@tokmizer/plugin 0.9.59 → 0.9.61

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.
@@ -2,4 +2,4 @@ import { createRequire as __tkrCreateRequire } from "node:module"; const require
2
2
  var et=Object.defineProperty;var tt=(r,e)=>{for(var t in e)et(r,t,{get:e[t],enumerable:!0})};function Oe(r=5e3){return new Promise(e=>{let t=[],n=process.stdin,s=!1,a=()=>{s||(s=!0,clearTimeout(o),n.off("data",i),n.pause(),n.unref?.(),e(Buffer.concat(t).toString("utf8")))},i=u=>{t.push(Buffer.isBuffer(u)?u:Buffer.from(u))},o=setTimeout(a,r);n.on("data",i).once("end",a).once("error",a),n.resume()})}import{realpathSync as Ce}from"node:fs";import{fileURLToPath as rt,pathToFileURL as nt}from"node:url";var Ne=null;function Re(r,e,t){if(t!==void 0&&Ne===t)return!0;if(Ne!==null||!r)return!1;if(e===nt(r).href)return!0;try{return Ce(r)===Ce(rt(e))}catch{return!1}}import{appendFileSync as sn,mkdirSync as an,readFileSync as it,writeFileSync as on,renameSync as cn,statSync as ot,readdirSync as ct,rmSync as ut,chmodSync as un}from"node:fs";import{join as be}from"node:path";import st from"node:os";import{join as at}from"node:path";function N(){return process.env.TOKMIZER_HOME||at(st.homedir(),".tokmizer")}var fn=96*1024;var dt=168*3600*1e3;function Ae(){return be(N(),"sessions")}function lt(r){let e=r.replace(/[^A-Za-z0-9._-]/g,"-").replace(/\.\./g,"-").slice(0,80)||"default";return be(Ae(),`${e}.jsonl`)}function Ie(r){try{let e=it(lt(r),"utf8"),t=[];for(let n of e.split(`
3
3
  `))if(n.trim())try{let s=JSON.parse(n);typeof s.tool=="string"&&typeof s.target=="string"&&t.push(s)}catch{}return t}catch{return[]}}function je(){try{let r=Ae(),e=Date.now();for(let t of ct(r)){let n=be(r,t);try{e-ot(n).mtimeMs>dt&&ut(n,{force:!0})}catch{}}}catch{}}function $e(r){if(r.length===0)return"";let e=new Map,t=[],n=[];for(let u of r)u.tool==="Read"?e.set(u.target,(e.get(u.target)??0)+1):u.tool==="Grep"||u.tool==="Glob"?t.includes(u.target)||t.push(u.target):u.tool==="Bash"&&n.push({target:u.target,fail:u.fail===1});let s=["Tokmizer session recap (this session before context trimming):"],a=[...e.entries()].slice(-12);if(a.length>0){s.push("Files read:");for(let[u,l]of a)s.push(l>1?` ${u} \xD7${l}`:` ${u}`)}t.length>0&&s.push(`Searches: ${t.slice(-5).join(", ")}`);let i=new Set,o=[];for(let u=n.length-1;u>=0&&o.length<8;u--){let l=n[u];i.has(l.target)||(i.add(l.target),o.unshift(l))}if(o.length>0){s.push("Recent commands:");for(let u of o)s.push(u.fail?` ${u.target} \u2717 failed`:` ${u.target}`)}return s.push("Originals of trimmed outputs stay recoverable: tkr restore <hash>."),s.slice(0,30).join(`
4
4
  `)}import{appendFileSync as mn,chmodSync as gn,mkdirSync as yn,readFileSync as _n,rmSync as ft,statSync as vn}from"node:fs";import{join as pt}from"node:path";var bn=256*1024;function ht(r){let e=r.replace(/[^A-Za-z0-9._-]/g,"-").replace(/\.\./g,"-").slice(0,80)||"default";return pt(N(),"sessions",`${e}.seen`)}function Me(r){try{ft(ht(r),{force:!0})}catch{}}import{existsSync as Xe,mkdirSync as Vr,writeFileSync as zr}from"node:fs";import{join as Lr}from"node:path";import{readFile as Or,writeFile as Qn,mkdir as es,chmod as ts,rm as rs,rename as ns,readdir as ss}from"node:fs/promises";import{join as Cr}from"node:path";var C={};tt(C,{BRAND:()=>Lt,DIRTY:()=>F,EMPTY_PATH:()=>_t,INVALID:()=>h,NEVER:()=>Sr,OK:()=>k,ParseStatus:()=>x,Schema:()=>y,ZodAny:()=>L,ZodArray:()=>P,ZodBigInt:()=>B,ZodBoolean:()=>H,ZodBranded:()=>pe,ZodCatch:()=>re,ZodDate:()=>W,ZodDefault:()=>te,ZodDiscriminatedUnion:()=>_e,ZodEffects:()=>O,ZodEnum:()=>Q,ZodError:()=>b,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>xe,ZodIntersection:()=>Y,ZodIssueCode:()=>c,ZodLazy:()=>G,ZodLiteral:()=>X,ZodMap:()=>ue,ZodNaN:()=>le,ZodNativeEnum:()=>ee,ZodNever:()=>R,ZodNull:()=>J,ZodNullable:()=>j,ZodNumber:()=>U,ZodObject:()=>w,ZodOptional:()=>T,ZodParsedType:()=>f,ZodPipeline:()=>he,ZodPromise:()=>D,ZodReadonly:()=>ne,ZodRecord:()=>ve,ZodSchema:()=>y,ZodSet:()=>de,ZodString:()=>z,ZodSymbol:()=>oe,ZodTransformer:()=>O,ZodTuple:()=>I,ZodType:()=>y,ZodUndefined:()=>q,ZodUnion:()=>K,ZodUnknown:()=>Z,ZodVoid:()=>ce,addIssueToContext:()=>d,any:()=>Kt,array:()=>Qt,bigint:()=>Bt,boolean:()=>We,coerce:()=>wr,custom:()=>Ue,date:()=>Ht,datetimeRegex:()=>De,defaultErrorMap:()=>$,discriminatedUnion:()=>nr,effect:()=>mr,enum:()=>fr,function:()=>ur,getErrorMap:()=>se,getParsedType:()=>A,instanceof:()=>Ft,intersection:()=>sr,isAborted:()=>ge,isAsync:()=>ae,isDirty:()=>ye,isValid:()=>V,late:()=>Dt,lazy:()=>dr,literal:()=>lr,makeIssue:()=>fe,map:()=>or,nan:()=>Ut,nativeEnum:()=>pr,never:()=>Gt,null:()=>Jt,nullable:()=>yr,number:()=>He,object:()=>er,objectUtil:()=>we,oboolean:()=>br,onumber:()=>kr,optional:()=>gr,ostring:()=>xr,pipeline:()=>vr,preprocess:()=>_r,promise:()=>hr,quotelessJson:()=>mt,record:()=>ir,set:()=>cr,setErrorMap:()=>yt,strictObject:()=>tr,string:()=>Be,symbol:()=>Wt,transformer:()=>mr,tuple:()=>ar,undefined:()=>qt,union:()=>rr,unknown:()=>Yt,util:()=>_,void:()=>Xt});var _;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(_||(_={}));var we;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));var f=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=_.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"]),mt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),b=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){let l=i.path[u];u===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return s(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)if(s.path.length>0){let a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};b.create=r=>new b(r);var gt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,_.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${_.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:_.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,_.assertNever(r)}return{message:t}},$=gt;var Ze=$;function yt(r){Ze=r}function se(){return Ze}var fe=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},_t=[];function d(r,e){let t=se(),n=fe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===$?void 0:$].filter(s=>!!s)});r.common.issues.push(n)}var x=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return h;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t){let a=await s.key,i=await s.value;n.push({key:a,value:i})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return h;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},h=Object.freeze({status:"aborted"}),F=r=>({status:"dirty",value:r}),k=r=>({status:"valid",value:r}),ge=r=>r.status==="aborted",ye=r=>r.status==="dirty",V=r=>r.status==="valid",ae=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var E=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}},Pe=(r,e)=>{if(V(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new b(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{let{message:u}=r;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:s}}var y=class{get description(){return this._def.description}_getType(e){return A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new x,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ae(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Pe(n,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return V(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>V(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ae(s)?s:Promise.resolve(s));return Pe(n,a)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new O({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return T.create(this,this._def)}nullable(){return j.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return P.create(this)}promise(){return D.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return Y.create(this,e,this._def)}transform(e){return new O({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new te({...g(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new pe({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new re({...g(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return he.create(this,e)}readonly(){return ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},vt=/^c[^\s-]{8,}$/i,xt=/^[0-9a-z]+$/,kt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bt=/^[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,wt=/^[a-z0-9_-]{21}$/i,St=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tt=/^[-+]?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)?)??$/,Et=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ot="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,Ct=/^(?:(?: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])$/,Nt=/^(?:(?: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])$/,Rt=/^(([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]))$/,At=/^(([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])$/,It=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\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])))",$t=new RegExp(`^${ze}$`);function Le(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Mt(r){return new RegExp(`^${Le(r)}$`)}function De(r){let e=`${ze}T${Le(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Zt(r,e){return!!((e==="v4"||!e)&&Ct.test(r)||(e==="v6"||!e)&&Rt.test(r))}function Pt(r,e){if(!St.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Vt(r,e){return!!((e==="v4"||!e)&&Nt.test(r)||(e==="v6"||!e)&&At.test(r))}var z=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),h}let n=new x,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?d(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Et.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(Ot,"u")),Se.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")bt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")vt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")xt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")kt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?De(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?$t.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Mt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Zt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Pt(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Vt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?jt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.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,...p.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,...p.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};z.create=r=>new z({checks:[],typeName:m.ZodString,coerce:r?.coerce??!1,...g(r)});function zt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}var U=class r extends y{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)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),h}let n,s=new x;for(let a of this._def.checks)a.kind==="int"?_.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?zt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_finite,message:a.message}),s.dirty()):_.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};U.create=r=>new U({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...g(r)});var B=class r extends y{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)!==f.bigint)return this._getInvalidInput(e);let n,s=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):_.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),h}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};B.create=r=>new B({checks:[],typeName:m.ZodBigInt,coerce:r?.coerce??!1,...g(r)});var H=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),h}return k(e.data)}};H.create=r=>new H({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var W=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),h}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),h}let n=new x,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):_.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};W.create=r=>new W({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...g(r)});var oe=class extends y{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),h}return k(e.data)}};oe.create=r=>new oe({typeName:m.ZodSymbol,...g(r)});var q=class extends y{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),h}return k(e.data)}};q.create=r=>new q({typeName:m.ZodUndefined,...g(r)});var J=class extends y{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),h}return k(e.data)}};J.create=r=>new J({typeName:m.ZodNull,...g(r)});var L=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}};L.create=r=>new L({typeName:m.ZodAny,...g(r)});var Z=class extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}};Z.create=r=>new Z({typeName:m.ZodUnknown,...g(r)});var R=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),h}};R.create=r=>new R({typeName:m.ZodNever,...g(r)});var ce=class extends y{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),h}return k(e.data)}};ce.create=r=>new ce({typeName:m.ZodVoid,...g(r)});var P=class r extends y{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),h;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(d(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(d(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(d(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new E(t,i,t.path,o)))).then(i=>x.mergeArray(n,i));let a=[...t.data].map((i,o)=>s.type._parseSync(new E(t,i,t.path,o)));return x.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};P.create=(r,e)=>new P({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function ie(r){if(r instanceof w){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=T.create(ie(n))}return new w({...r._def,shape:()=>e})}else return r instanceof P?new P({...r._def,type:ie(r.element)}):r instanceof T?T.create(ie(r.unwrap())):r instanceof j?j.create(ie(r.unwrap())):r instanceof I?I.create(r.items.map(e=>ie(e))):r}var w=class r extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=_.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),h}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof R&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||o.push(l);let u=[];for(let l of i){let v=a[l],S=s.data[l];u.push({key:{status:"valid",value:l},value:v._parse(new E(s,S,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof R){let l=this._def.unknownKeys;if(l==="passthrough")for(let v of o)u.push({key:{status:"valid",value:v},value:{status:"valid",value:s.data[v]}});else if(l==="strict")o.length>0&&(d(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let v of o){let S=s.data[v];u.push({key:{status:"valid",value:v},value:l._parse(new E(s,S,s.path,v)),alwaysSet:v in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let v of u){let S=await v.key,Ee=await v.value;l.push({key:S,value:Ee,alwaysSet:v.alwaysSet})}return l}).then(l=>x.mergeObjectSync(n,l)):x.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of _.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of _.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return ie(this)}partial(e){let t={};for(let n of _.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of _.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof T;)a=a._def.innerType;t[n]=a}return new r({...this._def,shape:()=>t})}keyof(){return Fe(_.objectKeys(this.shape))}};w.create=(r,e)=>new w({shape:()=>r,unknownKeys:"strip",catchall:R.create(),typeName:m.ZodObject,...g(e)});w.strictCreate=(r,e)=>new w({shape:()=>r,unknownKeys:"strict",catchall:R.create(),typeName:m.ZodObject,...g(e)});w.lazycreate=(r,e)=>new w({shape:r,unknownKeys:"strip",catchall:R.create(),typeName:m.ZodObject,...g(e)});var K=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new b(o.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:i}),h}if(t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let u of n){let l={...t,common:{...t.common,issues:[]},parent:null},v=u._parseSync({data:t.data,path:t.path,parent:l});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new b(u));return d(t,{code:c.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};K.create=(r,e)=>new K({options:r,typeName:m.ZodUnion,...g(e)});var M=r=>r instanceof G?M(r.schema):r instanceof O?M(r.innerType()):r instanceof X?[r.value]:r instanceof Q?r.options:r instanceof ee?_.objectValues(r.enum):r instanceof te?M(r._def.innerType):r instanceof q?[void 0]:r instanceof J?[null]:r instanceof T?[void 0,...M(r.unwrap())]:r instanceof j?[null,...M(r.unwrap())]:r instanceof pe||r instanceof ne?M(r.unwrap()):r instanceof re?M(r._def.innerType):[],_e=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return d(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),h;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=M(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...g(n)})}};function Te(r,e){let t=A(r),n=A(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){let s=_.objectKeys(e),a=_.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let u=Te(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],u=Te(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Y=class extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(ge(a)||ge(i))return h;let o=Te(a.value,i.value);return o.valid?((ye(a)||ye(i))&&t.dirty(),{status:t.value,value:o.data}):(d(n,{code:c.invalid_intersection_types}),h)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Y.create=(r,e,t)=>new Y({left:r,right:e,typeName:m.ZodIntersection,...g(t)});var I=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return d(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),h;if(n.data.length<this._def.items.length)return d(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new E(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>x.mergeArray(t,i)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:r,typeName:m.ZodTuple,rest:null,...g(e)})};var ve=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return d(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),h;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new E(n,o,n.path,o)),value:i._parse(new E(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?x.mergeObjectAsync(t,s):x.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof y?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...g(n)}):new r({keyType:z.create(),valueType:e,typeName:m.ZodRecord,...g(t)})}},ue=class extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return d(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),h;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],l)=>({key:s._parse(new E(n,o,n.path,[l,"key"])),value:a._parse(new E(n,u,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let l=await u.key,v=await u.value;if(l.status==="aborted"||v.status==="aborted")return h;(l.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(l.value,v.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let u of i){let l=u.key,v=u.value;if(l.status==="aborted"||v.status==="aborted")return h;(l.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(l.value,v.value)}return{status:t.value,value:o}}}};ue.create=(r,e,t)=>new ue({valueType:e,keyType:r,typeName:m.ZodMap,...g(t)});var de=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return d(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),h;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(d(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(d(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(u){let l=new Set;for(let v of u){if(v.status==="aborted")return h;v.status==="dirty"&&t.dirty(),l.add(v.value)}return{status:t.value,value:l}}let o=[...n.data.values()].map((u,l)=>a._parse(new E(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};de.create=(r,e)=>new de({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});var xe=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return d(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),h;function n(o,u){return fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,se(),$].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:u}})}function s(o,u){return fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,se(),$].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof D){let o=this;return k(async function(...u){let l=new b([]),v=await o._def.args.parseAsync(u,a).catch(ke=>{throw l.addIssue(n(u,ke)),l}),S=await Reflect.apply(i,this,v);return await o._def.returns._def.type.parseAsync(S,a).catch(ke=>{throw l.addIssue(s(S,ke)),l})})}else{let o=this;return k(function(...u){let l=o._def.args.safeParse(u,a);if(!l.success)throw new b([n(u,l.error)]);let v=Reflect.apply(i,this,l.data),S=o._def.returns.safeParse(v,a);if(!S.success)throw new b([s(v,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:I.create(e).rest(Z.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||I.create([]).rest(Z.create()),returns:t||Z.create(),typeName:m.ZodFunction,...g(n)})}},G=class extends y{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};G.create=(r,e)=>new G({getter:r,typeName:m.ZodLazy,...g(e)});var X=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:m.ZodLiteral,...g(e)});function Fe(r,e){return new Q({values:r,typeName:m.ZodEnum,...g(e)})}var Q=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{expected:_.joinValues(n),received:t.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:n}),h}return k(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Q.create=Fe;var ee=class extends y{_parse(e){let t=_.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let s=_.objectValues(t);return d(n,{expected:_.joinValues(s),received:n.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(_.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=_.objectValues(t);return d(n,{received:n.data,code:c.invalid_enum_value,options:s}),h}return k(e.data)}get enum(){return this._def.values}};ee.create=(r,e)=>new ee({values:r,typeName:m.ZodNativeEnum,...g(e)});var D=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),h;let n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return k(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};D.create=(r,e)=>new D({type:r,typeName:m.ZodPromise,...g(e)});var O=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{d(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return h;let u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?h:u.status==="dirty"?F(u.value):t.value==="dirty"?F(u.value):u});{if(t.value==="aborted")return h;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?h:o.status==="dirty"?F(o.value):t.value==="dirty"?F(o.value):o}}if(s.type==="refinement"){let i=o=>{let u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!V(i))return h;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>V(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):h);_.assertNever(s)}};O.create=(r,e,t)=>new O({schema:r,typeName:m.ZodEffects,effect:e,...g(t)});O.createWithPreprocess=(r,e,t)=>new O({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...g(t)});var T=class extends y{_parse(e){return this._getType(e)===f.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};T.create=(r,e)=>new T({innerType:r,typeName:m.ZodOptional,...g(e)});var j=class extends y{_parse(e){return this._getType(e)===f.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};j.create=(r,e)=>new j({innerType:r,typeName:m.ZodNullable,...g(e)});var te=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var re=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ae(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var le=class extends y{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),h}return{status:"valid",value:e.data}}};le.create=r=>new le({typeName:m.ZodNaN,...g(r)});var Lt=Symbol("zod_brand"),pe=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},he=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?h:a.status==="dirty"?(t.dirty(),F(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?h:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},ne=class extends y{_parse(e){let t=this._def.innerType._parse(e),n=s=>(V(s)&&(s.value=Object.freeze(s.value)),s);return ae(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}};ne.create=(r,e)=>new ne({innerType:r,typeName:m.ZodReadonly,...g(e)});function Ve(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Ue(r,e={},t){return r?L.create().superRefine((n,s)=>{let a=r(n);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Ve(e,n),u=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:u})}});if(!a){let i=Ve(e,n),o=i.fatal??t??!0;s.addIssue({code:"custom",...i,fatal:o})}}):L.create()}var Dt={object:w.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var Ft=(r,e={message:`Input not instance of ${r.name}`})=>Ue(t=>t instanceof r,e),Be=z.create,He=U.create,Ut=le.create,Bt=B.create,We=H.create,Ht=W.create,Wt=oe.create,qt=q.create,Jt=J.create,Kt=L.create,Yt=Z.create,Gt=R.create,Xt=ce.create,Qt=P.create,er=w.create,tr=w.strictCreate,rr=K.create,nr=_e.create,sr=Y.create,ar=I.create,ir=ve.create,or=ue.create,cr=de.create,ur=xe.create,dr=G.create,lr=X.create,fr=Q.create,pr=ee.create,hr=D.create,mr=O.create,gr=T.create,yr=j.create,_r=O.createWithPreprocess,vr=he.create,xr=()=>Be().optional(),kr=()=>He().optional(),br=()=>We().optional(),wr={string:(r=>z.create({...r,coerce:!0})),number:(r=>U.create({...r,coerce:!0})),boolean:(r=>H.create({...r,coerce:!0})),bigint:(r=>B.create({...r,coerce:!0})),date:(r=>W.create({...r,coerce:!0}))};var Sr=h;var Tr=C.enum(["normal","compact","minimal"]),Er=C.enum(["off","light","balanced","max"]),me=C.object({enabled:C.boolean().default(!0),telemetryOptIn:C.boolean().default(!0),outputVerbosity:Tr.default("compact"),reducer:Er.default("off"),filters:C.object({enableAll:C.boolean().default(!0),disabled:C.array(C.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})});var Nr="settings-cache.json",qe=me.parse({}),cs=me.partial().extend({filters:me.shape.filters.removeDefault().partial().optional()});async function Je(){let r=null;try{let e=JSON.parse(await Or(Cr(N(),Nr),"utf8"));typeof e=="object"&&e!==null&&!Array.isArray(e)&&(r=e)}catch{}return r?me.parse({...qe,...r}):qe}import{existsSync as Rr,mkdirSync as ls,rmSync as fs,writeFileSync as ps}from"node:fs";import{join as Ar}from"node:path";var Ir=new Set(["0","off","false","no"]);var gs=["Tokmizer contacts tokmizer.com to keep its rules up to date and to improve the product. No account or email is needed.","It sends a random install ID, your computer name, OS and CPU model, a hash of your network card address and of your user name, and the plugin version. Command contents and output are never sent.","Usage stats (command names, token counts and install health counts) are sent only while they are on. Check with: tkr telemetry status.","Turn all network access off: tkr network off. Usage stats only: tkr telemetry off."].join(`
5
- `);function jr(){return Ar(N(),"network-off")}function $r(){let r=process.env.TOKMIZER_NETWORK;return r!==void 0&&Ir.has(r.trim().toLowerCase())}function Ke(){return $r()?!1:!Rr(jr())}import{createRequire as Mr}from"node:module";var Zr=Mr(import.meta.url);function Pr(){let r="0.9.59";if(r)return r;for(let e of["../package.json","../../package.json"])try{let t=Zr(e).version;if(typeof t=="string"&&t)return t}catch{}return"0.0.0"}var Ye=Pr();var Dr="telemetry-notice-shown";var Fr="Tokmizer sends usage stats (command names and tokens saved, never content, files or arguments) to improve the product. No account or email needed. To turn off: tkr telemetry off (or tkr network off to cut all network access).";function Ge(){return Lr(N(),Dr)}function Ur(r,e){if(Xe(r))return!1;try{Vr(N(),{recursive:!0}),zr(r,e,{mode:384})}catch{return!1}return!0}async function Qe(){return!Ke()||Xe(Ge())||!(await Je()).telemetryOptIn?null:Ur(Ge(),`${Ye} ${Date.now()}`)?Fr:null}async function Br(r){if(r.source!=="compact"&&r.source!=="resume"||!r.session_id)return null;let e=Ie(r.session_id);return $e(e)||null}async function Hr(){let r=await Oe();r||process.exit(0);let e;try{e=JSON.parse(r)}catch{process.exit(0)}let t=Wr(await qr(e),await Qe().catch(()=>null));t&&process.stdout.write(t)}function Wr(r,e){return e?JSON.stringify({systemMessage:e,...r?{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:r}}:{}}):r}async function qr(r){try{je()}catch{}return r.session_id&&r.source!=="startup"&&Me(r.session_id),Br(r)}var Jr=process.argv[1]??"";Re(Jr,import.meta.url,"session-recap")&&Hr().catch(()=>{process.exit(0)});export{qr as handleSessionStart,Br as recapForSessionStart,Wr as sessionStartOutput};
5
+ `);function jr(){return Ar(N(),"network-off")}function $r(){let r=process.env.TOKMIZER_NETWORK;return r!==void 0&&Ir.has(r.trim().toLowerCase())}function Ke(){return $r()?!1:!Rr(jr())}import{createRequire as Mr}from"node:module";var Zr=Mr(import.meta.url);function Pr(){let r="0.9.61";if(r)return r;for(let e of["../package.json","../../package.json"])try{let t=Zr(e).version;if(typeof t=="string"&&t)return t}catch{}return"0.0.0"}var Ye=Pr();var Dr="telemetry-notice-shown";var Fr="Tokmizer sends usage stats (command names and tokens saved, never content, files or arguments) to improve the product. No account or email needed. To turn off: tkr telemetry off (or tkr network off to cut all network access).";function Ge(){return Lr(N(),Dr)}function Ur(r,e){if(Xe(r))return!1;try{Vr(N(),{recursive:!0}),zr(r,e,{mode:384})}catch{return!1}return!0}async function Qe(){return!Ke()||Xe(Ge())||!(await Je()).telemetryOptIn?null:Ur(Ge(),`${Ye} ${Date.now()}`)?Fr:null}async function Br(r){if(r.source!=="compact"&&r.source!=="resume"||!r.session_id)return null;let e=Ie(r.session_id);return $e(e)||null}async function Hr(){let r=await Oe();r||process.exit(0);let e;try{e=JSON.parse(r)}catch{process.exit(0)}let t=Wr(await qr(e),await Qe().catch(()=>null));t&&process.stdout.write(t)}function Wr(r,e){return e?JSON.stringify({systemMessage:e,...r?{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:r}}:{}}):r}async function qr(r){try{je()}catch{}return r.session_id&&r.source!=="startup"&&Me(r.session_id),Br(r)}var Jr=process.argv[1]??"";Re(Jr,import.meta.url,"session-recap")&&Hr().catch(()=>{process.exit(0)});export{qr as handleSessionStart,Br as recapForSessionStart,Wr as sessionStartOutput};