Files
claude-mem/plugin/scripts/search-server.js
T
Alex Newman 002f7a94b8 feat: Release v4.0.0 - Plugin data directory and auto-starting worker
BREAKING CHANGES:
- Data directory moved from ~/.claude-mem/ to ${CLAUDE_PLUGIN_ROOT}/data/
- Fresh start required - no migration from v3.x databases
- Worker service now auto-starts on SessionStart hook

New Features:
- MCP Search Server with 6 specialized search tools
- FTS5 full-text search across observations and sessions
- Auto-starting worker service in SessionStart hook
- Citation support for search results (claude-mem:// URIs)

Changes:
- Updated paths.ts to use CLAUDE_PLUGIN_ROOT for data directory
- Added worker auto-start logic to context hook
- Updated worker service to write port file to plugin data dir
- Bumped version to 4.0.0 in package.json and plugin.json
- Created comprehensive CHANGELOG.md documenting v4.0.0 changes
- Updated README.md with v4.0.0 breaking changes and features
- Rebuilt all hooks and worker service

Technical Improvements:
- Improved error handling and graceful degradation
- Structured logging across all components
- Enhanced plugin integration with Claude Code

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 00:05:56 -04:00

138 lines
316 KiB
JavaScript
Executable File

#!/usr/bin/env node
#!/usr/bin/env node
var Bi=Object.defineProperty;var Qi=(s,t)=>{for(var r in t)Bi(s,r,{get:t[r],enumerable:!0})};import*as ie from"fs";import{stat as Do}from"fs/promises";import{join as Ec}from"path";import{homedir as wc}from"os";import{dirname as Rc,join as On}from"path";import{cwd as dn}from"process";import{randomUUID as Tc}from"crypto";var Gi=Object.create,Ji=Object.getPrototypeOf,cs=Object.defineProperty,Wi=Object.getOwnPropertyNames,Ki=Object.prototype.hasOwnProperty,Yi=(s,t,r)=>{r=s!=null?Gi(Ji(s)):{};let e=t||!s||!s.__esModule?cs(r,"default",{value:s,enumerable:!0}):r;for(let n of Wi(s))Ki.call(e,n)||cs(e,n,{get:()=>s[n],enumerable:!0});return e},ce=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Xi=(s,t)=>{for(var r in t)cs(s,r,{get:t[r],enumerable:!0,configurable:!0,set:e=>t[r]=()=>e})},eo=ce((s,t)=>{(function(r,e){typeof s=="object"&&typeof t<"u"?e(s):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(s,function(r){function e(){for(var v=arguments.length,h=Array(v),S=0;S<v;S++)h[S]=arguments[S];if(h.length>1){h[0]=h[0].slice(0,-1);for(var C=h.length-1,I=1;I<C;++I)h[I]=h[I].slice(1,-1);return h[C]=h[C].slice(1),h.join("")}else return h[0]}function n(v){return"(?:"+v+")"}function i(v){return v===void 0?"undefined":v===null?"null":Object.prototype.toString.call(v).split(" ").pop().split("]").shift().toLowerCase()}function a(v){return v.toUpperCase()}function o(v){return v!=null?v instanceof Array?v:typeof v.length!="number"||v.split||v.setInterval||v.call?[v]:Array.prototype.slice.call(v):[]}function c(v,h){var S=v;if(h)for(var C in h)S[C]=h[C];return S}function l(v){var h="[A-Za-z]",S="[\\x0D]",C="[0-9]",I="[\\x22]",W=e(C,"[A-Fa-f]"),me="[\\x0A]",we="[\\x20]",ke=n(n("%[EFef]"+W+"%"+W+W+"%"+W+W)+"|"+n("%[89A-Fa-f]"+W+"%"+W+W)+"|"+n("%"+W+W)),Ze="[\\:\\/\\?\\#\\[\\]\\@]",xe="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Me=e(Ze,xe),Ve=v?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Ne=v?"[\\uE000-\\uF8FF]":"[]",Re=e(h,C,"[\\-\\.\\_\\~]",Ve),Le=n(h+e(h,C,"[\\+\\-\\.]")+"*"),Oe=n(n(ke+"|"+e(Re,xe,"[\\:]"))+"*"),er=n(n("25[0-5]")+"|"+n("2[0-4]"+C)+"|"+n("1"+C+C)+"|"+n("[1-9]"+C)+"|"+C),ot=n(n("25[0-5]")+"|"+n("2[0-4]"+C)+"|"+n("1"+C+C)+"|"+n("0?[1-9]"+C)+"|0?0?"+C),ht=n(ot+"\\."+ot+"\\."+ot+"\\."+ot),Ie=n(W+"{1,4}"),lt=n(n(Ie+"\\:"+Ie)+"|"+ht),pt=n(n(Ie+"\\:")+"{6}"+lt),kt=n("\\:\\:"+n(Ie+"\\:")+"{5}"+lt),tr=n(n(Ie)+"?\\:\\:"+n(Ie+"\\:")+"{4}"+lt),Dt=n(n(n(Ie+"\\:")+"{0,1}"+Ie)+"?\\:\\:"+n(Ie+"\\:")+"{3}"+lt),fa=n(n(n(Ie+"\\:")+"{0,2}"+Ie)+"?\\:\\:"+n(Ie+"\\:")+"{2}"+lt),$a=n(n(n(Ie+"\\:")+"{0,3}"+Ie)+"?\\:\\:"+Ie+"\\:"+lt),Aa=n(n(n(Ie+"\\:")+"{0,4}"+Ie)+"?\\:\\:"+lt),Mr=n(n(n(Ie+"\\:")+"{0,5}"+Ie)+"?\\:\\:"+Ie),Lr=n(n(n(Ie+"\\:")+"{0,6}"+Ie)+"?\\:\\:"),Nt=n([pt,kt,tr,Dt,fa,$a,Aa,Mr,Lr].join("|")),qr=n(n(Re+"|"+ke)+"+"),as=n(Nt+"\\%25"+qr),rr=n(Nt+n("\\%25|\\%(?!"+W+"{2})")+qr),Li=n("[vV]"+W+"+\\."+e(Re,xe,"[\\:]")+"+"),qi=n("\\["+n(rr+"|"+Nt+"|"+Li)+"\\]"),Ys=n(n(ke+"|"+e(Re,xe))+"*"),ha=n(qi+"|"+ht+"(?!"+Ys+")|"+Ys),pa=n(C+"*"),Xs=n(n(Oe+"@")+"?"+ha+n("\\:"+pa)+"?"),ma=n(ke+"|"+e(Re,xe,"[\\:\\@]")),Ui=n(ma+"*"),en=n(ma+"+"),zi=n(n(ke+"|"+e(Re,xe,"[\\@]"))+"+"),Ft=n(n("\\/"+Ui)+"*"),Ur=n("\\/"+n(en+Ft)+"?"),ss=n(zi+Ft),ja=n(en+Ft),zr="(?!"+ma+")",Zh=n(Ft+"|"+Ur+"|"+ss+"|"+ja+"|"+zr),Zr=n(n(ma+"|"+e("[\\/\\?]",Ne))+"*"),va=n(n(ma+"|[\\/\\?]")+"*"),tn=n(n("\\/\\/"+Xs+Ft)+"|"+Ur+"|"+ja+"|"+zr),Zi=n(Le+"\\:"+tn+n("\\?"+Zr)+"?"+n("\\#"+va)+"?"),Vi=n(n("\\/\\/"+Xs+Ft)+"|"+Ur+"|"+ss+"|"+zr),Hi=n(Vi+n("\\?"+Zr)+"?"+n("\\#"+va)+"?"),Vh=n(Zi+"|"+Hi),Hh=n(Le+"\\:"+tn+n("\\?"+Zr)+"?"),Bh="^("+Le+")\\:"+n(n("\\/\\/("+n("("+Oe+")@")+"?("+ha+")"+n("\\:("+pa+")")+"?)")+"?("+Ft+"|"+Ur+"|"+ja+"|"+zr+")")+n("\\?("+Zr+")")+"?"+n("\\#("+va+")")+"?$",Qh="^(){0}"+n(n("\\/\\/("+n("("+Oe+")@")+"?("+ha+")"+n("\\:("+pa+")")+"?)")+"?("+Ft+"|"+Ur+"|"+ss+"|"+zr+")")+n("\\?("+Zr+")")+"?"+n("\\#("+va+")")+"?$",Gh="^("+Le+")\\:"+n(n("\\/\\/("+n("("+Oe+")@")+"?("+ha+")"+n("\\:("+pa+")")+"?)")+"?("+Ft+"|"+Ur+"|"+ja+"|"+zr+")")+n("\\?("+Zr+")")+"?$",Jh="^"+n("\\#("+va+")")+"?$",Wh="^"+n("("+Oe+")@")+"?("+ha+")"+n("\\:("+pa+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",h,C,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Re,xe),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Re,xe),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Re,xe),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Re,xe),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Re,xe,"[\\:\\@\\/\\?]",Ne),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Re,xe,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Re,xe),"g"),UNRESERVED:new RegExp(Re,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Re,Me),"g"),PCT_ENCODED:new RegExp(ke,"g"),IPV4ADDRESS:new RegExp("^("+ht+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Nt+")"+n(n("\\%25|\\%(?!"+W+"{2})")+"("+qr+")")+"?\\]?$")}}var f=l(!1),y=l(!0),R=function(){function v(h,S){var C=[],I=!0,W=!1,me=void 0;try{for(var we=h[Symbol.iterator](),ke;!(I=(ke=we.next()).done)&&(C.push(ke.value),!(S&&C.length===S));I=!0);}catch(Ze){W=!0,me=Ze}finally{try{!I&&we.return&&we.return()}finally{if(W)throw me}}return C}return function(h,S){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return v(h,S);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),m=function(v){if(Array.isArray(v)){for(var h=0,S=Array(v.length);h<v.length;h++)S[h]=v[h];return S}else return Array.from(v)},b=2147483647,d=36,p=1,_=26,g=38,x=700,$=72,O=128,E="-",T=/^xn--/,A=/[^\0-\x7E]/,D=/[\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"},j=d-p,w=Math.floor,k=String.fromCharCode;function N(v){throw new RangeError(F[v])}function U(v,h){for(var S=[],C=v.length;C--;)S[C]=h(v[C]);return S}function H(v,h){var S=v.split("@"),C="";S.length>1&&(C=S[0]+"@",v=S[1]),v=v.replace(D,".");var I=v.split("."),W=U(I,h).join(".");return C+W}function Y(v){for(var h=[],S=0,C=v.length;S<C;){var I=v.charCodeAt(S++);if(I>=55296&&I<=56319&&S<C){var W=v.charCodeAt(S++);(W&64512)==56320?h.push(((I&1023)<<10)+(W&1023)+65536):(h.push(I),S--)}else h.push(I)}return h}var _e=function(h){return String.fromCodePoint.apply(String,m(h))},se=function(h){return h-48<10?h-22:h-65<26?h-65:h-97<26?h-97:d},ve=function(h,S){return h+22+75*(h<26)-((S!=0)<<5)},le=function(h,S,C){var I=0;for(h=C?w(h/x):h>>1,h+=w(h/S);h>j*_>>1;I+=d)h=w(h/j);return w(I+(j+1)*h/(h+g))},ue=function(h){var S=[],C=h.length,I=0,W=O,me=$,we=h.lastIndexOf(E);we<0&&(we=0);for(var ke=0;ke<we;++ke)h.charCodeAt(ke)>=128&&N("not-basic"),S.push(h.charCodeAt(ke));for(var Ze=we>0?we+1:0;Ze<C;){for(var xe=I,Me=1,Ve=d;;Ve+=d){Ze>=C&&N("invalid-input");var Ne=se(h.charCodeAt(Ze++));(Ne>=d||Ne>w((b-I)/Me))&&N("overflow"),I+=Ne*Me;var Re=Ve<=me?p:Ve>=me+_?_:Ve-me;if(Ne<Re)break;var Le=d-Re;Me>w(b/Le)&&N("overflow"),Me*=Le}var Oe=S.length+1;me=le(I-xe,Oe,xe==0),w(I/Oe)>b-W&&N("overflow"),W+=w(I/Oe),I%=Oe,S.splice(I++,0,W)}return String.fromCodePoint.apply(String,S)},Be=function(h){var S=[];h=Y(h);var C=h.length,I=O,W=0,me=$,we=!0,ke=!1,Ze=void 0;try{for(var xe=h[Symbol.iterator](),Me;!(we=(Me=xe.next()).done);we=!0){var Ve=Me.value;Ve<128&&S.push(k(Ve))}}catch(rr){ke=!0,Ze=rr}finally{try{!we&&xe.return&&xe.return()}finally{if(ke)throw Ze}}var Ne=S.length,Re=Ne;for(Ne&&S.push(E);Re<C;){var Le=b,Oe=!0,er=!1,ot=void 0;try{for(var ht=h[Symbol.iterator](),Ie;!(Oe=(Ie=ht.next()).done);Oe=!0){var lt=Ie.value;lt>=I&&lt<Le&&(Le=lt)}}catch(rr){er=!0,ot=rr}finally{try{!Oe&&ht.return&&ht.return()}finally{if(er)throw ot}}var pt=Re+1;Le-I>w((b-W)/pt)&&N("overflow"),W+=(Le-I)*pt,I=Le;var kt=!0,tr=!1,Dt=void 0;try{for(var fa=h[Symbol.iterator](),$a;!(kt=($a=fa.next()).done);kt=!0){var Aa=$a.value;if(Aa<I&&++W>b&&N("overflow"),Aa==I){for(var Mr=W,Lr=d;;Lr+=d){var Nt=Lr<=me?p:Lr>=me+_?_:Lr-me;if(Mr<Nt)break;var qr=Mr-Nt,as=d-Nt;S.push(k(ve(Nt+qr%as,0))),Mr=w(qr/as)}S.push(k(ve(Mr,0))),me=le(W,pt,Re==Ne),W=0,++Re}}}catch(rr){tr=!0,Dt=rr}finally{try{!kt&&fa.return&&fa.return()}finally{if(tr)throw Dt}}++W,++I}return S.join("")},We=function(h){return H(h,function(S){return T.test(S)?ue(S.slice(4).toLowerCase()):S})},Qe=function(h){return H(h,function(S){return A.test(S)?"xn--"+Be(S):S})},$e={version:"2.1.0",ucs2:{decode:Y,encode:_e},decode:ue,encode:Be,toASCII:Qe,toUnicode:We},Fe={};function P(v){var h=v.charCodeAt(0),S=void 0;return h<16?S="%0"+h.toString(16).toUpperCase():h<128?S="%"+h.toString(16).toUpperCase():h<2048?S="%"+(h>>6|192).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase():S="%"+(h>>12|224).toString(16).toUpperCase()+"%"+(h>>6&63|128).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase(),S}function M(v){for(var h="",S=0,C=v.length;S<C;){var I=parseInt(v.substr(S+1,2),16);if(I<128)h+=String.fromCharCode(I),S+=3;else if(I>=194&&I<224){if(C-S>=6){var W=parseInt(v.substr(S+4,2),16);h+=String.fromCharCode((I&31)<<6|W&63)}else h+=v.substr(S,6);S+=6}else if(I>=224){if(C-S>=9){var me=parseInt(v.substr(S+4,2),16),we=parseInt(v.substr(S+7,2),16);h+=String.fromCharCode((I&15)<<12|(me&63)<<6|we&63)}else h+=v.substr(S,9);S+=9}else h+=v.substr(S,3),S+=3}return h}function X(v,h){function S(C){var I=M(C);return I.match(h.UNRESERVED)?I:C}return v.scheme&&(v.scheme=String(v.scheme).replace(h.PCT_ENCODED,S).toLowerCase().replace(h.NOT_SCHEME,"")),v.userinfo!==void 0&&(v.userinfo=String(v.userinfo).replace(h.PCT_ENCODED,S).replace(h.NOT_USERINFO,P).replace(h.PCT_ENCODED,a)),v.host!==void 0&&(v.host=String(v.host).replace(h.PCT_ENCODED,S).toLowerCase().replace(h.NOT_HOST,P).replace(h.PCT_ENCODED,a)),v.path!==void 0&&(v.path=String(v.path).replace(h.PCT_ENCODED,S).replace(v.scheme?h.NOT_PATH:h.NOT_PATH_NOSCHEME,P).replace(h.PCT_ENCODED,a)),v.query!==void 0&&(v.query=String(v.query).replace(h.PCT_ENCODED,S).replace(h.NOT_QUERY,P).replace(h.PCT_ENCODED,a)),v.fragment!==void 0&&(v.fragment=String(v.fragment).replace(h.PCT_ENCODED,S).replace(h.NOT_FRAGMENT,P).replace(h.PCT_ENCODED,a)),v}function de(v){return v.replace(/^0*(.*)/,"$1")||"0"}function L(v,h){var S=v.match(h.IPV4ADDRESS)||[],C=R(S,2),I=C[1];return I?I.split(".").map(de).join("."):v}function V(v,h){var S=v.match(h.IPV6ADDRESS)||[],C=R(S,3),I=C[1],W=C[2];if(I){for(var me=I.toLowerCase().split("::").reverse(),we=R(me,2),ke=we[0],Ze=we[1],xe=Ze?Ze.split(":").map(de):[],Me=ke.split(":").map(de),Ve=h.IPV4ADDRESS.test(Me[Me.length-1]),Ne=Ve?7:8,Re=Me.length-Ne,Le=Array(Ne),Oe=0;Oe<Ne;++Oe)Le[Oe]=xe[Oe]||Me[Re+Oe]||"";Ve&&(Le[Ne-1]=L(Le[Ne-1],h));var er=Le.reduce(function(pt,kt,tr){if(!kt||kt==="0"){var Dt=pt[pt.length-1];Dt&&Dt.index+Dt.length===tr?Dt.length++:pt.push({index:tr,length:1})}return pt},[]),ot=er.sort(function(pt,kt){return kt.length-pt.length})[0],ht=void 0;if(ot&&ot.length>1){var Ie=Le.slice(0,ot.index),lt=Le.slice(ot.index+ot.length);ht=Ie.join(":")+"::"+lt.join(":")}else ht=Le.join(":");return W&&(ht+="%"+W),ht}else return v}var ye=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Se="".match(/(){0}/)[1]===void 0;function oe(v){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S={},C=h.iri!==!1?y:f;h.reference==="suffix"&&(v=(h.scheme?h.scheme+":":"")+"//"+v);var I=v.match(ye);if(I){Se?(S.scheme=I[1],S.userinfo=I[3],S.host=I[4],S.port=parseInt(I[5],10),S.path=I[6]||"",S.query=I[7],S.fragment=I[8],isNaN(S.port)&&(S.port=I[5])):(S.scheme=I[1]||void 0,S.userinfo=v.indexOf("@")!==-1?I[3]:void 0,S.host=v.indexOf("//")!==-1?I[4]:void 0,S.port=parseInt(I[5],10),S.path=I[6]||"",S.query=v.indexOf("?")!==-1?I[7]:void 0,S.fragment=v.indexOf("#")!==-1?I[8]:void 0,isNaN(S.port)&&(S.port=v.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),S.host&&(S.host=V(L(S.host,C),C)),S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&!S.path&&S.query===void 0?S.reference="same-document":S.scheme===void 0?S.reference="relative":S.fragment===void 0?S.reference="absolute":S.reference="uri",h.reference&&h.reference!=="suffix"&&h.reference!==S.reference&&(S.error=S.error||"URI is not a "+h.reference+" reference.");var W=Fe[(h.scheme||S.scheme||"").toLowerCase()];if(!h.unicodeSupport&&(!W||!W.unicodeSupport)){if(S.host&&(h.domainHost||W&&W.domainHost))try{S.host=$e.toASCII(S.host.replace(C.PCT_ENCODED,M).toLowerCase())}catch(me){S.error=S.error||"Host's domain name can not be converted to ASCII via punycode: "+me}X(S,f)}else X(S,C);W&&W.parse&&W.parse(S,h)}else S.error=S.error||"URI can not be parsed.";return S}function Ae(v,h){var S=h.iri!==!1?y:f,C=[];return v.userinfo!==void 0&&(C.push(v.userinfo),C.push("@")),v.host!==void 0&&C.push(V(L(String(v.host),S),S).replace(S.IPV6ADDRESS,function(I,W,me){return"["+W+(me?"%25"+me:"")+"]"})),(typeof v.port=="number"||typeof v.port=="string")&&(C.push(":"),C.push(String(v.port))),C.length?C.join(""):void 0}var je=/^\.\.?\//,Pe=/^\/\.(\/|$)/,Ge=/^\/\.\.(\/|$)/,ze=/^\/?(?:.|\n)*?(?=\/|$)/;function Xe(v){for(var h=[];v.length;)if(v.match(je))v=v.replace(je,"");else if(v.match(Pe))v=v.replace(Pe,"/");else if(v.match(Ge))v=v.replace(Ge,"/"),h.pop();else if(v==="."||v==="..")v="";else{var S=v.match(ze);if(S){var C=S[0];v=v.slice(C.length),h.push(C)}else throw new Error("Unexpected dot segment condition")}return h.join("")}function De(v){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=h.iri?y:f,C=[],I=Fe[(h.scheme||v.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize(v,h),v.host&&!S.IPV6ADDRESS.test(v.host)){if(h.domainHost||I&&I.domainHost)try{v.host=h.iri?$e.toUnicode(v.host):$e.toASCII(v.host.replace(S.PCT_ENCODED,M).toLowerCase())}catch(we){v.error=v.error||"Host's domain name can not be converted to "+(h.iri?"Unicode":"ASCII")+" via punycode: "+we}}X(v,S),h.reference!=="suffix"&&v.scheme&&(C.push(v.scheme),C.push(":"));var W=Ae(v,h);if(W!==void 0&&(h.reference!=="suffix"&&C.push("//"),C.push(W),v.path&&v.path.charAt(0)!=="/"&&C.push("/")),v.path!==void 0){var me=v.path;!h.absolutePath&&(!I||!I.absolutePath)&&(me=Xe(me)),W===void 0&&(me=me.replace(/^\/\//,"/%2F")),C.push(me)}return v.query!==void 0&&(C.push("?"),C.push(v.query)),v.fragment!==void 0&&(C.push("#"),C.push(v.fragment)),C.join("")}function He(v,h){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=arguments[3],I={};return C||(v=oe(De(v,S),S),h=oe(De(h,S),S)),S=S||{},!S.tolerant&&h.scheme?(I.scheme=h.scheme,I.userinfo=h.userinfo,I.host=h.host,I.port=h.port,I.path=Xe(h.path||""),I.query=h.query):(h.userinfo!==void 0||h.host!==void 0||h.port!==void 0?(I.userinfo=h.userinfo,I.host=h.host,I.port=h.port,I.path=Xe(h.path||""),I.query=h.query):(h.path?(h.path.charAt(0)==="/"?I.path=Xe(h.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?I.path="/"+h.path:v.path?I.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+h.path:I.path=h.path,I.path=Xe(I.path)),I.query=h.query):(I.path=v.path,h.query!==void 0?I.query=h.query:I.query=v.query),I.userinfo=v.userinfo,I.host=v.host,I.port=v.port),I.scheme=v.scheme),I.fragment=h.fragment,I}function ft(v,h,S){var C=c({scheme:"null"},S);return De(He(oe(v,C),oe(h,C),C,!0),C)}function it(v,h){return typeof v=="string"?v=De(oe(v,h),h):i(v)==="object"&&(v=oe(De(v,h),h)),v}function Ia(v,h,S){return typeof v=="string"?v=De(oe(v,S),S):i(v)==="object"&&(v=De(v,S)),typeof h=="string"?h=De(oe(h,S),S):i(h)==="object"&&(h=De(h,S)),v===h}function ts(v,h){return v&&v.toString().replace(!h||!h.iri?f.ESCAPE:y.ESCAPE,P)}function xt(v,h){return v&&v.toString().replace(!h||!h.iri?f.PCT_ENCODED:y.PCT_ENCODED,M)}var ua={scheme:"http",domainHost:!0,parse:function(h,S){return h.host||(h.error=h.error||"HTTP URIs must have a host."),h},serialize:function(h,S){var C=String(h.scheme).toLowerCase()==="https";return(h.port===(C?443:80)||h.port==="")&&(h.port=void 0),h.path||(h.path="/"),h}},Vs={scheme:"https",domainHost:ua.domainHost,parse:ua.parse,serialize:ua.serialize};function Hs(v){return typeof v.secure=="boolean"?v.secure:String(v.scheme).toLowerCase()==="wss"}var da={scheme:"ws",domainHost:!0,parse:function(h,S){var C=h;return C.secure=Hs(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C},serialize:function(h,S){if((h.port===(Hs(h)?443:80)||h.port==="")&&(h.port=void 0),typeof h.secure=="boolean"&&(h.scheme=h.secure?"wss":"ws",h.secure=void 0),h.resourceName){var C=h.resourceName.split("?"),I=R(C,2),W=I[0],me=I[1];h.path=W&&W!=="/"?W:void 0,h.query=me,h.resourceName=void 0}return h.fragment=void 0,h}},Bs={scheme:"wss",domainHost:da.domainHost,parse:da.parse,serialize:da.serialize},Ti={},ki=!0,Qs="[A-Za-z0-9\\-\\.\\_\\~"+(ki?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Tt="[0-9A-Fa-f]",Ci=n(n("%[EFef]"+Tt+"%"+Tt+Tt+"%"+Tt+Tt)+"|"+n("%[89A-Fa-f]"+Tt+"%"+Tt+Tt)+"|"+n("%"+Tt+Tt)),Oi="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ii="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",$i=e(Ii,'[\\"\\\\]'),Ai="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ji=new RegExp(Qs,"g"),Fr=new RegExp(Ci,"g"),Di=new RegExp(e("[^]",Oi,"[\\.]",'[\\"]',$i),"g"),Gs=new RegExp(e("[^]",Qs,Ai),"g"),Ni=Gs;function rs(v){var h=M(v);return h.match(ji)?h:v}var Js={scheme:"mailto",parse:function(h,S){var C=h,I=C.to=C.path?C.path.split(","):[];if(C.path=void 0,C.query){for(var W=!1,me={},we=C.query.split("&"),ke=0,Ze=we.length;ke<Ze;++ke){var xe=we[ke].split("=");switch(xe[0]){case"to":for(var Me=xe[1].split(","),Ve=0,Ne=Me.length;Ve<Ne;++Ve)I.push(Me[Ve]);break;case"subject":C.subject=xt(xe[1],S);break;case"body":C.body=xt(xe[1],S);break;default:W=!0,me[xt(xe[0],S)]=xt(xe[1],S);break}}W&&(C.headers=me)}C.query=void 0;for(var Re=0,Le=I.length;Re<Le;++Re){var Oe=I[Re].split("@");if(Oe[0]=xt(Oe[0]),S.unicodeSupport)Oe[1]=xt(Oe[1],S).toLowerCase();else try{Oe[1]=$e.toASCII(xt(Oe[1],S).toLowerCase())}catch(er){C.error=C.error||"Email address's domain name can not be converted to ASCII via punycode: "+er}I[Re]=Oe.join("@")}return C},serialize:function(h,S){var C=h,I=o(h.to);if(I){for(var W=0,me=I.length;W<me;++W){var we=String(I[W]),ke=we.lastIndexOf("@"),Ze=we.slice(0,ke).replace(Fr,rs).replace(Fr,a).replace(Di,P),xe=we.slice(ke+1);try{xe=S.iri?$e.toUnicode(xe):$e.toASCII(xt(xe,S).toLowerCase())}catch(Re){C.error=C.error||"Email address's domain name can not be converted to "+(S.iri?"Unicode":"ASCII")+" via punycode: "+Re}I[W]=Ze+"@"+xe}C.path=I.join(",")}var Me=h.headers=h.headers||{};h.subject&&(Me.subject=h.subject),h.body&&(Me.body=h.body);var Ve=[];for(var Ne in Me)Me[Ne]!==Ti[Ne]&&Ve.push(Ne.replace(Fr,rs).replace(Fr,a).replace(Gs,P)+"="+Me[Ne].replace(Fr,rs).replace(Fr,a).replace(Ni,P));return Ve.length&&(C.query=Ve.join("&")),C}},Fi=/^([^\:]+)\:(.*)/,Ws={scheme:"urn",parse:function(h,S){var C=h.path&&h.path.match(Fi),I=h;if(C){var W=S.scheme||I.scheme||"urn",me=C[1].toLowerCase(),we=C[2],ke=W+":"+(S.nid||me),Ze=Fe[ke];I.nid=me,I.nss=we,I.path=void 0,Ze&&(I=Ze.parse(I,S))}else I.error=I.error||"URN can not be parsed.";return I},serialize:function(h,S){var C=S.scheme||h.scheme||"urn",I=h.nid,W=C+":"+(S.nid||I),me=Fe[W];me&&(h=me.serialize(h,S));var we=h,ke=h.nss;return we.path=(I||S.nid)+":"+ke,we}},Mi=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ks={scheme:"urn:uuid",parse:function(h,S){var C=h;return C.uuid=C.nss,C.nss=void 0,!S.tolerant&&(!C.uuid||!C.uuid.match(Mi))&&(C.error=C.error||"UUID is not valid."),C},serialize:function(h,S){var C=h;return C.nss=(h.uuid||"").toLowerCase(),C}};Fe[ua.scheme]=ua,Fe[Vs.scheme]=Vs,Fe[da.scheme]=da,Fe[Bs.scheme]=Bs,Fe[Js.scheme]=Js,Fe[Ws.scheme]=Ws,Fe[Ks.scheme]=Ks,r.SCHEMES=Fe,r.pctEncChar=P,r.pctDecChars=M,r.parse=oe,r.removeDotSegments=Xe,r.serialize=De,r.resolveComponents=He,r.resolve=ft,r.normalize=it,r.equal=Ia,r.escapeComponent=ts,r.unescapeComponent=xt,Object.defineProperty(r,"__esModule",{value:!0})})}),Rs=ce((s,t)=>{t.exports=function r(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var i,a,o;if(Array.isArray(e)){if(i=e.length,i!=n.length)return!1;for(a=i;a--!==0;)if(!r(e[a],n[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),i=o.length,i!==Object.keys(n).length)return!1;for(a=i;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=i;a--!==0;){var c=o[a];if(!r(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}}),to=ce((s,t)=>{t.exports=function(e){for(var n=0,i=e.length,a=0,o;a<i;)n++,o=e.charCodeAt(a++),o>=55296&&o<=56319&&a<i&&(o=e.charCodeAt(a),(o&64512)==56320&&a++);return n}}),Yr=ce((s,t)=>{t.exports={copy:r,checkDataType:e,checkDataTypes:n,coerceToTypes:a,toHash:o,getProperty:f,escapeQuotes:y,equal:Rs(),ucs2length:to(),varOccurences:R,varReplace:m,schemaHasRules:b,schemaHasRulesExcept:d,schemaUnknownRules:p,toQuotedString:_,getPathExpr:g,getPath:x,getData:E,unescapeFragment:A,unescapeJsonPointer:j,escapeFragment:D,escapeJsonPointer:F};function r(w,k){k=k||{};for(var N in w)k[N]=w[N];return k}function e(w,k,N,U){var H=U?" !== ":" === ",Y=U?" || ":" && ",_e=U?"!":"",se=U?"":"!";switch(w){case"null":return k+H+"null";case"array":return _e+"Array.isArray("+k+")";case"object":return"("+_e+k+Y+"typeof "+k+H+'"object"'+Y+se+"Array.isArray("+k+"))";case"integer":return"(typeof "+k+H+'"number"'+Y+se+"("+k+" % 1)"+Y+k+H+k+(N?Y+_e+"isFinite("+k+")":"")+")";case"number":return"(typeof "+k+H+'"'+w+'"'+(N?Y+_e+"isFinite("+k+")":"")+")";default:return"typeof "+k+H+'"'+w+'"'}}function n(w,k,N){switch(w.length){case 1:return e(w[0],k,N,!0);default:var U="",H=o(w);H.array&&H.object&&(U=H.null?"(":"(!"+k+" || ",U+="typeof "+k+' !== "object")',delete H.null,delete H.array,delete H.object),H.number&&delete H.integer;for(var Y in H)U+=(U?" && ":"")+e(Y,k,N,!0);return U}}var i=o(["string","number","integer","boolean","null"]);function a(w,k){if(Array.isArray(k)){for(var N=[],U=0;U<k.length;U++){var H=k[U];(i[H]||w==="array"&&H==="array")&&(N[N.length]=H)}if(N.length)return N}else{if(i[k])return[k];if(w==="array"&&k==="array")return["array"]}}function o(w){for(var k={},N=0;N<w.length;N++)k[w[N]]=!0;return k}var c=/^[a-z$_][a-z$_0-9]*$/i,l=/'|\\/g;function f(w){return typeof w=="number"?"["+w+"]":c.test(w)?"."+w:"['"+y(w)+"']"}function y(w){return w.replace(l,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function R(w,k){k+="[^0-9]";var N=w.match(new RegExp(k,"g"));return N?N.length:0}function m(w,k,N){return k+="([^0-9])",N=N.replace(/\$/g,"$$$$"),w.replace(new RegExp(k,"g"),N+"$1")}function b(w,k){if(typeof w=="boolean")return!w;for(var N in w)if(k[N])return!0}function d(w,k,N){if(typeof w=="boolean")return!w&&N!="not";for(var U in w)if(U!=N&&k[U])return!0}function p(w,k){if(typeof w!="boolean"){for(var N in w)if(!k[N])return N}}function _(w){return"'"+y(w)+"'"}function g(w,k,N,U){var H=N?"'/' + "+k+(U?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):U?"'[' + "+k+" + ']'":"'[\\'' + "+k+" + '\\']'";return T(w,H)}function x(w,k,N){var U=_(N?"/"+F(k):f(k));return T(w,U)}var $=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function E(w,k,N){var U,H,Y,_e;if(w==="")return"rootData";if(w[0]=="/"){if(!$.test(w))throw new Error("Invalid JSON-pointer: "+w);H=w,Y="rootData"}else{if(_e=w.match(O),!_e)throw new Error("Invalid JSON-pointer: "+w);if(U=+_e[1],H=_e[2],H=="#"){if(U>=k)throw new Error("Cannot access property/index "+U+" levels up, current level is "+k);return N[k-U]}if(U>k)throw new Error("Cannot access data "+U+" levels up, current level is "+k);if(Y="data"+(k-U||""),!H)return Y}for(var se=Y,ve=H.split("/"),le=0;le<ve.length;le++){var ue=ve[le];ue&&(Y+=f(j(ue)),se+=" && "+Y)}return se}function T(w,k){return w=='""'?k:(w+" + "+k).replace(/([^\\])' \+ '/g,"$1")}function A(w){return j(decodeURIComponent(w))}function D(w){return encodeURIComponent(F(w))}function F(w){return w.replace(/~/g,"~0").replace(/\//g,"~1")}function j(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}}),xn=ce((s,t)=>{var r=Yr();t.exports=e;function e(n){r.copy(n,this)}}),ro=ce((s,t)=>{var r=t.exports=function(i,a,o){typeof a=="function"&&(o=a,a={}),o=a.cb||o;var c=typeof o=="function"?o:o.pre||function(){},l=o.post||function(){};e(a,c,l,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 e(i,a,o,c,l,f,y,R,m,b){if(c&&typeof c=="object"&&!Array.isArray(c)){a(c,l,f,y,R,m,b);for(var d in c){var p=c[d];if(Array.isArray(p)){if(d in r.arrayKeywords)for(var _=0;_<p.length;_++)e(i,a,o,p[_],l+"/"+d+"/"+_,f,l,d,c,_)}else if(d in r.propsKeywords){if(p&&typeof p=="object")for(var g in p)e(i,a,o,p[g],l+"/"+d+"/"+n(g),f,l,d,c,g)}else(d in r.keywords||i.allKeys&&!(d in r.skipKeywords))&&e(i,a,o,p,l+"/"+d,f,l,d,c)}o(c,l,f,y,R,m,b)}}function n(i){return i.replace(/~/g,"~0").replace(/\//g,"~1")}}),Ts=ce((s,t)=>{var r=eo(),e=Rs(),n=Yr(),i=xn(),a=ro();t.exports=o,o.normalizeId=x,o.fullPath=p,o.url=$,o.ids=O,o.inlineRef=m,o.schema=c;function o(E,T,A){var D=this._refs[A];if(typeof D=="string")if(this._refs[D])D=this._refs[D];else return o.call(this,E,T,D);if(D=D||this._schemas[A],D instanceof i)return m(D.schema,this._opts.inlineRefs)?D.schema:D.validate||this._compile(D);var F=c.call(this,T,A),j,w,k;return F&&(j=F.schema,T=F.root,k=F.baseId),j instanceof i?w=j.validate||E.call(this,j.schema,T,void 0,k):j!==void 0&&(w=m(j,this._opts.inlineRefs)?j:E.call(this,j,T,void 0,k)),w}function c(E,T){var A=r.parse(T),D=_(A),F=p(this._getId(E.schema));if(Object.keys(E.schema).length===0||D!==F){var j=x(D),w=this._refs[j];if(typeof w=="string")return l.call(this,E,w,A);if(w instanceof i)w.validate||this._compile(w),E=w;else if(w=this._schemas[j],w instanceof i){if(w.validate||this._compile(w),j==x(T))return{schema:w,root:E,baseId:F};E=w}else return;if(!E.schema)return;F=p(this._getId(E.schema))}return y.call(this,A,F,E.schema,E)}function l(E,T,A){var D=c.call(this,E,T);if(D){var F=D.schema,j=D.baseId;E=D.root;var w=this._getId(F);return w&&(j=$(j,w)),y.call(this,A,j,F,E)}}var f=n.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function y(E,T,A,D){if(E.fragment=E.fragment||"",E.fragment.slice(0,1)=="/"){for(var F=E.fragment.split("/"),j=1;j<F.length;j++){var w=F[j];if(w){if(w=n.unescapeFragment(w),A=A[w],A===void 0)break;var k;if(!f[w]&&(k=this._getId(A),k&&(T=$(T,k)),A.$ref)){var N=$(T,A.$ref),U=c.call(this,D,N);U&&(A=U.schema,D=U.root,T=U.baseId)}}}if(A!==void 0&&A!==D.schema)return{schema:A,root:D,baseId:T}}}var R=n.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function m(E,T){if(T===!1)return!1;if(T===void 0||T===!0)return b(E);if(T)return d(E)<=T}function b(E){var T;if(Array.isArray(E)){for(var A=0;A<E.length;A++)if(T=E[A],typeof T=="object"&&!b(T))return!1}else for(var D in E)if(D=="$ref"||(T=E[D],typeof T=="object"&&!b(T)))return!1;return!0}function d(E){var T=0,A;if(Array.isArray(E)){for(var D=0;D<E.length;D++)if(A=E[D],typeof A=="object"&&(T+=d(A)),T==1/0)return 1/0}else for(var F in E){if(F=="$ref")return 1/0;if(R[F])T++;else if(A=E[F],typeof A=="object"&&(T+=d(A)+1),T==1/0)return 1/0}return T}function p(E,T){T!==!1&&(E=x(E));var A=r.parse(E);return _(A)}function _(E){return r.serialize(E).split("#")[0]+"#"}var g=/#\/?$/;function x(E){return E?E.replace(g,""):""}function $(E,T){return T=x(T),r.resolve(E,T)}function O(E){var T=x(this._getId(E)),A={"":T},D={"":p(T,!1)},F={},j=this;return a(E,{allKeys:!0},function(w,k,N,U,H,Y,_e){if(k!==""){var se=j._getId(w),ve=A[U],le=D[U]+"/"+H;if(_e!==void 0&&(le+="/"+(typeof _e=="number"?_e:n.escapeFragment(_e))),typeof se=="string"){se=ve=x(ve?r.resolve(ve,se):se);var ue=j._refs[se];if(typeof ue=="string"&&(ue=j._refs[ue]),ue&&ue.schema){if(!e(w,ue.schema))throw new Error('id "'+se+'" resolves to more than one schema')}else if(se!=x(le))if(se[0]=="#"){if(F[se]&&!e(w,F[se]))throw new Error('id "'+se+'" resolves to more than one schema');F[se]=w}else j._refs[se]=le}A[k]=ve,D[k]=le}}),F}}),ks=ce((s,t)=>{var r=Ts();t.exports={Validation:i(e),MissingRef:i(n)};function e(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}n.message=function(a,o){return"can't resolve reference "+o+" from id "+a};function n(a,o,c){this.message=c||n.message(a,o),this.missingRef=r.url(a,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function i(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}}),En=ce((s,t)=>{t.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var n=typeof e.cycles=="boolean"?e.cycles:!1,i=e.cmp&&function(o){return function(c){return function(l,f){var y={key:l,value:c[l]},R={key:f,value:c[f]};return o(y,R)}}}(e.cmp),a=[];return function o(c){if(c&&c.toJSON&&typeof c.toJSON=="function"&&(c=c.toJSON()),c!==void 0){if(typeof c=="number")return isFinite(c)?""+c:"null";if(typeof c!="object")return JSON.stringify(c);var l,f;if(Array.isArray(c)){for(f="[",l=0;l<c.length;l++)l&&(f+=","),f+=o(c[l])||"null";return f+"]"}if(c===null)return"null";if(a.indexOf(c)!==-1){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var y=a.push(c)-1,R=Object.keys(c).sort(i&&i(c));for(f="",l=0;l<R.length;l++){var m=R[l],b=o(c[m]);b&&(f&&(f+=","),f+=JSON.stringify(m)+":"+b)}return a.splice(y,1),"{"+f+"}"}}(r)}}),wn=ce((s,t)=>{t.exports=function(e,n,i){var a="",o=e.schema.$async===!0,c=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.opts.strictKeywords){var f=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(f){var y="unknown keyword: "+f;if(e.opts.strictKeywords==="log")e.logger.warn(y);else throw new Error(y)}}if(e.isTop&&(a+=" var validate = ",o&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+l+" */")+" ")),typeof e.schema=="boolean"||!(c||e.schema.$ref)){var n="false schema",R=e.level,m=e.dataLevel,b=e.schema[n],d=e.schemaPath+e.util.getProperty(n),p=e.errSchemaPath+"/"+n,T=!e.opts.allErrors,F,_="data"+(m||""),E="valid"+R;if(e.schema===!1){e.isTop?T=!0:a+=" var "+E+" = false; ";var g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(F||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),a+=" } "):a+=" {} ";var x=a;a=g.pop(),!e.compositeRule&&T?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?o?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+E+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var $=e.isTop,R=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 O="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(O);else throw new Error(O)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var{level:R,dataLevel:m}=e,_="data"+(m||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),o&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+R+" = errors;"}var E="valid"+R,T=!e.opts.allErrors,A="",D="",F,j=e.schema.type,w=Array.isArray(j);if(j&&e.opts.nullable&&e.schema.nullable===!0&&(w?j.indexOf("null")==-1&&(j=j.concat("null")):j!="null"&&(j=[j,"null"],w=!0)),w&&j.length==1&&(j=j[0],w=!1),e.schema.$ref&&c){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&&(c=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),j){if(e.opts.coerceTypes)var k=e.util.coerceToTypes(e.opts.coerceTypes,j);var N=e.RULES.types[j];if(k||w||N===!0||N&&!ze(N)){var d=e.schemaPath+".type",p=e.errSchemaPath+"/type",d=e.schemaPath+".type",p=e.errSchemaPath+"/type",U=w?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[U](j,_,e.opts.strictNumbers,!0)+") { ",k){var H="dataType"+R,Y="coerced"+R;a+=" var "+H+" = typeof "+_+"; var "+Y+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+H+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+H+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+Y+" = "+_+"; } "),a+=" if ("+Y+" !== undefined) ; ";var _e=k;if(_e)for(var se,ve=-1,le=_e.length-1;ve<le;)se=_e[ve+=1],se=="string"?a+=" else if ("+H+" == 'number' || "+H+" == 'boolean') "+Y+" = '' + "+_+"; else if ("+_+" === null) "+Y+" = ''; ":se=="number"||se=="integer"?(a+=" else if ("+H+" == 'boolean' || "+_+" === null || ("+H+" == 'string' && "+_+" && "+_+" == +"+_+" ",se=="integer"&&(a+=" && !("+_+" % 1)"),a+=")) "+Y+" = +"+_+"; "):se=="boolean"?a+=" else if ("+_+" === 'false' || "+_+" === 0 || "+_+" === null) "+Y+" = false; else if ("+_+" === 'true' || "+_+" === 1) "+Y+" = true; ":se=="null"?a+=" else if ("+_+" === '' || "+_+" === 0 || "+_+" === false) "+Y+" = null; ":e.opts.coerceTypes=="array"&&se=="array"&&(a+=" else if ("+H+" == 'string' || "+H+" == 'number' || "+H+" == 'boolean' || "+_+" == null) "+Y+" = ["+_+"]; ");a+=" else { ";var g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",w?a+=""+j.join(","):a+=""+j,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",w?a+=""+j.join(","):a+=""+j,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),a+=" } "):a+=" {} ";var x=a;a=g.pop(),!e.compositeRule&&T?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+Y+" !== undefined) { ";var ue=m?"data"+(m-1||""):"parentData",Be=m?e.dataPathArr[m]:"parentDataProperty";a+=" "+_+" = "+Y+"; ",m||(a+="if ("+ue+" !== undefined)"),a+=" "+ue+"["+Be+"] = "+Y+"; } "}else{var g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",w?a+=""+j.join(","):a+=""+j,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",w?a+=""+j.join(","):a+=""+j,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),a+=" } "):a+=" {} ";var x=a;a=g.pop(),!e.compositeRule&&T?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!c)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",T&&(a+=" } if (errors === ",$?a+="0":a+="errs_"+R,a+=") { ",D+="}");else{var We=e.RULES;if(We){for(var N,Qe=-1,$e=We.length-1;Qe<$e;)if(N=We[Qe+=1],ze(N)){if(N.type&&(a+=" if ("+e.util.checkDataType(N.type,_,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(N.type=="object"&&e.schema.properties){var b=e.schema.properties,Fe=Object.keys(b),P=Fe;if(P)for(var M,X=-1,de=P.length-1;X<de;){M=P[X+=1];var L=b[M];if(L.default!==void 0){var V=_+e.util.getProperty(M);if(e.compositeRule){if(e.opts.strictDefaults){var O="default is ignored for: "+V;if(e.opts.strictDefaults==="log")e.logger.warn(O);else throw new Error(O)}}else a+=" if ("+V+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+V+" === null || "+V+" === '' "),a+=" ) "+V+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(L.default)+" ":a+=" "+JSON.stringify(L.default)+" ",a+="; "}}}else if(N.type=="array"&&Array.isArray(e.schema.items)){var ye=e.schema.items;if(ye){for(var L,ve=-1,Se=ye.length-1;ve<Se;)if(L=ye[ve+=1],L.default!==void 0){var V=_+"["+ve+"]";if(e.compositeRule){if(e.opts.strictDefaults){var O="default is ignored for: "+V;if(e.opts.strictDefaults==="log")e.logger.warn(O);else throw new Error(O)}}else a+=" if ("+V+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+V+" === null || "+V+" === '' "),a+=" ) "+V+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(L.default)+" ":a+=" "+JSON.stringify(L.default)+" ",a+="; "}}}}var oe=N.rules;if(oe){for(var Ae,je=-1,Pe=oe.length-1;je<Pe;)if(Ae=oe[je+=1],Xe(Ae)){var Ge=Ae.code(e,Ae.keyword,N.type);Ge&&(a+=" "+Ge+" ",T&&(A+="}"))}}if(T&&(a+=" "+A+" ",A=""),N.type&&(a+=" } ",j&&j===N.type&&!k)){a+=" else { ";var d=e.schemaPath+".type",p=e.errSchemaPath+"/type",g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",w?a+=""+j.join(","):a+=""+j,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",w?a+=""+j.join(","):a+=""+j,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),a+=" } "):a+=" {} ";var x=a;a=g.pop(),!e.compositeRule&&T?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}T&&(a+=" if (errors === ",$?a+="0":a+="errs_"+R,a+=") { ",D+="}")}}}T&&(a+=" "+D+" "),$?(o?(a+=" if (errors === 0) return data; ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0; "),a+=" }; return validate;"):a+=" var "+E+" = errors === errs_"+R+";";function ze(He){for(var ft=He.rules,it=0;it<ft.length;it++)if(Xe(ft[it]))return!0}function Xe(He){return e.schema[He.keyword]!==void 0||He.implements&&De(He)}function De(He){for(var ft=He.implements,it=0;it<ft.length;it++)if(e.schema[ft[it]]!==void 0)return!0}return a}}),ao=ce((s,t)=>{var r=Ts(),e=Yr(),n=ks(),i=En(),a=wn(),o=e.ucs2length,c=Rs(),l=n.Validation;t.exports=f;function f(x,$,O,E){var T=this,A=this._opts,D=[void 0],F={},j=[],w={},k=[],N={},U=[];$=$||{schema:x,refVal:D,refs:F};var H=y.call(this,x,$,E),Y=this._compilations[H.index];if(H.compiling)return Y.callValidate=ue;var _e=this._formats,se=this.RULES;try{var ve=Be(x,$,O,E);Y.validate=ve;var le=Y.callValidate;return le&&(le.schema=ve.schema,le.errors=null,le.refs=ve.refs,le.refVal=ve.refVal,le.root=ve.root,le.$async=ve.$async,A.sourceCode&&(le.source=ve.source)),ve}finally{R.call(this,x,$,E)}function ue(){var L=Y.validate,V=L.apply(this,arguments);return ue.errors=L.errors,V}function Be(L,V,ye,Se){var oe=!V||V&&V.schema==L;if(V.schema!=$.schema)return f.call(T,L,V,ye,Se);var Ae=L.$async===!0,je=a({isTop:!0,schema:L,isRoot:oe,baseId:Se,root:V,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:n.MissingRef,RULES:se,validate:a,util:e,resolve:r,resolveRef:We,usePattern:M,useDefault:X,useCustomRule:de,opts:A,formats:_e,logger:T.logger,self:T});je=g(D,p)+g(j,b)+g(k,d)+g(U,_)+je,A.processCode&&(je=A.processCode(je,L));var Pe;try{var Ge=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",je);Pe=Ge(T,se,_e,$,D,k,U,c,o,l),D[0]=Pe}catch(ze){throw T.logger.error("Error compiling schema, function code:",je),ze}return Pe.schema=L,Pe.errors=null,Pe.refs=F,Pe.refVal=D,Pe.root=oe?Pe:V,Ae&&(Pe.$async=!0),A.sourceCode===!0&&(Pe.source={code:je,patterns:j,defaults:k}),Pe}function We(L,V,ye){V=r.url(L,V);var Se=F[V],oe,Ae;if(Se!==void 0)return oe=D[Se],Ae="refVal["+Se+"]",P(oe,Ae);if(!ye&&$.refs){var je=$.refs[V];if(je!==void 0)return oe=$.refVal[je],Ae=Qe(V,oe),P(oe,Ae)}Ae=Qe(V);var Pe=r.call(T,Be,$,V);if(Pe===void 0){var Ge=O&&O[V];Ge&&(Pe=r.inlineRef(Ge,A.inlineRefs)?Ge:f.call(T,Ge,$,O,L))}if(Pe===void 0)$e(V);else return Fe(V,Pe),P(Pe,Ae)}function Qe(L,V){var ye=D.length;return D[ye]=V,F[L]=ye,"refVal"+ye}function $e(L){delete F[L]}function Fe(L,V){var ye=F[L];D[ye]=V}function P(L,V){return typeof L=="object"||typeof L=="boolean"?{code:V,schema:L,inline:!0}:{code:V,$async:L&&!!L.$async}}function M(L){var V=w[L];return V===void 0&&(V=w[L]=j.length,j[V]=L),"pattern"+V}function X(L){switch(typeof L){case"boolean":case"number":return""+L;case"string":return e.toQuotedString(L);case"object":if(L===null)return"null";var V=i(L),ye=N[V];return ye===void 0&&(ye=N[V]=k.length,k[ye]=L),"default"+ye}}function de(L,V,ye,Se){if(T._opts.validateSchema!==!1){var oe=L.definition.dependencies;if(oe&&!oe.every(function(ft){return Object.prototype.hasOwnProperty.call(ye,ft)}))throw new Error("parent schema must have all required keywords: "+oe.join(","));var Ae=L.definition.validateSchema;if(Ae){var je=Ae(V);if(!je){var Pe="keyword schema is invalid: "+T.errorsText(Ae.errors);if(T._opts.validateSchema=="log")T.logger.error(Pe);else throw new Error(Pe)}}}var Ge=L.definition.compile,ze=L.definition.inline,Xe=L.definition.macro,De;if(Ge)De=Ge.call(T,V,ye,Se);else if(Xe)De=Xe.call(T,V,ye,Se),A.validateSchema!==!1&&T.validateSchema(De,!0);else if(ze)De=ze.call(T,Se,L.keyword,V,ye);else if(De=L.definition.validate,!De)return;if(De===void 0)throw new Error('custom keyword "'+L.keyword+'"failed to compile');var He=U.length;return U[He]=De,{code:"customRule"+He,validate:De}}}function y(x,$,O){var E=m.call(this,x,$,O);return E>=0?{index:E,compiling:!0}:(E=this._compilations.length,this._compilations[E]={schema:x,root:$,baseId:O},{index:E,compiling:!1})}function R(x,$,O){var E=m.call(this,x,$,O);E>=0&&this._compilations.splice(E,1)}function m(x,$,O){for(var E=0;E<this._compilations.length;E++){var T=this._compilations[E];if(T.schema==x&&T.root==$&&T.baseId==O)return E}return-1}function b(x,$){return"var pattern"+x+" = new RegExp("+e.toQuotedString($[x])+");"}function d(x){return"var default"+x+" = defaults["+x+"];"}function p(x,$){return $[x]===void 0?"":"var refVal"+x+" = refVal["+x+"];"}function _(x){return"var customRule"+x+" = customRules["+x+"];"}function g(x,$){if(!x.length)return"";for(var O="",E=0;E<x.length;E++)O+=$(E,x);return O}}),so=ce((s,t)=>{var r=t.exports=function(){this._cache={}};r.prototype.put=function(n,i){this._cache[n]=i},r.prototype.get=function(n){return this._cache[n]},r.prototype.del=function(n){delete this._cache[n]},r.prototype.clear=function(){this._cache={}}}),no=ce((s,t)=>{var r=Yr(),e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,a=/^(?=.{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,o=/^(?:[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,c=/^(?:[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,l=/^(?:(?:[^\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,f=/^(?:(?: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,y=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,R=/^(?:\/(?:[^~/]|~0|~1)*)*$/,m=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,b=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;t.exports=d;function d(D){return D=D=="full"?"full":"fast",r.copy(d[D])}d.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":l,url:f,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:a,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:A,uuid:y,"json-pointer":R,"json-pointer-uri-fragment":m,"relative-json-pointer":b},d.full={date:_,time:g,"date-time":$,uri:E,"uri-reference":c,"uri-template":l,url:f,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:a,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:A,uuid:y,"json-pointer":R,"json-pointer-uri-fragment":m,"relative-json-pointer":b};function p(D){return D%4===0&&(D%100!==0||D%400===0)}function _(D){var F=D.match(e);if(!F)return!1;var j=+F[1],w=+F[2],k=+F[3];return w>=1&&w<=12&&k>=1&&k<=(w==2&&p(j)?29:n[w])}function g(D,F){var j=D.match(i);if(!j)return!1;var w=j[1],k=j[2],N=j[3],U=j[5];return(w<=23&&k<=59&&N<=59||w==23&&k==59&&N==60)&&(!F||U)}var x=/t|\s/i;function $(D){var F=D.split(x);return F.length==2&&_(F[0])&&g(F[1],!0)}var O=/\/|:/;function E(D){return O.test(D)&&o.test(D)}var T=/[^\\]\\Z/;function A(D){if(T.test(D))return!1;try{return new RegExp(D),!0}catch{return!1}}}),io=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.errSchemaPath+"/"+n,y=!e.opts.allErrors,R="data"+(c||""),m="valid"+o,b,d;if(l=="#"||l=="#/")e.isRoot?(b=e.async,d="validate"):(b=e.root.schema.$async===!0,d="root.refVal[0]");else{var p=e.resolveRef(e.baseId,l,e.isRoot);if(p===void 0){var _=e.MissingRefError.message(e.baseId,l);if(e.opts.missingRefs=="fail"){e.logger.error(_);var g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+R+" "),a+=" } "):a+=" {} ";var x=a;a=g.pop(),!e.compositeRule&&y?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",y&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),y&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,l,_)}else if(p.inline){var $=e.util.copy(e);$.level++;var O="valid"+$.level;$.schema=p.schema,$.schemaPath="",$.errSchemaPath=l;var E=e.validate($).replace(/validate\.schema/g,p.code);a+=" "+E+" ",y&&(a+=" if ("+O+") { ")}else b=p.$async===!0||e.async&&p.$async!==!1,d=p.code}if(d){var g=g||[];g.push(a),a="",e.opts.passContext?a+=" "+d+".call(this, ":a+=" "+d+"( ",a+=" "+R+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var T=c?"data"+(c-1||""):"parentData",A=c?e.dataPathArr[c]:"parentDataProperty";a+=" , "+T+" , "+A+", rootData) ";var D=a;if(a=g.pop(),b){if(!e.async)throw new Error("async schema referenced by sync schema");y&&(a+=" var "+m+"; "),a+=" try { await "+D+"; ",y&&(a+=" "+m+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",y&&(a+=" "+m+" = false; "),a+=" } ",y&&(a+=" if ("+m+") { ")}else a+=" if (!"+D+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",y&&(a+=" else { ")}return a}}),oo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.schema[n],c=e.schemaPath+e.util.getProperty(n),l=e.errSchemaPath+"/"+n,f=!e.opts.allErrors,y=e.util.copy(e),R="";y.level++;var m="valid"+y.level,b=y.baseId,d=!0,p=o;if(p)for(var _,g=-1,x=p.length-1;g<x;)_=p[g+=1],(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(d=!1,y.schema=_,y.schemaPath=c+"["+g+"]",y.errSchemaPath=l+"/"+g,a+=" "+e.validate(y)+" ",y.baseId=b,f&&(a+=" if ("+m+") { ",R+="}"));return f&&(d?a+=" if (true) { ":a+=" "+R.slice(0,-1)+" "),a}}),lo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d="errs__"+o,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,x=l.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(x){var $=p.baseId;a+=" var "+d+" = errors; var "+b+" = false; ";var O=e.compositeRule;e.compositeRule=p.compositeRule=!0;var E=l;if(E)for(var T,A=-1,D=E.length-1;A<D;)T=E[A+=1],p.schema=T,p.schemaPath=f+"["+A+"]",p.errSchemaPath=y+"/"+A,a+=" "+e.validate(p)+" ",p.baseId=$,a+=" "+b+" = "+b+" || "+g+"; if (!"+b+") { ",_+="}";e.compositeRule=p.compositeRule=O,a+=" "+_+" if (!"+b+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&R&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else R&&(a+=" if (true) { ");return a}}),co=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.schema[n],c=e.errSchemaPath+"/"+n,l=!e.opts.allErrors,f=e.util.toQuotedString(o);return e.opts.$comment===!0?a+=" console.log("+f+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+f+", "+e.util.toQuotedString(c)+", validate.root.schema);"),a}}),uo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d=e.opts.$data&&l&&l.$data,p;d?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",p="schema"+o):p=l,d||(a+=" var schema"+o+" = validate.schema"+f+";"),a+="var "+b+" = equal("+m+", schema"+o+"); if (!"+b+") { ";var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { allowedValue: schema"+o+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var g=a;return a=_.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",R&&(a+=" else { "),a}}),fo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d="errs__"+o,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,x="i"+o,$=p.dataLevel=e.dataLevel+1,O="data"+$,E=e.baseId,T=e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all);if(a+="var "+d+" = errors;var "+b+";",T){var A=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=l,p.schemaPath=f,p.errSchemaPath=y,a+=" var "+g+" = false; for (var "+x+" = 0; "+x+" < "+m+".length; "+x+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var D=m+"["+x+"]";p.dataPathArr[$]=x;var F=e.validate(p);p.baseId=E,e.util.varOccurences(F,O)<2?a+=" "+e.util.varReplace(F,O,D)+" ":a+=" var "+O+" = "+D+"; "+F+" ",a+=" if ("+g+") break; } ",e.compositeRule=p.compositeRule=A,a+=" "+_+" if (!"+g+") {"}else a+=" if ("+m+".length == 0) {";var j=j||[];j.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var w=a;return a=j.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",T&&(a+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}}),ho=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="errs__"+o,d=e.util.copy(e),p="";d.level++;var _="valid"+d.level,g={},x={},$=e.opts.ownProperties;for(A in l)if(A!="__proto__"){var O=l[A],E=Array.isArray(O)?x:g;E[A]=O}a+="var "+b+" = errors;";var T=e.errorPath;a+="var missing"+o+";";for(var A in x)if(E=x[A],E.length){if(a+=" if ( "+m+e.util.getProperty(A)+" !== undefined ",$&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(A)+"') "),R){a+=" && ( ";var D=E;if(D)for(var F,j=-1,w=D.length-1;j<w;){F=D[j+=1],j&&(a+=" || ");var k=e.util.getProperty(F),N=m+k;a+=" ( ( "+N+" === undefined ",$&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(F)+"') "),a+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:k)+") ) "}a+=")) { ";var U="missing"+o,H="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(T,U,!0):T+" + "+U);var Y=Y||[];Y.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+H+"', depsCount: "+E.length+", deps: '"+e.util.escapeQuotes(E.length==1?E[0]:E.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",E.length==1?a+="property "+e.util.escapeQuotes(E[0]):a+="properties "+e.util.escapeQuotes(E.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var _e=a;a=Y.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+_e+"]); ":a+=" validate.errors = ["+_e+"]; return false; ":a+=" var err = "+_e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var se=E;if(se)for(var F,ve=-1,le=se.length-1;ve<le;){F=se[ve+=1];var k=e.util.getProperty(F),H=e.util.escapeQuotes(F),N=m+k;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(T,F,e.opts.jsonPointers)),a+=" if ( "+N+" === undefined ",$&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(F)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+H+"', depsCount: "+E.length+", deps: '"+e.util.escapeQuotes(E.length==1?E[0]:E.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",E.length==1?a+="property "+e.util.escapeQuotes(E[0]):a+="properties "+e.util.escapeQuotes(E.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",R&&(p+="}",a+=" else { ")}e.errorPath=T;var ue=d.baseId;for(var A in g){var O=g[A];(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))&&(a+=" "+_+" = true; if ( "+m+e.util.getProperty(A)+" !== undefined ",$&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(A)+"') "),a+=") { ",d.schema=O,d.schemaPath=f+e.util.getProperty(A),d.errSchemaPath=y+"/"+e.util.escapeFragment(A),a+=" "+e.validate(d)+" ",d.baseId=ue,a+=" } ",R&&(a+=" if ("+_+") { ",p+="}"))}return R&&(a+=" "+p+" if ("+b+" == errors) {"),a}}),po=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d=e.opts.$data&&l&&l.$data,p;d?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",p="schema"+o):p=l;var _="i"+o,g="schema"+o;d||(a+=" var "+g+" = validate.schema"+f+";"),a+="var "+b+";",d&&(a+=" if (schema"+o+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+o+")) "+b+" = false; else {"),a+=""+b+" = false;for (var "+_+"=0; "+_+"<"+g+".length; "+_+"++) if (equal("+m+", "+g+"["+_+"])) { "+b+" = true; break; }",d&&(a+=" } "),a+=" if (!"+b+") { ";var x=x||[];x.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { allowedValues: schema"+o+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var $=a;return a=x.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+$+"]); ":a+=" validate.errors = ["+$+"]; return false; ":a+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",R&&(a+=" else { "),a}}),mo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||"");if(e.opts.format===!1)return R&&(a+=" if (true) { "),a;var b=e.opts.$data&&l&&l.$data,d;b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l;var p=e.opts.unknownFormats,_=Array.isArray(p);if(b){var g="format"+o,x="isObject"+o,$="formatType"+o;a+=" var "+g+" = formats["+d+"]; var "+x+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+$+" = "+x+" && "+g+".type || 'string'; if ("+x+") { ",e.async&&(a+=" var async"+o+" = "+g+".async; "),a+=" "+g+" = "+g+".validate; } if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),a+=" (",p!="ignore"&&(a+=" ("+d+" && !"+g+" ",_&&(a+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),a+=") || "),a+=" ("+g+" && "+$+" == '"+i+"' && !(typeof "+g+" == 'function' ? ",e.async?a+=" (async"+o+" ? await "+g+"("+m+") : "+g+"("+m+")) ":a+=" "+g+"("+m+") ",a+=" : "+g+".test("+m+"))))) {"}else{var g=e.formats[l];if(!g){if(p=="ignore")return e.logger.warn('unknown format "'+l+'" ignored in schema at path "'+e.errSchemaPath+'"'),R&&(a+=" if (true) { "),a;if(_&&p.indexOf(l)>=0)return R&&(a+=" if (true) { "),a;throw new Error('unknown format "'+l+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,$=x&&g.type||"string";if(x){var O=g.async===!0;g=g.validate}if($!=i)return R&&(a+=" if (true) { "),a;if(O){if(!e.async)throw new Error("async format in sync schema");var E="formats"+e.util.getProperty(l)+".validate";a+=" if (!(await "+E+"("+m+"))) { "}else{a+=" if (! ";var E="formats"+e.util.getProperty(l);x&&(E+=".validate"),typeof g=="function"?a+=" "+E+"("+m+") ":a+=" "+E+".test("+m+") ",a+=") { "}}var T=T||[];T.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { format: ",b?a+=""+d:a+=""+e.util.toQuotedString(l),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,b?a+="' + "+d+" + '":a+=""+e.util.escapeQuotes(l),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+e.util.toQuotedString(l),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var A=a;return a=T.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+A+"]); ":a+=" validate.errors = ["+A+"]; return false; ":a+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",R&&(a+=" else { "),a}}),vo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d="errs__"+o,p=e.util.copy(e);p.level++;var _="valid"+p.level,g=e.schema.then,x=e.schema.else,$=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),O=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),E=p.baseId;if($||O){var T;p.createErrors=!1,p.schema=l,p.schemaPath=f,p.errSchemaPath=y,a+=" var "+d+" = errors; var "+b+" = true; ";var A=e.compositeRule;e.compositeRule=p.compositeRule=!0,a+=" "+e.validate(p)+" ",p.baseId=E,p.createErrors=!0,a+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=p.compositeRule=A,$?(a+=" if ("+_+") { ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(p)+" ",p.baseId=E,a+=" "+b+" = "+_+"; ",$&&O?(T="ifClause"+o,a+=" var "+T+" = 'then'; "):T="'then'",a+=" } ",O&&(a+=" else { ")):a+=" if (!"+_+") { ",O&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(p)+" ",p.baseId=E,a+=" "+b+" = "+_+"; ",$&&O?(T="ifClause"+o,a+=" var "+T+" = 'else'; "):T="'else'",a+=" } "),a+=" if (!"+b+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { failingKeyword: "+T+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+T+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&R&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",R&&(a+=" else { ")}else R&&(a+=" if (true) { ");return a}}),go=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d="errs__"+o,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,x="i"+o,$=p.dataLevel=e.dataLevel+1,O="data"+$,E=e.baseId;if(a+="var "+d+" = errors;var "+b+";",Array.isArray(l)){var T=e.schema.additionalItems;if(T===!1){a+=" "+b+" = "+m+".length <= "+l.length+"; ";var A=y;y=e.errSchemaPath+"/additionalItems",a+=" if (!"+b+") { ";var D=D||[];D.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { limit: "+l.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+l.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var F=a;a=D.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+F+"]); ":a+=" validate.errors = ["+F+"]; return false; ":a+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",y=A,R&&(_+="}",a+=" else { ")}var j=l;if(j){for(var w,k=-1,N=j.length-1;k<N;)if(w=j[k+=1],e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all)){a+=" "+g+" = true; if ("+m+".length > "+k+") { ";var U=m+"["+k+"]";p.schema=w,p.schemaPath=f+"["+k+"]",p.errSchemaPath=y+"/"+k,p.errorPath=e.util.getPathExpr(e.errorPath,k,e.opts.jsonPointers,!0),p.dataPathArr[$]=k;var H=e.validate(p);p.baseId=E,e.util.varOccurences(H,O)<2?a+=" "+e.util.varReplace(H,O,U)+" ":a+=" var "+O+" = "+U+"; "+H+" ",a+=" } ",R&&(a+=" if ("+g+") { ",_+="}")}}if(typeof T=="object"&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))){p.schema=T,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+g+" = true; if ("+m+".length > "+l.length+") { for (var "+x+" = "+l.length+"; "+x+" < "+m+".length; "+x+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var U=m+"["+x+"]";p.dataPathArr[$]=x;var H=e.validate(p);p.baseId=E,e.util.varOccurences(H,O)<2?a+=" "+e.util.varReplace(H,O,U)+" ":a+=" var "+O+" = "+U+"; "+H+" ",R&&(a+=" if (!"+g+") break; "),a+=" } } ",R&&(a+=" if ("+g+") { ",_+="}")}}else if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){p.schema=l,p.schemaPath=f,p.errSchemaPath=y,a+=" for (var "+x+" = 0; "+x+" < "+m+".length; "+x+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var U=m+"["+x+"]";p.dataPathArr[$]=x;var H=e.validate(p);p.baseId=E,e.util.varOccurences(H,O)<2?a+=" "+e.util.varReplace(H,O,U)+" ":a+=" var "+O+" = "+U+"; "+H+" ",R&&(a+=" if (!"+g+") break; "),a+=" }"}return R&&(a+=" "+_+" if ("+d+" == errors) {"),a}}),rn=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,E,m="data"+(c||""),b=e.opts.$data&&l&&l.$data,d;b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l;var p=n=="maximum",_=p?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[_],x=e.opts.$data&&g&&g.$data,$=p?"<":">",O=p?">":"<",E=void 0;if(!(b||typeof l=="number"||l===void 0))throw new Error(n+" must be number");if(!(x||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(_+" must be number or boolean");if(x){var T=e.util.getData(g.$data,c,e.dataPathArr),A="exclusive"+o,D="exclType"+o,F="exclIsNumber"+o,j="op"+o,w="' + "+j+" + '";a+=" var schemaExcl"+o+" = "+T+"; ",T="schemaExcl"+o,a+=" var "+A+"; var "+D+" = typeof "+T+"; if ("+D+" != 'boolean' && "+D+" != 'undefined' && "+D+" != 'number') { ";var E=_,k=k||[];k.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var N=a;a=k.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+N+"]); ":a+=" validate.errors = ["+N+"]; return false; ":a+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),a+=" "+D+" == 'number' ? ( ("+A+" = "+d+" === undefined || "+T+" "+$+"= "+d+") ? "+m+" "+O+"= "+T+" : "+m+" "+O+" "+d+" ) : ( ("+A+" = "+T+" === true) ? "+m+" "+O+"= "+d+" : "+m+" "+O+" "+d+" ) || "+m+" !== "+m+") { var op"+o+" = "+A+" ? '"+$+"' : '"+$+"='; ",l===void 0&&(E=_,y=e.errSchemaPath+"/"+_,d=T,b=x)}else{var F=typeof g=="number",w=$;if(F&&b){var j="'"+w+"'";a+=" if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),a+=" ( "+d+" === undefined || "+g+" "+$+"= "+d+" ? "+m+" "+O+"= "+g+" : "+m+" "+O+" "+d+" ) || "+m+" !== "+m+") { "}else{F&&l===void 0?(A=!0,E=_,y=e.errSchemaPath+"/"+_,d=g,O+="="):(F&&(d=Math[p?"min":"max"](g,l)),g===(F?d:!0)?(A=!0,E=_,y=e.errSchemaPath+"/"+_,O+="="):(A=!1,w+="="));var j="'"+w+"'";a+=" if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),a+=" "+m+" "+O+" "+d+" || "+m+" !== "+m+") { "}}E=E||n;var k=k||[];k.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { comparison: "+j+", limit: "+d+", exclusive: "+A+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+w+" ",b?a+="' + "+d:a+=""+d+"'"),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+l,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var N=a;return a=k.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+N+"]); ":a+=" validate.errors = ["+N+"]; return false; ":a+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",R&&(a+=" else { "),a}}),an=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,_,m="data"+(c||""),b=e.opts.$data&&l&&l.$data,d;if(b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l,!(b||typeof l=="number"))throw new Error(n+" must be number");var p=n=="maxItems"?">":"<";a+="if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),a+=" "+m+".length "+p+" "+d+") { ";var _=n,g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",n=="maxItems"?a+="more":a+="fewer",a+=" than ",b?a+="' + "+d+" + '":a+=""+l,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+l,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var x=a;return a=g.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",R&&(a+=" else { "),a}}),sn=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,_,m="data"+(c||""),b=e.opts.$data&&l&&l.$data,d;if(b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l,!(b||typeof l=="number"))throw new Error(n+" must be number");var p=n=="maxLength"?">":"<";a+="if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?a+=" "+m+".length ":a+=" ucs2length("+m+") ",a+=" "+p+" "+d+") { ";var _=n,g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",n=="maxLength"?a+="longer":a+="shorter",a+=" than ",b?a+="' + "+d+" + '":a+=""+l,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+l,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var x=a;return a=g.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",R&&(a+=" else { "),a}}),nn=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,_,m="data"+(c||""),b=e.opts.$data&&l&&l.$data,d;if(b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l,!(b||typeof l=="number"))throw new Error(n+" must be number");var p=n=="maxProperties"?">":"<";a+="if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),a+=" Object.keys("+m+").length "+p+" "+d+") { ";var _=n,g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",n=="maxProperties"?a+="more":a+="fewer",a+=" than ",b?a+="' + "+d+" + '":a+=""+l,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+l,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var x=a;return a=g.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",R&&(a+=" else { "),a}}),yo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b=e.opts.$data&&l&&l.$data,d;if(b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l,!(b||typeof l=="number"))throw new Error(n+" must be number");a+="var division"+o+";if (",b&&(a+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),a+=" (division"+o+" = "+m+" / "+d+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+o+" !== parseInt(division"+o+") ",a+=" ) ",b&&(a+=" ) "),a+=" ) { ";var p=p||[];p.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",b?a+="' + "+d:a+=""+d+"'"),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+l,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var _=a;return a=p.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+_+"]); ":a+=" validate.errors = ["+_+"]; return false; ":a+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",R&&(a+=" else { "),a}}),_o=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="errs__"+o,d=e.util.copy(e);d.level++;var p="valid"+d.level;if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=f,d.errSchemaPath=y,a+=" var "+b+" = errors; ";var _=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var g;d.opts.allErrors&&(g=d.opts.allErrors,d.opts.allErrors=!1),a+=" "+e.validate(d)+" ",d.createErrors=!0,g&&(d.opts.allErrors=g),e.compositeRule=d.compositeRule=_,a+=" if ("+p+") { ";var x=x||[];x.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var $=a;a=x.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+$+"]); ":a+=" validate.errors = ["+$+"]; return false; ":a+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+b+"; if (vErrors !== null) { if ("+b+") vErrors.length = "+b+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",R&&(a+=" if (false) { ");return a}}),bo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d="errs__"+o,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,x=p.baseId,$="prevValid"+o,O="passingSchemas"+o;a+="var "+d+" = errors , "+$+" = false , "+b+" = false , "+O+" = null; ";var E=e.compositeRule;e.compositeRule=p.compositeRule=!0;var T=l;if(T)for(var A,D=-1,F=T.length-1;D<F;)A=T[D+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(p.schema=A,p.schemaPath=f+"["+D+"]",p.errSchemaPath=y+"/"+D,a+=" "+e.validate(p)+" ",p.baseId=x):a+=" var "+g+" = true; ",D&&(a+=" if ("+g+" && "+$+") { "+b+" = false; "+O+" = ["+O+", "+D+"]; } else { ",_+="}"),a+=" if ("+g+") { "+b+" = "+$+" = true; "+O+" = "+D+"; }";return e.compositeRule=p.compositeRule=E,a+=""+_+"if (!"+b+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { passingSchemas: "+O+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&R&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}}),So=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b=e.opts.$data&&l&&l.$data,d;b?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",d="schema"+o):d=l;var p=b?"(new RegExp("+d+"))":e.usePattern(l);a+="if ( ",b&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),a+=" !"+p+".test("+m+") ) { ";var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { pattern: ",b?a+=""+d:a+=""+e.util.toQuotedString(l),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,b?a+="' + "+d+" + '":a+=""+e.util.escapeQuotes(l),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",b?a+="validate.schema"+f:a+=""+e.util.toQuotedString(l),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var g=a;return a=_.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",R&&(a+=" else { "),a}}),xo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="errs__"+o,d=e.util.copy(e),p="";d.level++;var _="valid"+d.level,g="key"+o,x="idx"+o,$=d.dataLevel=e.dataLevel+1,O="data"+$,E="dataProperties"+o,T=Object.keys(l||{}).filter(ve),A=e.schema.patternProperties||{},D=Object.keys(A).filter(ve),F=e.schema.additionalProperties,j=T.length||D.length,w=F===!1,k=typeof F=="object"&&Object.keys(F).length,N=e.opts.removeAdditional,U=w||k||N,H=e.opts.ownProperties,Y=e.baseId,_e=e.schema.required;if(_e&&!(e.opts.$data&&_e.$data)&&_e.length<e.opts.loopRequired)var se=e.util.toHash(_e);function ve(xt){return xt!=="__proto__"}if(a+="var "+b+" = errors;var "+_+" = true;",H&&(a+=" var "+E+" = undefined;"),U){if(H?a+=" "+E+" = "+E+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+E+".length; "+x+"++) { var "+g+" = "+E+"["+x+"]; ":a+=" for (var "+g+" in "+m+") { ",j){if(a+=" var isAdditional"+o+" = !(false ",T.length)if(T.length>8)a+=" || validate.schema"+f+".hasOwnProperty("+g+") ";else{var le=T;if(le)for(var ue,Be=-1,We=le.length-1;Be<We;)ue=le[Be+=1],a+=" || "+g+" == "+e.util.toQuotedString(ue)+" "}if(D.length){var Qe=D;if(Qe)for(var $e,Fe=-1,P=Qe.length-1;Fe<P;)$e=Qe[Fe+=1],a+=" || "+e.usePattern($e)+".test("+g+") "}a+=" ); if (isAdditional"+o+") { "}if(N=="all")a+=" delete "+m+"["+g+"]; ";else{var M=e.errorPath,X="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),w)if(N)a+=" delete "+m+"["+g+"]; ";else{a+=" "+_+" = false; ";var de=y;y=e.errSchemaPath+"/additionalProperties";var L=L||[];L.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { additionalProperty: '"+X+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var V=a;a=L.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+V+"]); ":a+=" validate.errors = ["+V+"]; return false; ":a+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",y=de,R&&(a+=" break; ")}else if(k)if(N=="failing"){a+=" var "+b+" = errors; ";var ye=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Se=m+"["+g+"]";d.dataPathArr[$]=g;var oe=e.validate(d);d.baseId=Y,e.util.varOccurences(oe,O)<2?a+=" "+e.util.varReplace(oe,O,Se)+" ":a+=" var "+O+" = "+Se+"; "+oe+" ",a+=" if (!"+_+") { errors = "+b+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+g+"]; } ",e.compositeRule=d.compositeRule=ye}else{d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Se=m+"["+g+"]";d.dataPathArr[$]=g;var oe=e.validate(d);d.baseId=Y,e.util.varOccurences(oe,O)<2?a+=" "+e.util.varReplace(oe,O,Se)+" ":a+=" var "+O+" = "+Se+"; "+oe+" ",R&&(a+=" if (!"+_+") break; ")}e.errorPath=M}j&&(a+=" } "),a+=" } ",R&&(a+=" if ("+_+") { ",p+="}")}var Ae=e.opts.useDefaults&&!e.compositeRule;if(T.length){var je=T;if(je)for(var ue,Pe=-1,Ge=je.length-1;Pe<Ge;){ue=je[Pe+=1];var ze=l[ue];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){var Xe=e.util.getProperty(ue),Se=m+Xe,De=Ae&&ze.default!==void 0;d.schema=ze,d.schemaPath=f+Xe,d.errSchemaPath=y+"/"+e.util.escapeFragment(ue),d.errorPath=e.util.getPath(e.errorPath,ue,e.opts.jsonPointers),d.dataPathArr[$]=e.util.toQuotedString(ue);var oe=e.validate(d);if(d.baseId=Y,e.util.varOccurences(oe,O)<2){oe=e.util.varReplace(oe,O,Se);var He=Se}else{var He=O;a+=" var "+O+" = "+Se+"; "}if(De)a+=" "+oe+" ";else{if(se&&se[ue]){a+=" if ( "+He+" === undefined ",H&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(ue)+"') "),a+=") { "+_+" = false; ";var M=e.errorPath,de=y,ft=e.util.escapeQuotes(ue);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(M,ue,e.opts.jsonPointers)),y=e.errSchemaPath+"/required";var L=L||[];L.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { missingProperty: '"+ft+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+ft+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var V=a;a=L.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+V+"]); ":a+=" validate.errors = ["+V+"]; return false; ":a+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",y=de,e.errorPath=M,a+=" } else { "}else R?(a+=" if ( "+He+" === undefined ",H&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(ue)+"') "),a+=") { "+_+" = true; } else { "):(a+=" if ("+He+" !== undefined ",H&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(ue)+"') "),a+=" ) { ");a+=" "+oe+" } "}}R&&(a+=" if ("+_+") { ",p+="}")}}if(D.length){var it=D;if(it)for(var $e,Ia=-1,ts=it.length-1;Ia<ts;){$e=it[Ia+=1];var ze=A[$e];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){d.schema=ze,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty($e),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment($e),H?a+=" "+E+" = "+E+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+E+".length; "+x+"++) { var "+g+" = "+E+"["+x+"]; ":a+=" for (var "+g+" in "+m+") { ",a+=" if ("+e.usePattern($e)+".test("+g+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Se=m+"["+g+"]";d.dataPathArr[$]=g;var oe=e.validate(d);d.baseId=Y,e.util.varOccurences(oe,O)<2?a+=" "+e.util.varReplace(oe,O,Se)+" ":a+=" var "+O+" = "+Se+"; "+oe+" ",R&&(a+=" if (!"+_+") break; "),a+=" } ",R&&(a+=" else "+_+" = true; "),a+=" } ",R&&(a+=" if ("+_+") { ",p+="}")}}}return R&&(a+=" "+p+" if ("+b+" == errors) {"),a}}),Eo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="errs__"+o,d=e.util.copy(e),p="";d.level++;var _="valid"+d.level;if(a+="var "+b+" = errors;",e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=f,d.errSchemaPath=y;var g="key"+o,x="idx"+o,$="i"+o,O="' + "+g+" + '",E=d.dataLevel=e.dataLevel+1,T="data"+E,A="dataProperties"+o,D=e.opts.ownProperties,F=e.baseId;D&&(a+=" var "+A+" = undefined; "),D?a+=" "+A+" = "+A+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+A+".length; "+x+"++) { var "+g+" = "+A+"["+x+"]; ":a+=" for (var "+g+" in "+m+") { ",a+=" var startErrs"+o+" = errors; ";var j=g,w=e.compositeRule;e.compositeRule=d.compositeRule=!0;var k=e.validate(d);d.baseId=F,e.util.varOccurences(k,T)<2?a+=" "+e.util.varReplace(k,T,j)+" ":a+=" var "+T+" = "+j+"; "+k+" ",e.compositeRule=d.compositeRule=w,a+=" if (!"+_+") { for (var "+$+"=startErrs"+o+"; "+$+"<errors; "+$+"++) { vErrors["+$+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { propertyName: '"+O+"' } ",e.opts.messages!==!1&&(a+=" , message: 'property name \\'"+O+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&R&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),R&&(a+=" break; "),a+=" } }"}return R&&(a+=" "+p+" if ("+b+" == errors) {"),a}}),wo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d=e.opts.$data&&l&&l.$data,p;d?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",p="schema"+o):p=l;var _="schema"+o;if(!d)if(l.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],x=l;if(x)for(var $,O=-1,E=x.length-1;O<E;){$=x[O+=1];var T=e.schema.properties[$];T&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))||(g[g.length]=$)}}else var g=l;if(d||g.length){var A=e.errorPath,D=d||g.length>=e.opts.loopRequired,F=e.opts.ownProperties;if(R)if(a+=" var missing"+o+"; ",D){d||(a+=" var "+_+" = validate.schema"+f+"; ");var j="i"+o,w="schema"+o+"["+j+"]",k="' + "+w+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,w,e.opts.jsonPointers)),a+=" var "+b+" = true; ",d&&(a+=" if (schema"+o+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+o+")) "+b+" = false; else {"),a+=" for (var "+j+" = 0; "+j+" < "+_+".length; "+j+"++) { "+b+" = "+m+"["+_+"["+j+"]] !== undefined ",F&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+j+"]) "),a+="; if (!"+b+") break; } ",d&&(a+=" } "),a+=" if (!"+b+") { ";var N=N||[];N.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { missingProperty: '"+k+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+k+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var U=a;a=N.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+U+"]); ":a+=" validate.errors = ["+U+"]; return false; ":a+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var H=g;if(H)for(var Y,j=-1,_e=H.length-1;j<_e;){Y=H[j+=1],j&&(a+=" || ");var se=e.util.getProperty(Y),ve=m+se;a+=" ( ( "+ve+" === undefined ",F&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Y)+"') "),a+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?Y:se)+") ) "}a+=") { ";var w="missing"+o,k="' + "+w+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,w,!0):A+" + "+w);var N=N||[];N.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { missingProperty: '"+k+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+k+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var U=a;a=N.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+U+"]); ":a+=" validate.errors = ["+U+"]; return false; ":a+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(D){d||(a+=" var "+_+" = validate.schema"+f+"; ");var j="i"+o,w="schema"+o+"["+j+"]",k="' + "+w+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,w,e.opts.jsonPointers)),d&&(a+=" if ("+_+" && !Array.isArray("+_+")) { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { missingProperty: '"+k+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+k+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+_+" !== undefined) { "),a+=" for (var "+j+" = 0; "+j+" < "+_+".length; "+j+"++) { if ("+m+"["+_+"["+j+"]] === undefined ",F&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+_+"["+j+"]) "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { missingProperty: '"+k+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+k+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(a+=" } ")}else{var le=g;if(le)for(var Y,ue=-1,Be=le.length-1;ue<Be;){Y=le[ue+=1];var se=e.util.getProperty(Y),k=e.util.escapeQuotes(Y),ve=m+se;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,Y,e.opts.jsonPointers)),a+=" if ( "+ve+" === undefined ",F&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Y)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { missingProperty: '"+k+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+k+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=A}else R&&(a+=" if (true) {");return a}}),Po=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m="data"+(c||""),b="valid"+o,d=e.opts.$data&&l&&l.$data,p;if(d?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",p="schema"+o):p=l,(l||d)&&e.opts.uniqueItems!==!1){d&&(a+=" var "+b+"; if ("+p+" === false || "+p+" === undefined) "+b+" = true; else if (typeof "+p+" != 'boolean') "+b+" = false; else { "),a+=" var i = "+m+".length , "+b+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,g=Array.isArray(_);if(!_||_=="object"||_=="array"||g&&(_.indexOf("object")>=0||_.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+b+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var x="checkDataType"+(g?"s":"");a+=" if ("+e.util[x](_,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+b+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",d&&(a+=" } "),a+=" if (!"+b+") { ";var $=$||[];$.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",d?a+="validate.schema"+f:a+=""+l,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var O=a;a=$.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+O+"]); ":a+=" validate.errors = ["+O+"]; return false; ":a+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",R&&(a+=" else { ")}else R&&(a+=" if (true) { ");return a}}),Ro=ce((s,t)=>{t.exports={$ref:io(),allOf:oo(),anyOf:lo(),$comment:co(),const:uo(),contains:fo(),dependencies:ho(),enum:po(),format:mo(),if:vo(),items:go(),maximum:rn(),minimum:rn(),maxItems:an(),minItems:an(),maxLength:sn(),minLength:sn(),maxProperties:nn(),minProperties:nn(),multipleOf:yo(),not:_o(),oneOf:bo(),pattern:So(),properties:xo(),propertyNames:Eo(),required:wo(),uniqueItems:Po(),validate:wn()}}),To=ce((s,t)=>{var r=Ro(),e=Yr().toHash;t.exports=function(){var i=[{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"]}],a=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],c=["number","integer","string","array","object","boolean","null"];return i.all=e(a),i.types=e(c),i.forEach(function(l){l.rules=l.rules.map(function(f){var y;if(typeof f=="object"){var R=Object.keys(f)[0];y=f[R],f=R,y.forEach(function(b){a.push(b),i.all[b]=!0})}a.push(f);var m=i.all[f]={keyword:f,code:r[f],implements:y};return m}),i.all.$comment={keyword:"$comment",code:r.$comment},l.type&&(i.types[l.type]=l)}),i.keywords=e(a.concat(o)),i.custom={},i}}),ko=ce((s,t)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];t.exports=function(e,n){for(var i=0;i<n.length;i++){e=JSON.parse(JSON.stringify(e));var a=n[i].split("/"),o=e,c;for(c=1;c<a.length;c++)o=o[a[c]];for(c=0;c<r.length;c++){var l=r[c],f=o[l];f&&(o[l]={anyOf:[f,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return e}}),Co=ce((s,t)=>{var r=ks().MissingRef;t.exports=e;function e(n,i,a){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof i=="function"&&(a=i,i=void 0);var c=l(n).then(function(){var y=o._addSchema(n,void 0,i);return y.validate||f(y)});return a&&c.then(function(y){a(null,y)},a),c;function l(y){var R=y.$schema;return R&&!o.getSchema(R)?e.call(o,{$ref:R},!0):Promise.resolve()}function f(y){try{return o._compile(y)}catch(m){if(m instanceof r)return R(m);throw m}function R(m){var b=m.missingSchema;if(_(b))throw new Error("Schema "+b+" is loaded but "+m.missingRef+" cannot be resolved");var d=o._loadingSchemas[b];return d||(d=o._loadingSchemas[b]=o._opts.loadSchema(b),d.then(p,p)),d.then(function(g){if(!_(b))return l(g).then(function(){_(b)||o.addSchema(g,b,void 0,i)})}).then(function(){return f(y)});function p(){delete o._loadingSchemas[b]}function _(g){return o._refs[g]||o._schemas[g]}}}}}),Oo=ce((s,t)=>{t.exports=function(e,n,i){var a=" ",o=e.level,c=e.dataLevel,l=e.schema[n],f=e.schemaPath+e.util.getProperty(n),y=e.errSchemaPath+"/"+n,R=!e.opts.allErrors,m,b="data"+(c||""),d="valid"+o,p="errs__"+o,_=e.opts.$data&&l&&l.$data,g;_?(a+=" var schema"+o+" = "+e.util.getData(l.$data,c,e.dataPathArr)+"; ",g="schema"+o):g=l;var x=this,$="definition"+o,O=x.definition,E="",T,A,D,F,j;if(_&&O.$data){j="keywordValidate"+o;var w=O.validateSchema;a+=" var "+$+" = RULES.custom['"+n+"'].definition; var "+j+" = "+$+".validate;"}else{if(F=e.useCustomRule(x,l,e.schema,e),!F)return;g="validate.schema"+f,j=F.code,T=O.compile,A=O.inline,D=O.macro}var k=j+".errors",N="i"+o,U="ruleErr"+o,H=O.async;if(H&&!e.async)throw new Error("async keyword in sync schema");if(A||D||(a+=""+k+" = null;"),a+="var "+p+" = errors;var "+d+";",_&&O.$data&&(E+="}",a+=" if ("+g+" === undefined) { "+d+" = true; } else { ",w&&(E+="}",a+=" "+d+" = "+$+".validateSchema("+g+"); if ("+d+") { ")),A)O.statements?a+=" "+F.validate+" ":a+=" "+d+" = "+F.validate+"; ";else if(D){var Y=e.util.copy(e),E="";Y.level++;var _e="valid"+Y.level;Y.schema=F.validate,Y.schemaPath="";var se=e.compositeRule;e.compositeRule=Y.compositeRule=!0;var ve=e.validate(Y).replace(/validate\.schema/g,j);e.compositeRule=Y.compositeRule=se,a+=" "+ve}else{var le=le||[];le.push(a),a="",a+=" "+j+".call( ",e.opts.passContext?a+="this":a+="self",T||O.schema===!1?a+=" , "+b+" ":a+=" , "+g+" , "+b+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var ue=c?"data"+(c-1||""):"parentData",Be=c?e.dataPathArr[c]:"parentDataProperty";a+=" , "+ue+" , "+Be+" , rootData ) ";var We=a;a=le.pop(),O.errors===!1?(a+=" "+d+" = ",H&&(a+="await "),a+=""+We+"; "):H?(k="customErrors"+o,a+=" var "+k+" = null; try { "+d+" = await "+We+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+k+" = e.errors; else throw e; } "):a+=" "+k+" = null; "+d+" = "+We+"; "}if(O.modifying&&(a+=" if ("+ue+") "+b+" = "+ue+"["+Be+"];"),a+=""+E,O.valid)R&&(a+=" if (true) { ");else{a+=" if ( ",O.valid===void 0?(a+=" !",D?a+=""+_e:a+=""+d):a+=" "+!O.valid+" ",a+=") { ",m=x.keyword;var le=le||[];le.push(a),a="";var le=le||[];le.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),a+=" } "):a+=" {} ";var Qe=a;a=le.pop(),!e.compositeRule&&R?e.async?a+=" throw new ValidationError(["+Qe+"]); ":a+=" validate.errors = ["+Qe+"]; return false; ":a+=" var err = "+Qe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var $e=a;a=le.pop(),A?O.errors?O.errors!="full"&&(a+=" for (var "+N+"="+p+"; "+N+"<errors; "+N+"++) { var "+U+" = vErrors["+N+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+U+".schemaPath === undefined) { "+U+'.schemaPath = "'+y+'"; } ',e.opts.verbose&&(a+=" "+U+".schema = "+g+"; "+U+".data = "+b+"; "),a+=" } "):O.errors===!1?a+=" "+$e+" ":(a+=" if ("+p+" == errors) { "+$e+" } else { for (var "+N+"="+p+"; "+N+"<errors; "+N+"++) { var "+U+" = vErrors["+N+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+U+".schemaPath === undefined) { "+U+'.schemaPath = "'+y+'"; } ',e.opts.verbose&&(a+=" "+U+".schema = "+g+"; "+U+".data = "+b+"; "),a+=" } } "):D?(a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&R&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; ")):O.errors===!1?a+=" "+$e+" ":(a+=" if (Array.isArray("+k+")) { if (vErrors === null) vErrors = "+k+"; else vErrors = vErrors.concat("+k+"); errors = vErrors.length; for (var "+N+"="+p+"; "+N+"<errors; "+N+"++) { var "+U+" = vErrors["+N+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; "+U+'.schemaPath = "'+y+'"; ',e.opts.verbose&&(a+=" "+U+".schema = "+g+"; "+U+".data = "+b+"; "),a+=" } } else { "+$e+" } "),a+=" } ",R&&(a+=" else { ")}return a}}),Pn=ce((s,t)=>{t.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}}),Io=ce((s,t)=>{var r=Pn();t.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.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"}]}}}}),$o=ce((s,t)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,e=Oo(),n=Io();t.exports={add:i,get:a,remove:o,validate:c};function i(l,f){var y=this.RULES;if(y.keywords[l])throw new Error("Keyword "+l+" is already defined");if(!r.test(l))throw new Error("Keyword "+l+" is not a valid identifier");if(f){this.validateKeyword(f,!0);var R=f.type;if(Array.isArray(R))for(var m=0;m<R.length;m++)d(l,R[m],f);else d(l,R,f);var b=f.metaSchema;b&&(f.$data&&this._opts.$data&&(b={anyOf:[b,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),f.validateSchema=this.compile(b,!0))}y.keywords[l]=y.all[l]=!0;function d(p,_,g){for(var x,$=0;$<y.length;$++){var O=y[$];if(O.type==_){x=O;break}}x||(x={type:_,rules:[]},y.push(x));var E={keyword:p,definition:g,custom:!0,code:e,implements:g.implements};x.rules.push(E),y.custom[p]=E}return this}function a(l){var f=this.RULES.custom[l];return f?f.definition:this.RULES.keywords[l]||!1}function o(l){var f=this.RULES;delete f.keywords[l],delete f.all[l],delete f.custom[l];for(var y=0;y<f.length;y++)for(var R=f[y].rules,m=0;m<R.length;m++)if(R[m].keyword==l){R.splice(m,1);break}return this}function c(l,f){c.errors=null;var y=this._validateKeyword=this._validateKeyword||this.compile(n,!0);if(y(l))return!0;if(c.errors=y.errors,f)throw new Error("custom keyword definition is invalid: "+this.errorsText(y.errors));return!1}}),Ao=ce((s,t)=>{t.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}}),jo=ce((s,t)=>{var r=ao(),e=Ts(),n=so(),i=xn(),a=En(),o=no(),c=To(),l=ko(),f=Yr();t.exports=p,p.prototype.validate=_,p.prototype.compile=g,p.prototype.addSchema=x,p.prototype.addMetaSchema=$,p.prototype.validateSchema=O,p.prototype.getSchema=T,p.prototype.removeSchema=F,p.prototype.addFormat=se,p.prototype.errorsText=_e,p.prototype._addSchema=w,p.prototype._compile=k,p.prototype.compileAsync=Co();var y=$o();p.prototype.addKeyword=y.add,p.prototype.getKeyword=y.get,p.prototype.removeKeyword=y.remove,p.prototype.validateKeyword=y.validate;var R=ks();p.ValidationError=R.Validation,p.MissingRefError=R.MissingRef,p.$dataMetaSchema=l;var m="http://json-schema.org/draft-07/schema",b=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],d=["/properties"];function p(P){if(!(this instanceof p))return new p(P);P=this._opts=f.copy(P)||{},$e(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(P.format),this._cache=P.cache||new n,this._loadingSchemas={},this._compilations=[],this.RULES=c(),this._getId=N(P),P.loopRequired=P.loopRequired||1/0,P.errorDataPath=="property"&&(P._errorDataPathProperty=!0),P.serialize===void 0&&(P.serialize=a),this._metaOpts=Qe(this),P.formats&&ue(this),P.keywords&&Be(this),ve(this),typeof P.meta=="object"&&this.addMetaSchema(P.meta),P.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),le(this)}function _(P,M){var X;if(typeof P=="string"){if(X=this.getSchema(P),!X)throw new Error('no schema with key or ref "'+P+'"')}else{var de=this._addSchema(P);X=de.validate||this._compile(de)}var L=X(M);return X.$async!==!0&&(this.errors=X.errors),L}function g(P,M){var X=this._addSchema(P,void 0,M);return X.validate||this._compile(X)}function x(P,M,X,de){if(Array.isArray(P)){for(var L=0;L<P.length;L++)this.addSchema(P[L],void 0,X,de);return this}var V=this._getId(P);if(V!==void 0&&typeof V!="string")throw new Error("schema id must be string");return M=e.normalizeId(M||V),We(this,M),this._schemas[M]=this._addSchema(P,X,de,!0),this}function $(P,M,X){return this.addSchema(P,M,X,!0),this}function O(P,M){var X=P.$schema;if(X!==void 0&&typeof X!="string")throw new Error("$schema must be a string");if(X=X||this._opts.defaultMeta||E(this),!X)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var de=this.validate(X,P);if(!de&&M){var L="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(L);else throw new Error(L)}return de}function E(P){var M=P._opts.meta;return P._opts.defaultMeta=typeof M=="object"?P._getId(M)||M:P.getSchema(m)?m:void 0,P._opts.defaultMeta}function T(P){var M=D(this,P);switch(typeof M){case"object":return M.validate||this._compile(M);case"string":return this.getSchema(M);case"undefined":return A(this,P)}}function A(P,M){var X=e.schema.call(P,{schema:{}},M);if(X){var{schema:de,root:L,baseId:V}=X,ye=r.call(P,de,L,void 0,V);return P._fragments[M]=new i({ref:M,fragment:!0,schema:de,root:L,baseId:V,validate:ye}),ye}}function D(P,M){return M=e.normalizeId(M),P._schemas[M]||P._refs[M]||P._fragments[M]}function F(P){if(P instanceof RegExp)return j(this,this._schemas,P),j(this,this._refs,P),this;switch(typeof P){case"undefined":return j(this,this._schemas),j(this,this._refs),this._cache.clear(),this;case"string":var M=D(this,P);return M&&this._cache.del(M.cacheKey),delete this._schemas[P],delete this._refs[P],this;case"object":var X=this._opts.serialize,de=X?X(P):P;this._cache.del(de);var L=this._getId(P);L&&(L=e.normalizeId(L),delete this._schemas[L],delete this._refs[L])}return this}function j(P,M,X){for(var de in M){var L=M[de];!L.meta&&(!X||X.test(de))&&(P._cache.del(L.cacheKey),delete M[de])}}function w(P,M,X,de){if(typeof P!="object"&&typeof P!="boolean")throw new Error("schema should be object or boolean");var L=this._opts.serialize,V=L?L(P):P,ye=this._cache.get(V);if(ye)return ye;de=de||this._opts.addUsedSchema!==!1;var Se=e.normalizeId(this._getId(P));Se&&de&&We(this,Se);var oe=this._opts.validateSchema!==!1&&!M,Ae;oe&&!(Ae=Se&&Se==e.normalizeId(P.$schema))&&this.validateSchema(P,!0);var je=e.ids.call(this,P),Pe=new i({id:Se,schema:P,localRefs:je,cacheKey:V,meta:X});return Se[0]!="#"&&de&&(this._refs[Se]=Pe),this._cache.put(V,Pe),oe&&Ae&&this.validateSchema(P,!0),Pe}function k(P,M){if(P.compiling)return P.validate=L,L.schema=P.schema,L.errors=null,L.root=M||L,P.schema.$async===!0&&(L.$async=!0),L;P.compiling=!0;var X;P.meta&&(X=this._opts,this._opts=this._metaOpts);var de;try{de=r.call(this,P.schema,M,P.localRefs)}catch(V){throw delete P.validate,V}finally{P.compiling=!1,P.meta&&(this._opts=X)}return P.validate=de,P.refs=de.refs,P.refVal=de.refVal,P.root=de.root,de;function L(){var V=P.validate,ye=V.apply(this,arguments);return L.errors=V.errors,ye}}function N(P){switch(P.schemaId){case"auto":return Y;case"id":return U;default:return H}}function U(P){return P.$id&&this.logger.warn("schema $id ignored",P.$id),P.id}function H(P){return P.id&&this.logger.warn("schema id ignored",P.id),P.$id}function Y(P){if(P.$id&&P.id&&P.$id!=P.id)throw new Error("schema $id is different from id");return P.$id||P.id}function _e(P,M){if(P=P||this.errors,!P)return"No errors";M=M||{};for(var X=M.separator===void 0?", ":M.separator,de=M.dataVar===void 0?"data":M.dataVar,L="",V=0;V<P.length;V++){var ye=P[V];ye&&(L+=de+ye.dataPath+" "+ye.message+X)}return L.slice(0,-X.length)}function se(P,M){return typeof M=="string"&&(M=new RegExp(M)),this._formats[P]=M,this}function ve(P){var M;if(P._opts.$data&&(M=Ao(),P.addMetaSchema(M,M.$id,!0)),P._opts.meta!==!1){var X=Pn();P._opts.$data&&(X=l(X,d)),P.addMetaSchema(X,m,!0),P._refs["http://json-schema.org/schema"]=m}}function le(P){var M=P._opts.schemas;if(M)if(Array.isArray(M))P.addSchema(M);else for(var X in M)P.addSchema(M[X],X)}function ue(P){for(var M in P._opts.formats){var X=P._opts.formats[M];P.addFormat(M,X)}}function Be(P){for(var M in P._opts.keywords){var X=P._opts.keywords[M];P.addKeyword(M,X)}}function We(P,M){if(P._schemas[M]||P._refs[M])throw new Error('schema with key or id "'+M+'" already exists')}function Qe(P){for(var M=f.copy(P._opts),X=0;X<b.length;X++)delete M[b[X]];return M}function $e(P){var M=P._opts.logger;if(M===!1)P.logger={log:Fe,warn:Fe,error:Fe};else{if(M===void 0&&(M=console),!(typeof M=="object"&&M.log&&M.warn&&M.error))throw new Error("logger must implement log, warn and error methods");P.logger=M}}function Fe(){}});var No={cwd(){return process.cwd()},existsSync(s){return ie.existsSync(s)},async stat(s){return Do(s)},statSync(s){return ie.statSync(s)},readFileSync(s,t){return ie.readFileSync(s,{encoding:t.encoding})},readFileBytesSync(s){return ie.readFileSync(s)},readSync(s,t){let r;try{r=ie.openSync(s,"r");let e=Buffer.alloc(t.length),n=ie.readSync(r,e,0,t.length,0);return{buffer:e,bytesRead:n}}finally{r&&ie.closeSync(r)}},writeFileSync(s,t,r){if(!r.flush){let n={encoding:r.encoding};r.mode!==void 0&&(n.mode=r.mode),ie.writeFileSync(s,t,n);return}let e;try{let n=r.mode!==void 0?r.mode:void 0;e=ie.openSync(s,"w",n),ie.writeFileSync(e,t,{encoding:r.encoding}),ie.fsyncSync(e)}finally{e&&ie.closeSync(e)}},appendFileSync(s,t){ie.appendFileSync(s,t)},copyFileSync(s,t){ie.copyFileSync(s,t)},unlinkSync(s){ie.unlinkSync(s)},renameSync(s,t){ie.renameSync(s,t)},linkSync(s,t){ie.linkSync(s,t)},symlinkSync(s,t){ie.symlinkSync(s,t)},readlinkSync(s){return ie.readlinkSync(s)},realpathSync(s){return ie.realpathSync(s)},mkdirSync(s){ie.existsSync(s)||ie.mkdirSync(s,{recursive:!0,mode:448})},readdirSync(s){return ie.readdirSync(s,{withFileTypes:!0})},readdirStringSync(s){return ie.readdirSync(s)},isDirEmptySync(s){return this.readdirSync(s).length===0},rmdirSync(s){ie.rmdirSync(s)},rmSync(s,t){ie.rmSync(s,t)},createWriteStream(s){return ie.createWriteStream(s)}},Fo=No;function ga(){return Fo}var Mo=typeof global=="object"&&global&&global.Object===Object&&global,Lo=Mo,qo=typeof self=="object"&&self&&self.Object===Object&&self,Uo=Lo||qo||Function("return this")(),Cs=Uo,zo=Cs.Symbol,Na=zo,Rn=Object.prototype,Zo=Rn.hasOwnProperty,Vo=Rn.toString,ya=Na?Na.toStringTag:void 0;function Ho(s){var t=Zo.call(s,ya),r=s[ya];try{s[ya]=void 0;var e=!0}catch{}var n=Vo.call(s);return e&&(t?s[ya]=r:delete s[ya]),n}var Bo=Ho,Qo=Object.prototype,Go=Qo.toString;function Jo(s){return Go.call(s)}var Wo=Jo,Ko="[object Null]",Yo="[object Undefined]",on=Na?Na.toStringTag:void 0;function Xo(s){return s==null?s===void 0?Yo:Ko:on&&on in Object(s)?Bo(s):Wo(s)}var el=Xo;function tl(s){var t=typeof s;return s!=null&&(t=="object"||t=="function")}var Tn=tl,rl="[object AsyncFunction]",al="[object Function]",sl="[object GeneratorFunction]",nl="[object Proxy]";function il(s){if(!Tn(s))return!1;var t=el(s);return t==al||t==sl||t==rl||t==nl}var ol=il,ll=Cs["__core-js_shared__"],ns=ll,ln=function(){var s=/[^.]+$/.exec(ns&&ns.keys&&ns.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}();function cl(s){return!!ln&&ln in s}var ul=cl,dl=Function.prototype,fl=dl.toString;function hl(s){if(s!=null){try{return fl.call(s)}catch{}try{return s+""}catch{}}return""}var pl=hl,ml=/[\\^$.*+?()[\]{}|]/g,vl=/^\[object .+?Constructor\]$/,gl=Function.prototype,yl=Object.prototype,_l=gl.toString,bl=yl.hasOwnProperty,Sl=RegExp("^"+_l.call(bl).replace(ml,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xl(s){if(!Tn(s)||ul(s))return!1;var t=ol(s)?Sl:vl;return t.test(pl(s))}var El=xl;function wl(s,t){return s?.[t]}var Pl=wl;function Rl(s,t){var r=Pl(s,t);return El(r)?r:void 0}var kn=Rl;function Tl(s,t){return s===t||s!==s&&t!==t}var kl=Tl,Cl=kn(Object,"create"),_a=Cl;function Ol(){this.__data__=_a?_a(null):{},this.size=0}var Il=Ol;function $l(s){var t=this.has(s)&&delete this.__data__[s];return this.size-=t?1:0,t}var Al=$l,jl="__lodash_hash_undefined__",Dl=Object.prototype,Nl=Dl.hasOwnProperty;function Fl(s){var t=this.__data__;if(_a){var r=t[s];return r===jl?void 0:r}return Nl.call(t,s)?t[s]:void 0}var Ml=Fl,Ll=Object.prototype,ql=Ll.hasOwnProperty;function Ul(s){var t=this.__data__;return _a?t[s]!==void 0:ql.call(t,s)}var zl=Ul,Zl="__lodash_hash_undefined__";function Vl(s,t){var r=this.__data__;return this.size+=this.has(s)?0:1,r[s]=_a&&t===void 0?Zl:t,this}var Hl=Vl;function Xr(s){var t=-1,r=s==null?0:s.length;for(this.clear();++t<r;){var e=s[t];this.set(e[0],e[1])}}Xr.prototype.clear=Il;Xr.prototype.delete=Al;Xr.prototype.get=Ml;Xr.prototype.has=zl;Xr.prototype.set=Hl;var cn=Xr;function Bl(){this.__data__=[],this.size=0}var Ql=Bl;function Gl(s,t){for(var r=s.length;r--;)if(kl(s[r][0],t))return r;return-1}var Za=Gl,Jl=Array.prototype,Wl=Jl.splice;function Kl(s){var t=this.__data__,r=Za(t,s);if(r<0)return!1;var e=t.length-1;return r==e?t.pop():Wl.call(t,r,1),--this.size,!0}var Yl=Kl;function Xl(s){var t=this.__data__,r=Za(t,s);return r<0?void 0:t[r][1]}var ec=Xl;function tc(s){return Za(this.__data__,s)>-1}var rc=tc;function ac(s,t){var r=this.__data__,e=Za(r,s);return e<0?(++this.size,r.push([s,t])):r[e][1]=t,this}var sc=ac;function ea(s){var t=-1,r=s==null?0:s.length;for(this.clear();++t<r;){var e=s[t];this.set(e[0],e[1])}}ea.prototype.clear=Ql;ea.prototype.delete=Yl;ea.prototype.get=ec;ea.prototype.has=rc;ea.prototype.set=sc;var nc=ea,ic=kn(Cs,"Map"),oc=ic;function lc(){this.size=0,this.__data__={hash:new cn,map:new(oc||nc),string:new cn}}var cc=lc;function uc(s){var t=typeof s;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?s!=="__proto__":s===null}var dc=uc;function fc(s,t){var r=s.__data__;return dc(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Va=fc;function hc(s){var t=Va(this,s).delete(s);return this.size-=t?1:0,t}var pc=hc;function mc(s){return Va(this,s).get(s)}var vc=mc;function gc(s){return Va(this,s).has(s)}var yc=gc;function _c(s,t){var r=Va(this,s),e=r.size;return r.set(s,t),this.size+=r.size==e?0:1,this}var bc=_c;function ta(s){var t=-1,r=s==null?0:s.length;for(this.clear();++t<r;){var e=s[t];this.set(e[0],e[1])}}ta.prototype.clear=cc;ta.prototype.delete=pc;ta.prototype.get=vc;ta.prototype.has=yc;ta.prototype.set=bc;var Cn=ta,Sc="Expected a function";function Os(s,t){if(typeof s!="function"||t!=null&&typeof t!="function")throw new TypeError(Sc);var r=function(){var e=arguments,n=t?t.apply(this,e):e[0],i=r.cache;if(i.has(n))return i.get(n);var a=s.apply(this,e);return r.cache=i.set(n,a)||i,a};return r.cache=new(Os.Cache||Cn),r}Os.Cache=Cn;var wa=Os;var xc=wa(s=>{if(!s||s.trim()==="")return null;let t=s.split(",").map(i=>i.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some(i=>i.startsWith("!")),e=t.some(i=>!i.startsWith("!"));if(r&&e)return null;let n=t.map(i=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function Pc(){return process.env.CLAUDE_CONFIG_DIR??Ec(wc(),".claude")}function un(s){if(!s)return!1;if(typeof s=="boolean")return s;let t=s.toLowerCase().trim();return["1","true","yes","on"].includes(t)}var kc={name:"BASH_MAX_OUTPUT_LENGTH",default:3e4,validate:s=>{if(!s)return{effective:3e4,status:"valid"};let e=parseInt(s,10);return isNaN(e)||e<=0?{effective:3e4,status:"invalid",message:`Invalid value "${s}" (using default: 30000)`}:e>15e4?{effective:15e4,status:"capped",message:`Capped from ${e} to 150000`}:{effective:e,status:"valid"}}},Cc={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:s=>{if(!s)return{effective:32e3,status:"valid"};let t=parseInt(s,10);return isNaN(t)||t<=0?{effective:32e3,status:"invalid",message:`Invalid value "${s}" (using default: 32000)`}:t>32e3?{effective:32e3,status:"capped",message:`Capped from ${t} to 32000`}:{effective:t,status:"valid"}}};function Oc(){return{originalCwd:dn(),totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:dn(),modelUsage:{},mainLoopModelOverride:void 0,maxRateLimitFallbackActive:!1,initialMainLoopModel:null,modelStrings:null,isNonInteractiveSession:!0,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:Tc(),loggerProvider:null,eventLogger:null,meterProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[kc,Cc],lastAPIRequest:null,inMemoryErrorLog:[]}}var Ic=Oc();function $c(){return Ic.sessionId}var np=wa(()=>un(process.env.DEBUG)||un(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||Ac()||process.argv.some(s=>s.startsWith("--debug="))),ip=wa(()=>{let s=process.argv.find(r=>r.startsWith("--debug="));if(!s)return null;let t=s.substring(8);return xc(t)}),Ac=wa(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e"));function jc(){return process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??On(Pc(),"debug",`${$c()}.txt`)}var op=wa(()=>{try{let s=jc(),t=Rc(s),r=On(t,"latest");if(ga().existsSync(t)||ga().mkdirSync(t),ga().existsSync(r))try{ga().unlinkSync(r)}catch{}ga().symlinkSync(s,r)}catch{}});var u={};Xi(u,{void:()=>yu,util:()=>Ee,unknown:()=>vu,union:()=>xu,undefined:()=>hu,tuple:()=>Pu,transformer:()=>pn,symbol:()=>fu,string:()=>Fn,strictObject:()=>Su,setErrorMap:()=>Fc,set:()=>ku,record:()=>Ru,quotelessJson:()=>Dc,promise:()=>ju,preprocess:()=>Fu,pipeline:()=>Mu,ostring:()=>Lu,optional:()=>Du,onumber:()=>qu,oboolean:()=>Uu,objectUtil:()=>us,object:()=>bu,number:()=>Mn,nullable:()=>Nu,null:()=>pu,never:()=>gu,nativeEnum:()=>Au,nan:()=>cu,map:()=>Tu,makeIssue:()=>Ma,literal:()=>Iu,lazy:()=>Ou,late:()=>ou,isValid:()=>ar,isDirty:()=>fs,isAsync:()=>ba,isAborted:()=>ds,intersection:()=>wu,instanceof:()=>lu,getParsedType:()=>Lt,getErrorMap:()=>Fa,function:()=>Cu,enum:()=>$u,effect:()=>pn,discriminatedUnion:()=>Eu,defaultErrorMap:()=>Br,datetimeRegex:()=>jn,date:()=>du,custom:()=>Nn,coerce:()=>zu,boolean:()=>Ln,bigint:()=>uu,array:()=>_u,any:()=>mu,addIssueToContext:()=>Q,ZodVoid:()=>Gr,ZodUnknown:()=>qt,ZodUnion:()=>ur,ZodUndefined:()=>lr,ZodType:()=>fe,ZodTuple:()=>Ct,ZodTransformer:()=>dt,ZodSymbol:()=>Qr,ZodString:()=>Bt,ZodSet:()=>Wr,ZodSchema:()=>fe,ZodRecord:()=>qa,ZodReadonly:()=>yr,ZodPromise:()=>Gt,ZodPipeline:()=>xa,ZodParsedType:()=>K,ZodOptional:()=>ut,ZodObject:()=>rt,ZodNumber:()=>sr,ZodNullable:()=>Ot,ZodNull:()=>cr,ZodNever:()=>Pt,ZodNativeEnum:()=>mr,ZodNaN:()=>Kr,ZodMap:()=>Jr,ZodLiteral:()=>hr,ZodLazy:()=>fr,ZodIssueCode:()=>z,ZodIntersection:()=>dr,ZodFunction:()=>Ua,ZodFirstPartyTypeKind:()=>Z,ZodError:()=>ct,ZodEnum:()=>pr,ZodEffects:()=>dt,ZodDiscriminatedUnion:()=>La,ZodDefault:()=>vr,ZodDate:()=>or,ZodCatch:()=>gr,ZodBranded:()=>Sa,ZodBoolean:()=>ir,ZodBigInt:()=>nr,ZodArray:()=>Ut,ZodAny:()=>Qt,Schema:()=>fe,ParseStatus:()=>Ke,OK:()=>tt,NEVER:()=>Zu,INVALID:()=>ae,EMPTY_PATH:()=>Mc,DIRTY:()=>Hr,BRAND:()=>iu});var Ee;(function(s){s.assertEqual=n=>{};function t(n){}s.assertIs=t;function r(n){throw new Error}s.assertNever=r,s.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},s.getValidEnumValues=n=>{let i=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(let o of i)a[o]=n[o];return s.objectValues(a)},s.objectValues=n=>s.objectKeys(n).map(function(i){return n[i]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},s.find=(n,i)=>{for(let a of n)if(i(a))return a},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function e(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}s.joinValues=e,s.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(Ee||(Ee={}));var us;(function(s){s.mergeShapes=(t,r)=>({...t,...r})})(us||(us={}));var K=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lt=s=>{switch(typeof s){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN(s)?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(s)?K.array:s===null?K.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?K.promise:typeof Map<"u"&&s instanceof Map?K.map:typeof Set<"u"&&s instanceof Set?K.set:typeof Date<"u"&&s instanceof Date?K.date:K.object;default:return K.unknown}},z=Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Dc=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),ct=class s extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},e={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)e._errors.push(r(a));else{let o=e,c=0;for(;c<a.path.length;){let l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),e}static assert(t){if(!(t instanceof s))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},e=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(t(n))}else e.push(t(n));return{formErrors:e,fieldErrors:r}}get formErrors(){return this.flatten()}};ct.create=s=>new ct(s);var Nc=(s,t)=>{let r;switch(s.code){case z.invalid_type:s.received===K.undefined?r="Required":r=`Expected ${s.expected}, received ${s.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(s.expected,Ee.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ee.joinValues(s.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ee.joinValues(s.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${Ee.joinValues(s.options)}, received '${s.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(r=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?r=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?r=`Invalid input: must end with "${s.validation.endsWith}"`:Ee.assertNever(s.validation):s.validation!=="regex"?r=`Invalid ${s.validation}`:r="Invalid";break;case z.too_small:s.type==="array"?r=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?r=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?r=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?r=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?r=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:r="Invalid input";break;case z.too_big:s.type==="array"?r=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?r=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?r=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?r=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?r=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${s.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ee.assertNever(s)}return{message:r}},Br=Nc,In=Br;function Fc(s){In=s}function Fa(){return In}var Ma=s=>{let{data:t,path:r,errorMaps:e,issueData:n}=s,i=[...r,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="",c=e.filter(l=>!!l).slice().reverse();for(let l of c)o=l(a,{data:t,defaultError:o}).message;return{...n,path:i,message:o}},Mc=[];function Q(s,t){let r=Fa(),e=Ma({issueData:t,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,r,r===Br?void 0:Br].filter(n=>!!n)});s.common.issues.push(e)}var Ke=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let e=[];for(let n of r){if(n.status==="aborted")return ae;n.status==="dirty"&&t.dirty(),e.push(n.value)}return{status:t.value,value:e}}static async mergeObjectAsync(t,r){let e=[];for(let n of r){let i=await n.key,a=await n.value;e.push({key:i,value:a})}return s.mergeObjectSync(t,e)}static mergeObjectSync(t,r){let e={};for(let n of r){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(e[i.value]=a.value)}return{status:t.value,value:e}}},ae=Object.freeze({status:"aborted"}),Hr=s=>({status:"dirty",value:s}),tt=s=>({status:"valid",value:s}),ds=s=>s.status==="aborted",fs=s=>s.status==="dirty",ar=s=>s.status==="valid",ba=s=>typeof Promise<"u"&&s instanceof Promise,te;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t?.message})(te||(te={}));var mt=class{constructor(t,r,e,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=e,this._key=n}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}},fn=(s,t)=>{if(ar(t))return{success:!0,data:t.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ct(s.common.issues);return this._error=r,this._error}}};function he(s){if(!s)return{};let{errorMap:t,invalid_type_error:r,required_error:e,description:n}=s;if(t&&(r||e))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(a,o)=>{let{message:c}=s;return a.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??e??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:n}}var fe=class{get description(){return this._def.description}_getType(t){return Lt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Lt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ke,ctx:{common:t.parent.common,data:t.data,parsedType:Lt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ba(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let e=this.safeParse(t,r);if(e.success)return e.data;throw e.error}safeParse(t,r){let e={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lt(t)},n=this._parseSync({data:t,path:e.path,parent:e});return fn(e,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lt(t)};if(!this["~standard"].async)try{let e=this._parseSync({data:t,path:[],parent:r});return ar(e)?{value:e.value}:{issues:r.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(e=>ar(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(t,r){let e=await this.safeParseAsync(t,r);if(e.success)return e.data;throw e.error}async safeParseAsync(t,r){let e={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lt(t)},n=this._parse({data:t,path:e.path,parent:e}),i=await(ba(n)?n:Promise.resolve(n));return fn(e,i)}refine(t,r){let e=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let a=t(n),o=()=>i.addIssue({code:z.custom,...e(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(t,r){return this._refinement((e,n)=>t(e)?!0:(n.addIssue(typeof r=="function"?r(e,n):r),!1))}_refinement(t){return new dt({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return ut.create(this,this._def)}nullable(){return Ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ut.create(this)}promise(){return Gt.create(this,this._def)}or(t){return ur.create([this,t],this._def)}and(t){return dr.create(this,t,this._def)}transform(t){return new dt({...he(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new vr({...he(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new Sa({typeName:Z.ZodBranded,type:this,...he(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new gr({...he(this._def),innerType:this,catchValue:r,typeName:Z.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return xa.create(this,t)}readonly(){return yr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lc=/^c[^\s-]{8,}$/i,qc=/^[0-9a-z]+$/,Uc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Zc=/^[a-z0-9_-]{21}$/i,Vc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Bc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",is,Gc=/^(?:(?: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])$/,Jc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Wc=/^(([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]))$/,Kc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$n="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",eu=new RegExp(`^${$n}$`);function An(s){let t="[0-5]\\d";s.precision?t=`${t}\\.\\d{${s.precision}}`:s.precision==null&&(t=`${t}(\\.\\d+)?`);let r=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function tu(s){return new RegExp(`^${An(s)}$`)}function jn(s){let t=`${$n}T${An(s)}`,r=[];return r.push(s.local?"Z?":"Z"),s.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ru(s,t){return!!((t==="v4"||!t)&&Gc.test(s)||(t==="v6"||!t)&&Wc.test(s))}function au(s,t){if(!Vc.test(s))return!1;try{let[r]=s.split(".");if(!r)return!1;let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(e));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function su(s,t){return!!((t==="v4"||!t)&&Jc.test(s)||(t==="v6"||!t)&&Kc.test(s))}var Bt=class s extends fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==K.string){let i=this._getOrReturnCtx(t);return Q(i,{code:z.invalid_type,expected:K.string,received:i.parsedType}),ae}let e=new Ke,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),e.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),e.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,o=t.data.length<i.value;(a||o)&&(n=this._getOrReturnCtx(t,n),a?Q(n,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Q(n,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),e.dirty())}else if(i.kind==="email")Bc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"email",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="emoji")is||(is=new RegExp(Qc,"u")),is.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"emoji",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="uuid")zc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"uuid",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="nanoid")Zc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"nanoid",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="cuid")Lc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"cuid",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="cuid2")qc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"cuid2",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="ulid")Uc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"ulid",code:z.invalid_string,message:i.message}),e.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),Q(n,{validation:"url",code:z.invalid_string,message:i.message}),e.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"regex",code:z.invalid_string,message:i.message}),e.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),Q(n,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),e.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),Q(n,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),e.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),Q(n,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),e.dirty()):i.kind==="datetime"?jn(i).test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:z.invalid_string,validation:"datetime",message:i.message}),e.dirty()):i.kind==="date"?eu.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:z.invalid_string,validation:"date",message:i.message}),e.dirty()):i.kind==="time"?tu(i).test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:z.invalid_string,validation:"time",message:i.message}),e.dirty()):i.kind==="duration"?Hc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"duration",code:z.invalid_string,message:i.message}),e.dirty()):i.kind==="ip"?ru(t.data,i.version)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"ip",code:z.invalid_string,message:i.message}),e.dirty()):i.kind==="jwt"?au(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"jwt",code:z.invalid_string,message:i.message}),e.dirty()):i.kind==="cidr"?su(t.data,i.version)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"cidr",code:z.invalid_string,message:i.message}),e.dirty()):i.kind==="base64"?Yc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"base64",code:z.invalid_string,message:i.message}),e.dirty()):i.kind==="base64url"?Xc.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"base64url",code:z.invalid_string,message:i.message}),e.dirty()):Ee.assertNever(i);return{status:e.value,value:t.data}}_regex(t,r,e){return this.refinement(n=>t.test(n),{validation:r,code:z.invalid_string,...te.errToObj(e)})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...te.errToObj(t)})}url(t){return this._addCheck({kind:"url",...te.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...te.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...te.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...te.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...te.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...te.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...te.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...te.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...te.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...te.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...te.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...te.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...te.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...te.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...te.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...te.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...te.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...te.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...te.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...te.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...te.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...te.errToObj(r)})}nonempty(t){return this.min(1,te.errToObj(t))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Bt.create=s=>new Bt({checks:[],typeName:Z.ZodString,coerce:s?.coerce??!1,...he(s)});function nu(s,t){let r=(s.toString().split(".")[1]||"").length,e=(t.toString().split(".")[1]||"").length,n=r>e?r:e,i=Number.parseInt(s.toFixed(n).replace(".","")),a=Number.parseInt(t.toFixed(n).replace(".",""));return i%a/10**n}var sr=class s extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==K.number){let i=this._getOrReturnCtx(t);return Q(i,{code:z.invalid_type,expected:K.number,received:i.parsedType}),ae}let e,n=new Ke;for(let i of this._def.checks)i.kind==="int"?Ee.isInteger(t.data)||(e=this._getOrReturnCtx(t,e),Q(e,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(e=this._getOrReturnCtx(t,e),Q(e,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(e=this._getOrReturnCtx(t,e),Q(e,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?nu(t.data,i.value)!==0&&(e=this._getOrReturnCtx(t,e),Q(e,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(e=this._getOrReturnCtx(t,e),Q(e,{code:z.not_finite,message:i.message}),n.dirty()):Ee.assertNever(i);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,te.toString(r))}gt(t,r){return this.setLimit("min",t,!1,te.toString(r))}lte(t,r){return this.setLimit("max",t,!0,te.toString(r))}lt(t,r){return this.setLimit("max",t,!1,te.toString(r))}setLimit(t,r,e,n){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:e,message:te.toString(n)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:te.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:te.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:te.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:te.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:te.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:te.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:te.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:te.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:te.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ee.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let e of this._def.checks){if(e.kind==="finite"||e.kind==="int"||e.kind==="multipleOf")return!0;e.kind==="min"?(r===null||e.value>r)&&(r=e.value):e.kind==="max"&&(t===null||e.value<t)&&(t=e.value)}return Number.isFinite(r)&&Number.isFinite(t)}};sr.create=s=>new sr({checks:[],typeName:Z.ZodNumber,coerce:s?.coerce||!1,...he(s)});var nr=class s extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==K.bigint)return this._getInvalidInput(t);let e,n=new Ke;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(e=this._getOrReturnCtx(t,e),Q(e,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(e=this._getOrReturnCtx(t,e),Q(e,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(e=this._getOrReturnCtx(t,e),Q(e,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Ee.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Q(r,{code:z.invalid_type,expected:K.bigint,received:r.parsedType}),ae}gte(t,r){return this.setLimit("min",t,!0,te.toString(r))}gt(t,r){return this.setLimit("min",t,!1,te.toString(r))}lte(t,r){return this.setLimit("max",t,!0,te.toString(r))}lt(t,r){return this.setLimit("max",t,!1,te.toString(r))}setLimit(t,r,e,n){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:e,message:te.toString(n)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:te.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:te.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:te.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:te.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:te.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};nr.create=s=>new nr({checks:[],typeName:Z.ZodBigInt,coerce:s?.coerce??!1,...he(s)});var ir=class extends fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==K.boolean){let e=this._getOrReturnCtx(t);return Q(e,{code:z.invalid_type,expected:K.boolean,received:e.parsedType}),ae}return tt(t.data)}};ir.create=s=>new ir({typeName:Z.ZodBoolean,coerce:s?.coerce||!1,...he(s)});var or=class s extends fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==K.date){let i=this._getOrReturnCtx(t);return Q(i,{code:z.invalid_type,expected:K.date,received:i.parsedType}),ae}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Q(i,{code:z.invalid_date}),ae}let e=new Ke,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),e.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),e.dirty()):Ee.assertNever(i);return{status:e.value,value:new Date(t.data.getTime())}}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:te.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:te.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};or.create=s=>new or({checks:[],coerce:s?.coerce||!1,typeName:Z.ZodDate,...he(s)});var Qr=class extends fe{_parse(t){if(this._getType(t)!==K.symbol){let e=this._getOrReturnCtx(t);return Q(e,{code:z.invalid_type,expected:K.symbol,received:e.parsedType}),ae}return tt(t.data)}};Qr.create=s=>new Qr({typeName:Z.ZodSymbol,...he(s)});var lr=class extends fe{_parse(t){if(this._getType(t)!==K.undefined){let e=this._getOrReturnCtx(t);return Q(e,{code:z.invalid_type,expected:K.undefined,received:e.parsedType}),ae}return tt(t.data)}};lr.create=s=>new lr({typeName:Z.ZodUndefined,...he(s)});var cr=class extends fe{_parse(t){if(this._getType(t)!==K.null){let e=this._getOrReturnCtx(t);return Q(e,{code:z.invalid_type,expected:K.null,received:e.parsedType}),ae}return tt(t.data)}};cr.create=s=>new cr({typeName:Z.ZodNull,...he(s)});var Qt=class extends fe{constructor(){super(...arguments),this._any=!0}_parse(t){return tt(t.data)}};Qt.create=s=>new Qt({typeName:Z.ZodAny,...he(s)});var qt=class extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return tt(t.data)}};qt.create=s=>new qt({typeName:Z.ZodUnknown,...he(s)});var Pt=class extends fe{_parse(t){let r=this._getOrReturnCtx(t);return Q(r,{code:z.invalid_type,expected:K.never,received:r.parsedType}),ae}};Pt.create=s=>new Pt({typeName:Z.ZodNever,...he(s)});var Gr=class extends fe{_parse(t){if(this._getType(t)!==K.undefined){let e=this._getOrReturnCtx(t);return Q(e,{code:z.invalid_type,expected:K.void,received:e.parsedType}),ae}return tt(t.data)}};Gr.create=s=>new Gr({typeName:Z.ZodVoid,...he(s)});var Ut=class s extends fe{_parse(t){let{ctx:r,status:e}=this._processInputParams(t),n=this._def;if(r.parsedType!==K.array)return Q(r,{code:z.invalid_type,expected:K.array,received:r.parsedType}),ae;if(n.exactLength!==null){let a=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(a||o)&&(Q(r,{code:a?z.too_big:z.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),e.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(Q(r,{code:z.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),e.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(Q(r,{code:z.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),e.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>n.type._parseAsync(new mt(r,a,r.path,o)))).then(a=>Ke.mergeArray(e,a));let i=[...r.data].map((a,o)=>n.type._parseSync(new mt(r,a,r.path,o)));return Ke.mergeArray(e,i)}get element(){return this._def.type}min(t,r){return new s({...this._def,minLength:{value:t,message:te.toString(r)}})}max(t,r){return new s({...this._def,maxLength:{value:t,message:te.toString(r)}})}length(t,r){return new s({...this._def,exactLength:{value:t,message:te.toString(r)}})}nonempty(t){return this.min(1,t)}};Ut.create=(s,t)=>new Ut({type:s,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...he(t)});function Vr(s){if(s instanceof rt){let t={};for(let r in s.shape){let e=s.shape[r];t[r]=ut.create(Vr(e))}return new rt({...s._def,shape:()=>t})}else return s instanceof Ut?new Ut({...s._def,type:Vr(s.element)}):s instanceof ut?ut.create(Vr(s.unwrap())):s instanceof Ot?Ot.create(Vr(s.unwrap())):s instanceof Ct?Ct.create(s.items.map(t=>Vr(t))):s}var rt=class s extends fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==K.object){let l=this._getOrReturnCtx(t);return Q(l,{code:z.invalid_type,expected:K.object,received:l.parsedType}),ae}let{status:e,ctx:n}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Pt&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||o.push(l);let c=[];for(let l of a){let f=i[l],y=n.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new mt(n,y,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Pt){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(l==="strict")o.length>0&&(Q(n,{code:z.unrecognized_keys,keys:o}),e.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of o){let y=n.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new mt(n,y,n.path,f)),alwaysSet:f in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of c){let y=await f.key,R=await f.value;l.push({key:y,value:R,alwaysSet:f.alwaysSet})}return l}).then(l=>Ke.mergeObjectSync(e,l)):Ke.mergeObjectSync(e,c)}get shape(){return this._def.shape()}strict(t){return te.errToObj,new s({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,e)=>{let n=this._def.errorMap?.(r,e).message??e.defaultError;return r.code==="unrecognized_keys"?{message:te.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(t){return new s({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new s({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new s({...this._def,catchall:t})}pick(t){let r={};for(let e of Ee.objectKeys(t))t[e]&&this.shape[e]&&(r[e]=this.shape[e]);return new s({...this._def,shape:()=>r})}omit(t){let r={};for(let e of Ee.objectKeys(this.shape))t[e]||(r[e]=this.shape[e]);return new s({...this._def,shape:()=>r})}deepPartial(){return Vr(this)}partial(t){let r={};for(let e of Ee.objectKeys(this.shape)){let n=this.shape[e];t&&!t[e]?r[e]=n:r[e]=n.optional()}return new s({...this._def,shape:()=>r})}required(t){let r={};for(let e of Ee.objectKeys(this.shape))if(t&&!t[e])r[e]=this.shape[e];else{let i=this.shape[e];for(;i instanceof ut;)i=i._def.innerType;r[e]=i}return new s({...this._def,shape:()=>r})}keyof(){return Dn(Ee.objectKeys(this.shape))}};rt.create=(s,t)=>new rt({shape:()=>s,unknownKeys:"strip",catchall:Pt.create(),typeName:Z.ZodObject,...he(t)});rt.strictCreate=(s,t)=>new rt({shape:()=>s,unknownKeys:"strict",catchall:Pt.create(),typeName:Z.ZodObject,...he(t)});rt.lazycreate=(s,t)=>new rt({shape:s,unknownKeys:"strip",catchall:Pt.create(),typeName:Z.ZodObject,...he(t)});var ur=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),e=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new ct(o.ctx.common.issues));return Q(r,{code:z.invalid_union,unionErrors:a}),ae}if(r.common.async)return Promise.all(e.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let c of e){let l={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(c=>new ct(c));return Q(r,{code:z.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}};ur.create=(s,t)=>new ur({options:s,typeName:Z.ZodUnion,...he(t)});var Mt=s=>s instanceof fr?Mt(s.schema):s instanceof dt?Mt(s.innerType()):s instanceof hr?[s.value]:s instanceof pr?s.options:s instanceof mr?Ee.objectValues(s.enum):s instanceof vr?Mt(s._def.innerType):s instanceof lr?[void 0]:s instanceof cr?[null]:s instanceof ut?[void 0,...Mt(s.unwrap())]:s instanceof Ot?[null,...Mt(s.unwrap())]:s instanceof Sa||s instanceof yr?Mt(s.unwrap()):s instanceof gr?Mt(s._def.innerType):[],La=class s extends fe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==K.object)return Q(r,{code:z.invalid_type,expected:K.object,received:r.parsedType}),ae;let e=this.discriminator,n=r.data[e],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(Q(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[e]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,e){let n=new Map;for(let i of r){let a=Mt(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);n.set(o,i)}}return new s({typeName:Z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...he(e)})}};function hs(s,t){let r=Lt(s),e=Lt(t);if(s===t)return{valid:!0,data:s};if(r===K.object&&e===K.object){let n=Ee.objectKeys(t),i=Ee.objectKeys(s).filter(o=>n.indexOf(o)!==-1),a={...s,...t};for(let o of i){let c=hs(s[o],t[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(r===K.array&&e===K.array){if(s.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<s.length;i++){let a=s[i],o=t[i],c=hs(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===K.date&&e===K.date&&+s==+t?{valid:!0,data:s}:{valid:!1}}var dr=class extends fe{_parse(t){let{status:r,ctx:e}=this._processInputParams(t),n=(i,a)=>{if(ds(i)||ds(a))return ae;let o=hs(i.value,a.value);return o.valid?((fs(i)||fs(a))&&r.dirty(),{status:r.value,value:o.data}):(Q(e,{code:z.invalid_intersection_types}),ae)};return e.common.async?Promise.all([this._def.left._parseAsync({data:e.data,path:e.path,parent:e}),this._def.right._parseAsync({data:e.data,path:e.path,parent:e})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:e.data,path:e.path,parent:e}),this._def.right._parseSync({data:e.data,path:e.path,parent:e}))}};dr.create=(s,t,r)=>new dr({left:s,right:t,typeName:Z.ZodIntersection,...he(r)});var Ct=class s extends fe{_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==K.array)return Q(e,{code:z.invalid_type,expected:K.array,received:e.parsedType}),ae;if(e.data.length<this._def.items.length)return Q(e,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&e.data.length>this._def.items.length&&(Q(e,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...e.data].map((a,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new mt(e,a,e.path,o)):null}).filter(a=>!!a);return e.common.async?Promise.all(i).then(a=>Ke.mergeArray(r,a)):Ke.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new s({...this._def,rest:t})}};Ct.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ct({items:s,typeName:Z.ZodTuple,rest:null,...he(t)})};var qa=class s extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==K.object)return Q(e,{code:z.invalid_type,expected:K.object,received:e.parsedType}),ae;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in e.data)n.push({key:i._parse(new mt(e,o,e.path,o)),value:a._parse(new mt(e,e.data[o],e.path,o)),alwaysSet:o in e.data});return e.common.async?Ke.mergeObjectAsync(r,n):Ke.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,e){return r instanceof fe?new s({keyType:t,valueType:r,typeName:Z.ZodRecord,...he(e)}):new s({keyType:Bt.create(),valueType:t,typeName:Z.ZodRecord,...he(r)})}},Jr=class extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==K.map)return Q(e,{code:z.invalid_type,expected:K.map,received:e.parsedType}),ae;let n=this._def.keyType,i=this._def.valueType,a=[...e.data.entries()].map(([o,c],l)=>({key:n._parse(new mt(e,o,e.path,[l,"key"])),value:i._parse(new mt(e,c,e.path,[l,"value"]))}));if(e.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return ae;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(l.value,f.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of a){let l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return ae;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(l.value,f.value)}return{status:r.value,value:o}}}};Jr.create=(s,t,r)=>new Jr({valueType:t,keyType:s,typeName:Z.ZodMap,...he(r)});var Wr=class s extends fe{_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==K.set)return Q(e,{code:z.invalid_type,expected:K.set,received:e.parsedType}),ae;let n=this._def;n.minSize!==null&&e.data.size<n.minSize.value&&(Q(e,{code:z.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&e.data.size>n.maxSize.value&&(Q(e,{code:z.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let f of c){if(f.status==="aborted")return ae;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let o=[...e.data.values()].map((c,l)=>i._parse(new mt(e,c,e.path,l)));return e.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(t,r){return new s({...this._def,minSize:{value:t,message:te.toString(r)}})}max(t,r){return new s({...this._def,maxSize:{value:t,message:te.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Wr.create=(s,t)=>new Wr({valueType:s,minSize:null,maxSize:null,typeName:Z.ZodSet,...he(t)});var Ua=class s extends fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==K.function)return Q(r,{code:z.invalid_type,expected:K.function,received:r.parsedType}),ae;function e(o,c){return Ma({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fa(),Br].filter(l=>!!l),issueData:{code:z.invalid_arguments,argumentsError:c}})}function n(o,c){return Ma({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fa(),Br].filter(l=>!!l),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Gt){let o=this;return tt(async function(...c){let l=new ct([]),f=await o._def.args.parseAsync(c,i).catch(m=>{throw l.addIssue(e(c,m)),l}),y=await Reflect.apply(a,this,f);return await o._def.returns._def.type.parseAsync(y,i).catch(m=>{throw l.addIssue(n(y,m)),l})})}else{let o=this;return tt(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new ct([e(c,l.error)]);let f=Reflect.apply(a,this,l.data),y=o._def.returns.safeParse(f,i);if(!y.success)throw new ct([n(f,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new s({...this._def,args:Ct.create(t).rest(qt.create())})}returns(t){return new s({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,e){return new s({args:t||Ct.create([]).rest(qt.create()),returns:r||qt.create(),typeName:Z.ZodFunction,...he(e)})}},fr=class extends fe{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};fr.create=(s,t)=>new fr({getter:s,typeName:Z.ZodLazy,...he(t)});var hr=class extends fe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Q(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}};hr.create=(s,t)=>new hr({value:s,typeName:Z.ZodLiteral,...he(t)});function Dn(s,t){return new pr({values:s,typeName:Z.ZodEnum,...he(t)})}var pr=class s extends fe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),e=this._def.values;return Q(r,{expected:Ee.joinValues(e),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),e=this._def.values;return Q(r,{received:r.data,code:z.invalid_enum_value,options:e}),ae}return tt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return s.create(t,{...this._def,...r})}exclude(t,r=this._def){return s.create(this.options.filter(e=>!t.includes(e)),{...this._def,...r})}};pr.create=Dn;var mr=class extends fe{_parse(t){let r=Ee.getValidEnumValues(this._def.values),e=this._getOrReturnCtx(t);if(e.parsedType!==K.string&&e.parsedType!==K.number){let n=Ee.objectValues(r);return Q(e,{expected:Ee.joinValues(n),received:e.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(Ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=Ee.objectValues(r);return Q(e,{received:e.data,code:z.invalid_enum_value,options:n}),ae}return tt(t.data)}get enum(){return this._def.values}};mr.create=(s,t)=>new mr({values:s,typeName:Z.ZodNativeEnum,...he(t)});var Gt=class extends fe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==K.promise&&r.common.async===!1)return Q(r,{code:z.invalid_type,expected:K.promise,received:r.parsedType}),ae;let e=r.parsedType===K.promise?r.data:Promise.resolve(r.data);return tt(e.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Gt.create=(s,t)=>new Gt({type:s,typeName:Z.ZodPromise,...he(t)});var dt=class extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:e}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:a=>{Q(e,a),a.fatal?r.abort():r.dirty()},get path(){return e.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let a=n.transform(e.data,i);if(e.common.async)return Promise.resolve(a).then(async o=>{if(r.value==="aborted")return ae;let c=await this._def.schema._parseAsync({data:o,path:e.path,parent:e});return c.status==="aborted"?ae:c.status==="dirty"||r.value==="dirty"?Hr(c.value):c});{if(r.value==="aborted")return ae;let o=this._def.schema._parseSync({data:a,path:e.path,parent:e});return o.status==="aborted"?ae:o.status==="dirty"||r.value==="dirty"?Hr(o.value):o}}if(n.type==="refinement"){let a=o=>{let c=n.refinement(o,i);if(e.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(e.common.async===!1){let o=this._def.schema._parseSync({data:e.data,path:e.path,parent:e});return o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:e.data,path:e.path,parent:e}).then(o=>o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(e.common.async===!1){let a=this._def.schema._parseSync({data:e.data,path:e.path,parent:e});if(!ar(a))return ae;let o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:e.data,path:e.path,parent:e}).then(a=>ar(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:r.value,value:o})):ae);Ee.assertNever(n)}};dt.create=(s,t,r)=>new dt({schema:s,typeName:Z.ZodEffects,effect:t,...he(r)});dt.createWithPreprocess=(s,t,r)=>new dt({schema:t,effect:{type:"preprocess",transform:s},typeName:Z.ZodEffects,...he(r)});var ut=class extends fe{_parse(t){return this._getType(t)===K.undefined?tt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ut.create=(s,t)=>new ut({innerType:s,typeName:Z.ZodOptional,...he(t)});var Ot=class extends fe{_parse(t){return this._getType(t)===K.null?tt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ot.create=(s,t)=>new Ot({innerType:s,typeName:Z.ZodNullable,...he(t)});var vr=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),e=r.data;return r.parsedType===K.undefined&&(e=this._def.defaultValue()),this._def.innerType._parse({data:e,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};vr.create=(s,t)=>new vr({innerType:s,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...he(t)});var gr=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),e={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:e.data,path:e.path,parent:{...e}});return ba(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ct(e.common.issues)},input:e.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ct(e.common.issues)},input:e.data})}}removeCatch(){return this._def.innerType}};gr.create=(s,t)=>new gr({innerType:s,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...he(t)});var Kr=class extends fe{_parse(t){if(this._getType(t)!==K.nan){let e=this._getOrReturnCtx(t);return Q(e,{code:z.invalid_type,expected:K.nan,received:e.parsedType}),ae}return{status:"valid",value:t.data}}};Kr.create=s=>new Kr({typeName:Z.ZodNaN,...he(s)});var iu=Symbol("zod_brand"),Sa=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),e=r.data;return this._def.type._parse({data:e,path:r.path,parent:r})}unwrap(){return this._def.type}},xa=class s extends fe{_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:e.data,path:e.path,parent:e});return i.status==="aborted"?ae:i.status==="dirty"?(r.dirty(),Hr(i.value)):this._def.out._parseAsync({data:i.value,path:e.path,parent:e})})();{let n=this._def.in._parseSync({data:e.data,path:e.path,parent:e});return n.status==="aborted"?ae:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:e.path,parent:e})}}static create(t,r){return new s({in:t,out:r,typeName:Z.ZodPipeline})}},yr=class extends fe{_parse(t){let r=this._def.innerType._parse(t),e=n=>(ar(n)&&(n.value=Object.freeze(n.value)),n);return ba(r)?r.then(n=>e(n)):e(r)}unwrap(){return this._def.innerType}};yr.create=(s,t)=>new yr({innerType:s,typeName:Z.ZodReadonly,...he(t)});function hn(s,t){let r=typeof s=="function"?s(t):typeof s=="string"?{message:s}:s;return typeof r=="string"?{message:r}:r}function Nn(s,t={},r){return s?Qt.create().superRefine((e,n)=>{let i=s(e);if(i instanceof Promise)return i.then(a=>{if(!a){let o=hn(t,e),c=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:c})}});if(!i){let a=hn(t,e),o=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:o})}}):Qt.create()}var ou={object:rt.lazycreate},Z;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(Z||(Z={}));var lu=(s,t={message:`Input not instance of ${s.name}`})=>Nn(r=>r instanceof s,t),Fn=Bt.create,Mn=sr.create,cu=Kr.create,uu=nr.create,Ln=ir.create,du=or.create,fu=Qr.create,hu=lr.create,pu=cr.create,mu=Qt.create,vu=qt.create,gu=Pt.create,yu=Gr.create,_u=Ut.create,bu=rt.create,Su=rt.strictCreate,xu=ur.create,Eu=La.create,wu=dr.create,Pu=Ct.create,Ru=qa.create,Tu=Jr.create,ku=Wr.create,Cu=Ua.create,Ou=fr.create,Iu=hr.create,$u=pr.create,Au=mr.create,ju=Gt.create,pn=dt.create,Du=ut.create,Nu=Ot.create,Fu=dt.createWithPreprocess,Mu=xa.create,Lu=()=>Fn().optional(),qu=()=>Mn().optional(),Uu=()=>Ln().optional(),zu={string:s=>Bt.create({...s,coerce:!0}),number:s=>sr.create({...s,coerce:!0}),boolean:s=>ir.create({...s,coerce:!0}),bigint:s=>nr.create({...s,coerce:!0}),date:s=>or.create({...s,coerce:!0})},Zu=ae,qn="2025-06-18",Vu=[qn,"2025-03-26","2024-11-05","2024-10-07"],Ha="2.0",Un=u.union([u.string(),u.number().int()]),zn=u.string(),Hu=u.object({progressToken:u.optional(Un)}).passthrough(),vt=u.object({_meta:u.optional(Hu)}).passthrough(),at=u.object({method:u.string(),params:u.optional(vt)}),Pa=u.object({_meta:u.optional(u.object({}).passthrough())}).passthrough(),It=u.object({method:u.string(),params:u.optional(Pa)}),gt=u.object({_meta:u.optional(u.object({}).passthrough())}).passthrough(),Ba=u.union([u.string(),u.number().int()]),Zn=u.object({jsonrpc:u.literal(Ha),id:Ba}).merge(at).strict(),Bu=s=>Zn.safeParse(s).success,Vn=u.object({jsonrpc:u.literal(Ha)}).merge(It).strict(),Qu=s=>Vn.safeParse(s).success,Hn=u.object({jsonrpc:u.literal(Ha),id:Ba,result:gt}).strict(),mn=s=>Hn.safeParse(s).success,qe;(function(s){s[s.ConnectionClosed=-32e3]="ConnectionClosed",s[s.RequestTimeout=-32001]="RequestTimeout",s[s.ParseError=-32700]="ParseError",s[s.InvalidRequest=-32600]="InvalidRequest",s[s.MethodNotFound=-32601]="MethodNotFound",s[s.InvalidParams=-32602]="InvalidParams",s[s.InternalError=-32603]="InternalError"})(qe||(qe={}));var Bn=u.object({jsonrpc:u.literal(Ha),id:Ba,error:u.object({code:u.number().int(),message:u.string(),data:u.optional(u.unknown())})}).strict(),Gu=s=>Bn.safeParse(s).success,lp=u.union([Zn,Vn,Hn,Bn]),Is=gt.strict(),$s=It.extend({method:u.literal("notifications/cancelled"),params:Pa.extend({requestId:Ba,reason:u.string().optional()})}),Ra=u.object({name:u.string(),title:u.optional(u.string())}).passthrough(),Qn=Ra.extend({version:u.string()}),Ju=u.object({experimental:u.optional(u.object({}).passthrough()),sampling:u.optional(u.object({}).passthrough()),elicitation:u.optional(u.object({}).passthrough()),roots:u.optional(u.object({listChanged:u.optional(u.boolean())}).passthrough())}).passthrough(),Gn=at.extend({method:u.literal("initialize"),params:vt.extend({protocolVersion:u.string(),capabilities:Ju,clientInfo:Qn})}),Wu=u.object({experimental:u.optional(u.object({}).passthrough()),logging:u.optional(u.object({}).passthrough()),completions:u.optional(u.object({}).passthrough()),prompts:u.optional(u.object({listChanged:u.optional(u.boolean())}).passthrough()),resources:u.optional(u.object({subscribe:u.optional(u.boolean()),listChanged:u.optional(u.boolean())}).passthrough()),tools:u.optional(u.object({listChanged:u.optional(u.boolean())}).passthrough())}).passthrough(),Ku=gt.extend({protocolVersion:u.string(),capabilities:Wu,serverInfo:Qn,instructions:u.optional(u.string())}),Jn=It.extend({method:u.literal("notifications/initialized")}),As=at.extend({method:u.literal("ping")}),Yu=u.object({progress:u.number(),total:u.optional(u.number()),message:u.optional(u.string())}).passthrough(),js=It.extend({method:u.literal("notifications/progress"),params:Pa.merge(Yu).extend({progressToken:Un})}),Qa=at.extend({params:vt.extend({cursor:u.optional(zn)}).optional()}),Ga=gt.extend({nextCursor:u.optional(zn)}),Wn=u.object({uri:u.string(),mimeType:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Kn=Wn.extend({text:u.string()}),Ds=u.string().refine(s=>{try{return atob(s),!0}catch{return!1}},{message:"Invalid Base64 string"}),Yn=Wn.extend({blob:Ds}),Xn=Ra.extend({uri:u.string(),description:u.optional(u.string()),mimeType:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}),Xu=Ra.extend({uriTemplate:u.string(),description:u.optional(u.string()),mimeType:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}),ps=Qa.extend({method:u.literal("resources/list")}),ed=Ga.extend({resources:u.array(Xn)}),ms=Qa.extend({method:u.literal("resources/templates/list")}),td=Ga.extend({resourceTemplates:u.array(Xu)}),vs=at.extend({method:u.literal("resources/read"),params:vt.extend({uri:u.string()})}),rd=gt.extend({contents:u.array(u.union([Kn,Yn]))}),ad=It.extend({method:u.literal("notifications/resources/list_changed")}),sd=at.extend({method:u.literal("resources/subscribe"),params:vt.extend({uri:u.string()})}),nd=at.extend({method:u.literal("resources/unsubscribe"),params:vt.extend({uri:u.string()})}),id=It.extend({method:u.literal("notifications/resources/updated"),params:Pa.extend({uri:u.string()})}),od=u.object({name:u.string(),description:u.optional(u.string()),required:u.optional(u.boolean())}).passthrough(),ld=Ra.extend({description:u.optional(u.string()),arguments:u.optional(u.array(od)),_meta:u.optional(u.object({}).passthrough())}),gs=Qa.extend({method:u.literal("prompts/list")}),cd=Ga.extend({prompts:u.array(ld)}),ys=at.extend({method:u.literal("prompts/get"),params:vt.extend({name:u.string(),arguments:u.optional(u.record(u.string()))})}),Ns=u.object({type:u.literal("text"),text:u.string(),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Fs=u.object({type:u.literal("image"),data:Ds,mimeType:u.string(),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Ms=u.object({type:u.literal("audio"),data:Ds,mimeType:u.string(),_meta:u.optional(u.object({}).passthrough())}).passthrough(),ud=u.object({type:u.literal("resource"),resource:u.union([Kn,Yn]),_meta:u.optional(u.object({}).passthrough())}).passthrough(),dd=Xn.extend({type:u.literal("resource_link")}),ei=u.union([Ns,Fs,Ms,dd,ud]),fd=u.object({role:u.enum(["user","assistant"]),content:ei}).passthrough(),hd=gt.extend({description:u.optional(u.string()),messages:u.array(fd)}),pd=It.extend({method:u.literal("notifications/prompts/list_changed")}),md=u.object({title:u.optional(u.string()),readOnlyHint:u.optional(u.boolean()),destructiveHint:u.optional(u.boolean()),idempotentHint:u.optional(u.boolean()),openWorldHint:u.optional(u.boolean())}).passthrough(),vd=Ra.extend({description:u.optional(u.string()),inputSchema:u.object({type:u.literal("object"),properties:u.optional(u.object({}).passthrough()),required:u.optional(u.array(u.string()))}).passthrough(),outputSchema:u.optional(u.object({type:u.literal("object"),properties:u.optional(u.object({}).passthrough()),required:u.optional(u.array(u.string()))}).passthrough()),annotations:u.optional(md),_meta:u.optional(u.object({}).passthrough())}),_s=Qa.extend({method:u.literal("tools/list")}),gd=Ga.extend({tools:u.array(vd)}),ti=gt.extend({content:u.array(ei).default([]),structuredContent:u.object({}).passthrough().optional(),isError:u.optional(u.boolean())}),cp=ti.or(gt.extend({toolResult:u.unknown()})),bs=at.extend({method:u.literal("tools/call"),params:vt.extend({name:u.string(),arguments:u.optional(u.record(u.unknown()))})}),yd=It.extend({method:u.literal("notifications/tools/list_changed")}),ri=u.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),_d=at.extend({method:u.literal("logging/setLevel"),params:vt.extend({level:ri})}),bd=It.extend({method:u.literal("notifications/message"),params:Pa.extend({level:ri,logger:u.optional(u.string()),data:u.unknown()})}),Sd=u.object({name:u.string().optional()}).passthrough(),xd=u.object({hints:u.optional(u.array(Sd)),costPriority:u.optional(u.number().min(0).max(1)),speedPriority:u.optional(u.number().min(0).max(1)),intelligencePriority:u.optional(u.number().min(0).max(1))}).passthrough(),Ed=u.object({role:u.enum(["user","assistant"]),content:u.union([Ns,Fs,Ms])}).passthrough(),wd=at.extend({method:u.literal("sampling/createMessage"),params:vt.extend({messages:u.array(Ed),systemPrompt:u.optional(u.string()),includeContext:u.optional(u.enum(["none","thisServer","allServers"])),temperature:u.optional(u.number()),maxTokens:u.number().int(),stopSequences:u.optional(u.array(u.string())),metadata:u.optional(u.object({}).passthrough()),modelPreferences:u.optional(xd)})}),ai=gt.extend({model:u.string(),stopReason:u.optional(u.enum(["endTurn","stopSequence","maxTokens"]).or(u.string())),role:u.enum(["user","assistant"]),content:u.discriminatedUnion("type",[Ns,Fs,Ms])}),Pd=u.object({type:u.literal("boolean"),title:u.optional(u.string()),description:u.optional(u.string()),default:u.optional(u.boolean())}).passthrough(),Rd=u.object({type:u.literal("string"),title:u.optional(u.string()),description:u.optional(u.string()),minLength:u.optional(u.number()),maxLength:u.optional(u.number()),format:u.optional(u.enum(["email","uri","date","date-time"]))}).passthrough(),Td=u.object({type:u.enum(["number","integer"]),title:u.optional(u.string()),description:u.optional(u.string()),minimum:u.optional(u.number()),maximum:u.optional(u.number())}).passthrough(),kd=u.object({type:u.literal("string"),title:u.optional(u.string()),description:u.optional(u.string()),enum:u.array(u.string()),enumNames:u.optional(u.array(u.string()))}).passthrough(),Cd=u.union([Pd,Rd,Td,kd]),Od=at.extend({method:u.literal("elicitation/create"),params:vt.extend({message:u.string(),requestedSchema:u.object({type:u.literal("object"),properties:u.record(u.string(),Cd),required:u.optional(u.array(u.string()))}).passthrough()})}),si=gt.extend({action:u.enum(["accept","decline","cancel"]),content:u.optional(u.record(u.string(),u.unknown()))}),Id=u.object({type:u.literal("ref/resource"),uri:u.string()}).passthrough(),$d=u.object({type:u.literal("ref/prompt"),name:u.string()}).passthrough(),Ss=at.extend({method:u.literal("completion/complete"),params:vt.extend({ref:u.union([$d,Id]),argument:u.object({name:u.string(),value:u.string()}).passthrough(),context:u.optional(u.object({arguments:u.optional(u.record(u.string(),u.string()))}))})}),Ad=gt.extend({completion:u.object({values:u.array(u.string()).max(100),total:u.optional(u.number().int()),hasMore:u.optional(u.boolean())}).passthrough()}),jd=u.object({uri:u.string().startsWith("file://"),name:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Dd=at.extend({method:u.literal("roots/list")}),ni=gt.extend({roots:u.array(jd)}),Nd=It.extend({method:u.literal("notifications/roots/list_changed")}),up=u.union([As,Gn,Ss,_d,ys,gs,ps,ms,vs,sd,nd,bs,_s]),dp=u.union([$s,js,Jn,Nd]),fp=u.union([Is,ai,si,ni]),hp=u.union([As,wd,Od,Dd]),pp=u.union([$s,js,bd,id,ad,yd,pd]),mp=u.union([Is,Ku,Ad,hd,cd,ed,td,rd,ti,gd]),Ue=class extends Error{constructor(t,r,e){super(`MCP error ${t}: ${r}`),this.code=t,this.data=e,this.name="McpError"}},Fd=6e4,xs=class{constructor(t){this._options=t,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($s,r=>{let e=this._requestHandlerAbortControllers.get(r.params.requestId);e?.abort(r.params.reason)}),this.setNotificationHandler(js,r=>{this._onprogress(r)}),this.setRequestHandler(As,r=>({}))}_setupTimeout(t,r,e,n,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:e,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let e=Date.now()-r.startTime;if(r.maxTotalTimeout&&e>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new Ue(qe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:e});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var r,e,n;this._transport=t;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let a=(e=this.transport)===null||e===void 0?void 0:e.onerror;this._transport.onerror=c=>{a?.(c),this._onerror(c)};let o=(n=this._transport)===null||n===void 0?void 0:n.onmessage;this._transport.onmessage=(c,l)=>{o?.(c,l),mn(c)||Gu(c)?this._onresponse(c):Bu(c)?this._onrequest(c,l):Qu(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var t;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);let e=new Ue(qe.ConnectionClosed,"Connection closed");for(let n of r.values())n(e)}_onerror(t){var r;(r=this.onerror)===null||r===void 0||r.call(this,t)}_onnotification(t){var r;let e=(r=this._notificationHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;e!==void 0&&Promise.resolve().then(()=>e(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){var e,n;let i=(e=this._requestHandlers.get(t.method))!==null&&e!==void 0?e:this.fallbackRequestHandler,a=this._transport;if(i===void 0){a?.send({jsonrpc:"2.0",id:t.id,error:{code:qe.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(t.id,o);let c={signal:o.signal,sessionId:a?.sessionId,_meta:(n=t.params)===null||n===void 0?void 0:n._meta,sendNotification:l=>this.notification(l,{relatedRequestId:t.id}),sendRequest:(l,f,y)=>this.request(l,f,{...y,relatedRequestId:t.id}),authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>i(t,c)).then(l=>{if(!o.signal.aborted)return a?.send({result:l,jsonrpc:"2.0",id:t.id})},l=>{var f;if(!o.signal.aborted)return a?.send({jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:qe.InternalError,message:(f=l.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...e}=t.params,n=Number(r),i=this._progressHandlers.get(n);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(n),o=this._timeoutInfo.get(n);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){a(c);return}i(e)}_onresponse(t){let r=Number(t.id),e=this._responseHandlers.get(r);if(e===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),mn(t))e(t);else{let n=new Ue(t.error.code,t.error.message,t.error.data);e(n)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}request(t,r,e){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a}=e??{};return new Promise((o,c)=>{var l,f,y,R,m,b;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(t.method),(f=e?.signal)===null||f===void 0||f.throwIfAborted();let d=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:d};e?.onprogress&&(this._progressHandlers.set(d,e.onprogress),p.params={...t.params,_meta:{...((y=t.params)===null||y===void 0?void 0:y._meta)||{},progressToken:d}});let _=$=>{var O;this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),(O=this._transport)===null||O===void 0||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String($)}},{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a}).catch(E=>this._onerror(new Error(`Failed to send cancellation: ${E}`))),c($)};this._responseHandlers.set(d,$=>{var O;if(!(!((O=e?.signal)===null||O===void 0)&&O.aborted)){if($ instanceof Error)return c($);try{let E=r.parse($.result);o(E)}catch(E){c(E)}}}),(R=e?.signal)===null||R===void 0||R.addEventListener("abort",()=>{var $;_(($=e?.signal)===null||$===void 0?void 0:$.reason)});let g=(m=e?.timeout)!==null&&m!==void 0?m:Fd,x=()=>_(new Ue(qe.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(d,g,e?.maxTotalTimeout,x,(b=e?.resetTimeoutOnProgress)!==null&&b!==void 0?b:!1),this._transport.send(p,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a}).catch($=>{this._cleanupTimeout(d),c($)})})}async notification(t,r){var e,n;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(t.method),((n=(e=this._options)===null||e===void 0?void 0:e.debouncedNotificationMethods)!==null&&n!==void 0?n:[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let l={...t,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,r).catch(f=>this._onerror(f))});return}let o={...t,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(t,r){let e=t.shape.method.value;this.assertRequestHandlerCapability(e),this._requestHandlers.set(e,(n,i)=>Promise.resolve(r(t.parse(n),i)))}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){this._notificationHandlers.set(t.shape.method.value,e=>Promise.resolve(r(t.parse(e))))}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function Md(s,t){return Object.entries(t).reduce((r,[e,n])=>(n&&typeof n=="object"?r[e]=r[e]?{...r[e],...n}:n:r[e]=n,r),{...s})}var Ld=Yi(jo(),1),Es=class extends xs{constructor(t,r){var e;super(r),this._serverInfo=t,this._capabilities=(e=r?.capabilities)!==null&&e!==void 0?e:{},this._instructions=r?.instructions,this.setRequestHandler(Gn,n=>this._oninitialize(n)),this.setNotificationHandler(Jn,()=>{var n;return(n=this.oninitialized)===null||n===void 0?void 0:n.call(this)})}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Md(this._capabilities,t)}assertCapabilityForMethod(t){var r,e,n;switch(t){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!(!((e=this._clientCapabilities)===null||e===void 0)&&e.elicitation))throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.roots))throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);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 ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);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 ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"ping":case"initialize":break}}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Vu.includes(r)?r:qn,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"},Is)}async createMessage(t,r){return this.request({method:"sampling/createMessage",params:t},ai,r)}async elicitInput(t,r){let e=await this.request({method:"elicitation/create",params:t},si,r);if(e.action==="accept"&&e.content)try{let n=new Ld.default,i=n.compile(t.requestedSchema);if(!i(e.content))throw new Ue(qe.InvalidParams,`Elicitation response content does not match requested schema: ${n.errorsText(i.errors)}`)}catch(n){throw n instanceof Ue?n:new Ue(qe.InternalError,`Error validating elicitation response: ${n}`)}return e}async listRoots(t,r){return this.request({method:"roots/list",params:t},ni,r)}async sendLoggingMessage(t){return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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"})}},qd=Symbol("Let zodToJsonSchema decide on which parser to use"),vn={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Ud=s=>typeof s=="string"?{...vn,name:s}:{...vn,...s},zd=s=>{let t=Ud(s),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function ii(s,t,r,e){e?.errorMessages&&r&&(s.errorMessage={...s.errorMessage,[t]:r})}function Ce(s,t,r,e,n){s[t]=r,ii(s,t,e,n)}function Zd(){return{}}function Vd(s,t){let r={type:"array"};return s.type?._def&&s.type?._def?.typeName!==Z.ZodAny&&(r.items=Te(s.type._def,{...t,currentPath:[...t.currentPath,"items"]})),s.minLength&&Ce(r,"minItems",s.minLength.value,s.minLength.message,t),s.maxLength&&Ce(r,"maxItems",s.maxLength.value,s.maxLength.message,t),s.exactLength&&(Ce(r,"minItems",s.exactLength.value,s.exactLength.message,t),Ce(r,"maxItems",s.exactLength.value,s.exactLength.message,t)),r}function Hd(s,t){let r={type:"integer",format:"int64"};if(!s.checks)return r;for(let e of s.checks)switch(e.kind){case"min":t.target==="jsonSchema7"?e.inclusive?Ce(r,"minimum",e.value,e.message,t):Ce(r,"exclusiveMinimum",e.value,e.message,t):(e.inclusive||(r.exclusiveMinimum=!0),Ce(r,"minimum",e.value,e.message,t));break;case"max":t.target==="jsonSchema7"?e.inclusive?Ce(r,"maximum",e.value,e.message,t):Ce(r,"exclusiveMaximum",e.value,e.message,t):(e.inclusive||(r.exclusiveMaximum=!0),Ce(r,"maximum",e.value,e.message,t));break;case"multipleOf":Ce(r,"multipleOf",e.value,e.message,t);break}return r}function Bd(){return{type:"boolean"}}function oi(s,t){return Te(s.type._def,t)}var Qd=(s,t)=>Te(s.innerType._def,t);function li(s,t,r){let e=r??t.dateStrategy;if(Array.isArray(e))return{anyOf:e.map((n,i)=>li(s,t,n))};switch(e){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Gd(s,t)}}var Gd=(s,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let e of s.checks)switch(e.kind){case"min":Ce(r,"minimum",e.value,e.message,t);break;case"max":Ce(r,"maximum",e.value,e.message,t);break}return r};function Jd(s,t){return{...Te(s.innerType._def,t),default:s.defaultValue()}}function Wd(s,t){return t.effectStrategy==="input"?Te(s.schema._def,t):{}}function Kd(s){return{type:"string",enum:Array.from(s.values)}}var Yd=s=>"type"in s&&s.type==="string"?!1:"allOf"in s;function Xd(s,t){let r=[Te(s.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Te(s.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),e=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(i=>{if(Yd(i))n.push(...i.allOf),i.unevaluatedProperties===void 0&&(e=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:o,...c}=i;a=c}else e=void 0;n.push(a)}}),n.length?{allOf:n,...e}:void 0}function ef(s,t){let r=typeof s.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(s.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[s.value]}:{type:r==="bigint"?"integer":r,const:s.value}}var os=void 0,Et={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(os===void 0&&(os=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),os),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ci(s,t){let r={type:"string"};if(s.checks)for(let e of s.checks)switch(e.kind){case"min":Ce(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,e.value):e.value,e.message,t);break;case"max":Ce(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,e.value):e.value,e.message,t);break;case"email":switch(t.emailStrategy){case"format:email":wt(r,"email",e.message,t);break;case"format:idn-email":wt(r,"idn-email",e.message,t);break;case"pattern:zod":et(r,Et.email,e.message,t);break}break;case"url":wt(r,"uri",e.message,t);break;case"uuid":wt(r,"uuid",e.message,t);break;case"regex":et(r,e.regex,e.message,t);break;case"cuid":et(r,Et.cuid,e.message,t);break;case"cuid2":et(r,Et.cuid2,e.message,t);break;case"startsWith":et(r,RegExp(`^${ls(e.value,t)}`),e.message,t);break;case"endsWith":et(r,RegExp(`${ls(e.value,t)}$`),e.message,t);break;case"datetime":wt(r,"date-time",e.message,t);break;case"date":wt(r,"date",e.message,t);break;case"time":wt(r,"time",e.message,t);break;case"duration":wt(r,"duration",e.message,t);break;case"length":Ce(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,e.value):e.value,e.message,t),Ce(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,e.value):e.value,e.message,t);break;case"includes":{et(r,RegExp(ls(e.value,t)),e.message,t);break}case"ip":{e.version!=="v6"&&wt(r,"ipv4",e.message,t),e.version!=="v4"&&wt(r,"ipv6",e.message,t);break}case"base64url":et(r,Et.base64url,e.message,t);break;case"jwt":et(r,Et.jwt,e.message,t);break;case"cidr":{e.version!=="v6"&&et(r,Et.ipv4Cidr,e.message,t),e.version!=="v4"&&et(r,Et.ipv6Cidr,e.message,t);break}case"emoji":et(r,Et.emoji(),e.message,t);break;case"ulid":{et(r,Et.ulid,e.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{wt(r,"binary",e.message,t);break}case"contentEncoding:base64":{Ce(r,"contentEncoding","base64",e.message,t);break}case"pattern:zod":{et(r,Et.base64,e.message,t);break}}break}case"nanoid":et(r,Et.nanoid,e.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function ls(s,t){return t.patternStrategy==="escape"?rf(s):s}var tf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function rf(s){let t="";for(let r=0;r<s.length;r++)tf.has(s[r])||(t+="\\"),t+=s[r];return t}function wt(s,t,r,e){s.format||s.anyOf?.some(n=>n.format)?(s.anyOf||(s.anyOf=[]),s.format&&(s.anyOf.push({format:s.format,...s.errorMessage&&e.errorMessages&&{errorMessage:{format:s.errorMessage.format}}}),delete s.format,s.errorMessage&&(delete s.errorMessage.format,Object.keys(s.errorMessage).length===0&&delete s.errorMessage)),s.anyOf.push({format:t,...r&&e.errorMessages&&{errorMessage:{format:r}}})):Ce(s,"format",t,r,e)}function et(s,t,r,e){s.pattern||s.allOf?.some(n=>n.pattern)?(s.allOf||(s.allOf=[]),s.pattern&&(s.allOf.push({pattern:s.pattern,...s.errorMessage&&e.errorMessages&&{errorMessage:{pattern:s.errorMessage.pattern}}}),delete s.pattern,s.errorMessage&&(delete s.errorMessage.pattern,Object.keys(s.errorMessage).length===0&&delete s.errorMessage)),s.allOf.push({pattern:gn(t,e),...r&&e.errorMessages&&{errorMessage:{pattern:r}}})):Ce(s,"pattern",gn(t,e),r,e)}function gn(s,t){if(!t.applyRegexFlags||!s.flags)return s.source;let r={i:s.flags.includes("i"),m:s.flags.includes("m"),s:s.flags.includes("s")},e=r.i?s.source.toLowerCase():s.source,n="",i=!1,a=!1,o=!1;for(let c=0;c<e.length;c++){if(i){n+=e[c],i=!1;continue}if(r.i){if(a){if(e[c].match(/[a-z]/)){o?(n+=e[c],n+=`${e[c-2]}-${e[c]}`.toUpperCase(),o=!1):e[c+1]==="-"&&e[c+2]?.match(/[a-z]/)?(n+=e[c],o=!0):n+=`${e[c]}${e[c].toUpperCase()}`;continue}}else if(e[c].match(/[a-z]/)){n+=`[${e[c]}${e[c].toUpperCase()}]`;continue}}if(r.m){if(e[c]==="^"){n+=`(^|(?<=[\r
]))`;continue}else if(e[c]==="$"){n+=`($|(?=[\r
]))`;continue}}if(r.s&&e[c]==="."){n+=a?`${e[c]}\r
`:`[${e[c]}\r
]`;continue}n+=e[c],e[c]==="\\"?i=!0:a&&e[c]==="]"?a=!1:!a&&e[c]==="["&&(a=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),s.source}return n}function ui(s,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&s.keyType?._def.typeName===Z.ZodEnum)return{type:"object",required:s.keyType._def.values,properties:s.keyType._def.values.reduce((e,n)=>({...e,[n]:Te(s.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??{}}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Te(s.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(s.keyType?._def.typeName===Z.ZodString&&s.keyType._def.checks?.length){let{type:e,...n}=ci(s.keyType._def,t);return{...r,propertyNames:n}}else{if(s.keyType?._def.typeName===Z.ZodEnum)return{...r,propertyNames:{enum:s.keyType._def.values}};if(s.keyType?._def.typeName===Z.ZodBranded&&s.keyType._def.type._def.typeName===Z.ZodString&&s.keyType._def.type._def.checks?.length){let{type:e,...n}=oi(s.keyType._def,t);return{...r,propertyNames:n}}}return r}function af(s,t){if(t.mapStrategy==="record")return ui(s,t);let r=Te(s.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},e=Te(s.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,e],minItems:2,maxItems:2}}}function sf(s){let t=s.values,e=Object.keys(s.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),n=Array.from(new Set(e.map(i=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:e}}function nf(){return{not:{}}}function of(s){return s.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var za={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function lf(s,t){if(t.target==="openApi3")return yn(s,t);let r=s.options instanceof Map?Array.from(s.options.values()):s.options;if(r.every(e=>e._def.typeName in za&&(!e._def.checks||!e._def.checks.length))){let e=r.reduce((n,i)=>{let a=za[i._def.typeName];return a&&!n.includes(a)?[...n,a]:n},[]);return{type:e.length>1?e:e[0]}}else if(r.every(e=>e._def.typeName==="ZodLiteral"&&!e.description)){let e=r.reduce((n,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...n,a];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(e.length===r.length){let n=e.filter((i,a,o)=>o.indexOf(i)===a);return{type:n.length>1?n:n[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(e=>e._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((e,n)=>[...e,...n._def.values.filter(i=>!e.includes(i))],[])};return yn(s,t)}var yn=(s,t)=>{let r=(s.options instanceof Map?Array.from(s.options.values()):s.options).map((e,n)=>Te(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e=="object"&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function cf(s,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(s.innerType._def.typeName)&&(!s.innerType._def.checks||!s.innerType._def.checks.length))return t.target==="openApi3"?{type:za[s.innerType._def.typeName],nullable:!0}:{type:[za[s.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let e=Te(s.innerType._def,{...t,currentPath:[...t.currentPath]});return e&&"$ref"in e?{allOf:[e],nullable:!0}:e&&{...e,nullable:!0}}let r=Te(s.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function uf(s,t){let r={type:"number"};if(!s.checks)return r;for(let e of s.checks)switch(e.kind){case"int":r.type="integer",ii(r,"type",e.message,t);break;case"min":t.target==="jsonSchema7"?e.inclusive?Ce(r,"minimum",e.value,e.message,t):Ce(r,"exclusiveMinimum",e.value,e.message,t):(e.inclusive||(r.exclusiveMinimum=!0),Ce(r,"minimum",e.value,e.message,t));break;case"max":t.target==="jsonSchema7"?e.inclusive?Ce(r,"maximum",e.value,e.message,t):Ce(r,"exclusiveMaximum",e.value,e.message,t):(e.inclusive||(r.exclusiveMaximum=!0),Ce(r,"maximum",e.value,e.message,t));break;case"multipleOf":Ce(r,"multipleOf",e.value,e.message,t);break}return r}function df(s,t){let r=t.target==="openAi",e={type:"object",properties:{}},n=[],i=s.shape();for(let o in i){let c=i[o];if(c===void 0||c._def===void 0)continue;let l=hf(c);l&&r&&(c instanceof ut&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);let f=Te(c._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});f!==void 0&&(e.properties[o]=f,l||n.push(o))}n.length&&(e.required=n);let a=ff(s,t);return a!==void 0&&(e.additionalProperties=a),e}function ff(s,t){if(s.catchall._def.typeName!=="ZodNever")return Te(s.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(s.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function hf(s){try{return s.isOptional()}catch{return!0}}var pf=(s,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Te(s.innerType._def,t);let r=Te(s.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}},mf=(s,t)=>{if(t.pipeStrategy==="input")return Te(s.in._def,t);if(t.pipeStrategy==="output")return Te(s.out._def,t);let r=Te(s.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),e=Te(s.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,e].filter(n=>n!==void 0)}};function vf(s,t){return Te(s.type._def,t)}function gf(s,t){let e={type:"array",uniqueItems:!0,items:Te(s.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return s.minSize&&Ce(e,"minItems",s.minSize.value,s.minSize.message,t),s.maxSize&&Ce(e,"maxItems",s.maxSize.value,s.maxSize.message,t),e}function yf(s,t){return s.rest?{type:"array",minItems:s.items.length,items:s.items.map((r,e)=>Te(r._def,{...t,currentPath:[...t.currentPath,"items",`${e}`]})).reduce((r,e)=>e===void 0?r:[...r,e],[]),additionalItems:Te(s.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:s.items.length,maxItems:s.items.length,items:s.items.map((r,e)=>Te(r._def,{...t,currentPath:[...t.currentPath,"items",`${e}`]})).reduce((r,e)=>e===void 0?r:[...r,e],[])}}function _f(){return{not:{}}}function bf(){return{}}var Sf=(s,t)=>Te(s.innerType._def,t),xf=(s,t,r)=>{switch(t){case Z.ZodString:return ci(s,r);case Z.ZodNumber:return uf(s,r);case Z.ZodObject:return df(s,r);case Z.ZodBigInt:return Hd(s,r);case Z.ZodBoolean:return Bd();case Z.ZodDate:return li(s,r);case Z.ZodUndefined:return _f();case Z.ZodNull:return of(r);case Z.ZodArray:return Vd(s,r);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return lf(s,r);case Z.ZodIntersection:return Xd(s,r);case Z.ZodTuple:return yf(s,r);case Z.ZodRecord:return ui(s,r);case Z.ZodLiteral:return ef(s,r);case Z.ZodEnum:return Kd(s);case Z.ZodNativeEnum:return sf(s);case Z.ZodNullable:return cf(s,r);case Z.ZodOptional:return pf(s,r);case Z.ZodMap:return af(s,r);case Z.ZodSet:return gf(s,r);case Z.ZodLazy:return()=>s.getter()._def;case Z.ZodPromise:return vf(s,r);case Z.ZodNaN:case Z.ZodNever:return nf();case Z.ZodEffects:return Wd(s,r);case Z.ZodAny:return Zd();case Z.ZodUnknown:return bf();case Z.ZodDefault:return Jd(s,r);case Z.ZodBranded:return oi(s,r);case Z.ZodReadonly:return Sf(s,r);case Z.ZodCatch:return Qd(s,r);case Z.ZodPipeline:return mf(s,r);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return(e=>{})(t)}};function Te(s,t,r=!1){let e=t.seen.get(s);if(t.override){let o=t.override?.(s,t,e,r);if(o!==qd)return o}if(e&&!r){let o=Ef(e,t);if(o!==void 0)return o}let n={def:s,path:t.currentPath,jsonSchema:void 0};t.seen.set(s,n);let i=xf(s,s.typeName,t),a=typeof i=="function"?Te(i(),t):i;if(a&&Pf(s,t,a),t.postProcess){let o=t.postProcess(a,s,t);return n.jsonSchema=a,o}return n.jsonSchema=a,a}var Ef=(s,t)=>{switch(t.$refStrategy){case"root":return{$ref:s.path.join("/")};case"relative":return{$ref:wf(t.currentPath,s.path)};case"none":case"seen":return s.path.length<t.currentPath.length&&s.path.every((r,e)=>t.currentPath[e]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):t.$refStrategy==="seen"?{}:void 0}},wf=(s,t)=>{let r=0;for(;r<s.length&&r<t.length&&s[r]===t[r];r++);return[(s.length-r).toString(),...t.slice(r)].join("/")},Pf=(s,t,r)=>(s.description&&(r.description=s.description,t.markdownDescription&&(r.markdownDescription=s.description)),r),_n=(s,t)=>{let r=zd(t),e=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,f])=>({...c,[l]:Te(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,n=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=Te(s._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a);let o=n===void 0?e?{...i,[r.definitionPath]:e}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...e,[n]:i}};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o},ws;(function(s){s.Completable="McpCompletable"})(ws||(ws={}));var Ea=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),e=r.data;return this._def.type._parse({data:e,path:r.path,parent:r})}unwrap(){return this._def.type}};Ea.create=(s,t)=>new Ea({type:s,typeName:ws.Completable,complete:t.complete,...Rf(t)});function Rf(s){if(!s)return{};let{errorMap:t,invalid_type_error:r,required_error:e,description:n}=s;if(t&&(r||e))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(a,o)=>{var c,l;let{message:f}=s;return a.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(c=f??e)!==null&&c!==void 0?c:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(l=f??r)!==null&&l!==void 0?l:o.defaultError}},description:n}}var Ps=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Es(t,r)}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(_s.shape.method.value),this.server.assertCanSetRequestHandler(bs.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(_s,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let e={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?_n(r.inputSchema,{strictUnions:!0}):Tf,annotations:r.annotations};return r.outputSchema&&(e.outputSchema=_n(r.outputSchema,{strictUnions:!0})),e})})),this.server.setRequestHandler(bs,async(t,r)=>{let e=this._registeredTools[t.params.name];if(!e)throw new Ue(qe.InvalidParams,`Tool ${t.params.name} not found`);if(!e.enabled)throw new Ue(qe.InvalidParams,`Tool ${t.params.name} disabled`);let n;if(e.inputSchema){let i=await e.inputSchema.safeParseAsync(t.params.arguments);if(!i.success)throw new Ue(qe.InvalidParams,`Invalid arguments for tool ${t.params.name}: ${i.error.message}`);let a=i.data,o=e.callback;try{n=await Promise.resolve(o(a,r))}catch(c){n={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{let i=e.callback;try{n=await Promise.resolve(i(r))}catch(a){n={content:[{type:"text",text:a instanceof Error?a.message:String(a)}],isError:!0}}}if(e.outputSchema&&!n.isError){if(!n.structuredContent)throw new Ue(qe.InvalidParams,`Tool ${t.params.name} has an output schema but no structured content was provided`);let i=await e.outputSchema.safeParseAsync(n.structuredContent);if(!i.success)throw new Ue(qe.InvalidParams,`Invalid structured content for tool ${t.params.name}: ${i.error.message}`)}return n}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Ss.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ss,async t=>{switch(t.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return this.handleResourceCompletion(t,t.params.ref);default:throw new Ue(qe.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let e=this._registeredPrompts[r.name];if(!e)throw new Ue(qe.InvalidParams,`Prompt ${r.name} not found`);if(!e.enabled)throw new Ue(qe.InvalidParams,`Prompt ${r.name} disabled`);if(!e.argsSchema)return Da;let n=e.argsSchema.shape[t.params.argument.name];if(!(n instanceof Ea))return Da;let a=await n._def.complete(t.params.argument.value,t.params.context);return Sn(a)}async handleResourceCompletion(t,r){let e=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===r.uri);if(!e){if(this._registeredResources[r.uri])return Da;throw new Ue(qe.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let n=e.resourceTemplate.completeCallback(t.params.argument.name);if(!n)return Da;let i=await n(t.params.argument.value,t.params.context);return Sn(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(ps.shape.method.value),this.server.assertCanSetRequestHandler(ms.shape.method.value),this.server.assertCanSetRequestHandler(vs.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(ps,async(t,r)=>{let e=Object.entries(this._registeredResources).filter(([i,a])=>a.enabled).map(([i,a])=>({uri:i,name:a.name,...a.metadata})),n=[];for(let i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;let a=await i.resourceTemplate.listCallback(r);for(let o of a.resources)n.push({...i.metadata,...o})}return{resources:[...e,...n]}}),this.server.setRequestHandler(ms,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,e])=>({name:r,uriTemplate:e.resourceTemplate.uriTemplate.toString(),...e.metadata}))})),this.server.setRequestHandler(vs,async(t,r)=>{let e=new URL(t.params.uri),n=this._registeredResources[e.toString()];if(n){if(!n.enabled)throw new Ue(qe.InvalidParams,`Resource ${e} disabled`);return n.readCallback(e,r)}for(let i of Object.values(this._registeredResourceTemplates)){let a=i.resourceTemplate.uriTemplate.match(e.toString());if(a)return i.readCallback(e,a,r)}throw new Ue(qe.InvalidParams,`Resource ${e} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(gs.shape.method.value),this.server.assertCanSetRequestHandler(ys.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(gs,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?Cf(r.argsSchema):void 0}))})),this.server.setRequestHandler(ys,async(t,r)=>{let e=this._registeredPrompts[t.params.name];if(!e)throw new Ue(qe.InvalidParams,`Prompt ${t.params.name} not found`);if(!e.enabled)throw new Ue(qe.InvalidParams,`Prompt ${t.params.name} disabled`);if(e.argsSchema){let n=await e.argsSchema.safeParseAsync(t.params.arguments);if(!n.success)throw new Ue(qe.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${n.error.message}`);let i=n.data,a=e.callback;return await Promise.resolve(a(i,r))}else{let n=e.callback;return await Promise.resolve(n(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(t,r,...e){let n;typeof e[0]=="object"&&(n=e.shift());let i=e[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let a=this._createRegisteredResource(t,void 0,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let a=this._createRegisteredResourceTemplate(t,void 0,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(t,r,e,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(t,e.title,r,e,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let i=this._createRegisteredResourceTemplate(t,e.title,r,e,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(t,r,e,n,i){let a={name:t,title:r,metadata:n,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==e&&(delete this._registeredResources[e],o.uri&&(this._registeredResources[o.uri]=a)),typeof o.name<"u"&&(a.name=o.name),typeof o.title<"u"&&(a.title=o.title),typeof o.metadata<"u"&&(a.metadata=o.metadata),typeof o.callback<"u"&&(a.readCallback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[e]=a,a}_createRegisteredResourceTemplate(t,r,e,n,i){let a={resourceTemplate:e,title:r,metadata:n,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==t&&(delete this._registeredResourceTemplates[t],o.name&&(this._registeredResourceTemplates[o.name]=a)),typeof o.title<"u"&&(a.title=o.title),typeof o.template<"u"&&(a.resourceTemplate=o.template),typeof o.metadata<"u"&&(a.metadata=o.metadata),typeof o.callback<"u"&&(a.readCallback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[t]=a,a}_createRegisteredPrompt(t,r,e,n,i){let a={title:r,description:e,argsSchema:n===void 0?void 0:u.object(n),callback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==t&&(delete this._registeredPrompts[t],o.name&&(this._registeredPrompts[o.name]=a)),typeof o.title<"u"&&(a.title=o.title),typeof o.description<"u"&&(a.description=o.description),typeof o.argsSchema<"u"&&(a.argsSchema=u.object(o.argsSchema)),typeof o.callback<"u"&&(a.callback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=a,a}_createRegisteredTool(t,r,e,n,i,a,o){let c={title:r,description:e,inputSchema:n===void 0?void 0:u.object(n),outputSchema:i===void 0?void 0:u.object(i),annotations:a,callback:o,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredTools[t],l.name&&(this._registeredTools[l.name]=c)),typeof l.title<"u"&&(c.title=l.title),typeof l.description<"u"&&(c.description=l.description),typeof l.paramsSchema<"u"&&(c.inputSchema=u.object(l.paramsSchema)),typeof l.callback<"u"&&(c.callback=l.callback),typeof l.annotations<"u"&&(c.annotations=l.annotations),typeof l.enabled<"u"&&(c.enabled=l.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let e,n,i,a;if(typeof r[0]=="string"&&(e=r.shift()),r.length>1){let c=r[0];bn(c)?(n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!bn(r[0])&&(a=r.shift())):typeof c=="object"&&c!==null&&(a=r.shift())}let o=r[0];return this._createRegisteredTool(t,void 0,e,n,i,a,o)}registerTool(t,r,e){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:n,description:i,inputSchema:a,outputSchema:o,annotations:c}=r;return this._createRegisteredTool(t,n,i,a,o,c,e)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let e;typeof r[0]=="string"&&(e=r.shift());let n;r.length>1&&(n=r.shift());let i=r[0],a=this._createRegisteredPrompt(t,void 0,e,n,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(t,r,e){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:n,description:i,argsSchema:a}=r,o=this._createRegisteredPrompt(t,n,i,a,e);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Tf={type:"object",properties:{}};function bn(s){return typeof s!="object"||s===null?!1:Object.keys(s).length===0||Object.values(s).some(kf)}function kf(s){return s!==null&&typeof s=="object"&&"parse"in s&&typeof s.parse=="function"&&"safeParse"in s&&typeof s.safeParse=="function"}function Cf(s){return Object.entries(s.shape).map(([t,r])=>({name:t,description:r.description,required:!r.isOptional()}))}function Sn(s){return{completion:{values:s.slice(0,100),total:s.length,hasMore:s.length>100}}}var Da={completion:{values:[],hasMore:!1}};function _r(s,t,r,e){return{name:s,description:t,inputSchema:r,handler:e}}function di(s){let t=new Ps({name:s.name,version:s.version??"1.0.0"},{capabilities:{tools:s.tools?{}:void 0}});return s.tools&&s.tools.forEach(r=>{t.tool(r.name,r.description,r.inputSchema,r.handler)}),{type:"sdk",name:s.name,instance:t}}var G={};Qi(G,{BRAND:()=>th,DIRTY:()=>br,EMPTY_PATH:()=>Af,INVALID:()=>re,NEVER:()=>Lh,OK:()=>Ye,ParseStatus:()=>Je,Schema:()=>ge,ZodAny:()=>Kt,ZodArray:()=>Ht,ZodBigInt:()=>xr,ZodBoolean:()=>Er,ZodBranded:()=>ka,ZodCatch:()=>jr,ZodDate:()=>wr,ZodDefault:()=>Ar,ZodDiscriminatedUnion:()=>Ka,ZodEffects:()=>bt,ZodEnum:()=>Ir,ZodError:()=>st,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Xa,ZodIntersection:()=>kr,ZodIssueCode:()=>q,ZodLazy:()=>Cr,ZodLiteral:()=>Or,ZodMap:()=>oa,ZodNaN:()=>ca,ZodNativeEnum:()=>$r,ZodNever:()=>Rt,ZodNull:()=>Rr,ZodNullable:()=>jt,ZodNumber:()=>Sr,ZodObject:()=>nt,ZodOptional:()=>yt,ZodParsedType:()=>J,ZodPipeline:()=>Ca,ZodPromise:()=>Yt,ZodReadonly:()=>Dr,ZodRecord:()=>Ya,ZodSchema:()=>ge,ZodSet:()=>la,ZodString:()=>Wt,ZodSymbol:()=>na,ZodTransformer:()=>bt,ZodTuple:()=>At,ZodType:()=>ge,ZodUndefined:()=>Pr,ZodUnion:()=>Tr,ZodUnknown:()=>Vt,ZodVoid:()=>ia,addIssueToContext:()=>B,any:()=>uh,array:()=>ph,bigint:()=>nh,boolean:()=>xi,coerce:()=>Mh,custom:()=>_i,date:()=>ih,datetimeRegex:()=>gi,defaultErrorMap:()=>zt,discriminatedUnion:()=>yh,effect:()=>Oh,enum:()=>Th,function:()=>wh,getErrorMap:()=>ra,getParsedType:()=>$t,instanceof:()=>ah,intersection:()=>_h,isAborted:()=>Ja,isAsync:()=>aa,isDirty:()=>Wa,isValid:()=>Jt,late:()=>rh,lazy:()=>Ph,literal:()=>Rh,makeIssue:()=>Ta,map:()=>xh,nan:()=>sh,nativeEnum:()=>kh,never:()=>fh,null:()=>ch,nullable:()=>$h,number:()=>Si,object:()=>mh,objectUtil:()=>Ls,oboolean:()=>Fh,onumber:()=>Nh,optional:()=>Ih,ostring:()=>Dh,pipeline:()=>jh,preprocess:()=>Ah,promise:()=>Ch,quotelessJson:()=>Of,record:()=>Sh,set:()=>Eh,setErrorMap:()=>$f,strictObject:()=>vh,string:()=>bi,symbol:()=>oh,transformer:()=>Oh,tuple:()=>bh,undefined:()=>lh,union:()=>gh,unknown:()=>dh,util:()=>be,void:()=>hh});var be;(function(s){s.assertEqual=n=>{};function t(n){}s.assertIs=t;function r(n){throw new Error}s.assertNever=r,s.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},s.getValidEnumValues=n=>{let i=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(let o of i)a[o]=n[o];return s.objectValues(a)},s.objectValues=n=>s.objectKeys(n).map(function(i){return n[i]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},s.find=(n,i)=>{for(let a of n)if(i(a))return a},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function e(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}s.joinValues=e,s.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(be||(be={}));var Ls;(function(s){s.mergeShapes=(t,r)=>({...t,...r})})(Ls||(Ls={}));var J=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$t=s=>{switch(typeof s){case"undefined":return J.undefined;case"string":return J.string;case"number":return Number.isNaN(s)?J.nan:J.number;case"boolean":return J.boolean;case"function":return J.function;case"bigint":return J.bigint;case"symbol":return J.symbol;case"object":return Array.isArray(s)?J.array:s===null?J.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?J.promise:typeof Map<"u"&&s instanceof Map?J.map:typeof Set<"u"&&s instanceof Set?J.set:typeof Date<"u"&&s instanceof Date?J.date:J.object;default:return J.unknown}};var q=be.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"]),Of=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),st=class s extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},e={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)e._errors.push(r(a));else{let o=e,c=0;for(;c<a.path.length;){let l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),e}static assert(t){if(!(t instanceof s))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},e=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(t(n))}else e.push(t(n));return{formErrors:e,fieldErrors:r}}get formErrors(){return this.flatten()}};st.create=s=>new st(s);var If=(s,t)=>{let r;switch(s.code){case q.invalid_type:s.received===J.undefined?r="Required":r=`Expected ${s.expected}, received ${s.received}`;break;case q.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(s.expected,be.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:r=`Unrecognized key(s) in object: ${be.joinValues(s.keys,", ")}`;break;case q.invalid_union:r="Invalid input";break;case q.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${be.joinValues(s.options)}`;break;case q.invalid_enum_value:r=`Invalid enum value. Expected ${be.joinValues(s.options)}, received '${s.received}'`;break;case q.invalid_arguments:r="Invalid function arguments";break;case q.invalid_return_type:r="Invalid function return type";break;case q.invalid_date:r="Invalid date";break;case q.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(r=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?r=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?r=`Invalid input: must end with "${s.validation.endsWith}"`:be.assertNever(s.validation):s.validation!=="regex"?r=`Invalid ${s.validation}`:r="Invalid";break;case q.too_small:s.type==="array"?r=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?r=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?r=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?r=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?r=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:r="Invalid input";break;case q.too_big:s.type==="array"?r=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?r=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?r=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?r=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?r=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:r="Invalid input";break;case q.custom:r="Invalid input";break;case q.invalid_intersection_types:r="Intersection results could not be merged";break;case q.not_multiple_of:r=`Number must be a multiple of ${s.multipleOf}`;break;case q.not_finite:r="Number must be finite";break;default:r=t.defaultError,be.assertNever(s)}return{message:r}},zt=If;var fi=zt;function $f(s){fi=s}function ra(){return fi}var Ta=s=>{let{data:t,path:r,errorMaps:e,issueData:n}=s,i=[...r,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="",c=e.filter(l=>!!l).slice().reverse();for(let l of c)o=l(a,{data:t,defaultError:o}).message;return{...n,path:i,message:o}},Af=[];function B(s,t){let r=ra(),e=Ta({issueData:t,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,r,r===zt?void 0:zt].filter(n=>!!n)});s.common.issues.push(e)}var Je=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let e=[];for(let n of r){if(n.status==="aborted")return re;n.status==="dirty"&&t.dirty(),e.push(n.value)}return{status:t.value,value:e}}static async mergeObjectAsync(t,r){let e=[];for(let n of r){let i=await n.key,a=await n.value;e.push({key:i,value:a})}return s.mergeObjectSync(t,e)}static mergeObjectSync(t,r){let e={};for(let n of r){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return re;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(e[i.value]=a.value)}return{status:t.value,value:e}}},re=Object.freeze({status:"aborted"}),br=s=>({status:"dirty",value:s}),Ye=s=>({status:"valid",value:s}),Ja=s=>s.status==="aborted",Wa=s=>s.status==="dirty",Jt=s=>s.status==="valid",aa=s=>typeof Promise<"u"&&s instanceof Promise;var ee;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t?.message})(ee||(ee={}));var _t=class{constructor(t,r,e,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=e,this._key=n}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}},hi=(s,t)=>{if(Jt(t))return{success:!0,data:t.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new st(s.common.issues);return this._error=r,this._error}}};function pe(s){if(!s)return{};let{errorMap:t,invalid_type_error:r,required_error:e,description:n}=s;if(t&&(r||e))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(a,o)=>{let{message:c}=s;return a.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??e??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:n}}var ge=class{get description(){return this._def.description}_getType(t){return $t(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:$t(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Je,ctx:{common:t.parent.common,data:t.data,parsedType:$t(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(aa(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let e=this.safeParse(t,r);if(e.success)return e.data;throw e.error}safeParse(t,r){let e={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)},n=this._parseSync({data:t,path:e.path,parent:e});return hi(e,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)};if(!this["~standard"].async)try{let e=this._parseSync({data:t,path:[],parent:r});return Jt(e)?{value:e.value}:{issues:r.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(e=>Jt(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(t,r){let e=await this.safeParseAsync(t,r);if(e.success)return e.data;throw e.error}async safeParseAsync(t,r){let e={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)},n=this._parse({data:t,path:e.path,parent:e}),i=await(aa(n)?n:Promise.resolve(n));return hi(e,i)}refine(t,r){let e=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let a=t(n),o=()=>i.addIssue({code:q.custom,...e(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(t,r){return this._refinement((e,n)=>t(e)?!0:(n.addIssue(typeof r=="function"?r(e,n):r),!1))}_refinement(t){return new bt({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return yt.create(this,this._def)}nullable(){return jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return Yt.create(this,this._def)}or(t){return Tr.create([this,t],this._def)}and(t){return kr.create(this,t,this._def)}transform(t){return new bt({...pe(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ar({...pe(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new ka({typeName:ne.ZodBranded,type:this,...pe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new jr({...pe(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ca.create(this,t)}readonly(){return Dr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jf=/^c[^\s-]{8,}$/i,Df=/^[0-9a-z]+$/,Nf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ff=/^[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,Mf=/^[a-z0-9_-]{21}$/i,Lf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qf=/^[-+]?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)?)??$/,Uf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qs,Zf=/^(?:(?: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])$/,Vf=/^(?:(?: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])$/,Hf=/^(([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]))$/,Bf=/^(([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])$/,Qf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mi="((\\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])))",Jf=new RegExp(`^${mi}$`);function vi(s){let t="[0-5]\\d";s.precision?t=`${t}\\.\\d{${s.precision}}`:s.precision==null&&(t=`${t}(\\.\\d+)?`);let r=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Wf(s){return new RegExp(`^${vi(s)}$`)}function gi(s){let t=`${mi}T${vi(s)}`,r=[];return r.push(s.local?"Z?":"Z"),s.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Kf(s,t){return!!((t==="v4"||!t)&&Zf.test(s)||(t==="v6"||!t)&&Hf.test(s))}function Yf(s,t){if(!Lf.test(s))return!1;try{let[r]=s.split(".");if(!r)return!1;let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(e));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function Xf(s,t){return!!((t==="v4"||!t)&&Vf.test(s)||(t==="v6"||!t)&&Bf.test(s))}var Wt=class s extends ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==J.string){let i=this._getOrReturnCtx(t);return B(i,{code:q.invalid_type,expected:J.string,received:i.parsedType}),re}let e=new Je,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),B(n,{code:q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),e.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),B(n,{code:q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),e.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,o=t.data.length<i.value;(a||o)&&(n=this._getOrReturnCtx(t,n),a?B(n,{code:q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&B(n,{code:q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),e.dirty())}else if(i.kind==="email")Uf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"email",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="emoji")qs||(qs=new RegExp(zf,"u")),qs.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"emoji",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="uuid")Ff.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"uuid",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="nanoid")Mf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"nanoid",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="cuid")jf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"cuid",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="cuid2")Df.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"cuid2",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="ulid")Nf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"ulid",code:q.invalid_string,message:i.message}),e.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),B(n,{validation:"url",code:q.invalid_string,message:i.message}),e.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"regex",code:q.invalid_string,message:i.message}),e.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),B(n,{code:q.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),e.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),B(n,{code:q.invalid_string,validation:{startsWith:i.value},message:i.message}),e.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),B(n,{code:q.invalid_string,validation:{endsWith:i.value},message:i.message}),e.dirty()):i.kind==="datetime"?gi(i).test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{code:q.invalid_string,validation:"datetime",message:i.message}),e.dirty()):i.kind==="date"?Jf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{code:q.invalid_string,validation:"date",message:i.message}),e.dirty()):i.kind==="time"?Wf(i).test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{code:q.invalid_string,validation:"time",message:i.message}),e.dirty()):i.kind==="duration"?qf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"duration",code:q.invalid_string,message:i.message}),e.dirty()):i.kind==="ip"?Kf(t.data,i.version)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"ip",code:q.invalid_string,message:i.message}),e.dirty()):i.kind==="jwt"?Yf(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"jwt",code:q.invalid_string,message:i.message}),e.dirty()):i.kind==="cidr"?Xf(t.data,i.version)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"cidr",code:q.invalid_string,message:i.message}),e.dirty()):i.kind==="base64"?Qf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"base64",code:q.invalid_string,message:i.message}),e.dirty()):i.kind==="base64url"?Gf.test(t.data)||(n=this._getOrReturnCtx(t,n),B(n,{validation:"base64url",code:q.invalid_string,message:i.message}),e.dirty()):be.assertNever(i);return{status:e.value,value:t.data}}_regex(t,r,e){return this.refinement(n=>t.test(n),{validation:r,code:q.invalid_string,...ee.errToObj(e)})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ee.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ee.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ee.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ee.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ee.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ee.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ee.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ee.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ee.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ee.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ee.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ee.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ee.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ee.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ee.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ee.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ee.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ee.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ee.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ee.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ee.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ee.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ee.errToObj(r)})}nonempty(t){return this.min(1,ee.errToObj(t))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Wt.create=s=>new Wt({checks:[],typeName:ne.ZodString,coerce:s?.coerce??!1,...pe(s)});function eh(s,t){let r=(s.toString().split(".")[1]||"").length,e=(t.toString().split(".")[1]||"").length,n=r>e?r:e,i=Number.parseInt(s.toFixed(n).replace(".","")),a=Number.parseInt(t.toFixed(n).replace(".",""));return i%a/10**n}var Sr=class s extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==J.number){let i=this._getOrReturnCtx(t);return B(i,{code:q.invalid_type,expected:J.number,received:i.parsedType}),re}let e,n=new Je;for(let i of this._def.checks)i.kind==="int"?be.isInteger(t.data)||(e=this._getOrReturnCtx(t,e),B(e,{code:q.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(e=this._getOrReturnCtx(t,e),B(e,{code:q.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(e=this._getOrReturnCtx(t,e),B(e,{code:q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?eh(t.data,i.value)!==0&&(e=this._getOrReturnCtx(t,e),B(e,{code:q.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(e=this._getOrReturnCtx(t,e),B(e,{code:q.not_finite,message:i.message}),n.dirty()):be.assertNever(i);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ee.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ee.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ee.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ee.toString(r))}setLimit(t,r,e,n){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:e,message:ee.toString(n)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ee.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ee.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ee.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ee.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ee.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ee.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&be.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let e of this._def.checks){if(e.kind==="finite"||e.kind==="int"||e.kind==="multipleOf")return!0;e.kind==="min"?(r===null||e.value>r)&&(r=e.value):e.kind==="max"&&(t===null||e.value<t)&&(t=e.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Sr.create=s=>new Sr({checks:[],typeName:ne.ZodNumber,coerce:s?.coerce||!1,...pe(s)});var xr=class s extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==J.bigint)return this._getInvalidInput(t);let e,n=new Je;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(e=this._getOrReturnCtx(t,e),B(e,{code:q.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(e=this._getOrReturnCtx(t,e),B(e,{code:q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(e=this._getOrReturnCtx(t,e),B(e,{code:q.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):be.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return B(r,{code:q.invalid_type,expected:J.bigint,received:r.parsedType}),re}gte(t,r){return this.setLimit("min",t,!0,ee.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ee.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ee.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ee.toString(r))}setLimit(t,r,e,n){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:e,message:ee.toString(n)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ee.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ee.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};xr.create=s=>new xr({checks:[],typeName:ne.ZodBigInt,coerce:s?.coerce??!1,...pe(s)});var Er=class extends ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==J.boolean){let e=this._getOrReturnCtx(t);return B(e,{code:q.invalid_type,expected:J.boolean,received:e.parsedType}),re}return Ye(t.data)}};Er.create=s=>new Er({typeName:ne.ZodBoolean,coerce:s?.coerce||!1,...pe(s)});var wr=class s extends ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==J.date){let i=this._getOrReturnCtx(t);return B(i,{code:q.invalid_type,expected:J.date,received:i.parsedType}),re}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return B(i,{code:q.invalid_date}),re}let e=new Je,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),B(n,{code:q.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),e.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),B(n,{code:q.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),e.dirty()):be.assertNever(i);return{status:e.value,value:new Date(t.data.getTime())}}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ee.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ee.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};wr.create=s=>new wr({checks:[],coerce:s?.coerce||!1,typeName:ne.ZodDate,...pe(s)});var na=class extends ge{_parse(t){if(this._getType(t)!==J.symbol){let e=this._getOrReturnCtx(t);return B(e,{code:q.invalid_type,expected:J.symbol,received:e.parsedType}),re}return Ye(t.data)}};na.create=s=>new na({typeName:ne.ZodSymbol,...pe(s)});var Pr=class extends ge{_parse(t){if(this._getType(t)!==J.undefined){let e=this._getOrReturnCtx(t);return B(e,{code:q.invalid_type,expected:J.undefined,received:e.parsedType}),re}return Ye(t.data)}};Pr.create=s=>new Pr({typeName:ne.ZodUndefined,...pe(s)});var Rr=class extends ge{_parse(t){if(this._getType(t)!==J.null){let e=this._getOrReturnCtx(t);return B(e,{code:q.invalid_type,expected:J.null,received:e.parsedType}),re}return Ye(t.data)}};Rr.create=s=>new Rr({typeName:ne.ZodNull,...pe(s)});var Kt=class extends ge{constructor(){super(...arguments),this._any=!0}_parse(t){return Ye(t.data)}};Kt.create=s=>new Kt({typeName:ne.ZodAny,...pe(s)});var Vt=class extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ye(t.data)}};Vt.create=s=>new Vt({typeName:ne.ZodUnknown,...pe(s)});var Rt=class extends ge{_parse(t){let r=this._getOrReturnCtx(t);return B(r,{code:q.invalid_type,expected:J.never,received:r.parsedType}),re}};Rt.create=s=>new Rt({typeName:ne.ZodNever,...pe(s)});var ia=class extends ge{_parse(t){if(this._getType(t)!==J.undefined){let e=this._getOrReturnCtx(t);return B(e,{code:q.invalid_type,expected:J.void,received:e.parsedType}),re}return Ye(t.data)}};ia.create=s=>new ia({typeName:ne.ZodVoid,...pe(s)});var Ht=class s extends ge{_parse(t){let{ctx:r,status:e}=this._processInputParams(t),n=this._def;if(r.parsedType!==J.array)return B(r,{code:q.invalid_type,expected:J.array,received:r.parsedType}),re;if(n.exactLength!==null){let a=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(a||o)&&(B(r,{code:a?q.too_big:q.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),e.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(B(r,{code:q.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),e.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(B(r,{code:q.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),e.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>n.type._parseAsync(new _t(r,a,r.path,o)))).then(a=>Je.mergeArray(e,a));let i=[...r.data].map((a,o)=>n.type._parseSync(new _t(r,a,r.path,o)));return Je.mergeArray(e,i)}get element(){return this._def.type}min(t,r){return new s({...this._def,minLength:{value:t,message:ee.toString(r)}})}max(t,r){return new s({...this._def,maxLength:{value:t,message:ee.toString(r)}})}length(t,r){return new s({...this._def,exactLength:{value:t,message:ee.toString(r)}})}nonempty(t){return this.min(1,t)}};Ht.create=(s,t)=>new Ht({type:s,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...pe(t)});function sa(s){if(s instanceof nt){let t={};for(let r in s.shape){let e=s.shape[r];t[r]=yt.create(sa(e))}return new nt({...s._def,shape:()=>t})}else return s instanceof Ht?new Ht({...s._def,type:sa(s.element)}):s instanceof yt?yt.create(sa(s.unwrap())):s instanceof jt?jt.create(sa(s.unwrap())):s instanceof At?At.create(s.items.map(t=>sa(t))):s}var nt=class s extends ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=be.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==J.object){let l=this._getOrReturnCtx(t);return B(l,{code:q.invalid_type,expected:J.object,received:l.parsedType}),re}let{status:e,ctx:n}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Rt&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||o.push(l);let c=[];for(let l of a){let f=i[l],y=n.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new _t(n,y,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Rt){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(l==="strict")o.length>0&&(B(n,{code:q.unrecognized_keys,keys:o}),e.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of o){let y=n.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new _t(n,y,n.path,f)),alwaysSet:f in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of c){let y=await f.key,R=await f.value;l.push({key:y,value:R,alwaysSet:f.alwaysSet})}return l}).then(l=>Je.mergeObjectSync(e,l)):Je.mergeObjectSync(e,c)}get shape(){return this._def.shape()}strict(t){return ee.errToObj,new s({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,e)=>{let n=this._def.errorMap?.(r,e).message??e.defaultError;return r.code==="unrecognized_keys"?{message:ee.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(t){return new s({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new s({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ne.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new s({...this._def,catchall:t})}pick(t){let r={};for(let e of be.objectKeys(t))t[e]&&this.shape[e]&&(r[e]=this.shape[e]);return new s({...this._def,shape:()=>r})}omit(t){let r={};for(let e of be.objectKeys(this.shape))t[e]||(r[e]=this.shape[e]);return new s({...this._def,shape:()=>r})}deepPartial(){return sa(this)}partial(t){let r={};for(let e of be.objectKeys(this.shape)){let n=this.shape[e];t&&!t[e]?r[e]=n:r[e]=n.optional()}return new s({...this._def,shape:()=>r})}required(t){let r={};for(let e of be.objectKeys(this.shape))if(t&&!t[e])r[e]=this.shape[e];else{let i=this.shape[e];for(;i instanceof yt;)i=i._def.innerType;r[e]=i}return new s({...this._def,shape:()=>r})}keyof(){return yi(be.objectKeys(this.shape))}};nt.create=(s,t)=>new nt({shape:()=>s,unknownKeys:"strip",catchall:Rt.create(),typeName:ne.ZodObject,...pe(t)});nt.strictCreate=(s,t)=>new nt({shape:()=>s,unknownKeys:"strict",catchall:Rt.create(),typeName:ne.ZodObject,...pe(t)});nt.lazycreate=(s,t)=>new nt({shape:s,unknownKeys:"strip",catchall:Rt.create(),typeName:ne.ZodObject,...pe(t)});var Tr=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),e=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new st(o.ctx.common.issues));return B(r,{code:q.invalid_union,unionErrors:a}),re}if(r.common.async)return Promise.all(e.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let c of e){let l={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(c=>new st(c));return B(r,{code:q.invalid_union,unionErrors:o}),re}}get options(){return this._def.options}};Tr.create=(s,t)=>new Tr({options:s,typeName:ne.ZodUnion,...pe(t)});var Zt=s=>s instanceof Cr?Zt(s.schema):s instanceof bt?Zt(s.innerType()):s instanceof Or?[s.value]:s instanceof Ir?s.options:s instanceof $r?be.objectValues(s.enum):s instanceof Ar?Zt(s._def.innerType):s instanceof Pr?[void 0]:s instanceof Rr?[null]:s instanceof yt?[void 0,...Zt(s.unwrap())]:s instanceof jt?[null,...Zt(s.unwrap())]:s instanceof ka||s instanceof Dr?Zt(s.unwrap()):s instanceof jr?Zt(s._def.innerType):[],Ka=class s extends ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==J.object)return B(r,{code:q.invalid_type,expected:J.object,received:r.parsedType}),re;let e=this.discriminator,n=r.data[e],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[e]}),re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,e){let n=new Map;for(let i of r){let a=Zt(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);n.set(o,i)}}return new s({typeName:ne.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...pe(e)})}};function Us(s,t){let r=$t(s),e=$t(t);if(s===t)return{valid:!0,data:s};if(r===J.object&&e===J.object){let n=be.objectKeys(t),i=be.objectKeys(s).filter(o=>n.indexOf(o)!==-1),a={...s,...t};for(let o of i){let c=Us(s[o],t[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(r===J.array&&e===J.array){if(s.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<s.length;i++){let a=s[i],o=t[i],c=Us(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===J.date&&e===J.date&&+s==+t?{valid:!0,data:s}:{valid:!1}}var kr=class extends ge{_parse(t){let{status:r,ctx:e}=this._processInputParams(t),n=(i,a)=>{if(Ja(i)||Ja(a))return re;let o=Us(i.value,a.value);return o.valid?((Wa(i)||Wa(a))&&r.dirty(),{status:r.value,value:o.data}):(B(e,{code:q.invalid_intersection_types}),re)};return e.common.async?Promise.all([this._def.left._parseAsync({data:e.data,path:e.path,parent:e}),this._def.right._parseAsync({data:e.data,path:e.path,parent:e})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:e.data,path:e.path,parent:e}),this._def.right._parseSync({data:e.data,path:e.path,parent:e}))}};kr.create=(s,t,r)=>new kr({left:s,right:t,typeName:ne.ZodIntersection,...pe(r)});var At=class s extends ge{_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==J.array)return B(e,{code:q.invalid_type,expected:J.array,received:e.parsedType}),re;if(e.data.length<this._def.items.length)return B(e,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&e.data.length>this._def.items.length&&(B(e,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...e.data].map((a,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new _t(e,a,e.path,o)):null}).filter(a=>!!a);return e.common.async?Promise.all(i).then(a=>Je.mergeArray(r,a)):Je.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new s({...this._def,rest:t})}};At.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new At({items:s,typeName:ne.ZodTuple,rest:null,...pe(t)})};var Ya=class s extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==J.object)return B(e,{code:q.invalid_type,expected:J.object,received:e.parsedType}),re;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in e.data)n.push({key:i._parse(new _t(e,o,e.path,o)),value:a._parse(new _t(e,e.data[o],e.path,o)),alwaysSet:o in e.data});return e.common.async?Je.mergeObjectAsync(r,n):Je.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,e){return r instanceof ge?new s({keyType:t,valueType:r,typeName:ne.ZodRecord,...pe(e)}):new s({keyType:Wt.create(),valueType:t,typeName:ne.ZodRecord,...pe(r)})}},oa=class extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==J.map)return B(e,{code:q.invalid_type,expected:J.map,received:e.parsedType}),re;let n=this._def.keyType,i=this._def.valueType,a=[...e.data.entries()].map(([o,c],l)=>({key:n._parse(new _t(e,o,e.path,[l,"key"])),value:i._parse(new _t(e,c,e.path,[l,"value"]))}));if(e.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return re;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(l.value,f.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of a){let l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return re;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(l.value,f.value)}return{status:r.value,value:o}}}};oa.create=(s,t,r)=>new oa({valueType:t,keyType:s,typeName:ne.ZodMap,...pe(r)});var la=class s extends ge{_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.parsedType!==J.set)return B(e,{code:q.invalid_type,expected:J.set,received:e.parsedType}),re;let n=this._def;n.minSize!==null&&e.data.size<n.minSize.value&&(B(e,{code:q.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&e.data.size>n.maxSize.value&&(B(e,{code:q.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let f of c){if(f.status==="aborted")return re;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let o=[...e.data.values()].map((c,l)=>i._parse(new _t(e,c,e.path,l)));return e.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(t,r){return new s({...this._def,minSize:{value:t,message:ee.toString(r)}})}max(t,r){return new s({...this._def,maxSize:{value:t,message:ee.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};la.create=(s,t)=>new la({valueType:s,minSize:null,maxSize:null,typeName:ne.ZodSet,...pe(t)});var Xa=class s extends ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==J.function)return B(r,{code:q.invalid_type,expected:J.function,received:r.parsedType}),re;function e(o,c){return Ta({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ra(),zt].filter(l=>!!l),issueData:{code:q.invalid_arguments,argumentsError:c}})}function n(o,c){return Ta({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ra(),zt].filter(l=>!!l),issueData:{code:q.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Yt){let o=this;return Ye(async function(...c){let l=new st([]),f=await o._def.args.parseAsync(c,i).catch(m=>{throw l.addIssue(e(c,m)),l}),y=await Reflect.apply(a,this,f);return await o._def.returns._def.type.parseAsync(y,i).catch(m=>{throw l.addIssue(n(y,m)),l})})}else{let o=this;return Ye(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new st([e(c,l.error)]);let f=Reflect.apply(a,this,l.data),y=o._def.returns.safeParse(f,i);if(!y.success)throw new st([n(f,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new s({...this._def,args:At.create(t).rest(Vt.create())})}returns(t){return new s({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,e){return new s({args:t||At.create([]).rest(Vt.create()),returns:r||Vt.create(),typeName:ne.ZodFunction,...pe(e)})}},Cr=class extends ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Cr.create=(s,t)=>new Cr({getter:s,typeName:ne.ZodLazy,...pe(t)});var Or=class extends ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return B(r,{received:r.data,code:q.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:t.data}}get value(){return this._def.value}};Or.create=(s,t)=>new Or({value:s,typeName:ne.ZodLiteral,...pe(t)});function yi(s,t){return new Ir({values:s,typeName:ne.ZodEnum,...pe(t)})}var Ir=class s extends ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),e=this._def.values;return B(r,{expected:be.joinValues(e),received:r.parsedType,code:q.invalid_type}),re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),e=this._def.values;return B(r,{received:r.data,code:q.invalid_enum_value,options:e}),re}return Ye(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return s.create(t,{...this._def,...r})}exclude(t,r=this._def){return s.create(this.options.filter(e=>!t.includes(e)),{...this._def,...r})}};Ir.create=yi;var $r=class extends ge{_parse(t){let r=be.getValidEnumValues(this._def.values),e=this._getOrReturnCtx(t);if(e.parsedType!==J.string&&e.parsedType!==J.number){let n=be.objectValues(r);return B(e,{expected:be.joinValues(n),received:e.parsedType,code:q.invalid_type}),re}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=be.objectValues(r);return B(e,{received:e.data,code:q.invalid_enum_value,options:n}),re}return Ye(t.data)}get enum(){return this._def.values}};$r.create=(s,t)=>new $r({values:s,typeName:ne.ZodNativeEnum,...pe(t)});var Yt=class extends ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==J.promise&&r.common.async===!1)return B(r,{code:q.invalid_type,expected:J.promise,received:r.parsedType}),re;let e=r.parsedType===J.promise?r.data:Promise.resolve(r.data);return Ye(e.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Yt.create=(s,t)=>new Yt({type:s,typeName:ne.ZodPromise,...pe(t)});var bt=class extends ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:e}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:a=>{B(e,a),a.fatal?r.abort():r.dirty()},get path(){return e.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let a=n.transform(e.data,i);if(e.common.async)return Promise.resolve(a).then(async o=>{if(r.value==="aborted")return re;let c=await this._def.schema._parseAsync({data:o,path:e.path,parent:e});return c.status==="aborted"?re:c.status==="dirty"?br(c.value):r.value==="dirty"?br(c.value):c});{if(r.value==="aborted")return re;let o=this._def.schema._parseSync({data:a,path:e.path,parent:e});return o.status==="aborted"?re:o.status==="dirty"?br(o.value):r.value==="dirty"?br(o.value):o}}if(n.type==="refinement"){let a=o=>{let c=n.refinement(o,i);if(e.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(e.common.async===!1){let o=this._def.schema._parseSync({data:e.data,path:e.path,parent:e});return o.status==="aborted"?re:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:e.data,path:e.path,parent:e}).then(o=>o.status==="aborted"?re:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(e.common.async===!1){let a=this._def.schema._parseSync({data:e.data,path:e.path,parent:e});if(!Jt(a))return re;let o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:e.data,path:e.path,parent:e}).then(a=>Jt(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:r.value,value:o})):re);be.assertNever(n)}};bt.create=(s,t,r)=>new bt({schema:s,typeName:ne.ZodEffects,effect:t,...pe(r)});bt.createWithPreprocess=(s,t,r)=>new bt({schema:t,effect:{type:"preprocess",transform:s},typeName:ne.ZodEffects,...pe(r)});var yt=class extends ge{_parse(t){return this._getType(t)===J.undefined?Ye(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};yt.create=(s,t)=>new yt({innerType:s,typeName:ne.ZodOptional,...pe(t)});var jt=class extends ge{_parse(t){return this._getType(t)===J.null?Ye(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};jt.create=(s,t)=>new jt({innerType:s,typeName:ne.ZodNullable,...pe(t)});var Ar=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),e=r.data;return r.parsedType===J.undefined&&(e=this._def.defaultValue()),this._def.innerType._parse({data:e,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ar.create=(s,t)=>new Ar({innerType:s,typeName:ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...pe(t)});var jr=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),e={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:e.data,path:e.path,parent:{...e}});return aa(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new st(e.common.issues)},input:e.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new st(e.common.issues)},input:e.data})}}removeCatch(){return this._def.innerType}};jr.create=(s,t)=>new jr({innerType:s,typeName:ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...pe(t)});var ca=class extends ge{_parse(t){if(this._getType(t)!==J.nan){let e=this._getOrReturnCtx(t);return B(e,{code:q.invalid_type,expected:J.nan,received:e.parsedType}),re}return{status:"valid",value:t.data}}};ca.create=s=>new ca({typeName:ne.ZodNaN,...pe(s)});var th=Symbol("zod_brand"),ka=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),e=r.data;return this._def.type._parse({data:e,path:r.path,parent:r})}unwrap(){return this._def.type}},Ca=class s extends ge{_parse(t){let{status:r,ctx:e}=this._processInputParams(t);if(e.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:e.data,path:e.path,parent:e});return i.status==="aborted"?re:i.status==="dirty"?(r.dirty(),br(i.value)):this._def.out._parseAsync({data:i.value,path:e.path,parent:e})})();{let n=this._def.in._parseSync({data:e.data,path:e.path,parent:e});return n.status==="aborted"?re:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:e.path,parent:e})}}static create(t,r){return new s({in:t,out:r,typeName:ne.ZodPipeline})}},Dr=class extends ge{_parse(t){let r=this._def.innerType._parse(t),e=n=>(Jt(n)&&(n.value=Object.freeze(n.value)),n);return aa(r)?r.then(n=>e(n)):e(r)}unwrap(){return this._def.innerType}};Dr.create=(s,t)=>new Dr({innerType:s,typeName:ne.ZodReadonly,...pe(t)});function pi(s,t){let r=typeof s=="function"?s(t):typeof s=="string"?{message:s}:s;return typeof r=="string"?{message:r}:r}function _i(s,t={},r){return s?Kt.create().superRefine((e,n)=>{let i=s(e);if(i instanceof Promise)return i.then(a=>{if(!a){let o=pi(t,e),c=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:c})}});if(!i){let a=pi(t,e),o=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:o})}}):Kt.create()}var rh={object:nt.lazycreate},ne;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(ne||(ne={}));var ah=(s,t={message:`Input not instance of ${s.name}`})=>_i(r=>r instanceof s,t),bi=Wt.create,Si=Sr.create,sh=ca.create,nh=xr.create,xi=Er.create,ih=wr.create,oh=na.create,lh=Pr.create,ch=Rr.create,uh=Kt.create,dh=Vt.create,fh=Rt.create,hh=ia.create,ph=Ht.create,mh=nt.create,vh=nt.strictCreate,gh=Tr.create,yh=Ka.create,_h=kr.create,bh=At.create,Sh=Ya.create,xh=oa.create,Eh=la.create,wh=Xa.create,Ph=Cr.create,Rh=Or.create,Th=Ir.create,kh=$r.create,Ch=Yt.create,Oh=bt.create,Ih=yt.create,$h=jt.create,Ah=bt.createWithPreprocess,jh=Ca.create,Dh=()=>bi().optional(),Nh=()=>Si().optional(),Fh=()=>xi().optional(),Mh={string:s=>Wt.create({...s,coerce:!0}),number:s=>Sr.create({...s,coerce:!0}),boolean:s=>Er.create({...s,coerce:!0}),bigint:s=>xr.create({...s,coerce:!0}),date:s=>wr.create({...s,coerce:!0})};var Lh=re;import zh from"better-sqlite3";import{join as St,dirname as Hp,basename as Bp}from"path";import{homedir as Ei}from"os";import{existsSync as Wp,mkdirSync as qh}from"fs";var Uh=()=>process.env.CLAUDE_PLUGIN_ROOT?St(process.env.CLAUDE_PLUGIN_ROOT,"data"):process.env.CLAUDE_MEM_DATA_DIR?process.env.CLAUDE_MEM_DATA_DIR:St(Ei(),".claude-mem"),Xt=Uh(),zs=process.env.CLAUDE_CONFIG_DIR||St(Ei(),".claude"),Kp=St(Xt,"archives"),Yp=St(Xt,"logs"),Xp=St(Xt,"trash"),em=St(Xt,"backups"),tm=St(Xt,"settings.json"),wi=St(Xt,"claude-mem.db"),rm=St(zs,"settings.json"),am=St(zs,"commands"),sm=St(zs,"CLAUDE.md");function Pi(s){qh(s,{recursive:!0})}var es=class{db;constructor(t){t||(Pi(Xt),t=wi),this.db=new zh(t),this.db.pragma("journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){try{if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(e=>e.name==="observations_fts"||e.name==="session_summaries_fts"))return;console.error("[SessionSearch] Creating FTS5 tables..."),this.db.exec(`
CREATE VIRTUAL TABLE IF NOT EXISTS observations_fts USING fts5(
title,
subtitle,
narrative,
text,
facts,
concepts,
content='observations',
content_rowid='id'
);
`),this.db.exec(`
INSERT INTO observations_fts(rowid, title, subtitle, narrative, text, facts, concepts)
SELECT id, title, subtitle, narrative, text, facts, concepts
FROM observations;
`),this.db.exec(`
CREATE TRIGGER IF NOT EXISTS observations_ai AFTER INSERT ON observations BEGIN
INSERT INTO observations_fts(rowid, title, subtitle, narrative, text, facts, concepts)
VALUES (new.id, new.title, new.subtitle, new.narrative, new.text, new.facts, new.concepts);
END;
CREATE TRIGGER IF NOT EXISTS observations_ad AFTER DELETE ON observations BEGIN
INSERT INTO observations_fts(observations_fts, rowid, title, subtitle, narrative, text, facts, concepts)
VALUES('delete', old.id, old.title, old.subtitle, old.narrative, old.text, old.facts, old.concepts);
END;
CREATE TRIGGER IF NOT EXISTS observations_au AFTER UPDATE ON observations BEGIN
INSERT INTO observations_fts(observations_fts, rowid, title, subtitle, narrative, text, facts, concepts)
VALUES('delete', old.id, old.title, old.subtitle, old.narrative, old.text, old.facts, old.concepts);
INSERT INTO observations_fts(rowid, title, subtitle, narrative, text, facts, concepts)
VALUES (new.id, new.title, new.subtitle, new.narrative, new.text, new.facts, new.concepts);
END;
`),this.db.exec(`
CREATE VIRTUAL TABLE IF NOT EXISTS session_summaries_fts USING fts5(
request,
investigated,
learned,
completed,
next_steps,
notes,
content='session_summaries',
content_rowid='id'
);
`),this.db.exec(`
INSERT INTO session_summaries_fts(rowid, request, investigated, learned, completed, next_steps, notes)
SELECT id, request, investigated, learned, completed, next_steps, notes
FROM session_summaries;
`),this.db.exec(`
CREATE TRIGGER IF NOT EXISTS session_summaries_ai AFTER INSERT ON session_summaries BEGIN
INSERT INTO session_summaries_fts(rowid, request, investigated, learned, completed, next_steps, notes)
VALUES (new.id, new.request, new.investigated, new.learned, new.completed, new.next_steps, new.notes);
END;
CREATE TRIGGER IF NOT EXISTS session_summaries_ad AFTER DELETE ON session_summaries BEGIN
INSERT INTO session_summaries_fts(session_summaries_fts, rowid, request, investigated, learned, completed, next_steps, notes)
VALUES('delete', old.id, old.request, old.investigated, old.learned, old.completed, old.next_steps, old.notes);
END;
CREATE TRIGGER IF NOT EXISTS session_summaries_au AFTER UPDATE ON session_summaries BEGIN
INSERT INTO session_summaries_fts(session_summaries_fts, rowid, request, investigated, learned, completed, next_steps, notes)
VALUES('delete', old.id, old.request, old.investigated, old.learned, old.completed, old.next_steps, old.notes);
INSERT INTO session_summaries_fts(rowid, request, investigated, learned, completed, next_steps, notes)
VALUES (new.id, new.request, new.investigated, new.learned, new.completed, new.next_steps, new.notes);
END;
`),console.error("[SessionSearch] FTS5 tables created successfully")}catch(t){console.error("[SessionSearch] FTS migration error:",t.message)}}escapeFTS5(t){return t}buildFilterClause(t,r,e="o"){let n=[];if(t.project&&(n.push(`${e}.project = ?`),r.push(t.project)),t.type)if(Array.isArray(t.type)){let i=t.type.map(()=>"?").join(",");n.push(`${e}.type IN (${i})`),r.push(...t.type)}else n.push(`${e}.type = ?`),r.push(t.type);if(t.dateRange){let{start:i,end:a}=t.dateRange;if(i){let o=typeof i=="number"?i:new Date(i).getTime();n.push(`${e}.created_at_epoch >= ?`),r.push(o)}if(a){let o=typeof a=="number"?a:new Date(a).getTime();n.push(`${e}.created_at_epoch <= ?`),r.push(o)}}if(t.concepts){let i=Array.isArray(t.concepts)?t.concepts:[t.concepts],a=i.map(()=>`EXISTS (SELECT 1 FROM json_each(${e}.concepts) WHERE value = ?)`);a.length>0&&(n.push(`(${a.join(" OR ")})`),r.push(...i))}if(t.files){let i=Array.isArray(t.files)?t.files:[t.files],a=i.map(()=>`(
EXISTS (SELECT 1 FROM json_each(${e}.files_read) WHERE value LIKE ?)
OR EXISTS (SELECT 1 FROM json_each(${e}.files_modified) WHERE value LIKE ?)
)`);a.length>0&&(n.push(`(${a.join(" OR ")})`),i.forEach(o=>{r.push(`%${o}%`,`%${o}%`)}))}return n.length>0?n.join(" AND "):""}buildOrderClause(t="relevance",r=!0,e="observations_fts"){switch(t){case"relevance":return r?`ORDER BY ${e}.rank ASC`:"ORDER BY o.created_at_epoch DESC";case"date_desc":return"ORDER BY o.created_at_epoch DESC";case"date_asc":return"ORDER BY o.created_at_epoch ASC";default:return"ORDER BY o.created_at_epoch DESC"}}searchObservations(t,r={}){let e=[],{limit:n=50,offset:i=0,orderBy:a="relevance",...o}=r,c=this.escapeFTS5(t);e.push(c);let l=this.buildFilterClause(o,e,"o"),f=l?`AND ${l}`:"",y=this.buildOrderClause(a,!0),R=`
SELECT
o.*,
observations_fts.rank as rank
FROM observations o
JOIN observations_fts ON o.id = observations_fts.rowid
WHERE observations_fts MATCH ?
${f}
${y}
LIMIT ? OFFSET ?
`;e.push(n,i);let m=this.db.prepare(R).all(...e);if(m.length>0){let b=Math.min(...m.map(_=>_.rank||0)),p=Math.max(...m.map(_=>_.rank||0))-b||1;m.forEach(_=>{_.rank!==void 0&&(_.score=1-(_.rank-b)/p)})}return m}searchSessions(t,r={}){let e=[],{limit:n=50,offset:i=0,orderBy:a="relevance",...o}=r,c=this.escapeFTS5(t);e.push(c);let l={...o};delete l.type;let f=this.buildFilterClause(l,e,"s"),b=`
SELECT
s.*,
session_summaries_fts.rank as rank
FROM session_summaries s
JOIN session_summaries_fts ON s.id = session_summaries_fts.rowid
WHERE session_summaries_fts MATCH ?
${(f?`AND ${f}`:"").replace(/files_read/g,"files_read").replace(/files_modified/g,"files_edited")}
${a==="relevance"?"ORDER BY session_summaries_fts.rank ASC":a==="date_asc"?"ORDER BY s.created_at_epoch ASC":"ORDER BY s.created_at_epoch DESC"}
LIMIT ? OFFSET ?
`;e.push(n,i);let d=this.db.prepare(b).all(...e);if(d.length>0){let p=Math.min(...d.map(x=>x.rank||0)),g=Math.max(...d.map(x=>x.rank||0))-p||1;d.forEach(x=>{x.rank!==void 0&&(x.score=1-(x.rank-p)/g)})}return d}findByConcept(t,r={}){let e=[],n={...r,concepts:t},a=`
SELECT o.*
FROM observations o
WHERE ${this.buildFilterClause(n,e,"o")}
ORDER BY o.created_at_epoch DESC
`;return this.db.prepare(a).all(...e)}findByFile(t,r={}){let e=[],n={...r,files:t},a=`
SELECT o.*
FROM observations o
WHERE ${this.buildFilterClause(n,e,"o")}
ORDER BY o.created_at_epoch DESC
`,o=this.db.prepare(a).all(...e),c=[],l={...r};delete l.type;let f=[];if(l.project&&(f.push("s.project = ?"),c.push(l.project)),l.dateRange){let{start:m,end:b}=l.dateRange;if(m){let d=typeof m=="number"?m:new Date(m).getTime();f.push("s.created_at_epoch >= ?"),c.push(d)}if(b){let d=typeof b=="number"?b:new Date(b).getTime();f.push("s.created_at_epoch <= ?"),c.push(d)}}f.push(`(
EXISTS (SELECT 1 FROM json_each(s.files_read) WHERE value LIKE ?)
OR EXISTS (SELECT 1 FROM json_each(s.files_edited) WHERE value LIKE ?)
)`),c.push(`%${t}%`,`%${t}%`);let y=`
SELECT s.*
FROM session_summaries s
WHERE ${f.join(" AND ")}
ORDER BY s.created_at_epoch DESC
`,R=this.db.prepare(y).all(...c);return{observations:o,sessions:R}}findByType(t,r={}){let e=[],n={...r,type:t},a=`
SELECT o.*
FROM observations o
WHERE ${this.buildFilterClause(n,e,"o")}
ORDER BY o.created_at_epoch DESC
`;return this.db.prepare(a).all(...e)}advancedSearch(t){let{textQuery:r,searchSessions:e=!0,...n}=t,i=[],a=[];if(r)i=this.searchObservations(r,n),e&&(a=this.searchSessions(r,n));else{let o=[],c=this.buildFilterClause(n,o,"o");if(c){let l=`
SELECT o.*
FROM observations o
WHERE ${c}
${this.buildOrderClause(n.orderBy,!1)}
LIMIT ? OFFSET ?
`;o.push(n.limit||50,n.offset||0),i=this.db.prepare(l).all(...o)}if(e){let l=[],f={...n};delete f.type;let y=this.buildFilterClause(f,l,"s");if(y){let R=`
SELECT s.*
FROM session_summaries s
WHERE ${y}
ORDER BY s.created_at_epoch DESC
LIMIT ? OFFSET ?
`;l.push(n.limit||50,n.offset||0),a=this.db.prepare(R).all(...l)}}}return{observations:i,sessions:a}}close(){this.db.close()}};var Nr;try{Nr=new es}catch(s){console.error("[search-server] Failed to initialize search:",s.message),process.exit(1)}function Oa(s,t){let r=`claude-mem://observation/${s.id}`,e=s.title||`Observation #${s.id}`,n=[];s.subtitle&&n.push(`**${s.subtitle}**`),s.narrative&&n.push(s.narrative),s.text&&n.push(s.text);let i=[];if(i.push(`Type: ${s.type}`),s.facts)try{let o=JSON.parse(s.facts);o.length>0&&i.push(`Facts: ${o.join("; ")}`)}catch{}if(s.concepts)try{let o=JSON.parse(s.concepts);o.length>0&&i.push(`Concepts: ${o.join(", ")}`)}catch{}if(s.files_read||s.files_modified){let o=[];if(s.files_read)try{o.push(...JSON.parse(s.files_read))}catch{}if(s.files_modified)try{o.push(...JSON.parse(s.files_modified))}catch{}o.length>0&&i.push(`Files: ${[...new Set(o)].join(", ")}`)}i.length>0&&n.push(`
---
${i.join(" | ")}`);let a=n.join(`
`);return{type:"search_result",source:r,title:e,content:[{type:"text",text:a||"No content available"}],citations:{enabled:!0}}}function Zs(s,t){let r=`claude-mem://session/${s.sdk_session_id}`,e=s.request||`Session ${s.sdk_session_id.substring(0,8)}`,n=[];s.completed&&n.push(`**Completed:** ${s.completed}`),s.learned&&n.push(`**Learned:** ${s.learned}`),s.investigated&&n.push(`**Investigated:** ${s.investigated}`),s.next_steps&&n.push(`**Next Steps:** ${s.next_steps}`),s.notes&&n.push(`**Notes:** ${s.notes}`);let i=[];if(s.files_read||s.files_edited){let c=[];if(s.files_read)try{c.push(...JSON.parse(s.files_read))}catch{}if(s.files_edited)try{c.push(...JSON.parse(s.files_edited))}catch{}c.length>0&&i.push(`Files: ${[...new Set(c)].join(", ")}`)}let a=new Date(s.created_at_epoch).toLocaleDateString();i.push(`Date: ${a}`),i.length>0&&n.push(`
---
${i.join(" | ")}`);let o=n.join(`
`);return{type:"search_result",source:r,title:e,content:[{type:"text",text:o||"No content available"}],citations:{enabled:!0}}}var Ri=G.object({project:G.string().optional().describe("Filter by project name"),type:G.union([G.enum(["decision","bugfix","feature","refactor","discovery","change"]),G.array(G.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).optional().describe("Filter by observation type"),concepts:G.union([G.string(),G.array(G.string())]).optional().describe("Filter by concept tags"),files:G.union([G.string(),G.array(G.string())]).optional().describe("Filter by file paths (partial match)"),dateRange:G.object({start:G.union([G.string(),G.number()]).optional().describe("Start date (ISO string or epoch)"),end:G.union([G.string(),G.number()]).optional().describe("End date (ISO string or epoch)")}).optional().describe("Filter by date range"),limit:G.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:G.number().min(0).default(0).describe("Number of results to skip"),orderBy:G.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order")}),hm=di({name:"claude-mem-search",version:"1.0.0",tools:[_r("search_observations","Search observations using full-text search across titles, narratives, facts, and concepts",{query:G.string().describe("Search query for FTS5 full-text search"),...Ri.shape},async s=>{try{let{query:t,...r}=s,e=Nr.searchObservations(t,r);return e.length===0?{content:[{type:"text",text:`No observations found matching "${t}"`}]}:{content:e.map((n,i)=>Oa(n,i))}}catch(t){return{content:[{type:"text",text:`Search failed: ${t.message}`}]}}}),_r("search_sessions","Search session summaries using full-text search across requests, completions, learnings, and notes",{query:G.string().describe("Search query for FTS5 full-text search"),project:G.string().optional().describe("Filter by project name"),dateRange:G.object({start:G.union([G.string(),G.number()]).optional(),end:G.union([G.string(),G.number()]).optional()}).optional().describe("Filter by date range"),limit:G.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:G.number().min(0).default(0).describe("Number of results to skip"),orderBy:G.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order")},async s=>{try{let{query:t,...r}=s,e=Nr.searchSessions(t,r);return e.length===0?{content:[{type:"text",text:`No sessions found matching "${t}"`}]}:{content:e.map((n,i)=>Zs(n,i))}}catch(t){return{content:[{type:"text",text:`Search failed: ${t.message}`}]}}}),_r("find_by_concept","Find observations tagged with a specific concept",{concept:G.string().describe("Concept tag to search for"),project:G.string().optional().describe("Filter by project name"),dateRange:G.object({start:G.union([G.string(),G.number()]).optional(),end:G.union([G.string(),G.number()]).optional()}).optional().describe("Filter by date range")},async s=>{try{let{concept:t,...r}=s,e=Nr.findByConcept(t,r);return e.length===0?{content:[{type:"text",text:`No observations found with concept "${t}"`}]}:{content:e.map((n,i)=>Oa(n,i))}}catch(t){return{content:[{type:"text",text:`Search failed: ${t.message}`}]}}}),_r("find_by_file","Find observations and sessions that reference a specific file path",{filePath:G.string().describe("File path to search for (supports partial matching)"),project:G.string().optional().describe("Filter by project name"),dateRange:G.object({start:G.union([G.string(),G.number()]).optional(),end:G.union([G.string(),G.number()]).optional()}).optional().describe("Filter by date range")},async s=>{try{let{filePath:t,...r}=s,e=Nr.findByFile(t,r);if(e.observations.length+e.sessions.length===0)return{content:[{type:"text",text:`No results found for file "${t}"`}]};let i=[];return e.observations.forEach((a,o)=>{i.push(Oa(a,o))}),e.sessions.forEach((a,o)=>{i.push(Zs(a,o+e.observations.length))}),{content:i}}catch(t){return{content:[{type:"text",text:`Search failed: ${t.message}`}]}}}),_r("find_by_type","Find observations of a specific type (decision, bugfix, feature, refactor, discovery, change)",{type:G.union([G.enum(["decision","bugfix","feature","refactor","discovery","change"]),G.array(G.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).describe("Observation type(s) to filter by"),project:G.string().optional().describe("Filter by project name"),dateRange:G.object({start:G.union([G.string(),G.number()]).optional(),end:G.union([G.string(),G.number()]).optional()}).optional().describe("Filter by date range")},async s=>{try{let{type:t,...r}=s,e=Nr.findByType(t,r);return e.length===0?{content:[{type:"text",text:`No observations found with type "${Array.isArray(t)?t.join(", "):t}"`}]}:{content:e.map((n,i)=>Oa(n,i))}}catch(t){return{content:[{type:"text",text:`Search failed: ${t.message}`}]}}}),_r("advanced_search","Advanced search combining full-text search with structured filters across both observations and sessions",{textQuery:G.string().optional().describe("Optional text query for FTS5 search"),searchSessions:G.boolean().default(!0).describe("Include session summaries in results"),...Ri.shape},async s=>{try{let t=Nr.advancedSearch(s);if(t.observations.length+t.sessions.length===0)return{content:[{type:"text",text:"No results found matching the search criteria"}]};let e=[];return t.observations.forEach((n,i)=>{e.push(Oa(n,i))}),t.sessions.forEach((n,i)=>{e.push(Zs(n,i+t.observations.length))}),{content:e}}catch(t){return{content:[{type:"text",text:`Search failed: ${t.message}`}]}}})]});console.error("[search-server] Starting claude-mem search server...");