diff --git a/docs/public/architecture/search-architecture.mdx b/docs/public/architecture/search-architecture.mdx
index 7e195926..2bcda614 100644
--- a/docs/public/architecture/search-architecture.mdx
+++ b/docs/public/architecture/search-architecture.mdx
@@ -397,7 +397,7 @@ Claude translates to appropriate API call.
### For Developers
-**Deprecated**: MCP search server (`src/servers/search-server.ts`)
+**Renamed**: MCP server (formerly `search-server.ts`, now `src/servers/mcp-server.ts`)
- Source file kept for reference
- No longer built or registered
- MCP configuration removed from `plugin/.mcp.json`
diff --git a/docs/public/configuration.mdx b/docs/public/configuration.mdx
index 5f0a306e..94b01801 100644
--- a/docs/public/configuration.mdx
+++ b/docs/public/configuration.mdx
@@ -82,7 +82,7 @@ ${CLAUDE_PLUGIN_ROOT}/
│ ├── summary-hook.js # Summary generation hook
│ ├── cleanup-hook.js # Session cleanup hook
│ ├── worker-service.cjs # Worker service (CJS)
-│ └── search-server.cjs # MCP search server (CJS)
+│ └── mcp-server.cjs # MCP search server (CJS)
└── ui/
└── viewer.html # Web viewer UI bundle
```
diff --git a/docs/public/development.mdx b/docs/public/development.mdx
index b15d2d20..d6985059 100644
--- a/docs/public/development.mdx
+++ b/docs/public/development.mdx
@@ -33,7 +33,7 @@ The build process uses esbuild to compile TypeScript:
1. Compiles TypeScript to JavaScript
2. Creates standalone executables for each hook in `plugin/scripts/`
-3. Bundles MCP search server to `plugin/scripts/search-server.cjs`
+3. Bundles MCP search server to `plugin/scripts/mcp-server.cjs`
4. Bundles worker service to `plugin/scripts/worker-service.cjs`
5. Bundles web viewer UI to `plugin/ui/viewer.html`
@@ -41,7 +41,7 @@ The build process uses esbuild to compile TypeScript:
- Hook executables: `*-hook.js` (ESM format)
- Smart installer: `smart-install.js` (ESM format)
- Worker service: `worker-service.cjs` (CJS format)
-- Search server: `search-server.cjs` (CJS format)
+- MCP server: `mcp-server.cjs` (CJS format)
- Viewer UI: `viewer.html` (self-contained HTML bundle)
### Build Scripts
@@ -342,7 +342,7 @@ npm test
### Adding MCP Search Tools
-1. Add tool definition in `src/servers/search-server.ts`:
+1. Add tool definition in `src/servers/mcp-server.ts`:
```typescript
server.setRequestHandler(CallToolRequestSchema, async (request) => {
diff --git a/docs/public/troubleshooting.mdx b/docs/public/troubleshooting.mdx
index fb785587..52e19a5b 100644
--- a/docs/public/troubleshooting.mdx
+++ b/docs/public/troubleshooting.mdx
@@ -542,7 +542,7 @@ The skill includes comprehensive diagnostics, automated repair sequences, and de
2. Verify search server is built:
```bash
- ls -l plugin/scripts/search-server.js
+ ls -l plugin/scripts/mcp-server.cjs
```
3. Rebuild if needed:
diff --git a/plugin/scripts/mcp-server.cjs b/plugin/scripts/mcp-server.cjs
index 0709e6f7..fe7eaa76 100755
--- a/plugin/scripts/mcp-server.cjs
+++ b/plugin/scripts/mcp-server.cjs
@@ -1,13 +1,13 @@
#!/usr/bin/env node
-"use strict";var hl=Object.create;var Pa=Object.defineProperty;var pl=Object.getOwnPropertyDescriptor;var ml=Object.getOwnPropertyNames;var vl=Object.getPrototypeOf,gl=Object.prototype.hasOwnProperty;var Q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),yl=(a,e)=>{for(var t in e)Pa(a,t,{get:e[t],enumerable:!0})},bl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ml(e))!gl.call(a,r)&&r!==t&&Pa(a,r,{get:()=>e[r],enumerable:!(s=pl(e,r))||s.enumerable});return a};var $s=(a,e,t)=>(t=a!=null?hl(vl(a)):{},bl(e||!a||!a.__esModule?Pa(t,"default",{value:a,enumerable:!0}):t,a));var ln=Q((Bt,on)=>{(function(a,e){typeof Bt=="object"&&typeof on<"u"?e(Bt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Bt,(function(a){"use strict";function e(){for(var p=arguments.length,u=Array(p),v=0;v
1){u[0]=u[0].slice(0,-1);for(var x=u.length-1,P=1;P= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-y,z=Math.floor,M=String.fromCharCode;function F(p){throw new RangeError(q[p])}function D(p,u){for(var v=[],x=p.length;x--;)v[x]=u(p[x]);return v}function A(p,u){var v=p.split("@"),x="";v.length>1&&(x=v[0]+"@",p=v[1]),p=p.replace(V,".");var P=p.split("."),N=D(P,u).join(".");return x+N}function L(p){for(var u=[],v=0,x=p.length;v=55296&&P<=56319&&v>1,u+=z(u/v);u>k*b>>1;P+=c)u=z(u/k);return z(P+(k+1)*u/(u+g))},Z=function(u){var v=[],x=u.length,P=0,N=S,K=$,ae=u.lastIndexOf(R);ae<0&&(ae=0);for(var oe=0;oe=128&&F("not-basic"),v.push(u.charCodeAt(oe));for(var _e=ae>0?ae+1:0;_e=x&&F("invalid-input");var de=Y(u.charCodeAt(_e++));(de>=c||de>z((_-P)/he))&&F("overflow"),P+=de*he;var ne=xe<=K?y:xe>=K+b?b:xe-K;if(dez(_/pe)&&F("overflow"),he*=pe}var ce=v.length+1;K=G(P-te,ce,te==0),z(P/ce)>_-N&&F("overflow"),N+=z(P/ce),P%=ce,v.splice(P++,0,N)}return String.fromCodePoint.apply(String,v)},me=function(u){var v=[];u=L(u);var x=u.length,P=S,N=0,K=$,ae=!0,oe=!1,_e=void 0;try{for(var te=u[Symbol.iterator](),he;!(ae=(he=te.next()).done);ae=!0){var xe=he.value;xe<128&&v.push(M(xe))}}catch(kr){oe=!0,_e=kr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw _e}}var de=v.length,ne=de;for(de&&v.push(R);ne=P&&qez((_-N)/Ve)&&F("overflow"),N+=(pe-P)*Ve,P=pe;var sr=!0,Ir=!1,dr=void 0;try{for(var pt=u[Symbol.iterator](),$t;!(sr=($t=pt.next()).done);sr=!0){var Tt=$t.value;if(Tt_&&F("overflow"),Tt==P){for(var Yr=N,Xr=c;;Xr+=c){var fr=Xr<=K?y:Xr>=K+b?b:Xr-K;if(Yr>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase():v="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase(),v}function $e(p){for(var u="",v=0,x=p.length;v=194&&P<224){if(x-v>=6){var N=parseInt(p.substr(v+4,2),16);u+=String.fromCharCode((P&31)<<6|N&63)}else u+=p.substr(v,6);v+=6}else if(P>=224){if(x-v>=9){var K=parseInt(p.substr(v+4,2),16),ae=parseInt(p.substr(v+7,2),16);u+=String.fromCharCode((P&15)<<12|(K&63)<<6|ae&63)}else u+=p.substr(v,9);v+=9}else u+=p.substr(v,3),v+=3}return u}function yr(p,u){function v(x){var P=$e(x);return P.match(u.UNRESERVED)?P:x}return p.scheme&&(p.scheme=String(p.scheme).replace(u.PCT_ENCODED,v).toLowerCase().replace(u.NOT_SCHEME,"")),p.userinfo!==void 0&&(p.userinfo=String(p.userinfo).replace(u.PCT_ENCODED,v).replace(u.NOT_USERINFO,Pe).replace(u.PCT_ENCODED,r)),p.host!==void 0&&(p.host=String(p.host).replace(u.PCT_ENCODED,v).toLowerCase().replace(u.NOT_HOST,Pe).replace(u.PCT_ENCODED,r)),p.path!==void 0&&(p.path=String(p.path).replace(u.PCT_ENCODED,v).replace(p.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,Pe).replace(u.PCT_ENCODED,r)),p.query!==void 0&&(p.query=String(p.query).replace(u.PCT_ENCODED,v).replace(u.NOT_QUERY,Pe).replace(u.PCT_ENCODED,r)),p.fragment!==void 0&&(p.fragment=String(p.fragment).replace(u.PCT_ENCODED,v).replace(u.NOT_FRAGMENT,Pe).replace(u.PCT_ENCODED,r)),p}function cr(p){return p.replace(/^0*(.*)/,"$1")||"0"}function be(p,u){var v=p.match(u.IPV4ADDRESS)||[],x=h(v,2),P=x[1];return P?P.split(".").map(cr).join("."):p}function ve(p,u){var v=p.match(u.IPV6ADDRESS)||[],x=h(v,3),P=x[1],N=x[2];if(P){for(var K=P.toLowerCase().split("::").reverse(),ae=h(K,2),oe=ae[0],_e=ae[1],te=_e?_e.split(":").map(cr):[],he=oe.split(":").map(cr),xe=u.IPV4ADDRESS.test(he[he.length-1]),de=xe?7:8,ne=he.length-de,pe=Array(de),ce=0;ce1){var ue=pe.slice(0,Me.index),qe=pe.slice(Me.index+Me.length);Ue=ue.join(":")+"::"+qe.join(":")}else Ue=pe.join(":");return N&&(Ue+="%"+N),Ue}else return p}var Or=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Re="".match(/(){0}/)[1]===void 0;function ie(p){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},x=u.iri!==!1?f:d;u.reference==="suffix"&&(p=(u.scheme?u.scheme+":":"")+"//"+p);var P=p.match(Or);if(P){Re?(v.scheme=P[1],v.userinfo=P[3],v.host=P[4],v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=P[7],v.fragment=P[8],isNaN(v.port)&&(v.port=P[5])):(v.scheme=P[1]||void 0,v.userinfo=p.indexOf("@")!==-1?P[3]:void 0,v.host=p.indexOf("//")!==-1?P[4]:void 0,v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=p.indexOf("?")!==-1?P[7]:void 0,v.fragment=p.indexOf("#")!==-1?P[8]:void 0,isNaN(v.port)&&(v.port=p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),v.host&&(v.host=ve(be(v.host,x),x)),v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0?v.reference="same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",u.reference&&u.reference!=="suffix"&&u.reference!==v.reference&&(v.error=v.error||"URI is not a "+u.reference+" reference.");var N=ye[(u.scheme||v.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!N||!N.unicodeSupport)){if(v.host&&(u.domainHost||N&&N.domainHost))try{v.host=se.toASCII(v.host.replace(x.PCT_ENCODED,$e).toLowerCase())}catch(K){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+K}yr(v,d)}else yr(v,x);N&&N.parse&&N.parse(v,u)}else v.error=v.error||"URI can not be parsed.";return v}function br(p,u){var v=u.iri!==!1?f:d,x=[];return p.userinfo!==void 0&&(x.push(p.userinfo),x.push("@")),p.host!==void 0&&x.push(ve(be(String(p.host),v),v).replace(v.IPV6ADDRESS,function(P,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof p.port=="number"||typeof p.port=="string")&&(x.push(":"),x.push(String(p.port))),x.length?x.join(""):void 0}var ur=/^\.\.?\//,Dr=/^\/\.(\/|$)/,$r=/^\/\.\.(\/|$)/,Ee=/^\/?(?:.|\n)*?(?=\/|$)/;function ze(p){for(var u=[];p.length;)if(p.match(ur))p=p.replace(ur,"");else if(p.match(Dr))p=p.replace(Dr,"/");else if(p.match($r))p=p.replace($r,"/"),u.pop();else if(p==="."||p==="..")p="";else{var v=p.match(Ee);if(v){var x=v[0];p=p.slice(x.length),u.push(x)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function ke(p){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=u.iri?f:d,x=[],P=ye[(u.scheme||p.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(p,u),p.host&&!v.IPV6ADDRESS.test(p.host)){if(u.domainHost||P&&P.domainHost)try{p.host=u.iri?se.toUnicode(p.host):se.toASCII(p.host.replace(v.PCT_ENCODED,$e).toLowerCase())}catch(ae){p.error=p.error||"Host's domain name can not be converted to "+(u.iri?"Unicode":"ASCII")+" via punycode: "+ae}}yr(p,v),u.reference!=="suffix"&&p.scheme&&(x.push(p.scheme),x.push(":"));var N=br(p,u);if(N!==void 0&&(u.reference!=="suffix"&&x.push("//"),x.push(N),p.path&&p.path.charAt(0)!=="/"&&x.push("/")),p.path!==void 0){var K=p.path;!u.absolutePath&&(!P||!P.absolutePath)&&(K=ze(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),x.push(K)}return p.query!==void 0&&(x.push("?"),x.push(p.query)),p.fragment!==void 0&&(x.push("#"),x.push(p.fragment)),x.join("")}function Te(p,u){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],P={};return x||(p=ie(ke(p,v),v),u=ie(ke(u,v),v)),v=v||{},!v.tolerant&&u.scheme?(P.scheme=u.scheme,P.userinfo=u.userinfo,P.host=u.host,P.port=u.port,P.path=ze(u.path||""),P.query=u.query):(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0?(P.userinfo=u.userinfo,P.host=u.host,P.port=u.port,P.path=ze(u.path||""),P.query=u.query):(u.path?(u.path.charAt(0)==="/"?P.path=ze(u.path):((p.userinfo!==void 0||p.host!==void 0||p.port!==void 0)&&!p.path?P.path="/"+u.path:p.path?P.path=p.path.slice(0,p.path.lastIndexOf("/")+1)+u.path:P.path=u.path,P.path=ze(P.path)),P.query=u.query):(P.path=p.path,u.query!==void 0?P.query=u.query:P.query=p.query),P.userinfo=p.userinfo,P.host=p.host,P.port=p.port),P.scheme=p.scheme),P.fragment=u.fragment,P}function tr(p,u,v){var x=l({scheme:"null"},v);return ke(Te(ie(p,x),ie(u,x),x,!0),x)}function Le(p,u){return typeof p=="string"?p=ke(ie(p,u),u):s(p)==="object"&&(p=ie(ke(p,u),u)),p}function Dt(p,u,v){return typeof p=="string"?p=ke(ie(p,v),v):s(p)==="object"&&(p=ke(p,v)),typeof u=="string"?u=ke(ie(u,v),v):s(u)==="object"&&(u=ke(u,v)),p===u}function ya(p,u){return p&&p.toString().replace(!u||!u.iri?d.ESCAPE:f.ESCAPE,Pe)}function Ke(p,u){return p&&p.toString().replace(!u||!u.iri?d.PCT_ENCODED:f.PCT_ENCODED,$e)}var ft={scheme:"http",domainHost:!0,parse:function(u,v){return u.host||(u.error=u.error||"HTTP URIs must have a host."),u},serialize:function(u,v){var x=String(u.scheme).toLowerCase()==="https";return(u.port===(x?443:80)||u.port==="")&&(u.port=void 0),u.path||(u.path="/"),u}},gs={scheme:"https",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize};function ys(p){return typeof p.secure=="boolean"?p.secure:String(p.scheme).toLowerCase()==="wss"}var ht={scheme:"ws",domainHost:!0,parse:function(u,v){var x=u;return x.secure=ys(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(u,v){if((u.port===(ys(u)?443:80)||u.port==="")&&(u.port=void 0),typeof u.secure=="boolean"&&(u.scheme=u.secure?"wss":"ws",u.secure=void 0),u.resourceName){var x=u.resourceName.split("?"),P=h(x,2),N=P[0],K=P[1];u.path=N&&N!=="/"?N:void 0,u.query=K,u.resourceName=void 0}return u.fragment=void 0,u}},bs={scheme:"wss",domainHost:ht.domainHost,parse:ht.parse,serialize:ht.serialize},Jo={},Ko=!0,_s="[A-Za-z0-9\\-\\.\\_\\~"+(Ko?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",Wo=t(t("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+t("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+t("%"+ar+ar)),Go="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Yo="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Xo=e(Yo,'[\\"\\\\]'),el="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",rl=new RegExp(_s,"g"),Gr=new RegExp(Wo,"g"),tl=new RegExp(e("[^]",Go,"[\\.]",'[\\"]',Xo),"g"),xs=new RegExp(e("[^]",_s,el),"g"),al=xs;function ba(p){var u=$e(p);return u.match(rl)?u:p}var Ps={scheme:"mailto",parse:function(u,v){var x=u,P=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var N=!1,K={},ae=x.query.split("&"),oe=0,_e=ae.length;oe<_e;++oe){var te=ae[oe].split("=");switch(te[0]){case"to":for(var he=te[1].split(","),xe=0,de=he.length;xe{"use strict";cn.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var l=n[r];if(!a(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}});var dn=Q((dh,un)=>{"use strict";un.exports=function(e){for(var t=0,s=e.length,r=0,n;r=55296&&n<=56319&&r{"use strict";pn.exports={copy:Ru,checkDataType:qa,checkDataTypes:Ou,coerceToTypes:Du,toHash:Ua,getProperty:Va,escapeQuotes:Za,equal:Qt(),ucs2length:dn(),varOccurences:Iu,varReplace:ku,schemaHasRules:Au,schemaHasRulesExcept:ju,schemaUnknownRules:Cu,toQuotedString:za,getPathExpr:Nu,getPath:Fu,getData:qu,unescapeFragment:zu,unescapeJsonPointer:Ba,escapeFragment:Uu,escapeJsonPointer:Ha};function Ru(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function qa(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",l=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return l+"Array.isArray("+e+")";case"object":return"("+l+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(t?n+l+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+l+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Ou(a,e,t){switch(a.length){case 1:return qa(a[0],e,t,!0);default:var s="",r=Ua(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+qa(n,e,t,!0);return s}}var fn=Ua(["string","number","integer","boolean","null"]);function Du(a,e){if(Array.isArray(e)){for(var t=[],s=0;s=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var o=n,d=r.split("/"),f=0;f{"use strict";var Vu=Kr();mn.exports=Zu;function Zu(a){Vu.copy(a,this)}});var gn=Q((ph,vn)=>{"use strict";var Sr=vn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Jt(e,s,r,a,"",a)};Sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Sr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Sr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Jt(a,e,t,s,r,n,l,o,d,f){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,l,o,d,f);for(var h in s){var m=s[h];if(Array.isArray(m)){if(h in Sr.arrayKeywords)for(var _=0;_{"use strict";var Rt=ln(),yn=Qt(),Yt=Kr(),Kt=Qa(),Bu=gn();xn.exports=Rr;Rr.normalizeId=wr;Rr.fullPath=Wt;Rr.url=Gt;Rr.ids=Gu;Rr.inlineRef=Ja;Rr.schema=Xt;function Rr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Rr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Kt)return Ja(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Xt.call(this,e,t),n,l,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Kt?l=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(l=Ja(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),l}function Xt(a,e){var t=Rt.parse(e),s=_n(t),r=Wt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=wr(s),l=this._refs[n];if(typeof l=="string")return Qu.call(this,a,l,t);if(l instanceof Kt)l.validate||this._compile(l),a=l;else if(l=this._schemas[n],l instanceof Kt){if(l.validate||this._compile(l),n==wr(e))return{schema:l,root:a,baseId:r};a=l}else return;if(!a.schema)return;r=Wt(this._getId(a.schema))}return bn.call(this,t,r,a.schema,a)}function Qu(a,e,t){var s=Xt.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var l=this._getId(r);return l&&(n=Gt(n,l)),bn.call(this,t,n,r,a)}}var Ju=Yt.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function bn(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n{"use strict";var Ga=ea();En.exports={Validation:Pn(Yu),MissingRef:Pn(Ya)};function Yu(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Ya.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Ya(a,e,t){this.message=t||Ya.message(a,e),this.missingRef=Ga.url(a,e),this.missingSchema=Ga.normalizeId(Ga.fullPath(this.missingRef))}function Pn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Xa=Q((gh,Sn)=>{"use strict";Sn.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&(function(n){return function(l){return function(o,d){var f={key:o,value:l[o]},h={key:d,value:l[d]};return n(f,h)}}})(e.cmp),r=[];return(function n(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var o,d;if(Array.isArray(l)){for(d="[",o=0;o{"use strict";wn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var t="false schema",h=e.level,m=e.dataLevel,_=e.schema[t],c=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,T=!e.opts.allErrors,q,b="data"+(m||""),R="valid"+h;if(e.schema===!1){e.isTop?T=!0:r+=" var "+R+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&T?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+R+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,h=e.level=0,m=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var S="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var h=e.level,m=e.dataLevel,b="data"+(m||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+h+" = errors;"}var R="valid"+h,T=!e.opts.allErrors,I="",V="",q,k=e.schema.type,z=Array.isArray(k);if(k&&e.opts.nullable&&e.schema.nullable===!0&&(z?k.indexOf("null")==-1&&(k=k.concat("null")):k!="null"&&(k=[k,"null"],z=!0)),z&&k.length==1&&(k=k[0],z=!1),e.schema.$ref&&l){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(l=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),k){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,k);var F=e.RULES.types[k];if(M||z||F===!0||F&&!Ee(F)){var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",c=e.schemaPath+".type",y=e.errSchemaPath+"/type",D=z?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[D](k,b,e.opts.strictNumbers,!0)+") { ",M){var A="dataType"+h,L="coerced"+h;r+=" var "+A+" = typeof "+b+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+A+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+A+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+L+" = "+b+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,G=le.length-1;re{"use strict";var ta=ea(),sa=Kr(),On=ra(),Xu=Xa(),Rn=es(),ed=sa.ucs2length,rd=Qt(),td=On.Validation;$n.exports=rs;function rs(a,e,t,s){var r=this,n=this._opts,l=[void 0],o={},d=[],f={},h=[],m={},_=[];e=e||{schema:a,refVal:l,refs:o};var c=ad.call(this,a,e,s),y=this._compilations[c.index];if(c.compiling)return y.callValidate=S;var b=this._formats,g=this.RULES;try{var E=R(a,e,t,s);y.validate=E;var $=y.callValidate;return $&&($.schema=E.schema,$.errors=null,$.refs=E.refs,$.refVal=E.refVal,$.root=E.root,$.$async=E.$async,n.sourceCode&&($.source=E.source)),E}finally{sd.call(this,a,e,s)}function S(){var D=y.validate,A=D.apply(this,arguments);return S.errors=D.errors,A}function R(D,A,L,le){var Y=!A||A&&A.schema==D;if(A.schema!=e.schema)return rs.call(r,D,A,L,le);var re=D.$async===!0,G=Rn({isTop:!0,schema:D,isRoot:Y,baseId:le,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:On.MissingRef,RULES:g,validate:Rn,util:sa,resolve:ta,resolveRef:T,usePattern:z,useDefault:M,useCustomRule:F,opts:n,formats:b,logger:r.logger,self:r});G=aa(l,od)+aa(d,nd)+aa(h,id)+aa(_,ld)+G,n.processCode&&(G=n.processCode(G,D));var Z;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",G);Z=me(r,g,b,e,l,h,_,rd,ed,td),l[0]=Z}catch(we){throw r.logger.error("Error compiling schema, function code:",G),we}return Z.schema=D,Z.errors=null,Z.refs=o,Z.refVal=l,Z.root=Y?Z:A,re&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:G,patterns:d,defaults:h}),Z}function T(D,A,L){A=ta.url(D,A);var le=o[A],Y,re;if(le!==void 0)return Y=l[le],re="refVal["+le+"]",k(Y,re);if(!L&&e.refs){var G=e.refs[A];if(G!==void 0)return Y=e.refVal[G],re=I(A,Y),k(Y,re)}re=I(A);var Z=ta.call(r,R,e,A);if(Z===void 0){var me=t&&t[A];me&&(Z=ta.inlineRef(me,n.inlineRefs)?me:rs.call(r,me,e,t,D))}if(Z===void 0)V(A);else return q(A,Z),k(Z,re)}function I(D,A){var L=l.length;return l[L]=A,o[D]=L,"refVal"+L}function V(D){delete o[D]}function q(D,A){var L=o[D];l[L]=A}function k(D,A){return typeof D=="object"||typeof D=="boolean"?{code:A,schema:D,inline:!0}:{code:A,$async:D&&!!D.$async}}function z(D){var A=f[D];return A===void 0&&(A=f[D]=d.length,d[A]=D),"pattern"+A}function M(D){switch(typeof D){case"boolean":case"number":return""+D;case"string":return sa.toQuotedString(D);case"object":if(D===null)return"null";var A=Xu(D),L=m[A];return L===void 0&&(L=m[A]=h.length,h[L]=D),"default"+L}}function F(D,A,L,le){if(r._opts.validateSchema!==!1){var Y=D.definition.dependencies;if(Y&&!Y.every(function(Pe){return Object.prototype.hasOwnProperty.call(L,Pe)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=D.definition.validateSchema;if(re){var G=re(A);if(!G){var Z="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var me=D.definition.compile,we=D.definition.inline,De=D.definition.macro,se;if(me)se=me.call(r,A,L,le);else if(De)se=De.call(r,A,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(we)se=we.call(r,le,D.keyword,A,L);else if(se=D.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+D.keyword+'"failed to compile');var ye=_.length;return _[ye]=se,{code:"customRule"+ye,validate:se}}}function ad(a,e,t){var s=Dn.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function sd(a,e,t){var s=Dn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Dn(a,e,t){for(var s=0;s{"use strict";var na=In.exports=function(){this._cache={}};na.prototype.put=function(e,t){this._cache[e]=t};na.prototype.get=function(e){return this._cache[e]};na.prototype.del=function(e){delete this._cache[e]};na.prototype.clear=function(){this._cache={}}});var Zn=Q((xh,Vn)=>{"use strict";var cd=Kr(),ud=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dd=[0,31,28,31,30,31,30,31,31,30,31,30,31],fd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,An=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,hd=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,pd=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,jn=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Cn=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Nn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Fn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ln=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Mn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Vn.exports=ia;function ia(a){return a=a=="full"?"full":"fast",cd.copy(ia[a])}ia.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":jn,url:Cn,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:An,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Un,uuid:Nn,"json-pointer":Fn,"json-pointer-uri-fragment":Ln,"relative-json-pointer":Mn};ia.full={date:qn,time:zn,"date-time":gd,uri:bd,"uri-reference":pd,"uri-template":jn,url:Cn,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:An,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Un,uuid:Nn,"json-pointer":Fn,"json-pointer-uri-fragment":Ln,"relative-json-pointer":Mn};function md(a){return a%4===0&&(a%100!==0||a%400===0)}function qn(a){var e=a.match(ud);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&md(t)?29:dd[s])}function zn(a,e){var t=a.match(fd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],l=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||l)}var vd=/t|\s/i;function gd(a){var e=a.split(vd);return e.length==2&&qn(e[0])&&zn(e[1],!0)}var yd=/\/|:/;function bd(a){return yd.test(a)&&hd.test(a)}var _d=/[^\\]\\Z/;function Un(a){if(_d.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Bn=Q((Ph,Hn)=>{"use strict";Hn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(l||""),m="valid"+n,_,c;if(o=="#"||o=="#/")e.isRoot?(_=e.async,c="validate"):(_=e.root.schema.$async===!0,c="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(b);var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,b)}else if(y.inline){var $=e.util.copy(e);$.level++;var S="valid"+$.level;$.schema=y.schema,$.schemaPath="",$.errSchemaPath=o;var R=e.validate($).replace(/validate\.schema/g,y.code);r+=" "+R+" ",f&&(r+=" if ("+S+") { ")}else _=y.$async===!0||e.async&&y.$async!==!1,c=y.code}if(c){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+c+".call(this, ":r+=" "+c+"( ",r+=" "+h+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var T=l?"data"+(l-1||""):"parentData",I=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+T+" , "+I+", rootData) ";var V=r;if(r=g.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",f&&(r+=" "+m+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(r+=" "+m+" = false; "),r+=" } ",f&&(r+=" if ("+m+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+c+".errors; else vErrors = vErrors.concat("+c+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var Jn=Q((Eh,Qn)=>{"use strict";Qn.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,f=e.util.copy(e),h="";f.level++;var m="valid"+f.level,_=f.baseId,c=!0,y=n;if(y)for(var b,g=-1,E=y.length-1;g0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(c=!1,f.schema=b,f.schemaPath=l+"["+g+"]",f.errSchemaPath=o+"/"+g,r+=" "+e.validate(f)+" ",f.baseId=_,d&&(r+=" if ("+m+") { ",h+="}"));return d&&(c?r+=" if (true) { ":r+=" "+h.slice(0,-1)+" "),r}});var Wn=Q((Sh,Kn)=>{"use strict";Kn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=o.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(E){var $=y.baseId;r+=" var "+c+" = errors; var "+_+" = false; ";var S=e.compositeRule;e.compositeRule=y.compositeRule=!0;var R=o;if(R)for(var T,I=-1,V=R.length-1;I{"use strict";Gn.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,d=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+d+", "+e.util.toQuotedString(l)+", validate.root.schema);"),r}});var ei=Q((Rh,Xn)=>{"use strict";Xn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o,c||(r+=" var schema"+n+" = validate.schema"+d+";"),r+="var "+_+" = equal("+m+", schema"+n+"); if (!"+_+") { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var ti=Q((Oh,ri)=>{"use strict";ri.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E="i"+n,$=y.dataLevel=e.dataLevel+1,S="data"+$,R=e.baseId,T=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+c+" = errors;var "+_+";",T){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+g+" = false; for (var "+E+" = 0; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var V=m+"["+E+"]";y.dataPathArr[$]=E;var q=e.validate(y);y.baseId=R,e.util.varOccurences(q,S)<2?r+=" "+e.util.varReplace(q,S,V)+" ":r+=" var "+S+" = "+V+"; "+q+" ",r+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+b+" if (!"+g+") {"}else r+=" if ("+m+".length == 0) {";var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var z=r;return r=k.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",T&&(r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var si=Q((Dh,ai)=>{"use strict";ai.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level,g={},E={},$=e.opts.ownProperties;for(I in o)if(I!="__proto__"){var S=o[I],R=Array.isArray(S)?E:g;R[I]=S}r+="var "+_+" = errors;";var T=e.errorPath;r+="var missing"+n+";";for(var I in E)if(R=E[I],R.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),h){r+=" && ( ";var V=R;if(V)for(var q,k=-1,z=V.length-1;k0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(r+=" "+b+" = true; if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",c.schema=S,c.schemaPath=d+e.util.getProperty(I),c.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(c)+" ",c.baseId=Z,r+=" } ",h&&(r+=" if ("+b+") { ",y+="}"))}return h&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var ii=Q(($h,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="i"+n,g="schema"+n;c||(r+=" var "+g+" = validate.schema"+d+";"),r+="var "+_+";",c&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=""+_+" = false;for (var "+b+"=0; "+b+"<"+g+".length; "+b+"++) if (equal("+m+", "+g+"["+b+"])) { "+_+" = true; break; }",c&&(r+=" } "),r+=" if (!"+_+") { ";var E=E||[];E.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;return r=E.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var li=Q((Th,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===!1)return h&&(r+=" if (true) { "),r;var _=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=e.opts.unknownFormats,b=Array.isArray(y);if(_){var g="format"+n,E="isObject"+n,$="formatType"+n;r+=" var "+g+" = formats["+c+"]; var "+E+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+$+" = "+E+" && "+g+".type || 'string'; if ("+E+") { ",e.async&&(r+=" var async"+n+" = "+g+".async; "),r+=" "+g+" = "+g+".validate; } if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+c+" && !"+g+" ",b&&(r+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),r+=") || "),r+=" ("+g+" && "+$+" == '"+s+"' && !(typeof "+g+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+g+"("+m+") : "+g+"("+m+")) ":r+=" "+g+"("+m+") ",r+=" : "+g+".test("+m+"))))) {"}else{var g=e.formats[o];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(r+=" if (true) { "),r;if(b&&y.indexOf(o)>=0)return h&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var E=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,$=E&&g.type||"string";if(E){var S=g.async===!0;g=g.validate}if($!=s)return h&&(r+=" if (true) { "),r;if(S){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+R+"("+m+"))) { "}else{r+=" if (! ";var R="formats"+e.util.getProperty(o);E&&(R+=".validate"),typeof g=="function"?r+=" "+R+"("+m+") ":r+=" "+R+".test("+m+") ",r+=") { "}}var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",_?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=T.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var ui=Q((Ih,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e);y.level++;var b="valid"+y.level,g=e.schema.then,E=e.schema.else,$=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),S=E!==void 0&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all)),R=y.baseId;if($||S){var T;y.createErrors=!1,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+c+" = errors; var "+_+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=R,y.createErrors=!0,r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,$?(r+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=R,r+=" "+_+" = "+b+"; ",$&&S?(T="ifClause"+n,r+=" var "+T+" = 'then'; "):T="'then'",r+=" } ",S&&(r+=" else { ")):r+=" if (!"+b+") { ",S&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=R,r+=" "+_+" = "+b+"; ",$&&S?(T="ifClause"+n,r+=" var "+T+" = 'else'; "):T="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+T+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+T+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var fi=Q((kh,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E="i"+n,$=y.dataLevel=e.dataLevel+1,S="data"+$,R=e.baseId;if(r+="var "+c+" = errors;var "+_+";",Array.isArray(o)){var T=e.schema.additionalItems;if(T===!1){r+=" "+_+" = "+m+".length <= "+o.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var q=r;r=V.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f=I,h&&(b+="}",r+=" else { ")}var k=o;if(k){for(var z,M=-1,F=k.length-1;M0||z===!1:e.util.schemaHasRules(z,e.RULES.all)){r+=" "+g+" = true; if ("+m+".length > "+M+") { ";var D=m+"["+M+"]";y.schema=z,y.schemaPath=d+"["+M+"]",y.errSchemaPath=f+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[$]=M;var A=e.validate(y);y.baseId=R,e.util.varOccurences(A,S)<2?r+=" "+e.util.varReplace(A,S,D)+" ":r+=" var "+S+" = "+D+"; "+A+" ",r+=" } ",h&&(r+=" if ("+g+") { ",b+="}")}}if(typeof T=="object"&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))){y.schema=T,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+m+".length > "+o.length+") { for (var "+E+" = "+o.length+"; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var D=m+"["+E+"]";y.dataPathArr[$]=E;var A=e.validate(y);y.baseId=R,e.util.varOccurences(A,S)<2?r+=" "+e.util.varReplace(A,S,D)+" ":r+=" var "+S+" = "+D+"; "+A+" ",h&&(r+=" if (!"+g+") break; "),r+=" } } ",h&&(r+=" if ("+g+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" for (var "+E+" = 0; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var D=m+"["+E+"]";y.dataPathArr[$]=E;var A=e.validate(y);y.baseId=R,e.util.varOccurences(A,S)<2?r+=" "+e.util.varReplace(A,S,D)+" ":r+=" var "+S+" = "+D+"; "+A+" ",h&&(r+=" if (!"+g+") break; "),r+=" }"}return h&&(r+=" "+b+" if ("+c+" == errors) {"),r}});var ts=Q((Ah,hi)=>{"use strict";hi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,R,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=t=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],E=e.opts.$data&&g&&g.$data,$=y?"<":">",S=y?">":"<",R=void 0;if(!(_||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(E||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(b+" must be number or boolean");if(E){var T=e.util.getData(g.$data,l,e.dataPathArr),I="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,k="op"+n,z="' + "+k+" + '";r+=" var schemaExcl"+n+" = "+T+"; ",T="schemaExcl"+n,r+=" var "+I+"; var "+V+" = typeof "+T+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var R=b,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+I+" = "+c+" === undefined || "+T+" "+$+"= "+c+") ? "+m+" "+S+"= "+T+" : "+m+" "+S+" "+c+" ) : ( ("+I+" = "+T+" === true) ? "+m+" "+S+"= "+c+" : "+m+" "+S+" "+c+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+$+"' : '"+$+"='; ",o===void 0&&(R=b,f=e.errSchemaPath+"/"+b,c=T,_=E)}else{var q=typeof g=="number",z=$;if(q&&_){var k="'"+z+"'";r+=" if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" ( "+c+" === undefined || "+g+" "+$+"= "+c+" ? "+m+" "+S+"= "+g+" : "+m+" "+S+" "+c+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(I=!0,R=b,f=e.errSchemaPath+"/"+b,c=g,S+="="):(q&&(c=Math[y?"min":"max"](g,o)),g===(q?c:!0)?(I=!0,R=b,f=e.errSchemaPath+"/"+b,S+="="):(I=!1,z+="="));var k="'"+z+"'";r+=" if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+" "+S+" "+c+" || "+m+" !== "+m+") { "}}R=R||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+k+", limit: "+c+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+z+" ",_?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var as=Q((jh,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+".length "+y+" "+c+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var ss=Q((Ch,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+c+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var ns=Q((Nh,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+c+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var yi=Q((Fh,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",_&&(r+=" "+c+" !== undefined && ( typeof "+c+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+c+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",_&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var b=r;return r=y.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+b+"]); ":r+=" validate.errors = ["+b+"]; return false; ":r+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var _i=Q((Lh,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e);c.level++;var y="valid"+c.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){c.schema=o,c.schemaPath=d,c.errSchemaPath=f,r+=" var "+_+" = errors; ";var b=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.createErrors=!1;var g;c.opts.allErrors&&(g=c.opts.allErrors,c.opts.allErrors=!1),r+=" "+e.validate(c)+" ",c.createErrors=!0,g&&(c.opts.allErrors=g),e.compositeRule=c.compositeRule=b,r+=" if ("+y+") { ";var E=E||[];E.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;r=E.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+_+"; if (vErrors !== null) { if ("+_+") vErrors.length = "+_+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(r+=" if (false) { ");return r}});var Pi=Q((Mh,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=y.baseId,$="prevValid"+n,S="passingSchemas"+n;r+="var "+c+" = errors , "+$+" = false , "+_+" = false , "+S+" = null; ";var R=e.compositeRule;e.compositeRule=y.compositeRule=!0;var T=o;if(T)for(var I,V=-1,q=T.length-1;V0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=d+"["+V+"]",y.errSchemaPath=f+"/"+V,r+=" "+e.validate(y)+" ",y.baseId=E):r+=" var "+g+" = true; ",V&&(r+=" if ("+g+" && "+$+") { "+_+" = false; "+S+" = ["+S+", "+V+"]; } else { ",b+="}"),r+=" if ("+g+") { "+_+" = "+$+" = true; "+S+" = "+V+"; }";return e.compositeRule=y.compositeRule=R,r+=""+b+"if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+S+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Si=Q((qh,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=_?"(new RegExp("+c+"))":e.usePattern(o);r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" !"+y+".test("+m+") ) { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",_?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var Ri=Q((zh,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level,g="key"+n,E="idx"+n,$=c.dataLevel=e.dataLevel+1,S="data"+$,R="dataProperties"+n,T=Object.keys(o||{}).filter(re),I=e.schema.patternProperties||{},V=Object.keys(I).filter(re),q=e.schema.additionalProperties,k=T.length||V.length,z=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,D=z||M||F,A=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length8)r+=" || validate.schema"+d+".hasOwnProperty("+g+") ";else{var G=T;if(G)for(var Z,me=-1,we=G.length-1;me0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){var ze=e.util.getProperty(Z),Re=m+ze,ke=br&&Ee.default!==void 0;c.schema=Ee,c.schemaPath=d+ze,c.errSchemaPath=f+"/"+e.util.escapeFragment(Z),c.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),c.dataPathArr[$]=e.util.toQuotedString(Z);var ie=e.validate(c);if(c.baseId=L,e.util.varOccurences(ie,S)<2){ie=e.util.varReplace(ie,S,Re);var Te=Re}else{var Te=S;r+=" var "+S+" = "+Re+"; "}if(ke)r+=" "+ie+" ";else{if(Y&&Y[Z]){r+=" if ( "+Te+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+b+" = false; ";var $e=e.errorPath,cr=f,tr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath($e,Z,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var be=be||[];be.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+tr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+tr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=be.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=cr,e.errorPath=$e,r+=" } else { "}else h?(r+=" if ( "+Te+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+b+" = true; } else { "):(r+=" if ("+Te+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+ie+" } "}}h&&(r+=" if ("+b+") { ",y+="}")}}if(V.length){var Le=V;if(Le)for(var se,Dt=-1,ya=Le.length-1;Dt0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){c.schema=Ee,c.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),c.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),A?r+=" "+R+" = "+R+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+R+".length; "+E+"++) { var "+g+" = "+R+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+g+")) { ",c.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Re=m+"["+g+"]";c.dataPathArr[$]=g;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,S)<2?r+=" "+e.util.varReplace(ie,S,Re)+" ":r+=" var "+S+" = "+Re+"; "+ie+" ",h&&(r+=" if (!"+b+") break; "),r+=" } ",h&&(r+=" else "+b+" = true; "),r+=" } ",h&&(r+=" if ("+b+") { ",y+="}")}}}return h&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Di=Q((Uh,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){c.schema=o,c.schemaPath=d,c.errSchemaPath=f;var g="key"+n,E="idx"+n,$="i"+n,S="' + "+g+" + '",R=c.dataLevel=e.dataLevel+1,T="data"+R,I="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+I+" = undefined; "),V?r+=" "+I+" = "+I+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+I+".length; "+E+"++) { var "+g+" = "+I+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var k=g,z=e.compositeRule;e.compositeRule=c.compositeRule=!0;var M=e.validate(c);c.baseId=q,e.util.varOccurences(M,T)<2?r+=" "+e.util.varReplace(M,T,k)+" ":r+=" var "+T+" = "+k+"; "+M+" ",e.compositeRule=c.compositeRule=z,r+=" if (!"+b+") { for (var "+$+"=startErrs"+n+"; "+$+"{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="schema"+n;if(!c)if(o.length0||T===!1:e.util.schemaHasRules(T,e.RULES.all))||(g[g.length]=$)}}else var g=o;if(c||g.length){var I=e.errorPath,V=c||g.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(h)if(r+=" var missing"+n+"; ",V){c||(r+=" var "+b+" = validate.schema"+d+"; ");var k="i"+n,z="schema"+n+"["+k+"]",M="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,z,e.opts.jsonPointers)),r+=" var "+_+" = true; ",c&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+b+".length; "+k+"++) { "+_+" = "+m+"["+b+"["+k+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+b+"["+k+"]) "),r+="; if (!"+_+") break; } ",c&&(r+=" } "),r+=" if (!"+_+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var A=g;if(A)for(var L,k=-1,le=A.length-1;k{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;if(c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o,(o||c)&&e.opts.uniqueItems!==!1){c&&(r+=" var "+_+"; if ("+y+" === false || "+y+" === undefined) "+_+" = true; else if (typeof "+y+" != 'boolean') "+_+" = false; else { "),r+=" var i = "+m+".length , "+_+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,g=Array.isArray(b);if(!b||b=="object"||b=="array"||g&&(b.indexOf("object")>=0||b.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+_+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var E="checkDataType"+(g?"s":"");r+=" if ("+e.util[E](b,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+_+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",c&&(r+=" } "),r+=" if (!"+_+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",c?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;r=$.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var ji=Q((Hh,Ai)=>{"use strict";Ai.exports={$ref:Bn(),allOf:Jn(),anyOf:Wn(),$comment:Yn(),const:ei(),contains:ti(),dependencies:si(),enum:ii(),format:li(),if:ui(),items:fi(),maximum:ts(),minimum:ts(),maxItems:as(),minItems:as(),maxLength:ss(),minLength:ss(),maxProperties:ns(),minProperties:ns(),multipleOf:yi(),not:_i(),oneOf:Pi(),pattern:Si(),properties:Ri(),propertyNames:Di(),required:Ti(),uniqueItems:ki(),validate:es()}});var Fi=Q((Bh,Ni)=>{"use strict";var Ci=ji(),is=Kr().toHash;Ni.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=is(t),e.types=is(r),e.forEach(function(n){n.rules=n.rules.map(function(l){var o;if(typeof l=="object"){var d=Object.keys(l)[0];o=l[d],l=d,o.forEach(function(h){t.push(h),e.all[h]=!0})}t.push(l);var f=e.all[l]={keyword:l,code:Ci[l],implements:o};return f}),e.all.$comment={keyword:"$comment",code:Ci.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=is(t.concat(s)),e.custom={},e}});var qi=Q((Qh,Mi)=>{"use strict";var Li=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Mi.exports=function(a,e){for(var t=0;t{"use strict";var xd=ra().MissingRef;Ui.exports=zi;function zi(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var o=s._addSchema(a,void 0,e);return o.validate||l(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var d=o.$schema;return d&&!s.getSchema(d)?zi.call(s,{$ref:d},!0):Promise.resolve()}function l(o){try{return s._compile(o)}catch(f){if(f instanceof xd)return d(f);throw f}function d(f){var h=f.missingSchema;if(c(h))throw new Error("Schema "+h+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[h];return m||(m=s._loadingSchemas[h]=s._opts.loadSchema(h),m.then(_,_)),m.then(function(y){if(!c(h))return n(y).then(function(){c(h)||s.addSchema(y,h,void 0,e)})}).then(function(){return l(o)});function _(){delete s._loadingSchemas[h]}function c(y){return s._refs[y]||s._schemas[y]}}}}});var Hi=Q((Kh,Zi)=>{"use strict";Zi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,_="data"+(l||""),c="valid"+n,y="errs__"+n,b=e.opts.$data&&o&&o.$data,g;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",g="schema"+n):g=o;var E=this,$="definition"+n,S=E.definition,R="",T,I,V,q,k;if(b&&S.$data){k="keywordValidate"+n;var z=S.validateSchema;r+=" var "+$+" = RULES.custom['"+t+"'].definition; var "+k+" = "+$+".validate;"}else{if(q=e.useCustomRule(E,o,e.schema,e),!q)return;g="validate.schema"+d,k=q.code,T=S.compile,I=S.inline,V=S.macro}var M=k+".errors",F="i"+n,D="ruleErr"+n,A=S.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(I||V||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+c+";",b&&S.$data&&(R+="}",r+=" if ("+g+" === undefined) { "+c+" = true; } else { ",z&&(R+="}",r+=" "+c+" = "+$+".validateSchema("+g+"); if ("+c+") { ")),I)S.statements?r+=" "+q.validate+" ":r+=" "+c+" = "+q.validate+"; ";else if(V){var L=e.util.copy(e),R="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,k);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var G=G||[];G.push(r),r="",r+=" "+k+".call( ",e.opts.passContext?r+="this":r+="self",T||S.schema===!1?r+=" , "+_+" ":r+=" , "+g+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=l?"data"+(l-1||""):"parentData",me=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+Z+" , "+me+" , rootData ) ";var we=r;r=G.pop(),S.errors===!1?(r+=" "+c+" = ",A&&(r+="await "),r+=""+we+"; "):A?(M="customErrors"+n,r+=" var "+M+" = null; try { "+c+" = await "+we+"; } catch (e) { "+c+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+c+" = "+we+"; "}if(S.modifying&&(r+=" if ("+Z+") "+_+" = "+Z+"["+me+"];"),r+=""+R,S.valid)h&&(r+=" if (true) { ");else{r+=" if ( ",S.valid===void 0?(r+=" !",V?r+=""+le:r+=""+c):r+=" "+!S.valid+" ",r+=") { ",m=E.keyword;var G=G||[];G.push(r),r="";var G=G||[];G.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+E.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+E.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var De=r;r=G.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+De+"]); ":r+=" validate.errors = ["+De+"]; return false; ":r+=" var err = "+De+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=G.pop(),I?S.errors?S.errors!="full"&&(r+=" for (var "+F+"="+y+"; "+F+"{Pd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Ji=Q((Gh,Qi)=>{"use strict";var Bi=os();Qi.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Bi.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Bi.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var Wi=Q((Yh,Ki)=>{"use strict";var Ed=/^[a-z_$][a-z0-9_$-]*$/i,Sd=Hi(),wd=Ji();Ki.exports={add:Rd,get:Od,remove:Dd,validate:ls};function Rd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Ed.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r{$d.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var oo=Q((ep,io)=>{"use strict";var Xi=Tn(),Wr=ea(),Td=kn(),eo=Qa(),Id=Xa(),kd=Zn(),Ad=Fi(),ro=qi(),to=Kr();io.exports=ge;ge.prototype.validate=Cd;ge.prototype.compile=Nd;ge.prototype.addSchema=Fd;ge.prototype.addMetaSchema=Ld;ge.prototype.validateSchema=Md;ge.prototype.getSchema=zd;ge.prototype.removeSchema=Vd;ge.prototype.addFormat=Gd;ge.prototype.errorsText=Wd;ge.prototype._addSchema=Zd;ge.prototype._compile=Hd;ge.prototype.compileAsync=Vi();var ca=Wi();ge.prototype.addKeyword=ca.add;ge.prototype.getKeyword=ca.get;ge.prototype.removeKeyword=ca.remove;ge.prototype.validateKeyword=ca.validate;var ao=ra();ge.ValidationError=ao.Validation;ge.MissingRefError=ao.MissingRef;ge.$dataMetaSchema=ro;var la="http://json-schema.org/draft-07/schema",Yi=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],jd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=to.copy(a)||{},af(this),this._schemas={},this._refs={},this._fragments={},this._formats=kd(a.format),this._cache=a.cache||new Td,this._loadingSchemas={},this._compilations=[],this.RULES=Ad(),this._getId=Bd(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Id),this._metaOpts=tf(this),a.formats&&ef(this),a.keywords&&rf(this),Yd(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Xd(this)}function Cd(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Nd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Fd(a,e,t,s){if(Array.isArray(a)){for(var r=0;rHl,DIRTY:()=>Ar,EMPTY_PATH:()=>El,INVALID:()=>H,NEVER:()=>$c,OK:()=>Oe,ParseStatus:()=>Se,Schema:()=>W,ZodAny:()=>Pr,ZodArray:()=>gr,ZodBigInt:()=>Cr,ZodBoolean:()=>Nr,ZodBranded:()=>_t,ZodCatch:()=>Qr,ZodDate:()=>Fr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>jt,ZodEffects:()=>Be,ZodEnum:()=>Zr,ZodError:()=>Ae,ZodFirstPartyTypeKind:()=>O,ZodFunction:()=>Nt,ZodIntersection:()=>zr,ZodIssueCode:()=>w,ZodLazy:()=>Ur,ZodLiteral:()=>Vr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>We,ZodNull:()=>Mr,ZodNullable:()=>or,ZodNumber:()=>jr,ZodObject:()=>je,ZodOptional:()=>Ze,ZodParsedType:()=>C,ZodPipeline:()=>xt,ZodPromise:()=>Er,ZodReadonly:()=>Jr,ZodRecord:()=>Ct,ZodSchema:()=>W,ZodSet:()=>ut,ZodString:()=>xr,ZodSymbol:()=>ot,ZodTransformer:()=>Be,ZodTuple:()=>ir,ZodType:()=>W,ZodUndefined:()=>Lr,ZodUnion:()=>qr,ZodUnknown:()=>vr,ZodVoid:()=>lt,addIssueToContext:()=>j,any:()=>ec,array:()=>sc,bigint:()=>Kl,boolean:()=>qs,coerce:()=>Dc,custom:()=>Fs,date:()=>Wl,datetimeRegex:()=>Cs,defaultErrorMap:()=>pr,discriminatedUnion:()=>lc,effect:()=>_c,enum:()=>gc,function:()=>pc,getErrorMap:()=>st,getParsedType:()=>nr,instanceof:()=>Ql,intersection:()=>cc,isAborted:()=>kt,isAsync:()=>nt,isDirty:()=>At,isValid:()=>_r,late:()=>Bl,lazy:()=>mc,literal:()=>vc,makeIssue:()=>bt,map:()=>fc,nan:()=>Jl,nativeEnum:()=>yc,never:()=>tc,null:()=>Xl,nullable:()=>Pc,number:()=>Ms,object:()=>nc,objectUtil:()=>Ea,oboolean:()=>Oc,onumber:()=>Rc,optional:()=>xc,ostring:()=>wc,pipeline:()=>Sc,preprocess:()=>Ec,promise:()=>bc,quotelessJson:()=>_l,record:()=>dc,set:()=>hc,setErrorMap:()=>Pl,strictObject:()=>ic,string:()=>Ls,symbol:()=>Gl,transformer:()=>_c,tuple:()=>uc,undefined:()=>Yl,union:()=>oc,unknown:()=>rc,util:()=>X,void:()=>ac});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let l of r)n[l]=l;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),l={};for(let o of n)l[o]=r[o];return a.objectValues(l)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&n.push(l);return n},a.find=(r,n)=>{for(let l of r)if(n(l))return l},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(l=>typeof l=="string"?`'${l}'`:l).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var Ea;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ea||(Ea={}));var C=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=a=>{switch(typeof a){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(a)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(a)?C.array:a===null?C.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?C.promise:typeof Map<"u"&&a instanceof Map?C.map:typeof Set<"u"&&a instanceof Set?C.set:typeof Date<"u"&&a instanceof Date?C.date:C.object;default:return C.unknown}};var w=X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),_l=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ae=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let l of n.issues)if(l.code==="invalid_union")l.unionErrors.map(r);else if(l.code==="invalid_return_type")r(l.returnTypeError);else if(l.code==="invalid_arguments")r(l.argumentsError);else if(l.path.length===0)s._errors.push(t(l));else{let o=s,d=0;for(;dt.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ae.create=a=>new Ae(a);var xl=(a,e)=>{let t;switch(a.code){case w.invalid_type:a.received===C.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case w.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case w.invalid_union:t="Invalid input";break;case w.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case w.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case w.invalid_arguments:t="Invalid function arguments";break;case w.invalid_return_type:t="Invalid function return type";break;case w.invalid_date:t="Invalid date";break;case w.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case w.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case w.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case w.custom:t="Invalid input";break;case w.invalid_intersection_types:t="Intersection results could not be merged";break;case w.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case w.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},pr=xl;var Ts=pr;function Pl(a){Ts=a}function st(){return Ts}var bt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],l={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",d=s.filter(f=>!!f).slice().reverse();for(let f of d)o=f(l,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},El=[];function j(a,e){let t=st(),s=bt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Se=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return H;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,l=await r.value;s.push({key:n,value:l})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:l}=r;if(n.status==="aborted"||l.status==="aborted")return H;n.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof l.value<"u"||r.alwaysSet)&&(s[n.value]=l.value)}return{status:e.value,value:s}}},H=Object.freeze({status:"aborted"}),Ar=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),kt=a=>a.status==="aborted",At=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=a=>typeof Promise<"u"&&a instanceof Promise;var U;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(U||(U={}));var He=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Is=(a,e)=>{if(_r(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ae(a.common.issues);return this._error=t,this._error}}};function J(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(l,o)=>{let{message:d}=a;return l.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:l.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:r}}var W=class{get description(){return this._def.description}_getType(e){return nr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Is(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>_r(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Is(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let l=e(r),o=()=>n.addIssue({code:w.custom,...s(r)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(o(),!1)):l?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Be({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Ze.create(this,this._def)}nullable(){return or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gr.create(this)}promise(){return Er.create(this,this._def)}or(e){return qr.create([this,e],this._def)}and(e){return zr.create(this,e,this._def)}transform(e){return new Be({...J(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...J(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new _t({typeName:O.ZodBranded,type:this,...J(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Qr({...J(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xt.create(this,e)}readonly(){return Jr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Sl=/^c[^\s-]{8,}$/i,wl=/^[0-9a-z]+$/,Rl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ol=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Dl=/^[a-z0-9_-]{21}$/i,$l=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Il=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Sa,Al=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Cl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Nl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,As="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ml=new RegExp(`^${As}$`);function js(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ql(a){return new RegExp(`^${js(a)}$`)}function Cs(a){let e=`${As}T${js(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zl(a,e){return!!((e==="v4"||!e)&&Al.test(a)||(e==="v6"||!e)&&Cl.test(a))}function Ul(a,e){if(!$l.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Vl(a,e){return!!((e==="v4"||!e)&&jl.test(a)||(e==="v6"||!e)&&Nl.test(a))}var xr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.string,received:n.parsedType}),H}let s=new Se,r;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let l=e.data.length>n.value,o=e.data.lengthe.test(r),{validation:t,code:w.invalid_string,...U.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...U.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...U.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...U.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...U.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...U.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...U.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...U.errToObj(t)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew xr({checks:[],typeName:O.ZodString,coerce:a?.coerce??!1,...J(a)});function Zl(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),l=Number.parseInt(e.toFixed(r).replace(".",""));return n%l/10**r}var jr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.number,received:n.parsedType}),H}let s,r=new Se;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:w.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Zl(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew jr({checks:[],typeName:O.ZodNumber,coerce:a?.coerce||!1,...J(a)});var Cr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let s,r=new Se;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:w.invalid_type,expected:C.bigint,received:t.parsedType}),H}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Cr({checks:[],typeName:O.ZodBigInt,coerce:a?.coerce??!1,...J(a)});var Nr=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.boolean,received:s.parsedType}),H}return Oe(e.data)}};Nr.create=a=>new Nr({typeName:O.ZodBoolean,coerce:a?.coerce||!1,...J(a)});var Fr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.date,received:n.parsedType}),H}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_date}),H}let s=new Se,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:w.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:U.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Fr({checks:[],coerce:a?.coerce||!1,typeName:O.ZodDate,...J(a)});var ot=class extends W{_parse(e){if(this._getType(e)!==C.symbol){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.symbol,received:s.parsedType}),H}return Oe(e.data)}};ot.create=a=>new ot({typeName:O.ZodSymbol,...J(a)});var Lr=class extends W{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.undefined,received:s.parsedType}),H}return Oe(e.data)}};Lr.create=a=>new Lr({typeName:O.ZodUndefined,...J(a)});var Mr=class extends W{_parse(e){if(this._getType(e)!==C.null){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.null,received:s.parsedType}),H}return Oe(e.data)}};Mr.create=a=>new Mr({typeName:O.ZodNull,...J(a)});var Pr=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};Pr.create=a=>new Pr({typeName:O.ZodAny,...J(a)});var vr=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};vr.create=a=>new vr({typeName:O.ZodUnknown,...J(a)});var We=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:w.invalid_type,expected:C.never,received:t.parsedType}),H}};We.create=a=>new We({typeName:O.ZodNever,...J(a)});var lt=class extends W{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.void,received:s.parsedType}),H}return Oe(e.data)}};lt.create=a=>new lt({typeName:O.ZodVoid,...J(a)});var gr=class a extends W{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==C.array)return j(t,{code:w.invalid_type,expected:C.array,received:t.parsedType}),H;if(r.exactLength!==null){let l=t.data.length>r.exactLength.value,o=t.data.lengthr.maxLength.value&&(j(t,{code:w.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((l,o)=>r.type._parseAsync(new He(t,l,t.path,o)))).then(l=>Se.mergeArray(s,l));let n=[...t.data].map((l,o)=>r.type._parseSync(new He(t,l,t.path,o)));return Se.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:U.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:U.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:U.toString(t)}})}nonempty(e){return this.min(1,e)}};gr.create=(a,e)=>new gr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...J(e)});function it(a){if(a instanceof je){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(it(s))}return new je({...a._def,shape:()=>e})}else return a instanceof gr?new gr({...a._def,type:it(a.element)}):a instanceof Ze?Ze.create(it(a.unwrap())):a instanceof or?or.create(it(a.unwrap())):a instanceof ir?ir.create(a.items.map(e=>it(e))):a}var je=class a extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let f=this._getOrReturnCtx(e);return j(f,{code:w.invalid_type,expected:C.object,received:f.parsedType}),H}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:l}=this._getCached(),o=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(let f in r.data)l.includes(f)||o.push(f);let d=[];for(let f of l){let h=n[f],m=r.data[f];d.push({key:{status:"valid",value:f},value:h._parse(new He(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof We){let f=this._def.unknownKeys;if(f==="passthrough")for(let h of o)d.push({key:{status:"valid",value:h},value:{status:"valid",value:r.data[h]}});else if(f==="strict")o.length>0&&(j(r,{code:w.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let h of o){let m=r.data[h];d.push({key:{status:"valid",value:h},value:f._parse(new He(r,m,r.path,h)),alwaysSet:h in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let h of d){let m=await h.key,_=await h.value;f.push({key:m,value:_,alwaysSet:h.alwaysSet})}return f}).then(f=>Se.mergeObjectSync(s,f)):Se.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:U.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return it(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Ns(X.objectKeys(this.shape))}};je.create=(a,e)=>new je({shape:()=>a,unknownKeys:"strip",catchall:We.create(),typeName:O.ZodObject,...J(e)});je.strictCreate=(a,e)=>new je({shape:()=>a,unknownKeys:"strict",catchall:We.create(),typeName:O.ZodObject,...J(e)});je.lazycreate=(a,e)=>new je({shape:a,unknownKeys:"strip",catchall:We.create(),typeName:O.ZodObject,...J(e)});var qr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let l=n.map(o=>new Ae(o.ctx.common.issues));return j(t,{code:w.invalid_union,unionErrors:l}),H}if(t.common.async)return Promise.all(s.map(async n=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(r);{let n,l=[];for(let d of s){let f={...t,common:{...t.common,issues:[]},parent:null},h=d._parseSync({data:t.data,path:t.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=l.map(d=>new Ae(d));return j(t,{code:w.invalid_union,unionErrors:o}),H}}get options(){return this._def.options}};qr.create=(a,e)=>new qr({options:a,typeName:O.ZodUnion,...J(e)});var mr=a=>a instanceof Ur?mr(a.schema):a instanceof Be?mr(a.innerType()):a instanceof Vr?[a.value]:a instanceof Zr?a.options:a instanceof Hr?X.objectValues(a.enum):a instanceof Br?mr(a._def.innerType):a instanceof Lr?[void 0]:a instanceof Mr?[null]:a instanceof Ze?[void 0,...mr(a.unwrap())]:a instanceof or?[null,...mr(a.unwrap())]:a instanceof _t||a instanceof Jr?mr(a.unwrap()):a instanceof Qr?mr(a._def.innerType):[],jt=class a extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return j(t,{code:w.invalid_type,expected:C.object,received:t.parsedType}),H;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(j(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),H)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let l=mr(n.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of l){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...J(s)})}};function wa(a,e){let t=nr(a),s=nr(e);if(a===e)return{valid:!0,data:a};if(t===C.object&&s===C.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(o=>r.indexOf(o)!==-1),l={...a,...e};for(let o of n){let d=wa(a[o],e[o]);if(!d.valid)return{valid:!1};l[o]=d.data}return{valid:!0,data:l}}else if(t===C.array&&s===C.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n{if(kt(n)||kt(l))return H;let o=wa(n.value,l.value);return o.valid?((At(n)||At(l))&&t.dirty(),{status:t.value,value:o.data}):(j(s,{code:w.invalid_intersection_types}),H)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,l])=>r(n,l)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};zr.create=(a,e,t)=>new zr({left:a,right:e,typeName:O.ZodIntersection,...J(t)});var ir=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.array)return j(s,{code:w.invalid_type,expected:C.array,received:s.parsedType}),H;if(s.data.lengththis._def.items.length&&(j(s,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((l,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new He(s,l,s.path,o)):null}).filter(l=>!!l);return s.common.async?Promise.all(n).then(l=>Se.mergeArray(t,l)):Se.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};ir.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ir({items:a,typeName:O.ZodTuple,rest:null,...J(e)})};var Ct=class a extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.object)return j(s,{code:w.invalid_type,expected:C.object,received:s.parsedType}),H;let r=[],n=this._def.keyType,l=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new He(s,o,s.path,o)),value:l._parse(new He(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Se.mergeObjectAsync(t,r):Se.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof W?new a({keyType:e,valueType:t,typeName:O.ZodRecord,...J(s)}):new a({keyType:xr.create(),valueType:e,typeName:O.ZodRecord,...J(t)})}},ct=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.map)return j(s,{code:w.invalid_type,expected:C.map,received:s.parsedType}),H;let r=this._def.keyType,n=this._def.valueType,l=[...s.data.entries()].map(([o,d],f)=>({key:r._parse(new He(s,o,s.path,[f,"key"])),value:n._parse(new He(s,d,s.path,[f,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of l){let f=await d.key,h=await d.value;if(f.status==="aborted"||h.status==="aborted")return H;(f.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(f.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of l){let f=d.key,h=d.value;if(f.status==="aborted"||h.status==="aborted")return H;(f.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(f.value,h.value)}return{status:t.value,value:o}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:O.ZodMap,...J(t)});var ut=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.set)return j(s,{code:w.invalid_type,expected:C.set,received:s.parsedType}),H;let r=this._def;r.minSize!==null&&s.data.sizer.maxSize.value&&(j(s,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function l(d){let f=new Set;for(let h of d){if(h.status==="aborted")return H;h.status==="dirty"&&t.dirty(),f.add(h.value)}return{status:t.value,value:f}}let o=[...s.data.values()].map((d,f)=>n._parse(new He(s,d,s.path,f)));return s.common.async?Promise.all(o).then(d=>l(d)):l(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:U.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:U.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:O.ZodSet,...J(e)});var Nt=class a extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return j(t,{code:w.invalid_type,expected:C.function,received:t.parsedType}),H;function s(o,d){return bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(f=>!!f),issueData:{code:w.invalid_arguments,argumentsError:d}})}function r(o,d){return bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(f=>!!f),issueData:{code:w.invalid_return_type,returnTypeError:d}})}let n={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Er){let o=this;return Oe(async function(...d){let f=new Ae([]),h=await o._def.args.parseAsync(d,n).catch(c=>{throw f.addIssue(s(d,c)),f}),m=await Reflect.apply(l,this,h);return await o._def.returns._def.type.parseAsync(m,n).catch(c=>{throw f.addIssue(r(m,c)),f})})}else{let o=this;return Oe(function(...d){let f=o._def.args.safeParse(d,n);if(!f.success)throw new Ae([s(d,f.error)]);let h=Reflect.apply(l,this,f.data),m=o._def.returns.safeParse(h,n);if(!m.success)throw new Ae([r(h,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:ir.create(e).rest(vr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||ir.create([]).rest(vr.create()),returns:t||vr.create(),typeName:O.ZodFunction,...J(s)})}},Ur=class extends W{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:O.ZodLazy,...J(e)});var Vr=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vr.create=(a,e)=>new Vr({value:a,typeName:O.ZodLiteral,...J(e)});function Ns(a,e){return new Zr({values:a,typeName:O.ZodEnum,...J(e)})}var Zr=class a extends W{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{expected:X.joinValues(s),received:t.parsedType,code:w.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{received:t.data,code:w.invalid_enum_value,options:s}),H}return Oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Zr.create=Ns;var Hr=class extends W{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==C.string&&s.parsedType!==C.number){let r=X.objectValues(t);return j(s,{expected:X.joinValues(r),received:s.parsedType,code:w.invalid_type}),H}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return j(s,{received:s.data,code:w.invalid_enum_value,options:r}),H}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:O.ZodNativeEnum,...J(e)});var Er=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return j(t,{code:w.invalid_type,expected:C.promise,received:t.parsedType}),H;let s=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Er.create=(a,e)=>new Er({type:a,typeName:O.ZodPromise,...J(e)});var Be=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:l=>{j(s,l),l.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let l=r.transform(s.data,n);if(s.common.async)return Promise.resolve(l).then(async o=>{if(t.value==="aborted")return H;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?H:d.status==="dirty"?Ar(d.value):t.value==="dirty"?Ar(d.value):d});{if(t.value==="aborted")return H;let o=this._def.schema._parseSync({data:l,path:s.path,parent:s});return o.status==="aborted"?H:o.status==="dirty"?Ar(o.value):t.value==="dirty"?Ar(o.value):o}}if(r.type==="refinement"){let l=o=>{let d=r.refinement(o,n);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?H:(o.status==="dirty"&&t.dirty(),l(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?H:(o.status==="dirty"&&t.dirty(),l(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(l))return H;let o=r.transform(l.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>_r(l)?Promise.resolve(r.transform(l.value,n)).then(o=>({status:t.value,value:o})):H);X.assertNever(r)}};Be.create=(a,e,t)=>new Be({schema:a,typeName:O.ZodEffects,effect:e,...J(t)});Be.createWithPreprocess=(a,e,t)=>new Be({schema:e,effect:{type:"preprocess",transform:a},typeName:O.ZodEffects,...J(t)});var Ze=class extends W{_parse(e){return this._getType(e)===C.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:O.ZodOptional,...J(e)});var or=class extends W{_parse(e){return this._getType(e)===C.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:O.ZodNullable,...J(e)});var Br=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===C.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(a,e)=>new Br({innerType:a,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...J(e)});var Qr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ae(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ae(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Qr.create=(a,e)=>new Qr({innerType:a,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...J(e)});var dt=class extends W{_parse(e){if(this._getType(e)!==C.nan){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.nan,received:s.parsedType}),H}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:O.ZodNaN,...J(a)});var Hl=Symbol("zod_brand"),_t=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},xt=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?H:n.status==="dirty"?(t.dirty(),Ar(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?H:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:O.ZodPipeline})}},Jr=class extends W{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Jr.create=(a,e)=>new Jr({innerType:a,typeName:O.ZodReadonly,...J(e)});function ks(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Fs(a,e={},t){return a?Pr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(l=>{if(!l){let o=ks(e,s),d=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:d})}});if(!n){let l=ks(e,s),o=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:o})}}):Pr.create()}var Bl={object:je.lazycreate},O;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(O||(O={}));var Ql=(a,e={message:`Input not instance of ${a.name}`})=>Fs(t=>t instanceof a,e),Ls=xr.create,Ms=jr.create,Jl=dt.create,Kl=Cr.create,qs=Nr.create,Wl=Fr.create,Gl=ot.create,Yl=Lr.create,Xl=Mr.create,ec=Pr.create,rc=vr.create,tc=We.create,ac=lt.create,sc=gr.create,nc=je.create,ic=je.strictCreate,oc=qr.create,lc=jt.create,cc=zr.create,uc=ir.create,dc=Ct.create,fc=ct.create,hc=ut.create,pc=Nt.create,mc=Ur.create,vc=Vr.create,gc=Zr.create,yc=Hr.create,bc=Er.create,_c=Be.create,xc=Ze.create,Pc=or.create,Ec=Be.createWithPreprocess,Sc=xt.create,wc=()=>Ls().optional(),Rc=()=>Ms().optional(),Oc=()=>qs().optional(),Dc={string:(a=>xr.create({...a,coerce:!0})),number:(a=>jr.create({...a,coerce:!0})),boolean:(a=>Nr.create({...a,coerce:!0})),bigint:(a=>Cr.create({...a,coerce:!0})),date:(a=>Fr.create({...a,coerce:!0}))};var $c=H;var Ra="2025-06-18";var zs=[Ra,"2025-03-26","2024-11-05","2024-10-07"],Ft="2.0",Us=i.union([i.string(),i.number().int()]),Vs=i.string(),Tc=i.object({progressToken:i.optional(Us)}).passthrough(),Qe=i.object({_meta:i.optional(Tc)}).passthrough(),Ce=i.object({method:i.string(),params:i.optional(Qe)}),Pt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),lr=i.object({method:i.string(),params:i.optional(Pt)}),Je=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),Lt=i.union([i.string(),i.number().int()]),Zs=i.object({jsonrpc:i.literal(Ft),id:Lt}).merge(Ce).strict(),Hs=a=>Zs.safeParse(a).success,Bs=i.object({jsonrpc:i.literal(Ft)}).merge(lr).strict(),Qs=a=>Bs.safeParse(a).success,Js=i.object({jsonrpc:i.literal(Ft),id:Lt,result:Je}).strict(),Oa=a=>Js.safeParse(a).success,Ge;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ge||(Ge={}));var Ks=i.object({jsonrpc:i.literal(Ft),id:Lt,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),Ws=a=>Ks.safeParse(a).success,Gs=i.union([Zs,Bs,Js,Ks]),Mt=Je.strict(),qt=lr.extend({method:i.literal("notifications/cancelled"),params:Pt.extend({requestId:Lt,reason:i.string().optional()})}),Ic=i.object({src:i.string(),mimeType:i.optional(i.string()),sizes:i.optional(i.array(i.string()))}).passthrough(),Et=i.object({icons:i.array(Ic).optional()}).passthrough(),St=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),Ys=St.extend({version:i.string(),websiteUrl:i.optional(i.string())}).merge(Et),kc=i.object({experimental:i.optional(i.object({}).passthrough()),sampling:i.optional(i.object({}).passthrough()),elicitation:i.optional(i.object({}).passthrough()),roots:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),Da=Ce.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:kc,clientInfo:Ys})});var Ac=i.object({experimental:i.optional(i.object({}).passthrough()),logging:i.optional(i.object({}).passthrough()),completions:i.optional(i.object({}).passthrough()),prompts:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough()),resources:i.optional(i.object({subscribe:i.optional(i.boolean()),listChanged:i.optional(i.boolean())}).passthrough()),tools:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),jc=Je.extend({protocolVersion:i.string(),capabilities:Ac,serverInfo:Ys,instructions:i.optional(i.string())}),$a=lr.extend({method:i.literal("notifications/initialized")});var zt=Ce.extend({method:i.literal("ping")}),Cc=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),Ut=lr.extend({method:i.literal("notifications/progress"),params:Pt.merge(Cc).extend({progressToken:Us})}),Vt=Ce.extend({params:Qe.extend({cursor:i.optional(Vs)}).optional()}),Zt=Je.extend({nextCursor:i.optional(Vs)}),Xs=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),en=Xs.extend({text:i.string()}),Ta=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),rn=Xs.extend({blob:Ta}),tn=St.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Nc=St.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Fc=Vt.extend({method:i.literal("resources/list")}),Lc=Zt.extend({resources:i.array(tn)}),Mc=Vt.extend({method:i.literal("resources/templates/list")}),qc=Zt.extend({resourceTemplates:i.array(Nc)}),zc=Ce.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),Uc=Je.extend({contents:i.array(i.union([en,rn]))}),Vc=lr.extend({method:i.literal("notifications/resources/list_changed")}),Zc=Ce.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),Hc=Ce.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),Bc=lr.extend({method:i.literal("notifications/resources/updated"),params:Pt.extend({uri:i.string()})}),Qc=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),Jc=St.extend({description:i.optional(i.string()),arguments:i.optional(i.array(Qc)),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Kc=Vt.extend({method:i.literal("prompts/list")}),Wc=Zt.extend({prompts:i.array(Jc)}),Gc=Ce.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),Ia=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),ka=i.object({type:i.literal("image"),data:Ta,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Aa=i.object({type:i.literal("audio"),data:Ta,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Yc=i.object({type:i.literal("resource"),resource:i.union([en,rn]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Xc=tn.extend({type:i.literal("resource_link")}),an=i.union([Ia,ka,Aa,Xc,Yc]),eu=i.object({role:i.enum(["user","assistant"]),content:an}).passthrough(),ru=Je.extend({description:i.optional(i.string()),messages:i.array(eu)}),tu=lr.extend({method:i.literal("notifications/prompts/list_changed")}),au=i.object({title:i.optional(i.string()),readOnlyHint:i.optional(i.boolean()),destructiveHint:i.optional(i.boolean()),idempotentHint:i.optional(i.boolean()),openWorldHint:i.optional(i.boolean())}).passthrough(),su=St.extend({description:i.optional(i.string()),inputSchema:i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough(),outputSchema:i.optional(i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough()),annotations:i.optional(au),_meta:i.optional(i.object({}).passthrough())}).merge(Et),ja=Vt.extend({method:i.literal("tools/list")}),nu=Zt.extend({tools:i.array(su)}),sn=Je.extend({content:i.array(an).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),eh=sn.or(Je.extend({toolResult:i.unknown()})),Ca=Ce.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),iu=lr.extend({method:i.literal("notifications/tools/list_changed")}),wt=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Na=Ce.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:wt})}),ou=lr.extend({method:i.literal("notifications/message"),params:Pt.extend({level:wt,logger:i.optional(i.string()),data:i.unknown()})}),lu=i.object({name:i.string().optional()}).passthrough(),cu=i.object({hints:i.optional(i.array(lu)),costPriority:i.optional(i.number().min(0).max(1)),speedPriority:i.optional(i.number().min(0).max(1)),intelligencePriority:i.optional(i.number().min(0).max(1))}).passthrough(),uu=i.object({role:i.enum(["user","assistant"]),content:i.union([Ia,ka,Aa])}).passthrough(),du=Ce.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(uu),systemPrompt:i.optional(i.string()),includeContext:i.optional(i.enum(["none","thisServer","allServers"])),temperature:i.optional(i.number()),maxTokens:i.number().int(),stopSequences:i.optional(i.array(i.string())),metadata:i.optional(i.object({}).passthrough()),modelPreferences:i.optional(cu)})}),Fa=Je.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[Ia,ka,Aa])}),fu=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),hu=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),minLength:i.optional(i.number()),maxLength:i.optional(i.number()),format:i.optional(i.enum(["email","uri","date","date-time"]))}).passthrough(),pu=i.object({type:i.enum(["number","integer"]),title:i.optional(i.string()),description:i.optional(i.string()),minimum:i.optional(i.number()),maximum:i.optional(i.number())}).passthrough(),mu=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),enum:i.array(i.string()),enumNames:i.optional(i.array(i.string()))}).passthrough(),vu=i.union([fu,hu,pu,mu]),gu=Ce.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),vu),required:i.optional(i.array(i.string()))}).passthrough()})}),La=Je.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),yu=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var bu=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),_u=Ce.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([bu,yu]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),xu=Je.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),Pu=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Eu=Ce.extend({method:i.literal("roots/list")}),Ma=Je.extend({roots:i.array(Pu)}),Su=lr.extend({method:i.literal("notifications/roots/list_changed")}),rh=i.union([zt,Da,_u,Na,Gc,Kc,Fc,Mc,zc,Zc,Hc,Ca,ja]),th=i.union([qt,Ut,$a,Su]),ah=i.union([Mt,Fa,La,Ma]),sh=i.union([zt,du,gu,Eu]),nh=i.union([qt,Ut,ou,Bc,Vc,iu,tu]),ih=i.union([Mt,jc,xu,ru,Wc,Lc,qc,Uc,sn,nu]),Ye=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var wu=6e4,Ht=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(qt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Ut,t=>{this._onprogress(t)}),this.setRequestHandler(zt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ye(Ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let l=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(d,f)=>{o?.(d,f),Oa(d)||Ws(d)?this._onresponse(d):Hs(d)?this._onrequest(d,f):Qs(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Ye(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,l=this._transport;if(n===void 0){l?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let d={signal:o.signal,sessionId:l?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,h,m)=>this.request(f,h,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,d)).then(f=>{if(!o.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var h;if(!o.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Ge.InternalError,message:(h=f.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let l=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&l&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){l(d);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Oa(e))s(e);else{let r=new Ye(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}=s??{};return new Promise((o,d)=>{var f,h,m,_,c,y;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(h=s?.signal)===null||h===void 0||h.throwIfAborted();let b=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:b};s?.onprogress&&(this._progressHandlers.set(b,s.onprogress),g.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:b}});let E=R=>{var T;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(T=this._transport)===null||T===void 0||T.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(R)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(R)};this._responseHandlers.set(b,R=>{var T;if(!(!((T=s?.signal)===null||T===void 0)&&T.aborted)){if(R instanceof Error)return d(R);try{let I=t.parse(R.result);o(I)}catch(I){d(I)}}}),(_=s?.signal)===null||_===void 0||_.addEventListener("abort",()=>{var R;E((R=s?.signal)===null||R===void 0?void 0:R.reason)});let $=(c=s?.timeout)!==null&&c!==void 0?c:wu,S=()=>E(new Ye(Ge.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(b,$,s?.maxTotalTimeout,S,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(g,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(R=>{this._cleanupTimeout(b),d(R)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,t).catch(h=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function nn(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var lo=$s(oo(),1),ua=class extends Ht{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(wt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let l=this._loggingLevels.get(n);return l?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler($a,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Na,async(r,n)=>{var l;let o=n.sessionId||((l=n.requestInfo)===null||l===void 0?void 0:l.headers["mcp-session-id"])||void 0,{level:d}=r.params,f=wt.safeParse(d);return f.success&&this._loggingLevels.set(o,f.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=nn(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:zs.includes(t)?t:Ra,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Mt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Fa,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},La,t);if(s.action==="accept"&&s.content)try{let r=new lo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ye(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ye?r:new Ye(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ma,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var us=$s(require("node:process"),1);var da=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
+"use strict";var pl=Object.create;var Pa=Object.defineProperty;var hl=Object.getOwnPropertyDescriptor;var ml=Object.getOwnPropertyNames;var vl=Object.getPrototypeOf,gl=Object.prototype.hasOwnProperty;var Q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),yl=(a,e)=>{for(var t in e)Pa(a,t,{get:e[t],enumerable:!0})},bl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ml(e))!gl.call(a,r)&&r!==t&&Pa(a,r,{get:()=>e[r],enumerable:!(s=hl(e,r))||s.enumerable});return a};var $s=(a,e,t)=>(t=a!=null?pl(vl(a)):{},bl(e||!a||!a.__esModule?Pa(t,"default",{value:a,enumerable:!0}):t,a));var ln=Q((Bt,on)=>{(function(a,e){typeof Bt=="object"&&typeof on<"u"?e(Bt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Bt,(function(a){"use strict";function e(){for(var h=arguments.length,u=Array(h),v=0;v1){u[0]=u[0].slice(0,-1);for(var x=u.length-1,P=1;P= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-y,z=Math.floor,M=String.fromCharCode;function F(h){throw new RangeError(q[h])}function D(h,u){for(var v=[],x=h.length;x--;)v[x]=u(h[x]);return v}function A(h,u){var v=h.split("@"),x="";v.length>1&&(x=v[0]+"@",h=v[1]),h=h.replace(V,".");var P=h.split("."),N=D(P,u).join(".");return x+N}function L(h){for(var u=[],v=0,x=h.length;v=55296&&P<=56319&&v>1,u+=z(u/v);u>k*b>>1;P+=c)u=z(u/k);return z(P+(k+1)*u/(u+g))},Z=function(u){var v=[],x=u.length,P=0,N=S,K=$,ae=u.lastIndexOf(R);ae<0&&(ae=0);for(var oe=0;oe=128&&F("not-basic"),v.push(u.charCodeAt(oe));for(var _e=ae>0?ae+1:0;_e=x&&F("invalid-input");var de=Y(u.charCodeAt(_e++));(de>=c||de>z((_-P)/pe))&&F("overflow"),P+=de*pe;var ne=xe<=K?y:xe>=K+b?b:xe-K;if(dez(_/he)&&F("overflow"),pe*=he}var ce=v.length+1;K=G(P-te,ce,te==0),z(P/ce)>_-N&&F("overflow"),N+=z(P/ce),P%=ce,v.splice(P++,0,N)}return String.fromCodePoint.apply(String,v)},me=function(u){var v=[];u=L(u);var x=u.length,P=S,N=0,K=$,ae=!0,oe=!1,_e=void 0;try{for(var te=u[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var xe=pe.value;xe<128&&v.push(M(xe))}}catch(kr){oe=!0,_e=kr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw _e}}var de=v.length,ne=de;for(de&&v.push(R);ne=P&&qez((_-N)/Ve)&&F("overflow"),N+=(he-P)*Ve,P=he;var sr=!0,Ir=!1,dr=void 0;try{for(var ht=u[Symbol.iterator](),$t;!(sr=($t=ht.next()).done);sr=!0){var Tt=$t.value;if(Tt_&&F("overflow"),Tt==P){for(var Yr=N,Xr=c;;Xr+=c){var fr=Xr<=K?y:Xr>=K+b?b:Xr-K;if(Yr>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase():v="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase(),v}function $e(h){for(var u="",v=0,x=h.length;v=194&&P<224){if(x-v>=6){var N=parseInt(h.substr(v+4,2),16);u+=String.fromCharCode((P&31)<<6|N&63)}else u+=h.substr(v,6);v+=6}else if(P>=224){if(x-v>=9){var K=parseInt(h.substr(v+4,2),16),ae=parseInt(h.substr(v+7,2),16);u+=String.fromCharCode((P&15)<<12|(K&63)<<6|ae&63)}else u+=h.substr(v,9);v+=9}else u+=h.substr(v,3),v+=3}return u}function yr(h,u){function v(x){var P=$e(x);return P.match(u.UNRESERVED)?P:x}return h.scheme&&(h.scheme=String(h.scheme).replace(u.PCT_ENCODED,v).toLowerCase().replace(u.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(u.PCT_ENCODED,v).replace(u.NOT_USERINFO,Pe).replace(u.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(u.PCT_ENCODED,v).toLowerCase().replace(u.NOT_HOST,Pe).replace(u.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(u.PCT_ENCODED,v).replace(h.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,Pe).replace(u.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(u.PCT_ENCODED,v).replace(u.NOT_QUERY,Pe).replace(u.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(u.PCT_ENCODED,v).replace(u.NOT_FRAGMENT,Pe).replace(u.PCT_ENCODED,r)),h}function cr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function be(h,u){var v=h.match(u.IPV4ADDRESS)||[],x=p(v,2),P=x[1];return P?P.split(".").map(cr).join("."):h}function ve(h,u){var v=h.match(u.IPV6ADDRESS)||[],x=p(v,3),P=x[1],N=x[2];if(P){for(var K=P.toLowerCase().split("::").reverse(),ae=p(K,2),oe=ae[0],_e=ae[1],te=_e?_e.split(":").map(cr):[],pe=oe.split(":").map(cr),xe=u.IPV4ADDRESS.test(pe[pe.length-1]),de=xe?7:8,ne=pe.length-de,he=Array(de),ce=0;ce1){var ue=he.slice(0,Me.index),qe=he.slice(Me.index+Me.length);Ue=ue.join(":")+"::"+qe.join(":")}else Ue=he.join(":");return N&&(Ue+="%"+N),Ue}else return h}var Or=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Re="".match(/(){0}/)[1]===void 0;function ie(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},x=u.iri!==!1?f:d;u.reference==="suffix"&&(h=(u.scheme?u.scheme+":":"")+"//"+h);var P=h.match(Or);if(P){Re?(v.scheme=P[1],v.userinfo=P[3],v.host=P[4],v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=P[7],v.fragment=P[8],isNaN(v.port)&&(v.port=P[5])):(v.scheme=P[1]||void 0,v.userinfo=h.indexOf("@")!==-1?P[3]:void 0,v.host=h.indexOf("//")!==-1?P[4]:void 0,v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=h.indexOf("?")!==-1?P[7]:void 0,v.fragment=h.indexOf("#")!==-1?P[8]:void 0,isNaN(v.port)&&(v.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),v.host&&(v.host=ve(be(v.host,x),x)),v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0?v.reference="same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",u.reference&&u.reference!=="suffix"&&u.reference!==v.reference&&(v.error=v.error||"URI is not a "+u.reference+" reference.");var N=ye[(u.scheme||v.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!N||!N.unicodeSupport)){if(v.host&&(u.domainHost||N&&N.domainHost))try{v.host=se.toASCII(v.host.replace(x.PCT_ENCODED,$e).toLowerCase())}catch(K){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+K}yr(v,d)}else yr(v,x);N&&N.parse&&N.parse(v,u)}else v.error=v.error||"URI can not be parsed.";return v}function br(h,u){var v=u.iri!==!1?f:d,x=[];return h.userinfo!==void 0&&(x.push(h.userinfo),x.push("@")),h.host!==void 0&&x.push(ve(be(String(h.host),v),v).replace(v.IPV6ADDRESS,function(P,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(x.push(":"),x.push(String(h.port))),x.length?x.join(""):void 0}var ur=/^\.\.?\//,Dr=/^\/\.(\/|$)/,$r=/^\/\.\.(\/|$)/,Ee=/^\/?(?:.|\n)*?(?=\/|$)/;function ze(h){for(var u=[];h.length;)if(h.match(ur))h=h.replace(ur,"");else if(h.match(Dr))h=h.replace(Dr,"/");else if(h.match($r))h=h.replace($r,"/"),u.pop();else if(h==="."||h==="..")h="";else{var v=h.match(Ee);if(v){var x=v[0];h=h.slice(x.length),u.push(x)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function ke(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=u.iri?f:d,x=[],P=ye[(u.scheme||h.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(h,u),h.host&&!v.IPV6ADDRESS.test(h.host)){if(u.domainHost||P&&P.domainHost)try{h.host=u.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(v.PCT_ENCODED,$e).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(u.iri?"Unicode":"ASCII")+" via punycode: "+ae}}yr(h,v),u.reference!=="suffix"&&h.scheme&&(x.push(h.scheme),x.push(":"));var N=br(h,u);if(N!==void 0&&(u.reference!=="suffix"&&x.push("//"),x.push(N),h.path&&h.path.charAt(0)!=="/"&&x.push("/")),h.path!==void 0){var K=h.path;!u.absolutePath&&(!P||!P.absolutePath)&&(K=ze(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),x.push(K)}return h.query!==void 0&&(x.push("?"),x.push(h.query)),h.fragment!==void 0&&(x.push("#"),x.push(h.fragment)),x.join("")}function Te(h,u){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],P={};return x||(h=ie(ke(h,v),v),u=ie(ke(u,v),v)),v=v||{},!v.tolerant&&u.scheme?(P.scheme=u.scheme,P.userinfo=u.userinfo,P.host=u.host,P.port=u.port,P.path=ze(u.path||""),P.query=u.query):(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0?(P.userinfo=u.userinfo,P.host=u.host,P.port=u.port,P.path=ze(u.path||""),P.query=u.query):(u.path?(u.path.charAt(0)==="/"?P.path=ze(u.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?P.path="/"+u.path:h.path?P.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+u.path:P.path=u.path,P.path=ze(P.path)),P.query=u.query):(P.path=h.path,u.query!==void 0?P.query=u.query:P.query=h.query),P.userinfo=h.userinfo,P.host=h.host,P.port=h.port),P.scheme=h.scheme),P.fragment=u.fragment,P}function tr(h,u,v){var x=l({scheme:"null"},v);return ke(Te(ie(h,x),ie(u,x),x,!0),x)}function Le(h,u){return typeof h=="string"?h=ke(ie(h,u),u):s(h)==="object"&&(h=ie(ke(h,u),u)),h}function Dt(h,u,v){return typeof h=="string"?h=ke(ie(h,v),v):s(h)==="object"&&(h=ke(h,v)),typeof u=="string"?u=ke(ie(u,v),v):s(u)==="object"&&(u=ke(u,v)),h===u}function ya(h,u){return h&&h.toString().replace(!u||!u.iri?d.ESCAPE:f.ESCAPE,Pe)}function Ke(h,u){return h&&h.toString().replace(!u||!u.iri?d.PCT_ENCODED:f.PCT_ENCODED,$e)}var ft={scheme:"http",domainHost:!0,parse:function(u,v){return u.host||(u.error=u.error||"HTTP URIs must have a host."),u},serialize:function(u,v){var x=String(u.scheme).toLowerCase()==="https";return(u.port===(x?443:80)||u.port==="")&&(u.port=void 0),u.path||(u.path="/"),u}},gs={scheme:"https",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize};function ys(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var pt={scheme:"ws",domainHost:!0,parse:function(u,v){var x=u;return x.secure=ys(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(u,v){if((u.port===(ys(u)?443:80)||u.port==="")&&(u.port=void 0),typeof u.secure=="boolean"&&(u.scheme=u.secure?"wss":"ws",u.secure=void 0),u.resourceName){var x=u.resourceName.split("?"),P=p(x,2),N=P[0],K=P[1];u.path=N&&N!=="/"?N:void 0,u.query=K,u.resourceName=void 0}return u.fragment=void 0,u}},bs={scheme:"wss",domainHost:pt.domainHost,parse:pt.parse,serialize:pt.serialize},Jo={},Ko=!0,_s="[A-Za-z0-9\\-\\.\\_\\~"+(Ko?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",Wo=t(t("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+t("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+t("%"+ar+ar)),Go="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Yo="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Xo=e(Yo,'[\\"\\\\]'),el="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",rl=new RegExp(_s,"g"),Gr=new RegExp(Wo,"g"),tl=new RegExp(e("[^]",Go,"[\\.]",'[\\"]',Xo),"g"),xs=new RegExp(e("[^]",_s,el),"g"),al=xs;function ba(h){var u=$e(h);return u.match(rl)?u:h}var Ps={scheme:"mailto",parse:function(u,v){var x=u,P=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var N=!1,K={},ae=x.query.split("&"),oe=0,_e=ae.length;oe<_e;++oe){var te=ae[oe].split("=");switch(te[0]){case"to":for(var pe=te[1].split(","),xe=0,de=pe.length;xe{"use strict";cn.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var l=n[r];if(!a(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}});var dn=Q((dp,un)=>{"use strict";un.exports=function(e){for(var t=0,s=e.length,r=0,n;r=55296&&n<=56319&&r{"use strict";hn.exports={copy:Ru,checkDataType:qa,checkDataTypes:Ou,coerceToTypes:Du,toHash:Ua,getProperty:Va,escapeQuotes:Za,equal:Qt(),ucs2length:dn(),varOccurences:Iu,varReplace:ku,schemaHasRules:Au,schemaHasRulesExcept:ju,schemaUnknownRules:Cu,toQuotedString:za,getPathExpr:Nu,getPath:Fu,getData:qu,unescapeFragment:zu,unescapeJsonPointer:Ba,escapeFragment:Uu,escapeJsonPointer:Ha};function Ru(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function qa(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",l=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return l+"Array.isArray("+e+")";case"object":return"("+l+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(t?n+l+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+l+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Ou(a,e,t){switch(a.length){case 1:return qa(a[0],e,t,!0);default:var s="",r=Ua(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+qa(n,e,t,!0);return s}}var fn=Ua(["string","number","integer","boolean","null"]);function Du(a,e){if(Array.isArray(e)){for(var t=[],s=0;s=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var o=n,d=r.split("/"),f=0;f{"use strict";var Vu=Kr();mn.exports=Zu;function Zu(a){Vu.copy(a,this)}});var gn=Q((hp,vn)=>{"use strict";var Sr=vn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Jt(e,s,r,a,"",a)};Sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Sr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Sr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Jt(a,e,t,s,r,n,l,o,d,f){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,l,o,d,f);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in Sr.arrayKeywords)for(var _=0;_{"use strict";var Rt=ln(),yn=Qt(),Yt=Kr(),Kt=Qa(),Bu=gn();xn.exports=Rr;Rr.normalizeId=wr;Rr.fullPath=Wt;Rr.url=Gt;Rr.ids=Gu;Rr.inlineRef=Ja;Rr.schema=Xt;function Rr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Rr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Kt)return Ja(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Xt.call(this,e,t),n,l,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Kt?l=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(l=Ja(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),l}function Xt(a,e){var t=Rt.parse(e),s=_n(t),r=Wt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=wr(s),l=this._refs[n];if(typeof l=="string")return Qu.call(this,a,l,t);if(l instanceof Kt)l.validate||this._compile(l),a=l;else if(l=this._schemas[n],l instanceof Kt){if(l.validate||this._compile(l),n==wr(e))return{schema:l,root:a,baseId:r};a=l}else return;if(!a.schema)return;r=Wt(this._getId(a.schema))}return bn.call(this,t,r,a.schema,a)}function Qu(a,e,t){var s=Xt.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var l=this._getId(r);return l&&(n=Gt(n,l)),bn.call(this,t,n,r,a)}}var Ju=Yt.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function bn(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n{"use strict";var Ga=ea();En.exports={Validation:Pn(Yu),MissingRef:Pn(Ya)};function Yu(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Ya.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Ya(a,e,t){this.message=t||Ya.message(a,e),this.missingRef=Ga.url(a,e),this.missingSchema=Ga.normalizeId(Ga.fullPath(this.missingRef))}function Pn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Xa=Q((gp,Sn)=>{"use strict";Sn.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&(function(n){return function(l){return function(o,d){var f={key:o,value:l[o]},p={key:d,value:l[d]};return n(f,p)}}})(e.cmp),r=[];return(function n(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var o,d;if(Array.isArray(l)){for(d="[",o=0;o{"use strict";wn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,_=e.schema[t],c=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,T=!e.opts.allErrors,q,b="data"+(m||""),R="valid"+p;if(e.schema===!1){e.isTop?T=!0:r+=" var "+R+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&T?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+R+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,p=e.level=0,m=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var S="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=e.level,m=e.dataLevel,b="data"+(m||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+p+" = errors;"}var R="valid"+p,T=!e.opts.allErrors,I="",V="",q,k=e.schema.type,z=Array.isArray(k);if(k&&e.opts.nullable&&e.schema.nullable===!0&&(z?k.indexOf("null")==-1&&(k=k.concat("null")):k!="null"&&(k=[k,"null"],z=!0)),z&&k.length==1&&(k=k[0],z=!1),e.schema.$ref&&l){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(l=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),k){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,k);var F=e.RULES.types[k];if(M||z||F===!0||F&&!Ee(F)){var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",c=e.schemaPath+".type",y=e.errSchemaPath+"/type",D=z?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[D](k,b,e.opts.strictNumbers,!0)+") { ",M){var A="dataType"+p,L="coerced"+p;r+=" var "+A+" = typeof "+b+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+A+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+A+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+L+" = "+b+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,G=le.length-1;re{"use strict";var ta=ea(),sa=Kr(),On=ra(),Xu=Xa(),Rn=es(),ed=sa.ucs2length,rd=Qt(),td=On.Validation;$n.exports=rs;function rs(a,e,t,s){var r=this,n=this._opts,l=[void 0],o={},d=[],f={},p=[],m={},_=[];e=e||{schema:a,refVal:l,refs:o};var c=ad.call(this,a,e,s),y=this._compilations[c.index];if(c.compiling)return y.callValidate=S;var b=this._formats,g=this.RULES;try{var E=R(a,e,t,s);y.validate=E;var $=y.callValidate;return $&&($.schema=E.schema,$.errors=null,$.refs=E.refs,$.refVal=E.refVal,$.root=E.root,$.$async=E.$async,n.sourceCode&&($.source=E.source)),E}finally{sd.call(this,a,e,s)}function S(){var D=y.validate,A=D.apply(this,arguments);return S.errors=D.errors,A}function R(D,A,L,le){var Y=!A||A&&A.schema==D;if(A.schema!=e.schema)return rs.call(r,D,A,L,le);var re=D.$async===!0,G=Rn({isTop:!0,schema:D,isRoot:Y,baseId:le,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:On.MissingRef,RULES:g,validate:Rn,util:sa,resolve:ta,resolveRef:T,usePattern:z,useDefault:M,useCustomRule:F,opts:n,formats:b,logger:r.logger,self:r});G=aa(l,od)+aa(d,nd)+aa(p,id)+aa(_,ld)+G,n.processCode&&(G=n.processCode(G,D));var Z;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",G);Z=me(r,g,b,e,l,p,_,rd,ed,td),l[0]=Z}catch(we){throw r.logger.error("Error compiling schema, function code:",G),we}return Z.schema=D,Z.errors=null,Z.refs=o,Z.refVal=l,Z.root=Y?Z:A,re&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:G,patterns:d,defaults:p}),Z}function T(D,A,L){A=ta.url(D,A);var le=o[A],Y,re;if(le!==void 0)return Y=l[le],re="refVal["+le+"]",k(Y,re);if(!L&&e.refs){var G=e.refs[A];if(G!==void 0)return Y=e.refVal[G],re=I(A,Y),k(Y,re)}re=I(A);var Z=ta.call(r,R,e,A);if(Z===void 0){var me=t&&t[A];me&&(Z=ta.inlineRef(me,n.inlineRefs)?me:rs.call(r,me,e,t,D))}if(Z===void 0)V(A);else return q(A,Z),k(Z,re)}function I(D,A){var L=l.length;return l[L]=A,o[D]=L,"refVal"+L}function V(D){delete o[D]}function q(D,A){var L=o[D];l[L]=A}function k(D,A){return typeof D=="object"||typeof D=="boolean"?{code:A,schema:D,inline:!0}:{code:A,$async:D&&!!D.$async}}function z(D){var A=f[D];return A===void 0&&(A=f[D]=d.length,d[A]=D),"pattern"+A}function M(D){switch(typeof D){case"boolean":case"number":return""+D;case"string":return sa.toQuotedString(D);case"object":if(D===null)return"null";var A=Xu(D),L=m[A];return L===void 0&&(L=m[A]=p.length,p[L]=D),"default"+L}}function F(D,A,L,le){if(r._opts.validateSchema!==!1){var Y=D.definition.dependencies;if(Y&&!Y.every(function(Pe){return Object.prototype.hasOwnProperty.call(L,Pe)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=D.definition.validateSchema;if(re){var G=re(A);if(!G){var Z="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var me=D.definition.compile,we=D.definition.inline,De=D.definition.macro,se;if(me)se=me.call(r,A,L,le);else if(De)se=De.call(r,A,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(we)se=we.call(r,le,D.keyword,A,L);else if(se=D.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+D.keyword+'"failed to compile');var ye=_.length;return _[ye]=se,{code:"customRule"+ye,validate:se}}}function ad(a,e,t){var s=Dn.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function sd(a,e,t){var s=Dn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Dn(a,e,t){for(var s=0;s{"use strict";var na=In.exports=function(){this._cache={}};na.prototype.put=function(e,t){this._cache[e]=t};na.prototype.get=function(e){return this._cache[e]};na.prototype.del=function(e){delete this._cache[e]};na.prototype.clear=function(){this._cache={}}});var Zn=Q((xp,Vn)=>{"use strict";var cd=Kr(),ud=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dd=[0,31,28,31,30,31,30,31,31,30,31,30,31],fd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,An=/^(?=.{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,pd=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,hd=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,jn=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Cn=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Nn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Fn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ln=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Mn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Vn.exports=ia;function ia(a){return a=a=="full"?"full":"fast",cd.copy(ia[a])}ia.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":jn,url:Cn,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:An,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Un,uuid:Nn,"json-pointer":Fn,"json-pointer-uri-fragment":Ln,"relative-json-pointer":Mn};ia.full={date:qn,time:zn,"date-time":gd,uri:bd,"uri-reference":hd,"uri-template":jn,url:Cn,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:An,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Un,uuid:Nn,"json-pointer":Fn,"json-pointer-uri-fragment":Ln,"relative-json-pointer":Mn};function md(a){return a%4===0&&(a%100!==0||a%400===0)}function qn(a){var e=a.match(ud);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&md(t)?29:dd[s])}function zn(a,e){var t=a.match(fd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],l=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||l)}var vd=/t|\s/i;function gd(a){var e=a.split(vd);return e.length==2&&qn(e[0])&&zn(e[1],!0)}var yd=/\/|:/;function bd(a){return yd.test(a)&&pd.test(a)}var _d=/[^\\]\\Z/;function Un(a){if(_d.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Bn=Q((Pp,Hn)=>{"use strict";Hn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(l||""),m="valid"+n,_,c;if(o=="#"||o=="#/")e.isRoot?(_=e.async,c="validate"):(_=e.root.schema.$async===!0,c="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(b);var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,b)}else if(y.inline){var $=e.util.copy(e);$.level++;var S="valid"+$.level;$.schema=y.schema,$.schemaPath="",$.errSchemaPath=o;var R=e.validate($).replace(/validate\.schema/g,y.code);r+=" "+R+" ",f&&(r+=" if ("+S+") { ")}else _=y.$async===!0||e.async&&y.$async!==!1,c=y.code}if(c){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+c+".call(this, ":r+=" "+c+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var T=l?"data"+(l-1||""):"parentData",I=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+T+" , "+I+", rootData) ";var V=r;if(r=g.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",f&&(r+=" "+m+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(r+=" "+m+" = false; "),r+=" } ",f&&(r+=" if ("+m+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+c+".errors; else vErrors = vErrors.concat("+c+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var Jn=Q((Ep,Qn)=>{"use strict";Qn.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,_=f.baseId,c=!0,y=n;if(y)for(var b,g=-1,E=y.length-1;g0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(c=!1,f.schema=b,f.schemaPath=l+"["+g+"]",f.errSchemaPath=o+"/"+g,r+=" "+e.validate(f)+" ",f.baseId=_,d&&(r+=" if ("+m+") { ",p+="}"));return d&&(c?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var Wn=Q((Sp,Kn)=>{"use strict";Kn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=o.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(E){var $=y.baseId;r+=" var "+c+" = errors; var "+_+" = false; ";var S=e.compositeRule;e.compositeRule=y.compositeRule=!0;var R=o;if(R)for(var T,I=-1,V=R.length-1;I{"use strict";Gn.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,d=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+d+", "+e.util.toQuotedString(l)+", validate.root.schema);"),r}});var ei=Q((Rp,Xn)=>{"use strict";Xn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o,c||(r+=" var schema"+n+" = validate.schema"+d+";"),r+="var "+_+" = equal("+m+", schema"+n+"); if (!"+_+") { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var ti=Q((Op,ri)=>{"use strict";ri.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E="i"+n,$=y.dataLevel=e.dataLevel+1,S="data"+$,R=e.baseId,T=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+c+" = errors;var "+_+";",T){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+g+" = false; for (var "+E+" = 0; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var V=m+"["+E+"]";y.dataPathArr[$]=E;var q=e.validate(y);y.baseId=R,e.util.varOccurences(q,S)<2?r+=" "+e.util.varReplace(q,S,V)+" ":r+=" var "+S+" = "+V+"; "+q+" ",r+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+b+" if (!"+g+") {"}else r+=" if ("+m+".length == 0) {";var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var z=r;return r=k.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",T&&(r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var si=Q((Dp,ai)=>{"use strict";ai.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level,g={},E={},$=e.opts.ownProperties;for(I in o)if(I!="__proto__"){var S=o[I],R=Array.isArray(S)?E:g;R[I]=S}r+="var "+_+" = errors;";var T=e.errorPath;r+="var missing"+n+";";for(var I in E)if(R=E[I],R.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),p){r+=" && ( ";var V=R;if(V)for(var q,k=-1,z=V.length-1;k0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(r+=" "+b+" = true; if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",c.schema=S,c.schemaPath=d+e.util.getProperty(I),c.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(c)+" ",c.baseId=Z,r+=" } ",p&&(r+=" if ("+b+") { ",y+="}"))}return p&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var ii=Q(($p,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="i"+n,g="schema"+n;c||(r+=" var "+g+" = validate.schema"+d+";"),r+="var "+_+";",c&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=""+_+" = false;for (var "+b+"=0; "+b+"<"+g+".length; "+b+"++) if (equal("+m+", "+g+"["+b+"])) { "+_+" = true; break; }",c&&(r+=" } "),r+=" if (!"+_+") { ";var E=E||[];E.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;return r=E.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var li=Q((Tp,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var _=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=e.opts.unknownFormats,b=Array.isArray(y);if(_){var g="format"+n,E="isObject"+n,$="formatType"+n;r+=" var "+g+" = formats["+c+"]; var "+E+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+$+" = "+E+" && "+g+".type || 'string'; if ("+E+") { ",e.async&&(r+=" var async"+n+" = "+g+".async; "),r+=" "+g+" = "+g+".validate; } if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+c+" && !"+g+" ",b&&(r+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),r+=") || "),r+=" ("+g+" && "+$+" == '"+s+"' && !(typeof "+g+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+g+"("+m+") : "+g+"("+m+")) ":r+=" "+g+"("+m+") ",r+=" : "+g+".test("+m+"))))) {"}else{var g=e.formats[o];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(b&&y.indexOf(o)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var E=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,$=E&&g.type||"string";if(E){var S=g.async===!0;g=g.validate}if($!=s)return p&&(r+=" if (true) { "),r;if(S){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+R+"("+m+"))) { "}else{r+=" if (! ";var R="formats"+e.util.getProperty(o);E&&(R+=".validate"),typeof g=="function"?r+=" "+R+"("+m+") ":r+=" "+R+".test("+m+") ",r+=") { "}}var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",_?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=T.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var ui=Q((Ip,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e);y.level++;var b="valid"+y.level,g=e.schema.then,E=e.schema.else,$=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),S=E!==void 0&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all)),R=y.baseId;if($||S){var T;y.createErrors=!1,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+c+" = errors; var "+_+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=R,y.createErrors=!0,r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,$?(r+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=R,r+=" "+_+" = "+b+"; ",$&&S?(T="ifClause"+n,r+=" var "+T+" = 'then'; "):T="'then'",r+=" } ",S&&(r+=" else { ")):r+=" if (!"+b+") { ",S&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=R,r+=" "+_+" = "+b+"; ",$&&S?(T="ifClause"+n,r+=" var "+T+" = 'else'; "):T="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+T+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+T+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var fi=Q((kp,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E="i"+n,$=y.dataLevel=e.dataLevel+1,S="data"+$,R=e.baseId;if(r+="var "+c+" = errors;var "+_+";",Array.isArray(o)){var T=e.schema.additionalItems;if(T===!1){r+=" "+_+" = "+m+".length <= "+o.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var q=r;r=V.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f=I,p&&(b+="}",r+=" else { ")}var k=o;if(k){for(var z,M=-1,F=k.length-1;M0||z===!1:e.util.schemaHasRules(z,e.RULES.all)){r+=" "+g+" = true; if ("+m+".length > "+M+") { ";var D=m+"["+M+"]";y.schema=z,y.schemaPath=d+"["+M+"]",y.errSchemaPath=f+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[$]=M;var A=e.validate(y);y.baseId=R,e.util.varOccurences(A,S)<2?r+=" "+e.util.varReplace(A,S,D)+" ":r+=" var "+S+" = "+D+"; "+A+" ",r+=" } ",p&&(r+=" if ("+g+") { ",b+="}")}}if(typeof T=="object"&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))){y.schema=T,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+m+".length > "+o.length+") { for (var "+E+" = "+o.length+"; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var D=m+"["+E+"]";y.dataPathArr[$]=E;var A=e.validate(y);y.baseId=R,e.util.varOccurences(A,S)<2?r+=" "+e.util.varReplace(A,S,D)+" ":r+=" var "+S+" = "+D+"; "+A+" ",p&&(r+=" if (!"+g+") break; "),r+=" } } ",p&&(r+=" if ("+g+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" for (var "+E+" = 0; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var D=m+"["+E+"]";y.dataPathArr[$]=E;var A=e.validate(y);y.baseId=R,e.util.varOccurences(A,S)<2?r+=" "+e.util.varReplace(A,S,D)+" ":r+=" var "+S+" = "+D+"; "+A+" ",p&&(r+=" if (!"+g+") break; "),r+=" }"}return p&&(r+=" "+b+" if ("+c+" == errors) {"),r}});var ts=Q((Ap,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,R,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=t=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],E=e.opts.$data&&g&&g.$data,$=y?"<":">",S=y?">":"<",R=void 0;if(!(_||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(E||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(b+" must be number or boolean");if(E){var T=e.util.getData(g.$data,l,e.dataPathArr),I="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,k="op"+n,z="' + "+k+" + '";r+=" var schemaExcl"+n+" = "+T+"; ",T="schemaExcl"+n,r+=" var "+I+"; var "+V+" = typeof "+T+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var R=b,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+I+" = "+c+" === undefined || "+T+" "+$+"= "+c+") ? "+m+" "+S+"= "+T+" : "+m+" "+S+" "+c+" ) : ( ("+I+" = "+T+" === true) ? "+m+" "+S+"= "+c+" : "+m+" "+S+" "+c+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+$+"' : '"+$+"='; ",o===void 0&&(R=b,f=e.errSchemaPath+"/"+b,c=T,_=E)}else{var q=typeof g=="number",z=$;if(q&&_){var k="'"+z+"'";r+=" if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" ( "+c+" === undefined || "+g+" "+$+"= "+c+" ? "+m+" "+S+"= "+g+" : "+m+" "+S+" "+c+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(I=!0,R=b,f=e.errSchemaPath+"/"+b,c=g,S+="="):(q&&(c=Math[y?"min":"max"](g,o)),g===(q?c:!0)?(I=!0,R=b,f=e.errSchemaPath+"/"+b,S+="="):(I=!1,z+="="));var k="'"+z+"'";r+=" if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+" "+S+" "+c+" || "+m+" !== "+m+") { "}}R=R||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+k+", limit: "+c+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+z+" ",_?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var as=Q((jp,hi)=>{"use strict";hi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+".length "+y+" "+c+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var ss=Q((Cp,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+c+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var ns=Q((Np,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+c+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var yi=Q((Fp,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",_&&(r+=" "+c+" !== undefined && ( typeof "+c+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+c+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",_&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var b=r;return r=y.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+b+"]); ":r+=" validate.errors = ["+b+"]; return false; ":r+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var _i=Q((Lp,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e);c.level++;var y="valid"+c.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){c.schema=o,c.schemaPath=d,c.errSchemaPath=f,r+=" var "+_+" = errors; ";var b=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.createErrors=!1;var g;c.opts.allErrors&&(g=c.opts.allErrors,c.opts.allErrors=!1),r+=" "+e.validate(c)+" ",c.createErrors=!0,g&&(c.opts.allErrors=g),e.compositeRule=c.compositeRule=b,r+=" if ("+y+") { ";var E=E||[];E.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;r=E.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+_+"; if (vErrors !== null) { if ("+_+") vErrors.length = "+_+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(r+=" if (false) { ");return r}});var Pi=Q((Mp,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=y.baseId,$="prevValid"+n,S="passingSchemas"+n;r+="var "+c+" = errors , "+$+" = false , "+_+" = false , "+S+" = null; ";var R=e.compositeRule;e.compositeRule=y.compositeRule=!0;var T=o;if(T)for(var I,V=-1,q=T.length-1;V0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=d+"["+V+"]",y.errSchemaPath=f+"/"+V,r+=" "+e.validate(y)+" ",y.baseId=E):r+=" var "+g+" = true; ",V&&(r+=" if ("+g+" && "+$+") { "+_+" = false; "+S+" = ["+S+", "+V+"]; } else { ",b+="}"),r+=" if ("+g+") { "+_+" = "+$+" = true; "+S+" = "+V+"; }";return e.compositeRule=y.compositeRule=R,r+=""+b+"if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+S+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Si=Q((qp,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=_?"(new RegExp("+c+"))":e.usePattern(o);r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" !"+y+".test("+m+") ) { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",_?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ri=Q((zp,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level,g="key"+n,E="idx"+n,$=c.dataLevel=e.dataLevel+1,S="data"+$,R="dataProperties"+n,T=Object.keys(o||{}).filter(re),I=e.schema.patternProperties||{},V=Object.keys(I).filter(re),q=e.schema.additionalProperties,k=T.length||V.length,z=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,D=z||M||F,A=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length8)r+=" || validate.schema"+d+".hasOwnProperty("+g+") ";else{var G=T;if(G)for(var Z,me=-1,we=G.length-1;me0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){var ze=e.util.getProperty(Z),Re=m+ze,ke=br&&Ee.default!==void 0;c.schema=Ee,c.schemaPath=d+ze,c.errSchemaPath=f+"/"+e.util.escapeFragment(Z),c.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),c.dataPathArr[$]=e.util.toQuotedString(Z);var ie=e.validate(c);if(c.baseId=L,e.util.varOccurences(ie,S)<2){ie=e.util.varReplace(ie,S,Re);var Te=Re}else{var Te=S;r+=" var "+S+" = "+Re+"; "}if(ke)r+=" "+ie+" ";else{if(Y&&Y[Z]){r+=" if ( "+Te+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+b+" = false; ";var $e=e.errorPath,cr=f,tr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath($e,Z,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var be=be||[];be.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+tr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+tr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=be.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=cr,e.errorPath=$e,r+=" } else { "}else p?(r+=" if ( "+Te+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+b+" = true; } else { "):(r+=" if ("+Te+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+b+") { ",y+="}")}}if(V.length){var Le=V;if(Le)for(var se,Dt=-1,ya=Le.length-1;Dt0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){c.schema=Ee,c.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),c.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),A?r+=" "+R+" = "+R+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+R+".length; "+E+"++) { var "+g+" = "+R+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+g+")) { ",c.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Re=m+"["+g+"]";c.dataPathArr[$]=g;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,S)<2?r+=" "+e.util.varReplace(ie,S,Re)+" ":r+=" var "+S+" = "+Re+"; "+ie+" ",p&&(r+=" if (!"+b+") break; "),r+=" } ",p&&(r+=" else "+b+" = true; "),r+=" } ",p&&(r+=" if ("+b+") { ",y+="}")}}}return p&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Di=Q((Up,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){c.schema=o,c.schemaPath=d,c.errSchemaPath=f;var g="key"+n,E="idx"+n,$="i"+n,S="' + "+g+" + '",R=c.dataLevel=e.dataLevel+1,T="data"+R,I="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+I+" = undefined; "),V?r+=" "+I+" = "+I+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+I+".length; "+E+"++) { var "+g+" = "+I+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var k=g,z=e.compositeRule;e.compositeRule=c.compositeRule=!0;var M=e.validate(c);c.baseId=q,e.util.varOccurences(M,T)<2?r+=" "+e.util.varReplace(M,T,k)+" ":r+=" var "+T+" = "+k+"; "+M+" ",e.compositeRule=c.compositeRule=z,r+=" if (!"+b+") { for (var "+$+"=startErrs"+n+"; "+$+"{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="schema"+n;if(!c)if(o.length0||T===!1:e.util.schemaHasRules(T,e.RULES.all))||(g[g.length]=$)}}else var g=o;if(c||g.length){var I=e.errorPath,V=c||g.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",V){c||(r+=" var "+b+" = validate.schema"+d+"; ");var k="i"+n,z="schema"+n+"["+k+"]",M="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,z,e.opts.jsonPointers)),r+=" var "+_+" = true; ",c&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+b+".length; "+k+"++) { "+_+" = "+m+"["+b+"["+k+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+b+"["+k+"]) "),r+="; if (!"+_+") break; } ",c&&(r+=" } "),r+=" if (!"+_+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=F.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var A=g;if(A)for(var L,k=-1,le=A.length-1;k{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;if(c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o,(o||c)&&e.opts.uniqueItems!==!1){c&&(r+=" var "+_+"; if ("+y+" === false || "+y+" === undefined) "+_+" = true; else if (typeof "+y+" != 'boolean') "+_+" = false; else { "),r+=" var i = "+m+".length , "+_+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,g=Array.isArray(b);if(!b||b=="object"||b=="array"||g&&(b.indexOf("object")>=0||b.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+_+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var E="checkDataType"+(g?"s":"");r+=" if ("+e.util[E](b,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+_+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",c&&(r+=" } "),r+=" if (!"+_+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",c?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;r=$.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var ji=Q((Hp,Ai)=>{"use strict";Ai.exports={$ref:Bn(),allOf:Jn(),anyOf:Wn(),$comment:Yn(),const:ei(),contains:ti(),dependencies:si(),enum:ii(),format:li(),if:ui(),items:fi(),maximum:ts(),minimum:ts(),maxItems:as(),minItems:as(),maxLength:ss(),minLength:ss(),maxProperties:ns(),minProperties:ns(),multipleOf:yi(),not:_i(),oneOf:Pi(),pattern:Si(),properties:Ri(),propertyNames:Di(),required:Ti(),uniqueItems:ki(),validate:es()}});var Fi=Q((Bp,Ni)=>{"use strict";var Ci=ji(),is=Kr().toHash;Ni.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=is(t),e.types=is(r),e.forEach(function(n){n.rules=n.rules.map(function(l){var o;if(typeof l=="object"){var d=Object.keys(l)[0];o=l[d],l=d,o.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(l);var f=e.all[l]={keyword:l,code:Ci[l],implements:o};return f}),e.all.$comment={keyword:"$comment",code:Ci.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=is(t.concat(s)),e.custom={},e}});var qi=Q((Qp,Mi)=>{"use strict";var Li=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Mi.exports=function(a,e){for(var t=0;t{"use strict";var xd=ra().MissingRef;Ui.exports=zi;function zi(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var o=s._addSchema(a,void 0,e);return o.validate||l(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var d=o.$schema;return d&&!s.getSchema(d)?zi.call(s,{$ref:d},!0):Promise.resolve()}function l(o){try{return s._compile(o)}catch(f){if(f instanceof xd)return d(f);throw f}function d(f){var p=f.missingSchema;if(c(p))throw new Error("Schema "+p+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(_,_)),m.then(function(y){if(!c(p))return n(y).then(function(){c(p)||s.addSchema(y,p,void 0,e)})}).then(function(){return l(o)});function _(){delete s._loadingSchemas[p]}function c(y){return s._refs[y]||s._schemas[y]}}}}});var Hi=Q((Kp,Zi)=>{"use strict";Zi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,_="data"+(l||""),c="valid"+n,y="errs__"+n,b=e.opts.$data&&o&&o.$data,g;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",g="schema"+n):g=o;var E=this,$="definition"+n,S=E.definition,R="",T,I,V,q,k;if(b&&S.$data){k="keywordValidate"+n;var z=S.validateSchema;r+=" var "+$+" = RULES.custom['"+t+"'].definition; var "+k+" = "+$+".validate;"}else{if(q=e.useCustomRule(E,o,e.schema,e),!q)return;g="validate.schema"+d,k=q.code,T=S.compile,I=S.inline,V=S.macro}var M=k+".errors",F="i"+n,D="ruleErr"+n,A=S.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(I||V||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+c+";",b&&S.$data&&(R+="}",r+=" if ("+g+" === undefined) { "+c+" = true; } else { ",z&&(R+="}",r+=" "+c+" = "+$+".validateSchema("+g+"); if ("+c+") { ")),I)S.statements?r+=" "+q.validate+" ":r+=" "+c+" = "+q.validate+"; ";else if(V){var L=e.util.copy(e),R="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,k);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var G=G||[];G.push(r),r="",r+=" "+k+".call( ",e.opts.passContext?r+="this":r+="self",T||S.schema===!1?r+=" , "+_+" ":r+=" , "+g+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=l?"data"+(l-1||""):"parentData",me=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+Z+" , "+me+" , rootData ) ";var we=r;r=G.pop(),S.errors===!1?(r+=" "+c+" = ",A&&(r+="await "),r+=""+we+"; "):A?(M="customErrors"+n,r+=" var "+M+" = null; try { "+c+" = await "+we+"; } catch (e) { "+c+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+c+" = "+we+"; "}if(S.modifying&&(r+=" if ("+Z+") "+_+" = "+Z+"["+me+"];"),r+=""+R,S.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",S.valid===void 0?(r+=" !",V?r+=""+le:r+=""+c):r+=" "+!S.valid+" ",r+=") { ",m=E.keyword;var G=G||[];G.push(r),r="";var G=G||[];G.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+E.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+E.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var De=r;r=G.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+De+"]); ":r+=" validate.errors = ["+De+"]; return false; ":r+=" var err = "+De+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=G.pop(),I?S.errors?S.errors!="full"&&(r+=" for (var "+F+"="+y+"; "+F+"{Pd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Ji=Q((Gp,Qi)=>{"use strict";var Bi=os();Qi.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Bi.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Bi.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var Wi=Q((Yp,Ki)=>{"use strict";var Ed=/^[a-z_$][a-z0-9_$-]*$/i,Sd=Hi(),wd=Ji();Ki.exports={add:Rd,get:Od,remove:Dd,validate:ls};function Rd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Ed.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r{$d.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var oo=Q((eh,io)=>{"use strict";var Xi=Tn(),Wr=ea(),Td=kn(),eo=Qa(),Id=Xa(),kd=Zn(),Ad=Fi(),ro=qi(),to=Kr();io.exports=ge;ge.prototype.validate=Cd;ge.prototype.compile=Nd;ge.prototype.addSchema=Fd;ge.prototype.addMetaSchema=Ld;ge.prototype.validateSchema=Md;ge.prototype.getSchema=zd;ge.prototype.removeSchema=Vd;ge.prototype.addFormat=Gd;ge.prototype.errorsText=Wd;ge.prototype._addSchema=Zd;ge.prototype._compile=Hd;ge.prototype.compileAsync=Vi();var ca=Wi();ge.prototype.addKeyword=ca.add;ge.prototype.getKeyword=ca.get;ge.prototype.removeKeyword=ca.remove;ge.prototype.validateKeyword=ca.validate;var ao=ra();ge.ValidationError=ao.Validation;ge.MissingRefError=ao.MissingRef;ge.$dataMetaSchema=ro;var la="http://json-schema.org/draft-07/schema",Yi=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],jd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=to.copy(a)||{},af(this),this._schemas={},this._refs={},this._fragments={},this._formats=kd(a.format),this._cache=a.cache||new Td,this._loadingSchemas={},this._compilations=[],this.RULES=Ad(),this._getId=Bd(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Id),this._metaOpts=tf(this),a.formats&&ef(this),a.keywords&&rf(this),Yd(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Xd(this)}function Cd(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Nd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Fd(a,e,t,s){if(Array.isArray(a)){for(var r=0;rHl,DIRTY:()=>Ar,EMPTY_PATH:()=>El,INVALID:()=>H,NEVER:()=>$c,OK:()=>Oe,ParseStatus:()=>Se,Schema:()=>W,ZodAny:()=>Pr,ZodArray:()=>gr,ZodBigInt:()=>Cr,ZodBoolean:()=>Nr,ZodBranded:()=>_t,ZodCatch:()=>Qr,ZodDate:()=>Fr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>jt,ZodEffects:()=>Be,ZodEnum:()=>Zr,ZodError:()=>Ae,ZodFirstPartyTypeKind:()=>O,ZodFunction:()=>Nt,ZodIntersection:()=>zr,ZodIssueCode:()=>w,ZodLazy:()=>Ur,ZodLiteral:()=>Vr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>We,ZodNull:()=>Mr,ZodNullable:()=>or,ZodNumber:()=>jr,ZodObject:()=>je,ZodOptional:()=>Ze,ZodParsedType:()=>C,ZodPipeline:()=>xt,ZodPromise:()=>Er,ZodReadonly:()=>Jr,ZodRecord:()=>Ct,ZodSchema:()=>W,ZodSet:()=>ut,ZodString:()=>xr,ZodSymbol:()=>ot,ZodTransformer:()=>Be,ZodTuple:()=>ir,ZodType:()=>W,ZodUndefined:()=>Lr,ZodUnion:()=>qr,ZodUnknown:()=>vr,ZodVoid:()=>lt,addIssueToContext:()=>j,any:()=>ec,array:()=>sc,bigint:()=>Kl,boolean:()=>qs,coerce:()=>Dc,custom:()=>Fs,date:()=>Wl,datetimeRegex:()=>Cs,defaultErrorMap:()=>hr,discriminatedUnion:()=>lc,effect:()=>_c,enum:()=>gc,function:()=>hc,getErrorMap:()=>st,getParsedType:()=>nr,instanceof:()=>Ql,intersection:()=>cc,isAborted:()=>kt,isAsync:()=>nt,isDirty:()=>At,isValid:()=>_r,late:()=>Bl,lazy:()=>mc,literal:()=>vc,makeIssue:()=>bt,map:()=>fc,nan:()=>Jl,nativeEnum:()=>yc,never:()=>tc,null:()=>Xl,nullable:()=>Pc,number:()=>Ms,object:()=>nc,objectUtil:()=>Ea,oboolean:()=>Oc,onumber:()=>Rc,optional:()=>xc,ostring:()=>wc,pipeline:()=>Sc,preprocess:()=>Ec,promise:()=>bc,quotelessJson:()=>_l,record:()=>dc,set:()=>pc,setErrorMap:()=>Pl,strictObject:()=>ic,string:()=>Ls,symbol:()=>Gl,transformer:()=>_c,tuple:()=>uc,undefined:()=>Yl,union:()=>oc,unknown:()=>rc,util:()=>X,void:()=>ac});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let l of r)n[l]=l;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),l={};for(let o of n)l[o]=r[o];return a.objectValues(l)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&n.push(l);return n},a.find=(r,n)=>{for(let l of r)if(n(l))return l},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(l=>typeof l=="string"?`'${l}'`:l).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var Ea;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ea||(Ea={}));var C=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=a=>{switch(typeof a){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(a)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(a)?C.array:a===null?C.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?C.promise:typeof Map<"u"&&a instanceof Map?C.map:typeof Set<"u"&&a instanceof Set?C.set:typeof Date<"u"&&a instanceof Date?C.date:C.object;default:return C.unknown}};var w=X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),_l=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ae=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let l of n.issues)if(l.code==="invalid_union")l.unionErrors.map(r);else if(l.code==="invalid_return_type")r(l.returnTypeError);else if(l.code==="invalid_arguments")r(l.argumentsError);else if(l.path.length===0)s._errors.push(t(l));else{let o=s,d=0;for(;dt.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ae.create=a=>new Ae(a);var xl=(a,e)=>{let t;switch(a.code){case w.invalid_type:a.received===C.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case w.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case w.invalid_union:t="Invalid input";break;case w.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case w.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case w.invalid_arguments:t="Invalid function arguments";break;case w.invalid_return_type:t="Invalid function return type";break;case w.invalid_date:t="Invalid date";break;case w.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case w.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case w.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case w.custom:t="Invalid input";break;case w.invalid_intersection_types:t="Intersection results could not be merged";break;case w.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case w.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},hr=xl;var Ts=hr;function Pl(a){Ts=a}function st(){return Ts}var bt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],l={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",d=s.filter(f=>!!f).slice().reverse();for(let f of d)o=f(l,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},El=[];function j(a,e){let t=st(),s=bt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===hr?void 0:hr].filter(r=>!!r)});a.common.issues.push(s)}var Se=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return H;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,l=await r.value;s.push({key:n,value:l})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:l}=r;if(n.status==="aborted"||l.status==="aborted")return H;n.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof l.value<"u"||r.alwaysSet)&&(s[n.value]=l.value)}return{status:e.value,value:s}}},H=Object.freeze({status:"aborted"}),Ar=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),kt=a=>a.status==="aborted",At=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=a=>typeof Promise<"u"&&a instanceof Promise;var U;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(U||(U={}));var He=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Is=(a,e)=>{if(_r(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ae(a.common.issues);return this._error=t,this._error}}};function J(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(l,o)=>{let{message:d}=a;return l.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:l.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:r}}var W=class{get description(){return this._def.description}_getType(e){return nr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Is(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>_r(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Is(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let l=e(r),o=()=>n.addIssue({code:w.custom,...s(r)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(o(),!1)):l?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Be({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Ze.create(this,this._def)}nullable(){return or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gr.create(this)}promise(){return Er.create(this,this._def)}or(e){return qr.create([this,e],this._def)}and(e){return zr.create(this,e,this._def)}transform(e){return new Be({...J(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...J(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new _t({typeName:O.ZodBranded,type:this,...J(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Qr({...J(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xt.create(this,e)}readonly(){return Jr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Sl=/^c[^\s-]{8,}$/i,wl=/^[0-9a-z]+$/,Rl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ol=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Dl=/^[a-z0-9_-]{21}$/i,$l=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Il=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Sa,Al=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Cl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Nl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,As="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ml=new RegExp(`^${As}$`);function js(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ql(a){return new RegExp(`^${js(a)}$`)}function Cs(a){let e=`${As}T${js(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zl(a,e){return!!((e==="v4"||!e)&&Al.test(a)||(e==="v6"||!e)&&Cl.test(a))}function Ul(a,e){if(!$l.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Vl(a,e){return!!((e==="v4"||!e)&&jl.test(a)||(e==="v6"||!e)&&Nl.test(a))}var xr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.string,received:n.parsedType}),H}let s=new Se,r;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let l=e.data.length>n.value,o=e.data.lengthe.test(r),{validation:t,code:w.invalid_string,...U.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...U.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...U.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...U.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...U.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...U.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...U.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...U.errToObj(t)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew xr({checks:[],typeName:O.ZodString,coerce:a?.coerce??!1,...J(a)});function Zl(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),l=Number.parseInt(e.toFixed(r).replace(".",""));return n%l/10**r}var jr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.number,received:n.parsedType}),H}let s,r=new Se;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:w.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Zl(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew jr({checks:[],typeName:O.ZodNumber,coerce:a?.coerce||!1,...J(a)});var Cr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let s,r=new Se;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:w.invalid_type,expected:C.bigint,received:t.parsedType}),H}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Cr({checks:[],typeName:O.ZodBigInt,coerce:a?.coerce??!1,...J(a)});var Nr=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.boolean,received:s.parsedType}),H}return Oe(e.data)}};Nr.create=a=>new Nr({typeName:O.ZodBoolean,coerce:a?.coerce||!1,...J(a)});var Fr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.date,received:n.parsedType}),H}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_date}),H}let s=new Se,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:w.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:U.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Fr({checks:[],coerce:a?.coerce||!1,typeName:O.ZodDate,...J(a)});var ot=class extends W{_parse(e){if(this._getType(e)!==C.symbol){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.symbol,received:s.parsedType}),H}return Oe(e.data)}};ot.create=a=>new ot({typeName:O.ZodSymbol,...J(a)});var Lr=class extends W{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.undefined,received:s.parsedType}),H}return Oe(e.data)}};Lr.create=a=>new Lr({typeName:O.ZodUndefined,...J(a)});var Mr=class extends W{_parse(e){if(this._getType(e)!==C.null){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.null,received:s.parsedType}),H}return Oe(e.data)}};Mr.create=a=>new Mr({typeName:O.ZodNull,...J(a)});var Pr=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};Pr.create=a=>new Pr({typeName:O.ZodAny,...J(a)});var vr=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};vr.create=a=>new vr({typeName:O.ZodUnknown,...J(a)});var We=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:w.invalid_type,expected:C.never,received:t.parsedType}),H}};We.create=a=>new We({typeName:O.ZodNever,...J(a)});var lt=class extends W{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.void,received:s.parsedType}),H}return Oe(e.data)}};lt.create=a=>new lt({typeName:O.ZodVoid,...J(a)});var gr=class a extends W{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==C.array)return j(t,{code:w.invalid_type,expected:C.array,received:t.parsedType}),H;if(r.exactLength!==null){let l=t.data.length>r.exactLength.value,o=t.data.lengthr.maxLength.value&&(j(t,{code:w.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((l,o)=>r.type._parseAsync(new He(t,l,t.path,o)))).then(l=>Se.mergeArray(s,l));let n=[...t.data].map((l,o)=>r.type._parseSync(new He(t,l,t.path,o)));return Se.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:U.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:U.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:U.toString(t)}})}nonempty(e){return this.min(1,e)}};gr.create=(a,e)=>new gr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...J(e)});function it(a){if(a instanceof je){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(it(s))}return new je({...a._def,shape:()=>e})}else return a instanceof gr?new gr({...a._def,type:it(a.element)}):a instanceof Ze?Ze.create(it(a.unwrap())):a instanceof or?or.create(it(a.unwrap())):a instanceof ir?ir.create(a.items.map(e=>it(e))):a}var je=class a extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let f=this._getOrReturnCtx(e);return j(f,{code:w.invalid_type,expected:C.object,received:f.parsedType}),H}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:l}=this._getCached(),o=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(let f in r.data)l.includes(f)||o.push(f);let d=[];for(let f of l){let p=n[f],m=r.data[f];d.push({key:{status:"valid",value:f},value:p._parse(new He(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof We){let f=this._def.unknownKeys;if(f==="passthrough")for(let p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(f==="strict")o.length>0&&(j(r,{code:w.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let p of o){let m=r.data[p];d.push({key:{status:"valid",value:p},value:f._parse(new He(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of d){let m=await p.key,_=await p.value;f.push({key:m,value:_,alwaysSet:p.alwaysSet})}return f}).then(f=>Se.mergeObjectSync(s,f)):Se.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:U.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return it(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Ns(X.objectKeys(this.shape))}};je.create=(a,e)=>new je({shape:()=>a,unknownKeys:"strip",catchall:We.create(),typeName:O.ZodObject,...J(e)});je.strictCreate=(a,e)=>new je({shape:()=>a,unknownKeys:"strict",catchall:We.create(),typeName:O.ZodObject,...J(e)});je.lazycreate=(a,e)=>new je({shape:a,unknownKeys:"strip",catchall:We.create(),typeName:O.ZodObject,...J(e)});var qr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let l=n.map(o=>new Ae(o.ctx.common.issues));return j(t,{code:w.invalid_union,unionErrors:l}),H}if(t.common.async)return Promise.all(s.map(async n=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(r);{let n,l=[];for(let d of s){let f={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=l.map(d=>new Ae(d));return j(t,{code:w.invalid_union,unionErrors:o}),H}}get options(){return this._def.options}};qr.create=(a,e)=>new qr({options:a,typeName:O.ZodUnion,...J(e)});var mr=a=>a instanceof Ur?mr(a.schema):a instanceof Be?mr(a.innerType()):a instanceof Vr?[a.value]:a instanceof Zr?a.options:a instanceof Hr?X.objectValues(a.enum):a instanceof Br?mr(a._def.innerType):a instanceof Lr?[void 0]:a instanceof Mr?[null]:a instanceof Ze?[void 0,...mr(a.unwrap())]:a instanceof or?[null,...mr(a.unwrap())]:a instanceof _t||a instanceof Jr?mr(a.unwrap()):a instanceof Qr?mr(a._def.innerType):[],jt=class a extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return j(t,{code:w.invalid_type,expected:C.object,received:t.parsedType}),H;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(j(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),H)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let l=mr(n.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of l){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...J(s)})}};function wa(a,e){let t=nr(a),s=nr(e);if(a===e)return{valid:!0,data:a};if(t===C.object&&s===C.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(o=>r.indexOf(o)!==-1),l={...a,...e};for(let o of n){let d=wa(a[o],e[o]);if(!d.valid)return{valid:!1};l[o]=d.data}return{valid:!0,data:l}}else if(t===C.array&&s===C.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n{if(kt(n)||kt(l))return H;let o=wa(n.value,l.value);return o.valid?((At(n)||At(l))&&t.dirty(),{status:t.value,value:o.data}):(j(s,{code:w.invalid_intersection_types}),H)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,l])=>r(n,l)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};zr.create=(a,e,t)=>new zr({left:a,right:e,typeName:O.ZodIntersection,...J(t)});var ir=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.array)return j(s,{code:w.invalid_type,expected:C.array,received:s.parsedType}),H;if(s.data.lengththis._def.items.length&&(j(s,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((l,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new He(s,l,s.path,o)):null}).filter(l=>!!l);return s.common.async?Promise.all(n).then(l=>Se.mergeArray(t,l)):Se.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};ir.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ir({items:a,typeName:O.ZodTuple,rest:null,...J(e)})};var Ct=class a extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.object)return j(s,{code:w.invalid_type,expected:C.object,received:s.parsedType}),H;let r=[],n=this._def.keyType,l=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new He(s,o,s.path,o)),value:l._parse(new He(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Se.mergeObjectAsync(t,r):Se.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof W?new a({keyType:e,valueType:t,typeName:O.ZodRecord,...J(s)}):new a({keyType:xr.create(),valueType:e,typeName:O.ZodRecord,...J(t)})}},ct=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.map)return j(s,{code:w.invalid_type,expected:C.map,received:s.parsedType}),H;let r=this._def.keyType,n=this._def.valueType,l=[...s.data.entries()].map(([o,d],f)=>({key:r._parse(new He(s,o,s.path,[f,"key"])),value:n._parse(new He(s,d,s.path,[f,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of l){let f=await d.key,p=await d.value;if(f.status==="aborted"||p.status==="aborted")return H;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(f.value,p.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of l){let f=d.key,p=d.value;if(f.status==="aborted"||p.status==="aborted")return H;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(f.value,p.value)}return{status:t.value,value:o}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:O.ZodMap,...J(t)});var ut=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.set)return j(s,{code:w.invalid_type,expected:C.set,received:s.parsedType}),H;let r=this._def;r.minSize!==null&&s.data.sizer.maxSize.value&&(j(s,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function l(d){let f=new Set;for(let p of d){if(p.status==="aborted")return H;p.status==="dirty"&&t.dirty(),f.add(p.value)}return{status:t.value,value:f}}let o=[...s.data.values()].map((d,f)=>n._parse(new He(s,d,s.path,f)));return s.common.async?Promise.all(o).then(d=>l(d)):l(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:U.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:U.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:O.ZodSet,...J(e)});var Nt=class a extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return j(t,{code:w.invalid_type,expected:C.function,received:t.parsedType}),H;function s(o,d){return bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),hr].filter(f=>!!f),issueData:{code:w.invalid_arguments,argumentsError:d}})}function r(o,d){return bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),hr].filter(f=>!!f),issueData:{code:w.invalid_return_type,returnTypeError:d}})}let n={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Er){let o=this;return Oe(async function(...d){let f=new Ae([]),p=await o._def.args.parseAsync(d,n).catch(c=>{throw f.addIssue(s(d,c)),f}),m=await Reflect.apply(l,this,p);return await o._def.returns._def.type.parseAsync(m,n).catch(c=>{throw f.addIssue(r(m,c)),f})})}else{let o=this;return Oe(function(...d){let f=o._def.args.safeParse(d,n);if(!f.success)throw new Ae([s(d,f.error)]);let p=Reflect.apply(l,this,f.data),m=o._def.returns.safeParse(p,n);if(!m.success)throw new Ae([r(p,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:ir.create(e).rest(vr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||ir.create([]).rest(vr.create()),returns:t||vr.create(),typeName:O.ZodFunction,...J(s)})}},Ur=class extends W{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:O.ZodLazy,...J(e)});var Vr=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vr.create=(a,e)=>new Vr({value:a,typeName:O.ZodLiteral,...J(e)});function Ns(a,e){return new Zr({values:a,typeName:O.ZodEnum,...J(e)})}var Zr=class a extends W{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{expected:X.joinValues(s),received:t.parsedType,code:w.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{received:t.data,code:w.invalid_enum_value,options:s}),H}return Oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Zr.create=Ns;var Hr=class extends W{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==C.string&&s.parsedType!==C.number){let r=X.objectValues(t);return j(s,{expected:X.joinValues(r),received:s.parsedType,code:w.invalid_type}),H}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return j(s,{received:s.data,code:w.invalid_enum_value,options:r}),H}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:O.ZodNativeEnum,...J(e)});var Er=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return j(t,{code:w.invalid_type,expected:C.promise,received:t.parsedType}),H;let s=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Er.create=(a,e)=>new Er({type:a,typeName:O.ZodPromise,...J(e)});var Be=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:l=>{j(s,l),l.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let l=r.transform(s.data,n);if(s.common.async)return Promise.resolve(l).then(async o=>{if(t.value==="aborted")return H;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?H:d.status==="dirty"?Ar(d.value):t.value==="dirty"?Ar(d.value):d});{if(t.value==="aborted")return H;let o=this._def.schema._parseSync({data:l,path:s.path,parent:s});return o.status==="aborted"?H:o.status==="dirty"?Ar(o.value):t.value==="dirty"?Ar(o.value):o}}if(r.type==="refinement"){let l=o=>{let d=r.refinement(o,n);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?H:(o.status==="dirty"&&t.dirty(),l(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?H:(o.status==="dirty"&&t.dirty(),l(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(l))return H;let o=r.transform(l.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>_r(l)?Promise.resolve(r.transform(l.value,n)).then(o=>({status:t.value,value:o})):H);X.assertNever(r)}};Be.create=(a,e,t)=>new Be({schema:a,typeName:O.ZodEffects,effect:e,...J(t)});Be.createWithPreprocess=(a,e,t)=>new Be({schema:e,effect:{type:"preprocess",transform:a},typeName:O.ZodEffects,...J(t)});var Ze=class extends W{_parse(e){return this._getType(e)===C.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:O.ZodOptional,...J(e)});var or=class extends W{_parse(e){return this._getType(e)===C.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:O.ZodNullable,...J(e)});var Br=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===C.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(a,e)=>new Br({innerType:a,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...J(e)});var Qr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ae(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ae(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Qr.create=(a,e)=>new Qr({innerType:a,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...J(e)});var dt=class extends W{_parse(e){if(this._getType(e)!==C.nan){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.nan,received:s.parsedType}),H}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:O.ZodNaN,...J(a)});var Hl=Symbol("zod_brand"),_t=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},xt=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?H:n.status==="dirty"?(t.dirty(),Ar(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?H:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:O.ZodPipeline})}},Jr=class extends W{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Jr.create=(a,e)=>new Jr({innerType:a,typeName:O.ZodReadonly,...J(e)});function ks(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Fs(a,e={},t){return a?Pr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(l=>{if(!l){let o=ks(e,s),d=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:d})}});if(!n){let l=ks(e,s),o=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:o})}}):Pr.create()}var Bl={object:je.lazycreate},O;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(O||(O={}));var Ql=(a,e={message:`Input not instance of ${a.name}`})=>Fs(t=>t instanceof a,e),Ls=xr.create,Ms=jr.create,Jl=dt.create,Kl=Cr.create,qs=Nr.create,Wl=Fr.create,Gl=ot.create,Yl=Lr.create,Xl=Mr.create,ec=Pr.create,rc=vr.create,tc=We.create,ac=lt.create,sc=gr.create,nc=je.create,ic=je.strictCreate,oc=qr.create,lc=jt.create,cc=zr.create,uc=ir.create,dc=Ct.create,fc=ct.create,pc=ut.create,hc=Nt.create,mc=Ur.create,vc=Vr.create,gc=Zr.create,yc=Hr.create,bc=Er.create,_c=Be.create,xc=Ze.create,Pc=or.create,Ec=Be.createWithPreprocess,Sc=xt.create,wc=()=>Ls().optional(),Rc=()=>Ms().optional(),Oc=()=>qs().optional(),Dc={string:(a=>xr.create({...a,coerce:!0})),number:(a=>jr.create({...a,coerce:!0})),boolean:(a=>Nr.create({...a,coerce:!0})),bigint:(a=>Cr.create({...a,coerce:!0})),date:(a=>Fr.create({...a,coerce:!0}))};var $c=H;var Ra="2025-06-18";var zs=[Ra,"2025-03-26","2024-11-05","2024-10-07"],Ft="2.0",Us=i.union([i.string(),i.number().int()]),Vs=i.string(),Tc=i.object({progressToken:i.optional(Us)}).passthrough(),Qe=i.object({_meta:i.optional(Tc)}).passthrough(),Ce=i.object({method:i.string(),params:i.optional(Qe)}),Pt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),lr=i.object({method:i.string(),params:i.optional(Pt)}),Je=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),Lt=i.union([i.string(),i.number().int()]),Zs=i.object({jsonrpc:i.literal(Ft),id:Lt}).merge(Ce).strict(),Hs=a=>Zs.safeParse(a).success,Bs=i.object({jsonrpc:i.literal(Ft)}).merge(lr).strict(),Qs=a=>Bs.safeParse(a).success,Js=i.object({jsonrpc:i.literal(Ft),id:Lt,result:Je}).strict(),Oa=a=>Js.safeParse(a).success,Ge;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ge||(Ge={}));var Ks=i.object({jsonrpc:i.literal(Ft),id:Lt,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),Ws=a=>Ks.safeParse(a).success,Gs=i.union([Zs,Bs,Js,Ks]),Mt=Je.strict(),qt=lr.extend({method:i.literal("notifications/cancelled"),params:Pt.extend({requestId:Lt,reason:i.string().optional()})}),Ic=i.object({src:i.string(),mimeType:i.optional(i.string()),sizes:i.optional(i.array(i.string()))}).passthrough(),Et=i.object({icons:i.array(Ic).optional()}).passthrough(),St=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),Ys=St.extend({version:i.string(),websiteUrl:i.optional(i.string())}).merge(Et),kc=i.object({experimental:i.optional(i.object({}).passthrough()),sampling:i.optional(i.object({}).passthrough()),elicitation:i.optional(i.object({}).passthrough()),roots:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),Da=Ce.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:kc,clientInfo:Ys})});var Ac=i.object({experimental:i.optional(i.object({}).passthrough()),logging:i.optional(i.object({}).passthrough()),completions:i.optional(i.object({}).passthrough()),prompts:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough()),resources:i.optional(i.object({subscribe:i.optional(i.boolean()),listChanged:i.optional(i.boolean())}).passthrough()),tools:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),jc=Je.extend({protocolVersion:i.string(),capabilities:Ac,serverInfo:Ys,instructions:i.optional(i.string())}),$a=lr.extend({method:i.literal("notifications/initialized")});var zt=Ce.extend({method:i.literal("ping")}),Cc=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),Ut=lr.extend({method:i.literal("notifications/progress"),params:Pt.merge(Cc).extend({progressToken:Us})}),Vt=Ce.extend({params:Qe.extend({cursor:i.optional(Vs)}).optional()}),Zt=Je.extend({nextCursor:i.optional(Vs)}),Xs=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),en=Xs.extend({text:i.string()}),Ta=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),rn=Xs.extend({blob:Ta}),tn=St.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Nc=St.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Fc=Vt.extend({method:i.literal("resources/list")}),Lc=Zt.extend({resources:i.array(tn)}),Mc=Vt.extend({method:i.literal("resources/templates/list")}),qc=Zt.extend({resourceTemplates:i.array(Nc)}),zc=Ce.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),Uc=Je.extend({contents:i.array(i.union([en,rn]))}),Vc=lr.extend({method:i.literal("notifications/resources/list_changed")}),Zc=Ce.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),Hc=Ce.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),Bc=lr.extend({method:i.literal("notifications/resources/updated"),params:Pt.extend({uri:i.string()})}),Qc=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),Jc=St.extend({description:i.optional(i.string()),arguments:i.optional(i.array(Qc)),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Kc=Vt.extend({method:i.literal("prompts/list")}),Wc=Zt.extend({prompts:i.array(Jc)}),Gc=Ce.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),Ia=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),ka=i.object({type:i.literal("image"),data:Ta,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Aa=i.object({type:i.literal("audio"),data:Ta,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Yc=i.object({type:i.literal("resource"),resource:i.union([en,rn]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Xc=tn.extend({type:i.literal("resource_link")}),an=i.union([Ia,ka,Aa,Xc,Yc]),eu=i.object({role:i.enum(["user","assistant"]),content:an}).passthrough(),ru=Je.extend({description:i.optional(i.string()),messages:i.array(eu)}),tu=lr.extend({method:i.literal("notifications/prompts/list_changed")}),au=i.object({title:i.optional(i.string()),readOnlyHint:i.optional(i.boolean()),destructiveHint:i.optional(i.boolean()),idempotentHint:i.optional(i.boolean()),openWorldHint:i.optional(i.boolean())}).passthrough(),su=St.extend({description:i.optional(i.string()),inputSchema:i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough(),outputSchema:i.optional(i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough()),annotations:i.optional(au),_meta:i.optional(i.object({}).passthrough())}).merge(Et),ja=Vt.extend({method:i.literal("tools/list")}),nu=Zt.extend({tools:i.array(su)}),sn=Je.extend({content:i.array(an).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),ep=sn.or(Je.extend({toolResult:i.unknown()})),Ca=Ce.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),iu=lr.extend({method:i.literal("notifications/tools/list_changed")}),wt=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Na=Ce.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:wt})}),ou=lr.extend({method:i.literal("notifications/message"),params:Pt.extend({level:wt,logger:i.optional(i.string()),data:i.unknown()})}),lu=i.object({name:i.string().optional()}).passthrough(),cu=i.object({hints:i.optional(i.array(lu)),costPriority:i.optional(i.number().min(0).max(1)),speedPriority:i.optional(i.number().min(0).max(1)),intelligencePriority:i.optional(i.number().min(0).max(1))}).passthrough(),uu=i.object({role:i.enum(["user","assistant"]),content:i.union([Ia,ka,Aa])}).passthrough(),du=Ce.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(uu),systemPrompt:i.optional(i.string()),includeContext:i.optional(i.enum(["none","thisServer","allServers"])),temperature:i.optional(i.number()),maxTokens:i.number().int(),stopSequences:i.optional(i.array(i.string())),metadata:i.optional(i.object({}).passthrough()),modelPreferences:i.optional(cu)})}),Fa=Je.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[Ia,ka,Aa])}),fu=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),pu=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),minLength:i.optional(i.number()),maxLength:i.optional(i.number()),format:i.optional(i.enum(["email","uri","date","date-time"]))}).passthrough(),hu=i.object({type:i.enum(["number","integer"]),title:i.optional(i.string()),description:i.optional(i.string()),minimum:i.optional(i.number()),maximum:i.optional(i.number())}).passthrough(),mu=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),enum:i.array(i.string()),enumNames:i.optional(i.array(i.string()))}).passthrough(),vu=i.union([fu,pu,hu,mu]),gu=Ce.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),vu),required:i.optional(i.array(i.string()))}).passthrough()})}),La=Je.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),yu=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var bu=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),_u=Ce.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([bu,yu]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),xu=Je.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),Pu=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Eu=Ce.extend({method:i.literal("roots/list")}),Ma=Je.extend({roots:i.array(Pu)}),Su=lr.extend({method:i.literal("notifications/roots/list_changed")}),rp=i.union([zt,Da,_u,Na,Gc,Kc,Fc,Mc,zc,Zc,Hc,Ca,ja]),tp=i.union([qt,Ut,$a,Su]),ap=i.union([Mt,Fa,La,Ma]),sp=i.union([zt,du,gu,Eu]),np=i.union([qt,Ut,ou,Bc,Vc,iu,tu]),ip=i.union([Mt,jc,xu,ru,Wc,Lc,qc,Uc,sn,nu]),Ye=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var wu=6e4,Ht=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(qt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Ut,t=>{this._onprogress(t)}),this.setRequestHandler(zt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ye(Ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let l=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(d,f)=>{o?.(d,f),Oa(d)||Ws(d)?this._onresponse(d):Hs(d)?this._onrequest(d,f):Qs(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Ye(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,l=this._transport;if(n===void 0){l?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let d={signal:o.signal,sessionId:l?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,p,m)=>this.request(f,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,d)).then(f=>{if(!o.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var p;if(!o.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Ge.InternalError,message:(p=f.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let l=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&l&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){l(d);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Oa(e))s(e);else{let r=new Ye(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}=s??{};return new Promise((o,d)=>{var f,p,m,_,c,y;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let b=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:b};s?.onprogress&&(this._progressHandlers.set(b,s.onprogress),g.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:b}});let E=R=>{var T;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(T=this._transport)===null||T===void 0||T.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(R)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(R)};this._responseHandlers.set(b,R=>{var T;if(!(!((T=s?.signal)===null||T===void 0)&&T.aborted)){if(R instanceof Error)return d(R);try{let I=t.parse(R.result);o(I)}catch(I){d(I)}}}),(_=s?.signal)===null||_===void 0||_.addEventListener("abort",()=>{var R;E((R=s?.signal)===null||R===void 0?void 0:R.reason)});let $=(c=s?.timeout)!==null&&c!==void 0?c:wu,S=()=>E(new Ye(Ge.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(b,$,s?.maxTotalTimeout,S,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(g,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(R=>{this._cleanupTimeout(b),d(R)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,t).catch(p=>this._onerror(p))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function nn(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var lo=$s(oo(),1),ua=class extends Ht{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(wt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let l=this._loggingLevels.get(n);return l?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler($a,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Na,async(r,n)=>{var l;let o=n.sessionId||((l=n.requestInfo)===null||l===void 0?void 0:l.headers["mcp-session-id"])||void 0,{level:d}=r.params,f=wt.safeParse(d);return f.success&&this._loggingLevels.set(o,f.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=nn(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:zs.includes(t)?t:Ra,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Mt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Fa,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},La,t);if(s.action==="accept"&&s.content)try{let r=new lo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ye(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ye?r:new Ye(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ma,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var us=$s(require("node:process"),1);var da=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),sf(t)}clear(){this._buffer=void 0}};function sf(a){return Gs.parse(JSON.parse(a))}function co(a){return JSON.stringify(a)+`
-`}var fa=class{constructor(e=us.default.stdin,t=us.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new da,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=co(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var fo=Symbol("Let zodToJsonSchema decide on which parser to use");var uo={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},ho=a=>typeof a=="string"?{...uo,name:a}:{...uo,...a};var po=a=>{let e=ho(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function ds(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,ds(a,e,s,r)}var ha=(a,e)=>{let t=0;for(;tB(a.innerType._def,e);function fs(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>fs(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nf(a,e)}}var nf=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function bo(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function _o(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function xo(a){return{type:"string",enum:Array.from(a.values)}}var of=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Po(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(of(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let l=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...d}=n;l=d}else s=void 0;r.push(l)}}),r.length?{allOf:r,...s}:void 0}function Eo(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var hs,Xe={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(hs===void 0&&(hs=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),hs),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ma(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":er(t,"email",s.message,e);break;case"format:idn-email":er(t,"idn-email",s.message,e);break;case"pattern:zod":Ie(t,Xe.email,s.message,e);break}break;case"url":er(t,"uri",s.message,e);break;case"uuid":er(t,"uuid",s.message,e);break;case"regex":Ie(t,s.regex,s.message,e);break;case"cuid":Ie(t,Xe.cuid,s.message,e);break;case"cuid2":Ie(t,Xe.cuid2,s.message,e);break;case"startsWith":Ie(t,RegExp(`^${ps(s.value,e)}`),s.message,e);break;case"endsWith":Ie(t,RegExp(`${ps(s.value,e)}$`),s.message,e);break;case"datetime":er(t,"date-time",s.message,e);break;case"date":er(t,"date",s.message,e);break;case"time":er(t,"time",s.message,e);break;case"duration":er(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ie(t,RegExp(ps(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&er(t,"ipv4",s.message,e),s.version!=="v4"&&er(t,"ipv6",s.message,e);break}case"base64url":Ie(t,Xe.base64url,s.message,e);break;case"jwt":Ie(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ie(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&Ie(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":Ie(t,Xe.emoji(),s.message,e);break;case"ulid":{Ie(t,Xe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ie(t,Xe.base64,s.message,e);break}}break}case"nanoid":Ie(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function ps(a,e){return e.patternStrategy==="escape"?cf(a):a}var lf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function cf(a){let e="";for(let t=0;tr.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function Ie(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:So(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",So(e,s),t,s)}function So(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,l=!1,o=!1;for(let d=0;d{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=co(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var fo=Symbol("Let zodToJsonSchema decide on which parser to use");var uo={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},po=a=>typeof a=="string"?{...uo,name:a}:{...uo,...a};var ho=a=>{let e=po(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function ds(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,ds(a,e,s,r)}var pa=(a,e)=>{let t=0;for(;tB(a.innerType._def,e);function fs(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>fs(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nf(a,e)}}var nf=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function bo(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function _o(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function xo(a){return{type:"string",enum:Array.from(a.values)}}var of=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Po(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(of(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let l=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...d}=n;l=d}else s=void 0;r.push(l)}}),r.length?{allOf:r,...s}:void 0}function Eo(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var ps,Xe={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(ps===void 0&&(ps=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ps),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ma(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":er(t,"email",s.message,e);break;case"format:idn-email":er(t,"idn-email",s.message,e);break;case"pattern:zod":Ie(t,Xe.email,s.message,e);break}break;case"url":er(t,"uri",s.message,e);break;case"uuid":er(t,"uuid",s.message,e);break;case"regex":Ie(t,s.regex,s.message,e);break;case"cuid":Ie(t,Xe.cuid,s.message,e);break;case"cuid2":Ie(t,Xe.cuid2,s.message,e);break;case"startsWith":Ie(t,RegExp(`^${hs(s.value,e)}`),s.message,e);break;case"endsWith":Ie(t,RegExp(`${hs(s.value,e)}$`),s.message,e);break;case"datetime":er(t,"date-time",s.message,e);break;case"date":er(t,"date",s.message,e);break;case"time":er(t,"time",s.message,e);break;case"duration":er(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ie(t,RegExp(hs(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&er(t,"ipv4",s.message,e),s.version!=="v4"&&er(t,"ipv6",s.message,e);break}case"base64url":Ie(t,Xe.base64url,s.message,e);break;case"jwt":Ie(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ie(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&Ie(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":Ie(t,Xe.emoji(),s.message,e);break;case"ulid":{Ie(t,Xe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ie(t,Xe.base64,s.message,e);break}}break}case"nanoid":Ie(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function hs(a,e){return e.patternStrategy==="escape"?cf(a):a}var lf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function cf(a){let e="";for(let t=0;tr.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function Ie(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:So(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",So(e,s),t,s)}function So(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,l=!1,o=!1;for(let d=0;d({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===O.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=ma(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===O.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===O.ZodBranded&&a.keyType._def.type._def.typeName===O.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=pa(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function wo(a,e){if(e.mapStrategy==="record")return va(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Ro(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Oo(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Do(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ot={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function To(a,e){if(e.target==="openApi3")return $o(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ot&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let l=Ot[n._def.typeName];return l&&!r.includes(l)?[...r,l]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let l=typeof n._def.value;switch(l){case"string":case"number":case"boolean":return[...r,l];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,l,o)=>o.indexOf(n)===l);return{type:r.length>1?r:r[0],enum:t.reduce((n,l)=>n.includes(l._def.value)?n:[...n,l._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return $o(a,e)}var $o=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Io(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ot[a.innerType._def.typeName],nullable:!0}:{type:[Ot[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function ko(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",ds(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Ao(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let d=n[o];if(d===void 0||d._def===void 0)continue;let f=df(d);f&&t&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),f=!1);let h=B(d._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});h!==void 0&&(s.properties[o]=h,f||r.push(o))}r.length&&(s.required=r);let l=uf(a,e);return l!==void 0&&(s.additionalProperties=l),s}function uf(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function df(a){try{return a.isOptional()}catch{return!0}}var jo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Co=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function No(a,e){return B(a.type._def,e)}function Fo(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Lo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Mo(a){return{not:fe(a)}}function qo(a){return fe(a)}var zo=(a,e)=>B(a.innerType._def,e);var Uo=(a,e,t)=>{switch(e){case O.ZodString:return ma(a,t);case O.ZodNumber:return ko(a,t);case O.ZodObject:return Ao(a,t);case O.ZodBigInt:return vo(a,t);case O.ZodBoolean:return go();case O.ZodDate:return fs(a,t);case O.ZodUndefined:return Mo(t);case O.ZodNull:return Do(t);case O.ZodArray:return mo(a,t);case O.ZodUnion:case O.ZodDiscriminatedUnion:return To(a,t);case O.ZodIntersection:return Po(a,t);case O.ZodTuple:return Lo(a,t);case O.ZodRecord:return va(a,t);case O.ZodLiteral:return Eo(a,t);case O.ZodEnum:return xo(a);case O.ZodNativeEnum:return Ro(a);case O.ZodNullable:return Io(a,t);case O.ZodOptional:return jo(a,t);case O.ZodMap:return wo(a,t);case O.ZodSet:return Fo(a,t);case O.ZodLazy:return()=>a.getter()._def;case O.ZodPromise:return No(a,t);case O.ZodNaN:case O.ZodNever:return Oo(t);case O.ZodEffects:return _o(a,t);case O.ZodAny:return fe(t);case O.ZodUnknown:return qo(t);case O.ZodDefault:return bo(a,t);case O.ZodBranded:return pa(a,t);case O.ZodReadonly:return zo(a,t);case O.ZodCatch:return yo(a,t);case O.ZodPipeline:return Co(a,t);case O.ZodFunction:case O.ZodVoid:case O.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let o=e.override?.(a,e,s,t);if(o!==fo)return o}if(s&&!t){let o=ff(s,e);if(o!==void 0)return o}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=Uo(a,a.typeName,e),l=typeof n=="function"?B(n(),e):n;if(l&&hf(a,e,l),e.postProcess){let o=e.postProcess(l,a,e);return r.jsonSchema=l,o}return r.jsonSchema=l,l}var ff=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:ha(e.currentPath,a.path)};case"none":case"seen":return a.path.lengthe.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},hf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var ms=(a,e)=>{let t=po(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,h])=>({...d,[f]:B(h._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),l=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;l!==void 0&&(n.title=l),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var Vo=require("fs"),Zo=require("os"),Ho=require("path"),pf=(0,Ho.join)((0,Zo.homedir)(),".claude-mem","silent.log");function rr(a,e,t=""){let s=new Date().toISOString(),o=((new Error().stack||"").split(`
-`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),d=o?`${o[1].split("/").pop()}:${o[2]}`:"unknown",f=`[${s}] [${d}] ${a}`;if(e!==void 0)try{f+=` ${JSON.stringify(e)}`}catch(h){f+=` [stringify error: ${h}]`}f+=`
-`;try{(0,Vo.appendFileSync)(pf,f)}catch(h){console.error("[silent-debug] Failed to write to log:",h)}return t}var mf=parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10),ga=`http://localhost:${mf}`,Ne={search:"/api/search",timeline:"/api/timeline",decisions:"/api/decisions",changes:"/api/changes",how_it_works:"/api/how-it-works",search_observations:"/api/search/observations",search_sessions:"/api/search/sessions",search_user_prompts:"/api/search/prompts",find_by_concept:"/api/search/by-concept",find_by_file:"/api/search/by-file",find_by_type:"/api/search/by-type",get_recent_context:"/api/context/recent",get_context_timeline:"/api/context/timeline",get_timeline_by_query:"/api/timeline/by-query"};async function Fe(a,e){rr("[search-server] \u2192 Worker API",{endpoint:a,params:e});try{let t=new URLSearchParams;for(let[l,o]of Object.entries(e))o!=null&&t.append(l,String(o));let s=`${ga}${a}?${t}`,r=await fetch(s);if(!r.ok){let l=await r.text();throw new Error(`Worker API error (${r.status}): ${l}`)}let n=await r.json();return rr("[search-server] \u2190 Worker API success",{endpoint:a}),n}catch(t){return rr("[search-server] \u2190 Worker API error",{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function vf(){try{return(await fetch(`${ga}/api/health`)).ok}catch{return!1}}var Bo=[{name:"search",description:'Unified search across all memory types (observations, sessions, and user prompts) using vector-first semantic search (ChromaDB). Returns combined results from all document types. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:i.object({query:i.string().optional().describe("Natural language search query for semantic ranking via ChromaDB vector search. Optional - omit for date-filtered queries only (Chroma cannot filter by date, requires direct SQLite)."),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),type:i.enum(["observations","sessions","prompts"]).optional().describe("Filter by document type (observations, sessions, or prompts). Omit to search all types."),obs_type:i.string().optional().describe('Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change). Only applies when type="observations"'),concepts:i.string().optional().describe('Filter by concept tags (single value or comma-separated list). Only applies when type="observations"'),files:i.string().optional().describe('Filter by file paths (single value or comma-separated list for partial match). Only applies when type="observations"'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.search;return await Fe(e,a)}},{name:"timeline",description:"Fetch timeline of observations around a specific point in time. Supports two modes: anchor-based (fetch observations before/after a specific observation ID) and query-based (semantic search for anchor point). IMPORTANT: Use anchor_id when you know the specific observation, or query to find an anchor point first.",inputSchema:i.object({query:i.string().optional().describe("Natural language query to find anchor observation (query-based mode). Mutually exclusive with anchor_id."),anchor_id:i.number().optional().describe("Observation ID to use as anchor (anchor-based mode). Mutually exclusive with query."),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),obs_type:i.string().optional().describe("Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Ne.timeline;return await Fe(e,a)}},{name:"decisions",description:"Semantic shortcut for finding architectural, design, and implementation decisions. Optimized for decision-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding decisions"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.decisions;return await Fe(e,a)}},{name:"changes",description:"Semantic shortcut for finding code changes, refactorings, and modifications. Optimized for change-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding changes"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.changes;return await Fe(e,a)}},{name:"how_it_works",description:"Semantic shortcut for understanding system architecture, design patterns, and implementation details. Optimized for discovery-type observations with architecture/design keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for understanding how something works"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.how_it_works;return await Fe(e,a)}},{name:"search_observations",description:'[DEPRECATED - Use "search" with type="observations" instead] Search observations (facts/narratives) using FTS5 full-text search. Supports filtering by type, concepts, files, and date range.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_observations;return await Fe(e,a)}},{name:"search_sessions",description:'[DEPRECATED - Use "search" with type="sessions" instead] Search session summaries using FTS5 full-text search. Returns both request_summary and learned_summary fields.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_sessions;return await Fe(e,a)}},{name:"search_user_prompts",description:'[DEPRECATED - Use "search" with type="prompts" instead] Search user prompts using FTS5 full-text search. Searches prompt text only.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_user_prompts;return await Fe(e,a)}},{name:"find_by_concept",description:"Find observations tagged with specific concepts. Returns observations that match any of the provided concept tags.",inputSchema:i.object({concepts:i.string().describe("Concept tag(s) to filter by (single value or comma-separated list)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_concept;return await Fe(e,a)}},{name:"find_by_file",description:"Find observations related to specific file paths. Uses partial matching - searches for file paths containing the provided string.",inputSchema:i.object({files:i.string().describe("File path(s) to filter by (single value or comma-separated list for partial match)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_file;return await Fe(e,a)}},{name:"find_by_type",description:"Find observations of specific types. Returns observations matching any of the provided observation types.",inputSchema:i.object({type:i.string().describe("Observation type(s) to filter by (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_type;return await Fe(e,a)}},{name:"get_recent_context",description:"Get recent session context for timeline display. Returns recent observations, sessions, and user prompts with metadata for building timeline UI.",inputSchema:i.object({limit:i.number().min(1).max(100).default(30).describe("Maximum number of timeline items to return"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.get_recent_context;return await Fe(e,a)}},{name:"get_context_timeline",description:"Get timeline of observations around a specific observation ID. Returns observations before and after the anchor point with metadata for timeline display.",inputSchema:i.object({anchor_id:i.number().describe("Observation ID to use as anchor point"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Ne.get_context_timeline;return await Fe(e,a)}},{name:"get_timeline_by_query",description:"Combined search + timeline tool. First searches for observations matching the query, then returns timeline around the best match. Useful for finding specific observations and viewing their context.",inputSchema:i.object({query:i.string().describe("Natural language query to find anchor observation"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.get_timeline_by_query;return await Fe(e,a)}}],vs=new ua({name:"claude-mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});vs.setRequestHandler(ja,async()=>({tools:Bo.map(a=>({name:a.name,description:a.description,inputSchema:ms(a.inputSchema)}))}));vs.setRequestHandler(Ca,async a=>{let e=Bo.find(t=>t.name===a.params.name);if(!e)throw new Error(`Unknown tool: ${a.params.name}`);try{return await e.handler(a.params.arguments||{})}catch(t){return{content:[{type:"text",text:`Tool execution failed: ${t.message}`}],isError:!0}}});async function Qo(){rr("[search-server] Shutting down..."),process.exit(0)}process.on("SIGTERM",Qo);process.on("SIGINT",Qo);async function gf(){let a=new fa;await vs.connect(a),rr("[search-server] Claude-mem search server started"),setTimeout(async()=>{await vf()?rr("[search-server] Worker available at",ga):(rr("[search-server] WARNING: Worker not available at",ga),rr("[search-server] Tools will fail until Worker is started"),rr("[search-server] Start Worker with: npm run worker:restart"))},0)}gf().catch(a=>{rr("[search-server] Fatal error:",a),process.exit(1)});
+]`;continue}r+=s[d],s[d]==="\\"?n=!0:l&&s[d]==="]"?l=!1:!l&&s[d]==="["&&(l=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function va(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===O.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===O.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=ma(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===O.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===O.ZodBranded&&a.keyType._def.type._def.typeName===O.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=ha(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function wo(a,e){if(e.mapStrategy==="record")return va(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Ro(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Oo(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Do(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ot={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function To(a,e){if(e.target==="openApi3")return $o(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ot&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let l=Ot[n._def.typeName];return l&&!r.includes(l)?[...r,l]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let l=typeof n._def.value;switch(l){case"string":case"number":case"boolean":return[...r,l];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,l,o)=>o.indexOf(n)===l);return{type:r.length>1?r:r[0],enum:t.reduce((n,l)=>n.includes(l._def.value)?n:[...n,l._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return $o(a,e)}var $o=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Io(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ot[a.innerType._def.typeName],nullable:!0}:{type:[Ot[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function ko(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",ds(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Ao(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let d=n[o];if(d===void 0||d._def===void 0)continue;let f=df(d);f&&t&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),f=!1);let p=B(d._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});p!==void 0&&(s.properties[o]=p,f||r.push(o))}r.length&&(s.required=r);let l=uf(a,e);return l!==void 0&&(s.additionalProperties=l),s}function uf(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function df(a){try{return a.isOptional()}catch{return!0}}var jo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Co=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function No(a,e){return B(a.type._def,e)}function Fo(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Lo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Mo(a){return{not:fe(a)}}function qo(a){return fe(a)}var zo=(a,e)=>B(a.innerType._def,e);var Uo=(a,e,t)=>{switch(e){case O.ZodString:return ma(a,t);case O.ZodNumber:return ko(a,t);case O.ZodObject:return Ao(a,t);case O.ZodBigInt:return vo(a,t);case O.ZodBoolean:return go();case O.ZodDate:return fs(a,t);case O.ZodUndefined:return Mo(t);case O.ZodNull:return Do(t);case O.ZodArray:return mo(a,t);case O.ZodUnion:case O.ZodDiscriminatedUnion:return To(a,t);case O.ZodIntersection:return Po(a,t);case O.ZodTuple:return Lo(a,t);case O.ZodRecord:return va(a,t);case O.ZodLiteral:return Eo(a,t);case O.ZodEnum:return xo(a);case O.ZodNativeEnum:return Ro(a);case O.ZodNullable:return Io(a,t);case O.ZodOptional:return jo(a,t);case O.ZodMap:return wo(a,t);case O.ZodSet:return Fo(a,t);case O.ZodLazy:return()=>a.getter()._def;case O.ZodPromise:return No(a,t);case O.ZodNaN:case O.ZodNever:return Oo(t);case O.ZodEffects:return _o(a,t);case O.ZodAny:return fe(t);case O.ZodUnknown:return qo(t);case O.ZodDefault:return bo(a,t);case O.ZodBranded:return ha(a,t);case O.ZodReadonly:return zo(a,t);case O.ZodCatch:return yo(a,t);case O.ZodPipeline:return Co(a,t);case O.ZodFunction:case O.ZodVoid:case O.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let o=e.override?.(a,e,s,t);if(o!==fo)return o}if(s&&!t){let o=ff(s,e);if(o!==void 0)return o}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=Uo(a,a.typeName,e),l=typeof n=="function"?B(n(),e):n;if(l&&pf(a,e,l),e.postProcess){let o=e.postProcess(l,a,e);return r.jsonSchema=l,o}return r.jsonSchema=l,l}var ff=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:pa(e.currentPath,a.path)};case"none":case"seen":return a.path.lengthe.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},pf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var ms=(a,e)=>{let t=ho(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,p])=>({...d,[f]:B(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),l=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;l!==void 0&&(n.title=l),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var Vo=require("fs"),Zo=require("os"),Ho=require("path"),hf=(0,Ho.join)((0,Zo.homedir)(),".claude-mem","silent.log");function rr(a,e,t=""){let s=new Date().toISOString(),o=((new Error().stack||"").split(`
+`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),d=o?`${o[1].split("/").pop()}:${o[2]}`:"unknown",f=`[${s}] [${d}] ${a}`;if(e!==void 0)try{f+=` ${JSON.stringify(e)}`}catch(p){f+=` [stringify error: ${p}]`}f+=`
+`;try{(0,Vo.appendFileSync)(hf,f)}catch(p){console.error("[silent-debug] Failed to write to log:",p)}return t}var mf=parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10),ga=`http://localhost:${mf}`,Ne={search:"/api/search",timeline:"/api/timeline",decisions:"/api/decisions",changes:"/api/changes",how_it_works:"/api/how-it-works",search_observations:"/api/search/observations",search_sessions:"/api/search/sessions",search_user_prompts:"/api/search/prompts",find_by_concept:"/api/search/by-concept",find_by_file:"/api/search/by-file",find_by_type:"/api/search/by-type",get_recent_context:"/api/context/recent",get_context_timeline:"/api/context/timeline",get_timeline_by_query:"/api/timeline/by-query"};async function Fe(a,e){rr("[mcp-server] \u2192 Worker API",{endpoint:a,params:e});try{let t=new URLSearchParams;for(let[l,o]of Object.entries(e))o!=null&&t.append(l,String(o));let s=`${ga}${a}?${t}`,r=await fetch(s);if(!r.ok){let l=await r.text();throw new Error(`Worker API error (${r.status}): ${l}`)}let n=await r.json();return rr("[mcp-server] \u2190 Worker API success",{endpoint:a}),n}catch(t){return rr("[mcp-server] \u2190 Worker API error",{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function vf(){try{return(await fetch(`${ga}/api/health`)).ok}catch{return!1}}var Bo=[{name:"search",description:'Unified search across all memory types (observations, sessions, and user prompts) using vector-first semantic search (ChromaDB). Returns combined results from all document types. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:i.object({query:i.string().optional().describe("Natural language search query for semantic ranking via ChromaDB vector search. Optional - omit for date-filtered queries only (Chroma cannot filter by date, requires direct SQLite)."),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),type:i.enum(["observations","sessions","prompts"]).optional().describe("Filter by document type (observations, sessions, or prompts). Omit to search all types."),obs_type:i.string().optional().describe('Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change). Only applies when type="observations"'),concepts:i.string().optional().describe('Filter by concept tags (single value or comma-separated list). Only applies when type="observations"'),files:i.string().optional().describe('Filter by file paths (single value or comma-separated list for partial match). Only applies when type="observations"'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.search;return await Fe(e,a)}},{name:"timeline",description:"Fetch timeline of observations around a specific point in time. Supports two modes: anchor-based (fetch observations before/after a specific observation ID) and query-based (semantic search for anchor point). IMPORTANT: Use anchor_id when you know the specific observation, or query to find an anchor point first.",inputSchema:i.object({query:i.string().optional().describe("Natural language query to find anchor observation (query-based mode). Mutually exclusive with anchor_id."),anchor_id:i.number().optional().describe("Observation ID to use as anchor (anchor-based mode). Mutually exclusive with query."),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),obs_type:i.string().optional().describe("Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Ne.timeline;return await Fe(e,a)}},{name:"decisions",description:"Semantic shortcut for finding architectural, design, and implementation decisions. Optimized for decision-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding decisions"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.decisions;return await Fe(e,a)}},{name:"changes",description:"Semantic shortcut for finding code changes, refactorings, and modifications. Optimized for change-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding changes"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.changes;return await Fe(e,a)}},{name:"how_it_works",description:"Semantic shortcut for understanding system architecture, design patterns, and implementation details. Optimized for discovery-type observations with architecture/design keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for understanding how something works"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.how_it_works;return await Fe(e,a)}},{name:"search_observations",description:'[DEPRECATED - Use "search" with type="observations" instead] Search observations (facts/narratives) using FTS5 full-text search. Supports filtering by type, concepts, files, and date range.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_observations;return await Fe(e,a)}},{name:"search_sessions",description:'[DEPRECATED - Use "search" with type="sessions" instead] Search session summaries using FTS5 full-text search. Returns both request_summary and learned_summary fields.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_sessions;return await Fe(e,a)}},{name:"search_user_prompts",description:'[DEPRECATED - Use "search" with type="prompts" instead] Search user prompts using FTS5 full-text search. Searches prompt text only.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_user_prompts;return await Fe(e,a)}},{name:"find_by_concept",description:"Find observations tagged with specific concepts. Returns observations that match any of the provided concept tags.",inputSchema:i.object({concepts:i.string().describe("Concept tag(s) to filter by (single value or comma-separated list)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_concept;return await Fe(e,a)}},{name:"find_by_file",description:"Find observations related to specific file paths. Uses partial matching - searches for file paths containing the provided string.",inputSchema:i.object({files:i.string().describe("File path(s) to filter by (single value or comma-separated list for partial match)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_file;return await Fe(e,a)}},{name:"find_by_type",description:"Find observations of specific types. Returns observations matching any of the provided observation types.",inputSchema:i.object({type:i.string().describe("Observation type(s) to filter by (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_type;return await Fe(e,a)}},{name:"get_recent_context",description:"Get recent session context for timeline display. Returns recent observations, sessions, and user prompts with metadata for building timeline UI.",inputSchema:i.object({limit:i.number().min(1).max(100).default(30).describe("Maximum number of timeline items to return"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.get_recent_context;return await Fe(e,a)}},{name:"get_context_timeline",description:"Get timeline of observations around a specific observation ID. Returns observations before and after the anchor point with metadata for timeline display.",inputSchema:i.object({anchor_id:i.number().describe("Observation ID to use as anchor point"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Ne.get_context_timeline;return await Fe(e,a)}},{name:"get_timeline_by_query",description:"Combined search + timeline tool. First searches for observations matching the query, then returns timeline around the best match. Useful for finding specific observations and viewing their context.",inputSchema:i.object({query:i.string().describe("Natural language query to find anchor observation"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.get_timeline_by_query;return await Fe(e,a)}}],vs=new ua({name:"claude-mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});vs.setRequestHandler(ja,async()=>({tools:Bo.map(a=>({name:a.name,description:a.description,inputSchema:ms(a.inputSchema)}))}));vs.setRequestHandler(Ca,async a=>{let e=Bo.find(t=>t.name===a.params.name);if(!e)throw new Error(`Unknown tool: ${a.params.name}`);try{return await e.handler(a.params.arguments||{})}catch(t){return{content:[{type:"text",text:`Tool execution failed: ${t.message}`}],isError:!0}}});async function Qo(){rr("[mcp-server] Shutting down..."),process.exit(0)}process.on("SIGTERM",Qo);process.on("SIGINT",Qo);async function gf(){let a=new fa;await vs.connect(a),rr("[mcp-server] Claude-mem search server started"),setTimeout(async()=>{await vf()?rr("[mcp-server] Worker available at",ga):(rr("[mcp-server] WARNING: Worker not available at",ga),rr("[mcp-server] Tools will fail until Worker is started"),rr("[mcp-server] Start Worker with: npm run worker:restart"))},0)}gf().catch(a=>{rr("[mcp-server] Fatal error:",a),process.exit(1)});
/*! Bundled license information:
uri-js/dist/es5/uri.all.js:
diff --git a/plugin/scripts/search-server.cjs b/plugin/scripts/search-server.cjs
deleted file mode 100755
index 0c3693f1..00000000
--- a/plugin/scripts/search-server.cjs
+++ /dev/null
@@ -1,658 +0,0 @@
-#!/usr/bin/env node
-"use strict";var eu=Object.create;var zs=Object.defineProperty;var tu=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var su=Object.getPrototypeOf,au=Object.prototype.hasOwnProperty;var z=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),nu=(s,e)=>{for(var r in e)zs(s,r,{get:e[r],enumerable:!0})},ou=(s,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of ru(e))!au.call(s,t)&&t!==r&&zs(s,t,{get:()=>e[t],enumerable:!(a=tu(e,t))||a.enumerable});return s};var Ut=(s,e,r)=>(r=s!=null?eu(su(s)):{},ou(e||!s||!s.__esModule?zs(r,"default",{value:s,enumerable:!0}):r,s));var Jn=z((ls,Kn)=>{(function(s,e){typeof ls=="object"&&typeof Kn<"u"?e(ls):typeof define=="function"&&define.amd?define(["exports"],e):e(s.URI=s.URI||{})})(ls,(function(s){"use strict";function e(){for(var _=arguments.length,m=Array(_),b=0;b<_;b++)m[b]=arguments[b];if(m.length>1){m[0]=m[0].slice(0,-1);for(var w=m.length-1,O=1;O= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=p-g,L=Math.floor,C=String.fromCharCode;function k(_){throw new RangeError(D[_])}function N(_,m){for(var b=[],w=_.length;w--;)b[w]=m(_[w]);return b}function A(_,m){var b=_.split("@"),w="";b.length>1&&(w=b[0]+"@",_=b[1]),_=_.replace(I,".");var O=_.split("."),V=N(O,m).join(".");return w+V}function M(_){for(var m=[],b=0,w=_.length;b=55296&&O<=56319&&b>1,m+=L(m/b);m>$*y>>1;O+=p)m=L(m/$);return L(O+($+1)*m/(m+v))},Z=function(m){var b=[],w=m.length,O=0,V=E,Y=P,ne=m.lastIndexOf(R);ne<0&&(ne=0);for(var ue=0;ue=128&&k("not-basic"),b.push(m.charCodeAt(ue));for(var xe=ne>0?ne+1:0;xe=w&&k("invalid-input");var he=Q(m.charCodeAt(xe++));(he>=p||he>L((h-O)/ve))&&k("overflow"),O+=he*ve;var ce=Re<=Y?g:Re>=Y+y?y:Re-Y;if(heL(h/ge)&&k("overflow"),ve*=ge}var de=b.length+1;Y=K(O-ae,de,ae==0),L(O/de)>h-V&&k("overflow"),V+=L(O/de),O%=de,b.splice(O++,0,V)}return String.fromCodePoint.apply(String,b)},fe=function(m){var b=[];m=M(m);var w=m.length,O=E,V=0,Y=P,ne=!0,ue=!1,xe=void 0;try{for(var ae=m[Symbol.iterator](),ve;!(ne=(ve=ae.next()).done);ne=!0){var Re=ve.value;Re<128&&b.push(C(Re))}}catch(qt){ue=!0,xe=qt}finally{try{!ne&&ae.return&&ae.return()}finally{if(ue)throw xe}}var he=b.length,ce=he;for(he&&b.push(R);ce=O&&zeL((h-V)/We)&&k("overflow"),V+=(ge-O)*We,O=ge;var ct=!0,Mt=!1,vt=void 0;try{for(var Pr=m[Symbol.iterator](),zr;!(ct=(zr=Pr.next()).done);ct=!0){var Zr=zr.value;if(Zrh&&k("overflow"),Zr==O){for(var cr=V,lr=p;;lr+=p){var gt=lr<=Y?g:lr>=Y+y?y:lr-Y;if(cr>6|192).toString(16).toUpperCase()+"%"+(m&63|128).toString(16).toUpperCase():b="%"+(m>>12|224).toString(16).toUpperCase()+"%"+(m>>6&63|128).toString(16).toUpperCase()+"%"+(m&63|128).toString(16).toUpperCase(),b}function ke(_){for(var m="",b=0,w=_.length;b=194&&O<224){if(w-b>=6){var V=parseInt(_.substr(b+4,2),16);m+=String.fromCharCode((O&31)<<6|V&63)}else m+=_.substr(b,6);b+=6}else if(O>=224){if(w-b>=9){var Y=parseInt(_.substr(b+4,2),16),ne=parseInt(_.substr(b+7,2),16);m+=String.fromCharCode((O&15)<<12|(Y&63)<<6|ne&63)}else m+=_.substr(b,9);b+=9}else m+=_.substr(b,3),b+=3}return m}function Rt(_,m){function b(w){var O=ke(w);return O.match(m.UNRESERVED)?O:w}return _.scheme&&(_.scheme=String(_.scheme).replace(m.PCT_ENCODED,b).toLowerCase().replace(m.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(m.PCT_ENCODED,b).replace(m.NOT_USERINFO,we).replace(m.PCT_ENCODED,t)),_.host!==void 0&&(_.host=String(_.host).replace(m.PCT_ENCODED,b).toLowerCase().replace(m.NOT_HOST,we).replace(m.PCT_ENCODED,t)),_.path!==void 0&&(_.path=String(_.path).replace(m.PCT_ENCODED,b).replace(_.scheme?m.NOT_PATH:m.NOT_PATH_NOSCHEME,we).replace(m.PCT_ENCODED,t)),_.query!==void 0&&(_.query=String(_.query).replace(m.PCT_ENCODED,b).replace(m.NOT_QUERY,we).replace(m.PCT_ENCODED,t)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(m.PCT_ENCODED,b).replace(m.NOT_FRAGMENT,we).replace(m.PCT_ENCODED,t)),_}function ht(_){return _.replace(/^0*(.*)/,"$1")||"0"}function Se(_,m){var b=_.match(m.IPV4ADDRESS)||[],w=d(b,2),O=w[1];return O?O.split(".").map(ht).join("."):_}function ye(_,m){var b=_.match(m.IPV6ADDRESS)||[],w=d(b,3),O=w[1],V=w[2];if(O){for(var Y=O.toLowerCase().split("::").reverse(),ne=d(Y,2),ue=ne[0],xe=ne[1],ae=xe?xe.split(":").map(ht):[],ve=ue.split(":").map(ht),Re=m.IPV4ADDRESS.test(ve[ve.length-1]),he=Re?7:8,ce=ve.length-he,ge=Array(he),de=0;de1){var pe=ge.slice(0,He.index),ze=ge.slice(He.index+He.length);Xe=pe.join(":")+"::"+ze.join(":")}else Xe=ge.join(":");return V&&(Xe+="%"+V),Xe}else return _}var kt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ne="".match(/(){0}/)[1]===void 0;function le(_){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={},w=m.iri!==!1?u:l;m.reference==="suffix"&&(_=(m.scheme?m.scheme+":":"")+"//"+_);var O=_.match(kt);if(O){Ne?(b.scheme=O[1],b.userinfo=O[3],b.host=O[4],b.port=parseInt(O[5],10),b.path=O[6]||"",b.query=O[7],b.fragment=O[8],isNaN(b.port)&&(b.port=O[5])):(b.scheme=O[1]||void 0,b.userinfo=_.indexOf("@")!==-1?O[3]:void 0,b.host=_.indexOf("//")!==-1?O[4]:void 0,b.port=parseInt(O[5],10),b.path=O[6]||"",b.query=_.indexOf("?")!==-1?O[7]:void 0,b.fragment=_.indexOf("#")!==-1?O[8]:void 0,isNaN(b.port)&&(b.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?O[4]:void 0)),b.host&&(b.host=ye(Se(b.host,w),w)),b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&!b.path&&b.query===void 0?b.reference="same-document":b.scheme===void 0?b.reference="relative":b.fragment===void 0?b.reference="absolute":b.reference="uri",m.reference&&m.reference!=="suffix"&&m.reference!==b.reference&&(b.error=b.error||"URI is not a "+m.reference+" reference.");var V=Ee[(m.scheme||b.scheme||"").toLowerCase()];if(!m.unicodeSupport&&(!V||!V.unicodeSupport)){if(b.host&&(m.domainHost||V&&V.domainHost))try{b.host=ie.toASCII(b.host.replace(w.PCT_ENCODED,ke).toLowerCase())}catch(Y){b.error=b.error||"Host's domain name can not be converted to ASCII via punycode: "+Y}Rt(b,l)}else Rt(b,w);V&&V.parse&&V.parse(b,m)}else b.error=b.error||"URI can not be parsed.";return b}function Tt(_,m){var b=m.iri!==!1?u:l,w=[];return _.userinfo!==void 0&&(w.push(_.userinfo),w.push("@")),_.host!==void 0&&w.push(ye(Se(String(_.host),b),b).replace(b.IPV6ADDRESS,function(O,V,Y){return"["+V+(Y?"%25"+Y:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(w.push(":"),w.push(String(_.port))),w.length?w.join(""):void 0}var mt=/^\.\.?\//,Lt=/^\/\.(\/|$)/,jt=/^\/\.\.(\/|$)/,Pe=/^\/?(?:.|\n)*?(?=\/|$)/;function Ge(_){for(var m=[];_.length;)if(_.match(mt))_=_.replace(mt,"");else if(_.match(Lt))_=_.replace(Lt,"/");else if(_.match(jt))_=_.replace(jt,"/"),m.pop();else if(_==="."||_==="..")_="";else{var b=_.match(Pe);if(b){var w=b[0];_=_.slice(w.length),m.push(w)}else throw new Error("Unexpected dot segment condition")}return m.join("")}function Me(_){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=m.iri?u:l,w=[],O=Ee[(m.scheme||_.scheme||"").toLowerCase()];if(O&&O.serialize&&O.serialize(_,m),_.host&&!b.IPV6ADDRESS.test(_.host)){if(m.domainHost||O&&O.domainHost)try{_.host=m.iri?ie.toUnicode(_.host):ie.toASCII(_.host.replace(b.PCT_ENCODED,ke).toLowerCase())}catch(ne){_.error=_.error||"Host's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+ne}}Rt(_,b),m.reference!=="suffix"&&_.scheme&&(w.push(_.scheme),w.push(":"));var V=Tt(_,m);if(V!==void 0&&(m.reference!=="suffix"&&w.push("//"),w.push(V),_.path&&_.path.charAt(0)!=="/"&&w.push("/")),_.path!==void 0){var Y=_.path;!m.absolutePath&&(!O||!O.absolutePath)&&(Y=Ge(Y)),V===void 0&&(Y=Y.replace(/^\/\//,"/%2F")),w.push(Y)}return _.query!==void 0&&(w.push("?"),w.push(_.query)),_.fragment!==void 0&&(w.push("#"),w.push(_.fragment)),w.join("")}function Le(_,m){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],O={};return w||(_=le(Me(_,b),b),m=le(Me(m,b),b)),b=b||{},!b.tolerant&&m.scheme?(O.scheme=m.scheme,O.userinfo=m.userinfo,O.host=m.host,O.port=m.port,O.path=Ge(m.path||""),O.query=m.query):(m.userinfo!==void 0||m.host!==void 0||m.port!==void 0?(O.userinfo=m.userinfo,O.host=m.host,O.port=m.port,O.path=Ge(m.path||""),O.query=m.query):(m.path?(m.path.charAt(0)==="/"?O.path=Ge(m.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?O.path="/"+m.path:_.path?O.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+m.path:O.path=m.path,O.path=Ge(O.path)),O.query=m.query):(O.path=_.path,m.query!==void 0?O.query=m.query:O.query=_.query),O.userinfo=_.userinfo,O.host=_.host,O.port=_.port),O.scheme=_.scheme),O.fragment=m.fragment,O}function ot(_,m,b){var w=i({scheme:"null"},b);return Me(Le(le(_,w),le(m,w),w,!0),w)}function Ve(_,m){return typeof _=="string"?_=Me(le(_,m),m):a(_)==="object"&&(_=le(Me(_,m),m)),_}function Hr(_,m,b){return typeof _=="string"?_=Me(le(_,b),b):a(_)==="object"&&(_=Me(_,b)),typeof m=="string"?m=Me(le(m,b),b):a(m)==="object"&&(m=Me(m,b)),_===m}function Us(_,m){return _&&_.toString().replace(!m||!m.iri?l.ESCAPE:u.ESCAPE,we)}function tt(_,m){return _&&_.toString().replace(!m||!m.iri?l.PCT_ENCODED:u.PCT_ENCODED,ke)}var wr={scheme:"http",domainHost:!0,parse:function(m,b){return m.host||(m.error=m.error||"HTTP URIs must have a host."),m},serialize:function(m,b){var w=String(m.scheme).toLowerCase()==="https";return(m.port===(w?443:80)||m.port==="")&&(m.port=void 0),m.path||(m.path="/"),m}},pn={scheme:"https",domainHost:wr.domainHost,parse:wr.parse,serialize:wr.serialize};function fn(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Or={scheme:"ws",domainHost:!0,parse:function(m,b){var w=m;return w.secure=fn(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(m,b){if((m.port===(fn(m)?443:80)||m.port==="")&&(m.port=void 0),typeof m.secure=="boolean"&&(m.scheme=m.secure?"wss":"ws",m.secure=void 0),m.resourceName){var w=m.resourceName.split("?"),O=d(w,2),V=O[0],Y=O[1];m.path=V&&V!=="/"?V:void 0,m.query=Y,m.resourceName=void 0}return m.fragment=void 0,m}},hn={scheme:"wss",domainHost:Or.domainHost,parse:Or.parse,serialize:Or.serialize},kl={},Ll=!0,mn="[A-Za-z0-9\\-\\.\\_\\~"+(Ll?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",it="[0-9A-Fa-f]",jl=r(r("%[EFef]"+it+"%"+it+it+"%"+it+it)+"|"+r("%[89A-Fa-f]"+it+"%"+it+it)+"|"+r("%"+it+it)),Fl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ml="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",ql=e(Ml,'[\\"\\\\]'),Ul="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Bl=new RegExp(mn,"g"),ir=new RegExp(jl,"g"),Vl=new RegExp(e("[^]",Fl,"[\\.]",'[\\"]',ql),"g"),vn=new RegExp(e("[^]",mn,Ul),"g"),Hl=vn;function Bs(_){var m=ke(_);return m.match(Bl)?m:_}var gn={scheme:"mailto",parse:function(m,b){var w=m,O=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var V=!1,Y={},ne=w.query.split("&"),ue=0,xe=ne.length;ue{"use strict";Yn.exports=function s(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var a,t,n;if(Array.isArray(e)){if(a=e.length,a!=r.length)return!1;for(t=a;t--!==0;)if(!s(e[t],r[t]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(n=Object.keys(e),a=n.length,a!==Object.keys(r).length)return!1;for(t=a;t--!==0;)if(!Object.prototype.hasOwnProperty.call(r,n[t]))return!1;for(t=a;t--!==0;){var i=n[t];if(!s(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var to=z((Em,eo)=>{"use strict";eo.exports=function(e){for(var r=0,a=e.length,t=0,n;t=55296&&n<=56319&&t{"use strict";ao.exports={copy:np,checkDataType:va,checkDataTypes:op,coerceToTypes:ip,toHash:ya,getProperty:_a,escapeQuotes:ba,equal:us(),ucs2length:to(),varOccurences:up,varReplace:dp,schemaHasRules:pp,schemaHasRulesExcept:fp,schemaUnknownRules:hp,toQuotedString:ga,getPathExpr:mp,getPath:vp,getData:_p,unescapeFragment:bp,unescapeJsonPointer:Sa,escapeFragment:Ep,escapeJsonPointer:Ea};function np(s,e){e=e||{};for(var r in s)e[r]=s[r];return e}function va(s,e,r,a){var t=a?" !== ":" === ",n=a?" || ":" && ",i=a?"!":"",o=a?"":"!";switch(s){case"null":return e+t+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+t+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+t+'"number"'+n+o+"("+e+" % 1)"+n+e+t+e+(r?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+t+'"'+s+'"'+(r?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+t+'"'+s+'"'}}function op(s,e,r){switch(s.length){case 1:return va(s[0],e,r,!0);default:var a="",t=ya(s);t.array&&t.object&&(a=t.null?"(":"(!"+e+" || ",a+="typeof "+e+' !== "object")',delete t.null,delete t.array,delete t.object),t.number&&delete t.integer;for(var n in t)a+=(a?" && ":"")+va(n,e,r,!0);return a}}var ro=ya(["string","number","integer","boolean","null"]);function ip(s,e){if(Array.isArray(e)){for(var r=[],a=0;a=e)throw new Error("Cannot access property/index "+a+" levels up, current level is "+e);return r[e-a]}if(a>e)throw new Error("Cannot access data "+a+" levels up, current level is "+e);if(n="data"+(e-a||""),!t)return n}for(var o=n,l=t.split("/"),u=0;u{"use strict";var Sp=ar();no.exports=xp;function xp(s){Sp.copy(s,this)}});var io=z((Rm,oo)=>{"use strict";var Nt=oo.exports=function(s,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var a=typeof r=="function"?r:r.pre||function(){},t=r.post||function(){};ds(e,a,t,s,"",s)};Nt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Nt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nt.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nt.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 ds(s,e,r,a,t,n,i,o,l,u){if(a&&typeof a=="object"&&!Array.isArray(a)){e(a,t,n,i,o,l,u);for(var d in a){var f=a[d];if(Array.isArray(f)){if(d in Nt.arrayKeywords)for(var h=0;h{"use strict";var Ur=Jn(),co=us(),ms=ar(),ps=xa(),Tp=io();po.exports=$t;$t.normalizeId=At;$t.fullPath=fs;$t.url=hs;$t.ids=Np;$t.inlineRef=Ra;$t.schema=vs;function $t(s,e,r){var a=this._refs[r];if(typeof a=="string")if(this._refs[a])a=this._refs[a];else return $t.call(this,s,e,a);if(a=a||this._schemas[r],a instanceof ps)return Ra(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var t=vs.call(this,e,r),n,i,o;return t&&(n=t.schema,e=t.root,o=t.baseId),n instanceof ps?i=n.validate||s.call(this,n.schema,e,void 0,o):n!==void 0&&(i=Ra(n,this._opts.inlineRefs)?n:s.call(this,n,e,void 0,o)),i}function vs(s,e){var r=Ur.parse(e),a=uo(r),t=fs(this._getId(s.schema));if(Object.keys(s.schema).length===0||a!==t){var n=At(a),i=this._refs[n];if(typeof i=="string")return wp.call(this,s,i,r);if(i instanceof ps)i.validate||this._compile(i),s=i;else if(i=this._schemas[n],i instanceof ps){if(i.validate||this._compile(i),n==At(e))return{schema:i,root:s,baseId:t};s=i}else return;if(!s.schema)return;t=fs(this._getId(s.schema))}return lo.call(this,r,t,s.schema,s)}function wp(s,e,r){var a=vs.call(this,s,e);if(a){var t=a.schema,n=a.baseId;s=a.root;var i=this._getId(t);return i&&(n=hs(n,i)),lo.call(this,r,n,t,s)}}var Op=ms.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function lo(s,e,r,a){if(s.fragment=s.fragment||"",s.fragment.slice(0,1)=="/"){for(var t=s.fragment.split("/"),n=1;n{"use strict";var Oa=gs();ho.exports={Validation:fo(Ap),MissingRef:fo(Pa)};function Ap(s){this.message="validation failed",this.errors=s,this.ajv=this.validation=!0}Pa.message=function(s,e){return"can't resolve reference "+e+" from id "+s};function Pa(s,e,r){this.message=r||Pa.message(s,e),this.missingRef=Oa.url(s,e),this.missingSchema=Oa.normalizeId(Oa.fullPath(this.missingRef))}function fo(s){return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}});var Ia=z((Om,mo)=>{"use strict";mo.exports=function(s,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,a=e.cmp&&(function(n){return function(i){return function(o,l){var u={key:o,value:i[o]},d={key:l,value:i[l]};return n(u,d)}}})(e.cmp),t=[];return(function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,l;if(Array.isArray(i)){for(l="[",o=0;o{"use strict";vo.exports=function(e,r,a){var t="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var u="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(t+=" var validate = ",n&&(e.async=!0,t+="async "),t+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(t+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var r="false schema",d=e.level,f=e.dataLevel,h=e.schema[r],p=e.schemaPath+e.util.getProperty(r),g=e.errSchemaPath+"/"+r,T=!e.opts.allErrors,D,y="data"+(f||""),R="valid"+d;if(e.schema===!1){e.isTop?T=!0:t+=" var "+R+" = false; ";var v=v||[];v.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(D||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'boolean schema is false' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),t+=" } "):t+=" {} ";var x=t;t=v.pop(),!e.compositeRule&&T?e.async?t+=" throw new ValidationError(["+x+"]); ":t+=" validate.errors = ["+x+"]; return false; ":t+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?t+=" return data; ":t+=" validate.errors = null; return true; ":t+=" var "+R+" = true; ";return e.isTop&&(t+=" }; return validate; "),t}if(e.isTop){var P=e.isTop,d=e.level=0,f=e.dataLevel=0,y="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 E="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}t+=" var vErrors = null; ",t+=" var errors = 0; ",t+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,f=e.dataLevel,y="data"+(f||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");t+=" var errs_"+d+" = errors;"}var R="valid"+d,T=!e.opts.allErrors,S="",I="",D,$=e.schema.type,L=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(L?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],L=!0)),L&&$.length==1&&($=$[0],L=!1),e.schema.$ref&&i){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&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(t+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var C=e.util.coerceToTypes(e.opts.coerceTypes,$);var k=e.RULES.types[$];if(C||L||k===!0||k&&!Pe(k)){var p=e.schemaPath+".type",g=e.errSchemaPath+"/type",p=e.schemaPath+".type",g=e.errSchemaPath+"/type",N=L?"checkDataTypes":"checkDataType";if(t+=" if ("+e.util[N]($,y,e.opts.strictNumbers,!0)+") { ",C){var A="dataType"+d,M="coerced"+d;t+=" var "+A+" = typeof "+y+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(t+=" if ("+A+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+A+" = typeof "+y+"; if ("+e.util.checkDataType(e.schema.type,y,e.opts.strictNumbers)+") "+M+" = "+y+"; } "),t+=" if ("+M+" !== undefined) ; ";var W=C;if(W)for(var Q,te=-1,K=W.length-1;te{"use strict";var _s=gs(),Es=ar(),yo=ys(),$p=Ia(),go=Na(),Dp=Es.ucs2length,Cp=us(),kp=yo.Validation;bo.exports=Aa;function Aa(s,e,r,a){var t=this,n=this._opts,i=[void 0],o={},l=[],u={},d=[],f={},h=[];e=e||{schema:s,refVal:i,refs:o};var p=Lp.call(this,s,e,a),g=this._compilations[p.index];if(p.compiling)return g.callValidate=E;var y=this._formats,v=this.RULES;try{var x=R(s,e,r,a);g.validate=x;var P=g.callValidate;return P&&(P.schema=x.schema,P.errors=null,P.refs=x.refs,P.refVal=x.refVal,P.root=x.root,P.$async=x.$async,n.sourceCode&&(P.source=x.source)),x}finally{jp.call(this,s,e,a)}function E(){var N=g.validate,A=N.apply(this,arguments);return E.errors=N.errors,A}function R(N,A,M,W){var Q=!A||A&&A.schema==N;if(A.schema!=e.schema)return Aa.call(t,N,A,M,W);var te=N.$async===!0,K=go({isTop:!0,schema:N,isRoot:Q,baseId:W,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:yo.MissingRef,RULES:v,validate:go,util:Es,resolve:_s,resolveRef:T,usePattern:L,useDefault:C,useCustomRule:k,opts:n,formats:y,logger:t.logger,self:t});K=bs(i,qp)+bs(l,Fp)+bs(d,Mp)+bs(h,Up)+K,n.processCode&&(K=n.processCode(K,N));var Z;try{var fe=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);Z=fe(t,v,y,e,i,d,h,Cp,Dp,kp),i[0]=Z}catch(Te){throw t.logger.error("Error compiling schema, function code:",K),Te}return Z.schema=N,Z.errors=null,Z.refs=o,Z.refVal=i,Z.root=Q?Z:A,te&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:K,patterns:l,defaults:d}),Z}function T(N,A,M){A=_s.url(N,A);var W=o[A],Q,te;if(W!==void 0)return Q=i[W],te="refVal["+W+"]",$(Q,te);if(!M&&e.refs){var K=e.refs[A];if(K!==void 0)return Q=e.refVal[K],te=S(A,Q),$(Q,te)}te=S(A);var Z=_s.call(t,R,e,A);if(Z===void 0){var fe=r&&r[A];fe&&(Z=_s.inlineRef(fe,n.inlineRefs)?fe:Aa.call(t,fe,e,r,N))}if(Z===void 0)I(A);else return D(A,Z),$(Z,te)}function S(N,A){var M=i.length;return i[M]=A,o[N]=M,"refVal"+M}function I(N){delete o[N]}function D(N,A){var M=o[N];i[M]=A}function $(N,A){return typeof N=="object"||typeof N=="boolean"?{code:A,schema:N,inline:!0}:{code:A,$async:N&&!!N.$async}}function L(N){var A=u[N];return A===void 0&&(A=u[N]=l.length,l[A]=N),"pattern"+A}function C(N){switch(typeof N){case"boolean":case"number":return""+N;case"string":return Es.toQuotedString(N);case"object":if(N===null)return"null";var A=$p(N),M=f[A];return M===void 0&&(M=f[A]=d.length,d[M]=N),"default"+M}}function k(N,A,M,W){if(t._opts.validateSchema!==!1){var Q=N.definition.dependencies;if(Q&&!Q.every(function(we){return Object.prototype.hasOwnProperty.call(M,we)}))throw new Error("parent schema must have all required keywords: "+Q.join(","));var te=N.definition.validateSchema;if(te){var K=te(A);if(!K){var Z="keyword schema is invalid: "+t.errorsText(te.errors);if(t._opts.validateSchema=="log")t.logger.error(Z);else throw new Error(Z)}}}var fe=N.definition.compile,Te=N.definition.inline,Ce=N.definition.macro,ie;if(fe)ie=fe.call(t,A,M,W);else if(Ce)ie=Ce.call(t,A,M,W),n.validateSchema!==!1&&t.validateSchema(ie,!0);else if(Te)ie=Te.call(t,W,N.keyword,A,M);else if(ie=N.definition.validate,!ie)return;if(ie===void 0)throw new Error('custom keyword "'+N.keyword+'"failed to compile');var Ee=h.length;return h[Ee]=ie,{code:"customRule"+Ee,validate:ie}}}function Lp(s,e,r){var a=_o.call(this,s,e,r);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:s,root:e,baseId:r},{index:a,compiling:!1})}function jp(s,e,r){var a=_o.call(this,s,e,r);a>=0&&this._compilations.splice(a,1)}function _o(s,e,r){for(var a=0;a{"use strict";var Ss=So.exports=function(){this._cache={}};Ss.prototype.put=function(e,r){this._cache[e]=r};Ss.prototype.get=function(e){return this._cache[e]};Ss.prototype.del=function(e){delete this._cache[e]};Ss.prototype.clear=function(){this._cache={}}});var ko=z((Am,Co)=>{"use strict";var Bp=ar(),Vp=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Hp=[0,31,28,31,30,31,30,31,31,30,31,30,31],zp=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ro=/^(?=.{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,Zp=/^(?:[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,Gp=/^(?:[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,To=/^(?:(?:[^\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,wo=/^(?:(?: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,Oo=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Po=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Io=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,No=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Co.exports=xs;function xs(s){return s=s=="full"?"full":"fast",Bp.copy(xs[s])}xs.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":To,url:wo,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:Ro,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:Do,uuid:Oo,"json-pointer":Po,"json-pointer-uri-fragment":Io,"relative-json-pointer":No};xs.full={date:Ao,time:$o,"date-time":Qp,uri:Jp,"uri-reference":Gp,"uri-template":To,url:wo,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:Ro,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:Do,uuid:Oo,"json-pointer":Po,"json-pointer-uri-fragment":Io,"relative-json-pointer":No};function Xp(s){return s%4===0&&(s%100!==0||s%400===0)}function Ao(s){var e=s.match(Vp);if(!e)return!1;var r=+e[1],a=+e[2],t=+e[3];return a>=1&&a<=12&&t>=1&&t<=(a==2&&Xp(r)?29:Hp[a])}function $o(s,e){var r=s.match(zp);if(!r)return!1;var a=r[1],t=r[2],n=r[3],i=r[5];return(a<=23&&t<=59&&n<=59||a==23&&t==59&&n==60)&&(!e||i)}var Wp=/t|\s/i;function Qp(s){var e=s.split(Wp);return e.length==2&&Ao(e[0])&&$o(e[1],!0)}var Kp=/\/|:/;function Jp(s){return Kp.test(s)&&Zp.test(s)}var Yp=/[^\\]\\Z/;function Do(s){if(Yp.test(s))return!1;try{return new RegExp(s),!0}catch{return!1}}});var jo=z(($m,Lo)=>{"use strict";Lo.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),f="valid"+n,h,p;if(o=="#"||o=="#/")e.isRoot?(h=e.async,p="validate"):(h=e.root.schema.$async===!0,p="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===void 0){var y=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(y);var v=v||[];v.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(t+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(t+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),t+=" } "):t+=" {} ";var x=t;t=v.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+x+"]); ":t+=" validate.errors = ["+x+"]; return false; ":t+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(t+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(y),u&&(t+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,y)}else if(g.inline){var P=e.util.copy(e);P.level++;var E="valid"+P.level;P.schema=g.schema,P.schemaPath="",P.errSchemaPath=o;var R=e.validate(P).replace(/validate\.schema/g,g.code);t+=" "+R+" ",u&&(t+=" if ("+E+") { ")}else h=g.$async===!0||e.async&&g.$async!==!1,p=g.code}if(p){var v=v||[];v.push(t),t="",e.opts.passContext?t+=" "+p+".call(this, ":t+=" "+p+"( ",t+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(t+=" + "+e.errorPath);var T=i?"data"+(i-1||""):"parentData",S=i?e.dataPathArr[i]:"parentDataProperty";t+=" , "+T+" , "+S+", rootData) ";var I=t;if(t=v.pop(),h){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(t+=" var "+f+"; "),t+=" try { await "+I+"; ",u&&(t+=" "+f+" = true; "),t+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(t+=" "+f+" = false; "),t+=" } ",u&&(t+=" if ("+f+") { ")}else t+=" if (!"+I+") { if (vErrors === null) vErrors = "+p+".errors; else vErrors = vErrors.concat("+p+".errors); errors = vErrors.length; } ",u&&(t+=" else { ")}return t}});var Mo=z((Dm,Fo)=>{"use strict";Fo.exports=function(e,r,a){var t=" ",n=e.schema[r],i=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,u=e.util.copy(e),d="";u.level++;var f="valid"+u.level,h=u.baseId,p=!0,g=n;if(g)for(var y,v=-1,x=g.length-1;v0||y===!1:e.util.schemaHasRules(y,e.RULES.all))&&(p=!1,u.schema=y,u.schemaPath=i+"["+v+"]",u.errSchemaPath=o+"/"+v,t+=" "+e.validate(u)+" ",u.baseId=h,l&&(t+=" if ("+f+") { ",d+="}"));return l&&(p?t+=" if (true) { ":t+=" "+d.slice(0,-1)+" "),t}});var Uo=z((Cm,qo)=>{"use strict";qo.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p="errs__"+n,g=e.util.copy(e),y="";g.level++;var v="valid"+g.level,x=o.every(function(D){return e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all)});if(x){var P=g.baseId;t+=" var "+p+" = errors; var "+h+" = false; ";var E=e.compositeRule;e.compositeRule=g.compositeRule=!0;var R=o;if(R)for(var T,S=-1,I=R.length-1;S{"use strict";Bo.exports=function(e,r,a){var t=" ",n=e.schema[r],i=e.errSchemaPath+"/"+r,o=!e.opts.allErrors,l=e.util.toQuotedString(n);return e.opts.$comment===!0?t+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(t+=" self._opts.$comment("+l+", "+e.util.toQuotedString(i)+", validate.root.schema);"),t}});var zo=z((Lm,Ho)=>{"use strict";Ho.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p=e.opts.$data&&o&&o.$data,g;p?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o,p||(t+=" var schema"+n+" = validate.schema"+l+";"),t+="var "+h+" = equal("+f+", schema"+n+"); if (!"+h+") { ";var y=y||[];y.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be equal to constant' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var v=t;return t=y.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+v+"]); ":t+=" validate.errors = ["+v+"]; return false; ":t+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" }",d&&(t+=" else { "),t}});var Go=z((jm,Zo)=>{"use strict";Zo.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p="errs__"+n,g=e.util.copy(e),y="";g.level++;var v="valid"+g.level,x="i"+n,P=g.dataLevel=e.dataLevel+1,E="data"+P,R=e.baseId,T=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(t+="var "+p+" = errors;var "+h+";",T){var S=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=l,g.errSchemaPath=u,t+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+f+".length; "+x+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var I=f+"["+x+"]";g.dataPathArr[P]=x;var D=e.validate(g);g.baseId=R,e.util.varOccurences(D,E)<2?t+=" "+e.util.varReplace(D,E,I)+" ":t+=" var "+E+" = "+I+"; "+D+" ",t+=" if ("+v+") break; } ",e.compositeRule=g.compositeRule=S,t+=" "+y+" if (!"+v+") {"}else t+=" if ("+f+".length == 0) {";var $=$||[];$.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should contain a valid item' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var L=t;return t=$.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+L+"]); ":t+=" validate.errors = ["+L+"]; return false; ":t+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { ",T&&(t+=" errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } "),e.opts.allErrors&&(t+=" } "),t}});var Wo=z((Fm,Xo)=>{"use strict";Xo.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="errs__"+n,p=e.util.copy(e),g="";p.level++;var y="valid"+p.level,v={},x={},P=e.opts.ownProperties;for(S in o)if(S!="__proto__"){var E=o[S],R=Array.isArray(E)?x:v;R[S]=E}t+="var "+h+" = errors;";var T=e.errorPath;t+="var missing"+n+";";for(var S in x)if(R=x[S],R.length){if(t+=" if ( "+f+e.util.getProperty(S)+" !== undefined ",P&&(t+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(S)+"') "),d){t+=" && ( ";var I=R;if(I)for(var D,$=-1,L=I.length-1;$0||E===!1:e.util.schemaHasRules(E,e.RULES.all))&&(t+=" "+y+" = true; if ( "+f+e.util.getProperty(S)+" !== undefined ",P&&(t+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(S)+"') "),t+=") { ",p.schema=E,p.schemaPath=l+e.util.getProperty(S),p.errSchemaPath=u+"/"+e.util.escapeFragment(S),t+=" "+e.validate(p)+" ",p.baseId=Z,t+=" } ",d&&(t+=" if ("+y+") { ",g+="}"))}return d&&(t+=" "+g+" if ("+h+" == errors) {"),t}});var Ko=z((Mm,Qo)=>{"use strict";Qo.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p=e.opts.$data&&o&&o.$data,g;p?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var y="i"+n,v="schema"+n;p||(t+=" var "+v+" = validate.schema"+l+";"),t+="var "+h+";",p&&(t+=" if (schema"+n+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+n+")) "+h+" = false; else {"),t+=""+h+" = false;for (var "+y+"=0; "+y+"<"+v+".length; "+y+"++) if (equal("+f+", "+v+"["+y+"])) { "+h+" = true; break; }",p&&(t+=" } "),t+=" if (!"+h+") { ";var x=x||[];x.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var P=t;return t=x.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+P+"]); ":t+=" validate.errors = ["+P+"]; return false; ":t+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" }",d&&(t+=" else { "),t}});var Yo=z((qm,Jo)=>{"use strict";Jo.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||"");if(e.opts.format===!1)return d&&(t+=" if (true) { "),t;var h=e.opts.$data&&o&&o.$data,p;h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o;var g=e.opts.unknownFormats,y=Array.isArray(g);if(h){var v="format"+n,x="isObject"+n,P="formatType"+n;t+=" var "+v+" = formats["+p+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+P+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(t+=" var async"+n+" = "+v+".async; "),t+=" "+v+" = "+v+".validate; } if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'string') || "),t+=" (",g!="ignore"&&(t+=" ("+p+" && !"+v+" ",y&&(t+=" && self._opts.unknownFormats.indexOf("+p+") == -1 "),t+=") || "),t+=" ("+v+" && "+P+" == '"+a+"' && !(typeof "+v+" == 'function' ? ",e.async?t+=" (async"+n+" ? await "+v+"("+f+") : "+v+"("+f+")) ":t+=" "+v+"("+f+") ",t+=" : "+v+".test("+f+"))))) {"}else{var v=e.formats[o];if(!v){if(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(t+=" if (true) { "),t;if(y&&g.indexOf(o)>=0)return d&&(t+=" if (true) { "),t;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,P=x&&v.type||"string";if(x){var E=v.async===!0;v=v.validate}if(P!=a)return d&&(t+=" if (true) { "),t;if(E){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(o)+".validate";t+=" if (!(await "+R+"("+f+"))) { "}else{t+=" if (! ";var R="formats"+e.util.getProperty(o);x&&(R+=".validate"),typeof v=="function"?t+=" "+R+"("+f+") ":t+=" "+R+".test("+f+") ",t+=") { "}}var T=T||[];T.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",h?t+=""+p:t+=""+e.util.toQuotedString(o),t+=" } ",e.opts.messages!==!1&&(t+=` , message: 'should match format "`,h?t+="' + "+p+" + '":t+=""+e.util.escapeQuotes(o),t+=`"' `),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+e.util.toQuotedString(o),t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var S=t;return t=T.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",d&&(t+=" else { "),t}});var ti=z((Um,ei)=>{"use strict";ei.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p="errs__"+n,g=e.util.copy(e);g.level++;var y="valid"+g.level,v=e.schema.then,x=e.schema.else,P=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),E=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),R=g.baseId;if(P||E){var T;g.createErrors=!1,g.schema=o,g.schemaPath=l,g.errSchemaPath=u,t+=" var "+p+" = errors; var "+h+" = true; ";var S=e.compositeRule;e.compositeRule=g.compositeRule=!0,t+=" "+e.validate(g)+" ",g.baseId=R,g.createErrors=!0,t+=" errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=S,P?(t+=" if ("+y+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",t+=" "+e.validate(g)+" ",g.baseId=R,t+=" "+h+" = "+y+"; ",P&&E?(T="ifClause"+n,t+=" var "+T+" = 'then'; "):T="'then'",t+=" } ",E&&(t+=" else { ")):t+=" if (!"+y+") { ",E&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",t+=" "+e.validate(g)+" ",g.baseId=R,t+=" "+h+" = "+y+"; ",P&&E?(T="ifClause"+n,t+=" var "+T+" = 'else'; "):T="'else'",t+=" } "),t+=" if (!"+h+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+T+" } ",e.opts.messages!==!1&&(t+=` , message: 'should match "' + `+T+` + '" schema' `),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+=" } ",d&&(t+=" else { ")}else d&&(t+=" if (true) { ");return t}});var si=z((Bm,ri)=>{"use strict";ri.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p="errs__"+n,g=e.util.copy(e),y="";g.level++;var v="valid"+g.level,x="i"+n,P=g.dataLevel=e.dataLevel+1,E="data"+P,R=e.baseId;if(t+="var "+p+" = errors;var "+h+";",Array.isArray(o)){var T=e.schema.additionalItems;if(T===!1){t+=" "+h+" = "+f+".length <= "+o.length+"; ";var S=u;u=e.errSchemaPath+"/additionalItems",t+=" if (!"+h+") { ";var I=I||[];I.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var D=t;t=I.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+D+"]); ":t+=" validate.errors = ["+D+"]; return false; ":t+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u=S,d&&(y+="}",t+=" else { ")}var $=o;if($){for(var L,C=-1,k=$.length-1;C0||L===!1:e.util.schemaHasRules(L,e.RULES.all)){t+=" "+v+" = true; if ("+f+".length > "+C+") { ";var N=f+"["+C+"]";g.schema=L,g.schemaPath=l+"["+C+"]",g.errSchemaPath=u+"/"+C,g.errorPath=e.util.getPathExpr(e.errorPath,C,e.opts.jsonPointers,!0),g.dataPathArr[P]=C;var A=e.validate(g);g.baseId=R,e.util.varOccurences(A,E)<2?t+=" "+e.util.varReplace(A,E,N)+" ":t+=" var "+E+" = "+N+"; "+A+" ",t+=" } ",d&&(t+=" if ("+v+") { ",y+="}")}}if(typeof T=="object"&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))){g.schema=T,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",t+=" "+v+" = true; if ("+f+".length > "+o.length+") { for (var "+x+" = "+o.length+"; "+x+" < "+f+".length; "+x+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var N=f+"["+x+"]";g.dataPathArr[P]=x;var A=e.validate(g);g.baseId=R,e.util.varOccurences(A,E)<2?t+=" "+e.util.varReplace(A,E,N)+" ":t+=" var "+E+" = "+N+"; "+A+" ",d&&(t+=" if (!"+v+") break; "),t+=" } } ",d&&(t+=" if ("+v+") { ",y+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){g.schema=o,g.schemaPath=l,g.errSchemaPath=u,t+=" for (var "+x+" = 0; "+x+" < "+f+".length; "+x+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var N=f+"["+x+"]";g.dataPathArr[P]=x;var A=e.validate(g);g.baseId=R,e.util.varOccurences(A,E)<2?t+=" "+e.util.varReplace(A,E,N)+" ":t+=" var "+E+" = "+N+"; "+A+" ",d&&(t+=" if (!"+v+") break; "),t+=" }"}return d&&(t+=" "+y+" if ("+p+" == errors) {"),t}});var $a=z((Vm,ai)=>{"use strict";ai.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,R,f="data"+(i||""),h=e.opts.$data&&o&&o.$data,p;h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o;var g=r=="maximum",y=g?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[y],x=e.opts.$data&&v&&v.$data,P=g?"<":">",E=g?">":"<",R=void 0;if(!(h||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(y+" must be number or boolean");if(x){var T=e.util.getData(v.$data,i,e.dataPathArr),S="exclusive"+n,I="exclType"+n,D="exclIsNumber"+n,$="op"+n,L="' + "+$+" + '";t+=" var schemaExcl"+n+" = "+T+"; ",T="schemaExcl"+n,t+=" var "+S+"; var "+I+" = typeof "+T+"; if ("+I+" != 'boolean' && "+I+" != 'undefined' && "+I+" != 'number') { ";var R=y,C=C||[];C.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: '"+y+" should be boolean' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var k=t;t=C.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+k+"]); ":t+=" validate.errors = ["+k+"]; return false; ":t+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" "+I+" == 'number' ? ( ("+S+" = "+p+" === undefined || "+T+" "+P+"= "+p+") ? "+f+" "+E+"= "+T+" : "+f+" "+E+" "+p+" ) : ( ("+S+" = "+T+" === true) ? "+f+" "+E+"= "+p+" : "+f+" "+E+" "+p+" ) || "+f+" !== "+f+") { var op"+n+" = "+S+" ? '"+P+"' : '"+P+"='; ",o===void 0&&(R=y,u=e.errSchemaPath+"/"+y,p=T,h=x)}else{var D=typeof v=="number",L=P;if(D&&h){var $="'"+L+"'";t+=" if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" ( "+p+" === undefined || "+v+" "+P+"= "+p+" ? "+f+" "+E+"= "+v+" : "+f+" "+E+" "+p+" ) || "+f+" !== "+f+") { "}else{D&&o===void 0?(S=!0,R=y,u=e.errSchemaPath+"/"+y,p=v,E+="="):(D&&(p=Math[g?"min":"max"](v,o)),v===(D?p:!0)?(S=!0,R=y,u=e.errSchemaPath+"/"+y,E+="="):(S=!1,L+="="));var $="'"+L+"'";t+=" if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" "+f+" "+E+" "+p+" || "+f+" !== "+f+") { "}}R=R||r;var C=C||[];C.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+$+", limit: "+p+", exclusive: "+S+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be "+L+" ",h?t+="' + "+p:t+=""+p+"'"),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var k=t;return t=C.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+k+"]); ":t+=" validate.errors = ["+k+"]; return false; ":t+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",d&&(t+=" else { "),t}});var Da=z((Hm,ni)=>{"use strict";ni.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,y,f="data"+(i||""),h=e.opts.$data&&o&&o.$data,p;if(h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o,!(h||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxItems"?">":"<";t+="if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" "+f+".length "+g+" "+p+") { ";var y=r,v=v||[];v.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have ",r=="maxItems"?t+="more":t+="fewer",t+=" than ",h?t+="' + "+p+" + '":t+=""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var x=t;return t=v.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+x+"]); ":t+=" validate.errors = ["+x+"]; return false; ":t+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",d&&(t+=" else { "),t}});var Ca=z((zm,oi)=>{"use strict";oi.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,y,f="data"+(i||""),h=e.opts.$data&&o&&o.$data,p;if(h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o,!(h||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxLength"?">":"<";t+="if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),e.opts.unicode===!1?t+=" "+f+".length ":t+=" ucs2length("+f+") ",t+=" "+g+" "+p+") { ";var y=r,v=v||[];v.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be ",r=="maxLength"?t+="longer":t+="shorter",t+=" than ",h?t+="' + "+p+" + '":t+=""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var x=t;return t=v.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+x+"]); ":t+=" validate.errors = ["+x+"]; return false; ":t+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",d&&(t+=" else { "),t}});var ka=z((Zm,ii)=>{"use strict";ii.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,y,f="data"+(i||""),h=e.opts.$data&&o&&o.$data,p;if(h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o,!(h||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxProperties"?">":"<";t+="if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" Object.keys("+f+").length "+g+" "+p+") { ";var y=r,v=v||[];v.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have ",r=="maxProperties"?t+="more":t+="fewer",t+=" than ",h?t+="' + "+p+" + '":t+=""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var x=t;return t=v.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+x+"]); ":t+=" validate.errors = ["+x+"]; return false; ":t+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",d&&(t+=" else { "),t}});var li=z((Gm,ci)=>{"use strict";ci.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h=e.opts.$data&&o&&o.$data,p;if(h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o,!(h||typeof o=="number"))throw new Error(r+" must be number");t+="var division"+n+";if (",h&&(t+=" "+p+" !== undefined && ( typeof "+p+" != 'number' || "),t+=" (division"+n+" = "+f+" / "+p+", ",e.opts.multipleOfPrecision?t+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":t+=" division"+n+" !== parseInt(division"+n+") ",t+=" ) ",h&&(t+=" ) "),t+=" ) { ";var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be multiple of ",h?t+="' + "+p:t+=""+p+"'"),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var y=t;return t=g.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+y+"]); ":t+=" validate.errors = ["+y+"]; return false; ":t+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",d&&(t+=" else { "),t}});var di=z((Xm,ui)=>{"use strict";ui.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="errs__"+n,p=e.util.copy(e);p.level++;var g="valid"+p.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){p.schema=o,p.schemaPath=l,p.errSchemaPath=u,t+=" var "+h+" = errors; ";var y=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.createErrors=!1;var v;p.opts.allErrors&&(v=p.opts.allErrors,p.opts.allErrors=!1),t+=" "+e.validate(p)+" ",p.createErrors=!0,v&&(p.opts.allErrors=v),e.compositeRule=p.compositeRule=y,t+=" if ("+g+") { ";var x=x||[];x.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var P=t;t=x.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+P+"]); ":t+=" validate.errors = ["+P+"]; return false; ":t+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else t+=" var err = ",e.createErrors!==!1?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(t+=" if (false) { ");return t}});var fi=z((Wm,pi)=>{"use strict";pi.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p="errs__"+n,g=e.util.copy(e),y="";g.level++;var v="valid"+g.level,x=g.baseId,P="prevValid"+n,E="passingSchemas"+n;t+="var "+p+" = errors , "+P+" = false , "+h+" = false , "+E+" = null; ";var R=e.compositeRule;e.compositeRule=g.compositeRule=!0;var T=o;if(T)for(var S,I=-1,D=T.length-1;I0||S===!1:e.util.schemaHasRules(S,e.RULES.all))?(g.schema=S,g.schemaPath=l+"["+I+"]",g.errSchemaPath=u+"/"+I,t+=" "+e.validate(g)+" ",g.baseId=x):t+=" var "+v+" = true; ",I&&(t+=" if ("+v+" && "+P+") { "+h+" = false; "+E+" = ["+E+", "+I+"]; } else { ",y+="}"),t+=" if ("+v+") { "+h+" = "+P+" = true; "+E+" = "+I+"; }";return e.compositeRule=g.compositeRule=R,t+=""+y+"if (!"+h+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+E+" } ",e.opts.messages!==!1&&(t+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+="} else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; }",e.opts.allErrors&&(t+=" } "),t}});var mi=z((Qm,hi)=>{"use strict";hi.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h=e.opts.$data&&o&&o.$data,p;h?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",p="schema"+n):p=o;var g=h?"(new RegExp("+p+"))":e.usePattern(o);t+="if ( ",h&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'string') || "),t+=" !"+g+".test("+f+") ) { ";var y=y||[];y.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",h?t+=""+p:t+=""+e.util.toQuotedString(o),t+=" } ",e.opts.messages!==!1&&(t+=` , message: 'should match pattern "`,h?t+="' + "+p+" + '":t+=""+e.util.escapeQuotes(o),t+=`"' `),e.opts.verbose&&(t+=" , schema: ",h?t+="validate.schema"+l:t+=""+e.util.toQuotedString(o),t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var v=t;return t=y.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+v+"]); ":t+=" validate.errors = ["+v+"]; return false; ":t+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",d&&(t+=" else { "),t}});var gi=z((Km,vi)=>{"use strict";vi.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="errs__"+n,p=e.util.copy(e),g="";p.level++;var y="valid"+p.level,v="key"+n,x="idx"+n,P=p.dataLevel=e.dataLevel+1,E="data"+P,R="dataProperties"+n,T=Object.keys(o||{}).filter(te),S=e.schema.patternProperties||{},I=Object.keys(S).filter(te),D=e.schema.additionalProperties,$=T.length||I.length,L=D===!1,C=typeof D=="object"&&Object.keys(D).length,k=e.opts.removeAdditional,N=L||C||k,A=e.opts.ownProperties,M=e.baseId,W=e.schema.required;if(W&&!(e.opts.$data&&W.$data)&&W.length8)t+=" || validate.schema"+l+".hasOwnProperty("+v+") ";else{var K=T;if(K)for(var Z,fe=-1,Te=K.length-1;fe0||Pe===!1:e.util.schemaHasRules(Pe,e.RULES.all)){var Ge=e.util.getProperty(Z),Ne=f+Ge,Me=Tt&&Pe.default!==void 0;p.schema=Pe,p.schemaPath=l+Ge,p.errSchemaPath=u+"/"+e.util.escapeFragment(Z),p.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),p.dataPathArr[P]=e.util.toQuotedString(Z);var le=e.validate(p);if(p.baseId=M,e.util.varOccurences(le,E)<2){le=e.util.varReplace(le,E,Ne);var Le=Ne}else{var Le=E;t+=" var "+E+" = "+Ne+"; "}if(Me)t+=" "+le+" ";else{if(Q&&Q[Z]){t+=" if ( "+Le+" === undefined ",A&&(t+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(Z)+"') "),t+=") { "+y+" = false; ";var ke=e.errorPath,ht=u,ot=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(ke,Z,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var Se=Se||[];Se.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+ot+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+ot+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var ye=t;t=Se.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+ye+"]); ":t+=" validate.errors = ["+ye+"]; return false; ":t+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ht,e.errorPath=ke,t+=" } else { "}else d?(t+=" if ( "+Le+" === undefined ",A&&(t+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(Z)+"') "),t+=") { "+y+" = true; } else { "):(t+=" if ("+Le+" !== undefined ",A&&(t+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(Z)+"') "),t+=" ) { ");t+=" "+le+" } "}}d&&(t+=" if ("+y+") { ",g+="}")}}if(I.length){var Ve=I;if(Ve)for(var ie,Hr=-1,Us=Ve.length-1;Hr0||Pe===!1:e.util.schemaHasRules(Pe,e.RULES.all)){p.schema=Pe,p.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ie),p.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ie),A?t+=" "+R+" = "+R+" || Object.keys("+f+"); for (var "+x+"=0; "+x+"<"+R+".length; "+x+"++) { var "+v+" = "+R+"["+x+"]; ":t+=" for (var "+v+" in "+f+") { ",t+=" if ("+e.usePattern(ie)+".test("+v+")) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Ne=f+"["+v+"]";p.dataPathArr[P]=v;var le=e.validate(p);p.baseId=M,e.util.varOccurences(le,E)<2?t+=" "+e.util.varReplace(le,E,Ne)+" ":t+=" var "+E+" = "+Ne+"; "+le+" ",d&&(t+=" if (!"+y+") break; "),t+=" } ",d&&(t+=" else "+y+" = true; "),t+=" } ",d&&(t+=" if ("+y+") { ",g+="}")}}}return d&&(t+=" "+g+" if ("+h+" == errors) {"),t}});var _i=z((Jm,yi)=>{"use strict";yi.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="errs__"+n,p=e.util.copy(e),g="";p.level++;var y="valid"+p.level;if(t+="var "+h+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){p.schema=o,p.schemaPath=l,p.errSchemaPath=u;var v="key"+n,x="idx"+n,P="i"+n,E="' + "+v+" + '",R=p.dataLevel=e.dataLevel+1,T="data"+R,S="dataProperties"+n,I=e.opts.ownProperties,D=e.baseId;I&&(t+=" var "+S+" = undefined; "),I?t+=" "+S+" = "+S+" || Object.keys("+f+"); for (var "+x+"=0; "+x+"<"+S+".length; "+x+"++) { var "+v+" = "+S+"["+x+"]; ":t+=" for (var "+v+" in "+f+") { ",t+=" var startErrs"+n+" = errors; ";var $=v,L=e.compositeRule;e.compositeRule=p.compositeRule=!0;var C=e.validate(p);p.baseId=D,e.util.varOccurences(C,T)<2?t+=" "+e.util.varReplace(C,T,$)+" ":t+=" var "+T+" = "+$+"; "+C+" ",e.compositeRule=p.compositeRule=L,t+=" if (!"+y+") { for (var "+P+"=startErrs"+n+"; "+P+"{"use strict";bi.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p=e.opts.$data&&o&&o.$data,g;p?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var y="schema"+n;if(!p)if(o.length0||T===!1:e.util.schemaHasRules(T,e.RULES.all))||(v[v.length]=P)}}else var v=o;if(p||v.length){var S=e.errorPath,I=p||v.length>=e.opts.loopRequired,D=e.opts.ownProperties;if(d)if(t+=" var missing"+n+"; ",I){p||(t+=" var "+y+" = validate.schema"+l+"; ");var $="i"+n,L="schema"+n+"["+$+"]",C="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(S,L,e.opts.jsonPointers)),t+=" var "+h+" = true; ",p&&(t+=" if (schema"+n+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+n+")) "+h+" = false; else {"),t+=" for (var "+$+" = 0; "+$+" < "+y+".length; "+$+"++) { "+h+" = "+f+"["+y+"["+$+"]] !== undefined ",D&&(t+=" && Object.prototype.hasOwnProperty.call("+f+", "+y+"["+$+"]) "),t+="; if (!"+h+") break; } ",p&&(t+=" } "),t+=" if (!"+h+") { ";var k=k||[];k.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+C+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+C+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var N=t;t=k.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+N+"]); ":t+=" validate.errors = ["+N+"]; return false; ":t+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else{t+=" if ( ";var A=v;if(A)for(var M,$=-1,W=A.length-1;${"use strict";Si.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,p=e.opts.$data&&o&&o.$data,g;if(p?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o,(o||p)&&e.opts.uniqueItems!==!1){p&&(t+=" var "+h+"; if ("+g+" === false || "+g+" === undefined) "+h+" = true; else if (typeof "+g+" != 'boolean') "+h+" = false; else { "),t+=" var i = "+f+".length , "+h+" = true , j; if (i > 1) { ";var y=e.schema.items&&e.schema.items.type,v=Array.isArray(y);if(!y||y=="object"||y=="array"||v&&(y.indexOf("object")>=0||y.indexOf("array")>=0))t+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+h+" = false; break outer; } } } ";else{t+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var x="checkDataType"+(v?"s":"");t+=" if ("+e.util[x](y,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(t+=` if (typeof item == 'string') item = '"' + item; `),t+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}t+=" } ",p&&(t+=" } "),t+=" if (!"+h+") { ";var P=P||[];P.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(t+=" , schema: ",p?t+="validate.schema"+l:t+=""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),t+=" } "):t+=" {} ";var E=t;t=P.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+E+"]); ":t+=" validate.errors = ["+E+"]; return false; ":t+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",d&&(t+=" else { ")}else d&&(t+=" if (true) { ");return t}});var Ti=z((tv,Ri)=>{"use strict";Ri.exports={$ref:jo(),allOf:Mo(),anyOf:Uo(),$comment:Vo(),const:zo(),contains:Go(),dependencies:Wo(),enum:Ko(),format:Yo(),if:ti(),items:si(),maximum:$a(),minimum:$a(),maxItems:Da(),minItems:Da(),maxLength:Ca(),minLength:Ca(),maxProperties:ka(),minProperties:ka(),multipleOf:li(),not:di(),oneOf:fi(),pattern:mi(),properties:gi(),propertyNames:_i(),required:Ei(),uniqueItems:xi(),validate:Na()}});var Pi=z((rv,Oi)=>{"use strict";var wi=Ti(),La=ar().toHash;Oi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],a=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],t=["number","integer","string","array","object","boolean","null"];return e.all=La(r),e.types=La(t),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var l=Object.keys(i)[0];o=i[l],i=l,o.forEach(function(d){r.push(d),e.all[d]=!0})}r.push(i);var u=e.all[i]={keyword:i,code:wi[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:wi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=La(r.concat(a)),e.custom={},e}});var Ai=z((sv,Ni)=>{"use strict";var Ii=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Ni.exports=function(s,e){for(var r=0;r{"use strict";var ef=ys().MissingRef;Di.exports=$i;function $i(s,e,r){var a=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var t=n(s).then(function(){var o=a._addSchema(s,void 0,e);return o.validate||i(o)});return r&&t.then(function(o){r(null,o)},r),t;function n(o){var l=o.$schema;return l&&!a.getSchema(l)?$i.call(a,{$ref:l},!0):Promise.resolve()}function i(o){try{return a._compile(o)}catch(u){if(u instanceof ef)return l(u);throw u}function l(u){var d=u.missingSchema;if(p(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var f=a._loadingSchemas[d];return f||(f=a._loadingSchemas[d]=a._opts.loadSchema(d),f.then(h,h)),f.then(function(g){if(!p(d))return n(g).then(function(){p(d)||a.addSchema(g,d,void 0,e)})}).then(function(){return i(o)});function h(){delete a._loadingSchemas[d]}function p(g){return a._refs[g]||a._schemas[g]}}}}});var Li=z((nv,ki)=>{"use strict";ki.exports=function(e,r,a){var t=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f,h="data"+(i||""),p="valid"+n,g="errs__"+n,y=e.opts.$data&&o&&o.$data,v;y?(t+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=o;var x=this,P="definition"+n,E=x.definition,R="",T,S,I,D,$;if(y&&E.$data){$="keywordValidate"+n;var L=E.validateSchema;t+=" var "+P+" = RULES.custom['"+r+"'].definition; var "+$+" = "+P+".validate;"}else{if(D=e.useCustomRule(x,o,e.schema,e),!D)return;v="validate.schema"+l,$=D.code,T=E.compile,S=E.inline,I=E.macro}var C=$+".errors",k="i"+n,N="ruleErr"+n,A=E.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(S||I||(t+=""+C+" = null;"),t+="var "+g+" = errors;var "+p+";",y&&E.$data&&(R+="}",t+=" if ("+v+" === undefined) { "+p+" = true; } else { ",L&&(R+="}",t+=" "+p+" = "+P+".validateSchema("+v+"); if ("+p+") { ")),S)E.statements?t+=" "+D.validate+" ":t+=" "+p+" = "+D.validate+"; ";else if(I){var M=e.util.copy(e),R="";M.level++;var W="valid"+M.level;M.schema=D.validate,M.schemaPath="";var Q=e.compositeRule;e.compositeRule=M.compositeRule=!0;var te=e.validate(M).replace(/validate\.schema/g,$);e.compositeRule=M.compositeRule=Q,t+=" "+te}else{var K=K||[];K.push(t),t="",t+=" "+$+".call( ",e.opts.passContext?t+="this":t+="self",T||E.schema===!1?t+=" , "+h+" ":t+=" , "+v+" , "+h+" , validate.schema"+e.schemaPath+" ",t+=" , (dataPath || '')",e.errorPath!='""'&&(t+=" + "+e.errorPath);var Z=i?"data"+(i-1||""):"parentData",fe=i?e.dataPathArr[i]:"parentDataProperty";t+=" , "+Z+" , "+fe+" , rootData ) ";var Te=t;t=K.pop(),E.errors===!1?(t+=" "+p+" = ",A&&(t+="await "),t+=""+Te+"; "):A?(C="customErrors"+n,t+=" var "+C+" = null; try { "+p+" = await "+Te+"; } catch (e) { "+p+" = false; if (e instanceof ValidationError) "+C+" = e.errors; else throw e; } "):t+=" "+C+" = null; "+p+" = "+Te+"; "}if(E.modifying&&(t+=" if ("+Z+") "+h+" = "+Z+"["+fe+"];"),t+=""+R,E.valid)d&&(t+=" if (true) { ");else{t+=" if ( ",E.valid===void 0?(t+=" !",I?t+=""+W:t+=""+p):t+=" "+!E.valid+" ",t+=") { ",f=x.keyword;var K=K||[];K.push(t),t="";var K=K||[];K.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(t+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(t+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Ce=t;t=K.pop(),!e.compositeRule&&d?e.async?t+=" throw new ValidationError(["+Ce+"]); ":t+=" validate.errors = ["+Ce+"]; return false; ":t+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ie=t;t=K.pop(),S?E.errors?E.errors!="full"&&(t+=" for (var "+k+"="+g+"; "+k+"{tf.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Mi=z((iv,Fi)=>{"use strict";var ji=ja();Fi.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:ji.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:ji.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var Ui=z((cv,qi)=>{"use strict";var rf=/^[a-z_$][a-z0-9_$-]*$/i,sf=Li(),af=Mi();qi.exports={add:nf,get:of,remove:cf,validate:Fa};function nf(s,e){var r=this.RULES;if(r.keywords[s])throw new Error("Keyword "+s+" is already defined");if(!rf.test(s))throw new Error("Keyword "+s+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var a=e.type;if(Array.isArray(a))for(var t=0;t{lf.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var qa=z((uv,Ki)=>{"use strict";var Hi=Eo(),nr=gs(),uf=xo(),zi=xa(),df=Ia(),pf=ko(),ff=Pi(),Zi=Ai(),Gi=ar();Ki.exports=_e;_e.prototype.validate=mf;_e.prototype.compile=vf;_e.prototype.addSchema=gf;_e.prototype.addMetaSchema=yf;_e.prototype.validateSchema=_f;_e.prototype.getSchema=Ef;_e.prototype.removeSchema=xf;_e.prototype.addFormat=Af;_e.prototype.errorsText=Nf;_e.prototype._addSchema=Rf;_e.prototype._compile=Tf;_e.prototype.compileAsync=Ci();var ws=Ui();_e.prototype.addKeyword=ws.add;_e.prototype.getKeyword=ws.get;_e.prototype.removeKeyword=ws.remove;_e.prototype.validateKeyword=ws.validate;var Xi=ys();_e.ValidationError=Xi.Validation;_e.MissingRefError=Xi.MissingRef;_e.$dataMetaSchema=Zi;var Ts="http://json-schema.org/draft-07/schema",Vi=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],hf=["/properties"];function _e(s){if(!(this instanceof _e))return new _e(s);s=this._opts=Gi.copy(s)||{},jf(this),this._schemas={},this._refs={},this._fragments={},this._formats=pf(s.format),this._cache=s.cache||new uf,this._loadingSchemas={},this._compilations=[],this.RULES=ff(),this._getId=wf(s),s.loopRequired=s.loopRequired||1/0,s.errorDataPath=="property"&&(s._errorDataPathProperty=!0),s.serialize===void 0&&(s.serialize=df),this._metaOpts=Lf(this),s.formats&&Cf(this),s.keywords&&kf(this),$f(this),typeof s.meta=="object"&&this.addMetaSchema(s.meta),s.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Df(this)}function mf(s,e){var r;if(typeof s=="string"){if(r=this.getSchema(s),!r)throw new Error('no schema with key or ref "'+s+'"')}else{var a=this._addSchema(s);r=a.validate||this._compile(a)}var t=r(e);return r.$async!==!0&&(this.errors=r.errors),t}function vf(s,e){var r=this._addSchema(s,void 0,e);return r.validate||this._compile(r)}function gf(s,e,r,a){if(Array.isArray(s)){for(var t=0;t{sc.exports=rc;rc.sync=qf;var ec=require("fs");function Mf(s,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var a=0;a{cc.exports=oc;oc.sync=Uf;var nc=require("fs");function oc(s,e,r){nc.stat(s,function(a,t){r(a,a?!1:ic(t,e))})}function Uf(s,e){return ic(nc.statSync(s),e)}function ic(s,e){return s.isFile()&&Bf(s,e)}function Bf(s,e){var r=s.mode,a=s.uid,t=s.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),l=parseInt("010",8),u=parseInt("001",8),d=o|l,f=r&u||r&l&&t===i||r&o&&a===n||r&d&&n===0;return f}});var dc=z((Rv,uc)=>{var xv=require("fs"),As;process.platform==="win32"||global.TESTING_WINDOWS?As=ac():As=lc();uc.exports=Ba;Ba.sync=Vf;function Ba(s,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(a,t){Ba(s,e||{},function(n,i){n?t(n):a(i)})})}As(s,e||{},function(a,t){a&&(a.code==="EACCES"||e&&e.ignoreErrors)&&(a=null,t=!1),r(a,t)})}function Vf(s,e){try{return As.sync(s,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var yc=z((Tv,gc)=>{var Rr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",pc=require("path"),Hf=Rr?";":":",fc=dc(),hc=s=>Object.assign(new Error(`not found: ${s}`),{code:"ENOENT"}),mc=(s,e)=>{let r=e.colon||Hf,a=s.match(/\//)||Rr&&s.match(/\\/)?[""]:[...Rr?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],t=Rr?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=Rr?t.split(r):[""];return Rr&&s.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:a,pathExt:n,pathExtExe:t}},vc=(s,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:a,pathExt:t,pathExtExe:n}=mc(s,e),i=[],o=u=>new Promise((d,f)=>{if(u===a.length)return e.all&&i.length?d(i):f(hc(s));let h=a[u],p=/^".*"$/.test(h)?h.slice(1,-1):h,g=pc.join(p,s),y=!p&&/^\.[\\\/]/.test(s)?s.slice(0,2)+g:g;d(l(y,u,0))}),l=(u,d,f)=>new Promise((h,p)=>{if(f===t.length)return h(o(d+1));let g=t[f];fc(u+g,{pathExt:n},(y,v)=>{if(!y&&v)if(e.all)i.push(u+g);else return h(u+g);return h(l(u,d,f+1))})});return r?o(0).then(u=>r(null,u),r):o(0)},zf=(s,e)=>{e=e||{};let{pathEnv:r,pathExt:a,pathExtExe:t}=mc(s,e),n=[];for(let i=0;i{"use strict";var _c=(s={})=>{let e=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(a=>a.toUpperCase()==="PATH")||"Path"};Va.exports=_c;Va.exports.default=_c});var Rc=z((Ov,xc)=>{"use strict";var Ec=require("path"),Zf=yc(),Gf=bc();function Sc(s,e){let r=s.options.env||process.env,a=process.cwd(),t=s.options.cwd!=null,n=t&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(s.options.cwd)}catch{}let i;try{i=Zf.sync(s.command,{path:r[Gf({env:r})],pathExt:e?Ec.delimiter:void 0})}catch{}finally{n&&process.chdir(a)}return i&&(i=Ec.resolve(t?s.options.cwd:"",i)),i}function Xf(s){return Sc(s)||Sc(s,!0)}xc.exports=Xf});var Tc=z((Pv,za)=>{"use strict";var Ha=/([()\][%!^"`<>&|;, *?])/g;function Wf(s){return s=s.replace(Ha,"^$1"),s}function Qf(s,e){return s=`${s}`,s=s.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),s=s.replace(/(?=(\\+?)?)\1$/,"$1$1"),s=`"${s}"`,s=s.replace(Ha,"^$1"),e&&(s=s.replace(Ha,"^$1")),s}za.exports.command=Wf;za.exports.argument=Qf});var Oc=z((Iv,wc)=>{"use strict";wc.exports=/^#!(.*)/});var Ic=z((Nv,Pc)=>{"use strict";var Kf=Oc();Pc.exports=(s="")=>{let e=s.match(Kf);if(!e)return null;let[r,a]=e[0].replace(/#! ?/,"").split(" "),t=r.split("/").pop();return t==="env"?a:a?`${t} ${a}`:t}});var Ac=z((Av,Nc)=>{"use strict";var Za=require("fs"),Jf=Ic();function Yf(s){let r=Buffer.alloc(150),a;try{a=Za.openSync(s,"r"),Za.readSync(a,r,0,150,0),Za.closeSync(a)}catch{}return Jf(r.toString())}Nc.exports=Yf});var kc=z(($v,Cc)=>{"use strict";var eh=require("path"),$c=Rc(),Dc=Tc(),th=Ac(),rh=process.platform==="win32",sh=/\.(?:com|exe)$/i,ah=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function nh(s){s.file=$c(s);let e=s.file&&th(s.file);return e?(s.args.unshift(s.file),s.command=e,$c(s)):s.file}function oh(s){if(!rh)return s;let e=nh(s),r=!sh.test(e);if(s.options.forceShell||r){let a=ah.test(e);s.command=eh.normalize(s.command),s.command=Dc.command(s.command),s.args=s.args.map(n=>Dc.argument(n,a));let t=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${t}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function ih(s,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let a={command:s,args:e,options:r,file:void 0,original:{command:s,args:e}};return r.shell?a:oh(a)}Cc.exports=ih});var Fc=z((Dv,jc)=>{"use strict";var Ga=process.platform==="win32";function Xa(s,e){return Object.assign(new Error(`${e} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${s.command}`,path:s.command,spawnargs:s.args})}function ch(s,e){if(!Ga)return;let r=s.emit;s.emit=function(a,t){if(a==="exit"){let n=Lc(t,e);if(n)return r.call(s,"error",n)}return r.apply(s,arguments)}}function Lc(s,e){return Ga&&s===1&&!e.file?Xa(e.original,"spawn"):null}function lh(s,e){return Ga&&s===1&&!e.file?Xa(e.original,"spawnSync"):null}jc.exports={hookChildProcess:ch,verifyENOENT:Lc,verifyENOENTSync:lh,notFoundError:Xa}});var Uc=z((Cv,Tr)=>{"use strict";var Mc=require("child_process"),Wa=kc(),Qa=Fc();function qc(s,e,r){let a=Wa(s,e,r),t=Mc.spawn(a.command,a.args,a.options);return Qa.hookChildProcess(t,a),t}function uh(s,e,r){let a=Wa(s,e,r),t=Mc.spawnSync(a.command,a.args,a.options);return t.error=t.error||Qa.verifyENOENTSync(t.status,a),t}Tr.exports=qc;Tr.exports.spawn=qc;Tr.exports.sync=uh;Tr.exports._parse=Wa;Tr.exports._enoent=Qa});var c={};nu(c,{BRAND:()=>$u,DIRTY:()=>Bt,EMPTY_PATH:()=>uu,INVALID:()=>G,NEVER:()=>vd,OK:()=>Ae,ParseStatus:()=>Ie,Schema:()=>ee,ZodAny:()=>Pt,ZodArray:()=>St,ZodBigInt:()=>Ht,ZodBoolean:()=>zt,ZodBranded:()=>Cr,ZodCatch:()=>rr,ZodDate:()=>Zt,ZodDefault:()=>tr,ZodDiscriminatedUnion:()=>Qr,ZodEffects:()=>Je,ZodEnum:()=>Yt,ZodError:()=>qe,ZodFirstPartyTypeKind:()=>F,ZodFunction:()=>Jr,ZodIntersection:()=>Qt,ZodIssueCode:()=>j,ZodLazy:()=>Kt,ZodLiteral:()=>Jt,ZodMap:()=>_r,ZodNaN:()=>Er,ZodNativeEnum:()=>er,ZodNever:()=>rt,ZodNull:()=>Xt,ZodNullable:()=>dt,ZodNumber:()=>Vt,ZodObject:()=>Ue,ZodOptional:()=>Qe,ZodParsedType:()=>B,ZodPipeline:()=>kr,ZodPromise:()=>It,ZodReadonly:()=>sr,ZodRecord:()=>Kr,ZodSchema:()=>ee,ZodSet:()=>br,ZodString:()=>Ot,ZodSymbol:()=>gr,ZodTransformer:()=>Je,ZodTuple:()=>ut,ZodType:()=>ee,ZodUndefined:()=>Gt,ZodUnion:()=>Wt,ZodUnknown:()=>Et,ZodVoid:()=>yr,addIssueToContext:()=>U,any:()=>Uu,array:()=>zu,bigint:()=>Lu,boolean:()=>Cn,coerce:()=>md,custom:()=>An,date:()=>ju,datetimeRegex:()=>In,defaultErrorMap:()=>_t,discriminatedUnion:()=>Wu,effect:()=>id,enum:()=>ad,function:()=>td,getErrorMap:()=>hr,getParsedType:()=>lt,instanceof:()=>Cu,intersection:()=>Qu,isAborted:()=>Xr,isAsync:()=>mr,isDirty:()=>Wr,isValid:()=>wt,late:()=>Du,lazy:()=>rd,literal:()=>sd,makeIssue:()=>Dr,map:()=>Yu,nan:()=>ku,nativeEnum:()=>nd,never:()=>Vu,null:()=>qu,nullable:()=>ld,number:()=>Dn,object:()=>Zu,objectUtil:()=>Zs,oboolean:()=>hd,onumber:()=>fd,optional:()=>cd,ostring:()=>pd,pipeline:()=>dd,preprocess:()=>ud,promise:()=>od,quotelessJson:()=>iu,record:()=>Ju,set:()=>ed,setErrorMap:()=>lu,strictObject:()=>Gu,string:()=>$n,symbol:()=>Fu,transformer:()=>id,tuple:()=>Ku,undefined:()=>Mu,union:()=>Xu,unknown:()=>Bu,util:()=>re,void:()=>Hu});var re;(function(s){s.assertEqual=t=>{};function e(t){}s.assertIs=e;function r(t){throw new Error}s.assertNever=r,s.arrayToEnum=t=>{let n={};for(let i of t)n[i]=i;return n},s.getValidEnumValues=t=>{let n=s.objectKeys(t).filter(o=>typeof t[t[o]]!="number"),i={};for(let o of n)i[o]=t[o];return s.objectValues(i)},s.objectValues=t=>s.objectKeys(t).map(function(n){return t[n]}),s.objectKeys=typeof Object.keys=="function"?t=>Object.keys(t):t=>{let n=[];for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&n.push(i);return n},s.find=(t,n)=>{for(let i of t)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?t=>Number.isInteger(t):t=>typeof t=="number"&&Number.isFinite(t)&&Math.floor(t)===t;function a(t,n=" | "){return t.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=a,s.jsonStringifyReplacer=(t,n)=>typeof n=="bigint"?n.toString():n})(re||(re={}));var Zs;(function(s){s.mergeShapes=(e,r)=>({...e,...r})})(Zs||(Zs={}));var B=re.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 B.undefined;case"string":return B.string;case"number":return Number.isNaN(s)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(s)?B.array:s===null?B.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?B.promise:typeof Map<"u"&&s instanceof Map?B.map:typeof Set<"u"&&s instanceof Set?B.set:typeof Date<"u"&&s instanceof Date?B.date:B.object;default:return B.unknown}};var j=re.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"]),iu=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),qe=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(n){return n.message},a={_errors:[]},t=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(t);else if(i.code==="invalid_return_type")t(i.returnTypeError);else if(i.code==="invalid_arguments")t(i.argumentsError);else if(i.path.length===0)a._errors.push(r(i));else{let o=a,l=0;for(;lr.message){let r={},a=[];for(let t of this.issues)if(t.path.length>0){let n=t.path[0];r[n]=r[n]||[],r[n].push(e(t))}else a.push(e(t));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};qe.create=s=>new qe(s);var cu=(s,e)=>{let r;switch(s.code){case j.invalid_type:s.received===B.undefined?r="Required":r=`Expected ${s.expected}, received ${s.received}`;break;case j.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(s.expected,re.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:r=`Unrecognized key(s) in object: ${re.joinValues(s.keys,", ")}`;break;case j.invalid_union:r="Invalid input";break;case j.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${re.joinValues(s.options)}`;break;case j.invalid_enum_value:r=`Invalid enum value. Expected ${re.joinValues(s.options)}, received '${s.received}'`;break;case j.invalid_arguments:r="Invalid function arguments";break;case j.invalid_return_type:r="Invalid function return type";break;case j.invalid_date:r="Invalid date";break;case j.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}"`:re.assertNever(s.validation):s.validation!=="regex"?r=`Invalid ${s.validation}`:r="Invalid";break;case j.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 j.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 j.custom:r="Invalid input";break;case j.invalid_intersection_types:r="Intersection results could not be merged";break;case j.not_multiple_of:r=`Number must be a multiple of ${s.multipleOf}`;break;case j.not_finite:r="Number must be finite";break;default:r=e.defaultError,re.assertNever(s)}return{message:r}},_t=cu;var Rn=_t;function lu(s){Rn=s}function hr(){return Rn}var Dr=s=>{let{data:e,path:r,errorMaps:a,issueData:t}=s,n=[...r,...t.path||[]],i={...t,path:n};if(t.message!==void 0)return{...t,path:n,message:t.message};let o="",l=a.filter(u=>!!u).slice().reverse();for(let u of l)o=u(i,{data:e,defaultError:o}).message;return{...t,path:n,message:o}},uu=[];function U(s,e){let r=hr(),a=Dr({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,r,r===_t?void 0:_t].filter(t=>!!t)});s.common.issues.push(a)}var Ie=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let t of r){if(t.status==="aborted")return G;t.status==="dirty"&&e.dirty(),a.push(t.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let t of r){let n=await t.key,i=await t.value;a.push({key:n,value:i})}return s.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let t of r){let{key:n,value:i}=t;if(n.status==="aborted"||i.status==="aborted")return G;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||t.alwaysSet)&&(a[n.value]=i.value)}return{status:e.value,value:a}}},G=Object.freeze({status:"aborted"}),Bt=s=>({status:"dirty",value:s}),Ae=s=>({status:"valid",value:s}),Xr=s=>s.status==="aborted",Wr=s=>s.status==="dirty",wt=s=>s.status==="valid",mr=s=>typeof Promise<"u"&&s instanceof Promise;var H;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(H||(H={}));var Ke=class{constructor(e,r,a,t){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=t}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}},Tn=(s,e)=>{if(wt(e))return{success:!0,data:e.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 qe(s.common.issues);return this._error=r,this._error}}};function J(s){if(!s)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:t}=s;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(i,o)=>{let{message:l}=s;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??a??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:t}}var ee=class{get description(){return this._def.description}_getType(e){return lt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:lt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ie,ctx:{common:e.parent.common,data:e.data,parsedType:lt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(mr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lt(e)},t=this._parseSync({data:e,path:a.path,parent:a});return Tn(a,t)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lt(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:r});return wt(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>wt(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lt(e)},t=this._parse({data:e,path:a.path,parent:a}),n=await(mr(t)?t:Promise.resolve(t));return Tn(a,n)}refine(e,r){let a=t=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(t):r;return this._refinement((t,n)=>{let i=e(t),o=()=>n.addIssue({code:j.custom,...a(t)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((a,t)=>e(a)?!0:(t.addIssue(typeof r=="function"?r(a,t):r),!1))}_refinement(e){return new Je({schema:this,typeName:F.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Qe.create(this,this._def)}nullable(){return dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return St.create(this)}promise(){return It.create(this,this._def)}or(e){return Wt.create([this,e],this._def)}and(e){return Qt.create(this,e,this._def)}transform(e){return new Je({...J(this._def),schema:this,typeName:F.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new tr({...J(this._def),innerType:this,defaultValue:r,typeName:F.ZodDefault})}brand(){return new Cr({typeName:F.ZodBranded,type:this,...J(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new rr({...J(this._def),innerType:this,catchValue:r,typeName:F.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kr.create(this,e)}readonly(){return sr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},du=/^c[^\s-]{8,}$/i,pu=/^[0-9a-z]+$/,fu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hu=/^[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,mu=/^[a-z0-9_-]{21}$/i,vu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gu=/^[-+]?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)?)??$/,yu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_u="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gs,bu=/^(?:(?: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])$/,Eu=/^(?:(?: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])$/,Su=/^(([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]))$/,xu=/^(([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])$/,Ru=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,On="((\\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])))",wu=new RegExp(`^${On}$`);function Pn(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let r=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Ou(s){return new RegExp(`^${Pn(s)}$`)}function In(s){let e=`${On}T${Pn(s)}`,r=[];return r.push(s.local?"Z?":"Z"),s.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Pu(s,e){return!!((e==="v4"||!e)&&bu.test(s)||(e==="v6"||!e)&&Su.test(s))}function Iu(s,e){if(!vu.test(s))return!1;try{let[r]=s.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),t=JSON.parse(atob(a));return!(typeof t!="object"||t===null||"typ"in t&&t?.typ!=="JWT"||!t.alg||e&&t.alg!==e)}catch{return!1}}function Nu(s,e){return!!((e==="v4"||!e)&&Eu.test(s)||(e==="v6"||!e)&&xu.test(s))}var Ot=class s extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){let n=this._getOrReturnCtx(e);return U(n,{code:j.invalid_type,expected:B.string,received:n.parsedType}),G}let a=new Ie,t;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(t=this._getOrReturnCtx(e,t),U(t,{code:j.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,o=e.data.lengthe.test(t),{validation:r,code:j.invalid_string,...H.errToObj(a)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...H.errToObj(e)})}url(e){return this._addCheck({kind:"url",...H.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...H.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...H.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...H.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...H.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...H.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...H.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...H.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...H.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...H.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...H.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...H.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...H.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...H.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...H.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...H.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...H.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...H.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...H.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...H.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...H.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...H.errToObj(r)})}nonempty(e){return this.min(1,H.errToObj(e))}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(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ot({checks:[],typeName:F.ZodString,coerce:s?.coerce??!1,...J(s)});function Au(s,e){let r=(s.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,t=r>a?r:a,n=Number.parseInt(s.toFixed(t).replace(".","")),i=Number.parseInt(e.toFixed(t).replace(".",""));return n%i/10**t}var Vt=class s extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){let n=this._getOrReturnCtx(e);return U(n,{code:j.invalid_type,expected:B.number,received:n.parsedType}),G}let a,t=new Ie;for(let n of this._def.checks)n.kind==="int"?re.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),U(a,{code:j.invalid_type,expected:"integer",received:"float",message:n.message}),t.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),U(a,{code:j.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),t.dirty()):n.kind==="multipleOf"?Au(e.data,n.value)!==0&&(a=this._getOrReturnCtx(e,a),U(a,{code:j.not_multiple_of,multipleOf:n.value,message:n.message}),t.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),U(a,{code:j.not_finite,message:n.message}),t.dirty()):re.assertNever(n);return{status:t.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,H.toString(r))}gt(e,r){return this.setLimit("min",e,!1,H.toString(r))}lte(e,r){return this.setLimit("max",e,!0,H.toString(r))}lt(e,r){return this.setLimit("max",e,!1,H.toString(r))}setLimit(e,r,a,t){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:H.toString(t)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:H.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:H.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&re.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.valuenew Vt({checks:[],typeName:F.ZodNumber,coerce:s?.coerce||!1,...J(s)});var Ht=class s extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let a,t=new Ie;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),U(a,{code:j.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),t.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),U(a,{code:j.not_multiple_of,multipleOf:n.value,message:n.message}),t.dirty()):re.assertNever(n);return{status:t.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return U(r,{code:j.invalid_type,expected:B.bigint,received:r.parsedType}),G}gte(e,r){return this.setLimit("min",e,!0,H.toString(r))}gt(e,r){return this.setLimit("min",e,!1,H.toString(r))}lte(e,r){return this.setLimit("max",e,!0,H.toString(r))}lt(e,r){return this.setLimit("max",e,!1,H.toString(r))}setLimit(e,r,a,t){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:H.toString(t)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ht({checks:[],typeName:F.ZodBigInt,coerce:s?.coerce??!1,...J(s)});var zt=class extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){let a=this._getOrReturnCtx(e);return U(a,{code:j.invalid_type,expected:B.boolean,received:a.parsedType}),G}return Ae(e.data)}};zt.create=s=>new zt({typeName:F.ZodBoolean,coerce:s?.coerce||!1,...J(s)});var Zt=class s extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){let n=this._getOrReturnCtx(e);return U(n,{code:j.invalid_type,expected:B.date,received:n.parsedType}),G}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return U(n,{code:j.invalid_date}),G}let a=new Ie,t;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(t=this._getOrReturnCtx(e,t),U(t,{code:j.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):re.assertNever(n);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:H.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:H.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Zt({checks:[],coerce:s?.coerce||!1,typeName:F.ZodDate,...J(s)});var gr=class extends ee{_parse(e){if(this._getType(e)!==B.symbol){let a=this._getOrReturnCtx(e);return U(a,{code:j.invalid_type,expected:B.symbol,received:a.parsedType}),G}return Ae(e.data)}};gr.create=s=>new gr({typeName:F.ZodSymbol,...J(s)});var Gt=class extends ee{_parse(e){if(this._getType(e)!==B.undefined){let a=this._getOrReturnCtx(e);return U(a,{code:j.invalid_type,expected:B.undefined,received:a.parsedType}),G}return Ae(e.data)}};Gt.create=s=>new Gt({typeName:F.ZodUndefined,...J(s)});var Xt=class extends ee{_parse(e){if(this._getType(e)!==B.null){let a=this._getOrReturnCtx(e);return U(a,{code:j.invalid_type,expected:B.null,received:a.parsedType}),G}return Ae(e.data)}};Xt.create=s=>new Xt({typeName:F.ZodNull,...J(s)});var Pt=class extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Ae(e.data)}};Pt.create=s=>new Pt({typeName:F.ZodAny,...J(s)});var Et=class extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ae(e.data)}};Et.create=s=>new Et({typeName:F.ZodUnknown,...J(s)});var rt=class extends ee{_parse(e){let r=this._getOrReturnCtx(e);return U(r,{code:j.invalid_type,expected:B.never,received:r.parsedType}),G}};rt.create=s=>new rt({typeName:F.ZodNever,...J(s)});var yr=class extends ee{_parse(e){if(this._getType(e)!==B.undefined){let a=this._getOrReturnCtx(e);return U(a,{code:j.invalid_type,expected:B.void,received:a.parsedType}),G}return Ae(e.data)}};yr.create=s=>new yr({typeName:F.ZodVoid,...J(s)});var St=class s extends ee{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),t=this._def;if(r.parsedType!==B.array)return U(r,{code:j.invalid_type,expected:B.array,received:r.parsedType}),G;if(t.exactLength!==null){let i=r.data.length>t.exactLength.value,o=r.data.lengtht.maxLength.value&&(U(r,{code:j.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>t.type._parseAsync(new Ke(r,i,r.path,o)))).then(i=>Ie.mergeArray(a,i));let n=[...r.data].map((i,o)=>t.type._parseSync(new Ke(r,i,r.path,o)));return Ie.mergeArray(a,n)}get element(){return this._def.type}min(e,r){return new s({...this._def,minLength:{value:e,message:H.toString(r)}})}max(e,r){return new s({...this._def,maxLength:{value:e,message:H.toString(r)}})}length(e,r){return new s({...this._def,exactLength:{value:e,message:H.toString(r)}})}nonempty(e){return this.min(1,e)}};St.create=(s,e)=>new St({type:s,minLength:null,maxLength:null,exactLength:null,typeName:F.ZodArray,...J(e)});function vr(s){if(s instanceof Ue){let e={};for(let r in s.shape){let a=s.shape[r];e[r]=Qe.create(vr(a))}return new Ue({...s._def,shape:()=>e})}else return s instanceof St?new St({...s._def,type:vr(s.element)}):s instanceof Qe?Qe.create(vr(s.unwrap())):s instanceof dt?dt.create(vr(s.unwrap())):s instanceof ut?ut.create(s.items.map(e=>vr(e))):s}var Ue=class s extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=re.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==B.object){let u=this._getOrReturnCtx(e);return U(u,{code:j.invalid_type,expected:B.object,received:u.parsedType}),G}let{status:a,ctx:t}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof rt&&this._def.unknownKeys==="strip"))for(let u in t.data)i.includes(u)||o.push(u);let l=[];for(let u of i){let d=n[u],f=t.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ke(t,f,t.path,u)),alwaysSet:u in t.data})}if(this._def.catchall instanceof rt){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:t.data[d]}});else if(u==="strict")o.length>0&&(U(t,{code:j.unrecognized_keys,keys:o}),a.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of o){let f=t.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ke(t,f,t.path,d)),alwaysSet:d in t.data})}}return t.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of l){let f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>Ie.mergeObjectSync(a,u)):Ie.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return H.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{let t=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:H.errToObj(e).message??t}:{message:t}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:F.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let r={};for(let a of re.objectKeys(e))e[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new s({...this._def,shape:()=>r})}omit(e){let r={};for(let a of re.objectKeys(this.shape))e[a]||(r[a]=this.shape[a]);return new s({...this._def,shape:()=>r})}deepPartial(){return vr(this)}partial(e){let r={};for(let a of re.objectKeys(this.shape)){let t=this.shape[a];e&&!e[a]?r[a]=t:r[a]=t.optional()}return new s({...this._def,shape:()=>r})}required(e){let r={};for(let a of re.objectKeys(this.shape))if(e&&!e[a])r[a]=this.shape[a];else{let n=this.shape[a];for(;n instanceof Qe;)n=n._def.innerType;r[a]=n}return new s({...this._def,shape:()=>r})}keyof(){return Nn(re.objectKeys(this.shape))}};Ue.create=(s,e)=>new Ue({shape:()=>s,unknownKeys:"strip",catchall:rt.create(),typeName:F.ZodObject,...J(e)});Ue.strictCreate=(s,e)=>new Ue({shape:()=>s,unknownKeys:"strict",catchall:rt.create(),typeName:F.ZodObject,...J(e)});Ue.lazycreate=(s,e)=>new Ue({shape:s,unknownKeys:"strip",catchall:rt.create(),typeName:F.ZodObject,...J(e)});var Wt=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function t(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=n.map(o=>new qe(o.ctx.common.issues));return U(r,{code:j.invalid_union,unionErrors:i}),G}if(r.common.async)return Promise.all(a.map(async n=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await n._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(t);{let n,i=[];for(let l of a){let u={...r,common:{...r.common,issues:[]},parent:null},d=l._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!n&&(n={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;let o=i.map(l=>new qe(l));return U(r,{code:j.invalid_union,unionErrors:o}),G}}get options(){return this._def.options}};Wt.create=(s,e)=>new Wt({options:s,typeName:F.ZodUnion,...J(e)});var bt=s=>s instanceof Kt?bt(s.schema):s instanceof Je?bt(s.innerType()):s instanceof Jt?[s.value]:s instanceof Yt?s.options:s instanceof er?re.objectValues(s.enum):s instanceof tr?bt(s._def.innerType):s instanceof Gt?[void 0]:s instanceof Xt?[null]:s instanceof Qe?[void 0,...bt(s.unwrap())]:s instanceof dt?[null,...bt(s.unwrap())]:s instanceof Cr||s instanceof sr?bt(s.unwrap()):s instanceof rr?bt(s._def.innerType):[],Qr=class s extends ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.object)return U(r,{code:j.invalid_type,expected:B.object,received:r.parsedType}),G;let a=this.discriminator,t=r.data[a],n=this.optionsMap.get(t);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(U(r,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let t=new Map;for(let n of r){let i=bt(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(t.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);t.set(o,n)}}return new s({typeName:F.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:t,...J(a)})}};function Xs(s,e){let r=lt(s),a=lt(e);if(s===e)return{valid:!0,data:s};if(r===B.object&&a===B.object){let t=re.objectKeys(e),n=re.objectKeys(s).filter(o=>t.indexOf(o)!==-1),i={...s,...e};for(let o of n){let l=Xs(s[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(r===B.array&&a===B.array){if(s.length!==e.length)return{valid:!1};let t=[];for(let n=0;n{if(Xr(n)||Xr(i))return G;let o=Xs(n.value,i.value);return o.valid?((Wr(n)||Wr(i))&&r.dirty(),{status:r.value,value:o.data}):(U(a,{code:j.invalid_intersection_types}),G)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([n,i])=>t(n,i)):t(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Qt.create=(s,e,r)=>new Qt({left:s,right:e,typeName:F.ZodIntersection,...J(r)});var ut=class s extends ee{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==B.array)return U(a,{code:j.invalid_type,expected:B.array,received:a.parsedType}),G;if(a.data.lengththis._def.items.length&&(U(a,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...a.data].map((i,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new Ke(a,i,a.path,o)):null}).filter(i=>!!i);return a.common.async?Promise.all(n).then(i=>Ie.mergeArray(r,i)):Ie.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};ut.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ut({items:s,typeName:F.ZodTuple,rest:null,...J(e)})};var Kr=class s extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==B.object)return U(a,{code:j.invalid_type,expected:B.object,received:a.parsedType}),G;let t=[],n=this._def.keyType,i=this._def.valueType;for(let o in a.data)t.push({key:n._parse(new Ke(a,o,a.path,o)),value:i._parse(new Ke(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?Ie.mergeObjectAsync(r,t):Ie.mergeObjectSync(r,t)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof ee?new s({keyType:e,valueType:r,typeName:F.ZodRecord,...J(a)}):new s({keyType:Ot.create(),valueType:e,typeName:F.ZodRecord,...J(r)})}},_r=class extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==B.map)return U(a,{code:j.invalid_type,expected:B.map,received:a.parsedType}),G;let t=this._def.keyType,n=this._def.valueType,i=[...a.data.entries()].map(([o,l],u)=>({key:t._parse(new Ke(a,o,a.path,[u,"key"])),value:n._parse(new Ke(a,l,a.path,[u,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of i){let u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return G;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(u.value,d.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let l of i){let u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return G;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(u.value,d.value)}return{status:r.value,value:o}}}};_r.create=(s,e,r)=>new _r({valueType:e,keyType:s,typeName:F.ZodMap,...J(r)});var br=class s extends ee{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==B.set)return U(a,{code:j.invalid_type,expected:B.set,received:a.parsedType}),G;let t=this._def;t.minSize!==null&&a.data.sizet.maxSize.value&&(U(a,{code:j.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),r.dirty());let n=this._def.valueType;function i(l){let u=new Set;for(let d of l){if(d.status==="aborted")return G;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let o=[...a.data.values()].map((l,u)=>n._parse(new Ke(a,l,a.path,u)));return a.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,r){return new s({...this._def,minSize:{value:e,message:H.toString(r)}})}max(e,r){return new s({...this._def,maxSize:{value:e,message:H.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};br.create=(s,e)=>new br({valueType:s,minSize:null,maxSize:null,typeName:F.ZodSet,...J(e)});var Jr=class s extends ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.function)return U(r,{code:j.invalid_type,expected:B.function,received:r.parsedType}),G;function a(o,l){return Dr({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hr(),_t].filter(u=>!!u),issueData:{code:j.invalid_arguments,argumentsError:l}})}function t(o,l){return Dr({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hr(),_t].filter(u=>!!u),issueData:{code:j.invalid_return_type,returnTypeError:l}})}let n={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof It){let o=this;return Ae(async function(...l){let u=new qe([]),d=await o._def.args.parseAsync(l,n).catch(p=>{throw u.addIssue(a(l,p)),u}),f=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(f,n).catch(p=>{throw u.addIssue(t(f,p)),u})})}else{let o=this;return Ae(function(...l){let u=o._def.args.safeParse(l,n);if(!u.success)throw new qe([a(l,u.error)]);let d=Reflect.apply(i,this,u.data),f=o._def.returns.safeParse(d,n);if(!f.success)throw new qe([t(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:ut.create(e).rest(Et.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new s({args:e||ut.create([]).rest(Et.create()),returns:r||Et.create(),typeName:F.ZodFunction,...J(a)})}},Kt=class extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Kt.create=(s,e)=>new Kt({getter:s,typeName:F.ZodLazy,...J(e)});var Jt=class extends ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return U(r,{received:r.data,code:j.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};Jt.create=(s,e)=>new Jt({value:s,typeName:F.ZodLiteral,...J(e)});function Nn(s,e){return new Yt({values:s,typeName:F.ZodEnum,...J(e)})}var Yt=class s extends ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return U(r,{expected:re.joinValues(a),received:r.parsedType,code:j.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return U(r,{received:r.data,code:j.invalid_enum_value,options:a}),G}return Ae(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return s.create(e,{...this._def,...r})}exclude(e,r=this._def){return s.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Yt.create=Nn;var er=class extends ee{_parse(e){let r=re.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==B.string&&a.parsedType!==B.number){let t=re.objectValues(r);return U(a,{expected:re.joinValues(t),received:a.parsedType,code:j.invalid_type}),G}if(this._cache||(this._cache=new Set(re.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let t=re.objectValues(r);return U(a,{received:a.data,code:j.invalid_enum_value,options:t}),G}return Ae(e.data)}get enum(){return this._def.values}};er.create=(s,e)=>new er({values:s,typeName:F.ZodNativeEnum,...J(e)});var It=class extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.promise&&r.common.async===!1)return U(r,{code:j.invalid_type,expected:B.promise,received:r.parsedType}),G;let a=r.parsedType===B.promise?r.data:Promise.resolve(r.data);return Ae(a.then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}};It.create=(s,e)=>new It({type:s,typeName:F.ZodPromise,...J(e)});var Je=class extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===F.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),t=this._def.effect||null,n={addIssue:i=>{U(a,i),i.fatal?r.abort():r.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),t.type==="preprocess"){let i=t.transform(a.data,n);if(a.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return G;let l=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return l.status==="aborted"?G:l.status==="dirty"?Bt(l.value):r.value==="dirty"?Bt(l.value):l});{if(r.value==="aborted")return G;let o=this._def.schema._parseSync({data:i,path:a.path,parent:a});return o.status==="aborted"?G:o.status==="dirty"?Bt(o.value):r.value==="dirty"?Bt(o.value):o}}if(t.type==="refinement"){let i=o=>{let l=t.refinement(o,n);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?G:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?G:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(t.type==="transform")if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!wt(i))return G;let o=t.transform(i.value,n);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:a.data,path:a.path,parent:a}).then(i=>wt(i)?Promise.resolve(t.transform(i.value,n)).then(o=>({status:r.value,value:o})):G);re.assertNever(t)}};Je.create=(s,e,r)=>new Je({schema:s,typeName:F.ZodEffects,effect:e,...J(r)});Je.createWithPreprocess=(s,e,r)=>new Je({schema:e,effect:{type:"preprocess",transform:s},typeName:F.ZodEffects,...J(r)});var Qe=class extends ee{_parse(e){return this._getType(e)===B.undefined?Ae(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Qe.create=(s,e)=>new Qe({innerType:s,typeName:F.ZodOptional,...J(e)});var dt=class extends ee{_parse(e){return this._getType(e)===B.null?Ae(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dt.create=(s,e)=>new dt({innerType:s,typeName:F.ZodNullable,...J(e)});var tr=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===B.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};tr.create=(s,e)=>new tr({innerType:s,typeName:F.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...J(e)});var rr=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},t=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return mr(t)?t.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new qe(a.common.issues)},input:a.data})})):{status:"valid",value:t.status==="valid"?t.value:this._def.catchValue({get error(){return new qe(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};rr.create=(s,e)=>new rr({innerType:s,typeName:F.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...J(e)});var Er=class extends ee{_parse(e){if(this._getType(e)!==B.nan){let a=this._getOrReturnCtx(e);return U(a,{code:j.invalid_type,expected:B.nan,received:a.parsedType}),G}return{status:"valid",value:e.data}}};Er.create=s=>new Er({typeName:F.ZodNaN,...J(s)});var $u=Symbol("zod_brand"),Cr=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},kr=class s extends ee{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?G:n.status==="dirty"?(r.dirty(),Bt(n.value)):this._def.out._parseAsync({data:n.value,path:a.path,parent:a})})();{let t=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return t.status==="aborted"?G:t.status==="dirty"?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:a.path,parent:a})}}static create(e,r){return new s({in:e,out:r,typeName:F.ZodPipeline})}},sr=class extends ee{_parse(e){let r=this._def.innerType._parse(e),a=t=>(wt(t)&&(t.value=Object.freeze(t.value)),t);return mr(r)?r.then(t=>a(t)):a(r)}unwrap(){return this._def.innerType}};sr.create=(s,e)=>new sr({innerType:s,typeName:F.ZodReadonly,...J(e)});function wn(s,e){let r=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof r=="string"?{message:r}:r}function An(s,e={},r){return s?Pt.create().superRefine((a,t)=>{let n=s(a);if(n instanceof Promise)return n.then(i=>{if(!i){let o=wn(e,a),l=o.fatal??r??!0;t.addIssue({code:"custom",...o,fatal:l})}});if(!n){let i=wn(e,a),o=i.fatal??r??!0;t.addIssue({code:"custom",...i,fatal:o})}}):Pt.create()}var Du={object:Ue.lazycreate},F;(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"})(F||(F={}));var Cu=(s,e={message:`Input not instance of ${s.name}`})=>An(r=>r instanceof s,e),$n=Ot.create,Dn=Vt.create,ku=Er.create,Lu=Ht.create,Cn=zt.create,ju=Zt.create,Fu=gr.create,Mu=Gt.create,qu=Xt.create,Uu=Pt.create,Bu=Et.create,Vu=rt.create,Hu=yr.create,zu=St.create,Zu=Ue.create,Gu=Ue.strictCreate,Xu=Wt.create,Wu=Qr.create,Qu=Qt.create,Ku=ut.create,Ju=Kr.create,Yu=_r.create,ed=br.create,td=Jr.create,rd=Kt.create,sd=Jt.create,ad=Yt.create,nd=er.create,od=It.create,id=Je.create,cd=Qe.create,ld=dt.create,ud=Je.createWithPreprocess,dd=kr.create,pd=()=>$n().optional(),fd=()=>Dn().optional(),hd=()=>Cn().optional(),md={string:(s=>Ot.create({...s,coerce:!0})),number:(s=>Vt.create({...s,coerce:!0})),boolean:(s=>zt.create({...s,coerce:!0})),bigint:(s=>Ht.create({...s,coerce:!0})),date:(s=>Zt.create({...s,coerce:!0}))};var vd=G;var Lr="2025-06-18";var Yr=[Lr,"2025-03-26","2024-11-05","2024-10-07"],es="2.0",kn=c.union([c.string(),c.number().int()]),Ln=c.string(),gd=c.object({progressToken:c.optional(kn)}).passthrough(),Ye=c.object({_meta:c.optional(gd)}).passthrough(),Be=c.object({method:c.string(),params:c.optional(Ye)}),jr=c.object({_meta:c.optional(c.object({}).passthrough())}).passthrough(),pt=c.object({method:c.string(),params:c.optional(jr)}),et=c.object({_meta:c.optional(c.object({}).passthrough())}).passthrough(),ts=c.union([c.string(),c.number().int()]),jn=c.object({jsonrpc:c.literal(es),id:ts}).merge(Be).strict(),Fn=s=>jn.safeParse(s).success,Mn=c.object({jsonrpc:c.literal(es)}).merge(pt).strict(),qn=s=>Mn.safeParse(s).success,Un=c.object({jsonrpc:c.literal(es),id:ts,result:et}).strict(),Ws=s=>Un.safeParse(s).success,je;(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"})(je||(je={}));var Bn=c.object({jsonrpc:c.literal(es),id:ts,error:c.object({code:c.number().int(),message:c.string(),data:c.optional(c.unknown())})}).strict(),Vn=s=>Bn.safeParse(s).success,Hn=c.union([jn,Mn,Un,Bn]),xt=et.strict(),rs=pt.extend({method:c.literal("notifications/cancelled"),params:jr.extend({requestId:ts,reason:c.string().optional()})}),yd=c.object({src:c.string(),mimeType:c.optional(c.string()),sizes:c.optional(c.array(c.string()))}).passthrough(),Fr=c.object({icons:c.array(yd).optional()}).passthrough(),Mr=c.object({name:c.string(),title:c.optional(c.string())}).passthrough(),zn=Mr.extend({version:c.string(),websiteUrl:c.optional(c.string())}).merge(Fr),_d=c.object({experimental:c.optional(c.object({}).passthrough()),sampling:c.optional(c.object({}).passthrough()),elicitation:c.optional(c.object({}).passthrough()),roots:c.optional(c.object({listChanged:c.optional(c.boolean())}).passthrough())}).passthrough(),Qs=Be.extend({method:c.literal("initialize"),params:Ye.extend({protocolVersion:c.string(),capabilities:_d,clientInfo:zn})});var bd=c.object({experimental:c.optional(c.object({}).passthrough()),logging:c.optional(c.object({}).passthrough()),completions:c.optional(c.object({}).passthrough()),prompts:c.optional(c.object({listChanged:c.optional(c.boolean())}).passthrough()),resources:c.optional(c.object({subscribe:c.optional(c.boolean()),listChanged:c.optional(c.boolean())}).passthrough()),tools:c.optional(c.object({listChanged:c.optional(c.boolean())}).passthrough())}).passthrough(),Ks=et.extend({protocolVersion:c.string(),capabilities:bd,serverInfo:zn,instructions:c.optional(c.string())}),Js=pt.extend({method:c.literal("notifications/initialized")});var ss=Be.extend({method:c.literal("ping")}),Ed=c.object({progress:c.number(),total:c.optional(c.number()),message:c.optional(c.string())}).passthrough(),as=pt.extend({method:c.literal("notifications/progress"),params:jr.merge(Ed).extend({progressToken:kn})}),ns=Be.extend({params:Ye.extend({cursor:c.optional(Ln)}).optional()}),os=et.extend({nextCursor:c.optional(Ln)}),Zn=c.object({uri:c.string(),mimeType:c.optional(c.string()),_meta:c.optional(c.object({}).passthrough())}).passthrough(),Gn=Zn.extend({text:c.string()}),Ys=c.string().refine(s=>{try{return atob(s),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xn=Zn.extend({blob:Ys}),Wn=Mr.extend({uri:c.string(),description:c.optional(c.string()),mimeType:c.optional(c.string()),_meta:c.optional(c.object({}).passthrough())}).merge(Fr),Sd=Mr.extend({uriTemplate:c.string(),description:c.optional(c.string()),mimeType:c.optional(c.string()),_meta:c.optional(c.object({}).passthrough())}).merge(Fr),xd=ns.extend({method:c.literal("resources/list")}),ea=os.extend({resources:c.array(Wn)}),Rd=ns.extend({method:c.literal("resources/templates/list")}),ta=os.extend({resourceTemplates:c.array(Sd)}),Td=Be.extend({method:c.literal("resources/read"),params:Ye.extend({uri:c.string()})}),ra=et.extend({contents:c.array(c.union([Gn,Xn]))}),wd=pt.extend({method:c.literal("notifications/resources/list_changed")}),Od=Be.extend({method:c.literal("resources/subscribe"),params:Ye.extend({uri:c.string()})}),Pd=Be.extend({method:c.literal("resources/unsubscribe"),params:Ye.extend({uri:c.string()})}),Id=pt.extend({method:c.literal("notifications/resources/updated"),params:jr.extend({uri:c.string()})}),Nd=c.object({name:c.string(),description:c.optional(c.string()),required:c.optional(c.boolean())}).passthrough(),Ad=Mr.extend({description:c.optional(c.string()),arguments:c.optional(c.array(Nd)),_meta:c.optional(c.object({}).passthrough())}).merge(Fr),$d=ns.extend({method:c.literal("prompts/list")}),sa=os.extend({prompts:c.array(Ad)}),Dd=Be.extend({method:c.literal("prompts/get"),params:Ye.extend({name:c.string(),arguments:c.optional(c.record(c.string()))})}),aa=c.object({type:c.literal("text"),text:c.string(),_meta:c.optional(c.object({}).passthrough())}).passthrough(),na=c.object({type:c.literal("image"),data:Ys,mimeType:c.string(),_meta:c.optional(c.object({}).passthrough())}).passthrough(),oa=c.object({type:c.literal("audio"),data:Ys,mimeType:c.string(),_meta:c.optional(c.object({}).passthrough())}).passthrough(),Cd=c.object({type:c.literal("resource"),resource:c.union([Gn,Xn]),_meta:c.optional(c.object({}).passthrough())}).passthrough(),kd=Wn.extend({type:c.literal("resource_link")}),Qn=c.union([aa,na,oa,kd,Cd]),Ld=c.object({role:c.enum(["user","assistant"]),content:Qn}).passthrough(),ia=et.extend({description:c.optional(c.string()),messages:c.array(Ld)}),jd=pt.extend({method:c.literal("notifications/prompts/list_changed")}),Fd=c.object({title:c.optional(c.string()),readOnlyHint:c.optional(c.boolean()),destructiveHint:c.optional(c.boolean()),idempotentHint:c.optional(c.boolean()),openWorldHint:c.optional(c.boolean())}).passthrough(),Md=Mr.extend({description:c.optional(c.string()),inputSchema:c.object({type:c.literal("object"),properties:c.optional(c.object({}).passthrough()),required:c.optional(c.array(c.string()))}).passthrough(),outputSchema:c.optional(c.object({type:c.literal("object"),properties:c.optional(c.object({}).passthrough()),required:c.optional(c.array(c.string()))}).passthrough()),annotations:c.optional(Fd),_meta:c.optional(c.object({}).passthrough())}).merge(Fr),ca=ns.extend({method:c.literal("tools/list")}),la=os.extend({tools:c.array(Md)}),is=et.extend({content:c.array(Qn).default([]),structuredContent:c.object({}).passthrough().optional(),isError:c.optional(c.boolean())}),um=is.or(et.extend({toolResult:c.unknown()})),ua=Be.extend({method:c.literal("tools/call"),params:Ye.extend({name:c.string(),arguments:c.optional(c.record(c.unknown()))})}),qd=pt.extend({method:c.literal("notifications/tools/list_changed")}),qr=c.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),da=Be.extend({method:c.literal("logging/setLevel"),params:Ye.extend({level:qr})}),Ud=pt.extend({method:c.literal("notifications/message"),params:jr.extend({level:qr,logger:c.optional(c.string()),data:c.unknown()})}),Bd=c.object({name:c.string().optional()}).passthrough(),Vd=c.object({hints:c.optional(c.array(Bd)),costPriority:c.optional(c.number().min(0).max(1)),speedPriority:c.optional(c.number().min(0).max(1)),intelligencePriority:c.optional(c.number().min(0).max(1))}).passthrough(),Hd=c.object({role:c.enum(["user","assistant"]),content:c.union([aa,na,oa])}).passthrough(),zd=Be.extend({method:c.literal("sampling/createMessage"),params:Ye.extend({messages:c.array(Hd),systemPrompt:c.optional(c.string()),includeContext:c.optional(c.enum(["none","thisServer","allServers"])),temperature:c.optional(c.number()),maxTokens:c.number().int(),stopSequences:c.optional(c.array(c.string())),metadata:c.optional(c.object({}).passthrough()),modelPreferences:c.optional(Vd)})}),pa=et.extend({model:c.string(),stopReason:c.optional(c.enum(["endTurn","stopSequence","maxTokens"]).or(c.string())),role:c.enum(["user","assistant"]),content:c.discriminatedUnion("type",[aa,na,oa])}),Zd=c.object({type:c.literal("boolean"),title:c.optional(c.string()),description:c.optional(c.string()),default:c.optional(c.boolean())}).passthrough(),Gd=c.object({type:c.literal("string"),title:c.optional(c.string()),description:c.optional(c.string()),minLength:c.optional(c.number()),maxLength:c.optional(c.number()),format:c.optional(c.enum(["email","uri","date","date-time"]))}).passthrough(),Xd=c.object({type:c.enum(["number","integer"]),title:c.optional(c.string()),description:c.optional(c.string()),minimum:c.optional(c.number()),maximum:c.optional(c.number())}).passthrough(),Wd=c.object({type:c.literal("string"),title:c.optional(c.string()),description:c.optional(c.string()),enum:c.array(c.string()),enumNames:c.optional(c.array(c.string()))}).passthrough(),Qd=c.union([Zd,Gd,Xd,Wd]),Kd=Be.extend({method:c.literal("elicitation/create"),params:Ye.extend({message:c.string(),requestedSchema:c.object({type:c.literal("object"),properties:c.record(c.string(),Qd),required:c.optional(c.array(c.string()))}).passthrough()})}),fa=et.extend({action:c.enum(["accept","decline","cancel"]),content:c.optional(c.record(c.string(),c.unknown()))}),Jd=c.object({type:c.literal("ref/resource"),uri:c.string()}).passthrough();var Yd=c.object({type:c.literal("ref/prompt"),name:c.string()}).passthrough(),ep=Be.extend({method:c.literal("completion/complete"),params:Ye.extend({ref:c.union([Yd,Jd]),argument:c.object({name:c.string(),value:c.string()}).passthrough(),context:c.optional(c.object({arguments:c.optional(c.record(c.string(),c.string()))}))})}),ha=et.extend({completion:c.object({values:c.array(c.string()).max(100),total:c.optional(c.number().int()),hasMore:c.optional(c.boolean())}).passthrough()}),tp=c.object({uri:c.string().startsWith("file://"),name:c.optional(c.string()),_meta:c.optional(c.object({}).passthrough())}).passthrough(),rp=Be.extend({method:c.literal("roots/list")}),ma=et.extend({roots:c.array(tp)}),sp=pt.extend({method:c.literal("notifications/roots/list_changed")}),dm=c.union([ss,Qs,ep,da,Dd,$d,xd,Rd,Td,Od,Pd,ua,ca]),pm=c.union([rs,as,Js,sp]),fm=c.union([xt,pa,fa,ma]),hm=c.union([ss,zd,Kd,rp]),mm=c.union([rs,as,Ud,Id,wd,qd,jd]),vm=c.union([xt,Ks,ha,ia,sa,ea,ta,ra,is,la]),$e=class extends Error{constructor(e,r,a){super(`MCP error ${e}: ${r}`),this.code=e,this.data=a,this.name="McpError"}};var ap=6e4,Sr=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(rs,r=>{let a=this._requestHandlerAbortControllers.get(r.params.requestId);a?.abort(r.params.reason)}),this.setNotificationHandler(as,r=>{this._onprogress(r)}),this.setRequestHandler(ss,r=>({}))}_setupTimeout(e,r,a,t,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(t,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:n,onTimeout:t})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new $e(je.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,a,t;this._transport=e;let n=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(a=this.transport)===null||a===void 0?void 0:a.onerror;this._transport.onerror=l=>{i?.(l),this._onerror(l)};let o=(t=this._transport)===null||t===void 0?void 0:t.onmessage;this._transport.onmessage=(l,u)=>{o?.(l,u),Ws(l)||Vn(l)?this._onresponse(l):Fn(l)?this._onrequest(l,u):qn(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let a=new $e(je.ConnectionClosed,"Connection closed");for(let t of r.values())t(a)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let a=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(e)).catch(t=>this._onerror(new Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(e,r){var a,t;let n=(a=this._requestHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:je.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let l={signal:o.signal,sessionId:i?.sessionId,_meta:(t=e.params)===null||t===void 0?void 0:t._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,f)=>this.request(u,d,{...f,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>n(e,l)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:je.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...a}=e.params,t=Number(r),n=this._progressHandlers.get(t);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(t),o=this._timeoutInfo.get(t);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(t)}catch(l){i(l);return}n(a)}_onresponse(e){let r=Number(e.id),a=this._responseHandlers.get(r);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Ws(e))a(e);else{let t=new $e(e.error.code,e.error.message,e.error.data);a(t)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,a){let{relatedRequestId:t,resumptionToken:n,onresumptiontoken:i}=a??{};return new Promise((o,l)=>{var u,d,f,h,p,g;if(!this._transport){l(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=a?.signal)===null||d===void 0||d.throwIfAborted();let y=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:y};a?.onprogress&&(this._progressHandlers.set(y,a.onprogress),v.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:y}});let x=R=>{var T;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),(T=this._transport)===null||T===void 0||T.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(R)}},{relatedRequestId:t,resumptionToken:n,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`))),l(R)};this._responseHandlers.set(y,R=>{var T;if(!(!((T=a?.signal)===null||T===void 0)&&T.aborted)){if(R instanceof Error)return l(R);try{let S=r.parse(R.result);o(S)}catch(S){l(S)}}}),(h=a?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var R;x((R=a?.signal)===null||R===void 0?void 0:R.reason)});let P=(p=a?.timeout)!==null&&p!==void 0?p:ap,E=()=>x(new $e(je.RequestTimeout,"Request timed out",{timeout:P}));this._setupTimeout(y,P,a?.maxTotalTimeout,E,(g=a?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(v,{relatedRequestId:t,resumptionToken:n,onresumptiontoken:i}).catch(R=>{this._cleanupTimeout(y),l(R)})})}async notification(e,r){var a,t;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((t=(a=this._options)===null||a===void 0?void 0:a.debouncedNotificationMethods)!==null&&t!==void 0?t:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(u,r).catch(d=>this._onerror(d))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(t,n)=>Promise.resolve(r(e.parse(t),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,a=>Promise.resolve(r(e.parse(a))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function cs(s,e){return Object.entries(e).reduce((r,[a,t])=>(t&&typeof t=="object"?r[a]=r[a]?{...r[a],...t}:t:r[a]=t,r),{...s})}var Ji=Ut(qa(),1),Os=class extends Sr{constructor(e,r){var a;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(qr.options.map((t,n)=>[t,n])),this.isMessageIgnored=(t,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(t)this._oninitialize(t)),this.setNotificationHandler(Js,()=>{var t;return(t=this.oninitialized)===null||t===void 0?void 0:t.call(this)}),this._capabilities.logging&&this.setRequestHandler(da,async(t,n)=>{var i;let o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:l}=t.params,u=qr.safeParse(l);return u.success&&this._loggingLevels.set(o,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cs(this._capabilities,e)}assertCapabilityForMethod(e){var r,a,t;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Yr.includes(r)?r:Lr,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"},xt)}async createMessage(e,r){return this.request({method:"sampling/createMessage",params:e},pa,r)}async elicitInput(e,r){let a=await this.request({method:"elicitation/create",params:e},fa,r);if(a.action==="accept"&&a.content)try{let t=new Ji.default,n=t.compile(e.requestedSchema);if(!n(a.content))throw new $e(je.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorsText(n.errors)}`)}catch(t){throw t instanceof $e?t:new $e(je.InternalError,`Error validating elicitation response: ${t}`)}return a}async listRoots(e,r){return this.request({method:"roots/list",params:e},ma,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Ua=Ut(require("node:process"),1);var xr=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
-`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ff(r)}clear(){this._buffer=void 0}};function Ff(s){return Hn.parse(JSON.parse(s))}function Ps(s){return JSON.stringify(s)+`
-`}var Is=class{constructor(e=Ua.default.stdin,r=Ua.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new xr,this._started=!1,this._ondata=a=>{this._readBuffer.append(a),this.processReadBuffer()},this._onerror=a=>{var t;(t=this.onerror)===null||t===void 0||t.call(this,a)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,r;;)try{let a=this._readBuffer.readMessage();if(a===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,a)}catch(a){(r=this.onerror)===null||r===void 0||r.call(this,a)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let a=Ps(e);this._stdout.write(a)?r():this._stdout.once("drain",r)})}};var Yi=Ut(qa(),1),Ns=class extends Sr{constructor(e,r){var a;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(a=r?.capabilities)!==null&&a!==void 0?a:{},this._ajv=new Yi.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cs(this._capabilities,e)}assertCapability(e,r){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let a=await this.request({method:"initialize",params:{protocolVersion:Lr,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ks,r);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!Yr.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"})}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,a,t,n,i;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},xt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},ha,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},xt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},ia,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},sa,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ea,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},ta,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},ra,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},xt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},xt,r)}async callTool(e,r=is,a){let t=await this.request({method:"tools/call",params:e},r,a),n=this.getToolOutputValidator(e.name);if(n){if(!t.structuredContent&&!t.isError)throw new $e(je.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(t.structuredContent)try{if(!n(t.structuredContent))throw new $e(je.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof $e?i:new $e(je.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return t}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let a=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,a)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let a=await this.request({method:"tools/list",params:e},la,r);return this.cacheToolOutputSchemas(a.tools),a}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Bc=Ut(Uc(),1),Br=Ut(require("node:process"),1),Vc=require("node:stream");var dh=Br.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function ph(){let s={};for(let e of dh){let r=Br.default.env[e];r!==void 0&&(r.startsWith("()")||(s[e]=r))}return s}var $s=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new xr,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new Vc.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var a,t,n,i,o;this._process=(0,Bc.default)(this._serverParams.command,(a=this._serverParams.args)!==null&&a!==void 0?a:[],{env:{...ph(),...this._serverParams.env},stdio:["pipe","pipe",(t=this._serverParams.stderr)!==null&&t!==void 0?t:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Br.default.platform==="win32"&&fh(),cwd:this._serverParams.cwd}),this._process.on("error",l=>{var u,d;if(l.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(l),(d=this.onerror)===null||d===void 0||d.call(this,l)}),this._process.on("spawn",()=>{e()}),this._process.on("close",l=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(n=this._process.stdin)===null||n===void 0||n.on("error",l=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,l)}),(i=this._process.stdout)===null||i===void 0||i.on("data",l=>{this._readBuffer.append(l),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",l=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,l)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let a=this._readBuffer.readMessage();if(a===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,a)}catch(a){(r=this.onerror)===null||r===void 0||r.call(this,a)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var a;if(!(!((a=this._process)===null||a===void 0)&&a.stdin))throw new Error("Not connected");let t=Ps(e);this._process.stdin.write(t)?r():this._process.stdin.once("drain",r)})}};function fh(){return"type"in Br.default}var zc=Symbol("Let zodToJsonSchema decide on which parser to use");var Hc={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Zc=s=>typeof s=="string"?{...Hc,name:s}:{...Hc,...s};var Gc=s=>{let e=Zc(s),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([a,t])=>[t._def,{def:t._def,path:[...e.basePath,e.definitionPath,a],jsonSchema:void 0}]))}};function Ka(s,e,r,a){a?.errorMessages&&r&&(s.errorMessage={...s.errorMessage,[e]:r})}function se(s,e,r,a,t){s[e]=r,Ka(s,e,a,t)}var Ds=(s,e)=>{let r=0;for(;rX(s.innerType._def,e);function Ja(s,e,r){let a=r??e.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((t,n)=>Ja(s,e,t))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return hh(s,e)}}var hh=(s,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let a of s.checks)switch(a.kind){case"min":se(r,"minimum",a.value,a.message,e);break;case"max":se(r,"maximum",a.value,a.message,e);break}return r};function Jc(s,e){return{...X(s.innerType._def,e),default:s.defaultValue()}}function Yc(s,e){return e.effectStrategy==="input"?X(s.schema._def,e):me(e)}function el(s){return{type:"string",enum:Array.from(s.values)}}var mh=s=>"type"in s&&s.type==="string"?!1:"allOf"in s;function tl(s,e){let r=[X(s.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),X(s.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),a=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,t=[];return r.forEach(n=>{if(mh(n))t.push(...n.allOf),n.unevaluatedProperties===void 0&&(a=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...l}=n;i=l}else a=void 0;t.push(i)}}),t.length?{allOf:t,...a}:void 0}function rl(s,e){let r=typeof s.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(s.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[s.value]}:{type:r==="bigint"?"integer":r,const:s.value}}var Ya,st={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:()=>(Ya===void 0&&(Ya=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ya),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 ks(s,e){let r={type:"string"};if(s.checks)for(let a of s.checks)switch(a.kind){case"min":se(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e);break;case"max":se(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":at(r,"email",a.message,e);break;case"format:idn-email":at(r,"idn-email",a.message,e);break;case"pattern:zod":Fe(r,st.email,a.message,e);break}break;case"url":at(r,"uri",a.message,e);break;case"uuid":at(r,"uuid",a.message,e);break;case"regex":Fe(r,a.regex,a.message,e);break;case"cuid":Fe(r,st.cuid,a.message,e);break;case"cuid2":Fe(r,st.cuid2,a.message,e);break;case"startsWith":Fe(r,RegExp(`^${en(a.value,e)}`),a.message,e);break;case"endsWith":Fe(r,RegExp(`${en(a.value,e)}$`),a.message,e);break;case"datetime":at(r,"date-time",a.message,e);break;case"date":at(r,"date",a.message,e);break;case"time":at(r,"time",a.message,e);break;case"duration":at(r,"duration",a.message,e);break;case"length":se(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e),se(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"includes":{Fe(r,RegExp(en(a.value,e)),a.message,e);break}case"ip":{a.version!=="v6"&&at(r,"ipv4",a.message,e),a.version!=="v4"&&at(r,"ipv6",a.message,e);break}case"base64url":Fe(r,st.base64url,a.message,e);break;case"jwt":Fe(r,st.jwt,a.message,e);break;case"cidr":{a.version!=="v6"&&Fe(r,st.ipv4Cidr,a.message,e),a.version!=="v4"&&Fe(r,st.ipv6Cidr,a.message,e);break}case"emoji":Fe(r,st.emoji(),a.message,e);break;case"ulid":{Fe(r,st.ulid,a.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{at(r,"binary",a.message,e);break}case"contentEncoding:base64":{se(r,"contentEncoding","base64",a.message,e);break}case"pattern:zod":{Fe(r,st.base64,a.message,e);break}}break}case"nanoid":Fe(r,st.nanoid,a.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function en(s,e){return e.patternStrategy==="escape"?gh(s):s}var vh=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function gh(s){let e="";for(let r=0;rt.format)?(s.anyOf||(s.anyOf=[]),s.format&&(s.anyOf.push({format:s.format,...s.errorMessage&&a.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:e,...r&&a.errorMessages&&{errorMessage:{format:r}}})):se(s,"format",e,r,a)}function Fe(s,e,r,a){s.pattern||s.allOf?.some(t=>t.pattern)?(s.allOf||(s.allOf=[]),s.pattern&&(s.allOf.push({pattern:s.pattern,...s.errorMessage&&a.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:sl(e,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):se(s,"pattern",sl(e,a),r,a)}function sl(s,e){if(!e.applyRegexFlags||!s.flags)return s.source;let r={i:s.flags.includes("i"),m:s.flags.includes("m"),s:s.flags.includes("s")},a=r.i?s.source.toLowerCase():s.source,t="",n=!1,i=!1,o=!1;for(let l=0;l({...a,[t]:X(s.valueType._def,{...e,currentPath:[...e.currentPath,"properties",t]})??me(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:X(s.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(s.keyType?._def.typeName===F.ZodString&&s.keyType._def.checks?.length){let{type:a,...t}=ks(s.keyType._def,e);return{...r,propertyNames:t}}else{if(s.keyType?._def.typeName===F.ZodEnum)return{...r,propertyNames:{enum:s.keyType._def.values}};if(s.keyType?._def.typeName===F.ZodBranded&&s.keyType._def.type._def.typeName===F.ZodString&&s.keyType._def.type._def.checks?.length){let{type:a,...t}=Cs(s.keyType._def,e);return{...r,propertyNames:t}}}return r}function al(s,e){if(e.mapStrategy==="record")return Ls(s,e);let r=X(s.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||me(e),a=X(s.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||me(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,a],minItems:2,maxItems:2}}}function nl(s){let e=s.values,a=Object.keys(s.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),t=Array.from(new Set(a.map(n=>typeof n)));return{type:t.length===1?t[0]==="string"?"string":"number":["string","number"],enum:a}}function ol(s){return s.target==="openAi"?void 0:{not:me({...s,currentPath:[...s.currentPath,"not"]})}}function il(s){return s.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Vr={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ll(s,e){if(e.target==="openApi3")return cl(s,e);let r=s.options instanceof Map?Array.from(s.options.values()):s.options;if(r.every(a=>a._def.typeName in Vr&&(!a._def.checks||!a._def.checks.length))){let a=r.reduce((t,n)=>{let i=Vr[n._def.typeName];return i&&!t.includes(i)?[...t,i]:t},[]);return{type:a.length>1?a:a[0]}}else if(r.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){let a=r.reduce((t,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...t,i];case"bigint":return[...t,"integer"];case"object":if(n._def.value===null)return[...t,"null"];case"symbol":case"undefined":case"function":default:return t}},[]);if(a.length===r.length){let t=a.filter((n,i,o)=>o.indexOf(n)===i);return{type:t.length>1?t:t[0],enum:r.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(r.every(a=>a._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((a,t)=>[...a,...t._def.values.filter(n=>!a.includes(n))],[])};return cl(s,e)}var cl=(s,e)=>{let r=(s.options instanceof Map?Array.from(s.options.values()):s.options).map((a,t)=>X(a._def,{...e,currentPath:[...e.currentPath,"anyOf",`${t}`]})).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return r.length?{anyOf:r}:void 0};function ul(s,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(s.innerType._def.typeName)&&(!s.innerType._def.checks||!s.innerType._def.checks.length))return e.target==="openApi3"?{type:Vr[s.innerType._def.typeName],nullable:!0}:{type:[Vr[s.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let a=X(s.innerType._def,{...e,currentPath:[...e.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}let r=X(s.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function dl(s,e){let r={type:"number"};if(!s.checks)return r;for(let a of s.checks)switch(a.kind){case"int":r.type="integer",Ka(r,"type",a.message,e);break;case"min":e.target==="jsonSchema7"?a.inclusive?se(r,"minimum",a.value,a.message,e):se(r,"exclusiveMinimum",a.value,a.message,e):(a.inclusive||(r.exclusiveMinimum=!0),se(r,"minimum",a.value,a.message,e));break;case"max":e.target==="jsonSchema7"?a.inclusive?se(r,"maximum",a.value,a.message,e):se(r,"exclusiveMaximum",a.value,a.message,e):(a.inclusive||(r.exclusiveMaximum=!0),se(r,"maximum",a.value,a.message,e));break;case"multipleOf":se(r,"multipleOf",a.value,a.message,e);break}return r}function pl(s,e){let r=e.target==="openAi",a={type:"object",properties:{}},t=[],n=s.shape();for(let o in n){let l=n[o];if(l===void 0||l._def===void 0)continue;let u=_h(l);u&&r&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),u=!1);let d=X(l._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});d!==void 0&&(a.properties[o]=d,u||t.push(o))}t.length&&(a.required=t);let i=yh(s,e);return i!==void 0&&(a.additionalProperties=i),a}function yh(s,e){if(s.catchall._def.typeName!=="ZodNever")return X(s.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(s.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function _h(s){try{return s.isOptional()}catch{return!0}}var fl=(s,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return X(s.innerType._def,e);let r=X(s.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:me(e)},r]}:me(e)};var hl=(s,e)=>{if(e.pipeStrategy==="input")return X(s.in._def,e);if(e.pipeStrategy==="output")return X(s.out._def,e);let r=X(s.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),a=X(s.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,a].filter(t=>t!==void 0)}};function ml(s,e){return X(s.type._def,e)}function vl(s,e){let a={type:"array",uniqueItems:!0,items:X(s.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return s.minSize&&se(a,"minItems",s.minSize.value,s.minSize.message,e),s.maxSize&&se(a,"maxItems",s.maxSize.value,s.maxSize.message,e),a}function gl(s,e){return s.rest?{type:"array",minItems:s.items.length,items:s.items.map((r,a)=>X(r._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((r,a)=>a===void 0?r:[...r,a],[]),additionalItems:X(s.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:s.items.length,maxItems:s.items.length,items:s.items.map((r,a)=>X(r._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((r,a)=>a===void 0?r:[...r,a],[])}}function yl(s){return{not:me(s)}}function _l(s){return me(s)}var bl=(s,e)=>X(s.innerType._def,e);var El=(s,e,r)=>{switch(e){case F.ZodString:return ks(s,r);case F.ZodNumber:return dl(s,r);case F.ZodObject:return pl(s,r);case F.ZodBigInt:return Wc(s,r);case F.ZodBoolean:return Qc();case F.ZodDate:return Ja(s,r);case F.ZodUndefined:return yl(r);case F.ZodNull:return il(r);case F.ZodArray:return Xc(s,r);case F.ZodUnion:case F.ZodDiscriminatedUnion:return ll(s,r);case F.ZodIntersection:return tl(s,r);case F.ZodTuple:return gl(s,r);case F.ZodRecord:return Ls(s,r);case F.ZodLiteral:return rl(s,r);case F.ZodEnum:return el(s);case F.ZodNativeEnum:return nl(s);case F.ZodNullable:return ul(s,r);case F.ZodOptional:return fl(s,r);case F.ZodMap:return al(s,r);case F.ZodSet:return vl(s,r);case F.ZodLazy:return()=>s.getter()._def;case F.ZodPromise:return ml(s,r);case F.ZodNaN:case F.ZodNever:return ol(r);case F.ZodEffects:return Yc(s,r);case F.ZodAny:return me(r);case F.ZodUnknown:return _l(r);case F.ZodDefault:return Jc(s,r);case F.ZodBranded:return Cs(s,r);case F.ZodReadonly:return bl(s,r);case F.ZodCatch:return Kc(s,r);case F.ZodPipeline:return hl(s,r);case F.ZodFunction:case F.ZodVoid:case F.ZodSymbol:return;default:return(a=>{})(e)}};function X(s,e,r=!1){let a=e.seen.get(s);if(e.override){let o=e.override?.(s,e,a,r);if(o!==zc)return o}if(a&&!r){let o=bh(a,e);if(o!==void 0)return o}let t={def:s,path:e.currentPath,jsonSchema:void 0};e.seen.set(s,t);let n=El(s,s.typeName,e),i=typeof n=="function"?X(n(),e):n;if(i&&Eh(s,e,i),e.postProcess){let o=e.postProcess(i,s,e);return t.jsonSchema=i,o}return t.jsonSchema=i,i}var bh=(s,e)=>{switch(e.$refStrategy){case"root":return{$ref:s.path.join("/")};case"relative":return{$ref:Ds(e.currentPath,s.path)};case"none":case"seen":return s.path.lengthe.currentPath[a]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),me(e)):e.$refStrategy==="seen"?me(e):void 0}},Eh=(s,e,r)=>(s.description&&(r.description=s.description,e.markdownDescription&&(r.markdownDescription=s.description)),r);var tn=(s,e)=>{let r=Gc(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[u,d])=>({...l,[u]:X(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??me(r)}),{}):void 0,t=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=X(s._def,t===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,t]},!1)??me(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),r.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[r.openAiAnyTypeName]||(a[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let o=t===void 0?a?{...n,[r.definitionPath]:a}:n:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,t].join("/"),[r.definitionPath]:{...a,[t]:n}};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};var $l=require("path");var Rl=Ut(require("better-sqlite3"),1);var De=require("path"),rn=require("os"),sn=require("fs");var Sl=require("url"),xh={};function Sh(){return typeof __dirname<"u"?__dirname:(0,De.dirname)((0,Sl.fileURLToPath)(xh.url))}var I_=Sh(),nt=process.env.CLAUDE_MEM_DATA_DIR||(0,De.join)((0,rn.homedir)(),".claude-mem"),an=process.env.CLAUDE_CONFIG_DIR||(0,De.join)((0,rn.homedir)(),".claude"),N_=(0,De.join)(nt,"archives"),A_=(0,De.join)(nt,"logs"),$_=(0,De.join)(nt,"trash"),D_=(0,De.join)(nt,"backups"),C_=(0,De.join)(nt,"settings.json"),js=(0,De.join)(nt,"claude-mem.db"),xl=(0,De.join)(nt,"vector-db"),k_=(0,De.join)(an,"settings.json"),L_=(0,De.join)(an,"commands"),j_=(0,De.join)(an,"CLAUDE.md");function Fs(s){(0,sn.mkdirSync)(s,{recursive:!0})}var Ms=class{db;constructor(e){e||(Fs(nt),e=js),this.db=new Rl.default(e),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(a=>a.name==="observations_fts"||a.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(e){console.error("[SessionSearch] FTS migration error:",e.message)}}buildFilterClause(e,r,a="o"){let t=[];if(e.project&&(t.push(`${a}.project = ?`),r.push(e.project)),e.type)if(Array.isArray(e.type)){let n=e.type.map(()=>"?").join(",");t.push(`${a}.type IN (${n})`),r.push(...e.type)}else t.push(`${a}.type = ?`),r.push(e.type);if(e.dateRange){let{start:n,end:i}=e.dateRange;if(n){let o=typeof n=="number"?n:new Date(n).getTime();t.push(`${a}.created_at_epoch >= ?`),r.push(o)}if(i){let o=typeof i=="number"?i:new Date(i).getTime();t.push(`${a}.created_at_epoch <= ?`),r.push(o)}}if(e.concepts){let n=Array.isArray(e.concepts)?e.concepts:[e.concepts],i=n.map(()=>`EXISTS (SELECT 1 FROM json_each(${a}.concepts) WHERE value = ?)`);i.length>0&&(t.push(`(${i.join(" OR ")})`),r.push(...n))}if(e.files){let n=Array.isArray(e.files)?e.files:[e.files],i=n.map(()=>`(
- EXISTS (SELECT 1 FROM json_each(${a}.files_read) WHERE value LIKE ?)
- OR EXISTS (SELECT 1 FROM json_each(${a}.files_modified) WHERE value LIKE ?)
- )`);i.length>0&&(t.push(`(${i.join(" OR ")})`),n.forEach(o=>{r.push(`%${o}%`,`%${o}%`)}))}return t.length>0?t.join(" AND "):""}buildOrderClause(e="relevance",r=!0,a="observations_fts"){switch(e){case"relevance":return r?`ORDER BY ${a}.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(e,r={}){let a=[],{limit:t=50,offset:n=0,orderBy:i="relevance",...o}=r;if(!e){let l=this.buildFilterClause(o,a,"o");if(!l)throw new Error("Either query or filters required for search");let u=this.buildOrderClause(i,!1),d=`
- SELECT o.*, o.discovery_tokens
- FROM observations o
- WHERE ${l}
- ${u}
- LIMIT ? OFFSET ?
- `;return a.push(t,n),this.db.prepare(d).all(...a)}return console.warn("[SessionSearch] Text search not supported - use ChromaDB for vector search"),[]}searchSessions(e,r={}){let a=[],{limit:t=50,offset:n=0,orderBy:i="relevance",...o}=r;if(!e){let l={...o};delete l.type;let u=this.buildFilterClause(l,a,"s");if(!u)throw new Error("Either query or filters required for search");let f=`
- SELECT s.*, s.discovery_tokens
- FROM session_summaries s
- WHERE ${u}
- ${i==="date_asc"?"ORDER BY s.created_at_epoch ASC":"ORDER BY s.created_at_epoch DESC"}
- LIMIT ? OFFSET ?
- `;return a.push(t,n),this.db.prepare(f).all(...a)}return console.warn("[SessionSearch] Text search not supported - use ChromaDB for vector search"),[]}findByConcept(e,r={}){let a=[],{limit:t=50,offset:n=0,orderBy:i="date_desc",...o}=r,l={...o,concepts:e},u=this.buildFilterClause(l,a,"o"),d=this.buildOrderClause(i,!1),f=`
- SELECT o.*, o.discovery_tokens
- FROM observations o
- WHERE ${u}
- ${d}
- LIMIT ? OFFSET ?
- `;return a.push(t,n),this.db.prepare(f).all(...a)}findByFile(e,r={}){let a=[],{limit:t=50,offset:n=0,orderBy:i="date_desc",...o}=r,l={...o,files:e},u=this.buildFilterClause(l,a,"o"),d=this.buildOrderClause(i,!1),f=`
- SELECT o.*, o.discovery_tokens
- FROM observations o
- WHERE ${u}
- ${d}
- LIMIT ? OFFSET ?
- `;a.push(t,n);let h=this.db.prepare(f).all(...a),p=[],g={...o};delete g.type;let y=[];if(g.project&&(y.push("s.project = ?"),p.push(g.project)),g.dateRange){let{start:P,end:E}=g.dateRange;if(P){let R=typeof P=="number"?P:new Date(P).getTime();y.push("s.created_at_epoch >= ?"),p.push(R)}if(E){let R=typeof E=="number"?E:new Date(E).getTime();y.push("s.created_at_epoch <= ?"),p.push(R)}}y.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 ?)
- )`),p.push(`%${e}%`,`%${e}%`);let v=`
- SELECT s.*, s.discovery_tokens
- FROM session_summaries s
- WHERE ${y.join(" AND ")}
- ORDER BY s.created_at_epoch DESC
- LIMIT ? OFFSET ?
- `;p.push(t,n);let x=this.db.prepare(v).all(...p);return{observations:h,sessions:x}}findByType(e,r={}){let a=[],{limit:t=50,offset:n=0,orderBy:i="date_desc",...o}=r,l={...o,type:e},u=this.buildFilterClause(l,a,"o"),d=this.buildOrderClause(i,!1),f=`
- SELECT o.*, o.discovery_tokens
- FROM observations o
- WHERE ${u}
- ${d}
- LIMIT ? OFFSET ?
- `;return a.push(t,n),this.db.prepare(f).all(...a)}searchUserPrompts(e,r={}){let a=[],{limit:t=20,offset:n=0,orderBy:i="relevance",...o}=r,l=[];if(o.project&&(l.push("s.project = ?"),a.push(o.project)),o.dateRange){let{start:u,end:d}=o.dateRange;if(u){let f=typeof u=="number"?u:new Date(u).getTime();l.push("up.created_at_epoch >= ?"),a.push(f)}if(d){let f=typeof d=="number"?d:new Date(d).getTime();l.push("up.created_at_epoch <= ?"),a.push(f)}}if(!e){if(l.length===0)throw new Error("Either query or filters required for search");let f=`
- SELECT up.*
- FROM user_prompts up
- JOIN sdk_sessions s ON up.claude_session_id = s.claude_session_id
- ${`WHERE ${l.join(" AND ")}`}
- ${i==="date_asc"?"ORDER BY up.created_at_epoch ASC":"ORDER BY up.created_at_epoch DESC"}
- LIMIT ? OFFSET ?
- `;return a.push(t,n),this.db.prepare(f).all(...a)}return console.warn("[SessionSearch] Text search not supported - use ChromaDB for vector search"),[]}getUserPromptsBySession(e){return this.db.prepare(`
- SELECT
- id,
- claude_session_id,
- prompt_number,
- prompt_text,
- created_at,
- created_at_epoch
- FROM user_prompts
- WHERE claude_session_id = ?
- ORDER BY prompt_number ASC
- `).all(e)}close(){this.db.close()}};var wl=Ut(require("better-sqlite3"),1);var nn=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.SILENT=4]="SILENT",n))(nn||{}),on=class{level;useColor;constructor(){let e=process.env.CLAUDE_MEM_LOG_LEVEL?.toUpperCase()||"INFO";this.level=nn[e]??1,this.useColor=process.stdout.isTTY??!1}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.level===0?`${e.message}
-${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;try{let a=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&a.command){let t=a.command.length>50?a.command.substring(0,50)+"...":a.command;return`${e}(${t})`}if(e==="Read"&&a.file_path){let t=a.file_path.split("/").pop()||a.file_path;return`${e}(${t})`}if(e==="Edit"&&a.file_path){let t=a.file_path.split("/").pop()||a.file_path;return`${e}(${t})`}if(e==="Write"&&a.file_path){let t=a.file_path.split("/").pop()||a.file_path;return`${e}(${t})`}return e}catch{return e}}log(e,r,a,t,n){if(e0&&(f=` {${Object.entries(v).map(([P,E])=>`${P}=${E}`).join(", ")}}`)}let h=`[${i}] [${o}] [${l}] ${u}${a}${f}${d}`;e===3?console.error(h):console.log(h)}debug(e,r,a,t){this.log(0,e,r,a,t)}info(e,r,a,t){this.log(1,e,r,a,t)}warn(e,r,a,t){this.log(2,e,r,a,t)}error(e,r,a,t){this.log(3,e,r,a,t)}dataIn(e,r,a,t){this.info(e,`\u2192 ${r}`,a,t)}dataOut(e,r,a,t){this.info(e,`\u2190 ${r}`,a,t)}success(e,r,a,t){this.info(e,`\u2713 ${r}`,a,t)}failure(e,r,a,t){this.error(e,`\u2717 ${r}`,a,t)}timing(e,r,a,t){this.info(e,`\u23F1 ${r}`,t,{duration:`${a}ms`})}},Tl=new on;var qs=class{db;constructor(){Fs(nt),this.db=new wl.default(js),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn()}initializeSchema(){try{this.db.exec(`
- CREATE TABLE IF NOT EXISTS schema_versions (
- id INTEGER PRIMARY KEY,
- version INTEGER UNIQUE NOT NULL,
- applied_at TEXT NOT NULL
- )
- `);let e=this.db.prepare("SELECT version FROM schema_versions ORDER BY version").all();(e.length>0?Math.max(...e.map(a=>a.version)):0)===0&&(console.error("[SessionStore] Initializing fresh database with migration004..."),this.db.exec(`
- CREATE TABLE IF NOT EXISTS sdk_sessions (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- claude_session_id TEXT UNIQUE NOT NULL,
- sdk_session_id TEXT UNIQUE,
- project TEXT NOT NULL,
- user_prompt TEXT,
- started_at TEXT NOT NULL,
- started_at_epoch INTEGER NOT NULL,
- completed_at TEXT,
- completed_at_epoch INTEGER,
- status TEXT CHECK(status IN ('active', 'completed', 'failed')) NOT NULL DEFAULT 'active'
- );
-
- CREATE INDEX IF NOT EXISTS idx_sdk_sessions_claude_id ON sdk_sessions(claude_session_id);
- CREATE INDEX IF NOT EXISTS idx_sdk_sessions_sdk_id ON sdk_sessions(sdk_session_id);
- CREATE INDEX IF NOT EXISTS idx_sdk_sessions_project ON sdk_sessions(project);
- CREATE INDEX IF NOT EXISTS idx_sdk_sessions_status ON sdk_sessions(status);
- CREATE INDEX IF NOT EXISTS idx_sdk_sessions_started ON sdk_sessions(started_at_epoch DESC);
-
- CREATE TABLE IF NOT EXISTS observations (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- sdk_session_id TEXT NOT NULL,
- project TEXT NOT NULL,
- text TEXT NOT NULL,
- type TEXT NOT NULL CHECK(type IN ('decision', 'bugfix', 'feature', 'refactor', 'discovery')),
- created_at TEXT NOT NULL,
- created_at_epoch INTEGER NOT NULL,
- FOREIGN KEY(sdk_session_id) REFERENCES sdk_sessions(sdk_session_id) ON DELETE CASCADE
- );
-
- CREATE INDEX IF NOT EXISTS idx_observations_sdk_session ON observations(sdk_session_id);
- CREATE INDEX IF NOT EXISTS idx_observations_project ON observations(project);
- CREATE INDEX IF NOT EXISTS idx_observations_type ON observations(type);
- CREATE INDEX IF NOT EXISTS idx_observations_created ON observations(created_at_epoch DESC);
-
- CREATE TABLE IF NOT EXISTS session_summaries (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- sdk_session_id TEXT UNIQUE NOT NULL,
- project TEXT NOT NULL,
- request TEXT,
- investigated TEXT,
- learned TEXT,
- completed TEXT,
- next_steps TEXT,
- files_read TEXT,
- files_edited TEXT,
- notes TEXT,
- created_at TEXT NOT NULL,
- created_at_epoch INTEGER NOT NULL,
- FOREIGN KEY(sdk_session_id) REFERENCES sdk_sessions(sdk_session_id) ON DELETE CASCADE
- );
-
- CREATE INDEX IF NOT EXISTS idx_session_summaries_sdk_session ON session_summaries(sdk_session_id);
- CREATE INDEX IF NOT EXISTS idx_session_summaries_project ON session_summaries(project);
- CREATE INDEX IF NOT EXISTS idx_session_summaries_created ON session_summaries(created_at_epoch DESC);
- `),this.db.prepare("INSERT INTO schema_versions (version, applied_at) VALUES (?, ?)").run(4,new Date().toISOString()),console.error("[SessionStore] Migration004 applied successfully"))}catch(e){throw console.error("[SessionStore] Schema initialization error:",e.message),e}}ensureWorkerPortColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(5))return;this.db.pragma("table_info(sdk_sessions)").some(t=>t.name==="worker_port")||(this.db.exec("ALTER TABLE sdk_sessions ADD COLUMN worker_port INTEGER"),console.error("[SessionStore] Added worker_port column to sdk_sessions table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(5,new Date().toISOString())}catch(e){console.error("[SessionStore] Migration error:",e.message)}}ensurePromptTrackingColumns(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(6))return;this.db.pragma("table_info(sdk_sessions)").some(l=>l.name==="prompt_counter")||(this.db.exec("ALTER TABLE sdk_sessions ADD COLUMN prompt_counter INTEGER DEFAULT 0"),console.error("[SessionStore] Added prompt_counter column to sdk_sessions table")),this.db.pragma("table_info(observations)").some(l=>l.name==="prompt_number")||(this.db.exec("ALTER TABLE observations ADD COLUMN prompt_number INTEGER"),console.error("[SessionStore] Added prompt_number column to observations table")),this.db.pragma("table_info(session_summaries)").some(l=>l.name==="prompt_number")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN prompt_number INTEGER"),console.error("[SessionStore] Added prompt_number column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(6,new Date().toISOString())}catch(e){console.error("[SessionStore] Prompt tracking migration error:",e.message)}}removeSessionSummariesUniqueConstraint(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;if(!this.db.pragma("index_list(session_summaries)").some(t=>t.unique===1)){this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString());return}console.error("[SessionStore] Removing UNIQUE constraint from session_summaries.sdk_session_id..."),this.db.exec("BEGIN TRANSACTION");try{this.db.exec(`
- CREATE TABLE session_summaries_new (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- sdk_session_id TEXT NOT NULL,
- project TEXT NOT NULL,
- request TEXT,
- investigated TEXT,
- learned TEXT,
- completed TEXT,
- next_steps TEXT,
- files_read TEXT,
- files_edited TEXT,
- notes TEXT,
- prompt_number INTEGER,
- created_at TEXT NOT NULL,
- created_at_epoch INTEGER NOT NULL,
- FOREIGN KEY(sdk_session_id) REFERENCES sdk_sessions(sdk_session_id) ON DELETE CASCADE
- )
- `),this.db.exec(`
- INSERT INTO session_summaries_new
- SELECT id, sdk_session_id, project, request, investigated, learned,
- completed, next_steps, files_read, files_edited, notes,
- prompt_number, created_at, created_at_epoch
- FROM session_summaries
- `),this.db.exec("DROP TABLE session_summaries"),this.db.exec("ALTER TABLE session_summaries_new RENAME TO session_summaries"),this.db.exec(`
- CREATE INDEX idx_session_summaries_sdk_session ON session_summaries(sdk_session_id);
- CREATE INDEX idx_session_summaries_project ON session_summaries(project);
- CREATE INDEX idx_session_summaries_created ON session_summaries(created_at_epoch DESC);
- `),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString()),console.error("[SessionStore] Successfully removed UNIQUE constraint from session_summaries.sdk_session_id")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (remove UNIQUE constraint):",e.message)}}addObservationHierarchicalFields(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(8))return;if(this.db.pragma("table_info(observations)").some(t=>t.name==="title")){this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(8,new Date().toISOString());return}console.error("[SessionStore] Adding hierarchical fields to observations table..."),this.db.exec(`
- ALTER TABLE observations ADD COLUMN title TEXT;
- ALTER TABLE observations ADD COLUMN subtitle TEXT;
- ALTER TABLE observations ADD COLUMN facts TEXT;
- ALTER TABLE observations ADD COLUMN narrative TEXT;
- ALTER TABLE observations ADD COLUMN concepts TEXT;
- ALTER TABLE observations ADD COLUMN files_read TEXT;
- ALTER TABLE observations ADD COLUMN files_modified TEXT;
- `),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(8,new Date().toISOString()),console.error("[SessionStore] Successfully added hierarchical fields to observations table")}catch(e){console.error("[SessionStore] Migration error (add hierarchical fields):",e.message)}}makeObservationsTextNullable(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(9))return;let a=this.db.pragma("table_info(observations)").find(t=>t.name==="text");if(!a||a.notnull===0){this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(9,new Date().toISOString());return}console.error("[SessionStore] Making observations.text nullable..."),this.db.exec("BEGIN TRANSACTION");try{this.db.exec(`
- CREATE TABLE observations_new (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- sdk_session_id TEXT NOT NULL,
- project TEXT NOT NULL,
- text TEXT,
- type TEXT NOT NULL CHECK(type IN ('decision', 'bugfix', 'feature', 'refactor', 'discovery', 'change')),
- title TEXT,
- subtitle TEXT,
- facts TEXT,
- narrative TEXT,
- concepts TEXT,
- files_read TEXT,
- files_modified TEXT,
- prompt_number INTEGER,
- created_at TEXT NOT NULL,
- created_at_epoch INTEGER NOT NULL,
- FOREIGN KEY(sdk_session_id) REFERENCES sdk_sessions(sdk_session_id) ON DELETE CASCADE
- )
- `),this.db.exec(`
- INSERT INTO observations_new
- SELECT id, sdk_session_id, project, text, type, title, subtitle, facts,
- narrative, concepts, files_read, files_modified, prompt_number,
- created_at, created_at_epoch
- FROM observations
- `),this.db.exec("DROP TABLE observations"),this.db.exec("ALTER TABLE observations_new RENAME TO observations"),this.db.exec(`
- CREATE INDEX idx_observations_sdk_session ON observations(sdk_session_id);
- CREATE INDEX idx_observations_project ON observations(project);
- CREATE INDEX idx_observations_type ON observations(type);
- CREATE INDEX idx_observations_created ON observations(created_at_epoch DESC);
- `),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(9,new Date().toISOString()),console.error("[SessionStore] Successfully made observations.text nullable")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (make text nullable):",e.message)}}createUserPromptsTable(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(10))return;if(this.db.pragma("table_info(user_prompts)").length>0){this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString());return}console.error("[SessionStore] Creating user_prompts table with FTS5 support..."),this.db.exec("BEGIN TRANSACTION");try{this.db.exec(`
- CREATE TABLE user_prompts (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- claude_session_id TEXT NOT NULL,
- prompt_number INTEGER NOT NULL,
- prompt_text TEXT NOT NULL,
- created_at TEXT NOT NULL,
- created_at_epoch INTEGER NOT NULL,
- FOREIGN KEY(claude_session_id) REFERENCES sdk_sessions(claude_session_id) ON DELETE CASCADE
- );
-
- CREATE INDEX idx_user_prompts_claude_session ON user_prompts(claude_session_id);
- CREATE INDEX idx_user_prompts_created ON user_prompts(created_at_epoch DESC);
- CREATE INDEX idx_user_prompts_prompt_number ON user_prompts(prompt_number);
- CREATE INDEX idx_user_prompts_lookup ON user_prompts(claude_session_id, prompt_number);
- `),this.db.exec(`
- CREATE VIRTUAL TABLE user_prompts_fts USING fts5(
- prompt_text,
- content='user_prompts',
- content_rowid='id'
- );
- `),this.db.exec(`
- CREATE TRIGGER user_prompts_ai AFTER INSERT ON user_prompts BEGIN
- INSERT INTO user_prompts_fts(rowid, prompt_text)
- VALUES (new.id, new.prompt_text);
- END;
-
- CREATE TRIGGER user_prompts_ad AFTER DELETE ON user_prompts BEGIN
- INSERT INTO user_prompts_fts(user_prompts_fts, rowid, prompt_text)
- VALUES('delete', old.id, old.prompt_text);
- END;
-
- CREATE TRIGGER user_prompts_au AFTER UPDATE ON user_prompts BEGIN
- INSERT INTO user_prompts_fts(user_prompts_fts, rowid, prompt_text)
- VALUES('delete', old.id, old.prompt_text);
- INSERT INTO user_prompts_fts(rowid, prompt_text)
- VALUES (new.id, new.prompt_text);
- END;
- `),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(a){throw this.db.exec("ROLLBACK"),a}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,r=10){return this.db.prepare(`
- SELECT
- request, investigated, learned, completed, next_steps,
- files_read, files_edited, notes, prompt_number, created_at
- FROM session_summaries
- WHERE project = ?
- ORDER BY created_at_epoch DESC
- LIMIT ?
- `).all(e,r)}getRecentSummariesWithSessionInfo(e,r=3){return this.db.prepare(`
- SELECT
- sdk_session_id, request, learned, completed, next_steps,
- prompt_number, created_at
- FROM session_summaries
- WHERE project = ?
- ORDER BY created_at_epoch DESC
- LIMIT ?
- `).all(e,r)}getRecentObservations(e,r=20){return this.db.prepare(`
- SELECT type, text, prompt_number, created_at
- FROM observations
- WHERE project = ?
- ORDER BY created_at_epoch DESC
- LIMIT ?
- `).all(e,r)}getAllRecentObservations(e=100){return this.db.prepare(`
- SELECT id, type, title, subtitle, text, project, prompt_number, created_at, created_at_epoch
- FROM observations
- ORDER BY created_at_epoch DESC
- LIMIT ?
- `).all(e)}getAllRecentSummaries(e=50){return this.db.prepare(`
- SELECT id, request, investigated, learned, completed, next_steps,
- files_read, files_edited, notes, project, prompt_number,
- created_at, created_at_epoch
- FROM session_summaries
- ORDER BY created_at_epoch DESC
- LIMIT ?
- `).all(e)}getAllRecentUserPrompts(e=100){return this.db.prepare(`
- SELECT
- up.id,
- up.claude_session_id,
- s.project,
- up.prompt_number,
- up.prompt_text,
- up.created_at,
- up.created_at_epoch
- FROM user_prompts up
- LEFT JOIN sdk_sessions s ON up.claude_session_id = s.claude_session_id
- ORDER BY up.created_at_epoch DESC
- LIMIT ?
- `).all(e)}getAllProjects(){return this.db.prepare(`
- SELECT DISTINCT project
- FROM sdk_sessions
- WHERE project IS NOT NULL AND project != ''
- ORDER BY project ASC
- `).all().map(a=>a.project)}getRecentSessionsWithStatus(e,r=3){return this.db.prepare(`
- SELECT * FROM (
- SELECT
- s.sdk_session_id,
- s.status,
- s.started_at,
- s.started_at_epoch,
- s.user_prompt,
- CASE WHEN sum.sdk_session_id IS NOT NULL THEN 1 ELSE 0 END as has_summary
- FROM sdk_sessions s
- LEFT JOIN session_summaries sum ON s.sdk_session_id = sum.sdk_session_id
- WHERE s.project = ? AND s.sdk_session_id IS NOT NULL
- GROUP BY s.sdk_session_id
- ORDER BY s.started_at_epoch DESC
- LIMIT ?
- )
- ORDER BY started_at_epoch ASC
- `).all(e,r)}getObservationsForSession(e){return this.db.prepare(`
- SELECT title, subtitle, type, prompt_number
- FROM observations
- WHERE sdk_session_id = ?
- ORDER BY created_at_epoch ASC
- `).all(e)}getObservationById(e){return this.db.prepare(`
- SELECT *
- FROM observations
- WHERE id = ?
- `).get(e)||null}getObservationsByIds(e,r={}){if(e.length===0)return[];let{orderBy:a="date_desc",limit:t}=r,n=a==="date_asc"?"ASC":"DESC",i=t?`LIMIT ${t}`:"",o=e.map(()=>"?").join(",");return this.db.prepare(`
- SELECT *
- FROM observations
- WHERE id IN (${o})
- ORDER BY created_at_epoch ${n}
- ${i}
- `).all(...e)}getSummaryForSession(e){return this.db.prepare(`
- SELECT
- request, investigated, learned, completed, next_steps,
- files_read, files_edited, notes, prompt_number, created_at
- FROM session_summaries
- WHERE sdk_session_id = ?
- ORDER BY created_at_epoch DESC
- LIMIT 1
- `).get(e)||null}getFilesForSession(e){let a=this.db.prepare(`
- SELECT files_read, files_modified
- FROM observations
- WHERE sdk_session_id = ?
- `).all(e),t=new Set,n=new Set;for(let i of a){if(i.files_read)try{let o=JSON.parse(i.files_read);Array.isArray(o)&&o.forEach(l=>t.add(l))}catch{}if(i.files_modified)try{let o=JSON.parse(i.files_modified);Array.isArray(o)&&o.forEach(l=>n.add(l))}catch{}}return{filesRead:Array.from(t),filesModified:Array.from(n)}}getSessionById(e){return this.db.prepare(`
- SELECT id, claude_session_id, sdk_session_id, project, user_prompt
- FROM sdk_sessions
- WHERE id = ?
- LIMIT 1
- `).get(e)||null}findActiveSDKSession(e){return this.db.prepare(`
- SELECT id, sdk_session_id, project, worker_port
- FROM sdk_sessions
- WHERE claude_session_id = ? AND status = 'active'
- LIMIT 1
- `).get(e)||null}findAnySDKSession(e){return this.db.prepare(`
- SELECT id
- FROM sdk_sessions
- WHERE claude_session_id = ?
- LIMIT 1
- `).get(e)||null}reactivateSession(e,r){this.db.prepare(`
- UPDATE sdk_sessions
- SET status = 'active', user_prompt = ?, worker_port = NULL
- WHERE id = ?
- `).run(r,e)}incrementPromptCounter(e){return this.db.prepare(`
- UPDATE sdk_sessions
- SET prompt_counter = COALESCE(prompt_counter, 0) + 1
- WHERE id = ?
- `).run(e),this.db.prepare(`
- SELECT prompt_counter FROM sdk_sessions WHERE id = ?
- `).get(e)?.prompt_counter||1}getPromptCounter(e){return this.db.prepare(`
- SELECT prompt_counter FROM sdk_sessions WHERE id = ?
- `).get(e)?.prompt_counter||0}createSDKSession(e,r,a){let t=new Date,n=t.getTime(),o=this.db.prepare(`
- INSERT OR IGNORE INTO sdk_sessions
- (claude_session_id, sdk_session_id, project, user_prompt, started_at, started_at_epoch, status)
- VALUES (?, ?, ?, ?, ?, ?, 'active')
- `).run(e,e,r,a,t.toISOString(),n);return o.lastInsertRowid===0||o.changes===0?(r&&r.trim()!==""&&this.db.prepare(`
- UPDATE sdk_sessions
- SET project = ?, user_prompt = ?
- WHERE claude_session_id = ?
- `).run(r,a,e),this.db.prepare(`
- SELECT id FROM sdk_sessions WHERE claude_session_id = ? LIMIT 1
- `).get(e).id):o.lastInsertRowid}updateSDKSessionId(e,r){return this.db.prepare(`
- UPDATE sdk_sessions
- SET sdk_session_id = ?
- WHERE id = ? AND sdk_session_id IS NULL
- `).run(r,e).changes===0?(Tl.debug("DB","sdk_session_id already set, skipping update",{sessionId:e,sdkSessionId:r}),!1):!0}setWorkerPort(e,r){this.db.prepare(`
- UPDATE sdk_sessions
- SET worker_port = ?
- WHERE id = ?
- `).run(r,e)}getWorkerPort(e){return this.db.prepare(`
- SELECT worker_port
- FROM sdk_sessions
- WHERE id = ?
- LIMIT 1
- `).get(e)?.worker_port||null}saveUserPrompt(e,r,a){let t=new Date,n=t.getTime();return this.db.prepare(`
- INSERT INTO user_prompts
- (claude_session_id, prompt_number, prompt_text, created_at, created_at_epoch)
- VALUES (?, ?, ?, ?, ?)
- `).run(e,r,a,t.toISOString(),n).lastInsertRowid}getUserPrompt(e,r){return this.db.prepare(`
- SELECT prompt_text
- FROM user_prompts
- WHERE claude_session_id = ? AND prompt_number = ?
- LIMIT 1
- `).get(e,r)?.prompt_text??null}storeObservation(e,r,a,t,n=0){let i=new Date,o=i.getTime();this.db.prepare(`
- SELECT id FROM sdk_sessions WHERE sdk_session_id = ?
- `).get(e)||(this.db.prepare(`
- INSERT INTO sdk_sessions
- (claude_session_id, sdk_session_id, project, started_at, started_at_epoch, status)
- VALUES (?, ?, ?, ?, ?, 'active')
- `).run(e,e,r,i.toISOString(),o),console.error(`[SessionStore] Auto-created session record for session_id: ${e}`));let f=this.db.prepare(`
- INSERT INTO observations
- (sdk_session_id, project, type, title, subtitle, facts, narrative, concepts,
- files_read, files_modified, prompt_number, discovery_tokens, created_at, created_at_epoch)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- `).run(e,r,a.type,a.title,a.subtitle,JSON.stringify(a.facts),a.narrative,JSON.stringify(a.concepts),JSON.stringify(a.files_read),JSON.stringify(a.files_modified),t||null,n,i.toISOString(),o);return{id:Number(f.lastInsertRowid),createdAtEpoch:o}}storeSummary(e,r,a,t,n=0){let i=new Date,o=i.getTime();this.db.prepare(`
- SELECT id FROM sdk_sessions WHERE sdk_session_id = ?
- `).get(e)||(this.db.prepare(`
- INSERT INTO sdk_sessions
- (claude_session_id, sdk_session_id, project, started_at, started_at_epoch, status)
- VALUES (?, ?, ?, ?, ?, 'active')
- `).run(e,e,r,i.toISOString(),o),console.error(`[SessionStore] Auto-created session record for session_id: ${e}`));let f=this.db.prepare(`
- INSERT INTO session_summaries
- (sdk_session_id, project, request, investigated, learned, completed,
- next_steps, notes, prompt_number, discovery_tokens, created_at, created_at_epoch)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- `).run(e,r,a.request,a.investigated,a.learned,a.completed,a.next_steps,a.notes,t||null,n,i.toISOString(),o);return{id:Number(f.lastInsertRowid),createdAtEpoch:o}}markSessionCompleted(e){let r=new Date,a=r.getTime();this.db.prepare(`
- UPDATE sdk_sessions
- SET status = 'completed', completed_at = ?, completed_at_epoch = ?
- WHERE id = ?
- `).run(r.toISOString(),a,e)}markSessionFailed(e){let r=new Date,a=r.getTime();this.db.prepare(`
- UPDATE sdk_sessions
- SET status = 'failed', completed_at = ?, completed_at_epoch = ?
- WHERE id = ?
- `).run(r.toISOString(),a,e)}getSessionSummariesByIds(e,r={}){if(e.length===0)return[];let{orderBy:a="date_desc",limit:t}=r,n=a==="date_asc"?"ASC":"DESC",i=t?`LIMIT ${t}`:"",o=e.map(()=>"?").join(",");return this.db.prepare(`
- SELECT * FROM session_summaries
- WHERE id IN (${o})
- ORDER BY created_at_epoch ${n}
- ${i}
- `).all(...e)}getUserPromptsByIds(e,r={}){if(e.length===0)return[];let{orderBy:a="date_desc",limit:t}=r,n=a==="date_asc"?"ASC":"DESC",i=t?`LIMIT ${t}`:"",o=e.map(()=>"?").join(",");return this.db.prepare(`
- SELECT
- up.*,
- s.project,
- s.sdk_session_id
- FROM user_prompts up
- JOIN sdk_sessions s ON up.claude_session_id = s.claude_session_id
- WHERE up.id IN (${o})
- ORDER BY up.created_at_epoch ${n}
- ${i}
- `).all(...e)}getTimelineAroundTimestamp(e,r=10,a=10,t){return this.getTimelineAroundObservation(null,e,r,a,t)}getTimelineAroundObservation(e,r,a=10,t=10,n){let i=n?"AND project = ?":"",o=n?[n]:[],l,u;if(e!==null){let p=`
- SELECT id, created_at_epoch
- FROM observations
- WHERE id <= ? ${i}
- ORDER BY id DESC
- LIMIT ?
- `,g=`
- SELECT id, created_at_epoch
- FROM observations
- WHERE id >= ? ${i}
- ORDER BY id ASC
- LIMIT ?
- `;try{let y=this.db.prepare(p).all(e,...o,a+1),v=this.db.prepare(g).all(e,...o,t+1);if(y.length===0&&v.length===0)return{observations:[],sessions:[],prompts:[]};l=y.length>0?y[y.length-1].created_at_epoch:r,u=v.length>0?v[v.length-1].created_at_epoch:r}catch(y){return console.error("[SessionStore] Error getting boundary observations:",y.message),{observations:[],sessions:[],prompts:[]}}}else{let p=`
- SELECT created_at_epoch
- FROM observations
- WHERE created_at_epoch <= ? ${i}
- ORDER BY created_at_epoch DESC
- LIMIT ?
- `,g=`
- SELECT created_at_epoch
- FROM observations
- WHERE created_at_epoch >= ? ${i}
- ORDER BY created_at_epoch ASC
- LIMIT ?
- `;try{let y=this.db.prepare(p).all(r,...o,a),v=this.db.prepare(g).all(r,...o,t+1);if(y.length===0&&v.length===0)return{observations:[],sessions:[],prompts:[]};l=y.length>0?y[y.length-1].created_at_epoch:r,u=v.length>0?v[v.length-1].created_at_epoch:r}catch(y){return console.error("[SessionStore] Error getting boundary timestamps:",y.message),{observations:[],sessions:[],prompts:[]}}}let d=`
- SELECT *
- FROM observations
- WHERE created_at_epoch >= ? AND created_at_epoch <= ? ${i}
- ORDER BY created_at_epoch ASC
- `,f=`
- SELECT *
- FROM session_summaries
- WHERE created_at_epoch >= ? AND created_at_epoch <= ? ${i}
- ORDER BY created_at_epoch ASC
- `,h=`
- SELECT up.*, s.project, s.sdk_session_id
- FROM user_prompts up
- JOIN sdk_sessions s ON up.claude_session_id = s.claude_session_id
- WHERE up.created_at_epoch >= ? AND up.created_at_epoch <= ? ${i.replace("project","s.project")}
- ORDER BY up.created_at_epoch ASC
- `;try{let p=this.db.prepare(d).all(l,u,...o),g=this.db.prepare(f).all(l,u,...o),y=this.db.prepare(h).all(l,u,...o);return{observations:p,sessions:g.map(v=>({id:v.id,sdk_session_id:v.sdk_session_id,project:v.project,request:v.request,completed:v.completed,next_steps:v.next_steps,created_at:v.created_at,created_at_epoch:v.created_at_epoch})),prompts:y.map(v=>({id:v.id,claude_session_id:v.claude_session_id,project:v.project,prompt:v.prompt_text,created_at:v.created_at,created_at_epoch:v.created_at_epoch}))}}catch(p){return console.error("[SessionStore] Error querying timeline records:",p.message),{observations:[],sessions:[],prompts:[]}}}close(){this.db.close()}};var Ol=require("fs"),Pl=require("os"),Il=require("path"),Rh=(0,Il.join)((0,Pl.homedir)(),".claude-mem","silent.log");function q(s,e,r=""){let a=new Date().toISOString(),o=((new Error().stack||"").split(`
-`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=o?`${o[1].split("/").pop()}:${o[2]}`:"unknown",u=`[${a}] [${l}] ${s}`;if(e!==void 0)try{u+=` ${JSON.stringify(e)}`}catch(d){u+=` [stringify error: ${d}]`}u+=`
-`;try{(0,Ol.appendFileSync)(Rh,u)}catch(d){console.error("[silent-debug] Failed to write to log:",d)}return r}var be,oe,Oe=null,Th="cm__claude-mem";try{be=new Ms,oe=new qs}catch(s){q("[search-server] Failed to initialize search:",s.message),process.exit(1)}async function Ze(s,e,r){if(!Oe)throw new Error("Chroma client not initialized");q("queryChroma called",{query:s,limit:e,whereFilter:r});let a=r?JSON.stringify(r):void 0;q("where filter stringified",{whereFilter:r,whereStringified:a});let t={collection_name:Th,query_texts:[s],n_results:e,include:["documents","metadatas","distances"],where:a};q("calling chroma_query_documents",t);let n=await Oe.callTool({name:"chroma_query_documents",arguments:t}),i=n.content[0]?.text||"";q("chroma response received",{hasContent:!!n.content[0]?.text,textLength:i.length,textPreview:i.substring(0,200)});let o;try{o=JSON.parse(i)}catch(h){return q("[search-server] Failed to parse Chroma response as JSON:",h),q("[search-server] Raw Chroma response:",i),{ids:[],distances:[],metadatas:[]}}let l=[],u=o.ids?.[0]||[];for(let h of u){let p=h.match(/obs_(\d+)_/),g=h.match(/summary_(\d+)_/),y=h.match(/prompt_(\d+)/),v=null;p?v=parseInt(p[1],10):g?v=parseInt(g[1],10):y&&(v=parseInt(y[1],10)),v!==null&&!l.includes(v)&&l.push(v)}let d=o.distances?.[0]||[],f=o.metadatas?.[0]||[];return{ids:l,distances:d,metadatas:f}}function or(){return`
----
-\u{1F4A1} Search Strategy:
-ALWAYS search with index format FIRST to get an overview and identify relevant results.
-This is critical for token efficiency - index format uses ~10x fewer tokens than full format.
-
-Search workflow:
-1. Initial search: Use default (index) format to see titles, dates, and sources
-2. Review results: Identify which items are most relevant to your needs
-3. Deep dive: Only then use format: "full" on specific items of interest
-4. Narrow down: Use filters (type, dateStart/dateEnd, concepts, files) to refine results
-
-Other tips:
-\u2022 To search by concept: Use find_by_concept tool
-\u2022 To browse by type: Use find_by_type with ["decision", "feature", etc.]
-\u2022 To sort by date: Use orderBy: "date_desc" or "date_asc"`}function cn(s,e,r,a,t){if(s.length===0)return s;let n=-1;if(typeof e=="number")n=s.findIndex(l=>l.type==="observation"&&l.data.id===e);else if(typeof e=="string"&&e.startsWith("S")){let l=parseInt(e.slice(1),10);n=s.findIndex(u=>u.type==="session"&&u.data.id===l)}else n=s.findIndex(l=>l.epoch>=r),n===-1&&(n=s.length-1);if(n===-1)return s;let i=Math.max(0,n-a),o=Math.min(s.length,n+t+1);return s.slice(i,o)}function Dt(s,e){let r=s.title||`Observation #${s.id}`,a=new Date(s.created_at_epoch).toLocaleString(),t=s.type?`[${s.type}]`:"";return`${e+1}. ${t} ${r}
- Date: ${a}
- Source: claude-mem://observation/${s.id}`}function ln(s,e){let r=s.request||`Session ${s.sdk_session_id?.substring(0,8)||"unknown"}`,a=new Date(s.created_at_epoch).toLocaleString();return`${e+1}. ${r}
- Date: ${a}
- Source: claude-mem://session/${s.sdk_session_id}`}function Ct(s){let e=s.title||`Observation #${s.id}`,r=[];r.push(`## ${e}`),r.push(`*Source: claude-mem://observation/${s.id}*`),r.push(""),s.subtitle&&(r.push(`**${s.subtitle}**`),r.push("")),s.narrative&&(r.push(s.narrative),r.push("")),s.text&&(r.push(s.text),r.push(""));let a=[];if(a.push(`Type: ${s.type}`),s.facts)try{let n=JSON.parse(s.facts);n.length>0&&a.push(`Facts: ${n.join("; ")}`)}catch{}if(s.concepts)try{let n=JSON.parse(s.concepts);n.length>0&&a.push(`Concepts: ${n.join(", ")}`)}catch{}if(s.files_read||s.files_modified){let n=[];if(s.files_read)try{n.push(...JSON.parse(s.files_read))}catch{}if(s.files_modified)try{n.push(...JSON.parse(s.files_modified))}catch{}n.length>0&&a.push(`Files: ${[...new Set(n)].join(", ")}`)}a.length>0&&(r.push("---"),r.push(a.join(" | ")));let t=new Date(s.created_at_epoch).toLocaleString();return r.push(""),r.push("---"),r.push(`Date: ${t}`),r.join(`
-`)}function un(s){let e=s.request||`Session ${s.sdk_session_id?.substring(0,8)||"unknown"}`,r=[];r.push(`## ${e}`),r.push(`*Source: claude-mem://session/${s.sdk_session_id}*`),r.push(""),s.completed&&(r.push(`**Completed:** ${s.completed}`),r.push("")),s.learned&&(r.push(`**Learned:** ${s.learned}`),r.push("")),s.investigated&&(r.push(`**Investigated:** ${s.investigated}`),r.push("")),s.next_steps&&(r.push(`**Next Steps:** ${s.next_steps}`),r.push("")),s.notes&&(r.push(`**Notes:** ${s.notes}`),r.push(""));let a=[];if(s.files_read||s.files_edited){let n=[];if(s.files_read)try{n.push(...JSON.parse(s.files_read))}catch{}if(s.files_edited)try{n.push(...JSON.parse(s.files_edited))}catch{}n.length>0&&a.push(`Files: ${[...new Set(n)].join(", ")}`)}let t=new Date(s.created_at_epoch).toLocaleDateString();return a.push(`Date: ${t}`),a.length>0&&(r.push("---"),r.push(a.join(" | "))),r.join(`
-`)}function Nl(s,e){let r=new Date(s.created_at_epoch).toLocaleString();return`${e+1}. "${s.prompt_text}"
- Date: ${r} | Prompt #${s.prompt_number}
- Source: claude-mem://user-prompt/${s.id}`}function Al(s){let e=[];e.push(`## User Prompt #${s.prompt_number}`),e.push(`*Source: claude-mem://user-prompt/${s.id}*`),e.push(""),e.push(s.prompt_text),e.push(""),e.push("---");let r=new Date(s.created_at_epoch).toLocaleString();return e.push(`Date: ${r}`),e.join(`
-`)}function ft(s){let e={...s};return e.concepts&&typeof e.concepts=="string"&&(e.concepts=e.concepts.split(",").map(r=>r.trim()).filter(Boolean)),e.files&&typeof e.files=="string"&&(e.files=e.files.split(",").map(r=>r.trim()).filter(Boolean)),e.obs_type&&typeof e.obs_type=="string"&&(e.obs_type=e.obs_type.split(",").map(r=>r.trim()).filter(Boolean)),e.type&&typeof e.type=="string"&&e.type.includes(",")&&(e.type=e.type.split(",").map(r=>r.trim()).filter(Boolean)),(e.dateStart||e.dateEnd)&&(e.dateRange={start:e.dateStart,end:e.dateEnd},delete e.dateStart,delete e.dateEnd),e}var wh=c.object({project:c.string().optional().describe("Filter by project name"),type:c.union([c.enum(["decision","bugfix","feature","refactor","discovery","change"]),c.array(c.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).optional().describe("Filter by observation type (single value or comma-separated list)"),concepts:c.union([c.string(),c.array(c.string())]).optional().describe("Filter by concept tags (single value or comma-separated list)"),files:c.union([c.string(),c.array(c.string())]).optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date (ISO string or epoch)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date (ISO string or epoch)"),dateRange:c.object({start:c.union([c.string(),c.number()]).optional().describe("Start date (ISO string or epoch)"),end:c.union([c.string(),c.number()]).optional().describe("End date (ISO string or epoch)")}).optional().describe("Filter by date range (use dateStart/dateEnd instead for simpler URLs)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),Dl=[{name:"search",description:'Unified search across all memory types (observations, sessions, and user prompts) using vector-first semantic search (ChromaDB). Returns combined results from all document types. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({query:c.string().optional().describe("Natural language search query for semantic ranking via ChromaDB vector search. Optional - omit for date-filtered queries only (Chroma cannot filter by date, requires direct SQLite)."),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),type:c.enum(["observations","sessions","prompts"]).optional().describe("Filter by document type (observations, sessions, or prompts). Omit to search all types."),obs_type:c.string().optional().describe('Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change). Only applies when type="observations"'),concepts:c.string().optional().describe('Filter by concept tags (single value or comma-separated list). Only applies when type="observations"'),files:c.string().optional().describe('Filter by file paths (single value or comma-separated list for partial match). Only applies when type="observations"'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{query:r,format:a="index",type:t,obs_type:n,concepts:i,files:o,...l}=e,u=[],d=[],f=[],h=!t||t==="observations",p=!t||t==="sessions",g=!t||t==="prompts";if(r)if(Oe){let E=!1;try{q(`[search-server] Using ChromaDB semantic search (type filter: ${t||"all"})`);let R;t==="observations"?R={doc_type:"observation"}:t==="sessions"?R={doc_type:"session_summary"}:t==="prompts"&&(R={doc_type:"user_prompt"});let T=await Ze(r,100,R);if(E=!0,q(`[search-server] ChromaDB returned ${T.ids.length} semantic matches`),T.ids.length>0){let S=Date.now()-7776e6,I=T.metadatas.map((C,k)=>({id:T.ids[k],meta:C,isRecent:C&&C.created_at_epoch>S})).filter(C=>C.isRecent);q(`[search-server] ${I.length} results within 90-day window`);let D=[],$=[],L=[];for(let C of I){let k=C.meta?.doc_type;k==="observation"&&h?D.push(C.id):k==="session_summary"&&p?$.push(C.id):k==="user_prompt"&&g&&L.push(C.id)}if(q(`[search-server] Categorized: ${D.length} obs, ${$.length} sessions, ${L.length} prompts`),D.length>0){let C={...l,type:n,concepts:i,files:o};u=oe.getObservationsByIds(D,C)}$.length>0&&(d=oe.getSessionSummariesByIds($,{orderBy:"date_desc",limit:l.limit})),L.length>0&&(f=oe.getUserPromptsByIds(L,{orderBy:"date_desc",limit:l.limit})),q(`[search-server] Hydrated ${u.length} obs, ${d.length} sessions, ${f.length} prompts from SQLite`)}else q("[search-server] ChromaDB found no matches (this is final - NOT falling back to FTS5)")}catch(R){q("[search-server] ChromaDB failed - returning empty results (FTS5 fallback removed):",R.message),q("[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),u=[],d=[],f=[]}}else q("[search-server] ChromaDB not initialized - returning empty results (FTS5 fallback removed)"),q("[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),u=[],d=[],f=[];else{q("[search-server] Filter-only query (no query text), using direct SQLite filtering (enables date filters)");let E={...l,type:n,concepts:i,files:o};h&&(u=be.searchObservations(void 0,E)),p&&(d=be.searchSessions(void 0,l)),g&&(f=be.searchUserPrompts(void 0,l))}let y=u.length+d.length+f.length;if(y===0)return{content:[{type:"text",text:`No results found matching "${r}"`}]};let v=[...u.map(E=>({type:"observation",data:E,epoch:E.created_at_epoch})),...d.map(E=>({type:"session",data:E,epoch:E.created_at_epoch})),...f.map(E=>({type:"prompt",data:E,epoch:E.created_at_epoch}))];l.orderBy==="date_desc"?v.sort((E,R)=>R.epoch-E.epoch):l.orderBy==="date_asc"&&v.sort((E,R)=>E.epoch-R.epoch);let x=v.slice(0,l.limit||20),P;if(a==="index"){let E=`Found ${y} result(s) matching "${r}" (${u.length} obs, ${d.length} sessions, ${f.length} prompts):
-
-`,R=x.map((T,S)=>T.type==="observation"?Dt(T.data,S):T.type==="session"?ln(T.data,S):Nl(T.data,S));P=E+R.join(`
-
-`)+or()}else P=x.map(R=>R.type==="observation"?Ct(R.data):R.type==="session"?un(R.data):Al(R.data)).join(`
-
----
-
-`);return{content:[{type:"text",text:P}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"timeline",description:"Get a unified timeline of context around a specific point in time OR search query. Supports two modes: (1) anchor-based: provide observation ID, session ID, or timestamp to center timeline around; (2) query-based: provide natural language query to find relevant observation and center timeline around it. All record types (observations, sessions, prompts) are interleaved chronologically.",inputSchema:c.object({anchor:c.union([c.number(),c.string()]).optional().describe('Anchor point: observation ID (number), session ID (e.g., "S123"), or ISO timestamp. Use this OR query, not both.'),query:c.string().optional().describe("Natural language search query to find relevant observation as anchor. Use this OR anchor, not both."),depth_before:c.number().min(0).max(50).default(10).describe("Number of records to retrieve before anchor (default: 10)"),depth_after:c.number().min(0).max(50).default(10).describe("Number of records to retrieve after anchor (default: 10)"),project:c.string().optional().describe("Filter by project name")}),handler:async s=>{try{let y=function(S){return new Date(S).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})},v=function(S){return new Date(S).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},x=function(S){return new Date(S).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})},P=function(S){return S?Math.ceil(S.length/4):0};var e=y,r=v,a=x,t=P;let{anchor:n,query:i,depth_before:o=10,depth_after:l=10,project:u}=s;if(!n&&!i)return{content:[{type:"text",text:'Error: Must provide either "anchor" or "query" parameter'}],isError:!0};if(n&&i)return{content:[{type:"text",text:'Error: Cannot provide both "anchor" and "query" parameters. Use one or the other.'}],isError:!0};let d,f,h;if(i){let S=[];if(Oe)try{q("[search-server] Using hybrid semantic search for timeline query");let D=await Ze(i,100);if(q(`[search-server] Chroma returned ${D.ids.length} semantic matches`),D.ids.length>0){let $=Date.now()-7776e6,L=D.ids.filter((C,k)=>{let N=D.metadatas[k];return N&&N.created_at_epoch>$});L.length>0&&(S=oe.getObservationsByIds(L,{orderBy:"date_desc",limit:1}))}}catch(D){q("[search-server] Chroma query failed - no results (FTS5 fallback removed):",D.message)}if(S.length===0)return{content:[{type:"text",text:`No observations found matching "${i}". Try a different search query.`}]};let I=S[0];d=I.id,f=I.created_at_epoch,q(`[search-server] Query mode: Using observation #${I.id} as timeline anchor`),h=oe.getTimelineAroundObservation(I.id,I.created_at_epoch,o,l,u)}else if(typeof n=="number"){let S=oe.getObservationById(n);if(!S)return{content:[{type:"text",text:`Observation #${n} not found`}],isError:!0};d=n,f=S.created_at_epoch,h=oe.getTimelineAroundObservation(n,f,o,l,u)}else if(typeof n=="string")if(n.startsWith("S")||n.startsWith("#S")){let S=n.replace(/^#?S/,""),I=parseInt(S,10),D=oe.getSessionSummariesByIds([I]);if(D.length===0)return{content:[{type:"text",text:`Session #${I} not found`}],isError:!0};f=D[0].created_at_epoch,d=`S${I}`,h=oe.getTimelineAroundTimestamp(f,o,l,u)}else{let S=new Date(n);if(isNaN(S.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${n}`}],isError:!0};f=S.getTime(),d=n,h=oe.getTimelineAroundTimestamp(f,o,l,u)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let p=[...h.observations.map(S=>({type:"observation",data:S,epoch:S.created_at_epoch})),...h.sessions.map(S=>({type:"session",data:S,epoch:S.created_at_epoch})),...h.prompts.map(S=>({type:"prompt",data:S,epoch:S.created_at_epoch}))];p.sort((S,I)=>S.epoch-I.epoch);let g=cn(p,d,f,o,l);if(g.length===0)return{content:[{type:"text",text:i?`Found observation matching "${i}", but no timeline context available (${o} records before, ${l} records after).`:`No context found around anchor (${o} records before, ${l} records after)`}]};let E=[];if(i){let S=g.find(D=>D.type==="observation"&&D.data.id===d),I=S?S.data.title||"Untitled":"Unknown";E.push(`# Timeline for query: "${i}"`),E.push(`**Anchor:** Observation #${d} - ${I}`)}else E.push(`# Timeline around anchor: ${d}`);E.push(`**Window:** ${o} records before \u2192 ${l} records after | **Items:** ${g.length}`),E.push(""),E.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),E.push("");let R=new Map;for(let S of g){let I=y(S.epoch);R.has(I)||R.set(I,[]),R.get(I).push(S)}let T=Array.from(R.entries()).sort((S,I)=>{let D=new Date(S[0]).getTime(),$=new Date(I[0]).getTime();return D-$});for(let[S,I]of T){E.push(`### ${S}`),E.push("");let D=null,$="",L=!1;for(let C of I){let k=typeof d=="number"&&C.type==="observation"&&C.data.id===d||typeof d=="string"&&d.startsWith("S")&&C.type==="session"&&`S${C.data.id}`===d;if(C.type==="session"){L&&(E.push(""),L=!1,D=null,$="");let N=C.data,A=N.request||"Session summary",M=`claude-mem://session-summary/${N.id}`,W=k?" \u2190 **ANCHOR**":"";E.push(`**\u{1F3AF} #S${N.id}** ${A} (${x(C.epoch)}) [\u2192](${M})${W}`),E.push("")}else if(C.type==="prompt"){L&&(E.push(""),L=!1,D=null,$="");let N=C.data,A=N.prompt.length>100?N.prompt.substring(0,100)+"...":N.prompt;E.push(`**\u{1F4AC} User Prompt #${N.prompt_number}** (${x(C.epoch)})`),E.push(`> ${A}`),E.push("")}else if(C.type==="observation"){let N=C.data,A="General";A!==D&&(L&&E.push(""),E.push(`**${A}**`),E.push("| ID | Time | T | Title | Tokens |"),E.push("|----|------|---|-------|--------|"),D=A,L=!0,$="");let M="\u2022";switch(N.type){case"bugfix":M="\u{1F534}";break;case"feature":M="\u{1F7E3}";break;case"refactor":M="\u{1F504}";break;case"change":M="\u2705";break;case"discovery":M="\u{1F535}";break;case"decision":M="\u{1F9E0}";break}let W=v(C.epoch),Q=N.title||"Untitled",te=P(N.narrative),Z=W!==$?W:"\u2033";$=W;let fe=k?" \u2190 **ANCHOR**":"";E.push(`| #${N.id} | ${Z} | ${M} | ${Q}${fe} | ~${te} |`)}}L&&E.push("")}return{content:[{type:"text",text:E.join(`
-`)}]}}catch(n){return{content:[{type:"text",text:`Timeline query failed: ${n.message}`}],isError:!0}}}},{name:"decisions",description:"Semantic shortcut to find decision-type observations. Returns observations where important architectural, technical, or process decisions were made. Supports optional semantic search query to filter decisions by relevance.",inputSchema:c.object({query:c.string().optional().describe("Search query to filter decisions semantically"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default), "full" for complete details'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{query:r,format:a="index",...t}=e,n=[];if(Oe)try{if(r){q("[search-server] Using Chroma semantic search with type=decision filter");let l=(await Ze(r,Math.min((t.limit||20)*2,100),{type:"decision"})).ids;l.length>0&&(n=oe.getObservationsByIds(l,{...t,type:"decision"}),n.sort((u,d)=>l.indexOf(u.id)-l.indexOf(d.id)))}else{q("[search-server] Using metadata-first + semantic ranking for decisions");let o=be.findByType("decision",t);if(o.length>0){let l=o.map(f=>f.id),u=await Ze("decision",Math.min(l.length,100)),d=[];for(let f of u.ids)l.includes(f)&&!d.includes(f)&&d.push(f);d.length>0&&(n=oe.getObservationsByIds(d,{limit:t.limit||20}),n.sort((f,h)=>d.indexOf(f.id)-d.indexOf(h.id)))}}}catch(o){q("[search-server] Chroma search failed, using SQLite fallback:",o.message)}if(n.length===0&&(n=be.findByType("decision",t)),n.length===0)return{content:[{type:"text",text:"No decision observations found"}]};let i;if(a==="index"){let o=`Found ${n.length} decision(s):
-
-`,l=n.map((u,d)=>Dt(u,d));i=o+l.join(`
-
-`)}else i=n.map(l=>Ct(l)).join(`
-
----
-
-`);return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"changes",description:'Semantic shortcut to find change-related observations. Returns observations documenting what changed in the codebase, system behavior, or project state. Searches for type="change" OR concept="change" OR concept="what-changed".',inputSchema:c.object({format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default), "full" for complete details'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{format:r="index",...a}=e,t=[];if(Oe)try{q("[search-server] Using hybrid search for change-related observations");let i=be.findByType("change",a),o=be.findByConcept("change",a),l=be.findByConcept("what-changed",a),u=new Set;if([...i,...o,...l].forEach(d=>u.add(d.id)),u.size>0){let d=Array.from(u),f=await Ze("what changed",Math.min(d.length,100)),h=[];for(let p of f.ids)d.includes(p)&&!h.includes(p)&&h.push(p);h.length>0&&(t=oe.getObservationsByIds(h,{limit:a.limit||20}),t.sort((p,g)=>h.indexOf(p.id)-h.indexOf(g.id)))}}catch(i){q("[search-server] Chroma ranking failed, using SQLite order:",i.message)}if(t.length===0){let i=be.findByType("change",a),o=be.findByConcept("change",a),l=be.findByConcept("what-changed",a),u=new Set;[...i,...o,...l].forEach(d=>u.add(d.id)),t=Array.from(u).map(d=>i.find(f=>f.id===d)||o.find(f=>f.id===d)||l.find(f=>f.id===d)).filter(Boolean),t.sort((d,f)=>f.created_at_epoch-d.created_at_epoch),t=t.slice(0,a.limit||20)}if(t.length===0)return{content:[{type:"text",text:"No change-related observations found"}]};let n;if(r==="index"){let i=`Found ${t.length} change-related observation(s):
-
-`,o=t.map((l,u)=>Dt(l,u));n=i+o.join(`
-
-`)}else n=t.map(o=>Ct(o)).join(`
-
----
-
-`);return{content:[{type:"text",text:n}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"how_it_works",description:'Semantic shortcut to find "how it works" explanations. Returns observations documenting system architecture, component interactions, data flow, and technical mechanisms. Searches for concept="how-it-works".',inputSchema:c.object({format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default), "full" for complete details'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{format:r="index",...a}=e,t=[];if(Oe)try{q("[search-server] Using metadata-first + semantic ranking for how-it-works");let i=be.findByConcept("how-it-works",a);if(i.length>0){let o=i.map(d=>d.id),l=await Ze("how it works architecture",Math.min(o.length,100)),u=[];for(let d of l.ids)o.includes(d)&&!u.includes(d)&&u.push(d);u.length>0&&(t=oe.getObservationsByIds(u,{limit:a.limit||20}),t.sort((d,f)=>u.indexOf(d.id)-u.indexOf(f.id)))}}catch(i){q("[search-server] Chroma ranking failed, using SQLite order:",i.message)}if(t.length===0&&(t=be.findByConcept("how-it-works",a)),t.length===0)return{content:[{type:"text",text:'No "how it works" observations found'}]};let n;if(r==="index"){let i=`Found ${t.length} "how it works" observation(s):
-
-`,o=t.map((l,u)=>Dt(l,u));n=i+o.join(`
-
-`)}else n=t.map(o=>Ct(o)).join(`
-
----
-
-`);return{content:[{type:"text",text:n}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"search_observations",description:'DEPRECATED: Use the unified "search" tool instead. Search observations using vector-first semantic search (ChromaDB). IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({query:c.string().describe("Natural language search query for semantic ranking via ChromaDB vector search"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),...wh.shape}),handler:async s=>{try{let e=ft(s),{query:r,format:a="index",...t}=e,n=[];if(Oe)try{q("[search-server] Using hybrid semantic search (Chroma + SQLite)");let o=await Ze(r,100);if(q(`[search-server] Chroma returned ${o.ids.length} semantic matches`),o.ids.length>0){let l=Date.now()-7776e6,u=o.ids.filter((d,f)=>{let h=o.metadatas[f];return h&&h.created_at_epoch>l});if(q(`[search-server] ${u.length} results within 90-day window`),u.length>0){let d=t.limit||20;n=oe.getObservationsByIds(u,{orderBy:"date_desc",limit:d}),q(`[search-server] Hydrated ${n.length} observations from SQLite`)}}}catch(o){q("[search-server] Chroma query failed - no results (FTS5 fallback removed):",o.message)}if(n.length===0)return{content:[{type:"text",text:`No observations found matching "${r}"`}]};let i;if(a==="index"){let o=`Found ${n.length} observation(s) matching "${r}":
-
-`,l=n.map((u,d)=>Dt(u,d));i=o+l.join(`
-
-`)+or()}else i=n.map(l=>Ct(l)).join(`
-
----
-
-`);return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"search_sessions",description:'DEPRECATED: Use the unified "search" tool instead. Search session summaries using vector-first semantic search (ChromaDB). IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({query:c.string().describe("Natural language search query for semantic ranking via ChromaDB vector search"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{query:r,format:a="index",...t}=e,n=[];if(Oe)try{q("[search-server] Using hybrid semantic search for sessions");let o=await Ze(r,100,{doc_type:"session_summary"});if(q(`[search-server] Chroma returned ${o.ids.length} semantic matches`),o.ids.length>0){let l=Date.now()-7776e6,u=o.ids.filter((d,f)=>{let h=o.metadatas[f];return h&&h.created_at_epoch>l});if(q(`[search-server] ${u.length} results within 90-day window`),u.length>0){let d=t.limit||20;n=oe.getSessionSummariesByIds(u,{orderBy:"date_desc",limit:d}),q(`[search-server] Hydrated ${n.length} sessions from SQLite`)}}}catch(o){q("[search-server] Chroma query failed - no results (FTS5 fallback removed):",o.message)}if(n.length===0)return{content:[{type:"text",text:`No sessions found matching "${r}"`}]};let i;if(a==="index"){let o=`Found ${n.length} session(s) matching "${r}":
-
-`,l=n.map((u,d)=>ln(u,d));i=o+l.join(`
-
-`)+or()}else i=n.map(l=>un(l)).join(`
-
----
-
-`);return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_concept",description:'Find observations tagged with a specific concept. Available concepts: "discovery", "problem-solution", "what-changed", "how-it-works", "pattern", "gotcha", "change". IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({concept:c.string().describe("Concept tag to search for. Available: discovery, problem-solution, what-changed, how-it-works, pattern, gotcha, change"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode."),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{concept:r,format:a="index",...t}=e,n=[];if(Oe)try{q("[search-server] Using metadata-first + semantic ranking for concept search");let o=be.findByConcept(r,t);if(q(`[search-server] Found ${o.length} observations with concept "${r}"`),o.length>0){let l=o.map(f=>f.id),u=await Ze(r,Math.min(l.length,100)),d=[];for(let f of u.ids)l.includes(f)&&!d.includes(f)&&d.push(f);q(`[search-server] Chroma ranked ${d.length} results by semantic relevance`),d.length>0&&(n=oe.getObservationsByIds(d,{limit:t.limit||20}),n.sort((f,h)=>d.indexOf(f.id)-d.indexOf(h.id)))}}catch(o){q("[search-server] Chroma ranking failed, using SQLite order:",o.message)}if(n.length===0&&(q("[search-server] Using SQLite-only concept search"),n=be.findByConcept(r,t)),n.length===0)return{content:[{type:"text",text:`No observations found with concept "${r}"`}]};let i;if(a==="index"){let o=`Found ${n.length} observation(s) with concept "${r}":
-
-`,l=n.map((u,d)=>Dt(u,d));i=o+l.join(`
-
-`)+or()}else i=n.map(l=>Ct(l)).join(`
-
----
-
-`);return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_file",description:'Find observations and sessions that reference a specific file path. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({filePath:c.string().describe("File path to search for (supports partial matching)"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode."),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{filePath:r,format:a="index",...t}=e,n=[],i=[];if(Oe)try{q("[search-server] Using metadata-first + semantic ranking for file search");let u=be.findByFile(r,t);if(q(`[search-server] Found ${u.observations.length} observations, ${u.sessions.length} sessions for file "${r}"`),i=u.sessions,u.observations.length>0){let d=u.observations.map(p=>p.id),f=await Ze(r,Math.min(d.length,100)),h=[];for(let p of f.ids)d.includes(p)&&!h.includes(p)&&h.push(p);q(`[search-server] Chroma ranked ${h.length} observations by semantic relevance`),h.length>0&&(n=oe.getObservationsByIds(h,{limit:t.limit||20}),n.sort((p,g)=>h.indexOf(p.id)-h.indexOf(g.id)))}}catch(u){q("[search-server] Chroma ranking failed, using SQLite order:",u.message)}if(n.length===0&&i.length===0){q("[search-server] Using SQLite-only file search");let u=be.findByFile(r,t);n=u.observations,i=u.sessions}let o=n.length+i.length;if(o===0)return{content:[{type:"text",text:`No results found for file "${r}"`}]};let l;if(a==="index"){let u=`Found ${o} result(s) for file "${r}":
-
-`,d=[];n.forEach((f,h)=>{d.push(Dt(f,h))}),i.forEach((f,h)=>{d.push(ln(f,h+n.length))}),l=u+d.join(`
-
-`)+or()}else{let u=[];n.forEach(d=>{u.push(Ct(d))}),i.forEach(d=>{u.push(un(d))}),l=u.join(`
-
----
-
-`)}return{content:[{type:"text",text:l}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_type",description:'Find observations of a specific type (decision, bugfix, feature, refactor, discovery, change). IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({type:c.string().describe("Observation type(s) to filter by (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode."),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{type:r,format:a="index",...t}=e,n=Array.isArray(r)?r.join(", "):r,i=[];if(Oe)try{q("[search-server] Using metadata-first + semantic ranking for type search");let l=be.findByType(r,t);if(q(`[search-server] Found ${l.length} observations with type "${n}"`),l.length>0){let u=l.map(h=>h.id),d=await Ze(n,Math.min(u.length,100)),f=[];for(let h of d.ids)u.includes(h)&&!f.includes(h)&&f.push(h);q(`[search-server] Chroma ranked ${f.length} results by semantic relevance`),f.length>0&&(i=oe.getObservationsByIds(f,{limit:t.limit||20}),i.sort((h,p)=>f.indexOf(h.id)-f.indexOf(p.id)))}}catch(l){q("[search-server] Chroma ranking failed, using SQLite order:",l.message)}if(i.length===0&&(q("[search-server] Using SQLite-only type search"),i=be.findByType(r,t)),i.length===0)return{content:[{type:"text",text:`No observations found with type "${n}"`}]};let o;if(a==="index"){let l=`Found ${i.length} observation(s) with type "${n}":
-
-`,u=i.map((d,f)=>Dt(d,f));o=l+u.join(`
-
-`)+or()}else o=i.map(u=>Ct(u)).join(`
-
----
-
-`);return{content:[{type:"text",text:o}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"get_recent_context",description:"Get recent session context including summaries and observations for a project",inputSchema:c.object({project:c.string().optional().describe("Project name (defaults to current working directory basename)"),limit:c.number().min(1).max(10).default(3).describe("Number of recent sessions to retrieve")}),handler:async s=>{try{let e=s.project||(0,$l.basename)(process.cwd()),r=s.limit||3,a=oe.getRecentSessionsWithStatus(e,r);if(a.length===0)return{content:[{type:"text",text:`# Recent Session Context
-
-No previous sessions found for project "${e}".`}]};let t=[];t.push("# Recent Session Context"),t.push(""),t.push(`Showing last ${a.length} session(s) for **${e}**:`),t.push("");for(let n of a)if(n.sdk_session_id){if(t.push("---"),t.push(""),n.has_summary){let i=oe.getSummaryForSession(n.sdk_session_id);if(i){let o=i.prompt_number?` (Prompt #${i.prompt_number})`:"";if(t.push(`**Summary${o}**`),t.push(""),i.request&&t.push(`**Request:** ${i.request}`),i.completed&&t.push(`**Completed:** ${i.completed}`),i.learned&&t.push(`**Learned:** ${i.learned}`),i.next_steps&&t.push(`**Next Steps:** ${i.next_steps}`),i.files_read)try{let u=JSON.parse(i.files_read);Array.isArray(u)&&u.length>0&&t.push(`**Files Read:** ${u.join(", ")}`)}catch{i.files_read.trim()&&t.push(`**Files Read:** ${i.files_read}`)}if(i.files_edited)try{let u=JSON.parse(i.files_edited);Array.isArray(u)&&u.length>0&&t.push(`**Files Edited:** ${u.join(", ")}`)}catch{i.files_edited.trim()&&t.push(`**Files Edited:** ${i.files_edited}`)}let l=new Date(i.created_at).toLocaleString();t.push(`**Date:** ${l}`)}}else if(n.status==="active"){t.push("**In Progress**"),t.push(""),n.user_prompt&&t.push(`**Request:** ${n.user_prompt}`);let i=oe.getObservationsForSession(n.sdk_session_id);if(i.length>0){t.push(""),t.push(`**Observations (${i.length}):**`);for(let l of i)t.push(`- ${l.title}`)}else t.push(""),t.push("*No observations yet*");t.push(""),t.push("**Status:** Active - summary pending");let o=new Date(n.started_at).toLocaleString();t.push(`**Date:** ${o}`)}else{t.push(`**${n.status.charAt(0).toUpperCase()+n.status.slice(1)}**`),t.push(""),n.user_prompt&&t.push(`**Request:** ${n.user_prompt}`),t.push(""),t.push(`**Status:** ${n.status} - no summary available`);let i=new Date(n.started_at).toLocaleString();t.push(`**Date:** ${i}`)}t.push("")}return{content:[{type:"text",text:t.join(`
-`)}]}}catch(e){return{content:[{type:"text",text:`Failed to get recent context: ${e.message}`}],isError:!0}}}},{name:"search_user_prompts",description:'DEPRECATED: Use the unified "search" tool instead. Search raw user prompts using vector-first semantic search (ChromaDB). Use this to find what the user actually said/requested across all sessions. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:c.object({query:c.string().describe("Natural language search query for semantic ranking via ChromaDB vector search"),format:c.enum(["index","full"]).default("index").describe('Output format: "index" for truncated prompts/dates (default, RECOMMENDED for initial search), "full" for complete prompt text (use only after reviewing index results)'),project:c.string().optional().describe("Filter by project name"),dateStart:c.union([c.string(),c.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:c.union([c.string(),c.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:c.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:c.number().min(0).default(0).describe("Number of results to skip"),orderBy:c.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async s=>{try{let e=ft(s),{query:r,format:a="index",...t}=e,n=[];if(Oe)try{q("[search-server] Using hybrid semantic search for user prompts");let o=await Ze(r,100,{doc_type:"user_prompt"});if(q(`[search-server] Chroma returned ${o.ids.length} semantic matches`),o.ids.length>0){let l=Date.now()-7776e6,u=o.ids.filter((d,f)=>{let h=o.metadatas[f];return h&&h.created_at_epoch>l});if(q(`[search-server] ${u.length} results within 90-day window`),u.length>0){let d=t.limit||20;n=oe.getUserPromptsByIds(u,{orderBy:"date_desc",limit:d}),q(`[search-server] Hydrated ${n.length} user prompts from SQLite`)}}}catch(o){q("[search-server] Chroma query failed - no results (FTS5 fallback removed):",o.message)}if(n.length===0)return{content:[{type:"text",text:`No user prompts found matching "${r}"`}]};let i;if(a==="index"){let o=`Found ${n.length} user prompt(s) matching "${r}":
-
-`,l=n.map((u,d)=>Nl(u,d));i=o+l.join(`
-
-`)+or()}else i=n.map(l=>Al(l)).join(`
-
----
-
-`);return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"get_context_timeline",description:'Get a unified timeline of context (observations, sessions, and prompts) around a specific point in time. All record types are interleaved chronologically. Useful for understanding "what was happening when X occurred". Returns depth_before records before anchor + anchor + depth_after records after (total: depth_before + 1 + depth_after mixed records).',inputSchema:c.object({anchor:c.union([c.number().describe("Observation ID to center timeline around"),c.string().describe("Session ID (format: S123) or ISO timestamp to center timeline around")]).describe('Anchor point: observation ID, session ID (e.g., "S123"), or ISO timestamp'),depth_before:c.number().min(0).max(50).default(10).describe("Number of records to retrieve before anchor, not including anchor (default: 10)"),depth_after:c.number().min(0).max(50).default(10).describe("Number of records to retrieve after anchor, not including anchor (default: 10)"),project:c.string().optional().describe("Filter by project name")}),handler:async s=>{try{let g=function(T){return new Date(T).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})},y=function(T){return new Date(T).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},v=function(T){return new Date(T).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})},x=function(T){return T?Math.ceil(T.length/4):0};var e=g,r=y,a=v,t=x;let{anchor:n,depth_before:i=10,depth_after:o=10,project:l}=s,u,d=n,f;if(typeof n=="number"){let T=oe.getObservationById(n);if(!T)return{content:[{type:"text",text:`Observation #${n} not found`}],isError:!0};u=T.created_at_epoch,f=oe.getTimelineAroundObservation(n,u,i,o,l)}else if(typeof n=="string")if(n.startsWith("S")||n.startsWith("#S")){let T=n.replace(/^#?S/,""),S=parseInt(T,10),I=oe.getSessionSummariesByIds([S]);if(I.length===0)return{content:[{type:"text",text:`Session #${S} not found`}],isError:!0};u=I[0].created_at_epoch,d=`S${S}`,f=oe.getTimelineAroundTimestamp(u,i,o,l)}else{let T=new Date(n);if(isNaN(T.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${n}`}],isError:!0};u=T.getTime(),f=oe.getTimelineAroundTimestamp(u,i,o,l)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let h=[...f.observations.map(T=>({type:"observation",data:T,epoch:T.created_at_epoch})),...f.sessions.map(T=>({type:"session",data:T,epoch:T.created_at_epoch})),...f.prompts.map(T=>({type:"prompt",data:T,epoch:T.created_at_epoch}))];h.sort((T,S)=>T.epoch-S.epoch);let p=cn(h,d,u,i,o);if(p.length===0)return{content:[{type:"text",text:`No context found around ${new Date(u).toLocaleString()} (${i} records before, ${o} records after)`}]};let P=[];P.push(`# Timeline around anchor: ${d}`),P.push(`**Window:** ${i} records before \u2192 ${o} records after | **Items:** ${p.length}`),P.push(""),P.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),P.push("");let E=new Map;for(let T of p){let S=g(T.epoch);E.has(S)||E.set(S,[]),E.get(S).push(T)}let R=Array.from(E.entries()).sort((T,S)=>{let I=new Date(T[0]).getTime(),D=new Date(S[0]).getTime();return I-D});for(let[T,S]of R){P.push(`### ${T}`),P.push("");let I=null,D="",$=!1;for(let L of S){let C=typeof d=="number"&&L.type==="observation"&&L.data.id===d||typeof d=="string"&&d.startsWith("S")&&L.type==="session"&&`S${L.data.id}`===d;if(L.type==="session"){$&&(P.push(""),$=!1,I=null,D="");let k=L.data,N=k.request||"Session summary",A=`claude-mem://session-summary/${k.id}`,M=C?" \u2190 **ANCHOR**":"";P.push(`**\u{1F3AF} #S${k.id}** ${N} (${v(L.epoch)}) [\u2192](${A})${M}`),P.push("")}else if(L.type==="prompt"){$&&(P.push(""),$=!1,I=null,D="");let k=L.data,N=k.prompt.length>100?k.prompt.substring(0,100)+"...":k.prompt;P.push(`**\u{1F4AC} User Prompt #${k.prompt_number}** (${v(L.epoch)})`),P.push(`> ${N}`),P.push("")}else if(L.type==="observation"){let k=L.data,N="General";N!==I&&($&&P.push(""),P.push(`**${N}**`),P.push("| ID | Time | T | Title | Tokens |"),P.push("|----|------|---|-------|--------|"),I=N,$=!0,D="");let A="\u2022";switch(k.type){case"bugfix":A="\u{1F534}";break;case"feature":A="\u{1F7E3}";break;case"refactor":A="\u{1F504}";break;case"change":A="\u2705";break;case"discovery":A="\u{1F535}";break;case"decision":A="\u{1F9E0}";break}let M=y(L.epoch),W=k.title||"Untitled",Q=x(k.narrative),K=M!==D?M:"\u2033";D=M;let Z=C?" \u2190 **ANCHOR**":"";P.push(`| #${k.id} | ${K} | ${A} | ${W}${Z} | ~${Q} |`)}}$&&P.push("")}return{content:[{type:"text",text:P.join(`
-`)}]}}catch(n){return{content:[{type:"text",text:`Timeline query failed: ${n.message}`}],isError:!0}}}},{name:"get_timeline_by_query",description:'Search for observations using natural language and get timeline context around the best match. Two modes: "auto" (default) automatically uses top result as timeline anchor; "interactive" returns top matches for you to choose from. This combines search + timeline into a single operation for faster context discovery.',inputSchema:c.object({query:c.string().describe("Natural language search query to find relevant observations"),mode:c.enum(["auto","interactive"]).default("auto").describe("auto: Automatically use top search result as timeline anchor. interactive: Show top N search results for manual anchor selection."),depth_before:c.number().min(0).max(50).default(10).describe("Number of timeline records before anchor (default: 10)"),depth_after:c.number().min(0).max(50).default(10).describe("Number of timeline records after anchor (default: 10)"),limit:c.number().min(1).max(20).default(5).describe("For interactive mode: number of top search results to display (default: 5)"),project:c.string().optional().describe("Filter by project name")}),handler:async s=>{try{let{query:n,mode:i="auto",depth_before:o=10,depth_after:l=10,limit:u=5,project:d}=s,f=[];if(Oe)try{q("[search-server] Using hybrid semantic search for timeline query");let h=await Ze(n,100);if(q(`[search-server] Chroma returned ${h.ids.length} semantic matches`),h.ids.length>0){let p=Date.now()-7776e6,g=h.ids.filter((y,v)=>{let x=h.metadatas[v];return x&&x.created_at_epoch>p});q(`[search-server] ${g.length} results within 90-day window`),g.length>0&&(f=oe.getObservationsByIds(g,{orderBy:"date_desc",limit:i==="auto"?1:u}),q(`[search-server] Hydrated ${f.length} observations from SQLite`))}}catch(h){q("[search-server] Chroma query failed - no results (FTS5 fallback removed):",h.message)}if(f.length===0)return{content:[{type:"text",text:`No observations found matching "${n}". Try a different search query.`}]};if(i==="interactive"){let h=[];h.push("# Timeline Anchor Search Results"),h.push(""),h.push(`Found ${f.length} observation(s) matching "${n}"`),h.push(""),h.push("To get timeline context around any of these observations, use the `get_context_timeline` tool with the observation ID as the anchor."),h.push(""),h.push(`**Top ${f.length} matches:**`),h.push("");for(let p=0;p({type:"observation",data:I,epoch:I.created_at_epoch})),...p.sessions.map(I=>({type:"session",data:I,epoch:I.created_at_epoch})),...p.prompts.map(I=>({type:"prompt",data:I,epoch:I.created_at_epoch}))];g.sort((I,D)=>I.epoch-D.epoch);let y=cn(g,h.id,0,o,l);if(y.length===0)return{content:[{type:"text",text:`Found observation #${h.id} matching "${n}", but no timeline context available (${o} records before, ${l} records after).`}]};let R=[];R.push(`# Timeline for query: "${n}"`),R.push(`**Anchor:** Observation #${h.id} - ${h.title||"Untitled"}`),R.push(`**Window:** ${o} records before \u2192 ${l} records after | **Items:** ${y.length}`),R.push(""),R.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),R.push("");let T=new Map;for(let I of y){let D=v(I.epoch);T.has(D)||T.set(D,[]),T.get(D).push(I)}let S=Array.from(T.entries()).sort((I,D)=>{let $=new Date(I[0]).getTime(),L=new Date(D[0]).getTime();return $-L});for(let[I,D]of S){R.push(`### ${I}`),R.push("");let $=null,L="",C=!1;for(let k of D){let N=k.type==="observation"&&k.data.id===h.id;if(k.type==="session"){C&&(R.push(""),C=!1,$=null,L="");let A=k.data,M=A.request||"Session summary",W=`claude-mem://session-summary/${A.id}`;R.push(`**\u{1F3AF} #S${A.id}** ${M} (${P(k.epoch)}) [\u2192](${W})`),R.push("")}else if(k.type==="prompt"){C&&(R.push(""),C=!1,$=null,L="");let A=k.data,M=A.prompt.length>100?A.prompt.substring(0,100)+"...":A.prompt;R.push(`**\u{1F4AC} User Prompt #${A.prompt_number}** (${P(k.epoch)})`),R.push(`> ${M}`),R.push("")}else if(k.type==="observation"){let A=k.data,M="General";M!==$&&(C&&R.push(""),R.push(`**${M}**`),R.push("| ID | Time | T | Title | Tokens |"),R.push("|----|------|---|-------|--------|"),$=M,C=!0,L="");let W="\u2022";switch(A.type){case"bugfix":W="\u{1F534}";break;case"feature":W="\u{1F7E3}";break;case"refactor":W="\u{1F504}";break;case"change":W="\u2705";break;case"discovery":W="\u{1F535}";break;case"decision":W="\u{1F9E0}";break}let Q=x(k.epoch),te=A.title||"Untitled",K=E(A.narrative),fe=Q!==L?Q:"\u2033";L=Q;let Te=N?" \u2190 **ANCHOR**":"";R.push(`| #${A.id} | ${fe} | ${W} | ${te}${Te} | ~${K} |`)}}C&&R.push("")}return{content:[{type:"text",text:R.join(`
-`)}]}}}catch(n){return{content:[{type:"text",text:`Timeline query failed: ${n.message}`}],isError:!0}}}}],dn=new Os({name:"claude-mem-search",version:"1.0.0"},{capabilities:{tools:{}}});dn.setRequestHandler(ca,async()=>({tools:Dl.map(s=>({name:s.name,description:s.description,inputSchema:tn(s.inputSchema)}))}));dn.setRequestHandler(ua,async s=>{let e=Dl.find(r=>r.name===s.params.name);if(!e)throw new Error(`Unknown tool: ${s.params.name}`);try{return await e.handler(s.params.arguments||{})}catch(r){return{content:[{type:"text",text:`Tool execution failed: ${r.message}`}],isError:!0}}});async function Cl(){if(q("[search-server] Shutting down..."),Oe)try{await Oe.close(),q("[search-server] Chroma client closed")}catch(s){q("[search-server] Error closing Chroma client:",s.message)}if(be)try{be.close(),q("[search-server] SessionSearch closed")}catch(s){q("[search-server] Error closing SessionSearch:",s.message)}if(oe)try{oe.close(),q("[search-server] SessionStore closed")}catch(s){q("[search-server] Error closing SessionStore:",s.message)}q("[search-server] Shutdown complete"),process.exit(0)}process.on("SIGTERM",Cl);process.on("SIGINT",Cl);async function Oh(){let s=new Is;await dn.connect(s),q("[search-server] Claude-mem search server started"),setTimeout(async()=>{try{q("[search-server] Initializing Chroma client...");let e=new $s({command:"uvx",args:["chroma-mcp","--client-type","persistent","--data-dir",xl],stderr:"ignore"}),r=new Ns({name:"claude-mem-search-chroma-client",version:"1.0.0"},{capabilities:{}});await r.connect(e),Oe=r,q("[search-server] Chroma client connected successfully")}catch(e){q("[search-server] Failed to initialize Chroma client:",e.message),q("[search-server] Vector search unavailable - text queries will return empty results (FTS5 fallback removed)"),q("[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),Oe=null}},0)}Oh().catch(s=>{q("[search-server] Fatal error:",s),process.exit(1)});
-/*! Bundled license information:
-
-uri-js/dist/es5/uri.all.js:
- (** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
-*/
diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs
index bdb76831..7ac60a5a 100755
--- a/plugin/scripts/worker-service.cjs
+++ b/plugin/scripts/worker-service.cjs
@@ -919,7 +919,7 @@ MEMORY PROCESSING CONTINUED
`,n=[];t&&(i+=" WHERE s.project = ?",n.push(t)),i+=" ORDER BY up.created_at_epoch DESC LIMIT ? OFFSET ?",n.push(r+1,e);let l=s.prepare(i).all(...n);return{items:l.slice(0,r),hasMore:l.length>r,offset:e,limit:r}}paginate(e,r,t,s,i){let n=this.dbManager.getSessionStore().db,o=`SELECT ${r} FROM ${e}`,l=[];i&&(o+=" WHERE project = ?",l.push(i)),o+=" ORDER BY created_at_epoch DESC LIMIT ? OFFSET ?",l.push(s+1,t);let u=n.prepare(o).all(...l);return{items:u.slice(0,s),hasMore:u.length>s,offset:t,limit:s}}};wt();var _l=class{dbManager;defaultSettings={sidebarOpen:!0,selectedProject:null,theme:"system"};constructor(e){this.dbManager=e}getSettings(){let e=this.dbManager.getSessionStore().db;try{let t=e.prepare("SELECT key, value FROM viewer_settings").all(),s={...this.defaultSettings};for(let i of t){let n=i.key;n in s&&(s[n]=JSON.parse(i.value))}return s}catch(r){return W.debug("WORKER","Failed to load settings, using defaults",{},r),{...this.defaultSettings}}}updateSettings(e){let t=this.dbManager.getSessionStore().db.prepare(`
INSERT OR REPLACE INTO viewer_settings (key, value)
VALUES (?, ?)
- `);for(let[s,i]of Object.entries(e))t.run(s,JSON.stringify(i));return this.getSettings()}};var ww=require("path");var Sl=class{constructor(e,r,t,s,i){this.sessionSearch=e;this.sessionStore=r;this.chromaSync=t;this.formatter=s;this.timelineService=i}async queryChroma(e,r,t){return await this.chromaSync.queryChroma(e,r,t)}normalizeParams(e){let r={...e};return r.concepts&&typeof r.concepts=="string"&&(r.concepts=r.concepts.split(",").map(t=>t.trim()).filter(Boolean)),r.files&&typeof r.files=="string"&&(r.files=r.files.split(",").map(t=>t.trim()).filter(Boolean)),r.obs_type&&typeof r.obs_type=="string"&&(r.obs_type=r.obs_type.split(",").map(t=>t.trim()).filter(Boolean)),r.type&&typeof r.type=="string"&&r.type.includes(",")&&(r.type=r.type.split(",").map(t=>t.trim()).filter(Boolean)),(r.dateStart||r.dateEnd)&&(r.dateRange={start:r.dateStart,end:r.dateEnd},delete r.dateStart,delete r.dateEnd),r}async search(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",type:i,obs_type:n,concepts:o,files:l,...c}=r,u=[],p=[],f=[],d=!i||i==="observations",v=!i||i==="sessions",h=!i||i==="prompts";if(t)if(this.chromaSync){let w=!1;try{ie(`[search-server] Using ChromaDB semantic search (type filter: ${i||"all"})`);let P;i==="observations"?P={doc_type:"observation"}:i==="sessions"?P={doc_type:"session_summary"}:i==="prompts"&&(P={doc_type:"user_prompt"});let T=await this.queryChroma(t,100,P);if(w=!0,ie(`[search-server] ChromaDB returned ${T.ids.length} semantic matches`),T.ids.length>0){let C=Date.now()-7776e6,D=T.metadatas.map((k,O)=>({id:T.ids[O],meta:k,isRecent:k&&k.created_at_epoch>C})).filter(k=>k.isRecent);ie(`[search-server] ${D.length} results within 90-day window`);let A=[],j=[],N=[];for(let k of D){let O=k.meta?.doc_type;O==="observation"&&d?A.push(k.id):O==="session_summary"&&v?j.push(k.id):O==="user_prompt"&&h&&N.push(k.id)}if(ie(`[search-server] Categorized: ${A.length} obs, ${j.length} sessions, ${N.length} prompts`),A.length>0){let k={...c,type:n,concepts:o,files:l};u=this.sessionStore.getObservationsByIds(A,k)}j.length>0&&(p=this.sessionStore.getSessionSummariesByIds(j,{orderBy:"date_desc",limit:c.limit})),N.length>0&&(f=this.sessionStore.getUserPromptsByIds(N,{orderBy:"date_desc",limit:c.limit})),ie(`[search-server] Hydrated ${u.length} obs, ${p.length} sessions, ${f.length} prompts from SQLite`)}else ie("[search-server] ChromaDB found no matches (this is final - NOT falling back to FTS5)")}catch(P){ie("[search-server] ChromaDB failed - returning empty results (FTS5 fallback removed):",P.message),ie("[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),u=[],p=[],f=[]}}else ie("[search-server] ChromaDB not initialized - returning empty results (FTS5 fallback removed)"),ie("[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),u=[],p=[],f=[];else{ie("[search-server] Filter-only query (no query text), using direct SQLite filtering (enables date filters)");let w={...c,type:n,concepts:o,files:l};d&&(u=this.sessionSearch.searchObservations(void 0,w)),v&&(p=this.sessionSearch.searchSessions(void 0,c)),h&&(f=this.sessionSearch.searchUserPrompts(void 0,c))}let m=u.length+p.length+f.length;if(m===0)return{content:[{type:"text",text:`No results found matching "${t}"`}]};let y=[...u.map(w=>({type:"observation",data:w,epoch:w.created_at_epoch})),...p.map(w=>({type:"session",data:w,epoch:w.created_at_epoch})),...f.map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch}))];c.orderBy==="date_desc"?y.sort((w,P)=>P.epoch-w.epoch):c.orderBy==="date_asc"&&y.sort((w,P)=>w.epoch-P.epoch);let g=y.slice(0,c.limit||20),b;if(s==="index"){let w=`Found ${m} result(s) matching "${t}" (${u.length} obs, ${p.length} sessions, ${f.length} prompts):
+ `);for(let[s,i]of Object.entries(e))t.run(s,JSON.stringify(i));return this.getSettings()}};var ww=require("path");var Sl=class{constructor(e,r,t,s,i){this.sessionSearch=e;this.sessionStore=r;this.chromaSync=t;this.formatter=s;this.timelineService=i}async queryChroma(e,r,t){return await this.chromaSync.queryChroma(e,r,t)}normalizeParams(e){let r={...e};return r.concepts&&typeof r.concepts=="string"&&(r.concepts=r.concepts.split(",").map(t=>t.trim()).filter(Boolean)),r.files&&typeof r.files=="string"&&(r.files=r.files.split(",").map(t=>t.trim()).filter(Boolean)),r.obs_type&&typeof r.obs_type=="string"&&(r.obs_type=r.obs_type.split(",").map(t=>t.trim()).filter(Boolean)),r.type&&typeof r.type=="string"&&r.type.includes(",")&&(r.type=r.type.split(",").map(t=>t.trim()).filter(Boolean)),(r.dateStart||r.dateEnd)&&(r.dateRange={start:r.dateStart,end:r.dateEnd},delete r.dateStart,delete r.dateEnd),r}async search(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",type:i,obs_type:n,concepts:o,files:l,...c}=r,u=[],p=[],f=[],d=!i||i==="observations",v=!i||i==="sessions",h=!i||i==="prompts";if(t)if(this.chromaSync){let w=!1;try{ie(`[mcp-server] Using ChromaDB semantic search (type filter: ${i||"all"})`);let P;i==="observations"?P={doc_type:"observation"}:i==="sessions"?P={doc_type:"session_summary"}:i==="prompts"&&(P={doc_type:"user_prompt"});let T=await this.queryChroma(t,100,P);if(w=!0,ie(`[mcp-server] ChromaDB returned ${T.ids.length} semantic matches`),T.ids.length>0){let C=Date.now()-7776e6,D=T.metadatas.map((k,O)=>({id:T.ids[O],meta:k,isRecent:k&&k.created_at_epoch>C})).filter(k=>k.isRecent);ie(`[mcp-server] ${D.length} results within 90-day window`);let A=[],j=[],N=[];for(let k of D){let O=k.meta?.doc_type;O==="observation"&&d?A.push(k.id):O==="session_summary"&&v?j.push(k.id):O==="user_prompt"&&h&&N.push(k.id)}if(ie(`[mcp-server] Categorized: ${A.length} obs, ${j.length} sessions, ${N.length} prompts`),A.length>0){let k={...c,type:n,concepts:o,files:l};u=this.sessionStore.getObservationsByIds(A,k)}j.length>0&&(p=this.sessionStore.getSessionSummariesByIds(j,{orderBy:"date_desc",limit:c.limit})),N.length>0&&(f=this.sessionStore.getUserPromptsByIds(N,{orderBy:"date_desc",limit:c.limit})),ie(`[mcp-server] Hydrated ${u.length} obs, ${p.length} sessions, ${f.length} prompts from SQLite`)}else ie("[mcp-server] ChromaDB found no matches (this is final - NOT falling back to FTS5)")}catch(P){ie("[mcp-server] ChromaDB failed - returning empty results (FTS5 fallback removed):",P.message),ie("[mcp-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),u=[],p=[],f=[]}}else ie("[mcp-server] ChromaDB not initialized - returning empty results (FTS5 fallback removed)"),ie("[mcp-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/"),u=[],p=[],f=[];else{ie("[mcp-server] Filter-only query (no query text), using direct SQLite filtering (enables date filters)");let w={...c,type:n,concepts:o,files:l};d&&(u=this.sessionSearch.searchObservations(void 0,w)),v&&(p=this.sessionSearch.searchSessions(void 0,c)),h&&(f=this.sessionSearch.searchUserPrompts(void 0,c))}let m=u.length+p.length+f.length;if(m===0)return{content:[{type:"text",text:`No results found matching "${t}"`}]};let y=[...u.map(w=>({type:"observation",data:w,epoch:w.created_at_epoch})),...p.map(w=>({type:"session",data:w,epoch:w.created_at_epoch})),...f.map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch}))];c.orderBy==="date_desc"?y.sort((w,P)=>P.epoch-w.epoch):c.orderBy==="date_asc"&&y.sort((w,P)=>w.epoch-P.epoch);let g=y.slice(0,c.limit||20),b;if(s==="index"){let w=`Found ${m} result(s) matching "${t}" (${u.length} obs, ${p.length} sessions, ${f.length} prompts):
`,P=g.map((T,C)=>T.type==="observation"?this.formatter.formatObservationIndex(T.data,C):T.type==="session"?this.formatter.formatSessionIndex(T.data,C):this.formatter.formatUserPromptIndex(T.data,C));b=w+P.join(`
@@ -927,8 +927,8 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:b}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async timeline(e){try{let{anchor:r,query:t,depth_before:s=10,depth_after:i=10,project:n}=e;if(!r&&!t)return{content:[{type:"text",text:'Error: Must provide either "anchor" or "query" parameter'}],isError:!0};if(r&&t)return{content:[{type:"text",text:'Error: Cannot provide both "anchor" and "query" parameters. Use one or the other.'}],isError:!0};let o,l,c;if(t){let b=[];if(this.chromaSync)try{ie("[search-server] Using hybrid semantic search for timeline query");let P=await this.queryChroma(t,100);if(ie(`[search-server] Chroma returned ${P?.ids?.length??0} semantic matches`),P?.ids&&P.ids.length>0){let T=Date.now()-7776e6,C=P.ids.filter((D,A)=>{let j=P.metadatas[A];return j&&j.created_at_epoch>T});C.length>0&&(b=this.sessionStore.getObservationsByIds(C,{orderBy:"date_desc",limit:1}))}}catch(P){ie("[search-server] Chroma query failed - no results (FTS5 fallback removed):",P.message)}if(b.length===0)return{content:[{type:"text",text:`No observations found matching "${t}". Try a different search query.`}]};let w=b[0];o=w.id,l=w.created_at_epoch,ie(`[search-server] Query mode: Using observation #${w.id} as timeline anchor`),c=this.sessionStore.getTimelineAroundObservation(w.id,w.created_at_epoch,s,i,n)}else if(typeof r=="number"){let b=this.sessionStore.getObservationById(r);if(!b)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};o=r,l=b.created_at_epoch,c=this.sessionStore.getTimelineAroundObservation(r,l,s,i,n)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let b=r.replace(/^#?S/,""),w=parseInt(b,10),P=this.sessionStore.getSessionSummariesByIds([w]);if(P.length===0)return{content:[{type:"text",text:`Session #${w} not found`}],isError:!0};l=P[0].created_at_epoch,o=`S${w}`,c=this.sessionStore.getTimelineAroundTimestamp(l,s,i,n)}else{let b=new Date(r);if(isNaN(b.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};l=b.getTime(),o=r,c=this.sessionStore.getTimelineAroundTimestamp(l,s,i,n)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let u=[...(c.observations||[]).map(b=>({type:"observation",data:b,epoch:b.created_at_epoch})),...(c.sessions||[]).map(b=>({type:"session",data:b,epoch:b.created_at_epoch})),...(c.prompts||[]).map(b=>({type:"prompt",data:b,epoch:b.created_at_epoch}))];u.sort((b,w)=>b.epoch-w.epoch);let p=this.timelineService.filterByDepth(u,o,l,s,i);if(!p||p.length===0)return{content:[{type:"text",text:t?`Found observation matching "${t}", but no timeline context available (${s} records before, ${i} records after).`:`No context found around anchor (${s} records before, ${i} records after)`}]};let f=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),d=b=>new Date(b).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),v=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),h=b=>b?Math.ceil(b.length/4):0,m=[];if(t){let b=p.find(P=>P.type==="observation"&&P.data.id===o),w=b&&b.type==="observation"?b.data.title||"Untitled":"Unknown";m.push(`# Timeline for query: "${t}"`),m.push(`**Anchor:** Observation #${o} - ${w}`)}else m.push(`# Timeline around anchor: ${o}`);m.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${p?.length??0}`),m.push(""),m.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),m.push("");let y=new Map;for(let b of p){let w=f(b.epoch);y.has(w)||y.set(w,[]),y.get(w).push(b)}let g=Array.from(y.entries()).sort((b,w)=>{let P=new Date(b[0]).getTime(),T=new Date(w[0]).getTime();return P-T});for(let[b,w]of g){m.push(`### ${b}`),m.push("");let P=null,T="",C=!1;for(let D of w){let A=typeof o=="number"&&D.type==="observation"&&D.data.id===o||typeof o=="string"&&o.startsWith("S")&&D.type==="session"&&`S${D.data.id}`===o;if(D.type==="session"){C&&(m.push(""),C=!1,P=null,T="");let j=D.data,N=j.request||"Session summary",k=`claude-mem://session-summary/${j.id}`,O=A?" \u2190 **ANCHOR**":"";m.push(`**\u{1F3AF} #S${j.id}** ${N} (${v(D.epoch)}) [\u2192](${k})${O}`),m.push("")}else if(D.type==="prompt"){C&&(m.push(""),C=!1,P=null,T="");let j=D.data,N=j.prompt_text.length>100?j.prompt_text.substring(0,100)+"...":j.prompt_text;m.push(`**\u{1F4AC} User Prompt #${j.prompt_number}** (${v(D.epoch)})`),m.push(`> ${N}`),m.push("")}else if(D.type==="observation"){let j=D.data,N="General";N!==P&&(C&&m.push(""),m.push(`**${N}**`),m.push("| ID | Time | T | Title | Tokens |"),m.push("|----|------|---|-------|--------|"),P=N,C=!0,T="");let k="\u2022";switch(j.type){case"bugfix":k="\u{1F534}";break;case"feature":k="\u{1F7E3}";break;case"refactor":k="\u{1F504}";break;case"change":k="\u2705";break;case"discovery":k="\u{1F535}";break;case"decision":k="\u{1F9E0}";break}let O=d(D.epoch),$=j.title||"Untitled",F=h(j.narrative),H=O!==T?O:"\u2033";T=O;let K=A?" \u2190 **ANCHOR**":"";m.push(`| #${j.id} | ${H} | ${k} | ${$}${K} | ~${F} |`)}}C&&m.push("")}return{content:[{type:"text",text:m.join(`
-`)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async decisions(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{if(t){ie("[search-server] Using Chroma semantic search with type=decision filter");let c=(await this.queryChroma(t,Math.min((i.limit||20)*2,100),{type:"decision"})).ids;c.length>0&&(n=this.sessionStore.getObservationsByIds(c,{...i,type:"decision"}),n.sort((u,p)=>c.indexOf(u.id)-c.indexOf(p.id)))}else{ie("[search-server] Using metadata-first + semantic ranking for decisions");let l=this.sessionSearch.findByType("decision",i);if(l.length>0){let c=l.map(f=>f.id),u=await this.queryChroma("decision",Math.min(c.length,100)),p=[];for(let f of u.ids)c.includes(f)&&!p.includes(f)&&p.push(f);p.length>0&&(n=this.sessionStore.getObservationsByIds(p,{limit:i.limit||20}),n.sort((f,d)=>p.indexOf(f.id)-p.indexOf(d.id)))}}}catch(l){ie("[search-server] Chroma search failed, using SQLite fallback:",l.message)}if(n.length===0&&(n=this.sessionSearch.findByType("decision",i)),n.length===0)return{content:[{type:"text",text:"No decision observations found"}]};let o;if(s==="index"){let l=`Found ${n.length} decision(s):
+`);return{content:[{type:"text",text:b}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async timeline(e){try{let{anchor:r,query:t,depth_before:s=10,depth_after:i=10,project:n}=e;if(!r&&!t)return{content:[{type:"text",text:'Error: Must provide either "anchor" or "query" parameter'}],isError:!0};if(r&&t)return{content:[{type:"text",text:'Error: Cannot provide both "anchor" and "query" parameters. Use one or the other.'}],isError:!0};let o,l,c;if(t){let b=[];if(this.chromaSync)try{ie("[mcp-server] Using hybrid semantic search for timeline query");let P=await this.queryChroma(t,100);if(ie(`[mcp-server] Chroma returned ${P?.ids?.length??0} semantic matches`),P?.ids&&P.ids.length>0){let T=Date.now()-7776e6,C=P.ids.filter((D,A)=>{let j=P.metadatas[A];return j&&j.created_at_epoch>T});C.length>0&&(b=this.sessionStore.getObservationsByIds(C,{orderBy:"date_desc",limit:1}))}}catch(P){ie("[mcp-server] Chroma query failed - no results (FTS5 fallback removed):",P.message)}if(b.length===0)return{content:[{type:"text",text:`No observations found matching "${t}". Try a different search query.`}]};let w=b[0];o=w.id,l=w.created_at_epoch,ie(`[mcp-server] Query mode: Using observation #${w.id} as timeline anchor`),c=this.sessionStore.getTimelineAroundObservation(w.id,w.created_at_epoch,s,i,n)}else if(typeof r=="number"){let b=this.sessionStore.getObservationById(r);if(!b)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};o=r,l=b.created_at_epoch,c=this.sessionStore.getTimelineAroundObservation(r,l,s,i,n)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let b=r.replace(/^#?S/,""),w=parseInt(b,10),P=this.sessionStore.getSessionSummariesByIds([w]);if(P.length===0)return{content:[{type:"text",text:`Session #${w} not found`}],isError:!0};l=P[0].created_at_epoch,o=`S${w}`,c=this.sessionStore.getTimelineAroundTimestamp(l,s,i,n)}else{let b=new Date(r);if(isNaN(b.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};l=b.getTime(),o=r,c=this.sessionStore.getTimelineAroundTimestamp(l,s,i,n)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let u=[...(c.observations||[]).map(b=>({type:"observation",data:b,epoch:b.created_at_epoch})),...(c.sessions||[]).map(b=>({type:"session",data:b,epoch:b.created_at_epoch})),...(c.prompts||[]).map(b=>({type:"prompt",data:b,epoch:b.created_at_epoch}))];u.sort((b,w)=>b.epoch-w.epoch);let p=this.timelineService.filterByDepth(u,o,l,s,i);if(!p||p.length===0)return{content:[{type:"text",text:t?`Found observation matching "${t}", but no timeline context available (${s} records before, ${i} records after).`:`No context found around anchor (${s} records before, ${i} records after)`}]};let f=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),d=b=>new Date(b).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),v=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),h=b=>b?Math.ceil(b.length/4):0,m=[];if(t){let b=p.find(P=>P.type==="observation"&&P.data.id===o),w=b&&b.type==="observation"?b.data.title||"Untitled":"Unknown";m.push(`# Timeline for query: "${t}"`),m.push(`**Anchor:** Observation #${o} - ${w}`)}else m.push(`# Timeline around anchor: ${o}`);m.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${p?.length??0}`),m.push(""),m.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),m.push("");let y=new Map;for(let b of p){let w=f(b.epoch);y.has(w)||y.set(w,[]),y.get(w).push(b)}let g=Array.from(y.entries()).sort((b,w)=>{let P=new Date(b[0]).getTime(),T=new Date(w[0]).getTime();return P-T});for(let[b,w]of g){m.push(`### ${b}`),m.push("");let P=null,T="",C=!1;for(let D of w){let A=typeof o=="number"&&D.type==="observation"&&D.data.id===o||typeof o=="string"&&o.startsWith("S")&&D.type==="session"&&`S${D.data.id}`===o;if(D.type==="session"){C&&(m.push(""),C=!1,P=null,T="");let j=D.data,N=j.request||"Session summary",k=`claude-mem://session-summary/${j.id}`,O=A?" \u2190 **ANCHOR**":"";m.push(`**\u{1F3AF} #S${j.id}** ${N} (${v(D.epoch)}) [\u2192](${k})${O}`),m.push("")}else if(D.type==="prompt"){C&&(m.push(""),C=!1,P=null,T="");let j=D.data,N=j.prompt_text.length>100?j.prompt_text.substring(0,100)+"...":j.prompt_text;m.push(`**\u{1F4AC} User Prompt #${j.prompt_number}** (${v(D.epoch)})`),m.push(`> ${N}`),m.push("")}else if(D.type==="observation"){let j=D.data,N="General";N!==P&&(C&&m.push(""),m.push(`**${N}**`),m.push("| ID | Time | T | Title | Tokens |"),m.push("|----|------|---|-------|--------|"),P=N,C=!0,T="");let k="\u2022";switch(j.type){case"bugfix":k="\u{1F534}";break;case"feature":k="\u{1F7E3}";break;case"refactor":k="\u{1F504}";break;case"change":k="\u2705";break;case"discovery":k="\u{1F535}";break;case"decision":k="\u{1F9E0}";break}let O=d(D.epoch),$=j.title||"Untitled",F=h(j.narrative),H=O!==T?O:"\u2033";T=O;let K=A?" \u2190 **ANCHOR**":"";m.push(`| #${j.id} | ${H} | ${k} | ${$}${K} | ~${F} |`)}}C&&m.push("")}return{content:[{type:"text",text:m.join(`
+`)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async decisions(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{if(t){ie("[mcp-server] Using Chroma semantic search with type=decision filter");let c=(await this.queryChroma(t,Math.min((i.limit||20)*2,100),{type:"decision"})).ids;c.length>0&&(n=this.sessionStore.getObservationsByIds(c,{...i,type:"decision"}),n.sort((u,p)=>c.indexOf(u.id)-c.indexOf(p.id)))}else{ie("[mcp-server] Using metadata-first + semantic ranking for decisions");let l=this.sessionSearch.findByType("decision",i);if(l.length>0){let c=l.map(f=>f.id),u=await this.queryChroma("decision",Math.min(c.length,100)),p=[];for(let f of u.ids)c.includes(f)&&!p.includes(f)&&p.push(f);p.length>0&&(n=this.sessionStore.getObservationsByIds(p,{limit:i.limit||20}),n.sort((f,d)=>p.indexOf(f.id)-p.indexOf(d.id)))}}}catch(l){ie("[mcp-server] Chroma search failed, using SQLite fallback:",l.message)}if(n.length===0&&(n=this.sessionSearch.findByType("decision",i)),n.length===0)return{content:[{type:"text",text:"No decision observations found"}]};let o;if(s==="index"){let l=`Found ${n.length} decision(s):
`,c=n.map((u,p)=>this.formatter.formatObservationIndex(u,p));o=l+c.join(`
@@ -936,7 +936,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async changes(e){try{let r=this.normalizeParams(e),{format:t="index",...s}=r,i=[];if(this.chromaSync)try{ie("[search-server] Using hybrid search for change-related observations");let o=this.sessionSearch.findByType("change",s),l=this.sessionSearch.findByConcept("change",s),c=this.sessionSearch.findByConcept("what-changed",s),u=new Set;if([...o,...l,...c].forEach(p=>u.add(p.id)),u.size>0){let p=Array.from(u),f=await this.queryChroma("what changed",Math.min(p.length,100)),d=[];for(let v of f.ids)p.includes(v)&&!d.includes(v)&&d.push(v);d.length>0&&(i=this.sessionStore.getObservationsByIds(d,{limit:s.limit||20}),i.sort((v,h)=>d.indexOf(v.id)-d.indexOf(h.id)))}}catch(o){ie("[search-server] Chroma ranking failed, using SQLite order:",o.message)}if(i.length===0){let o=this.sessionSearch.findByType("change",s),l=this.sessionSearch.findByConcept("change",s),c=this.sessionSearch.findByConcept("what-changed",s),u=new Set;[...o,...l,...c].forEach(p=>u.add(p.id)),i=Array.from(u).map(p=>o.find(f=>f.id===p)||l.find(f=>f.id===p)||c.find(f=>f.id===p)).filter(Boolean),i.sort((p,f)=>f.created_at_epoch-p.created_at_epoch),i=i.slice(0,s.limit||20)}if(i.length===0)return{content:[{type:"text",text:"No change-related observations found"}]};let n;if(t==="index"){let o=`Found ${i.length} change-related observation(s):
+`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async changes(e){try{let r=this.normalizeParams(e),{format:t="index",...s}=r,i=[];if(this.chromaSync)try{ie("[mcp-server] Using hybrid search for change-related observations");let o=this.sessionSearch.findByType("change",s),l=this.sessionSearch.findByConcept("change",s),c=this.sessionSearch.findByConcept("what-changed",s),u=new Set;if([...o,...l,...c].forEach(p=>u.add(p.id)),u.size>0){let p=Array.from(u),f=await this.queryChroma("what changed",Math.min(p.length,100)),d=[];for(let v of f.ids)p.includes(v)&&!d.includes(v)&&d.push(v);d.length>0&&(i=this.sessionStore.getObservationsByIds(d,{limit:s.limit||20}),i.sort((v,h)=>d.indexOf(v.id)-d.indexOf(h.id)))}}catch(o){ie("[mcp-server] Chroma ranking failed, using SQLite order:",o.message)}if(i.length===0){let o=this.sessionSearch.findByType("change",s),l=this.sessionSearch.findByConcept("change",s),c=this.sessionSearch.findByConcept("what-changed",s),u=new Set;[...o,...l,...c].forEach(p=>u.add(p.id)),i=Array.from(u).map(p=>o.find(f=>f.id===p)||l.find(f=>f.id===p)||c.find(f=>f.id===p)).filter(Boolean),i.sort((p,f)=>f.created_at_epoch-p.created_at_epoch),i=i.slice(0,s.limit||20)}if(i.length===0)return{content:[{type:"text",text:"No change-related observations found"}]};let n;if(t==="index"){let o=`Found ${i.length} change-related observation(s):
`,l=i.map((c,u)=>this.formatter.formatObservationIndex(c,u));n=o+l.join(`
@@ -944,7 +944,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:n}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async howItWorks(e){try{let r=this.normalizeParams(e),{format:t="index",...s}=r,i=[];if(this.chromaSync)try{ie("[search-server] Using metadata-first + semantic ranking for how-it-works");let o=this.sessionSearch.findByConcept("how-it-works",s);if(o.length>0){let l=o.map(p=>p.id),c=await this.queryChroma("how it works architecture",Math.min(l.length,100)),u=[];for(let p of c.ids)l.includes(p)&&!u.includes(p)&&u.push(p);u.length>0&&(i=this.sessionStore.getObservationsByIds(u,{limit:s.limit||20}),i.sort((p,f)=>u.indexOf(p.id)-u.indexOf(f.id)))}}catch(o){ie("[search-server] Chroma ranking failed, using SQLite order:",o.message)}if(i.length===0&&(i=this.sessionSearch.findByConcept("how-it-works",s)),i.length===0)return{content:[{type:"text",text:'No "how it works" observations found'}]};let n;if(t==="index"){let o=`Found ${i.length} "how it works" observation(s):
+`);return{content:[{type:"text",text:n}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async howItWorks(e){try{let r=this.normalizeParams(e),{format:t="index",...s}=r,i=[];if(this.chromaSync)try{ie("[mcp-server] Using metadata-first + semantic ranking for how-it-works");let o=this.sessionSearch.findByConcept("how-it-works",s);if(o.length>0){let l=o.map(p=>p.id),c=await this.queryChroma("how it works architecture",Math.min(l.length,100)),u=[];for(let p of c.ids)l.includes(p)&&!u.includes(p)&&u.push(p);u.length>0&&(i=this.sessionStore.getObservationsByIds(u,{limit:s.limit||20}),i.sort((p,f)=>u.indexOf(p.id)-u.indexOf(f.id)))}}catch(o){ie("[mcp-server] Chroma ranking failed, using SQLite order:",o.message)}if(i.length===0&&(i=this.sessionSearch.findByConcept("how-it-works",s)),i.length===0)return{content:[{type:"text",text:'No "how it works" observations found'}]};let n;if(t==="index"){let o=`Found ${i.length} "how it works" observation(s):
`,l=i.map((c,u)=>this.formatter.formatObservationIndex(c,u));n=o+l.join(`
@@ -952,7 +952,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:n}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async searchObservations(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[search-server] Using hybrid semantic search (Chroma + SQLite)");let l=await this.queryChroma(t,100);if(ie(`[search-server] Chroma returned ${l.ids.length} semantic matches`),l.ids.length>0){let c=Date.now()-7776e6,u=l.ids.filter((p,f)=>{let d=l.metadatas[f];return d&&d.created_at_epoch>c});if(ie(`[search-server] ${u.length} results within 90-day window`),u.length>0){let p=i.limit||20;n=this.sessionStore.getObservationsByIds(u,{orderBy:"date_desc",limit:p}),ie(`[search-server] Hydrated ${n.length} observations from SQLite`)}}}catch(l){ie("[search-server] Chroma query failed - no results (FTS5 fallback removed):",l.message)}if(n.length===0)return{content:[{type:"text",text:`No observations found matching "${t}"`}]};let o;if(s==="index"){let l=`Found ${n.length} observation(s) matching "${t}":
+`);return{content:[{type:"text",text:n}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async searchObservations(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[mcp-server] Using hybrid semantic search (Chroma + SQLite)");let l=await this.queryChroma(t,100);if(ie(`[mcp-server] Chroma returned ${l.ids.length} semantic matches`),l.ids.length>0){let c=Date.now()-7776e6,u=l.ids.filter((p,f)=>{let d=l.metadatas[f];return d&&d.created_at_epoch>c});if(ie(`[mcp-server] ${u.length} results within 90-day window`),u.length>0){let p=i.limit||20;n=this.sessionStore.getObservationsByIds(u,{orderBy:"date_desc",limit:p}),ie(`[mcp-server] Hydrated ${n.length} observations from SQLite`)}}}catch(l){ie("[mcp-server] Chroma query failed - no results (FTS5 fallback removed):",l.message)}if(n.length===0)return{content:[{type:"text",text:`No observations found matching "${t}"`}]};let o;if(s==="index"){let l=`Found ${n.length} observation(s) matching "${t}":
`,c=n.map((u,p)=>this.formatter.formatObservationIndex(u,p));o=l+c.join(`
@@ -960,7 +960,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async searchSessions(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[search-server] Using hybrid semantic search for sessions");let l=await this.queryChroma(t,100,{doc_type:"session_summary"});if(ie(`[search-server] Chroma returned ${l.ids.length} semantic matches`),l.ids.length>0){let c=Date.now()-7776e6,u=l.ids.filter((p,f)=>{let d=l.metadatas[f];return d&&d.created_at_epoch>c});if(ie(`[search-server] ${u.length} results within 90-day window`),u.length>0){let p=i.limit||20;n=this.sessionStore.getSessionSummariesByIds(u,{orderBy:"date_desc",limit:p}),ie(`[search-server] Hydrated ${n.length} sessions from SQLite`)}}}catch(l){ie("[search-server] Chroma query failed - no results (FTS5 fallback removed):",l.message)}if(n.length===0)return{content:[{type:"text",text:`No sessions found matching "${t}"`}]};let o;if(s==="index"){let l=`Found ${n.length} session(s) matching "${t}":
+`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async searchSessions(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[mcp-server] Using hybrid semantic search for sessions");let l=await this.queryChroma(t,100,{doc_type:"session_summary"});if(ie(`[mcp-server] Chroma returned ${l.ids.length} semantic matches`),l.ids.length>0){let c=Date.now()-7776e6,u=l.ids.filter((p,f)=>{let d=l.metadatas[f];return d&&d.created_at_epoch>c});if(ie(`[mcp-server] ${u.length} results within 90-day window`),u.length>0){let p=i.limit||20;n=this.sessionStore.getSessionSummariesByIds(u,{orderBy:"date_desc",limit:p}),ie(`[mcp-server] Hydrated ${n.length} sessions from SQLite`)}}}catch(l){ie("[mcp-server] Chroma query failed - no results (FTS5 fallback removed):",l.message)}if(n.length===0)return{content:[{type:"text",text:`No sessions found matching "${t}"`}]};let o;if(s==="index"){let l=`Found ${n.length} session(s) matching "${t}":
`,c=n.map((u,p)=>this.formatter.formatSessionIndex(u,p));o=l+c.join(`
@@ -968,7 +968,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async searchUserPrompts(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[search-server] Using hybrid semantic search for user prompts");let l=await this.queryChroma(t,100,{doc_type:"user_prompt"});if(ie(`[search-server] Chroma returned ${l.ids.length} semantic matches`),l.ids.length>0){let c=Date.now()-7776e6,u=l.ids.filter((p,f)=>{let d=l.metadatas[f];return d&&d.created_at_epoch>c});if(ie(`[search-server] ${u.length} results within 90-day window`),u.length>0){let p=i.limit||20;n=this.sessionStore.getUserPromptsByIds(u,{orderBy:"date_desc",limit:p}),ie(`[search-server] Hydrated ${n.length} user prompts from SQLite`)}}}catch(l){ie("[search-server] Chroma query failed - no results (FTS5 fallback removed):",l.message)}if(n.length===0)return{content:[{type:"text",text:t?`No user prompts found matching "${t}"`:"No user prompts found"}]};let o;if(s==="index"){let l=`Found ${n.length} user prompt(s) matching "${t}":
+`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async searchUserPrompts(e){try{let r=this.normalizeParams(e),{query:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[mcp-server] Using hybrid semantic search for user prompts");let l=await this.queryChroma(t,100,{doc_type:"user_prompt"});if(ie(`[mcp-server] Chroma returned ${l.ids.length} semantic matches`),l.ids.length>0){let c=Date.now()-7776e6,u=l.ids.filter((p,f)=>{let d=l.metadatas[f];return d&&d.created_at_epoch>c});if(ie(`[mcp-server] ${u.length} results within 90-day window`),u.length>0){let p=i.limit||20;n=this.sessionStore.getUserPromptsByIds(u,{orderBy:"date_desc",limit:p}),ie(`[mcp-server] Hydrated ${n.length} user prompts from SQLite`)}}}catch(l){ie("[mcp-server] Chroma query failed - no results (FTS5 fallback removed):",l.message)}if(n.length===0)return{content:[{type:"text",text:t?`No user prompts found matching "${t}"`:"No user prompts found"}]};let o;if(s==="index"){let l=`Found ${n.length} user prompt(s) matching "${t}":
`,c=n.map((u,p)=>this.formatter.formatUserPromptIndex(u,p));o=l+c.join(`
@@ -976,7 +976,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async findByConcept(e){try{let r=this.normalizeParams(e),{concepts:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[search-server] Using metadata-first + semantic ranking for concept search");let l=this.sessionSearch.findByConcept(t,i);if(ie(`[search-server] Found ${l.length} observations with concept "${t}"`),l.length>0){let c=l.map(f=>f.id),u=await this.queryChroma(t,Math.min(c.length,100)),p=[];for(let f of u.ids)c.includes(f)&&!p.includes(f)&&p.push(f);ie(`[search-server] Chroma ranked ${p.length} results by semantic relevance`),p.length>0&&(n=this.sessionStore.getObservationsByIds(p,{limit:i.limit||20}),n.sort((f,d)=>p.indexOf(f.id)-p.indexOf(d.id)))}}catch(l){ie("[search-server] Chroma ranking failed, using SQLite order:",l.message)}if(n.length===0&&(ie("[search-server] Using SQLite-only concept search"),n=this.sessionSearch.findByConcept(t,i)),n.length===0)return{content:[{type:"text",text:`No observations found with concept "${t}"`}]};let o;if(s==="index"){let l=`Found ${n.length} observation(s) with concept "${t}":
+`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async findByConcept(e){try{let r=this.normalizeParams(e),{concepts:t,format:s="index",...i}=r,n=[];if(this.chromaSync)try{ie("[mcp-server] Using metadata-first + semantic ranking for concept search");let l=this.sessionSearch.findByConcept(t,i);if(ie(`[mcp-server] Found ${l.length} observations with concept "${t}"`),l.length>0){let c=l.map(f=>f.id),u=await this.queryChroma(t,Math.min(c.length,100)),p=[];for(let f of u.ids)c.includes(f)&&!p.includes(f)&&p.push(f);ie(`[mcp-server] Chroma ranked ${p.length} results by semantic relevance`),p.length>0&&(n=this.sessionStore.getObservationsByIds(p,{limit:i.limit||20}),n.sort((f,d)=>p.indexOf(f.id)-p.indexOf(d.id)))}}catch(l){ie("[mcp-server] Chroma ranking failed, using SQLite order:",l.message)}if(n.length===0&&(ie("[mcp-server] Using SQLite-only concept search"),n=this.sessionSearch.findByConcept(t,i)),n.length===0)return{content:[{type:"text",text:`No observations found with concept "${t}"`}]};let o;if(s==="index"){let l=`Found ${n.length} observation(s) with concept "${t}":
`,c=n.map((u,p)=>this.formatter.formatObservationIndex(u,p));o=l+c.join(`
@@ -984,7 +984,7 @@ MEMORY PROCESSING CONTINUED
---
-`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async findByFile(e){try{let r=this.normalizeParams(e),{files:t,format:s="index",...i}=r,n=[],o=[];if(this.chromaSync)try{ie("[search-server] Using metadata-first + semantic ranking for file search");let u=this.sessionSearch.findByFile(t,i);if(ie(`[search-server] Found ${u.observations.length} observations, ${u.sessions.length} sessions for file "${t}"`),o=u.sessions,u.observations.length>0){let p=u.observations.map(v=>v.id),f=await this.queryChroma(t,Math.min(p.length,100)),d=[];for(let v of f.ids)p.includes(v)&&!d.includes(v)&&d.push(v);ie(`[search-server] Chroma ranked ${d.length} observations by semantic relevance`),d.length>0&&(n=this.sessionStore.getObservationsByIds(d,{limit:i.limit||20}),n.sort((v,h)=>d.indexOf(v.id)-d.indexOf(h.id)))}}catch(u){ie("[search-server] Chroma ranking failed, using SQLite order:",u.message)}if(n.length===0&&o.length===0){ie("[search-server] Using SQLite-only file search");let u=this.sessionSearch.findByFile(t,i);n=u.observations,o=u.sessions}let l=n.length+o.length;if(l===0)return{content:[{type:"text",text:`No results found for file "${t}"`}]};let c;if(s==="index"){let u=`Found ${l} result(s) for file "${t}":
+`);return{content:[{type:"text",text:o}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async findByFile(e){try{let r=this.normalizeParams(e),{files:t,format:s="index",...i}=r,n=[],o=[];if(this.chromaSync)try{ie("[mcp-server] Using metadata-first + semantic ranking for file search");let u=this.sessionSearch.findByFile(t,i);if(ie(`[mcp-server] Found ${u.observations.length} observations, ${u.sessions.length} sessions for file "${t}"`),o=u.sessions,u.observations.length>0){let p=u.observations.map(v=>v.id),f=await this.queryChroma(t,Math.min(p.length,100)),d=[];for(let v of f.ids)p.includes(v)&&!d.includes(v)&&d.push(v);ie(`[mcp-server] Chroma ranked ${d.length} observations by semantic relevance`),d.length>0&&(n=this.sessionStore.getObservationsByIds(d,{limit:i.limit||20}),n.sort((v,h)=>d.indexOf(v.id)-d.indexOf(h.id)))}}catch(u){ie("[mcp-server] Chroma ranking failed, using SQLite order:",u.message)}if(n.length===0&&o.length===0){ie("[mcp-server] Using SQLite-only file search");let u=this.sessionSearch.findByFile(t,i);n=u.observations,o=u.sessions}let l=n.length+o.length;if(l===0)return{content:[{type:"text",text:`No results found for file "${t}"`}]};let c;if(s==="index"){let u=`Found ${l} result(s) for file "${t}":
`,p=[];n.forEach((f,d)=>{p.push(this.formatter.formatObservationIndex(f,d))}),o.forEach((f,d)=>{p.push(this.formatter.formatSessionIndex(f,d+n.length))}),c=u+p.join(`
@@ -992,7 +992,7 @@ MEMORY PROCESSING CONTINUED
---
-`)}return{content:[{type:"text",text:c}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async findByType(e){try{let r=this.normalizeParams(e),{type:t,format:s="index",...i}=r,n=Array.isArray(t)?t.join(", "):t,o=[];if(this.chromaSync)try{ie("[search-server] Using metadata-first + semantic ranking for type search");let c=this.sessionSearch.findByType(t,i);if(ie(`[search-server] Found ${c.length} observations with type "${n}"`),c.length>0){let u=c.map(d=>d.id),p=await this.queryChroma(n,Math.min(u.length,100)),f=[];for(let d of p.ids)u.includes(d)&&!f.includes(d)&&f.push(d);ie(`[search-server] Chroma ranked ${f.length} results by semantic relevance`),f.length>0&&(o=this.sessionStore.getObservationsByIds(f,{limit:i.limit||20}),o.sort((d,v)=>f.indexOf(d.id)-f.indexOf(v.id)))}}catch(c){ie("[search-server] Chroma ranking failed, using SQLite order:",c.message)}if(o.length===0&&(ie("[search-server] Using SQLite-only type search"),o=this.sessionSearch.findByType(t,i)),o.length===0)return{content:[{type:"text",text:`No observations found with type "${n}"`}]};let l;if(s==="index"){let c=`Found ${o.length} observation(s) with type "${n}":
+`)}return{content:[{type:"text",text:c}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async findByType(e){try{let r=this.normalizeParams(e),{type:t,format:s="index",...i}=r,n=Array.isArray(t)?t.join(", "):t,o=[];if(this.chromaSync)try{ie("[mcp-server] Using metadata-first + semantic ranking for type search");let c=this.sessionSearch.findByType(t,i);if(ie(`[mcp-server] Found ${c.length} observations with type "${n}"`),c.length>0){let u=c.map(d=>d.id),p=await this.queryChroma(n,Math.min(u.length,100)),f=[];for(let d of p.ids)u.includes(d)&&!f.includes(d)&&f.push(d);ie(`[mcp-server] Chroma ranked ${f.length} results by semantic relevance`),f.length>0&&(o=this.sessionStore.getObservationsByIds(f,{limit:i.limit||20}),o.sort((d,v)=>f.indexOf(d.id)-f.indexOf(v.id)))}}catch(c){ie("[mcp-server] Chroma ranking failed, using SQLite order:",c.message)}if(o.length===0&&(ie("[mcp-server] Using SQLite-only type search"),o=this.sessionSearch.findByType(t,i)),o.length===0)return{content:[{type:"text",text:`No observations found with type "${n}"`}]};let l;if(s==="index"){let c=`Found ${o.length} observation(s) with type "${n}":
`,u=o.map((p,f)=>this.formatter.formatObservationIndex(p,f));l=c+u.join(`
@@ -1004,8 +1004,8 @@ MEMORY PROCESSING CONTINUED
No previous sessions found for project "${r}".`}]};let i=[];i.push("# Recent Session Context"),i.push(""),i.push(`Showing last ${s.length} session(s) for **${r}**:`),i.push("");for(let n of s)if(n.sdk_session_id){if(i.push("---"),i.push(""),n.has_summary){let o=this.sessionStore.getSummaryForSession(n.sdk_session_id);if(o){let l=o.prompt_number?` (Prompt #${o.prompt_number})`:"";if(i.push(`**Summary${l}**`),i.push(""),o.request&&i.push(`**Request:** ${o.request}`),o.completed&&i.push(`**Completed:** ${o.completed}`),o.learned&&i.push(`**Learned:** ${o.learned}`),o.next_steps&&i.push(`**Next Steps:** ${o.next_steps}`),o.files_read)try{let u=JSON.parse(o.files_read);Array.isArray(u)&&u.length>0&&i.push(`**Files Read:** ${u.join(", ")}`)}catch{o.files_read.trim()&&i.push(`**Files Read:** ${o.files_read}`)}if(o.files_edited)try{let u=JSON.parse(o.files_edited);Array.isArray(u)&&u.length>0&&i.push(`**Files Edited:** ${u.join(", ")}`)}catch{o.files_edited.trim()&&i.push(`**Files Edited:** ${o.files_edited}`)}let c=new Date(o.created_at).toLocaleString();i.push(`**Date:** ${c}`)}}else if(n.status==="active"){i.push("**In Progress**"),i.push(""),n.user_prompt&&i.push(`**Request:** ${n.user_prompt}`);let o=this.sessionStore.getObservationsForSession(n.sdk_session_id);if(o.length>0){i.push(""),i.push(`**Observations (${o.length}):**`);for(let c of o)i.push(`- ${c.title}`)}else i.push(""),i.push("*No observations yet*");i.push(""),i.push("**Status:** Active - summary pending");let l=new Date(n.started_at).toLocaleString();i.push(`**Date:** ${l}`)}else{i.push(`**${n.status.charAt(0).toUpperCase()+n.status.slice(1)}**`),i.push(""),n.user_prompt&&i.push(`**Request:** ${n.user_prompt}`),i.push(""),i.push(`**Status:** ${n.status} - no summary available`);let o=new Date(n.started_at).toLocaleString();i.push(`**Date:** ${o}`)}i.push("")}return{content:[{type:"text",text:i.join(`
`)}]}}catch(r){return{content:[{type:"text",text:`Failed to get recent context: ${r.message}`}],isError:!0}}}async getContextTimeline(e){try{let{anchor:r,depth_before:t=10,depth_after:s=10,project:i}=e,n,o=r,l;if(typeof r=="number"){let g=this.sessionStore.getObservationById(r);if(!g)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};n=g.created_at_epoch,l=this.sessionStore.getTimelineAroundObservation(r,n,t,s,i)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let g=r.replace(/^#?S/,""),b=parseInt(g,10),w=this.sessionStore.getSessionSummariesByIds([b]);if(w.length===0)return{content:[{type:"text",text:`Session #${b} not found`}],isError:!0};n=w[0].created_at_epoch,o=`S${b}`,l=this.sessionStore.getTimelineAroundTimestamp(n,t,s,i)}else{let g=new Date(r);if(isNaN(g.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};n=g.getTime(),l=this.sessionStore.getTimelineAroundTimestamp(n,t,s,i)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let c=[...l.observations.map(g=>({type:"observation",data:g,epoch:g.created_at_epoch})),...l.sessions.map(g=>({type:"session",data:g,epoch:g.created_at_epoch})),...l.prompts.map(g=>({type:"prompt",data:g,epoch:g.created_at_epoch}))];c.sort((g,b)=>g.epoch-b.epoch);let u=this.timelineService.filterByDepth(c,o,n,t,s);if(!u||u.length===0)return{content:[{type:"text",text:`No context found around ${new Date(n).toLocaleString()} (${t} records before, ${s} records after)`}]};let p=g=>new Date(g).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),f=g=>new Date(g).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),d=g=>new Date(g).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),v=g=>g?Math.ceil(g.length/4):0,h=[];h.push(`# Timeline around anchor: ${o}`),h.push(`**Window:** ${t} records before \u2192 ${s} records after | **Items:** ${u?.length??0}`),h.push(""),h.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),h.push("");let m=new Map;for(let g of u){let b=p(g.epoch);m.has(b)||m.set(b,[]),m.get(b).push(g)}let y=Array.from(m.entries()).sort((g,b)=>{let w=new Date(g[0]).getTime(),P=new Date(b[0]).getTime();return w-P});for(let[g,b]of y){h.push(`### ${g}`),h.push("");let w=null,P="",T=!1;for(let C of b){let D=typeof o=="number"&&C.type==="observation"&&C.data.id===o||typeof o=="string"&&o.startsWith("S")&&C.type==="session"&&`S${C.data.id}`===o;if(C.type==="session"){T&&(h.push(""),T=!1,w=null,P="");let A=C.data,j=A.request||"Session summary",N=`claude-mem://session-summary/${A.id}`,k=D?" \u2190 **ANCHOR**":"";h.push(`**\u{1F3AF} #S${A.id}** ${j} (${d(C.epoch)}) [\u2192](${N})${k}`),h.push("")}else if(C.type==="prompt"){T&&(h.push(""),T=!1,w=null,P="");let A=C.data,j=A.prompt_text.length>100?A.prompt_text.substring(0,100)+"...":A.prompt_text;h.push(`**\u{1F4AC} User Prompt #${A.prompt_number}** (${d(C.epoch)})`),h.push(`> ${j}`),h.push("")}else if(C.type==="observation"){let A=C.data,j="General";j!==w&&(T&&h.push(""),h.push(`**${j}**`),h.push("| ID | Time | T | Title | Tokens |"),h.push("|----|------|---|-------|--------|"),w=j,T=!0,P="");let N="\u2022";switch(A.type){case"bugfix":N="\u{1F534}";break;case"feature":N="\u{1F7E3}";break;case"refactor":N="\u{1F504}";break;case"change":N="\u2705";break;case"discovery":N="\u{1F535}";break;case"decision":N="\u{1F9E0}";break}let k=f(C.epoch),O=A.title||"Untitled",$=v(A.narrative),B=k!==P?k:"\u2033";P=k;let H=D?" \u2190 **ANCHOR**":"";h.push(`| #${A.id} | ${B} | ${N} | ${O}${H} | ~${$} |`)}}T&&h.push("")}return{content:[{type:"text",text:h.join(`
-`)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async getTimelineByQuery(e){try{let{query:r,mode:t="auto",depth_before:s=10,depth_after:i=10,limit:n=5,project:o}=e,l=[];if(this.chromaSync)try{ie("[search-server] Using hybrid semantic search for timeline query");let c=await this.queryChroma(r,100);if(ie(`[search-server] Chroma returned ${c.ids.length} semantic matches`),c.ids.length>0){let u=Date.now()-7776e6,p=c.ids.filter((f,d)=>{let v=c.metadatas[d];return v&&v.created_at_epoch>u});ie(`[search-server] ${p.length} results within 90-day window`),p.length>0&&(l=this.sessionStore.getObservationsByIds(p,{orderBy:"date_desc",limit:t==="auto"?1:n}),ie(`[search-server] Hydrated ${l.length} observations from SQLite`))}}catch(c){ie("[search-server] Chroma query failed - no results (FTS5 fallback removed):",c.message)}if(l.length===0)return{content:[{type:"text",text:`No observations found matching "${r}". Try a different search query.`}]};if(t==="interactive"){let c=[];c.push("# Timeline Anchor Search Results"),c.push(""),c.push(`Found ${l.length} observation(s) matching "${r}"`),c.push(""),c.push("To get timeline context around any of these observations, use the `get_context_timeline` tool with the observation ID as the anchor."),c.push(""),c.push(`**Top ${l.length} matches:**`),c.push("");for(let u=0;u({type:"observation",data:w,epoch:w.created_at_epoch})),...(u.sessions||[]).map(w=>({type:"session",data:w,epoch:w.created_at_epoch})),...(u.prompts||[]).map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch}))];p.sort((w,P)=>w.epoch-P.epoch);let f=this.timelineService.filterByDepth(p,c.id,0,s,i);if(!f||f.length===0)return{content:[{type:"text",text:`Found observation #${c.id} matching "${r}", but no timeline context available (${s} records before, ${i} records after).`}]};let d=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=w=>new Date(w).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),h=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),m=w=>w?Math.ceil(w.length/4):0,y=[];y.push(`# Timeline for query: "${r}"`),y.push(`**Anchor:** Observation #${c.id} - ${c.title||"Untitled"}`),y.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${f?.length??0}`),y.push(""),y.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),y.push("");let g=new Map;for(let w of f){let P=d(w.epoch);g.has(P)||g.set(P,[]),g.get(P).push(w)}let b=Array.from(g.entries()).sort((w,P)=>{let T=new Date(w[0]).getTime(),C=new Date(P[0]).getTime();return T-C});for(let[w,P]of b){y.push(`### ${w}`),y.push("");let T=null,C="",D=!1;for(let A of P){let j=A.type==="observation"&&A.data.id===c.id;if(A.type==="session"){D&&(y.push(""),D=!1,T=null,C="");let N=A.data,k=N.request||"Session summary",O=`claude-mem://session-summary/${N.id}`;y.push(`**\u{1F3AF} #S${N.id}** ${k} (${h(A.epoch)}) [\u2192](${O})`),y.push("")}else if(A.type==="prompt"){D&&(y.push(""),D=!1,T=null,C="");let N=A.data,k=N.prompt_text.length>100?N.prompt_text.substring(0,100)+"...":N.prompt_text;y.push(`**\u{1F4AC} User Prompt #${N.prompt_number}** (${h(A.epoch)})`),y.push(`> ${k}`),y.push("")}else if(A.type==="observation"){let N=A.data,k="General";k!==T&&(D&&y.push(""),y.push(`**${k}**`),y.push("| ID | Time | T | Title | Tokens |"),y.push("|----|------|---|-------|--------|"),T=k,D=!0,C="");let O="\u2022";switch(N.type){case"bugfix":O="\u{1F534}";break;case"feature":O="\u{1F7E3}";break;case"refactor":O="\u{1F504}";break;case"change":O="\u2705";break;case"discovery":O="\u{1F535}";break;case"decision":O="\u{1F9E0}";break}let $=v(A.epoch),F=N.title||"Untitled",B=m(N.narrative),K=$!==C?$:"\u2033";C=$;let X=j?" \u2190 **ANCHOR**":"";y.push(`| #${N.id} | ${K} | ${O} | ${F}${X} | ~${B} |`)}}D&&y.push("")}return{content:[{type:"text",text:y.join(`
+`)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async getTimelineByQuery(e){try{let{query:r,mode:t="auto",depth_before:s=10,depth_after:i=10,limit:n=5,project:o}=e,l=[];if(this.chromaSync)try{ie("[mcp-server] Using hybrid semantic search for timeline query");let c=await this.queryChroma(r,100);if(ie(`[mcp-server] Chroma returned ${c.ids.length} semantic matches`),c.ids.length>0){let u=Date.now()-7776e6,p=c.ids.filter((f,d)=>{let v=c.metadatas[d];return v&&v.created_at_epoch>u});ie(`[mcp-server] ${p.length} results within 90-day window`),p.length>0&&(l=this.sessionStore.getObservationsByIds(p,{orderBy:"date_desc",limit:t==="auto"?1:n}),ie(`[mcp-server] Hydrated ${l.length} observations from SQLite`))}}catch(c){ie("[mcp-server] Chroma query failed - no results (FTS5 fallback removed):",c.message)}if(l.length===0)return{content:[{type:"text",text:`No observations found matching "${r}". Try a different search query.`}]};if(t==="interactive"){let c=[];c.push("# Timeline Anchor Search Results"),c.push(""),c.push(`Found ${l.length} observation(s) matching "${r}"`),c.push(""),c.push("To get timeline context around any of these observations, use the `get_context_timeline` tool with the observation ID as the anchor."),c.push(""),c.push(`**Top ${l.length} matches:**`),c.push("");for(let u=0;u({type:"observation",data:w,epoch:w.created_at_epoch})),...(u.sessions||[]).map(w=>({type:"session",data:w,epoch:w.created_at_epoch})),...(u.prompts||[]).map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch}))];p.sort((w,P)=>w.epoch-P.epoch);let f=this.timelineService.filterByDepth(p,c.id,0,s,i);if(!f||f.length===0)return{content:[{type:"text",text:`Found observation #${c.id} matching "${r}", but no timeline context available (${s} records before, ${i} records after).`}]};let d=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=w=>new Date(w).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),h=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),m=w=>w?Math.ceil(w.length/4):0,y=[];y.push(`# Timeline for query: "${r}"`),y.push(`**Anchor:** Observation #${c.id} - ${c.title||"Untitled"}`),y.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${f?.length??0}`),y.push(""),y.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),y.push("");let g=new Map;for(let w of f){let P=d(w.epoch);g.has(P)||g.set(P,[]),g.get(P).push(w)}let b=Array.from(g.entries()).sort((w,P)=>{let T=new Date(w[0]).getTime(),C=new Date(P[0]).getTime();return T-C});for(let[w,P]of b){y.push(`### ${w}`),y.push("");let T=null,C="",D=!1;for(let A of P){let j=A.type==="observation"&&A.data.id===c.id;if(A.type==="session"){D&&(y.push(""),D=!1,T=null,C="");let N=A.data,k=N.request||"Session summary",O=`claude-mem://session-summary/${N.id}`;y.push(`**\u{1F3AF} #S${N.id}** ${k} (${h(A.epoch)}) [\u2192](${O})`),y.push("")}else if(A.type==="prompt"){D&&(y.push(""),D=!1,T=null,C="");let N=A.data,k=N.prompt_text.length>100?N.prompt_text.substring(0,100)+"...":N.prompt_text;y.push(`**\u{1F4AC} User Prompt #${N.prompt_number}** (${h(A.epoch)})`),y.push(`> ${k}`),y.push("")}else if(A.type==="observation"){let N=A.data,k="General";k!==T&&(D&&y.push(""),y.push(`**${k}**`),y.push("| ID | Time | T | Title | Tokens |"),y.push("|----|------|---|-------|--------|"),T=k,D=!0,C="");let O="\u2022";switch(N.type){case"bugfix":O="\u{1F534}";break;case"feature":O="\u{1F7E3}";break;case"refactor":O="\u{1F504}";break;case"change":O="\u2705";break;case"discovery":O="\u{1F535}";break;case"decision":O="\u{1F9E0}";break}let $=v(A.epoch),F=N.title||"Untitled",B=m(N.narrative),K=$!==C?$:"\u2033";C=$;let X=j?" \u2190 **ANCHOR**":"";y.push(`| #${N.id} | ${K} | ${O} | ${F}${X} | ~${B} |`)}}D&&y.push("")}return{content:[{type:"text",text:y.join(`
`)}]}}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}};var El=class{formatSearchTips(){return`
---
\u{1F4A1} Search Strategy:
diff --git a/src/servers/mcp-server.ts b/src/servers/mcp-server.ts
index ae821f63..6e24c470 100644
--- a/src/servers/mcp-server.ts
+++ b/src/servers/mcp-server.ts
@@ -49,7 +49,7 @@ async function callWorkerAPI(
endpoint: string,
params: Record
): Promise<{ content: Array<{ type: 'text'; text: string }>; isError?: boolean }> {
- silentDebug('[search-server] → Worker API', { endpoint, params });
+ silentDebug('[mcp-server] → Worker API', { endpoint, params });
try {
const searchParams = new URLSearchParams();
@@ -71,12 +71,12 @@ async function callWorkerAPI(
const data = await response.json() as { content: Array<{ type: 'text'; text: string }>; isError?: boolean };
- silentDebug('[search-server] ← Worker API success', { endpoint });
+ silentDebug('[mcp-server] ← Worker API success', { endpoint });
// Worker returns { content: [...] } format directly
return data;
} catch (error: any) {
- silentDebug('[search-server] ← Worker API error', { endpoint, error: error.message });
+ silentDebug('[mcp-server] ← Worker API error', { endpoint, error: error.message });
return {
content: [{
type: 'text' as const,
@@ -411,7 +411,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
// Cleanup function
async function cleanup() {
- silentDebug('[search-server] Shutting down...');
+ silentDebug('[mcp-server] Shutting down...');
process.exit(0);
}
@@ -424,22 +424,22 @@ async function main() {
// Start the MCP server
const transport = new StdioServerTransport();
await server.connect(transport);
- silentDebug('[search-server] Claude-mem search server started');
+ silentDebug('[mcp-server] Claude-mem search server started');
// Check Worker availability in background
setTimeout(async () => {
const workerAvailable = await verifyWorkerConnection();
if (!workerAvailable) {
- silentDebug('[search-server] WARNING: Worker not available at', WORKER_BASE_URL);
- silentDebug('[search-server] Tools will fail until Worker is started');
- silentDebug('[search-server] Start Worker with: npm run worker:restart');
+ silentDebug('[mcp-server] WARNING: Worker not available at', WORKER_BASE_URL);
+ silentDebug('[mcp-server] Tools will fail until Worker is started');
+ silentDebug('[mcp-server] Start Worker with: npm run worker:restart');
} else {
- silentDebug('[search-server] Worker available at', WORKER_BASE_URL);
+ silentDebug('[mcp-server] Worker available at', WORKER_BASE_URL);
}
}, 0);
}
main().catch((error) => {
- silentDebug('[search-server] Fatal error:', error);
+ silentDebug('[mcp-server] Fatal error:', error);
process.exit(1);
});
diff --git a/src/services/worker/SearchManager.ts b/src/services/worker/SearchManager.ts
index d43c50b6..95e1da17 100644
--- a/src/services/worker/SearchManager.ts
+++ b/src/services/worker/SearchManager.ts
@@ -97,7 +97,7 @@ export class SearchManager {
// PATH 1: FILTER-ONLY (no query text) - Skip Chroma/FTS5, use direct SQLite filtering
// This path enables date filtering which Chroma cannot do (requires direct SQLite access)
if (!query) {
- silentDebug(`[search-server] Filter-only query (no query text), using direct SQLite filtering (enables date filters)`);
+ silentDebug(`[mcp-server] Filter-only query (no query text), using direct SQLite filtering (enables date filters)`);
const obsOptions = { ...options, type: obs_type, concepts, files };
if (searchObservations) {
observations = this.sessionSearch.searchObservations(undefined, obsOptions);
@@ -113,7 +113,7 @@ export class SearchManager {
else if (this.chromaSync) {
let chromaSucceeded = false;
try {
- silentDebug(`[search-server] Using ChromaDB semantic search (type filter: ${type || 'all'})`);
+ silentDebug(`[mcp-server] Using ChromaDB semantic search (type filter: ${type || 'all'})`);
// Build Chroma where filter for doc_type
let whereFilter: Record | undefined;
@@ -128,7 +128,7 @@ export class SearchManager {
// Step 1: Chroma semantic search with optional type filter
const chromaResults = await this.queryChroma(query, 100, whereFilter);
chromaSucceeded = true; // Chroma didn't throw error
- silentDebug(`[search-server] ChromaDB returned ${chromaResults.ids.length} semantic matches`);
+ silentDebug(`[mcp-server] ChromaDB returned ${chromaResults.ids.length} semantic matches`);
if (chromaResults.ids.length > 0) {
// Step 2: Filter by recency (90 days)
@@ -139,7 +139,7 @@ export class SearchManager {
isRecent: meta && meta.created_at_epoch > ninetyDaysAgo
})).filter(item => item.isRecent);
- silentDebug(`[search-server] ${recentMetadata.length} results within 90-day window`);
+ silentDebug(`[mcp-server] ${recentMetadata.length} results within 90-day window`);
// Step 3: Categorize IDs by document type
const obsIds: number[] = [];
@@ -157,7 +157,7 @@ export class SearchManager {
}
}
- silentDebug(`[search-server] Categorized: ${obsIds.length} obs, ${sessionIds.length} sessions, ${promptIds.length} prompts`);
+ silentDebug(`[mcp-server] Categorized: ${obsIds.length} obs, ${sessionIds.length} sessions, ${promptIds.length} prompts`);
// Step 4: Hydrate from SQLite with additional filters
if (obsIds.length > 0) {
@@ -172,14 +172,14 @@ export class SearchManager {
prompts = this.sessionStore.getUserPromptsByIds(promptIds, { orderBy: 'date_desc', limit: options.limit });
}
- silentDebug(`[search-server] Hydrated ${observations.length} obs, ${sessions.length} sessions, ${prompts.length} prompts from SQLite`);
+ silentDebug(`[mcp-server] Hydrated ${observations.length} obs, ${sessions.length} sessions, ${prompts.length} prompts from SQLite`);
} else {
// Chroma returned 0 results - this is the correct answer, don't fall back to FTS5
- silentDebug(`[search-server] ChromaDB found no matches (this is final - NOT falling back to FTS5)`);
+ silentDebug(`[mcp-server] ChromaDB found no matches (this is final - NOT falling back to FTS5)`);
}
} catch (chromaError: any) {
- silentDebug('[search-server] ChromaDB failed - returning empty results (FTS5 fallback removed):', chromaError.message);
- silentDebug('[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/');
+ silentDebug('[mcp-server] ChromaDB failed - returning empty results (FTS5 fallback removed):', chromaError.message);
+ silentDebug('[mcp-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/');
// Return empty results - no fallback
observations = [];
sessions = [];
@@ -188,8 +188,8 @@ export class SearchManager {
}
// ChromaDB not initialized - return empty results (no fallback)
else {
- silentDebug(`[search-server] ChromaDB not initialized - returning empty results (FTS5 fallback removed)`);
- silentDebug(`[search-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/`);
+ silentDebug(`[mcp-server] ChromaDB not initialized - returning empty results (FTS5 fallback removed)`);
+ silentDebug(`[mcp-server] Install UVX/Python to enable vector search: https://docs.astral.sh/uv/getting-started/installation/`);
observations = [];
sessions = [];
prompts = [];
@@ -312,9 +312,9 @@ export class SearchManager {
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using hybrid semantic search for timeline query');
+ silentDebug('[mcp-server] Using hybrid semantic search for timeline query');
const chromaResults = await this.queryChroma(query, 100);
- silentDebug(`[search-server] Chroma returned ${chromaResults?.ids?.length ?? 0} semantic matches`);
+ silentDebug(`[mcp-server] Chroma returned ${chromaResults?.ids?.length ?? 0} semantic matches`);
if (chromaResults?.ids && chromaResults.ids.length > 0) {
const ninetyDaysAgo = Date.now() - (90 * 24 * 60 * 60 * 1000);
@@ -328,7 +328,7 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
+ silentDebug('[mcp-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
}
}
@@ -345,7 +345,7 @@ export class SearchManager {
const topResult = results[0];
anchorId = topResult.id;
anchorEpoch = topResult.created_at_epoch;
- silentDebug(`[search-server] Query mode: Using observation #${topResult.id} as timeline anchor`);
+ silentDebug(`[mcp-server] Query mode: Using observation #${topResult.id} as timeline anchor`);
timelineData = this.sessionStore.getTimelineAroundObservation(topResult.id, topResult.created_at_epoch, depth_before, depth_after, project);
}
// MODE 2: Anchor-based timeline
@@ -621,7 +621,7 @@ export class SearchManager {
try {
if (query) {
// Semantic search filtered to decision type
- silentDebug('[search-server] Using Chroma semantic search with type=decision filter');
+ silentDebug('[mcp-server] Using Chroma semantic search with type=decision filter');
const chromaResults = await this.queryChroma(query, Math.min((filters.limit || 20) * 2, 100), { type: 'decision' });
const obsIds = chromaResults.ids;
@@ -632,7 +632,7 @@ export class SearchManager {
}
} else {
// No query: get all decisions, rank by "decision" keyword
- silentDebug('[search-server] Using metadata-first + semantic ranking for decisions');
+ silentDebug('[mcp-server] Using metadata-first + semantic ranking for decisions');
const metadataResults = this.sessionSearch.findByType('decision', filters);
if (metadataResults.length > 0) {
@@ -653,7 +653,7 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma search failed, using SQLite fallback:', chromaError.message);
+ silentDebug('[mcp-server] Chroma search failed, using SQLite fallback:', chromaError.message);
}
}
@@ -709,7 +709,7 @@ export class SearchManager {
// Search for change-type observations and change-related concepts
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using hybrid search for change-related observations');
+ silentDebug('[mcp-server] Using hybrid search for change-related observations');
// Get all observations with type="change" or concepts containing change
const typeResults = this.sessionSearch.findByType('change', filters);
@@ -737,7 +737,7 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma ranking failed, using SQLite order:', chromaError.message);
+ silentDebug('[mcp-server] Chroma ranking failed, using SQLite order:', chromaError.message);
}
}
@@ -807,7 +807,7 @@ export class SearchManager {
// Search for how-it-works concept observations
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using metadata-first + semantic ranking for how-it-works');
+ silentDebug('[mcp-server] Using metadata-first + semantic ranking for how-it-works');
const metadataResults = this.sessionSearch.findByConcept('how-it-works', filters);
if (metadataResults.length > 0) {
@@ -827,7 +827,7 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma ranking failed, using SQLite order:', chromaError.message);
+ silentDebug('[mcp-server] Chroma ranking failed, using SQLite order:', chromaError.message);
}
}
@@ -883,11 +883,11 @@ export class SearchManager {
// Vector-first search via ChromaDB
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using hybrid semantic search (Chroma + SQLite)');
+ silentDebug('[mcp-server] Using hybrid semantic search (Chroma + SQLite)');
// Step 1: Chroma semantic search (top 100)
const chromaResults = await this.queryChroma(query, 100);
- silentDebug(`[search-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
+ silentDebug(`[mcp-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
if (chromaResults.ids.length > 0) {
// Step 2: Filter by recency (90 days)
@@ -897,17 +897,17 @@ export class SearchManager {
return meta && meta.created_at_epoch > ninetyDaysAgo;
});
- silentDebug(`[search-server] ${recentIds.length} results within 90-day window`);
+ silentDebug(`[mcp-server] ${recentIds.length} results within 90-day window`);
// Step 3: Hydrate from SQLite in temporal order
if (recentIds.length > 0) {
const limit = options.limit || 20;
results = this.sessionStore.getObservationsByIds(recentIds, { orderBy: 'date_desc', limit });
- silentDebug(`[search-server] Hydrated ${results.length} observations from SQLite`);
+ silentDebug(`[mcp-server] Hydrated ${results.length} observations from SQLite`);
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
+ silentDebug('[mcp-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
}
}
@@ -960,11 +960,11 @@ export class SearchManager {
// Vector-first search via ChromaDB
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using hybrid semantic search for sessions');
+ silentDebug('[mcp-server] Using hybrid semantic search for sessions');
// Step 1: Chroma semantic search (top 100)
const chromaResults = await this.queryChroma(query, 100, { doc_type: 'session_summary' });
- silentDebug(`[search-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
+ silentDebug(`[mcp-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
if (chromaResults.ids.length > 0) {
// Step 2: Filter by recency (90 days)
@@ -974,17 +974,17 @@ export class SearchManager {
return meta && meta.created_at_epoch > ninetyDaysAgo;
});
- silentDebug(`[search-server] ${recentIds.length} results within 90-day window`);
+ silentDebug(`[mcp-server] ${recentIds.length} results within 90-day window`);
// Step 3: Hydrate from SQLite in temporal order
if (recentIds.length > 0) {
const limit = options.limit || 20;
results = this.sessionStore.getSessionSummariesByIds(recentIds, { orderBy: 'date_desc', limit });
- silentDebug(`[search-server] Hydrated ${results.length} sessions from SQLite`);
+ silentDebug(`[mcp-server] Hydrated ${results.length} sessions from SQLite`);
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
+ silentDebug('[mcp-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
}
}
@@ -1037,11 +1037,11 @@ export class SearchManager {
// Vector-first search via ChromaDB
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using hybrid semantic search for user prompts');
+ silentDebug('[mcp-server] Using hybrid semantic search for user prompts');
// Step 1: Chroma semantic search (top 100)
const chromaResults = await this.queryChroma(query, 100, { doc_type: 'user_prompt' });
- silentDebug(`[search-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
+ silentDebug(`[mcp-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
if (chromaResults.ids.length > 0) {
// Step 2: Filter by recency (90 days)
@@ -1051,17 +1051,17 @@ export class SearchManager {
return meta && meta.created_at_epoch > ninetyDaysAgo;
});
- silentDebug(`[search-server] ${recentIds.length} results within 90-day window`);
+ silentDebug(`[mcp-server] ${recentIds.length} results within 90-day window`);
// Step 3: Hydrate from SQLite in temporal order
if (recentIds.length > 0) {
const limit = options.limit || 20;
results = this.sessionStore.getUserPromptsByIds(recentIds, { orderBy: 'date_desc', limit });
- silentDebug(`[search-server] Hydrated ${results.length} user prompts from SQLite`);
+ silentDebug(`[mcp-server] Hydrated ${results.length} user prompts from SQLite`);
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
+ silentDebug('[mcp-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
}
}
@@ -1114,11 +1114,11 @@ export class SearchManager {
// Metadata-first, semantic-enhanced search
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using metadata-first + semantic ranking for concept search');
+ silentDebug('[mcp-server] Using metadata-first + semantic ranking for concept search');
// Step 1: SQLite metadata filter (get all IDs with this concept)
const metadataResults = this.sessionSearch.findByConcept(concept, filters);
- silentDebug(`[search-server] Found ${metadataResults.length} observations with concept "${concept}"`);
+ silentDebug(`[mcp-server] Found ${metadataResults.length} observations with concept "${concept}"`);
if (metadataResults.length > 0) {
// Step 2: Chroma semantic ranking (rank by relevance to concept)
@@ -1133,7 +1133,7 @@ export class SearchManager {
}
}
- silentDebug(`[search-server] Chroma ranked ${rankedIds.length} results by semantic relevance`);
+ silentDebug(`[mcp-server] Chroma ranked ${rankedIds.length} results by semantic relevance`);
// Step 3: Hydrate in semantic rank order
if (rankedIds.length > 0) {
@@ -1143,14 +1143,14 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma ranking failed, using SQLite order:', chromaError.message);
+ silentDebug('[mcp-server] Chroma ranking failed, using SQLite order:', chromaError.message);
// Fall through to SQLite fallback
}
}
// Fall back to SQLite-only if Chroma unavailable or failed
if (results.length === 0) {
- silentDebug('[search-server] Using SQLite-only concept search');
+ silentDebug('[mcp-server] Using SQLite-only concept search');
results = this.sessionSearch.findByConcept(concept, filters);
}
@@ -1204,11 +1204,11 @@ export class SearchManager {
// Metadata-first, semantic-enhanced search for observations
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using metadata-first + semantic ranking for file search');
+ silentDebug('[mcp-server] Using metadata-first + semantic ranking for file search');
// Step 1: SQLite metadata filter (get all results with this file)
const metadataResults = this.sessionSearch.findByFile(filePath, filters);
- silentDebug(`[search-server] Found ${metadataResults.observations.length} observations, ${metadataResults.sessions.length} sessions for file "${filePath}"`);
+ silentDebug(`[mcp-server] Found ${metadataResults.observations.length} observations, ${metadataResults.sessions.length} sessions for file "${filePath}"`);
// Sessions: Keep as-is (already summarized, no semantic ranking needed)
sessions = metadataResults.sessions;
@@ -1227,7 +1227,7 @@ export class SearchManager {
}
}
- silentDebug(`[search-server] Chroma ranked ${rankedIds.length} observations by semantic relevance`);
+ silentDebug(`[mcp-server] Chroma ranked ${rankedIds.length} observations by semantic relevance`);
// Step 3: Hydrate in semantic rank order
if (rankedIds.length > 0) {
@@ -1237,14 +1237,14 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma ranking failed, using SQLite order:', chromaError.message);
+ silentDebug('[mcp-server] Chroma ranking failed, using SQLite order:', chromaError.message);
// Fall through to SQLite fallback
}
}
// Fall back to SQLite-only if Chroma unavailable or failed
if (observations.length === 0 && sessions.length === 0) {
- silentDebug('[search-server] Using SQLite-only file search');
+ silentDebug('[mcp-server] Using SQLite-only file search');
const results = this.sessionSearch.findByFile(filePath, filters);
observations = results.observations;
sessions = results.sessions;
@@ -1323,11 +1323,11 @@ export class SearchManager {
// Metadata-first, semantic-enhanced search
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using metadata-first + semantic ranking for type search');
+ silentDebug('[mcp-server] Using metadata-first + semantic ranking for type search');
// Step 1: SQLite metadata filter (get all IDs with this type)
const metadataResults = this.sessionSearch.findByType(type, filters);
- silentDebug(`[search-server] Found ${metadataResults.length} observations with type "${typeStr}"`);
+ silentDebug(`[mcp-server] Found ${metadataResults.length} observations with type "${typeStr}"`);
if (metadataResults.length > 0) {
// Step 2: Chroma semantic ranking (rank by relevance to type)
@@ -1342,7 +1342,7 @@ export class SearchManager {
}
}
- silentDebug(`[search-server] Chroma ranked ${rankedIds.length} results by semantic relevance`);
+ silentDebug(`[mcp-server] Chroma ranked ${rankedIds.length} results by semantic relevance`);
// Step 3: Hydrate in semantic rank order
if (rankedIds.length > 0) {
@@ -1352,14 +1352,14 @@ export class SearchManager {
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma ranking failed, using SQLite order:', chromaError.message);
+ silentDebug('[mcp-server] Chroma ranking failed, using SQLite order:', chromaError.message);
// Fall through to SQLite fallback
}
}
// Fall back to SQLite-only if Chroma unavailable or failed
if (results.length === 0) {
- silentDebug('[search-server] Using SQLite-only type search');
+ silentDebug('[mcp-server] Using SQLite-only type search');
results = this.sessionSearch.findByType(type, filters);
}
@@ -1815,9 +1815,9 @@ export class SearchManager {
// Use hybrid search if available
if (this.chromaSync) {
try {
- silentDebug('[search-server] Using hybrid semantic search for timeline query');
+ silentDebug('[mcp-server] Using hybrid semantic search for timeline query');
const chromaResults = await this.queryChroma(query, 100);
- silentDebug(`[search-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
+ silentDebug(`[mcp-server] Chroma returned ${chromaResults.ids.length} semantic matches`);
if (chromaResults.ids.length > 0) {
// Filter by recency (90 days)
@@ -1827,15 +1827,15 @@ export class SearchManager {
return meta && meta.created_at_epoch > ninetyDaysAgo;
});
- silentDebug(`[search-server] ${recentIds.length} results within 90-day window`);
+ silentDebug(`[mcp-server] ${recentIds.length} results within 90-day window`);
if (recentIds.length > 0) {
results = this.sessionStore.getObservationsByIds(recentIds, { orderBy: 'date_desc', limit: mode === 'auto' ? 1 : limit });
- silentDebug(`[search-server] Hydrated ${results.length} observations from SQLite`);
+ silentDebug(`[mcp-server] Hydrated ${results.length} observations from SQLite`);
}
}
} catch (chromaError: any) {
- silentDebug('[search-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
+ silentDebug('[mcp-server] Chroma query failed - no results (FTS5 fallback removed):', chromaError.message);
}
}
@@ -1886,7 +1886,7 @@ export class SearchManager {
} else {
// Auto mode: Use top result as timeline anchor
const topResult = results[0];
- silentDebug(`[search-server] Auto mode: Using observation #${topResult.id} as timeline anchor`);
+ silentDebug(`[mcp-server] Auto mode: Using observation #${topResult.id} as timeline anchor`);
// Get timeline around this observation
const timelineData = this.sessionStore.getTimelineAroundObservation(