@anmol-srv/sigil 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +397 -339
- package/dist/daemon.js +198 -121
- package/dist/hooks/post-tool-use.js +18 -18
- package/dist/hooks/session-end.js +28 -28
- package/dist/hooks/stop.js +36 -36
- package/dist/hooks/user-prompt-submit.js +17 -17
- package/dist/server.js +26 -26
- package/package.json +1 -1
- package/src/gui/web/api.js +37 -0
- package/src/gui/web/app.css +114 -50
- package/src/gui/web/app.js +203 -91
- package/src/gui/web/components.js +90 -0
- package/src/gui/web/design/colors_and_type.css +178 -0
- package/src/gui/web/design/sigil-mark-mono.svg +8 -0
- package/src/gui/web/design/sigil-mark.svg +26 -0
- package/src/gui/web/index.html +54 -42
- package/src/gui/web/toast.js +62 -0
package/dist/server.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __sigilCreateRequire } from 'node:module'; const require = __sigilCreateRequire(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`))!==-1;){let g=s.slice(0,m);if(s=s.slice(m+1),!g.trim())continue;let _;try{_=JSON.parse(g)}catch{continue}let A=o.get(_.id);A&&(o.delete(_.id),clearTimeout(A.timer),_.ok?A.resolve(_):A.reject(new
|
|
5
|
-
`;return new Promise((k,S)=>{let
|
|
6
|
-
`),await fd(),await cd(),Ht())}async function Bn(){if(!Gn(De))return!1;try{let t=await Ht({timeoutMs:1e3});return await t.call("ping",{}),await t.close(),!0}catch{return!1}}async function fd(){rd(N,{recursive:!0}),await Nn();let t=ud(),e=Dn(Vt,"a"),r=Dn(Vt,"a");td(process.execPath,[t],{detached:!0,stdio:["ignore",e,r],env:{...process.env,SIGIL_DAEMON_AUTOSPAWN:"1"}}).unref();try{Ln(e)}catch{}try{Ln(r)}catch{}}function ud(){let t=[ur(Me,"dist","daemon.js"),ur(Me,"src","daemon","index.js"),ur(nd(od(import.meta.url)),"..","daemon","index.js")];for(let e of t)if(Gn(e))return e;throw new Error("cannot locate daemon entry point (looked in dist/ and src/daemon/)")}async function cd(){let t=Date.now()+Fn,e=sd;for(;Date.now()<t;){if(await Bn())return;await ad(e),e=Math.min(e*2,id)}throw new Error(`daemon did not become ready within ${Fn}ms \u2014 check ${Vt}`)}var Fn,sd,id,zn=ct(()=>{Wt();jn();Mn();Fn=5e3,sd=25,id=400});var Vn={};dr(Vn,{closeDaemonConnection:()=>pd,daemonCall:()=>$});async function Zn(){return ft||(it||(it=Un({quiet:!0}).then(t=>(ft=t,t)).catch(t=>{throw it=null,t})),it)}function ld(t){return t?t.code&&dd.has(t.code)?!0:/^daemon connection closed/i.test(t.message||""):!1}async function $(t,e){let r=await Zn();try{let{data:a}=await r.call(t,e??{});return a}catch(a){if(ld(a)){ft=null,it=null;let n=await Zn(),{data:o}=await n.call(t,e??{});return o}throw a}}async function pd(){let t=ft;ft=null,it=null,t&&await t.close()}var it,ft,dd,H=ct(()=>{zn();it=null,ft=null;dd=new Set(["ECONNREFUSED","ENOENT","EPIPE","ECONNRESET"])});import{config as xd}from"dotenv";import{resolve as cr,dirname as ro}from"node:path";import{fileURLToPath as _d}from"node:url";import{existsSync as vd}from"node:fs";import"dotenv/config";import{McpServer as hd}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as gd}from"@modelcontextprotocol/sdk/server/stdio.js";var y={};dr(y,{BRAND:()=>Eo,DIRTY:()=>xe,EMPTY_PATH:()=>io,INVALID:()=>x,NEVER:()=>ms,OK:()=>M,ParseStatus:()=>j,Schema:()=>w,ZodAny:()=>fe,ZodArray:()=>re,ZodBigInt:()=>ve,ZodBoolean:()=>be,ZodBranded:()=>lt,ZodCatch:()=>Re,ZodDate:()=>we,ZodDefault:()=>$e,ZodDiscriminatedUnion:()=>wt,ZodEffects:()=>z,ZodEnum:()=>Ce,ZodError:()=>L,ZodFirstPartyTypeKind:()=>v,ZodFunction:()=>kt,ZodIntersection:()=>Oe,ZodIssueCode:()=>c,ZodLazy:()=>Ae,ZodLiteral:()=>Ie,ZodMap:()=>Ze,ZodNaN:()=>We,ZodNativeEnum:()=>Ee,ZodNever:()=>Z,ZodNull:()=>ke,ZodNullable:()=>Y,ZodNumber:()=>_e,ZodObject:()=>F,ZodOptional:()=>U,ZodParsedType:()=>p,ZodPipeline:()=>pt,ZodPromise:()=>ue,ZodReadonly:()=>Pe,ZodRecord:()=>Tt,ZodSchema:()=>w,ZodSet:()=>Ve,ZodString:()=>ie,ZodSymbol:()=>Be,ZodTransformer:()=>z,ZodTuple:()=>K,ZodType:()=>w,ZodUndefined:()=>Te,ZodUnion:()=>Se,ZodUnknown:()=>te,ZodVoid:()=>ze,addIssueToContext:()=>l,any:()=>Fo,array:()=>zo,bigint:()=>No,boolean:()=>wr,coerce:()=>ps,custom:()=>_r,date:()=>jo,datetimeRegex:()=>yr,defaultErrorMap:()=>Q,discriminatedUnion:()=>Ho,effect:()=>os,enum:()=>rs,function:()=>Qo,getErrorMap:()=>Fe,getParsedType:()=>q,instanceof:()=>Ro,intersection:()=>qo,isAborted:()=>vt,isAsync:()=>Ge,isDirty:()=>bt,isValid:()=>se,late:()=>$o,lazy:()=>es,literal:()=>ts,makeIssue:()=>dt,map:()=>Jo,nan:()=>Po,nativeEnum:()=>as,never:()=>Uo,null:()=>Lo,nullable:()=>is,number:()=>br,object:()=>Zo,objectUtil:()=>qt,oboolean:()=>ls,onumber:()=>ds,optional:()=>ss,ostring:()=>cs,pipeline:()=>us,preprocess:()=>fs,promise:()=>ns,quotelessJson:()=>no,record:()=>Yo,set:()=>Xo,setErrorMap:()=>so,strictObject:()=>Vo,string:()=>vr,symbol:()=>Mo,transformer:()=>os,tuple:()=>Ko,undefined:()=>Do,union:()=>Wo,unknown:()=>Go,util:()=>T,void:()=>Bo});var T;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),s={};for(let i of o)s[i]=n[i];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=a,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(T||(T={}));var qt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(qt||(qt={}));var p=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),q=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var c=T.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"]),no=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),L=class t 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(o){return o.message},a={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)a._errors.push(r(s));else{let i=a,f=0;for(;f<s.path.length;){let u=s.path[f];f===s.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(r(s))):i[u]=i[u]||{_errors:[]},i=i[u],f++}}};return n(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},a=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};L.create=t=>new L(t);var oo=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,T.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${T.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${T.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${T.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:T.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,T.assertNever(t)}return{message:r}},Q=oo;var lr=Q;function so(t){lr=t}function Fe(){return lr}var dt=t=>{let{data:e,path:r,errorMaps:a,issueData:n}=t,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let i="",f=a.filter(u=>!!u).slice().reverse();for(let u of f)i=u(s,{data:e,defaultError:i}).message;return{...n,path:o,message:i}},io=[];function l(t,e){let r=Fe(),a=dt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Q?void 0:Q].filter(n=>!!n)});t.common.issues.push(a)}var j=class t{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 n of r){if(n.status==="aborted")return x;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let n of r){let o=await n.key,s=await n.value;a.push({key:o,value:s})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return x;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(a[o.value]=s.value)}return{status:e.value,value:a}}},x=Object.freeze({status:"aborted"}),xe=t=>({status:"dirty",value:t}),M=t=>({status:"valid",value:t}),vt=t=>t.status==="aborted",bt=t=>t.status==="dirty",se=t=>t.status==="valid",Ge=t=>typeof Promise<"u"&&t instanceof Promise;var h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var B=class{constructor(e,r,a,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},pr=(t,e)=>{if(se(e))return{success:!0,data:e.value};if(!t.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 L(t.common.issues);return this._error=r,this._error}}};function b(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:n}=t;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:n}:{errorMap:(s,i)=>{let{message:f}=t;return s.code==="invalid_enum_value"?{message:f??i.defaultError}:typeof i.data>"u"?{message:f??a??i.defaultError}:s.code!=="invalid_type"?{message:i.defaultError}:{message:f??r??i.defaultError}},description:n}}var w=class{get description(){return this._def.description}_getType(e){return q(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ge(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:q(e)},n=this._parseSync({data:e,path:a.path,parent:a});return pr(a,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:q(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:r});return se(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=>se(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:q(e)},n=this._parse({data:e,path:a.path,parent:a}),o=await(Ge(n)?n:Promise.resolve(n));return pr(a,o)}refine(e,r){let a=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=e(n),i=()=>o.addIssue({code:c.custom,...a(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(f=>f?!0:(i(),!1)):s?!0:(i(),!1)})}refinement(e,r){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof r=="function"?r(a,n):r),!1))}_refinement(e){return new z({schema:this,typeName:v.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 U.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return ue.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return Oe.create(this,e,this._def)}transform(e){return new z({...b(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new $e({...b(this._def),innerType:this,defaultValue:r,typeName:v.ZodDefault})}brand(){return new lt({typeName:v.ZodBranded,type:this,...b(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Re({...b(this._def),innerType:this,catchValue:r,typeName:v.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return pt.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},fo=/^c[^\s-]{8,}$/i,uo=/^[0-9a-z]+$/,co=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lo=/^[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,po=/^[a-z0-9_-]{21}$/i,mo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ho=/^[-+]?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)?)??$/,go=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Kt,xo=/^(?:(?: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])$/,_o=/^(?:(?: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])$/,vo=/^(([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]))$/,bo=/^(([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])$/,wo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,To=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hr="((\\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])))",ko=new RegExp(`^${hr}$`);function gr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function So(t){return new RegExp(`^${gr(t)}$`)}function yr(t){let e=`${hr}T${gr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Oo(t,e){return!!((e==="v4"||!e)&&xo.test(t)||(e==="v6"||!e)&&vo.test(t))}function Ao(t,e){if(!mo.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Io(t,e){return!!((e==="v4"||!e)&&_o.test(t)||(e==="v6"||!e)&&bo.test(t))}var ie=class t extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_type,expected:p.string,received:o.parsedType}),x}let a=new j,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),a.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),a.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;(s||i)&&(n=this._getOrReturnCtx(e,n),s?l(n,{code:c.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&l(n,{code:c.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),a.dirty())}else if(o.kind==="email")go.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="emoji")Kt||(Kt=new RegExp(yo,"u")),Kt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="uuid")lo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="nanoid")po.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="cuid")fo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="cuid2")uo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="ulid")co.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:o.message}),a.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:o.message}),a.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),a.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:o.value},message:o.message}),a.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:o.value},message:o.message}),a.dirty()):o.kind==="datetime"?yr(o).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:o.message}),a.dirty()):o.kind==="date"?ko.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:o.message}),a.dirty()):o.kind==="time"?So(o).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:o.message}),a.dirty()):o.kind==="duration"?ho.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="ip"?Oo(e.data,o.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="jwt"?Ao(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="cidr"?Io(e.data,o.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="base64"?wo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="base64url"?To.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:o.message}),a.dirty()):T.assertNever(o);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(n=>e.test(n),{validation:r,code:c.invalid_string,...h.errToObj(a)})}_addCheck(e){return new t({...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 t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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.value<e)&&(e=r.value);return e}};ie.create=t=>new ie({checks:[],typeName:v.ZodString,coerce:t?.coerce??!1,...b(t)});function Co(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=r>a?r:a,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}var _e=class t 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)!==p.number){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_type,expected:p.number,received:o.parsedType}),x}let a,n=new j;for(let o of this._def.checks)o.kind==="int"?T.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Co(e.data,o.value)!==0&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.not_finite,message:o.message}),n.dirty()):T.assertNever(o);return{status:n.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,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:h.toString(n)}]})}_addCheck(e){return new t({...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.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&T.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.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};_e.create=t=>new _e({checks:[],typeName:v.ZodNumber,coerce:t?.coerce||!1,...b(t)});var ve=class t 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)!==p.bigint)return this._getInvalidInput(e);let a,n=new j;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):T.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.bigint,received:r.parsedType}),x}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,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:h.toString(n)}]})}_addCheck(e){return new t({...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.value<e)&&(e=r.value);return e}};ve.create=t=>new ve({checks:[],typeName:v.ZodBigInt,coerce:t?.coerce??!1,...b(t)});var be=class extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.boolean,received:a.parsedType}),x}return M(e.data)}};be.create=t=>new be({typeName:v.ZodBoolean,coerce:t?.coerce||!1,...b(t)});var we=class t extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_type,expected:p.date,received:o.parsedType}),x}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_date}),x}let a=new j,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),a.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),a.dirty()):T.assertNever(o);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...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.value<e)&&(e=r.value);return e!=null?new Date(e):null}};we.create=t=>new we({checks:[],coerce:t?.coerce||!1,typeName:v.ZodDate,...b(t)});var Be=class extends w{_parse(e){if(this._getType(e)!==p.symbol){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.symbol,received:a.parsedType}),x}return M(e.data)}};Be.create=t=>new Be({typeName:v.ZodSymbol,...b(t)});var Te=class extends w{_parse(e){if(this._getType(e)!==p.undefined){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.undefined,received:a.parsedType}),x}return M(e.data)}};Te.create=t=>new Te({typeName:v.ZodUndefined,...b(t)});var ke=class extends w{_parse(e){if(this._getType(e)!==p.null){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.null,received:a.parsedType}),x}return M(e.data)}};ke.create=t=>new ke({typeName:v.ZodNull,...b(t)});var fe=class extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return M(e.data)}};fe.create=t=>new fe({typeName:v.ZodAny,...b(t)});var te=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return M(e.data)}};te.create=t=>new te({typeName:v.ZodUnknown,...b(t)});var Z=class extends w{_parse(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.never,received:r.parsedType}),x}};Z.create=t=>new Z({typeName:v.ZodNever,...b(t)});var ze=class extends w{_parse(e){if(this._getType(e)!==p.undefined){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.void,received:a.parsedType}),x}return M(e.data)}};ze.create=t=>new ze({typeName:v.ZodVoid,...b(t)});var re=class t extends w{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),n=this._def;if(r.parsedType!==p.array)return l(r,{code:c.invalid_type,expected:p.array,received:r.parsedType}),x;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,i=r.data.length<n.exactLength.value;(s||i)&&(l(r,{code:s?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(l(r,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(l(r,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((s,i)=>n.type._parseAsync(new B(r,s,r.path,i)))).then(s=>j.mergeArray(a,s));let o=[...r.data].map((s,i)=>n.type._parseSync(new B(r,s,r.path,i)));return j.mergeArray(a,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:h.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:h.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:h.toString(r)}})}nonempty(e){return this.min(1,e)}};re.create=(t,e)=>new re({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...b(e)});function Ue(t){if(t instanceof F){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=U.create(Ue(a))}return new F({...t._def,shape:()=>e})}else return t instanceof re?new re({...t._def,type:Ue(t.element)}):t instanceof U?U.create(Ue(t.unwrap())):t instanceof Y?Y.create(Ue(t.unwrap())):t instanceof K?K.create(t.items.map(e=>Ue(e))):t}var F=class t 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(),r=T.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==p.object){let u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:p.object,received:u.parsedType}),x}let{status:a,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Z&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||i.push(u);let f=[];for(let u of s){let d=o[u],m=n.data[u];f.push({key:{status:"valid",value:u},value:d._parse(new B(n,m,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Z){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of i)f.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")i.length>0&&(l(n,{code:c.unrecognized_keys,keys:i}),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 i){let m=n.data[d];f.push({key:{status:"valid",value:d},value:u._parse(new B(n,m,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of f){let m=await d.key,g=await d.value;u.push({key:m,value:g,alwaysSet:d.alwaysSet})}return u}).then(u=>j.mergeObjectSync(a,u)):j.mergeObjectSync(a,f)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{let n=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let a of T.objectKeys(e))e[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let a of T.objectKeys(this.shape))e[a]||(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}deepPartial(){return Ue(this)}partial(e){let r={};for(let a of T.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?r[a]=n:r[a]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let a of T.objectKeys(this.shape))if(e&&!e[a])r[a]=this.shape[a];else{let o=this.shape[a];for(;o instanceof U;)o=o._def.innerType;r[a]=o}return new t({...this._def,shape:()=>r})}keyof(){return xr(T.objectKeys(this.shape))}};F.create=(t,e)=>new F({shape:()=>t,unknownKeys:"strip",catchall:Z.create(),typeName:v.ZodObject,...b(e)});F.strictCreate=(t,e)=>new F({shape:()=>t,unknownKeys:"strict",catchall:Z.create(),typeName:v.ZodObject,...b(e)});F.lazycreate=(t,e)=>new F({shape:t,unknownKeys:"strip",catchall:Z.create(),typeName:v.ZodObject,...b(e)});var Se=class extends w{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(i=>new L(i.ctx.common.issues));return l(r,{code:c.invalid_union,unionErrors:s}),x}if(r.common.async)return Promise.all(a.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let f of a){let u={...r,common:{...r.common,issues:[]},parent:null},d=f._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(f=>new L(f));return l(r,{code:c.invalid_union,unionErrors:i}),x}}get options(){return this._def.options}};Se.create=(t,e)=>new Se({options:t,typeName:v.ZodUnion,...b(e)});var ee=t=>t instanceof Ae?ee(t.schema):t instanceof z?ee(t.innerType()):t instanceof Ie?[t.value]:t instanceof Ce?t.options:t instanceof Ee?T.objectValues(t.enum):t instanceof $e?ee(t._def.innerType):t instanceof Te?[void 0]:t instanceof ke?[null]:t instanceof U?[void 0,...ee(t.unwrap())]:t instanceof Y?[null,...ee(t.unwrap())]:t instanceof lt||t instanceof Pe?ee(t.unwrap()):t instanceof Re?ee(t._def.innerType):[],wt=class t extends w{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return l(r,{code:c.invalid_type,expected:p.object,received:r.parsedType}),x;let a=this.discriminator,n=r.data[a],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(l(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let n=new Map;for(let o of r){let s=ee(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o)}}return new t({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...b(a)})}};function Yt(t,e){let r=q(t),a=q(e);if(t===e)return{valid:!0,data:t};if(r===p.object&&a===p.object){let n=T.objectKeys(e),o=T.objectKeys(t).filter(i=>n.indexOf(i)!==-1),s={...t,...e};for(let i of o){let f=Yt(t[i],e[i]);if(!f.valid)return{valid:!1};s[i]=f.data}return{valid:!0,data:s}}else if(r===p.array&&a===p.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],i=e[o],f=Yt(s,i);if(!f.valid)return{valid:!1};n.push(f.data)}return{valid:!0,data:n}}else return r===p.date&&a===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Oe=class extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e),n=(o,s)=>{if(vt(o)||vt(s))return x;let i=Yt(o.value,s.value);return i.valid?((bt(o)||bt(s))&&r.dirty(),{status:r.value,value:i.data}):(l(a,{code:c.invalid_intersection_types}),x)};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(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Oe.create=(t,e,r)=>new Oe({left:t,right:e,typeName:v.ZodIntersection,...b(r)});var K=class t extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==p.array)return l(a,{code:c.invalid_type,expected:p.array,received:a.parsedType}),x;if(a.data.length<this._def.items.length)return l(a,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&a.data.length>this._def.items.length&&(l(a,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...a.data].map((s,i)=>{let f=this._def.items[i]||this._def.rest;return f?f._parse(new B(a,s,a.path,i)):null}).filter(s=>!!s);return a.common.async?Promise.all(o).then(s=>j.mergeArray(r,s)):j.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};K.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new K({items:t,typeName:v.ZodTuple,rest:null,...b(e)})};var Tt=class t extends w{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!==p.object)return l(a,{code:c.invalid_type,expected:p.object,received:a.parsedType}),x;let n=[],o=this._def.keyType,s=this._def.valueType;for(let i in a.data)n.push({key:o._parse(new B(a,i,a.path,i)),value:s._parse(new B(a,a.data[i],a.path,i)),alwaysSet:i in a.data});return a.common.async?j.mergeObjectAsync(r,n):j.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof w?new t({keyType:e,valueType:r,typeName:v.ZodRecord,...b(a)}):new t({keyType:ie.create(),valueType:e,typeName:v.ZodRecord,...b(r)})}},Ze=class extends w{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!==p.map)return l(a,{code:c.invalid_type,expected:p.map,received:a.parsedType}),x;let n=this._def.keyType,o=this._def.valueType,s=[...a.data.entries()].map(([i,f],u)=>({key:n._parse(new B(a,i,a.path,[u,"key"])),value:o._parse(new B(a,f,a.path,[u,"value"]))}));if(a.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let f of s){let u=await f.key,d=await f.value;if(u.status==="aborted"||d.status==="aborted")return x;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let f of s){let u=f.key,d=f.value;if(u.status==="aborted"||d.status==="aborted")return x;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}}}};Ze.create=(t,e,r)=>new Ze({valueType:e,keyType:t,typeName:v.ZodMap,...b(r)});var Ve=class t extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==p.set)return l(a,{code:c.invalid_type,expected:p.set,received:a.parsedType}),x;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(l(a,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(l(a,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(f){let u=new Set;for(let d of f){if(d.status==="aborted")return x;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let i=[...a.data.values()].map((f,u)=>o._parse(new B(a,f,a.path,u)));return a.common.async?Promise.all(i).then(f=>s(f)):s(i)}min(e,r){return new t({...this._def,minSize:{value:e,message:h.toString(r)}})}max(e,r){return new t({...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)}};Ve.create=(t,e)=>new Ve({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...b(e)});var kt=class t extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.function)return l(r,{code:c.invalid_type,expected:p.function,received:r.parsedType}),x;function a(i,f){return dt({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fe(),Q].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:f}})}function n(i,f){return dt({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fe(),Q].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:f}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ue){let i=this;return M(async function(...f){let u=new L([]),d=await i._def.args.parseAsync(f,o).catch(_=>{throw u.addIssue(a(f,_)),u}),m=await Reflect.apply(s,this,d);return await i._def.returns._def.type.parseAsync(m,o).catch(_=>{throw u.addIssue(n(m,_)),u})})}else{let i=this;return M(function(...f){let u=i._def.args.safeParse(f,o);if(!u.success)throw new L([a(f,u.error)]);let d=Reflect.apply(s,this,u.data),m=i._def.returns.safeParse(d,o);if(!m.success)throw new L([n(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:K.create(e).rest(te.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||K.create([]).rest(te.create()),returns:r||te.create(),typeName:v.ZodFunction,...b(a)})}},Ae=class extends w{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})}};Ae.create=(t,e)=>new Ae({getter:t,typeName:v.ZodLazy,...b(e)});var Ie=class extends w{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return l(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ie.create=(t,e)=>new Ie({value:t,typeName:v.ZodLiteral,...b(e)});function xr(t,e){return new Ce({values:t,typeName:v.ZodEnum,...b(e)})}var Ce=class t extends w{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return l(r,{expected:T.joinValues(a),received:r.parsedType,code:c.invalid_type}),x}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 l(r,{received:r.data,code:c.invalid_enum_value,options:a}),x}return M(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 t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Ce.create=xr;var Ee=class extends w{_parse(e){let r=T.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==p.string&&a.parsedType!==p.number){let n=T.objectValues(r);return l(a,{expected:T.joinValues(n),received:a.parsedType,code:c.invalid_type}),x}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=T.objectValues(r);return l(a,{received:a.data,code:c.invalid_enum_value,options:n}),x}return M(e.data)}get enum(){return this._def.values}};Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...b(e)});var ue=class extends w{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.promise&&r.common.async===!1)return l(r,{code:c.invalid_type,expected:p.promise,received:r.parsedType}),x;let a=r.parsedType===p.promise?r.data:Promise.resolve(r.data);return M(a.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...b(e)});var z=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:s=>{l(a,s),s.fatal?r.abort():r.dirty()},get path(){return a.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(a.data,o);if(a.common.async)return Promise.resolve(s).then(async i=>{if(r.value==="aborted")return x;let f=await this._def.schema._parseAsync({data:i,path:a.path,parent:a});return f.status==="aborted"?x:f.status==="dirty"?xe(f.value):r.value==="dirty"?xe(f.value):f});{if(r.value==="aborted")return x;let i=this._def.schema._parseSync({data:s,path:a.path,parent:a});return i.status==="aborted"?x:i.status==="dirty"?xe(i.value):r.value==="dirty"?xe(i.value):i}}if(n.type==="refinement"){let s=i=>{let f=n.refinement(i,o);if(a.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?x:(i.status==="dirty"&&r.dirty(),s(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>i.status==="aborted"?x:(i.status==="dirty"&&r.dirty(),s(i.value).then(()=>({status:r.value,value:i.value}))))}if(n.type==="transform")if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!se(s))return x;let i=n.transform(s.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>se(s)?Promise.resolve(n.transform(s.value,o)).then(i=>({status:r.value,value:i})):x);T.assertNever(n)}};z.create=(t,e,r)=>new z({schema:t,typeName:v.ZodEffects,effect:e,...b(r)});z.createWithPreprocess=(t,e,r)=>new z({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...b(r)});var U=class extends w{_parse(e){return this._getType(e)===p.undefined?M(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};U.create=(t,e)=>new U({innerType:t,typeName:v.ZodOptional,...b(e)});var Y=class extends w{_parse(e){return this._getType(e)===p.null?M(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Y.create=(t,e)=>new Y({innerType:t,typeName:v.ZodNullable,...b(e)});var $e=class extends w{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===p.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};$e.create=(t,e)=>new $e({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var Re=class extends w{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Ge(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new L(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new L(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Re.create=(t,e)=>new Re({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var We=class extends w{_parse(e){if(this._getType(e)!==p.nan){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.nan,received:a.parsedType}),x}return{status:"valid",value:e.data}}};We.create=t=>new We({typeName:v.ZodNaN,...b(t)});var Eo=Symbol("zod_brand"),lt=class extends w{_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}},pt=class t extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?x:o.status==="dirty"?(r.dirty(),xe(o.value)):this._def.out._parseAsync({data:o.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?x:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:v.ZodPipeline})}},Pe=class extends w{_parse(e){let r=this._def.innerType._parse(e),a=n=>(se(n)&&(n.value=Object.freeze(n.value)),n);return Ge(r)?r.then(n=>a(n)):a(r)}unwrap(){return this._def.innerType}};Pe.create=(t,e)=>new Pe({innerType:t,typeName:v.ZodReadonly,...b(e)});function mr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function _r(t,e={},r){return t?fe.create().superRefine((a,n)=>{let o=t(a);if(o instanceof Promise)return o.then(s=>{if(!s){let i=mr(e,a),f=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:f})}});if(!o){let s=mr(e,a),i=s.fatal??r??!0;n.addIssue({code:"custom",...s,fatal:i})}}):fe.create()}var $o={object:F.lazycreate},v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(v||(v={}));var Ro=(t,e={message:`Input not instance of ${t.name}`})=>_r(r=>r instanceof t,e),vr=ie.create,br=_e.create,Po=We.create,No=ve.create,wr=be.create,jo=we.create,Mo=Be.create,Do=Te.create,Lo=ke.create,Fo=fe.create,Go=te.create,Uo=Z.create,Bo=ze.create,zo=re.create,Zo=F.create,Vo=F.strictCreate,Wo=Se.create,Ho=wt.create,qo=Oe.create,Ko=K.create,Yo=Tt.create,Jo=Ze.create,Xo=Ve.create,Qo=kt.create,es=Ae.create,ts=Ie.create,rs=Ce.create,as=Ee.create,ns=ue.create,os=z.create,ss=U.create,is=Y.create,fs=z.createWithPreprocess,us=pt.create,cs=()=>vr().optional(),ds=()=>br().optional(),ls=()=>wr().optional(),ps={string:(t=>ie.create({...t,coerce:!0})),number:(t=>_e.create({...t,coerce:!0})),boolean:(t=>be.create({...t,coerce:!0})),bigint:(t=>ve.create({...t,coerce:!0})),date:(t=>we.create({...t,coerce:!0}))};var ms=x;var hs=typeof global=="object"&&global&&global.Object===Object&&global,St=hs;var gs=typeof self=="object"&&self&&self.Object===Object&&self,ys=St||gs||Function("return this")(),P=ys;var xs=P.Symbol,D=xs;var Tr=Object.prototype,_s=Tr.hasOwnProperty,vs=Tr.toString,mt=D?D.toStringTag:void 0;function bs(t){var e=_s.call(t,mt),r=t[mt];try{t[mt]=void 0;var a=!0}catch{}var n=vs.call(t);return a&&(e?t[mt]=r:delete t[mt]),n}var kr=bs;var ws=Object.prototype,Ts=ws.toString;function ks(t){return Ts.call(t)}var Sr=ks;var Ss="[object Null]",Os="[object Undefined]",Or=D?D.toStringTag:void 0;function As(t){return t==null?t===void 0?Os:Ss:Or&&Or in Object(t)?kr(t):Sr(t)}var V=As;function Is(t){return t!=null&&typeof t=="object"}var W=Is;var Cs="[object Symbol]";function Es(t){return typeof t=="symbol"||W(t)&&V(t)==Cs}var ae=Es;function $s(t,e){for(var r=-1,a=t==null?0:t.length,n=Array(a);++r<a;)n[r]=e(t[r],r,t);return n}var He=$s;var Rs=Array.isArray,E=Rs;var Ps=1/0,Ar=D?D.prototype:void 0,Ir=Ar?Ar.toString:void 0;function Cr(t){if(typeof t=="string")return t;if(E(t))return He(t,Cr)+"";if(ae(t))return Ir?Ir.call(t):"";var e=t+"";return e=="0"&&1/t==-Ps?"-0":e}var Er=Cr;function Ns(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ce=Ns;function js(t){return t}var de=js;var Ms="[object AsyncFunction]",Ds="[object Function]",Ls="[object GeneratorFunction]",Fs="[object Proxy]";function Gs(t){if(!ce(t))return!1;var e=V(t);return e==Ds||e==Ls||e==Ms||e==Fs}var Ot=Gs;var Us=P["__core-js_shared__"],At=Us;var $r=(function(){var t=/[^.]+$/.exec(At&&At.keys&&At.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Bs(t){return!!$r&&$r in t}var Rr=Bs;var zs=Function.prototype,Zs=zs.toString;function Vs(t){if(t!=null){try{return Zs.call(t)}catch{}try{return t+""}catch{}}return""}var ne=Vs;var Ws=/[\\^$.*+?()[\]{}|]/g,Hs=/^\[object .+?Constructor\]$/,qs=Function.prototype,Ks=Object.prototype,Ys=qs.toString,Js=Ks.hasOwnProperty,Xs=RegExp("^"+Ys.call(Js).replace(Ws,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Qs(t){if(!ce(t)||Rr(t))return!1;var e=Ot(t)?Xs:Hs;return e.test(ne(t))}var Pr=Qs;function ei(t,e){return t?.[e]}var Nr=ei;function ti(t,e){var r=Nr(t,e);return Pr(r)?r:void 0}var G=ti;var ri=G(P,"WeakMap"),It=ri;function ai(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var jr=ai;var ni=800,oi=16,si=Date.now;function ii(t){var e=0,r=0;return function(){var a=si(),n=oi-(a-r);if(r=a,n>0){if(++e>=ni)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Mr=ii;function fi(t){return function(){return t}}var Dr=fi;var ui=(function(){try{var t=G(Object,"defineProperty");return t({},"",{}),t}catch{}})(),qe=ui;var ci=qe?function(t,e){return qe(t,"toString",{configurable:!0,enumerable:!1,value:Dr(e),writable:!0})}:de,Lr=ci;var di=Mr(Lr),Fr=di;var li=9007199254740991,pi=/^(?:0|[1-9]\d*)$/;function mi(t,e){var r=typeof t;return e=e??li,!!e&&(r=="number"||r!="symbol"&&pi.test(t))&&t>-1&&t%1==0&&t<e}var Ke=mi;function hi(t,e,r){e=="__proto__"&&qe?qe(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Gr=hi;function gi(t,e){return t===e||t!==t&&e!==e}var Ye=gi;var Ur=Math.max;function yi(t,e,r){return e=Ur(e===void 0?t.length-1:e,0),function(){for(var a=arguments,n=-1,o=Ur(a.length-e,0),s=Array(o);++n<o;)s[n]=a[e+n];n=-1;for(var i=Array(e+1);++n<e;)i[n]=a[n];return i[e]=r(s),jr(t,this,i)}}var Br=yi;function xi(t,e){return Fr(Br(t,e,de),t+"")}var zr=xi;var _i=9007199254740991;function vi(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_i}var Je=vi;function bi(t){return t!=null&&Je(t.length)&&!Ot(t)}var le=bi;function wi(t,e,r){if(!ce(r))return!1;var a=typeof e;return(a=="number"?le(r)&&Ke(e,r.length):a=="string"&&e in r)?Ye(r[e],t):!1}var Jt=wi;var Ti=Object.prototype;function ki(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ti;return t===r}var Zr=ki;function Si(t,e){for(var r=-1,a=Array(t);++r<t;)a[r]=e(r);return a}var Vr=Si;var Oi="[object Arguments]";function Ai(t){return W(t)&&V(t)==Oi}var Xt=Ai;var Wr=Object.prototype,Ii=Wr.hasOwnProperty,Ci=Wr.propertyIsEnumerable,Ei=Xt((function(){return arguments})())?Xt:function(t){return W(t)&&Ii.call(t,"callee")&&!Ci.call(t,"callee")},Xe=Ei;function $i(){return!1}var Hr=$i;var Yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qr=Yr&&typeof module=="object"&&module&&!module.nodeType&&module,Ri=qr&&qr.exports===Yr,Kr=Ri?P.Buffer:void 0,Pi=Kr?Kr.isBuffer:void 0,Ni=Pi||Hr,ht=Ni;var ji="[object Arguments]",Mi="[object Array]",Di="[object Boolean]",Li="[object Date]",Fi="[object Error]",Gi="[object Function]",Ui="[object Map]",Bi="[object Number]",zi="[object Object]",Zi="[object RegExp]",Vi="[object Set]",Wi="[object String]",Hi="[object WeakMap]",qi="[object ArrayBuffer]",Ki="[object DataView]",Yi="[object Float32Array]",Ji="[object Float64Array]",Xi="[object Int8Array]",Qi="[object Int16Array]",ef="[object Int32Array]",tf="[object Uint8Array]",rf="[object Uint8ClampedArray]",af="[object Uint16Array]",nf="[object Uint32Array]",I={};I[Yi]=I[Ji]=I[Xi]=I[Qi]=I[ef]=I[tf]=I[rf]=I[af]=I[nf]=!0;I[ji]=I[Mi]=I[qi]=I[Di]=I[Ki]=I[Li]=I[Fi]=I[Gi]=I[Ui]=I[Bi]=I[zi]=I[Zi]=I[Vi]=I[Wi]=I[Hi]=!1;function of(t){return W(t)&&Je(t.length)&&!!I[V(t)]}var Jr=of;function sf(t){return function(e){return t(e)}}var Ct=sf;var Xr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gt=Xr&&typeof module=="object"&&module&&!module.nodeType&&module,ff=gt&>.exports===Xr,Qt=ff&&St.process,uf=(function(){try{var t=gt&>.require&>.require("util").types;return t||Qt&&Qt.binding&&Qt.binding("util")}catch{}})(),er=uf;var Qr=er&&er.isTypedArray,cf=Qr?Ct(Qr):Jr,Et=cf;var df=Object.prototype,lf=df.hasOwnProperty;function pf(t,e){var r=E(t),a=!r&&Xe(t),n=!r&&!a&&ht(t),o=!r&&!a&&!n&&Et(t),s=r||a||n||o,i=s?Vr(t.length,String):[],f=i.length;for(var u in t)(e||lf.call(t,u))&&!(s&&(u=="length"||n&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Ke(u,f)))&&i.push(u);return i}var ea=pf;function mf(t,e){return function(r){return t(e(r))}}var ta=mf;var hf=ta(Object.keys,Object),ra=hf;var gf=Object.prototype,yf=gf.hasOwnProperty;function xf(t){if(!Zr(t))return ra(t);var e=[];for(var r in Object(t))yf.call(t,r)&&r!="constructor"&&e.push(r);return e}var aa=xf;function _f(t){return le(t)?ea(t):aa(t)}var Qe=_f;var vf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bf=/^\w*$/;function wf(t,e){if(E(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||ae(t)?!0:bf.test(t)||!vf.test(t)||e!=null&&t in Object(e)}var et=wf;var Tf=G(Object,"create"),oe=Tf;function kf(){this.__data__=oe?oe(null):{},this.size=0}var na=kf;function Sf(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var oa=Sf;var Of="__lodash_hash_undefined__",Af=Object.prototype,If=Af.hasOwnProperty;function Cf(t){var e=this.__data__;if(oe){var r=e[t];return r===Of?void 0:r}return If.call(e,t)?e[t]:void 0}var sa=Cf;var Ef=Object.prototype,$f=Ef.hasOwnProperty;function Rf(t){var e=this.__data__;return oe?e[t]!==void 0:$f.call(e,t)}var ia=Rf;var Pf="__lodash_hash_undefined__";function Nf(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=oe&&e===void 0?Pf:e,this}var fa=Nf;function tt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}tt.prototype.clear=na;tt.prototype.delete=oa;tt.prototype.get=sa;tt.prototype.has=ia;tt.prototype.set=fa;var tr=tt;function jf(){this.__data__=[],this.size=0}var ua=jf;function Mf(t,e){for(var r=t.length;r--;)if(Ye(t[r][0],e))return r;return-1}var pe=Mf;var Df=Array.prototype,Lf=Df.splice;function Ff(t){var e=this.__data__,r=pe(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():Lf.call(e,r,1),--this.size,!0}var ca=Ff;function Gf(t){var e=this.__data__,r=pe(e,t);return r<0?void 0:e[r][1]}var da=Gf;function Uf(t){return pe(this.__data__,t)>-1}var la=Uf;function Bf(t,e){var r=this.__data__,a=pe(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var pa=Bf;function rt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}rt.prototype.clear=ua;rt.prototype.delete=ca;rt.prototype.get=da;rt.prototype.has=la;rt.prototype.set=pa;var me=rt;var zf=G(P,"Map"),he=zf;function Zf(){this.size=0,this.__data__={hash:new tr,map:new(he||me),string:new tr}}var ma=Zf;function Vf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ha=Vf;function Wf(t,e){var r=t.__data__;return ha(e)?r[typeof e=="string"?"string":"hash"]:r.map}var ge=Wf;function Hf(t){var e=ge(this,t).delete(t);return this.size-=e?1:0,e}var ga=Hf;function qf(t){return ge(this,t).get(t)}var ya=qf;function Kf(t){return ge(this,t).has(t)}var xa=Kf;function Yf(t,e){var r=ge(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}var _a=Yf;function at(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}at.prototype.clear=ma;at.prototype.delete=ga;at.prototype.get=ya;at.prototype.has=xa;at.prototype.set=_a;var Ne=at;var Jf="Expected a function";function rr(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Jf);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,a);return r.cache=o.set(n,s)||o,s};return r.cache=new(rr.Cache||Ne),r}rr.Cache=Ne;var va=rr;var Xf=500;function Qf(t){var e=va(t,function(a){return r.size===Xf&&r.clear(),a}),r=e.cache;return e}var ba=Qf;var eu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tu=/\\(\\)?/g,ru=ba(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(eu,function(r,a,n,o){e.push(n?o.replace(tu,"$1"):a||r)}),e}),wa=ru;function au(t){return t==null?"":Er(t)}var Ta=au;function nu(t,e){return E(t)?t:et(t,e)?[t]:wa(Ta(t))}var $t=nu;var ou=1/0;function su(t){if(typeof t=="string"||ae(t))return t;var e=t+"";return e=="0"&&1/t==-ou?"-0":e}var ye=su;function iu(t,e){e=$t(e,t);for(var r=0,a=e.length;t!=null&&r<a;)t=t[ye(e[r++])];return r&&r==a?t:void 0}var nt=iu;function fu(t,e,r){var a=t==null?void 0:nt(t,e);return a===void 0?r:a}var ka=fu;function uu(t,e){for(var r=-1,a=e.length,n=t.length;++r<a;)t[n+r]=e[r];return t}var Rt=uu;var Sa=D?D.isConcatSpreadable:void 0;function cu(t){return E(t)||Xe(t)||!!(Sa&&t&&t[Sa])}var Oa=cu;function Aa(t,e,r,a,n){var o=-1,s=t.length;for(r||(r=Oa),n||(n=[]);++o<s;){var i=t[o];e>0&&r(i)?e>1?Aa(i,e-1,r,a,n):Rt(n,i):a||(n[n.length]=i)}return n}var Ia=Aa;function du(){this.__data__=new me,this.size=0}var Ca=du;function lu(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Ea=lu;function pu(t){return this.__data__.get(t)}var $a=pu;function mu(t){return this.__data__.has(t)}var Ra=mu;var hu=200;function gu(t,e){var r=this.__data__;if(r instanceof me){var a=r.__data__;if(!he||a.length<hu-1)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ne(a)}return r.set(t,e),this.size=r.size,this}var Pa=gu;function ot(t){var e=this.__data__=new me(t);this.size=e.size}ot.prototype.clear=Ca;ot.prototype.delete=Ea;ot.prototype.get=$a;ot.prototype.has=Ra;ot.prototype.set=Pa;var st=ot;function yu(t,e){for(var r=-1,a=t==null?0:t.length,n=0,o=[];++r<a;){var s=t[r];e(s,r,t)&&(o[n++]=s)}return o}var Na=yu;function xu(){return[]}var ja=xu;var _u=Object.prototype,vu=_u.propertyIsEnumerable,Ma=Object.getOwnPropertySymbols,bu=Ma?function(t){return t==null?[]:(t=Object(t),Na(Ma(t),function(e){return vu.call(t,e)}))}:ja,Da=bu;function wu(t,e,r){var a=e(t);return E(t)?a:Rt(a,r(t))}var La=wu;function Tu(t){return La(t,Qe,Da)}var ar=Tu;var ku=G(P,"DataView"),Pt=ku;var Su=G(P,"Promise"),Nt=Su;var Ou=G(P,"Set"),jt=Ou;var Fa="[object Map]",Au="[object Object]",Ga="[object Promise]",Ua="[object Set]",Ba="[object WeakMap]",za="[object DataView]",Iu=ne(Pt),Cu=ne(he),Eu=ne(Nt),$u=ne(jt),Ru=ne(It),je=V;(Pt&&je(new Pt(new ArrayBuffer(1)))!=za||he&&je(new he)!=Fa||Nt&&je(Nt.resolve())!=Ga||jt&&je(new jt)!=Ua||It&&je(new It)!=Ba)&&(je=function(t){var e=V(t),r=e==Au?t.constructor:void 0,a=r?ne(r):"";if(a)switch(a){case Iu:return za;case Cu:return Fa;case Eu:return Ga;case $u:return Ua;case Ru:return Ba}return e});var nr=je;var Pu=P.Uint8Array,or=Pu;var Nu="__lodash_hash_undefined__";function ju(t){return this.__data__.set(t,Nu),this}var Za=ju;function Mu(t){return this.__data__.has(t)}var Va=Mu;function Mt(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Ne;++e<r;)this.add(t[e])}Mt.prototype.add=Mt.prototype.push=Za;Mt.prototype.has=Va;var Wa=Mt;function Du(t,e){for(var r=-1,a=t==null?0:t.length;++r<a;)if(e(t[r],r,t))return!0;return!1}var Ha=Du;function Lu(t,e){return t.has(e)}var qa=Lu;var Fu=1,Gu=2;function Uu(t,e,r,a,n,o){var s=r&Fu,i=t.length,f=e.length;if(i!=f&&!(s&&f>i))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var m=-1,g=!0,_=r&Gu?new Wa:void 0;for(o.set(t,e),o.set(e,t);++m<i;){var A=t[m],k=e[m];if(a)var S=s?a(k,A,m,e,t,o):a(A,k,m,t,e,o);if(S!==void 0){if(S)continue;g=!1;break}if(_){if(!Ha(e,function(R,X){if(!qa(_,X)&&(A===R||n(A,R,r,a,o)))return _.push(X)})){g=!1;break}}else if(!(A===k||n(A,k,r,a,o))){g=!1;break}}return o.delete(t),o.delete(e),g}var Dt=Uu;function Bu(t){var e=-1,r=Array(t.size);return t.forEach(function(a,n){r[++e]=[n,a]}),r}var Ka=Bu;function zu(t){var e=-1,r=Array(t.size);return t.forEach(function(a){r[++e]=a}),r}var Ya=zu;var Zu=1,Vu=2,Wu="[object Boolean]",Hu="[object Date]",qu="[object Error]",Ku="[object Map]",Yu="[object Number]",Ju="[object RegExp]",Xu="[object Set]",Qu="[object String]",ec="[object Symbol]",tc="[object ArrayBuffer]",rc="[object DataView]",Ja=D?D.prototype:void 0,sr=Ja?Ja.valueOf:void 0;function ac(t,e,r,a,n,o,s){switch(r){case rc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case tc:return!(t.byteLength!=e.byteLength||!o(new or(t),new or(e)));case Wu:case Hu:case Yu:return Ye(+t,+e);case qu:return t.name==e.name&&t.message==e.message;case Ju:case Qu:return t==e+"";case Ku:var i=Ka;case Xu:var f=a&Zu;if(i||(i=Ya),t.size!=e.size&&!f)return!1;var u=s.get(t);if(u)return u==e;a|=Vu,s.set(t,e);var d=Dt(i(t),i(e),a,n,o,s);return s.delete(t),d;case ec:if(sr)return sr.call(t)==sr.call(e)}return!1}var Xa=ac;var nc=1,oc=Object.prototype,sc=oc.hasOwnProperty;function ic(t,e,r,a,n,o){var s=r&nc,i=ar(t),f=i.length,u=ar(e),d=u.length;if(f!=d&&!s)return!1;for(var m=f;m--;){var g=i[m];if(!(s?g in e:sc.call(e,g)))return!1}var _=o.get(t),A=o.get(e);if(_&&A)return _==e&&A==t;var k=!0;o.set(t,e),o.set(e,t);for(var S=s;++m<f;){g=i[m];var R=t[g],X=e[g];if(a)var xt=s?a(X,R,g,e,t,o):a(R,X,g,t,e,o);if(!(xt===void 0?R===X||n(R,X,r,a,o):xt)){k=!1;break}S||(S=g=="constructor")}if(k&&!S){var Le=t.constructor,_t=e.constructor;Le!=_t&&"constructor"in t&&"constructor"in e&&!(typeof Le=="function"&&Le instanceof Le&&typeof _t=="function"&&_t instanceof _t)&&(k=!1)}return o.delete(t),o.delete(e),k}var Qa=ic;var fc=1,en="[object Arguments]",tn="[object Array]",Lt="[object Object]",uc=Object.prototype,rn=uc.hasOwnProperty;function cc(t,e,r,a,n,o){var s=E(t),i=E(e),f=s?tn:nr(t),u=i?tn:nr(e);f=f==en?Lt:f,u=u==en?Lt:u;var d=f==Lt,m=u==Lt,g=f==u;if(g&&ht(t)){if(!ht(e))return!1;s=!0,d=!1}if(g&&!d)return o||(o=new st),s||Et(t)?Dt(t,e,r,a,n,o):Xa(t,e,f,r,a,n,o);if(!(r&fc)){var _=d&&rn.call(t,"__wrapped__"),A=m&&rn.call(e,"__wrapped__");if(_||A){var k=_?t.value():t,S=A?e.value():e;return o||(o=new st),n(k,S,r,a,o)}}return g?(o||(o=new st),Qa(t,e,r,a,n,o)):!1}var an=cc;function nn(t,e,r,a,n){return t===e?!0:t==null||e==null||!W(t)&&!W(e)?t!==t&&e!==e:an(t,e,r,a,nn,n)}var Ft=nn;var dc=1,lc=2;function pc(t,e,r,a){var n=r.length,o=n,s=!a;if(t==null)return!o;for(t=Object(t);n--;){var i=r[n];if(s&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++n<o;){i=r[n];var f=i[0],u=t[f],d=i[1];if(s&&i[2]){if(u===void 0&&!(f in t))return!1}else{var m=new st;if(a)var g=a(u,d,f,t,e,m);if(!(g===void 0?Ft(d,u,dc|lc,a,m):g))return!1}}return!0}var on=pc;function mc(t){return t===t&&!ce(t)}var Gt=mc;function hc(t){for(var e=Qe(t),r=e.length;r--;){var a=e[r],n=t[a];e[r]=[a,n,Gt(n)]}return e}var sn=hc;function gc(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Ut=gc;function yc(t){var e=sn(t);return e.length==1&&e[0][2]?Ut(e[0][0],e[0][1]):function(r){return r===t||on(r,t,e)}}var fn=yc;function xc(t,e){return t!=null&&e in Object(t)}var un=xc;function _c(t,e,r){e=$t(e,t);for(var a=-1,n=e.length,o=!1;++a<n;){var s=ye(e[a]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++a!=n?o:(n=t==null?0:t.length,!!n&&Je(n)&&Ke(s,n)&&(E(t)||Xe(t)))}var cn=_c;function vc(t,e){return t!=null&&cn(t,e,un)}var dn=vc;var bc=1,wc=2;function Tc(t,e){return et(t)&&Gt(e)?Ut(ye(t),e):function(r){var a=ka(r,t);return a===void 0&&a===e?dn(r,t):Ft(e,a,bc|wc)}}var ln=Tc;function kc(t){return function(e){return e?.[t]}}var pn=kc;function Sc(t){return function(e){return nt(e,t)}}var mn=Sc;function Oc(t){return et(t)?pn(ye(t)):mn(t)}var hn=Oc;function Ac(t){return typeof t=="function"?t:t==null?de:typeof t=="object"?E(t)?ln(t[0],t[1]):fn(t):hn(t)}var Bt=Ac;function Ic(t,e,r,a){for(var n=-1,o=t==null?0:t.length;++n<o;){var s=t[n];e(a,s,r(s),t)}return a}var gn=Ic;function Cc(t){return function(e,r,a){for(var n=-1,o=Object(e),s=a(e),i=s.length;i--;){var f=s[t?i:++n];if(r(o[f],f,o)===!1)break}return e}}var yn=Cc;var Ec=yn(),xn=Ec;function $c(t,e){return t&&xn(t,e,Qe)}var _n=$c;function Rc(t,e){return function(r,a){if(r==null)return r;if(!le(r))return t(r,a);for(var n=r.length,o=e?n:-1,s=Object(r);(e?o--:++o<n)&&a(s[o],o,s)!==!1;);return r}}var vn=Rc;var Pc=vn(_n),zt=Pc;function Nc(t,e,r,a){return zt(t,function(n,o,s){e(a,n,r(n),s)}),a}var bn=Nc;function jc(t,e){return function(r,a){var n=E(r)?gn:bn,o=e?e():{};return n(r,t,Bt(a,2),o)}}var wn=jc;function Mc(t,e){var r=-1,a=le(t)?Array(t.length):[];return zt(t,function(n,o,s){a[++r]=e(n,o,s)}),a}var Tn=Mc;var Dc=Object.prototype,Lc=Dc.hasOwnProperty,Fc=wn(function(t,e,r){Lc.call(t,r)?t[r].push(e):Gr(t,r,[e])}),yt=Fc;function Gc(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var kn=Gc;function Uc(t,e){if(t!==e){var r=t!==void 0,a=t===null,n=t===t,o=ae(t),s=e!==void 0,i=e===null,f=e===e,u=ae(e);if(!i&&!u&&!o&&t>e||o&&s&&f&&!i&&!u||a&&s&&f||!r&&f||!n)return 1;if(!a&&!o&&!u&&t<e||u&&r&&n&&!a&&!o||i&&r&&n||!s&&n||!f)return-1}return 0}var Sn=Uc;function Bc(t,e,r){for(var a=-1,n=t.criteria,o=e.criteria,s=n.length,i=r.length;++a<s;){var f=Sn(n[a],o[a]);if(f){if(a>=i)return f;var u=r[a];return f*(u=="desc"?-1:1)}}return t.index-e.index}var On=Bc;function zc(t,e,r){e.length?e=He(e,function(o){return E(o)?function(s){return nt(s,o.length===1?o[0]:o)}:o}):e=[de];var a=-1;e=He(e,Ct(Bt));var n=Tn(t,function(o,s,i){var f=He(e,function(u){return u(o)});return{criteria:f,index:++a,value:o}});return kn(n,function(o,s){return On(o,s,r)})}var An=zc;var Zc=zr(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Jt(t,e[0],e[1])?e=[]:r>2&&Jt(e[0],e[1],e[2])&&(e=[e[0]]),An(t,Ia(e,1),[])}),ir=Zc;H();function O(t){return{content:[{type:"text",text:t}]}}function J(t,e){return!t||t.length<=e?t:t.slice(0,e)+"..."}var ut=200;function Wn(t){t.tool("search",`Search Sigil knowledge base for facts across all ingested documents.
|
|
3
|
+
var no=Object.defineProperty;var Fe=(t,e)=>()=>(t&&(e=t(t=0)),e);var dr=(t,e)=>{for(var r in e)no(t,r,{get:e[r],enumerable:!0})};import{fileURLToPath as Wc}from"node:url";import{dirname as In,join as I}from"node:path";import{existsSync as Cn}from"node:fs";import{homedir as Hc}from"node:os";function qc(){let t=In(Wc(import.meta.url));for(let e=0;e<10;e++){if(Cn(I(t,"package.json"))&&Cn(I(t,"prompts")))return t;let r=In(t);if(r===t)break;t=r}return process.cwd()}var Me,o_,s_,En,$,i_,f_,u_,c_,d_,l_,p_,m_,h_,De,Vt,Wt,g_,y_,x_,__,v_,b_,w_,$n,T_,k_,xt=Fe(()=>{Me=qc(),o_=I(Me,"prompts"),s_=I(Me,"src","db","migrations"),En=Hc(),$=I(En,".sigil"),i_=I($,".env"),f_=I($,"db"),u_=I($,"CLAUDE.md"),c_=I($,"schemas"),d_=I($,".hook-errors.log"),l_=I($,".last-clean-doctor"),p_=I($,".active-session.json"),m_=I($,".stop-cursor.json"),h_=I($,".hook-dedup.json"),De=I($,"sock"),Vt=I($,"sigild.pid"),Wt=I($,"sigild.log"),g_=I($,"heartbeat.json"),y_=I($,"onboarding-state.json"),x_=I($,"gui.token"),__=I(Me,"dist","gui"),v_=I(Me,"src","gui","web"),b_=I($,"iroh"),w_=I($,"identity.key"),$n=I(En,".claude"),T_=I($n,"settings.json"),k_=I($n,"CLAUDE.md")});import{readFile as Kc,writeFile as A_,unlink as Rn,mkdir as I_}from"node:fs/promises";import{existsSync as Pn}from"node:fs";function Yc(t){if(!t||!Number.isFinite(t))return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function Jc(){if(!Pn(Vt))return null;try{let t=(await Kc(Vt,"utf8")).trim(),e=Number(t);return Number.isFinite(e)?e:null}catch{return null}}async function Xc(){try{await Rn(Vt)}catch{}}async function Qc(){try{await Rn(De)}catch{}}async function Nn(){let t=await Jc();return t&&Yc(t)?t:(t&&await Xc(),Pn(De)&&await Qc(),null)}var jn=Fe(()=>{xt()});import{existsSync as ed}from"node:fs";import{dirname as td,join as fr}from"node:path";import{fileURLToPath as rd}from"node:url";function Mn(){let t=[fr(Me,"dist","daemon.js"),fr(Me,"src","daemon","index.js"),fr(td(rd(import.meta.url)),"..","daemon","index.js")];for(let e of t)if(ed(e))return e;throw new Error("cannot locate daemon entry point (looked in dist/ and src/daemon/)")}var Dn=Fe(()=>{xt()});import{connect as ad}from"node:net";import{randomUUID as nd}from"node:crypto";function Ht({path:t=De,timeoutMs:e=3e4}={}){return new Promise((r,a)=>{let n=ad(t),o=new Map,s="",i=!1;n.setEncoding("utf8"),n.once("connect",()=>{n.off("error",f),r(u())});function f(d){a(d)}n.once("error",f),n.on("data",d=>{s+=d;let m;for(;(m=s.indexOf(`
|
|
4
|
+
`))!==-1;){let g=s.slice(0,m);if(s=s.slice(m+1),!g.trim())continue;let _;try{_=JSON.parse(g)}catch{continue}let A=o.get(_.id);A&&(o.delete(_.id),clearTimeout(A.timer),_.ok?A.resolve(_):A.reject(new ur(_.error||{})))}}),n.on("close",()=>{i=!0;for(let[,d]of o)clearTimeout(d.timer),d.reject(new Error("daemon connection closed"));o.clear()}),n.on("error",()=>{});function u(){return{call(d,m){if(i)return Promise.reject(new Error("client is closed"));let g=nd(),_=process.env.SIGIL_AGENT||null,A=JSON.stringify({id:g,method:d,params:m,agent:_})+`
|
|
5
|
+
`;return new Promise((k,S)=>{let P=setTimeout(()=>{o.delete(g)&&S(new Error(`rpc timeout after ${e}ms: ${d}`))},e);o.set(g,{resolve:k,reject:S,timer:P}),n.write(A)})},close(){return new Promise(d=>{if(i)return d();n.end(()=>d())})}}}})}var ur,Ln=Fe(()=>{xt();ur=class extends Error{constructor({code:e,message:r,stack:a}){super(r||e||"rpc error"),this.name="SigilRpcError",this.code=e||"handler_error",a&&(this.remoteStack=a)}}});import{spawn as od}from"node:child_process";import{existsSync as sd,openSync as Fn,closeSync as Gn,mkdirSync as id}from"node:fs";import{setTimeout as fd}from"node:timers/promises";async function Bn({quiet:t=!1}={}){return await zn()?Ht():(t||process.stderr.write(`[sigil] daemon not running, starting it...
|
|
6
|
+
`),await dd(),await ld(),Ht())}async function zn(){if(!sd(De))return!1;try{let t=await Ht({timeoutMs:1e3});return await t.call("ping",{}),await t.close(),!0}catch{return!1}}async function dd(){id($,{recursive:!0}),await Nn();let t=Mn(),e=Fn(Wt,"a"),r=Fn(Wt,"a");od(process.execPath,[t],{detached:!0,stdio:["ignore",e,r],env:{...process.env,SIGIL_DAEMON_AUTOSPAWN:"1"}}).unref();try{Gn(e)}catch{}try{Gn(r)}catch{}}async function ld(){let t=Date.now()+Un,e=ud;for(;Date.now()<t;){if(await zn())return;await fd(e),e=Math.min(e*2,cd)}throw new Error(`daemon did not become ready within ${Un}ms \u2014 check ${Wt}`)}var Un,ud,cd,Zn=Fe(()=>{xt();jn();Dn();Ln();Un=5e3,ud=25,cd=400});var Wn={};dr(Wn,{closeDaemonConnection:()=>hd,daemonCall:()=>R});async function Vn(){return ut||(ft||(ft=Bn({quiet:!0}).then(t=>(ut=t,t)).catch(t=>{throw ft=null,t})),ft)}function md(t){return t?t.code&&pd.has(t.code)?!0:/^daemon connection closed/i.test(t.message||""):!1}async function R(t,e){let r=await Vn();try{let{data:a}=await r.call(t,e??{});return a}catch(a){if(md(a)){ut=null,ft=null;let n=await Vn(),{data:o}=await n.call(t,e??{});return o}throw a}}async function hd(){let t=ut;ut=null,ft=null,t&&await t.close()}var ft,ut,pd,H=Fe(()=>{Zn();ft=null,ut=null;pd=new Set(["ECONNREFUSED","ENOENT","EPIPE","ECONNRESET"])});import{config as vd}from"dotenv";import{resolve as cr,dirname as ao}from"node:path";import{fileURLToPath as bd}from"node:url";import{existsSync as wd}from"node:fs";import"dotenv/config";import{McpServer as yd}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as xd}from"@modelcontextprotocol/sdk/server/stdio.js";var y={};dr(y,{BRAND:()=>$o,DIRTY:()=>xe,EMPTY_PATH:()=>fo,INVALID:()=>x,NEVER:()=>hs,OK:()=>M,ParseStatus:()=>j,Schema:()=>w,ZodAny:()=>fe,ZodArray:()=>re,ZodBigInt:()=>ve,ZodBoolean:()=>be,ZodBranded:()=>lt,ZodCatch:()=>Re,ZodDate:()=>we,ZodDefault:()=>$e,ZodDiscriminatedUnion:()=>Tt,ZodEffects:()=>z,ZodEnum:()=>Ce,ZodError:()=>L,ZodFirstPartyTypeKind:()=>v,ZodFunction:()=>St,ZodIntersection:()=>Oe,ZodIssueCode:()=>c,ZodLazy:()=>Ae,ZodLiteral:()=>Ie,ZodMap:()=>Ve,ZodNaN:()=>He,ZodNativeEnum:()=>Ee,ZodNever:()=>Z,ZodNull:()=>ke,ZodNullable:()=>Y,ZodNumber:()=>_e,ZodObject:()=>F,ZodOptional:()=>U,ZodParsedType:()=>p,ZodPipeline:()=>pt,ZodPromise:()=>ue,ZodReadonly:()=>Pe,ZodRecord:()=>kt,ZodSchema:()=>w,ZodSet:()=>We,ZodString:()=>ie,ZodSymbol:()=>ze,ZodTransformer:()=>z,ZodTuple:()=>K,ZodType:()=>w,ZodUndefined:()=>Te,ZodUnion:()=>Se,ZodUnknown:()=>te,ZodVoid:()=>Ze,addIssueToContext:()=>l,any:()=>Go,array:()=>Zo,bigint:()=>jo,boolean:()=>wr,coerce:()=>ms,custom:()=>_r,date:()=>Mo,datetimeRegex:()=>yr,defaultErrorMap:()=>Q,discriminatedUnion:()=>qo,effect:()=>ss,enum:()=>as,function:()=>es,getErrorMap:()=>Ge,getParsedType:()=>q,instanceof:()=>Po,intersection:()=>Ko,isAborted:()=>bt,isAsync:()=>Ue,isDirty:()=>wt,isValid:()=>se,late:()=>Ro,lazy:()=>ts,literal:()=>rs,makeIssue:()=>dt,map:()=>Xo,nan:()=>No,nativeEnum:()=>ns,never:()=>Bo,null:()=>Fo,nullable:()=>fs,number:()=>br,object:()=>Vo,objectUtil:()=>qt,oboolean:()=>ps,onumber:()=>ls,optional:()=>is,ostring:()=>ds,pipeline:()=>cs,preprocess:()=>us,promise:()=>os,quotelessJson:()=>oo,record:()=>Jo,set:()=>Qo,setErrorMap:()=>io,strictObject:()=>Wo,string:()=>vr,symbol:()=>Do,transformer:()=>ss,tuple:()=>Yo,undefined:()=>Lo,union:()=>Ho,unknown:()=>Uo,util:()=>T,void:()=>zo});var T;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),s={};for(let i of o)s[i]=n[i];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=a,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(T||(T={}));var qt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(qt||(qt={}));var p=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),q=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var c=T.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"]),oo=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),L=class t 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(o){return o.message},a={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)a._errors.push(r(s));else{let i=a,f=0;for(;f<s.path.length;){let u=s.path[f];f===s.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(r(s))):i[u]=i[u]||{_errors:[]},i=i[u],f++}}};return n(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},a=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};L.create=t=>new L(t);var so=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,T.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${T.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${T.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${T.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:T.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,T.assertNever(t)}return{message:r}},Q=so;var lr=Q;function io(t){lr=t}function Ge(){return lr}var dt=t=>{let{data:e,path:r,errorMaps:a,issueData:n}=t,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let i="",f=a.filter(u=>!!u).slice().reverse();for(let u of f)i=u(s,{data:e,defaultError:i}).message;return{...n,path:o,message:i}},fo=[];function l(t,e){let r=Ge(),a=dt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Q?void 0:Q].filter(n=>!!n)});t.common.issues.push(a)}var j=class t{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 n of r){if(n.status==="aborted")return x;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let n of r){let o=await n.key,s=await n.value;a.push({key:o,value:s})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return x;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(a[o.value]=s.value)}return{status:e.value,value:a}}},x=Object.freeze({status:"aborted"}),xe=t=>({status:"dirty",value:t}),M=t=>({status:"valid",value:t}),bt=t=>t.status==="aborted",wt=t=>t.status==="dirty",se=t=>t.status==="valid",Ue=t=>typeof Promise<"u"&&t instanceof Promise;var h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var B=class{constructor(e,r,a,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},pr=(t,e)=>{if(se(e))return{success:!0,data:e.value};if(!t.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 L(t.common.issues);return this._error=r,this._error}}};function b(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:n}=t;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:n}:{errorMap:(s,i)=>{let{message:f}=t;return s.code==="invalid_enum_value"?{message:f??i.defaultError}:typeof i.data>"u"?{message:f??a??i.defaultError}:s.code!=="invalid_type"?{message:i.defaultError}:{message:f??r??i.defaultError}},description:n}}var w=class{get description(){return this._def.description}_getType(e){return q(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ue(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:q(e)},n=this._parseSync({data:e,path:a.path,parent:a});return pr(a,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:q(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:r});return se(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=>se(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:q(e)},n=this._parse({data:e,path:a.path,parent:a}),o=await(Ue(n)?n:Promise.resolve(n));return pr(a,o)}refine(e,r){let a=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=e(n),i=()=>o.addIssue({code:c.custom,...a(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(f=>f?!0:(i(),!1)):s?!0:(i(),!1)})}refinement(e,r){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof r=="function"?r(a,n):r),!1))}_refinement(e){return new z({schema:this,typeName:v.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 U.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return ue.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return Oe.create(this,e,this._def)}transform(e){return new z({...b(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new $e({...b(this._def),innerType:this,defaultValue:r,typeName:v.ZodDefault})}brand(){return new lt({typeName:v.ZodBranded,type:this,...b(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Re({...b(this._def),innerType:this,catchValue:r,typeName:v.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return pt.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},uo=/^c[^\s-]{8,}$/i,co=/^[0-9a-z]+$/,lo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,po=/^[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,mo=/^[a-z0-9_-]{21}$/i,ho=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,go=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Kt,_o=/^(?:(?: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])$/,vo=/^(?:(?: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])$/,bo=/^(([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]))$/,wo=/^(([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])$/,To=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ko=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hr="((\\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])))",So=new RegExp(`^${hr}$`);function gr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Oo(t){return new RegExp(`^${gr(t)}$`)}function yr(t){let e=`${hr}T${gr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Ao(t,e){return!!((e==="v4"||!e)&&_o.test(t)||(e==="v6"||!e)&&bo.test(t))}function Io(t,e){if(!ho.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Co(t,e){return!!((e==="v4"||!e)&&vo.test(t)||(e==="v6"||!e)&&wo.test(t))}var ie=class t extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_type,expected:p.string,received:o.parsedType}),x}let a=new j,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),a.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),a.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;(s||i)&&(n=this._getOrReturnCtx(e,n),s?l(n,{code:c.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&l(n,{code:c.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),a.dirty())}else if(o.kind==="email")yo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="emoji")Kt||(Kt=new RegExp(xo,"u")),Kt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="uuid")po.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="nanoid")mo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="cuid")uo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="cuid2")co.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="ulid")lo.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:o.message}),a.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:o.message}),a.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:o.message}),a.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),a.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:o.value},message:o.message}),a.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:o.value},message:o.message}),a.dirty()):o.kind==="datetime"?yr(o).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:o.message}),a.dirty()):o.kind==="date"?So.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:o.message}),a.dirty()):o.kind==="time"?Oo(o).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:o.message}),a.dirty()):o.kind==="duration"?go.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="ip"?Ao(e.data,o.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="jwt"?Io(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="cidr"?Co(e.data,o.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="base64"?To.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:o.message}),a.dirty()):o.kind==="base64url"?ko.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:o.message}),a.dirty()):T.assertNever(o);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(n=>e.test(n),{validation:r,code:c.invalid_string,...h.errToObj(a)})}_addCheck(e){return new t({...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 t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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.value<e)&&(e=r.value);return e}};ie.create=t=>new ie({checks:[],typeName:v.ZodString,coerce:t?.coerce??!1,...b(t)});function Eo(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=r>a?r:a,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}var _e=class t 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)!==p.number){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_type,expected:p.number,received:o.parsedType}),x}let a,n=new j;for(let o of this._def.checks)o.kind==="int"?T.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Eo(e.data,o.value)!==0&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.not_finite,message:o.message}),n.dirty()):T.assertNever(o);return{status:n.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,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:h.toString(n)}]})}_addCheck(e){return new t({...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.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&T.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.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};_e.create=t=>new _e({checks:[],typeName:v.ZodNumber,coerce:t?.coerce||!1,...b(t)});var ve=class t 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)!==p.bigint)return this._getInvalidInput(e);let a,n=new j;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):T.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.bigint,received:r.parsedType}),x}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,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:h.toString(n)}]})}_addCheck(e){return new t({...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.value<e)&&(e=r.value);return e}};ve.create=t=>new ve({checks:[],typeName:v.ZodBigInt,coerce:t?.coerce??!1,...b(t)});var be=class extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.boolean,received:a.parsedType}),x}return M(e.data)}};be.create=t=>new be({typeName:v.ZodBoolean,coerce:t?.coerce||!1,...b(t)});var we=class t extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_type,expected:p.date,received:o.parsedType}),x}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return l(o,{code:c.invalid_date}),x}let a=new j,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),a.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),a.dirty()):T.assertNever(o);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...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.value<e)&&(e=r.value);return e!=null?new Date(e):null}};we.create=t=>new we({checks:[],coerce:t?.coerce||!1,typeName:v.ZodDate,...b(t)});var ze=class extends w{_parse(e){if(this._getType(e)!==p.symbol){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.symbol,received:a.parsedType}),x}return M(e.data)}};ze.create=t=>new ze({typeName:v.ZodSymbol,...b(t)});var Te=class extends w{_parse(e){if(this._getType(e)!==p.undefined){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.undefined,received:a.parsedType}),x}return M(e.data)}};Te.create=t=>new Te({typeName:v.ZodUndefined,...b(t)});var ke=class extends w{_parse(e){if(this._getType(e)!==p.null){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.null,received:a.parsedType}),x}return M(e.data)}};ke.create=t=>new ke({typeName:v.ZodNull,...b(t)});var fe=class extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return M(e.data)}};fe.create=t=>new fe({typeName:v.ZodAny,...b(t)});var te=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return M(e.data)}};te.create=t=>new te({typeName:v.ZodUnknown,...b(t)});var Z=class extends w{_parse(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.never,received:r.parsedType}),x}};Z.create=t=>new Z({typeName:v.ZodNever,...b(t)});var Ze=class extends w{_parse(e){if(this._getType(e)!==p.undefined){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.void,received:a.parsedType}),x}return M(e.data)}};Ze.create=t=>new Ze({typeName:v.ZodVoid,...b(t)});var re=class t extends w{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),n=this._def;if(r.parsedType!==p.array)return l(r,{code:c.invalid_type,expected:p.array,received:r.parsedType}),x;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,i=r.data.length<n.exactLength.value;(s||i)&&(l(r,{code:s?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(l(r,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(l(r,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((s,i)=>n.type._parseAsync(new B(r,s,r.path,i)))).then(s=>j.mergeArray(a,s));let o=[...r.data].map((s,i)=>n.type._parseSync(new B(r,s,r.path,i)));return j.mergeArray(a,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:h.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:h.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:h.toString(r)}})}nonempty(e){return this.min(1,e)}};re.create=(t,e)=>new re({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...b(e)});function Be(t){if(t instanceof F){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=U.create(Be(a))}return new F({...t._def,shape:()=>e})}else return t instanceof re?new re({...t._def,type:Be(t.element)}):t instanceof U?U.create(Be(t.unwrap())):t instanceof Y?Y.create(Be(t.unwrap())):t instanceof K?K.create(t.items.map(e=>Be(e))):t}var F=class t 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(),r=T.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==p.object){let u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:p.object,received:u.parsedType}),x}let{status:a,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Z&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||i.push(u);let f=[];for(let u of s){let d=o[u],m=n.data[u];f.push({key:{status:"valid",value:u},value:d._parse(new B(n,m,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Z){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of i)f.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")i.length>0&&(l(n,{code:c.unrecognized_keys,keys:i}),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 i){let m=n.data[d];f.push({key:{status:"valid",value:d},value:u._parse(new B(n,m,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of f){let m=await d.key,g=await d.value;u.push({key:m,value:g,alwaysSet:d.alwaysSet})}return u}).then(u=>j.mergeObjectSync(a,u)):j.mergeObjectSync(a,f)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{let n=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let a of T.objectKeys(e))e[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let a of T.objectKeys(this.shape))e[a]||(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}deepPartial(){return Be(this)}partial(e){let r={};for(let a of T.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?r[a]=n:r[a]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let a of T.objectKeys(this.shape))if(e&&!e[a])r[a]=this.shape[a];else{let o=this.shape[a];for(;o instanceof U;)o=o._def.innerType;r[a]=o}return new t({...this._def,shape:()=>r})}keyof(){return xr(T.objectKeys(this.shape))}};F.create=(t,e)=>new F({shape:()=>t,unknownKeys:"strip",catchall:Z.create(),typeName:v.ZodObject,...b(e)});F.strictCreate=(t,e)=>new F({shape:()=>t,unknownKeys:"strict",catchall:Z.create(),typeName:v.ZodObject,...b(e)});F.lazycreate=(t,e)=>new F({shape:t,unknownKeys:"strip",catchall:Z.create(),typeName:v.ZodObject,...b(e)});var Se=class extends w{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(i=>new L(i.ctx.common.issues));return l(r,{code:c.invalid_union,unionErrors:s}),x}if(r.common.async)return Promise.all(a.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let f of a){let u={...r,common:{...r.common,issues:[]},parent:null},d=f._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(f=>new L(f));return l(r,{code:c.invalid_union,unionErrors:i}),x}}get options(){return this._def.options}};Se.create=(t,e)=>new Se({options:t,typeName:v.ZodUnion,...b(e)});var ee=t=>t instanceof Ae?ee(t.schema):t instanceof z?ee(t.innerType()):t instanceof Ie?[t.value]:t instanceof Ce?t.options:t instanceof Ee?T.objectValues(t.enum):t instanceof $e?ee(t._def.innerType):t instanceof Te?[void 0]:t instanceof ke?[null]:t instanceof U?[void 0,...ee(t.unwrap())]:t instanceof Y?[null,...ee(t.unwrap())]:t instanceof lt||t instanceof Pe?ee(t.unwrap()):t instanceof Re?ee(t._def.innerType):[],Tt=class t extends w{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return l(r,{code:c.invalid_type,expected:p.object,received:r.parsedType}),x;let a=this.discriminator,n=r.data[a],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(l(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let n=new Map;for(let o of r){let s=ee(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o)}}return new t({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...b(a)})}};function Yt(t,e){let r=q(t),a=q(e);if(t===e)return{valid:!0,data:t};if(r===p.object&&a===p.object){let n=T.objectKeys(e),o=T.objectKeys(t).filter(i=>n.indexOf(i)!==-1),s={...t,...e};for(let i of o){let f=Yt(t[i],e[i]);if(!f.valid)return{valid:!1};s[i]=f.data}return{valid:!0,data:s}}else if(r===p.array&&a===p.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],i=e[o],f=Yt(s,i);if(!f.valid)return{valid:!1};n.push(f.data)}return{valid:!0,data:n}}else return r===p.date&&a===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Oe=class extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e),n=(o,s)=>{if(bt(o)||bt(s))return x;let i=Yt(o.value,s.value);return i.valid?((wt(o)||wt(s))&&r.dirty(),{status:r.value,value:i.data}):(l(a,{code:c.invalid_intersection_types}),x)};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(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Oe.create=(t,e,r)=>new Oe({left:t,right:e,typeName:v.ZodIntersection,...b(r)});var K=class t extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==p.array)return l(a,{code:c.invalid_type,expected:p.array,received:a.parsedType}),x;if(a.data.length<this._def.items.length)return l(a,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&a.data.length>this._def.items.length&&(l(a,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...a.data].map((s,i)=>{let f=this._def.items[i]||this._def.rest;return f?f._parse(new B(a,s,a.path,i)):null}).filter(s=>!!s);return a.common.async?Promise.all(o).then(s=>j.mergeArray(r,s)):j.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};K.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new K({items:t,typeName:v.ZodTuple,rest:null,...b(e)})};var kt=class t extends w{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!==p.object)return l(a,{code:c.invalid_type,expected:p.object,received:a.parsedType}),x;let n=[],o=this._def.keyType,s=this._def.valueType;for(let i in a.data)n.push({key:o._parse(new B(a,i,a.path,i)),value:s._parse(new B(a,a.data[i],a.path,i)),alwaysSet:i in a.data});return a.common.async?j.mergeObjectAsync(r,n):j.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof w?new t({keyType:e,valueType:r,typeName:v.ZodRecord,...b(a)}):new t({keyType:ie.create(),valueType:e,typeName:v.ZodRecord,...b(r)})}},Ve=class extends w{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!==p.map)return l(a,{code:c.invalid_type,expected:p.map,received:a.parsedType}),x;let n=this._def.keyType,o=this._def.valueType,s=[...a.data.entries()].map(([i,f],u)=>({key:n._parse(new B(a,i,a.path,[u,"key"])),value:o._parse(new B(a,f,a.path,[u,"value"]))}));if(a.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let f of s){let u=await f.key,d=await f.value;if(u.status==="aborted"||d.status==="aborted")return x;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let f of s){let u=f.key,d=f.value;if(u.status==="aborted"||d.status==="aborted")return x;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}}}};Ve.create=(t,e,r)=>new Ve({valueType:e,keyType:t,typeName:v.ZodMap,...b(r)});var We=class t extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==p.set)return l(a,{code:c.invalid_type,expected:p.set,received:a.parsedType}),x;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(l(a,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(l(a,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(f){let u=new Set;for(let d of f){if(d.status==="aborted")return x;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let i=[...a.data.values()].map((f,u)=>o._parse(new B(a,f,a.path,u)));return a.common.async?Promise.all(i).then(f=>s(f)):s(i)}min(e,r){return new t({...this._def,minSize:{value:e,message:h.toString(r)}})}max(e,r){return new t({...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)}};We.create=(t,e)=>new We({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...b(e)});var St=class t extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.function)return l(r,{code:c.invalid_type,expected:p.function,received:r.parsedType}),x;function a(i,f){return dt({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ge(),Q].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:f}})}function n(i,f){return dt({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ge(),Q].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:f}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ue){let i=this;return M(async function(...f){let u=new L([]),d=await i._def.args.parseAsync(f,o).catch(_=>{throw u.addIssue(a(f,_)),u}),m=await Reflect.apply(s,this,d);return await i._def.returns._def.type.parseAsync(m,o).catch(_=>{throw u.addIssue(n(m,_)),u})})}else{let i=this;return M(function(...f){let u=i._def.args.safeParse(f,o);if(!u.success)throw new L([a(f,u.error)]);let d=Reflect.apply(s,this,u.data),m=i._def.returns.safeParse(d,o);if(!m.success)throw new L([n(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:K.create(e).rest(te.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||K.create([]).rest(te.create()),returns:r||te.create(),typeName:v.ZodFunction,...b(a)})}},Ae=class extends w{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})}};Ae.create=(t,e)=>new Ae({getter:t,typeName:v.ZodLazy,...b(e)});var Ie=class extends w{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return l(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ie.create=(t,e)=>new Ie({value:t,typeName:v.ZodLiteral,...b(e)});function xr(t,e){return new Ce({values:t,typeName:v.ZodEnum,...b(e)})}var Ce=class t extends w{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return l(r,{expected:T.joinValues(a),received:r.parsedType,code:c.invalid_type}),x}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 l(r,{received:r.data,code:c.invalid_enum_value,options:a}),x}return M(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 t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Ce.create=xr;var Ee=class extends w{_parse(e){let r=T.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==p.string&&a.parsedType!==p.number){let n=T.objectValues(r);return l(a,{expected:T.joinValues(n),received:a.parsedType,code:c.invalid_type}),x}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=T.objectValues(r);return l(a,{received:a.data,code:c.invalid_enum_value,options:n}),x}return M(e.data)}get enum(){return this._def.values}};Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...b(e)});var ue=class extends w{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.promise&&r.common.async===!1)return l(r,{code:c.invalid_type,expected:p.promise,received:r.parsedType}),x;let a=r.parsedType===p.promise?r.data:Promise.resolve(r.data);return M(a.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...b(e)});var z=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:s=>{l(a,s),s.fatal?r.abort():r.dirty()},get path(){return a.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(a.data,o);if(a.common.async)return Promise.resolve(s).then(async i=>{if(r.value==="aborted")return x;let f=await this._def.schema._parseAsync({data:i,path:a.path,parent:a});return f.status==="aborted"?x:f.status==="dirty"?xe(f.value):r.value==="dirty"?xe(f.value):f});{if(r.value==="aborted")return x;let i=this._def.schema._parseSync({data:s,path:a.path,parent:a});return i.status==="aborted"?x:i.status==="dirty"?xe(i.value):r.value==="dirty"?xe(i.value):i}}if(n.type==="refinement"){let s=i=>{let f=n.refinement(i,o);if(a.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?x:(i.status==="dirty"&&r.dirty(),s(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>i.status==="aborted"?x:(i.status==="dirty"&&r.dirty(),s(i.value).then(()=>({status:r.value,value:i.value}))))}if(n.type==="transform")if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!se(s))return x;let i=n.transform(s.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>se(s)?Promise.resolve(n.transform(s.value,o)).then(i=>({status:r.value,value:i})):x);T.assertNever(n)}};z.create=(t,e,r)=>new z({schema:t,typeName:v.ZodEffects,effect:e,...b(r)});z.createWithPreprocess=(t,e,r)=>new z({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...b(r)});var U=class extends w{_parse(e){return this._getType(e)===p.undefined?M(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};U.create=(t,e)=>new U({innerType:t,typeName:v.ZodOptional,...b(e)});var Y=class extends w{_parse(e){return this._getType(e)===p.null?M(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Y.create=(t,e)=>new Y({innerType:t,typeName:v.ZodNullable,...b(e)});var $e=class extends w{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===p.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};$e.create=(t,e)=>new $e({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var Re=class extends w{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Ue(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new L(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new L(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Re.create=(t,e)=>new Re({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var He=class extends w{_parse(e){if(this._getType(e)!==p.nan){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.nan,received:a.parsedType}),x}return{status:"valid",value:e.data}}};He.create=t=>new He({typeName:v.ZodNaN,...b(t)});var $o=Symbol("zod_brand"),lt=class extends w{_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}},pt=class t extends w{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?x:o.status==="dirty"?(r.dirty(),xe(o.value)):this._def.out._parseAsync({data:o.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?x:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:v.ZodPipeline})}},Pe=class extends w{_parse(e){let r=this._def.innerType._parse(e),a=n=>(se(n)&&(n.value=Object.freeze(n.value)),n);return Ue(r)?r.then(n=>a(n)):a(r)}unwrap(){return this._def.innerType}};Pe.create=(t,e)=>new Pe({innerType:t,typeName:v.ZodReadonly,...b(e)});function mr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function _r(t,e={},r){return t?fe.create().superRefine((a,n)=>{let o=t(a);if(o instanceof Promise)return o.then(s=>{if(!s){let i=mr(e,a),f=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:f})}});if(!o){let s=mr(e,a),i=s.fatal??r??!0;n.addIssue({code:"custom",...s,fatal:i})}}):fe.create()}var Ro={object:F.lazycreate},v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(v||(v={}));var Po=(t,e={message:`Input not instance of ${t.name}`})=>_r(r=>r instanceof t,e),vr=ie.create,br=_e.create,No=He.create,jo=ve.create,wr=be.create,Mo=we.create,Do=ze.create,Lo=Te.create,Fo=ke.create,Go=fe.create,Uo=te.create,Bo=Z.create,zo=Ze.create,Zo=re.create,Vo=F.create,Wo=F.strictCreate,Ho=Se.create,qo=Tt.create,Ko=Oe.create,Yo=K.create,Jo=kt.create,Xo=Ve.create,Qo=We.create,es=St.create,ts=Ae.create,rs=Ie.create,as=Ce.create,ns=Ee.create,os=ue.create,ss=z.create,is=U.create,fs=Y.create,us=z.createWithPreprocess,cs=pt.create,ds=()=>vr().optional(),ls=()=>br().optional(),ps=()=>wr().optional(),ms={string:(t=>ie.create({...t,coerce:!0})),number:(t=>_e.create({...t,coerce:!0})),boolean:(t=>be.create({...t,coerce:!0})),bigint:(t=>ve.create({...t,coerce:!0})),date:(t=>we.create({...t,coerce:!0}))};var hs=x;var gs=typeof global=="object"&&global&&global.Object===Object&&global,Ot=gs;var ys=typeof self=="object"&&self&&self.Object===Object&&self,xs=Ot||ys||Function("return this")(),N=xs;var _s=N.Symbol,D=_s;var Tr=Object.prototype,vs=Tr.hasOwnProperty,bs=Tr.toString,mt=D?D.toStringTag:void 0;function ws(t){var e=vs.call(t,mt),r=t[mt];try{t[mt]=void 0;var a=!0}catch{}var n=bs.call(t);return a&&(e?t[mt]=r:delete t[mt]),n}var kr=ws;var Ts=Object.prototype,ks=Ts.toString;function Ss(t){return ks.call(t)}var Sr=Ss;var Os="[object Null]",As="[object Undefined]",Or=D?D.toStringTag:void 0;function Is(t){return t==null?t===void 0?As:Os:Or&&Or in Object(t)?kr(t):Sr(t)}var V=Is;function Cs(t){return t!=null&&typeof t=="object"}var W=Cs;var Es="[object Symbol]";function $s(t){return typeof t=="symbol"||W(t)&&V(t)==Es}var ae=$s;function Rs(t,e){for(var r=-1,a=t==null?0:t.length,n=Array(a);++r<a;)n[r]=e(t[r],r,t);return n}var qe=Rs;var Ps=Array.isArray,E=Ps;var Ns=1/0,Ar=D?D.prototype:void 0,Ir=Ar?Ar.toString:void 0;function Cr(t){if(typeof t=="string")return t;if(E(t))return qe(t,Cr)+"";if(ae(t))return Ir?Ir.call(t):"";var e=t+"";return e=="0"&&1/t==-Ns?"-0":e}var Er=Cr;function js(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ce=js;function Ms(t){return t}var de=Ms;var Ds="[object AsyncFunction]",Ls="[object Function]",Fs="[object GeneratorFunction]",Gs="[object Proxy]";function Us(t){if(!ce(t))return!1;var e=V(t);return e==Ls||e==Fs||e==Ds||e==Gs}var At=Us;var Bs=N["__core-js_shared__"],It=Bs;var $r=(function(){var t=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function zs(t){return!!$r&&$r in t}var Rr=zs;var Zs=Function.prototype,Vs=Zs.toString;function Ws(t){if(t!=null){try{return Vs.call(t)}catch{}try{return t+""}catch{}}return""}var ne=Ws;var Hs=/[\\^$.*+?()[\]{}|]/g,qs=/^\[object .+?Constructor\]$/,Ks=Function.prototype,Ys=Object.prototype,Js=Ks.toString,Xs=Ys.hasOwnProperty,Qs=RegExp("^"+Js.call(Xs).replace(Hs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ei(t){if(!ce(t)||Rr(t))return!1;var e=At(t)?Qs:qs;return e.test(ne(t))}var Pr=ei;function ti(t,e){return t?.[e]}var Nr=ti;function ri(t,e){var r=Nr(t,e);return Pr(r)?r:void 0}var G=ri;var ai=G(N,"WeakMap"),Ct=ai;function ni(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var jr=ni;var oi=800,si=16,ii=Date.now;function fi(t){var e=0,r=0;return function(){var a=ii(),n=si-(a-r);if(r=a,n>0){if(++e>=oi)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Mr=fi;function ui(t){return function(){return t}}var Dr=ui;var ci=(function(){try{var t=G(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Ke=ci;var di=Ke?function(t,e){return Ke(t,"toString",{configurable:!0,enumerable:!1,value:Dr(e),writable:!0})}:de,Lr=di;var li=Mr(Lr),Fr=li;var pi=9007199254740991,mi=/^(?:0|[1-9]\d*)$/;function hi(t,e){var r=typeof t;return e=e??pi,!!e&&(r=="number"||r!="symbol"&&mi.test(t))&&t>-1&&t%1==0&&t<e}var Ye=hi;function gi(t,e,r){e=="__proto__"&&Ke?Ke(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Gr=gi;function yi(t,e){return t===e||t!==t&&e!==e}var Je=yi;var Ur=Math.max;function xi(t,e,r){return e=Ur(e===void 0?t.length-1:e,0),function(){for(var a=arguments,n=-1,o=Ur(a.length-e,0),s=Array(o);++n<o;)s[n]=a[e+n];n=-1;for(var i=Array(e+1);++n<e;)i[n]=a[n];return i[e]=r(s),jr(t,this,i)}}var Br=xi;function _i(t,e){return Fr(Br(t,e,de),t+"")}var zr=_i;var vi=9007199254740991;function bi(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=vi}var Xe=bi;function wi(t){return t!=null&&Xe(t.length)&&!At(t)}var le=wi;function Ti(t,e,r){if(!ce(r))return!1;var a=typeof e;return(a=="number"?le(r)&&Ye(e,r.length):a=="string"&&e in r)?Je(r[e],t):!1}var Jt=Ti;var ki=Object.prototype;function Si(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||ki;return t===r}var Zr=Si;function Oi(t,e){for(var r=-1,a=Array(t);++r<t;)a[r]=e(r);return a}var Vr=Oi;var Ai="[object Arguments]";function Ii(t){return W(t)&&V(t)==Ai}var Xt=Ii;var Wr=Object.prototype,Ci=Wr.hasOwnProperty,Ei=Wr.propertyIsEnumerable,$i=Xt((function(){return arguments})())?Xt:function(t){return W(t)&&Ci.call(t,"callee")&&!Ei.call(t,"callee")},Qe=$i;function Ri(){return!1}var Hr=Ri;var Yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qr=Yr&&typeof module=="object"&&module&&!module.nodeType&&module,Pi=qr&&qr.exports===Yr,Kr=Pi?N.Buffer:void 0,Ni=Kr?Kr.isBuffer:void 0,ji=Ni||Hr,ht=ji;var Mi="[object Arguments]",Di="[object Array]",Li="[object Boolean]",Fi="[object Date]",Gi="[object Error]",Ui="[object Function]",Bi="[object Map]",zi="[object Number]",Zi="[object Object]",Vi="[object RegExp]",Wi="[object Set]",Hi="[object String]",qi="[object WeakMap]",Ki="[object ArrayBuffer]",Yi="[object DataView]",Ji="[object Float32Array]",Xi="[object Float64Array]",Qi="[object Int8Array]",ef="[object Int16Array]",tf="[object Int32Array]",rf="[object Uint8Array]",af="[object Uint8ClampedArray]",nf="[object Uint16Array]",of="[object Uint32Array]",C={};C[Ji]=C[Xi]=C[Qi]=C[ef]=C[tf]=C[rf]=C[af]=C[nf]=C[of]=!0;C[Mi]=C[Di]=C[Ki]=C[Li]=C[Yi]=C[Fi]=C[Gi]=C[Ui]=C[Bi]=C[zi]=C[Zi]=C[Vi]=C[Wi]=C[Hi]=C[qi]=!1;function sf(t){return W(t)&&Xe(t.length)&&!!C[V(t)]}var Jr=sf;function ff(t){return function(e){return t(e)}}var Et=ff;var Xr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gt=Xr&&typeof module=="object"&&module&&!module.nodeType&&module,uf=gt&>.exports===Xr,Qt=uf&&Ot.process,cf=(function(){try{var t=gt&>.require&>.require("util").types;return t||Qt&&Qt.binding&&Qt.binding("util")}catch{}})(),er=cf;var Qr=er&&er.isTypedArray,df=Qr?Et(Qr):Jr,$t=df;var lf=Object.prototype,pf=lf.hasOwnProperty;function mf(t,e){var r=E(t),a=!r&&Qe(t),n=!r&&!a&&ht(t),o=!r&&!a&&!n&&$t(t),s=r||a||n||o,i=s?Vr(t.length,String):[],f=i.length;for(var u in t)(e||pf.call(t,u))&&!(s&&(u=="length"||n&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Ye(u,f)))&&i.push(u);return i}var ea=mf;function hf(t,e){return function(r){return t(e(r))}}var ta=hf;var gf=ta(Object.keys,Object),ra=gf;var yf=Object.prototype,xf=yf.hasOwnProperty;function _f(t){if(!Zr(t))return ra(t);var e=[];for(var r in Object(t))xf.call(t,r)&&r!="constructor"&&e.push(r);return e}var aa=_f;function vf(t){return le(t)?ea(t):aa(t)}var et=vf;var bf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wf=/^\w*$/;function Tf(t,e){if(E(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||ae(t)?!0:wf.test(t)||!bf.test(t)||e!=null&&t in Object(e)}var tt=Tf;var kf=G(Object,"create"),oe=kf;function Sf(){this.__data__=oe?oe(null):{},this.size=0}var na=Sf;function Of(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var oa=Of;var Af="__lodash_hash_undefined__",If=Object.prototype,Cf=If.hasOwnProperty;function Ef(t){var e=this.__data__;if(oe){var r=e[t];return r===Af?void 0:r}return Cf.call(e,t)?e[t]:void 0}var sa=Ef;var $f=Object.prototype,Rf=$f.hasOwnProperty;function Pf(t){var e=this.__data__;return oe?e[t]!==void 0:Rf.call(e,t)}var ia=Pf;var Nf="__lodash_hash_undefined__";function jf(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=oe&&e===void 0?Nf:e,this}var fa=jf;function rt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}rt.prototype.clear=na;rt.prototype.delete=oa;rt.prototype.get=sa;rt.prototype.has=ia;rt.prototype.set=fa;var tr=rt;function Mf(){this.__data__=[],this.size=0}var ua=Mf;function Df(t,e){for(var r=t.length;r--;)if(Je(t[r][0],e))return r;return-1}var pe=Df;var Lf=Array.prototype,Ff=Lf.splice;function Gf(t){var e=this.__data__,r=pe(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():Ff.call(e,r,1),--this.size,!0}var ca=Gf;function Uf(t){var e=this.__data__,r=pe(e,t);return r<0?void 0:e[r][1]}var da=Uf;function Bf(t){return pe(this.__data__,t)>-1}var la=Bf;function zf(t,e){var r=this.__data__,a=pe(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var pa=zf;function at(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}at.prototype.clear=ua;at.prototype.delete=ca;at.prototype.get=da;at.prototype.has=la;at.prototype.set=pa;var me=at;var Zf=G(N,"Map"),he=Zf;function Vf(){this.size=0,this.__data__={hash:new tr,map:new(he||me),string:new tr}}var ma=Vf;function Wf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ha=Wf;function Hf(t,e){var r=t.__data__;return ha(e)?r[typeof e=="string"?"string":"hash"]:r.map}var ge=Hf;function qf(t){var e=ge(this,t).delete(t);return this.size-=e?1:0,e}var ga=qf;function Kf(t){return ge(this,t).get(t)}var ya=Kf;function Yf(t){return ge(this,t).has(t)}var xa=Yf;function Jf(t,e){var r=ge(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}var _a=Jf;function nt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}nt.prototype.clear=ma;nt.prototype.delete=ga;nt.prototype.get=ya;nt.prototype.has=xa;nt.prototype.set=_a;var Ne=nt;var Xf="Expected a function";function rr(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Xf);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,a);return r.cache=o.set(n,s)||o,s};return r.cache=new(rr.Cache||Ne),r}rr.Cache=Ne;var va=rr;var Qf=500;function eu(t){var e=va(t,function(a){return r.size===Qf&&r.clear(),a}),r=e.cache;return e}var ba=eu;var tu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ru=/\\(\\)?/g,au=ba(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(tu,function(r,a,n,o){e.push(n?o.replace(ru,"$1"):a||r)}),e}),wa=au;function nu(t){return t==null?"":Er(t)}var Ta=nu;function ou(t,e){return E(t)?t:tt(t,e)?[t]:wa(Ta(t))}var Rt=ou;var su=1/0;function iu(t){if(typeof t=="string"||ae(t))return t;var e=t+"";return e=="0"&&1/t==-su?"-0":e}var ye=iu;function fu(t,e){e=Rt(e,t);for(var r=0,a=e.length;t!=null&&r<a;)t=t[ye(e[r++])];return r&&r==a?t:void 0}var ot=fu;function uu(t,e,r){var a=t==null?void 0:ot(t,e);return a===void 0?r:a}var ka=uu;function cu(t,e){for(var r=-1,a=e.length,n=t.length;++r<a;)t[n+r]=e[r];return t}var Pt=cu;var Sa=D?D.isConcatSpreadable:void 0;function du(t){return E(t)||Qe(t)||!!(Sa&&t&&t[Sa])}var Oa=du;function Aa(t,e,r,a,n){var o=-1,s=t.length;for(r||(r=Oa),n||(n=[]);++o<s;){var i=t[o];e>0&&r(i)?e>1?Aa(i,e-1,r,a,n):Pt(n,i):a||(n[n.length]=i)}return n}var Ia=Aa;function lu(){this.__data__=new me,this.size=0}var Ca=lu;function pu(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Ea=pu;function mu(t){return this.__data__.get(t)}var $a=mu;function hu(t){return this.__data__.has(t)}var Ra=hu;var gu=200;function yu(t,e){var r=this.__data__;if(r instanceof me){var a=r.__data__;if(!he||a.length<gu-1)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ne(a)}return r.set(t,e),this.size=r.size,this}var Pa=yu;function st(t){var e=this.__data__=new me(t);this.size=e.size}st.prototype.clear=Ca;st.prototype.delete=Ea;st.prototype.get=$a;st.prototype.has=Ra;st.prototype.set=Pa;var it=st;function xu(t,e){for(var r=-1,a=t==null?0:t.length,n=0,o=[];++r<a;){var s=t[r];e(s,r,t)&&(o[n++]=s)}return o}var Na=xu;function _u(){return[]}var ja=_u;var vu=Object.prototype,bu=vu.propertyIsEnumerable,Ma=Object.getOwnPropertySymbols,wu=Ma?function(t){return t==null?[]:(t=Object(t),Na(Ma(t),function(e){return bu.call(t,e)}))}:ja,Da=wu;function Tu(t,e,r){var a=e(t);return E(t)?a:Pt(a,r(t))}var La=Tu;function ku(t){return La(t,et,Da)}var ar=ku;var Su=G(N,"DataView"),Nt=Su;var Ou=G(N,"Promise"),jt=Ou;var Au=G(N,"Set"),Mt=Au;var Fa="[object Map]",Iu="[object Object]",Ga="[object Promise]",Ua="[object Set]",Ba="[object WeakMap]",za="[object DataView]",Cu=ne(Nt),Eu=ne(he),$u=ne(jt),Ru=ne(Mt),Pu=ne(Ct),je=V;(Nt&&je(new Nt(new ArrayBuffer(1)))!=za||he&&je(new he)!=Fa||jt&&je(jt.resolve())!=Ga||Mt&&je(new Mt)!=Ua||Ct&&je(new Ct)!=Ba)&&(je=function(t){var e=V(t),r=e==Iu?t.constructor:void 0,a=r?ne(r):"";if(a)switch(a){case Cu:return za;case Eu:return Fa;case $u:return Ga;case Ru:return Ua;case Pu:return Ba}return e});var nr=je;var Nu=N.Uint8Array,or=Nu;var ju="__lodash_hash_undefined__";function Mu(t){return this.__data__.set(t,ju),this}var Za=Mu;function Du(t){return this.__data__.has(t)}var Va=Du;function Dt(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Ne;++e<r;)this.add(t[e])}Dt.prototype.add=Dt.prototype.push=Za;Dt.prototype.has=Va;var Wa=Dt;function Lu(t,e){for(var r=-1,a=t==null?0:t.length;++r<a;)if(e(t[r],r,t))return!0;return!1}var Ha=Lu;function Fu(t,e){return t.has(e)}var qa=Fu;var Gu=1,Uu=2;function Bu(t,e,r,a,n,o){var s=r&Gu,i=t.length,f=e.length;if(i!=f&&!(s&&f>i))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var m=-1,g=!0,_=r&Uu?new Wa:void 0;for(o.set(t,e),o.set(e,t);++m<i;){var A=t[m],k=e[m];if(a)var S=s?a(k,A,m,e,t,o):a(A,k,m,t,e,o);if(S!==void 0){if(S)continue;g=!1;break}if(_){if(!Ha(e,function(P,X){if(!qa(_,X)&&(A===P||n(A,P,r,a,o)))return _.push(X)})){g=!1;break}}else if(!(A===k||n(A,k,r,a,o))){g=!1;break}}return o.delete(t),o.delete(e),g}var Lt=Bu;function zu(t){var e=-1,r=Array(t.size);return t.forEach(function(a,n){r[++e]=[n,a]}),r}var Ka=zu;function Zu(t){var e=-1,r=Array(t.size);return t.forEach(function(a){r[++e]=a}),r}var Ya=Zu;var Vu=1,Wu=2,Hu="[object Boolean]",qu="[object Date]",Ku="[object Error]",Yu="[object Map]",Ju="[object Number]",Xu="[object RegExp]",Qu="[object Set]",ec="[object String]",tc="[object Symbol]",rc="[object ArrayBuffer]",ac="[object DataView]",Ja=D?D.prototype:void 0,sr=Ja?Ja.valueOf:void 0;function nc(t,e,r,a,n,o,s){switch(r){case ac:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case rc:return!(t.byteLength!=e.byteLength||!o(new or(t),new or(e)));case Hu:case qu:case Ju:return Je(+t,+e);case Ku:return t.name==e.name&&t.message==e.message;case Xu:case ec:return t==e+"";case Yu:var i=Ka;case Qu:var f=a&Vu;if(i||(i=Ya),t.size!=e.size&&!f)return!1;var u=s.get(t);if(u)return u==e;a|=Wu,s.set(t,e);var d=Lt(i(t),i(e),a,n,o,s);return s.delete(t),d;case tc:if(sr)return sr.call(t)==sr.call(e)}return!1}var Xa=nc;var oc=1,sc=Object.prototype,ic=sc.hasOwnProperty;function fc(t,e,r,a,n,o){var s=r&oc,i=ar(t),f=i.length,u=ar(e),d=u.length;if(f!=d&&!s)return!1;for(var m=f;m--;){var g=i[m];if(!(s?g in e:ic.call(e,g)))return!1}var _=o.get(t),A=o.get(e);if(_&&A)return _==e&&A==t;var k=!0;o.set(t,e),o.set(e,t);for(var S=s;++m<f;){g=i[m];var P=t[g],X=e[g];if(a)var _t=s?a(X,P,g,e,t,o):a(P,X,g,t,e,o);if(!(_t===void 0?P===X||n(P,X,r,a,o):_t)){k=!1;break}S||(S=g=="constructor")}if(k&&!S){var Le=t.constructor,vt=e.constructor;Le!=vt&&"constructor"in t&&"constructor"in e&&!(typeof Le=="function"&&Le instanceof Le&&typeof vt=="function"&&vt instanceof vt)&&(k=!1)}return o.delete(t),o.delete(e),k}var Qa=fc;var uc=1,en="[object Arguments]",tn="[object Array]",Ft="[object Object]",cc=Object.prototype,rn=cc.hasOwnProperty;function dc(t,e,r,a,n,o){var s=E(t),i=E(e),f=s?tn:nr(t),u=i?tn:nr(e);f=f==en?Ft:f,u=u==en?Ft:u;var d=f==Ft,m=u==Ft,g=f==u;if(g&&ht(t)){if(!ht(e))return!1;s=!0,d=!1}if(g&&!d)return o||(o=new it),s||$t(t)?Lt(t,e,r,a,n,o):Xa(t,e,f,r,a,n,o);if(!(r&uc)){var _=d&&rn.call(t,"__wrapped__"),A=m&&rn.call(e,"__wrapped__");if(_||A){var k=_?t.value():t,S=A?e.value():e;return o||(o=new it),n(k,S,r,a,o)}}return g?(o||(o=new it),Qa(t,e,r,a,n,o)):!1}var an=dc;function nn(t,e,r,a,n){return t===e?!0:t==null||e==null||!W(t)&&!W(e)?t!==t&&e!==e:an(t,e,r,a,nn,n)}var Gt=nn;var lc=1,pc=2;function mc(t,e,r,a){var n=r.length,o=n,s=!a;if(t==null)return!o;for(t=Object(t);n--;){var i=r[n];if(s&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++n<o;){i=r[n];var f=i[0],u=t[f],d=i[1];if(s&&i[2]){if(u===void 0&&!(f in t))return!1}else{var m=new it;if(a)var g=a(u,d,f,t,e,m);if(!(g===void 0?Gt(d,u,lc|pc,a,m):g))return!1}}return!0}var on=mc;function hc(t){return t===t&&!ce(t)}var Ut=hc;function gc(t){for(var e=et(t),r=e.length;r--;){var a=e[r],n=t[a];e[r]=[a,n,Ut(n)]}return e}var sn=gc;function yc(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Bt=yc;function xc(t){var e=sn(t);return e.length==1&&e[0][2]?Bt(e[0][0],e[0][1]):function(r){return r===t||on(r,t,e)}}var fn=xc;function _c(t,e){return t!=null&&e in Object(t)}var un=_c;function vc(t,e,r){e=Rt(e,t);for(var a=-1,n=e.length,o=!1;++a<n;){var s=ye(e[a]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++a!=n?o:(n=t==null?0:t.length,!!n&&Xe(n)&&Ye(s,n)&&(E(t)||Qe(t)))}var cn=vc;function bc(t,e){return t!=null&&cn(t,e,un)}var dn=bc;var wc=1,Tc=2;function kc(t,e){return tt(t)&&Ut(e)?Bt(ye(t),e):function(r){var a=ka(r,t);return a===void 0&&a===e?dn(r,t):Gt(e,a,wc|Tc)}}var ln=kc;function Sc(t){return function(e){return e?.[t]}}var pn=Sc;function Oc(t){return function(e){return ot(e,t)}}var mn=Oc;function Ac(t){return tt(t)?pn(ye(t)):mn(t)}var hn=Ac;function Ic(t){return typeof t=="function"?t:t==null?de:typeof t=="object"?E(t)?ln(t[0],t[1]):fn(t):hn(t)}var zt=Ic;function Cc(t,e,r,a){for(var n=-1,o=t==null?0:t.length;++n<o;){var s=t[n];e(a,s,r(s),t)}return a}var gn=Cc;function Ec(t){return function(e,r,a){for(var n=-1,o=Object(e),s=a(e),i=s.length;i--;){var f=s[t?i:++n];if(r(o[f],f,o)===!1)break}return e}}var yn=Ec;var $c=yn(),xn=$c;function Rc(t,e){return t&&xn(t,e,et)}var _n=Rc;function Pc(t,e){return function(r,a){if(r==null)return r;if(!le(r))return t(r,a);for(var n=r.length,o=e?n:-1,s=Object(r);(e?o--:++o<n)&&a(s[o],o,s)!==!1;);return r}}var vn=Pc;var Nc=vn(_n),Zt=Nc;function jc(t,e,r,a){return Zt(t,function(n,o,s){e(a,n,r(n),s)}),a}var bn=jc;function Mc(t,e){return function(r,a){var n=E(r)?gn:bn,o=e?e():{};return n(r,t,zt(a,2),o)}}var wn=Mc;function Dc(t,e){var r=-1,a=le(t)?Array(t.length):[];return Zt(t,function(n,o,s){a[++r]=e(n,o,s)}),a}var Tn=Dc;var Lc=Object.prototype,Fc=Lc.hasOwnProperty,Gc=wn(function(t,e,r){Fc.call(t,r)?t[r].push(e):Gr(t,r,[e])}),yt=Gc;function Uc(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var kn=Uc;function Bc(t,e){if(t!==e){var r=t!==void 0,a=t===null,n=t===t,o=ae(t),s=e!==void 0,i=e===null,f=e===e,u=ae(e);if(!i&&!u&&!o&&t>e||o&&s&&f&&!i&&!u||a&&s&&f||!r&&f||!n)return 1;if(!a&&!o&&!u&&t<e||u&&r&&n&&!a&&!o||i&&r&&n||!s&&n||!f)return-1}return 0}var Sn=Bc;function zc(t,e,r){for(var a=-1,n=t.criteria,o=e.criteria,s=n.length,i=r.length;++a<s;){var f=Sn(n[a],o[a]);if(f){if(a>=i)return f;var u=r[a];return f*(u=="desc"?-1:1)}}return t.index-e.index}var On=zc;function Zc(t,e,r){e.length?e=qe(e,function(o){return E(o)?function(s){return ot(s,o.length===1?o[0]:o)}:o}):e=[de];var a=-1;e=qe(e,Et(zt));var n=Tn(t,function(o,s,i){var f=qe(e,function(u){return u(o)});return{criteria:f,index:++a,value:o}});return kn(n,function(o,s){return On(o,s,r)})}var An=Zc;var Vc=zr(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Jt(t,e[0],e[1])?e=[]:r>2&&Jt(e[0],e[1],e[2])&&(e=[e[0]]),An(t,Ia(e,1),[])}),ir=Vc;H();function O(t){return{content:[{type:"text",text:t}]}}function J(t,e){return!t||t.length<=e?t:t.slice(0,e)+"..."}var ct=200;function Hn(t){t.tool("search",`Search Sigil knowledge base for facts across all ingested documents.
|
|
7
7
|
Automatically detects entity names and returns entity-centric results.
|
|
8
8
|
Use for: "how does X work", "what is Y?", "what are the rules for Z", domain knowledge, decisions.
|
|
9
9
|
Returns compact facts. Use get_fact_context(factId) for full detail on any fact.
|
|
10
10
|
Set includeChunks=true only when raw document context is needed.
|
|
11
|
-
Set format="compact" for token-efficient output (one line per category, no IDs/metadata).`,{query:y.string().describe("Natural language search query"),limit:y.number().optional().default(5).describe("Max facts to return (default 5)"),namespaces:y.array(y.string()).optional().describe("Filter by namespaces"),minConfidence:y.enum(["low","medium","high"]).optional().default("medium").describe("Minimum fact confidence"),includeChunks:y.boolean().optional().default(!1).describe("Include raw document chunks (verbose \u2014 only when needed)"),useGraph:y.boolean().optional().default(!1).describe("Traverse entity graph for additional related facts"),pointInTime:y.string().optional().describe("ISO timestamp \u2014 return only facts valid at this point in time"),format:y.enum(["full","compact"]).optional().default("full").describe('Output format: "full" (default) or "compact" (token-efficient, one line per category)'),podScope:y.union([y.literal("auto"),y.literal("global"),y.array(y.string())]).optional().describe('Pod scope: "auto" (active project/session pods \u2014 the default), "global" (whole brain, no scope), or list of pod uids/names.')},async({query:e,limit:r,namespaces:a,minConfidence:n,includeChunks:o,useGraph:s,pointInTime:i,format:f,podScope:u})=>{let d=await
|
|
12
|
-
${
|
|
11
|
+
Set format="compact" for token-efficient output (one line per category, no IDs/metadata).`,{query:y.string().describe("Natural language search query"),limit:y.number().optional().default(5).describe("Max facts to return (default 5)"),namespaces:y.array(y.string()).optional().describe("Filter by namespaces"),minConfidence:y.enum(["low","medium","high"]).optional().default("medium").describe("Minimum fact confidence"),includeChunks:y.boolean().optional().default(!1).describe("Include raw document chunks (verbose \u2014 only when needed)"),useGraph:y.boolean().optional().default(!1).describe("Traverse entity graph for additional related facts"),pointInTime:y.string().optional().describe("ISO timestamp \u2014 return only facts valid at this point in time"),format:y.enum(["full","compact"]).optional().default("full").describe('Output format: "full" (default) or "compact" (token-efficient, one line per category)'),podScope:y.union([y.literal("auto"),y.literal("global"),y.array(y.string())]).optional().describe('Pod scope: "auto" (active project/session pods \u2014 the default), "global" (whole brain, no scope), or list of pod uids/names.')},async({query:e,limit:r,namespaces:a,minConfidence:n,includeChunks:o,useGraph:s,pointInTime:i,format:f,podScope:u})=>{let d=await R("search",{query:e,namespaces:a,limit:r,minConfidence:n,includeChunks:o,useGraph:s,pointInTime:i,podScope:u??"auto",cwd:process.cwd(),route:!1,synthesize:!1}),{facts:m,chunks:g,matchedEntity:_,relatedEntities:A}=d;if(f==="compact")return O(gd(m,_));let k=[];if(_&&(k.push(`**Matched entity:** ${_.name} (${_.entityType||_.type}, id:${_.id}, ${_.mentions??_.mentionCount??0} mentions)`),_.description&&k.push(_.description),k.push("")),m.length){k.push(`**Facts (${m.length}):**`);for(let S of m){let P=J(S.content,ct),X=S.importance==="vital"?" **[VITAL]**":"",_t=S.agent?` \xB7 via ${S.agent}`:"",Le=Array.isArray(S.sourceDocumentIds)&&S.sourceDocumentIds.length?` \xB7 doc#${S.sourceDocumentIds[0]}`:"";k.push(`- [${S.category}] ${P}${X} _(${S.confidence}, id:${S.id}${_t}${Le})_`)}}if(A.length){k.push(""),k.push(`**Related entities (${A.length}):**`);for(let S of A.slice(0,10))k.push(`- ${S.name} (${S.entityType||S.type}) [${S.relation}] id:${S.id}`)}if(o&&g.length){k.push(""),k.push(`**Chunks (${g.length}):**`);for(let S of g.slice(0,3)){let P=S.sectionHeading?`[${S.sectionHeading}] `:"";k.push(`---
|
|
12
|
+
${P}${J(S.content,500)}`)}}return!m.length&&!g.length&&k.push("No results found. Try broader terms or use search_entity to find entity names."),_&&k.push(`
|
|
13
13
|
_Drill down: get_entity_context(entityId=${_.id}) for full details about ${_.name}_`),O(k.join(`
|
|
14
|
-
`))})}function
|
|
14
|
+
`))})}function gd(t,e){let r=[];if(e&&r.push(`> ${e.name} (${e.entityType||e.type})`),!t.length)return r.push("No results."),r.join(`
|
|
15
15
|
`);let a=yt(t,"category");for(let[n,o]of Object.entries(a)){let i=ir(o,f=>f.importance==="vital"?0:1).map(f=>f.content);r.push(`[${n}]: ${i.join(". ")}`)}return r.join(`
|
|
16
|
-
`)}H();function
|
|
16
|
+
`)}H();function qn(t){t.tool("search_entity",`Find entities in the knowledge graph by name or type.
|
|
17
17
|
Use for: "find Alice", "list all topics", "show all people", "find documents about normalization".
|
|
18
18
|
Entity types: document, person, topic (extensible per domain).
|
|
19
|
-
Returns compact entity list. Use get_entity_context(entityId) for full details.`,{query:y.string().optional().describe('Entity name to search (e.g. "Alice", "Cohort 6")'),entityType:y.string().optional().describe("Filter by type: session, course, person, topic"),limit:y.number().optional().default(10).describe("Max results"),namespace:y.string().optional().describe("Namespace. Omit for default.")},async({query:e,entityType:r,limit:a,namespace:n})=>{if(!e&&!r)return O("Error: Provide either a query (entity name) or entityType.");let{entities:o}=await
|
|
19
|
+
Returns compact entity list. Use get_entity_context(entityId) for full details.`,{query:y.string().optional().describe('Entity name to search (e.g. "Alice", "Cohort 6")'),entityType:y.string().optional().describe("Filter by type: session, course, person, topic"),limit:y.number().optional().default(10).describe("Max results"),namespace:y.string().optional().describe("Namespace. Omit for default.")},async({query:e,entityType:r,limit:a,namespace:n})=>{if(!e&&!r)return O("Error: Provide either a query (entity name) or entityType.");let{entities:o}=await R("searchEntity",{query:e,entityType:r,limit:a,namespace:n});if(!o.length){let f=e?`matching "${e}"`:`of type "${r}"`;return O(`No entities found ${f}.`)}let s=o.map(f=>{let u=f.description?` \u2014 ${f.description}`:"";return`- **${f.name}** (${f.entityType}, id:${f.id}, ${f.mentionCount} mentions)${u}`}),i=e?`Entities matching "${e}"`:`${r} entities`;return O(`${i} (${o.length}):
|
|
20
20
|
${s.join(`
|
|
21
21
|
`)}
|
|
22
22
|
|
|
23
|
-
_Use get_entity_context(entityId=<id>) for details or traverse_graph(startEntityId=<id>) for connections._`)})}H();function
|
|
23
|
+
_Use get_entity_context(entityId=<id>) for details or traverse_graph(startEntityId=<id>) for connections._`)})}H();function Kn(t){t.tool("traverse_graph",`Navigate entity relationships in the knowledge graph.
|
|
24
24
|
Use for: "who did Alice mentor?", "what topics does course X cover?", "how is A related to B?",
|
|
25
25
|
"what documents cover this topic?", "show mentorship chain".
|
|
26
|
-
Relation types: PART_OF, LED_BY, MENTORED, COVERS, FOLLOWS.`,{startEntityId:y.number().describe("Starting entity ID (from search_entity results)"),action:y.enum(["neighbors","path","related"]).optional().default("neighbors").describe("neighbors = direct connections, path = shortest path to target, related = all reachable"),targetEntityId:y.number().optional().describe('Target entity ID (required for "path" action)'),relationType:y.string().optional().describe("Filter: PART_OF, LED_BY, MENTORED, COVERS, FOLLOWS"),maxDepth:y.number().optional().default(2).describe("Traversal depth 1-3"),limit:y.number().optional().default(20).describe("Max results")},async({startEntityId:e,action:r,targetEntityId:a,relationType:n,maxDepth:o,limit:s})=>{let i=await
|
|
26
|
+
Relation types: PART_OF, LED_BY, MENTORED, COVERS, FOLLOWS.`,{startEntityId:y.number().describe("Starting entity ID (from search_entity results)"),action:y.enum(["neighbors","path","related"]).optional().default("neighbors").describe("neighbors = direct connections, path = shortest path to target, related = all reachable"),targetEntityId:y.number().optional().describe('Target entity ID (required for "path" action)'),relationType:y.string().optional().describe("Filter: PART_OF, LED_BY, MENTORED, COVERS, FOLLOWS"),maxDepth:y.number().optional().default(2).describe("Traversal depth 1-3"),limit:y.number().optional().default(20).describe("Max results")},async({startEntityId:e,action:r,targetEntityId:a,relationType:n,maxDepth:o,limit:s})=>{let i=await R("traverseGraph",{startEntityId:e,action:r,targetEntityId:a,relationType:n,maxDepth:o,limit:s});if(i.notFound)return O(`Error: Entity ID ${e} not found.`);let f=`${i.start.name} (${i.start.entityType}, id:${i.start.id})`;if(i.action==="path"){if(!i.path)return O(`No path found from ${i.start.name} to entity ${a}.`);let g=i.path.path.map((_,A)=>{let k=A<i.path.relationTypes.length?` --[${i.path.relationTypes[A]}]--> `:"";return`${_.name} (${_.entityType})${k}`});return O(`Path (${i.path.depth} hops):
|
|
27
27
|
${g.join("")}`)}if(i.action==="related"){let g=i.related||[];if(!g.length)return O(`${i.start.name} has no related entities within ${o} hops.`);let _=yt(g,"depth"),A=[`Entities related to ${f} (${g.length}):`];for(let k of Object.keys(_).sort()){let S=k==="1"?"Direct":`${k} hops`;A.push(`
|
|
28
|
-
${S}:`);for(let
|
|
28
|
+
${S}:`);for(let P of _[k])A.push(`- [${P.relationType}] ${P.name} (${P.entityType}, id:${P.entityId})`)}return O(A.join(`
|
|
29
29
|
`))}if(i.related){let g=i.related.map(_=>`- [${_.relationType}] ${_.name} (${_.entityType}, id:${_.entityId||_.id}) depth:${_.depth}`);return O(`${f}
|
|
30
30
|
Connections (${i.related.length}):
|
|
31
31
|
${g.join(`
|
|
@@ -33,32 +33,32 @@ ${g.join(`
|
|
|
33
33
|
No connections found.`);let u=i.relations.filter(g=>g.direction==="outgoing"),d=i.relations.filter(g=>g.direction==="incoming"),m=[f];if(u.length){m.push(`
|
|
34
34
|
Outgoing (${u.length}):`);for(let g of u)m.push(`- [${g.relationType}] ${g.name} (${g.entityType}, id:${g.entityId})`)}if(d.length){m.push(`
|
|
35
35
|
Incoming (${d.length}):`);for(let g of d)m.push(`- ${g.name} (${g.entityType}, id:${g.entityId}) [${g.relationType}]`)}return O(m.join(`
|
|
36
|
-
`))})}H();function
|
|
36
|
+
`))})}H();function Yn(t){t.tool("get_fact_context",`Get full context for a specific fact: complete content, entities mentioned, relations created, sources.
|
|
37
37
|
Use for: drilling down on a fact from search results, checking provenance, understanding connections.
|
|
38
|
-
This is the detail view \u2014 search returns truncated facts, this returns everything.`,{factId:y.number().optional().describe("Fact ID (from search results)"),uid:y.string().optional().describe('Fact UID (e.g. "fact-a1b2c3d4")')},async({uid:e,factId:r})=>{if(!e&&!r)return O("Error: Provide either factId or uid.");let a=await
|
|
38
|
+
This is the detail view \u2014 search returns truncated facts, this returns everything.`,{factId:y.number().optional().describe("Fact ID (from search results)"),uid:y.string().optional().describe('Fact UID (e.g. "fact-a1b2c3d4")')},async({uid:e,factId:r})=>{if(!e&&!r)return O("Error: Provide either factId or uid.");let a=await R("getFactContext",{uid:e,factId:r});if(a.notFound)return O("Error: Fact not found.");let{fact:n,entities:o,relations:s,documents:i}=a,f=[`**Fact ${n.uid}** (${n.category}, ${n.confidence}, ${n.status})`,n.content];if(n.sourceSection&&f.push(`Source section: ${n.sourceSection}`),o.length&&f.push(`
|
|
39
39
|
Entities mentioned: ${o.map(u=>`${u.name} (${u.entityType}, id:${u.id})`).join(", ")}`),s.length){f.push(`
|
|
40
40
|
Relations from this fact:`);for(let u of s)f.push(`- ${u.sourceName} --[${u.relationType}]--> ${u.targetName}`)}return i.length&&f.push(`
|
|
41
41
|
Sources: ${i.map(u=>`${u.title} (${u.sourceType})`).join(", ")}`),O(f.join(`
|
|
42
|
-
`))})}H();function
|
|
42
|
+
`))})}H();function Jn(t){t.tool("get_entity_context",`Get full context for an entity: relations, connected facts, graph position.
|
|
43
43
|
Use for: "tell me about Alice", "what documents cover this topic?", "show expertise areas".
|
|
44
|
-
Returns entity details + relations + key facts (truncated \u2014 use get_fact_context for full text).`,{entityId:y.number().optional().describe("Entity ID (from search_entity or search results)"),name:y.string().optional().describe("Entity name (alternative to ID)"),namespace:y.string().optional().describe("Namespace. Omit for default.")},async({entityId:e,name:r,namespace:a})=>{if(!e&&!r)return O("Error: Provide either entityId or name.");let n=await
|
|
44
|
+
Returns entity details + relations + key facts (truncated \u2014 use get_fact_context for full text).`,{entityId:y.number().optional().describe("Entity ID (from search_entity or search results)"),name:y.string().optional().describe("Entity name (alternative to ID)"),namespace:y.string().optional().describe("Namespace. Omit for default.")},async({entityId:e,name:r,namespace:a})=>{if(!e&&!r)return O("Error: Provide either entityId or name.");let n=await R("getEntityContext",{entityId:e,name:r,namespace:a});if(n.notFound)return O("Error: Entity not found.");let{entity:o,relations:s,facts:i}=n,f=[`**${o.name}** (${o.entityType}, id:${o.id}, ${o.mentionCount} mentions)`];o.description&&f.push(o.description);let u=s.filter(m=>m.direction==="outgoing"),d=s.filter(m=>m.direction==="incoming");if(u.length){f.push(`
|
|
45
45
|
Outgoing relations (${u.length}):`);for(let m of u.slice(0,15))f.push(`- [${m.relationType}] ${m.name} (${m.entityType}, id:${m.entityId})`);u.length>15&&f.push(` ...and ${u.length-15} more`)}if(d.length){f.push(`
|
|
46
46
|
Incoming relations (${d.length}):`);for(let m of d.slice(0,15))f.push(`- ${m.name} (${m.entityType}, id:${m.entityId}) [${m.relationType}]`);d.length>15&&f.push(` ...and ${d.length-15} more`)}if(i.length){f.push(`
|
|
47
|
-
Key facts (${i.length}):`);for(let m of i){let g=J(m.content,
|
|
47
|
+
Key facts (${i.length}):`);for(let m of i){let g=J(m.content,ct);f.push(`- [${m.category}] ${g} _(${m.confidence}, id:${m.id})_`)}}return!u.length&&!d.length&&!i.length&&f.push(`
|
|
48
48
|
No connections or facts found for this entity.`),f.push(`
|
|
49
49
|
_Use traverse_graph(startEntityId=${o.id}) for deeper graph exploration._`),O(f.join(`
|
|
50
|
-
`))})}H();function
|
|
51
|
-
Use when: checking system health, verifying ingestion, reviewing knowledge graph size.`,{namespace:y.string().optional().describe("Filter by namespace. Omit for global stats.")},async({namespace:e})=>{let r=await
|
|
52
|
-
`);return O(n)})}H();function
|
|
50
|
+
`))})}H();function Xn(t){t.tool("status",`Show Sigil knowledge base statistics \u2014 documents, chunks, facts, entities, relations.
|
|
51
|
+
Use when: checking system health, verifying ingestion, reviewing knowledge graph size.`,{namespace:y.string().optional().describe("Filter by namespace. Omit for global stats.")},async({namespace:e})=>{let r=await R("status",{namespace:e,hotFactsLimit:5}),n=[`Sigil KB${r.namespace?` (${r.namespace})`:""}: ${r.documents} docs, ${r.chunks} chunks, ${r.facts} facts`,`Entities: ${r.entities.documents} documents, ${r.entities.people} people, ${r.entities.topics} topics`,`Relations: ${r.relations}`,`Hot facts (top ${r.hotFacts.length}): ${r.hotFacts.map(o=>`${J(o.content,60)} (${o.accessCount}x)`).join(", ")||"none yet"}`].join(`
|
|
52
|
+
`);return O(n)})}H();function Qn(t){t.tool("ingest",`Ingest a document into the Sigil knowledge base. Accepts raw content, a file path, or a URL.
|
|
53
53
|
Parses the content, chunks it, embeds it, extracts facts, links entities, and stores everything for search.
|
|
54
|
-
Use when: adding documents to the knowledge base, ingesting files, URLs, or raw text.`,{content:y.string().optional().describe("Raw text content to ingest. Provide this OR filePath OR url."),filePath:y.string().optional().describe("Local file path to ingest. Provide this OR content OR url."),url:y.string().optional().describe("URL to fetch and ingest. Provide this OR content OR filePath."),title:y.string().optional().describe("Document title. Auto-detected if not provided."),namespace:y.string().optional().describe("Namespace for the document. Defaults to config default."),sourceType:y.string().optional().describe("Source type label (e.g., docs, code, notes). Auto-detected from format."),skipFacts:y.boolean().optional().default(!1).describe("Skip fact extraction (faster, chunks only)"),skipEntities:y.boolean().optional().default(!1).describe("Skip entity linking")},async({content:e,filePath:r,url:a,title:n,namespace:o,sourceType:s,skipFacts:i,skipEntities:f})=>{let u=await
|
|
55
|
-
`);return O(d)})}H();function
|
|
54
|
+
Use when: adding documents to the knowledge base, ingesting files, URLs, or raw text.`,{content:y.string().optional().describe("Raw text content to ingest. Provide this OR filePath OR url."),filePath:y.string().optional().describe("Local file path to ingest. Provide this OR content OR url."),url:y.string().optional().describe("URL to fetch and ingest. Provide this OR content OR filePath."),title:y.string().optional().describe("Document title. Auto-detected if not provided."),namespace:y.string().optional().describe("Namespace for the document. Defaults to config default."),sourceType:y.string().optional().describe("Source type label (e.g., docs, code, notes). Auto-detected from format."),skipFacts:y.boolean().optional().default(!1).describe("Skip fact extraction (faster, chunks only)"),skipEntities:y.boolean().optional().default(!1).describe("Skip entity linking")},async({content:e,filePath:r,url:a,title:n,namespace:o,sourceType:s,skipFacts:i,skipEntities:f})=>{let u=await R("ingestDoc",{content:e,filePath:r,url:a,title:n,namespace:o,sourceType:s,skipFacts:i,skipEntities:f}),d=u.skipped?`Document "${u.title}" already up to date \u2014 skipped.`:[`Document "${u.title}" ingested.`,`- Document ID: ${u.documentId}`,`- Chunks: ${u.chunkCount}`,u.facts?`- Facts: ${u.facts.total} extracted (${u.facts.added} new, ${u.facts.skipped} skipped)`:"- Facts: skipped",u.entities?`- Entities: ${u.entities.entityCount}, Relations: ${u.entities.relationCount}`:"- Entities: skipped",u.output?`- Output: ${u.output}`:""].filter(Boolean).join(`
|
|
55
|
+
`);return O(d)})}H();function eo(t){t.tool("list_pods",`List memory pods (typed containers segregating facts by source or subject).
|
|
56
56
|
Use for: "what sessions do I have?", "list everyone I have a pod for", "which workspaces?".
|
|
57
57
|
Pod types: session (Claude Code), person (people you have a relationship with),
|
|
58
|
-
project, connector_workspace, custom.`,{type:y.enum(["session","person","project","connector_workspace","custom"]).optional().describe("Filter by pod type. Omit for all types."),namespace:y.string().optional().describe("Namespace. Omit for default."),status:y.enum(["active","archived"]).optional().default("active"),limit:y.number().int().positive().max(100).optional().default(20)},async({type:e,namespace:r,status:a,limit:n})=>{let{pods:o}=await
|
|
59
|
-
`))})}H();function
|
|
58
|
+
project, connector_workspace, custom.`,{type:y.enum(["session","person","project","connector_workspace","custom"]).optional().describe("Filter by pod type. Omit for all types."),namespace:y.string().optional().describe("Namespace. Omit for default."),status:y.enum(["active","archived"]).optional().default("active"),limit:y.number().int().positive().max(100).optional().default(20)},async({type:e,namespace:r,status:a,limit:n})=>{let{pods:o}=await R("listPods",{type:e,namespace:r,status:a,limit:n});if(!o.length){let i=e?` of type "${e}"`:"";return O(`No${i} pods found.`)}let s=[`Found ${o.length} pod${o.length===1?"":"s"}:`,""];for(let i of o){let f=i.memberFactCount??0,u=i.memberDocCount??0,d=i.updatedAt?new Date(i.updatedAt).toISOString().slice(0,16).replace("T"," "):"\u2014";s.push(`- **${i.name}** (${i.podType}, uid:${i.uid})`),s.push(` facts=${f} docs=${u} updated=${d}`)}return s.push(""),s.push("_Use get_pod(uid=...) for member facts and full metadata._"),O(s.join(`
|
|
59
|
+
`))})}H();function to(t){t.tool("get_pod",`Get a memory pod with its member facts, documents, and (for person pods)
|
|
60
60
|
the canonical entity link.
|
|
61
61
|
Use for: "what happened in this session?", "show me everything sigil knows
|
|
62
62
|
about Dhaval", "what's in the Slack workspace pod?".
|
|
63
|
-
Returns pod metadata + up to 20 latest facts + up to 10 latest documents.`,{uid:y.string().describe("Pod uid (from list_pods or sigil session current)")},async({uid:e})=>{let r=await
|
|
64
|
-
`))})}process.env.SIGIL_AGENT||(process.env.SIGIL_AGENT="mcp");function
|
|
63
|
+
Returns pod metadata + up to 20 latest facts + up to 10 latest documents.`,{uid:y.string().describe("Pod uid (from list_pods or sigil session current)")},async({uid:e})=>{let r=await R("getPod",{uid:e});if(r.notFound)return O(`Error: pod ${e} not found.`);let{pod:a,facts:n,documents:o}=r,s=[`**${a.name}** (${a.podType}, uid:${a.uid})`,"",`- namespace: ${a.namespace}`,`- status: ${a.status}`];a.startedAt&&s.push(`- started_at: ${a.startedAt}`),a.endedAt&&s.push(`- ended_at: ${a.endedAt}`),a.entityId&&s.push(`- entity_id: ${a.entityId}`),a.connectionId&&s.push(`- connection_id: ${a.connectionId}`),a.externalId&&s.push(`- external_id: ${a.externalId}`);let i=Object.entries(a.attrs||{}).filter(([,f])=>f!=null&&f!=="");if(i.length){s.push("","Attrs:");for(let[f,u]of i){let d=typeof u=="object"?JSON.stringify(u):u;s.push(`- ${f}: ${d}`)}}if(n.length){s.push("",`Member facts (${n.length}, up to 20):`);for(let f of n){let u=J(f.content,ct),d=f.podRole==="mention"?" _[mention]_":"";s.push(`- ${u} (id:${f.id})${d}`)}}if(o.length){s.push("",`Member documents (${o.length}, up to 10):`);for(let f of o){let u=f.title||f.sourcePath||`doc-${f.id}`;s.push(`- ${J(u,80)} (id:${f.id})`)}}return!n.length&&!o.length&&s.push("","_Pod has no member facts or documents yet._"),O(s.join(`
|
|
64
|
+
`))})}process.env.SIGIL_AGENT||(process.env.SIGIL_AGENT="mcp");function _d(){let t=new yd({name:"sigil",version:"0.2.0"});return Hn(t),qn(t),Kn(t),Yn(t),Jn(t),to(t),eo(t),Xn(t),Qn(t),t}async function ro(){let t=_d(),e=new xd;await t.connect(e);let{closeDaemonConnection:r}=await Promise.resolve().then(()=>(H(),Wn)),a=()=>{r().catch(()=>{})};return process.on("SIGTERM",a),process.on("SIGINT",a),process.on("beforeExit",a),t}var Td=ao(ao(bd(import.meta.url))),kd=process.env.DOTENV_CONFIG_PATH||(wd(cr(process.cwd(),".env"))?cr(process.cwd(),".env"):null)||cr(Td,".env");vd({path:kd,quiet:!0});await ro();
|