@tokmizer/plugin 0.9.52 → 0.9.54

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.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __tkrCreateRequire } from "node:module"; const require = __tkrCreateRequire(import.meta.url);
3
- var Bt=Object.defineProperty;var x=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(s){throw r=[s],s}};var Te=(t,e)=>{for(var r in e)Bt(t,r,{get:e[r],enumerable:!0})};import Ke from"node:os";import{join as U}from"node:path";function k(){return process.env.TOKMIZER_HOME||U(Ke.homedir(),".tokmizer")}function Ae(){return U(k(),"bundle-refresh.json")}function Ee(){return U(k(),"skills")}function B(t){return U(Ee(),`${t}.md`)}function Ve(){return U(k(),"managed-commands.json")}function Fe(){return process.env.TOKMIZER_CLAUDE_COMMANDS_DIR||U(Ke.homedir(),".claude","commands")}function q(t){return U(Fe(),`${t}.md`)}var _e=x(()=>{"use strict"});var v,Le,f,j,ve=x(()=>{(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},t.getValidEnumValues=n=>{let a=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},t.find=(n,a)=>{for(let i of n)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Le||(Le={}));f=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),j=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(t)?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(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}}});var c,Jt,T,Ce=x(()=>{ve();c=v.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"]),Jt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),T=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let 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(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,d=0;for(;d<i.path.length;){let l=i.path[d];d===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],d++}}};return n(this),s}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,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];r[a]=r[a]||[],r[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};T.create=t=>new T(t)});var Wt,P,ze=x(()=>{Ce();ve();Wt=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===f.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${v.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${v.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${v.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}"`:v.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,v.assertNever(t)}return{message:r}},P=Wt});function Gt(t){Qe=t}function ce(){return Qe}var Qe,Oe=x(()=>{ze();Qe=P});function u(t,e){let r=ce(),s=xe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===P?void 0:P].filter(n=>!!n)});t.common.issues.push(s)}var xe,Yt,b,h,H,w,Re,Ne,V,ue,Ue=x(()=>{Oe();ze();xe=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",d=s.filter(l=>!!l).slice().reverse();for(let l of d)o=l(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Yt=[];b=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 s=[];for(let n of r){if(n.status==="aborted")return h;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:a,value:i}=n;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"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},h=Object.freeze({status:"aborted"}),H=t=>({status:"dirty",value:t}),w=t=>({status:"valid",value:t}),Re=t=>t.status==="aborted",Ne=t=>t.status==="dirty",V=t=>t.status==="valid",ue=t=>typeof Promise<"u"&&t instanceof Promise});var et=x(()=>{});var p,tt=x(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}))});function y(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))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:(i,o)=>{let{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??r??o.defaultError}},description:n}}function at(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 pr(t){return new RegExp(`^${at(t)}$`)}function it(t){let e=`${nt}T${at(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 hr(t,e){return!!((e==="v4"||!e)&&ir.test(t)||(e==="v6"||!e)&&cr.test(t))}function mr(t,e){if(!rr.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function gr(t,e){return!!((e==="v4"||!e)&&or.test(t)||(e==="v6"||!e)&&ur.test(t))}function yr(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}function de(t){if(t instanceof A){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=E.create(de(s))}return new A({...t._def,shape:()=>e})}else return t instanceof D?new D({...t._def,type:de(t.element)}):t instanceof E?E.create(de(t.unwrap())):t instanceof M?M.create(de(t.unwrap())):t instanceof I?I.create(t.items.map(e=>de(e))):t}function qe(t,e){let r=j(t),s=j(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&s===f.object){let n=v.objectKeys(e),a=v.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(let o of a){let d=qe(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(r===f.array&&s===f.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<t.length;a++){let i=t[a],o=e[a],d=qe(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===f.date&&s===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function ot(t,e){return new se({values:t,typeName:m.ZodEnum,...y(e)})}function st(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function ct(t,e={},r){return t?L.create().superRefine((s,n)=>{let a=t(s);if(a instanceof Promise)return a.then(i=>{if(!i){let o=st(e,s),d=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){let i=st(e,s),o=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:o})}}):L.create()}var C,rt,_,Kt,Xt,Qt,er,tr,rr,sr,nr,ar,Be,ir,or,cr,ur,dr,lr,nt,fr,F,J,W,G,Y,le,K,X,L,Z,N,fe,D,A,Q,$,je,ee,I,Ie,pe,he,Me,te,re,se,ne,z,O,E,M,ae,ie,me,_r,be,ke,oe,vr,m,xr,ut,dt,br,kr,lt,wr,Sr,Tr,Ar,Er,Cr,Or,Rr,Nr,jr,Ir,Mr,Pr,$r,Zr,Dr,Vr,Fr,Lr,zr,Ur,Br,qr,Hr,Jr,Wr,Gr,Yr,Kr,Xr,Qr,es,ts,rs,ft=x(()=>{Ce();Oe();tt();Ue();ve();C=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,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}},rt=(t,e)=>{if(V(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 T(t.common.issues);return this._error=r,this._error}}};_=class{get description(){return this._def.description}_getType(e){return j(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:j(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 s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},n=this._parseSync({data:e,path:s.path,parent:s});return rt(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return V(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>V(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ue(n)?n:Promise.resolve(n));return rt(s,a)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!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:r=>this["~validate"](r)}}optional(){return E.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return z.create(this,this._def)}or(e){return Q.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new O({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ae({...y(this._def),innerType:this,defaultValue:r,typeName:m.ZodDefault})}brand(){return new be({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ie({...y(this._def),innerType:this,catchValue:r,typeName:m.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ke.create(this,e)}readonly(){return oe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Kt=/^c[^\s-]{8,}$/i,Xt=/^[0-9a-z]+$/,Qt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,er=/^[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,tr=/^[a-z0-9_-]{21}$/i,rr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sr=/^[-+]?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)?)??$/,nr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ar="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ir=/^(?:(?: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])$/,or=/^(?:(?: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])$/,cr=/^(([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]))$/,ur=/^(([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])$/,dr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nt="((\\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])))",fr=new RegExp(`^${nt}$`);F=class t extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),h}let s=new b,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")nr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Be||(Be=new RegExp(ar,"u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")er.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")tr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Kt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Xt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Qt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),u(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.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)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?it(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?fr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?pr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?sr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?hr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?mr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?gr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?dr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?lr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:c.invalid_string,...p.errToObj(s)})}_addCheck(e){return new t({...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,r){return this._addCheck({kind:"regex",regex:e,...p.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...p.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...p.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...p.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...p.errToObj(r)})}nonempty(e){return this.min(1,p.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}};F.create=t=>new F({checks:[],typeName:m.ZodString,coerce:t?.coerce??!1,...y(t)});J=class t extends _{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 u(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),h}let s,n=new b;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?yr(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,p.toString(r))}gt(e,r){return this.setLimit("min",e,!1,p.toString(r))}lte(e,r){return this.setLimit("max",e,!0,p.toString(r))}lt(e,r){return this.setLimit("max",e,!1,p.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new t({...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,r){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(r)})}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 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"&&v.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};J.create=t=>new J({checks:[],typeName:m.ZodNumber,coerce:t?.coerce||!1,...y(t)});W=class t extends _{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 s,n=new b;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.bigint,received:r.parsedType}),h}gte(e,r){return this.setLimit("min",e,!0,p.toString(r))}gt(e,r){return this.setLimit("min",e,!1,p.toString(r))}lte(e,r){return this.setLimit("max",e,!0,p.toString(r))}lt(e,r){return this.setLimit("max",e,!1,p.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:p.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: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,r){return this._addCheck({kind:"multipleOf",value:e,message:p.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}};W.create=t=>new W({checks:[],typeName:m.ZodBigInt,coerce:t?.coerce??!1,...y(t)});G=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),h}return w(e.data)}};G.create=t=>new G({typeName:m.ZodBoolean,coerce:t?.coerce||!1,...y(t)});Y=class t extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),h}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_date}),h}let s=new b,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):v.assertNever(a);return{status:s.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:p.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:p.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}};Y.create=t=>new Y({checks:[],coerce:t?.coerce||!1,typeName:m.ZodDate,...y(t)});le=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),h}return w(e.data)}};le.create=t=>new le({typeName:m.ZodSymbol,...y(t)});K=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),h}return w(e.data)}};K.create=t=>new K({typeName:m.ZodUndefined,...y(t)});X=class extends _{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),h}return w(e.data)}};X.create=t=>new X({typeName:m.ZodNull,...y(t)});L=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};L.create=t=>new L({typeName:m.ZodAny,...y(t)});Z=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};Z.create=t=>new Z({typeName:m.ZodUnknown,...y(t)});N=class extends _{_parse(e){let r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.never,received:r.parsedType}),h}};N.create=t=>new N({typeName:m.ZodNever,...y(t)});fe=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),h}return w(e.data)}};fe.create=t=>new fe({typeName:m.ZodVoid,...y(t)});D=class t extends _{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==f.array)return u(r,{code:c.invalid_type,expected:f.array,received:r.parsedType}),h;if(n.exactLength!==null){let i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(u(r,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(u(r,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(u(r,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new C(r,i,r.path,o)))).then(i=>b.mergeArray(s,i));let a=[...r.data].map((i,o)=>n.type._parseSync(new C(r,i,r.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:p.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:p.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:p.toString(r)}})}nonempty(e){return this.min(1,e)}};D.create=(t,e)=>new D({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});A=class t extends _{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=v.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return u(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),h}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(let l in n.data)i.includes(l)||o.push(l);let d=[];for(let l of i){let g=a[l],S=n.data[l];d.push({key:{status:"valid",value:l},value:g._parse(new C(n,S,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof N){let l=this._def.unknownKeys;if(l==="passthrough")for(let g of o)d.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")o.length>0&&(u(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let g of o){let S=n.data[g];d.push({key:{status:"valid",value:g},value:l._parse(new C(n,S,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let g of d){let S=await g.key,Ye=await g.value;l.push({key:S,value:Ye,alwaysSet:g.alwaysSet})}return l}).then(l=>b.mergeObjectSync(s,l)):b.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:p.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:m.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of v.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of v.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return de(this)}partial(e){let r={};for(let s of v.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of v.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof E;)a=a._def.innerType;r[s]=a}return new t({...this._def,shape:()=>r})}keyof(){return ot(v.objectKeys(this.shape))}};A.create=(t,e)=>new A({shape:()=>t,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,...y(e)});A.strictCreate=(t,e)=>new A({shape:()=>t,unknownKeys:"strict",catchall:N.create(),typeName:m.ZodObject,...y(e)});A.lazycreate=(t,e)=>new A({shape:t,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,...y(e)});Q=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(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 r.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return u(r,{code:c.invalid_union,unionErrors:i}),h}if(r.common.async)return Promise.all(s.map(async a=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let d of s){let l={...r,common:{...r.common,issues:[]},parent:null},g=d._parseSync({data:r.data,path:r.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(d=>new T(d));return u(r,{code:c.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};Q.create=(t,e)=>new Q({options:t,typeName:m.ZodUnion,...y(e)});$=t=>t instanceof te?$(t.schema):t instanceof O?$(t.innerType()):t instanceof re?[t.value]:t instanceof se?t.options:t instanceof ne?v.objectValues(t.enum):t instanceof ae?$(t._def.innerType):t instanceof K?[void 0]:t instanceof X?[null]:t instanceof E?[void 0,...$(t.unwrap())]:t instanceof M?[null,...$(t.unwrap())]:t instanceof be||t instanceof oe?$(t.unwrap()):t instanceof ie?$(t._def.innerType):[],je=class t extends _{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return u(r,{code:c.invalid_type,expected:f.object,received:r.parsedType}),h;let s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(u(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let a of r){let i=$(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(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new t({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...y(s)})}};ee=class extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Re(a)||Re(i))return h;let o=qe(a.value,i.value);return o.valid?((Ne(a)||Ne(i))&&r.dirty(),{status:r.value,value:o.data}):(u(s,{code:c.invalid_intersection_types}),h)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ee.create=(t,e,r)=>new ee({left:t,right:e,typeName:m.ZodIntersection,...y(r)});I=class t extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return u(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),h;if(s.data.length<this._def.items.length)return u(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&s.data.length>this._def.items.length&&(u(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...s.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new C(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(r,i)):b.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};I.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:t,typeName:m.ZodTuple,rest:null,...y(e)})};Ie=class t extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return u(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),h;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new C(s,o,s.path,o)),value:i._parse(new C(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?b.mergeObjectAsync(r,n):b.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof _?new t({keyType:e,valueType:r,typeName:m.ZodRecord,...y(s)}):new t({keyType:F.create(),valueType:e,typeName:m.ZodRecord,...y(r)})}},pe=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return u(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),h;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],l)=>({key:n._parse(new C(s,o,s.path,[l,"key"])),value:a._parse(new C(s,d,s.path,[l,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let l=await d.key,g=await d.value;if(l.status==="aborted"||g.status==="aborted")return h;(l.status==="dirty"||g.status==="dirty")&&r.dirty(),o.set(l.value,g.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let d of i){let l=d.key,g=d.value;if(l.status==="aborted"||g.status==="aborted")return h;(l.status==="dirty"||g.status==="dirty")&&r.dirty(),o.set(l.value,g.value)}return{status:r.value,value:o}}}};pe.create=(t,e,r)=>new pe({valueType:e,keyType:t,typeName:m.ZodMap,...y(r)});he=class t extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return u(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),h;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(u(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(u(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let a=this._def.valueType;function i(d){let l=new Set;for(let g of d){if(g.status==="aborted")return h;g.status==="dirty"&&r.dirty(),l.add(g.value)}return{status:r.value,value:l}}let o=[...s.data.values()].map((d,l)=>a._parse(new C(s,d,s.path,l)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:p.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:p.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};he.create=(t,e)=>new he({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});Me=class t extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return u(r,{code:c.invalid_type,expected:f.function,received:r.parsedType}),h;function s(o,d){return xe({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),P].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return xe({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),P].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:d}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof z){let o=this;return w(async function(...d){let l=new T([]),g=await o._def.args.parseAsync(d,a).catch(De=>{throw l.addIssue(s(d,De)),l}),S=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(S,a).catch(De=>{throw l.addIssue(n(S,De)),l})})}else{let o=this;return w(function(...d){let l=o._def.args.safeParse(d,a);if(!l.success)throw new T([s(d,l.error)]);let g=Reflect.apply(i,this,l.data),S=o._def.returns.safeParse(g,a);if(!S.success)throw new T([n(g,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:I.create(e).rest(Z.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,s){return new t({args:e||I.create([]).rest(Z.create()),returns:r||Z.create(),typeName:m.ZodFunction,...y(s)})}},te=class extends _{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})}};te.create=(t,e)=>new te({getter:t,typeName:m.ZodLazy,...y(e)});re=class extends _{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return u(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};re.create=(t,e)=>new re({value:t,typeName:m.ZodLiteral,...y(e)});se=class t extends _{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return u(r,{expected:v.joinValues(s),received:r.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return u(r,{received:r.data,code:c.invalid_enum_value,options:s}),h}return w(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(s=>!e.includes(s)),{...this._def,...r})}};se.create=ot;ne=class extends _{_parse(e){let r=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=v.objectValues(r);return u(s,{expected:v.joinValues(n),received:s.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(r);return u(s,{received:s.data,code:c.invalid_enum_value,options:n}),h}return w(e.data)}get enum(){return this._def.values}};ne.create=(t,e)=>new ne({values:t,typeName:m.ZodNativeEnum,...y(e)});z=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.promise&&r.common.async===!1)return u(r,{code:c.invalid_type,expected:f.promise,received:r.parsedType}),h;let s=r.parsedType===f.promise?r.data:Promise.resolve(r.data);return w(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};z.create=(t,e)=>new z({type:t,typeName:m.ZodPromise,...y(e)});O=class extends _{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:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{u(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return h;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?h:d.status==="dirty"?H(d.value):r.value==="dirty"?H(d.value):d});{if(r.value==="aborted")return h;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?h:o.status==="dirty"?H(o.value):r.value==="dirty"?H(o.value):o}}if(n.type==="refinement"){let i=o=>{let d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?h:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!V(i))return h;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>V(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:r.value,value:o})):h);v.assertNever(n)}};O.create=(t,e,r)=>new O({schema:t,typeName:m.ZodEffects,effect:e,...y(r)});O.createWithPreprocess=(t,e,r)=>new O({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...y(r)});E=class extends _{_parse(e){return this._getType(e)===f.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(t,e)=>new E({innerType:t,typeName:m.ZodOptional,...y(e)});M=class extends _{_parse(e){return this._getType(e)===f.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:m.ZodNullable,...y(e)});ae=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ae.create=(t,e)=>new ae({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});ie=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ue(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};ie.create=(t,e)=>new ie({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});me=class extends _{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),h}return{status:"valid",value:e.data}}};me.create=t=>new me({typeName:m.ZodNaN,...y(t)});_r=Symbol("zod_brand"),be=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},ke=class t extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?h:a.status==="dirty"?(r.dirty(),H(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?h:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:m.ZodPipeline})}},oe=class extends _{_parse(e){let r=this._def.innerType._parse(e),s=n=>(V(n)&&(n.value=Object.freeze(n.value)),n);return ue(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};oe.create=(t,e)=>new oe({innerType:t,typeName:m.ZodReadonly,...y(e)});vr={object:A.lazycreate};(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"})(m||(m={}));xr=(t,e={message:`Input not instance of ${t.name}`})=>ct(r=>r instanceof t,e),ut=F.create,dt=J.create,br=me.create,kr=W.create,lt=G.create,wr=Y.create,Sr=le.create,Tr=K.create,Ar=X.create,Er=L.create,Cr=Z.create,Or=N.create,Rr=fe.create,Nr=D.create,jr=A.create,Ir=A.strictCreate,Mr=Q.create,Pr=je.create,$r=ee.create,Zr=I.create,Dr=Ie.create,Vr=pe.create,Fr=he.create,Lr=Me.create,zr=te.create,Ur=re.create,Br=se.create,qr=ne.create,Hr=z.create,Jr=O.create,Wr=E.create,Gr=M.create,Yr=O.createWithPreprocess,Kr=ke.create,Xr=()=>ut().optional(),Qr=()=>dt().optional(),es=()=>lt().optional(),ts={string:(t=>F.create({...t,coerce:!0})),number:(t=>J.create({...t,coerce:!0})),boolean:(t=>G.create({...t,coerce:!0})),bigint:(t=>W.create({...t,coerce:!0})),date:(t=>Y.create({...t,coerce:!0}))},rs=h});var R={};Te(R,{BRAND:()=>_r,DIRTY:()=>H,EMPTY_PATH:()=>Yt,INVALID:()=>h,NEVER:()=>rs,OK:()=>w,ParseStatus:()=>b,Schema:()=>_,ZodAny:()=>L,ZodArray:()=>D,ZodBigInt:()=>W,ZodBoolean:()=>G,ZodBranded:()=>be,ZodCatch:()=>ie,ZodDate:()=>Y,ZodDefault:()=>ae,ZodDiscriminatedUnion:()=>je,ZodEffects:()=>O,ZodEnum:()=>se,ZodError:()=>T,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>Me,ZodIntersection:()=>ee,ZodIssueCode:()=>c,ZodLazy:()=>te,ZodLiteral:()=>re,ZodMap:()=>pe,ZodNaN:()=>me,ZodNativeEnum:()=>ne,ZodNever:()=>N,ZodNull:()=>X,ZodNullable:()=>M,ZodNumber:()=>J,ZodObject:()=>A,ZodOptional:()=>E,ZodParsedType:()=>f,ZodPipeline:()=>ke,ZodPromise:()=>z,ZodReadonly:()=>oe,ZodRecord:()=>Ie,ZodSchema:()=>_,ZodSet:()=>he,ZodString:()=>F,ZodSymbol:()=>le,ZodTransformer:()=>O,ZodTuple:()=>I,ZodType:()=>_,ZodUndefined:()=>K,ZodUnion:()=>Q,ZodUnknown:()=>Z,ZodVoid:()=>fe,addIssueToContext:()=>u,any:()=>Er,array:()=>Nr,bigint:()=>kr,boolean:()=>lt,coerce:()=>ts,custom:()=>ct,date:()=>wr,datetimeRegex:()=>it,defaultErrorMap:()=>P,discriminatedUnion:()=>Pr,effect:()=>Jr,enum:()=>Br,function:()=>Lr,getErrorMap:()=>ce,getParsedType:()=>j,instanceof:()=>xr,intersection:()=>$r,isAborted:()=>Re,isAsync:()=>ue,isDirty:()=>Ne,isValid:()=>V,late:()=>vr,lazy:()=>zr,literal:()=>Ur,makeIssue:()=>xe,map:()=>Vr,nan:()=>br,nativeEnum:()=>qr,never:()=>Or,null:()=>Ar,nullable:()=>Gr,number:()=>dt,object:()=>jr,objectUtil:()=>Le,oboolean:()=>es,onumber:()=>Qr,optional:()=>Wr,ostring:()=>Xr,pipeline:()=>Kr,preprocess:()=>Yr,promise:()=>Hr,quotelessJson:()=>Jt,record:()=>Dr,set:()=>Fr,setErrorMap:()=>Gt,strictObject:()=>Ir,string:()=>ut,symbol:()=>Sr,transformer:()=>Jr,tuple:()=>Zr,undefined:()=>Tr,union:()=>Mr,unknown:()=>Cr,util:()=>v,void:()=>Rr});var He=x(()=>{Oe();Ue();et();ve();ft();Ce()});var pt=x(()=>{He();He()});var ss,ns,ge,ht=x(()=>{"use strict";pt();ss=R.enum(["normal","compact","minimal"]),ns=R.enum(["off","light","balanced","max"]),ge=R.object({enabled:R.boolean().default(!0),telemetryOptIn:R.boolean().default(!0),outputVerbosity:ss.default("compact"),reducer:ns.default("off"),filters:R.object({enableAll:R.boolean().default(!0),disabled:R.array(R.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})})});var St={};Te(St,{clearSettingsCache:()=>ds,loadSettingsCache:()=>kt,saveSettingsCache:()=>wt,updateSettingsCache:()=>us});import{readFile as _t,writeFile as vt,mkdir as xt,chmod as as,rm as we,rename as bt,readdir as is}from"node:fs/promises";import{randomUUID as os}from"node:crypto";import{join as ye}from"node:path";import{setTimeout as mt}from"node:timers/promises";async function kt(){try{let t=await _t(ye(k(),Je),"utf8"),e=JSON.parse(t);return ge.parse({...gt,...e})}catch{return gt}}async function wt(t){await xt(k(),{recursive:!0});let e=ye(k(),Je),r=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;await vt(r,JSON.stringify(t,null,2),{mode:384});try{await as(r,384),await bt(r,e)}catch(s){try{await we(r,{force:!0})}catch{}throw s}}async function yt(t){let e=[];for(let r of await is(t)){let s=/^([1-9]\d*)-[0-9a-f-]{36}\.json$/.exec(r);if(!s)continue;let n=ye(t,r);try{process.kill(Number(s[1]),0)}catch(a){let i=a.code;if(i==="ESRCH"){await we(n,{force:!0});continue}if(i!=="EPERM")throw a}try{let a=JSON.parse(await _t(n,"utf8"));if(!Number.isSafeInteger(a)||a<0)throw new Error("Invalid local settings lock");e.push({id:r,ticket:a})}catch(a){if(a.code!=="ENOENT")throw a}}return e}async function us(t){let e=cs.parse(t),r=ye(k(),"settings-cache-locks");await xt(r,{recursive:!0,mode:448});let s=`${process.pid}-${os()}.json`,n=ye(r,s),a=`${n}.tmp`,i=performance.now()+3e3,o=async d=>{for(await vt(a,String(d),{mode:384});;)try{await bt(a,n);return}catch(l){let g=l.code;if(process.platform!=="win32"||g!=="EPERM"&&g!=="EBUSY"||performance.now()>=i)throw l;await mt(10)}};try{await o(0);let d=Math.max(0,...(await yt(r)).map(l=>l.ticket))+1;if(!Number.isSafeInteger(d))throw new Error("Invalid local settings lock");for(await o(d);;){if(!(await yt(r)).some(g=>g.id!==s&&(g.ticket===0||g.ticket<d||g.ticket===d&&g.id<s))){let g=await kt(),S=ge.parse({...g,...e,filters:{...g.filters,...e.filters}});return await wt(S),S}if(performance.now()>=i)throw new Error("Timed out waiting for local settings lock after 3 seconds; another process may still be updating settings");await mt(10)}}finally{await Promise.all([we(n,{force:!0}),we(a,{force:!0})])}}async function ds(){try{await we(ye(k(),Je),{force:!0})}catch{}}var Je,gt,cs,Tt=x(()=>{"use strict";ht();_e();Je="settings-cache.json",gt=ge.parse({}),cs=ge.partial().extend({filters:ge.shape.filters.removeDefault().partial().optional()})});var It={};Te(It,{STATIC_COMMAND_NAMES:()=>Pe,commandInstalled:()=>jt,commandsInstallStatus:()=>vs,installCommand:()=>ys,isFresh:()=>hs,pruneCommands:()=>_s,pruneSkills:()=>gs,readBundleRefresh:()=>bs,readSkill:()=>ks,recordBundleRefresh:()=>xs,writeSkill:()=>ms});import{chmod as We,mkdir as $e,readFile as Se,writeFile as Ze,stat as Ge,readdir as ls,rm as Et}from"node:fs/promises";async function Ot(){try{let t=JSON.parse(await Se(Ve(),"utf8"));return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}catch{return[]}}async function Rt(t){try{await $e(k(),{recursive:!0}),await Ze(Ve(),JSON.stringify(t),{mode:384})}catch{}}function Nt(){let t=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(t)&&t>0?Math.min(t,At):At}async function hs(t){try{let e=await Ge(B(t)),r=Date.now()-e.mtimeMs;return r<ps&&r<=Nt()}catch{return!1}}async function ms(t,e){await $e(Ee(),{recursive:!0}),await Ze(B(t),e,{mode:384}),await We(B(t),384)}async function gs(t){let e=new Set(t),r;try{r=await ls(Ee())}catch{return}for(let s of r){if(!s.endsWith(".md"))continue;let n=s.slice(0,-3);if(!e.has(n))try{await Et(B(n))}catch{}}}async function ys(t,e){await $e(Fe(),{recursive:!0});try{if(!(await Se(q(t),"utf8")).includes(Ct))return}catch{}await Ze(q(t),e,{mode:384}),await We(q(t),384);let r=await Ot();r.includes(t)||await Rt([...r,t])}async function _s(t){let e=new Set([...t,...Pe]),r=await Ot(),s=new Set([...r,...fs]);for(let n of s)if(!e.has(n))try{if(!(await Se(q(n),"utf8")).includes(Ct))continue;await Et(q(n))}catch{}await Rt(r.filter(n=>e.has(n)))}async function vs(){let t=0;for(let e of Pe)await jt(e)&&t++;return{installed:t,total:Pe.length}}async function jt(t){try{return await Ge(q(t)),!0}catch{return!1}}async function xs(t){try{await $e(k(),{recursive:!0}),await Ze(Ae(),JSON.stringify({at:Date.now(),error:t}),{mode:384}),await We(Ae(),384)}catch{}}async function bs(){try{return JSON.parse(await Se(Ae(),"utf8"))}catch{return null}}async function ks(t){try{let e=await Ge(B(t));return Date.now()-e.mtimeMs>Nt()?null:await Se(B(t),"utf8")}catch{return null}}var Ct,Pe,fs,ps,At,Mt=x(()=>{"use strict";_e();Ct="managed-by: tokmizer",Pe=["tkr","tkr-gain","tkr-status","tkr-link","tkr-unlink","tkr-compression","tkr-telemetry","tkr-update","tkr-yolo"],fs=["power","tkr-reducer"];ps=3600*1e3,At=10080*60*1e3});import{join as ws}from"node:path";import{mkdir as wn,readFile as Ss,writeFile as Sn,unlink as Tn,rename as An}from"node:fs/promises";function As(){try{let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t&&t.length>0?t:"Etc/UTC"}catch{return"Etc/UTC"}}function Es(t){return t?.dir??k()}async function Pt(t){let e=Es(t);try{let r=await Ss(ws(e,Ts),"utf8"),s=JSON.parse(r);return{...s,lastSettingsRevision:s.lastSettingsRevision??0,timeZone:s.timeZone??As(),bonusActive:s.bonusActive??!1,...s.bonusResetAt!==void 0?{bonusResetAt:s.bonusResetAt}:{}}}catch{return null}}var Ts,$t=x(()=>{"use strict";_e();Ts="state.json"});function Zt(t,e=Date.now()){return t.plan}function Dt(t,e=Date.now()){return t.bonusActive??!1}var Vt=x(()=>{"use strict"});function Ft(t,e=!1){return!0}var Lt=x(()=>{"use strict"});var zt={};Te(zt,{reducerStillEntitled:()=>Cs});async function Cs(){let t=await Pt();return t?Ft(Zt(t),Dt(t)):!1}var Ut=x(()=>{"use strict";$t();Vt();Lt()});_e();import{readFileSync as qt}from"node:fs";import{join as Ht}from"node:path";function Xe(){try{let t=JSON.parse(qt(Ht(k(),"settings-cache.json"),"utf8"));return t.enabled!==!1&&typeof t.reducer=="string"&&t.reducer!=="off"}catch{return!1}}async function Os(){if(!Xe())return;let{loadSettingsCache:t}=await Promise.resolve().then(()=>(Tt(),St)),{readSkill:e}=await Promise.resolve().then(()=>(Mt(),It)),{reducerStillEntitled:r}=await Promise.resolve().then(()=>(Ut(),zt)),s=await t();if(!s.enabled||s.reducer==="off"||!await r())return;let n=await e(`reducer-${s.reducer}`);n&&process.stdout.write(n)}Os().catch(()=>{});
3
+ var Bt=Object.defineProperty;var x=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(s){throw r=[s],s}};var Te=(t,e)=>{for(var r in e)Bt(t,r,{get:e[r],enumerable:!0})};import Ke from"node:os";import{join as U}from"node:path";function k(){return process.env.TOKMIZER_HOME||U(Ke.homedir(),".tokmizer")}function Ae(){return U(k(),"bundle-refresh.json")}function Ee(){return U(k(),"skills")}function B(t){return U(Ee(),`${t}.md`)}function Ve(){return U(k(),"managed-commands.json")}function Fe(){return process.env.TOKMIZER_CLAUDE_COMMANDS_DIR||U(Ke.homedir(),".claude","commands")}function q(t){return U(Fe(),`${t}.md`)}var _e=x(()=>{"use strict"});var v,Le,f,j,ve=x(()=>{(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},t.getValidEnumValues=n=>{let a=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},t.find=(n,a)=>{for(let i of n)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Le||(Le={}));f=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),j=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(t)?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(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}}});var c,Jt,T,Ce=x(()=>{ve();c=v.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"]),Jt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),T=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let 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(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,d=0;for(;d<i.path.length;){let l=i.path[d];d===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],d++}}};return n(this),s}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,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];r[a]=r[a]||[],r[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};T.create=t=>new T(t)});var Wt,P,ze=x(()=>{Ce();ve();Wt=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===f.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${v.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${v.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${v.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}"`:v.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,v.assertNever(t)}return{message:r}},P=Wt});function Gt(t){Qe=t}function ce(){return Qe}var Qe,Oe=x(()=>{ze();Qe=P});function u(t,e){let r=ce(),s=xe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===P?void 0:P].filter(n=>!!n)});t.common.issues.push(s)}var xe,Yt,b,h,H,w,Re,Ne,V,ue,Ue=x(()=>{Oe();ze();xe=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",d=s.filter(l=>!!l).slice().reverse();for(let l of d)o=l(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Yt=[];b=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 s=[];for(let n of r){if(n.status==="aborted")return h;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:a,value:i}=n;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"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},h=Object.freeze({status:"aborted"}),H=t=>({status:"dirty",value:t}),w=t=>({status:"valid",value:t}),Re=t=>t.status==="aborted",Ne=t=>t.status==="dirty",V=t=>t.status==="valid",ue=t=>typeof Promise<"u"&&t instanceof Promise});var et=x(()=>{});var p,tt=x(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}))});function y(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))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:(i,o)=>{let{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??r??o.defaultError}},description:n}}function at(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 pr(t){return new RegExp(`^${at(t)}$`)}function it(t){let e=`${nt}T${at(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 hr(t,e){return!!((e==="v4"||!e)&&ir.test(t)||(e==="v6"||!e)&&cr.test(t))}function mr(t,e){if(!rr.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function gr(t,e){return!!((e==="v4"||!e)&&or.test(t)||(e==="v6"||!e)&&ur.test(t))}function yr(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}function de(t){if(t instanceof A){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=E.create(de(s))}return new A({...t._def,shape:()=>e})}else return t instanceof D?new D({...t._def,type:de(t.element)}):t instanceof E?E.create(de(t.unwrap())):t instanceof M?M.create(de(t.unwrap())):t instanceof I?I.create(t.items.map(e=>de(e))):t}function qe(t,e){let r=j(t),s=j(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&s===f.object){let n=v.objectKeys(e),a=v.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(let o of a){let d=qe(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(r===f.array&&s===f.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<t.length;a++){let i=t[a],o=e[a],d=qe(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===f.date&&s===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function ot(t,e){return new se({values:t,typeName:m.ZodEnum,...y(e)})}function st(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function ct(t,e={},r){return t?L.create().superRefine((s,n)=>{let a=t(s);if(a instanceof Promise)return a.then(i=>{if(!i){let o=st(e,s),d=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){let i=st(e,s),o=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:o})}}):L.create()}var C,rt,_,Kt,Xt,Qt,er,tr,rr,sr,nr,ar,Be,ir,or,cr,ur,dr,lr,nt,fr,F,J,W,G,Y,le,K,X,L,$,N,fe,D,A,Q,Z,je,ee,I,Ie,pe,he,Me,te,re,se,ne,z,O,E,M,ae,ie,me,_r,be,ke,oe,vr,m,xr,ut,dt,br,kr,lt,wr,Sr,Tr,Ar,Er,Cr,Or,Rr,Nr,jr,Ir,Mr,Pr,Zr,$r,Dr,Vr,Fr,Lr,zr,Ur,Br,qr,Hr,Jr,Wr,Gr,Yr,Kr,Xr,Qr,es,ts,rs,ft=x(()=>{Ce();Oe();tt();Ue();ve();C=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,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}},rt=(t,e)=>{if(V(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 T(t.common.issues);return this._error=r,this._error}}};_=class{get description(){return this._def.description}_getType(e){return j(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:j(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 s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},n=this._parseSync({data:e,path:s.path,parent:s});return rt(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return V(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>V(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ue(n)?n:Promise.resolve(n));return rt(s,a)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!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:r=>this["~validate"](r)}}optional(){return E.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return z.create(this,this._def)}or(e){return Q.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new O({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ae({...y(this._def),innerType:this,defaultValue:r,typeName:m.ZodDefault})}brand(){return new be({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ie({...y(this._def),innerType:this,catchValue:r,typeName:m.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ke.create(this,e)}readonly(){return oe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Kt=/^c[^\s-]{8,}$/i,Xt=/^[0-9a-z]+$/,Qt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,er=/^[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,tr=/^[a-z0-9_-]{21}$/i,rr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sr=/^[-+]?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)?)??$/,nr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ar="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ir=/^(?:(?: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])$/,or=/^(?:(?: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])$/,cr=/^(([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]))$/,ur=/^(([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])$/,dr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nt="((\\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])))",fr=new RegExp(`^${nt}$`);F=class t extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),h}let s=new b,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")nr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Be||(Be=new RegExp(ar,"u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")er.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")tr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Kt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Xt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Qt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),u(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.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)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?it(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?fr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?pr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?sr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?hr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?mr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?gr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?dr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?lr.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:c.invalid_string,...p.errToObj(s)})}_addCheck(e){return new t({...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,r){return this._addCheck({kind:"regex",regex:e,...p.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...p.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...p.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...p.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...p.errToObj(r)})}nonempty(e){return this.min(1,p.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}};F.create=t=>new F({checks:[],typeName:m.ZodString,coerce:t?.coerce??!1,...y(t)});J=class t extends _{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 u(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),h}let s,n=new b;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?yr(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,p.toString(r))}gt(e,r){return this.setLimit("min",e,!1,p.toString(r))}lte(e,r){return this.setLimit("max",e,!0,p.toString(r))}lt(e,r){return this.setLimit("max",e,!1,p.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new t({...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,r){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(r)})}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 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"&&v.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};J.create=t=>new J({checks:[],typeName:m.ZodNumber,coerce:t?.coerce||!1,...y(t)});W=class t extends _{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 s,n=new b;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.bigint,received:r.parsedType}),h}gte(e,r){return this.setLimit("min",e,!0,p.toString(r))}gt(e,r){return this.setLimit("min",e,!1,p.toString(r))}lte(e,r){return this.setLimit("max",e,!0,p.toString(r))}lt(e,r){return this.setLimit("max",e,!1,p.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:p.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: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,r){return this._addCheck({kind:"multipleOf",value:e,message:p.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}};W.create=t=>new W({checks:[],typeName:m.ZodBigInt,coerce:t?.coerce??!1,...y(t)});G=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),h}return w(e.data)}};G.create=t=>new G({typeName:m.ZodBoolean,coerce:t?.coerce||!1,...y(t)});Y=class t extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),h}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_date}),h}let s=new b,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):v.assertNever(a);return{status:s.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:p.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:p.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}};Y.create=t=>new Y({checks:[],coerce:t?.coerce||!1,typeName:m.ZodDate,...y(t)});le=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),h}return w(e.data)}};le.create=t=>new le({typeName:m.ZodSymbol,...y(t)});K=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),h}return w(e.data)}};K.create=t=>new K({typeName:m.ZodUndefined,...y(t)});X=class extends _{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),h}return w(e.data)}};X.create=t=>new X({typeName:m.ZodNull,...y(t)});L=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};L.create=t=>new L({typeName:m.ZodAny,...y(t)});$=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};$.create=t=>new $({typeName:m.ZodUnknown,...y(t)});N=class extends _{_parse(e){let r=this._getOrReturnCtx(e);return u(r,{code:c.invalid_type,expected:f.never,received:r.parsedType}),h}};N.create=t=>new N({typeName:m.ZodNever,...y(t)});fe=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),h}return w(e.data)}};fe.create=t=>new fe({typeName:m.ZodVoid,...y(t)});D=class t extends _{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==f.array)return u(r,{code:c.invalid_type,expected:f.array,received:r.parsedType}),h;if(n.exactLength!==null){let i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(u(r,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(u(r,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(u(r,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new C(r,i,r.path,o)))).then(i=>b.mergeArray(s,i));let a=[...r.data].map((i,o)=>n.type._parseSync(new C(r,i,r.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:p.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:p.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:p.toString(r)}})}nonempty(e){return this.min(1,e)}};D.create=(t,e)=>new D({type:t,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});A=class t extends _{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=v.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return u(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),h}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(let l in n.data)i.includes(l)||o.push(l);let d=[];for(let l of i){let g=a[l],S=n.data[l];d.push({key:{status:"valid",value:l},value:g._parse(new C(n,S,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof N){let l=this._def.unknownKeys;if(l==="passthrough")for(let g of o)d.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")o.length>0&&(u(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let g of o){let S=n.data[g];d.push({key:{status:"valid",value:g},value:l._parse(new C(n,S,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let g of d){let S=await g.key,Ye=await g.value;l.push({key:S,value:Ye,alwaysSet:g.alwaysSet})}return l}).then(l=>b.mergeObjectSync(s,l)):b.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:p.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:m.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of v.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of v.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return de(this)}partial(e){let r={};for(let s of v.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of v.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof E;)a=a._def.innerType;r[s]=a}return new t({...this._def,shape:()=>r})}keyof(){return ot(v.objectKeys(this.shape))}};A.create=(t,e)=>new A({shape:()=>t,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,...y(e)});A.strictCreate=(t,e)=>new A({shape:()=>t,unknownKeys:"strict",catchall:N.create(),typeName:m.ZodObject,...y(e)});A.lazycreate=(t,e)=>new A({shape:t,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,...y(e)});Q=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(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 r.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return u(r,{code:c.invalid_union,unionErrors:i}),h}if(r.common.async)return Promise.all(s.map(async a=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let d of s){let l={...r,common:{...r.common,issues:[]},parent:null},g=d._parseSync({data:r.data,path:r.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(d=>new T(d));return u(r,{code:c.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};Q.create=(t,e)=>new Q({options:t,typeName:m.ZodUnion,...y(e)});Z=t=>t instanceof te?Z(t.schema):t instanceof O?Z(t.innerType()):t instanceof re?[t.value]:t instanceof se?t.options:t instanceof ne?v.objectValues(t.enum):t instanceof ae?Z(t._def.innerType):t instanceof K?[void 0]:t instanceof X?[null]:t instanceof E?[void 0,...Z(t.unwrap())]:t instanceof M?[null,...Z(t.unwrap())]:t instanceof be||t instanceof oe?Z(t.unwrap()):t instanceof ie?Z(t._def.innerType):[],je=class t extends _{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return u(r,{code:c.invalid_type,expected:f.object,received:r.parsedType}),h;let s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(u(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let a of r){let i=Z(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(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new t({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...y(s)})}};ee=class extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Re(a)||Re(i))return h;let o=qe(a.value,i.value);return o.valid?((Ne(a)||Ne(i))&&r.dirty(),{status:r.value,value:o.data}):(u(s,{code:c.invalid_intersection_types}),h)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ee.create=(t,e,r)=>new ee({left:t,right:e,typeName:m.ZodIntersection,...y(r)});I=class t extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return u(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),h;if(s.data.length<this._def.items.length)return u(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&s.data.length>this._def.items.length&&(u(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...s.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new C(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(r,i)):b.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};I.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:t,typeName:m.ZodTuple,rest:null,...y(e)})};Ie=class t extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return u(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),h;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new C(s,o,s.path,o)),value:i._parse(new C(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?b.mergeObjectAsync(r,n):b.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof _?new t({keyType:e,valueType:r,typeName:m.ZodRecord,...y(s)}):new t({keyType:F.create(),valueType:e,typeName:m.ZodRecord,...y(r)})}},pe=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return u(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),h;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],l)=>({key:n._parse(new C(s,o,s.path,[l,"key"])),value:a._parse(new C(s,d,s.path,[l,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let l=await d.key,g=await d.value;if(l.status==="aborted"||g.status==="aborted")return h;(l.status==="dirty"||g.status==="dirty")&&r.dirty(),o.set(l.value,g.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let d of i){let l=d.key,g=d.value;if(l.status==="aborted"||g.status==="aborted")return h;(l.status==="dirty"||g.status==="dirty")&&r.dirty(),o.set(l.value,g.value)}return{status:r.value,value:o}}}};pe.create=(t,e,r)=>new pe({valueType:e,keyType:t,typeName:m.ZodMap,...y(r)});he=class t extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return u(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),h;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(u(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(u(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let a=this._def.valueType;function i(d){let l=new Set;for(let g of d){if(g.status==="aborted")return h;g.status==="dirty"&&r.dirty(),l.add(g.value)}return{status:r.value,value:l}}let o=[...s.data.values()].map((d,l)=>a._parse(new C(s,d,s.path,l)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:p.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:p.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};he.create=(t,e)=>new he({valueType:t,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});Me=class t extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return u(r,{code:c.invalid_type,expected:f.function,received:r.parsedType}),h;function s(o,d){return xe({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),P].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return xe({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),P].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:d}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof z){let o=this;return w(async function(...d){let l=new T([]),g=await o._def.args.parseAsync(d,a).catch(De=>{throw l.addIssue(s(d,De)),l}),S=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(S,a).catch(De=>{throw l.addIssue(n(S,De)),l})})}else{let o=this;return w(function(...d){let l=o._def.args.safeParse(d,a);if(!l.success)throw new T([s(d,l.error)]);let g=Reflect.apply(i,this,l.data),S=o._def.returns.safeParse(g,a);if(!S.success)throw new T([n(g,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:I.create(e).rest($.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,s){return new t({args:e||I.create([]).rest($.create()),returns:r||$.create(),typeName:m.ZodFunction,...y(s)})}},te=class extends _{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})}};te.create=(t,e)=>new te({getter:t,typeName:m.ZodLazy,...y(e)});re=class extends _{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return u(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};re.create=(t,e)=>new re({value:t,typeName:m.ZodLiteral,...y(e)});se=class t extends _{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return u(r,{expected:v.joinValues(s),received:r.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return u(r,{received:r.data,code:c.invalid_enum_value,options:s}),h}return w(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(s=>!e.includes(s)),{...this._def,...r})}};se.create=ot;ne=class extends _{_parse(e){let r=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=v.objectValues(r);return u(s,{expected:v.joinValues(n),received:s.parsedType,code:c.invalid_type}),h}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(r);return u(s,{received:s.data,code:c.invalid_enum_value,options:n}),h}return w(e.data)}get enum(){return this._def.values}};ne.create=(t,e)=>new ne({values:t,typeName:m.ZodNativeEnum,...y(e)});z=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.promise&&r.common.async===!1)return u(r,{code:c.invalid_type,expected:f.promise,received:r.parsedType}),h;let s=r.parsedType===f.promise?r.data:Promise.resolve(r.data);return w(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};z.create=(t,e)=>new z({type:t,typeName:m.ZodPromise,...y(e)});O=class extends _{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:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{u(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return h;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?h:d.status==="dirty"?H(d.value):r.value==="dirty"?H(d.value):d});{if(r.value==="aborted")return h;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?h:o.status==="dirty"?H(o.value):r.value==="dirty"?H(o.value):o}}if(n.type==="refinement"){let i=o=>{let d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?h:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!V(i))return h;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>V(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:r.value,value:o})):h);v.assertNever(n)}};O.create=(t,e,r)=>new O({schema:t,typeName:m.ZodEffects,effect:e,...y(r)});O.createWithPreprocess=(t,e,r)=>new O({schema:e,effect:{type:"preprocess",transform:t},typeName:m.ZodEffects,...y(r)});E=class extends _{_parse(e){return this._getType(e)===f.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(t,e)=>new E({innerType:t,typeName:m.ZodOptional,...y(e)});M=class extends _{_parse(e){return this._getType(e)===f.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:m.ZodNullable,...y(e)});ae=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ae.create=(t,e)=>new ae({innerType:t,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});ie=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ue(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};ie.create=(t,e)=>new ie({innerType:t,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});me=class extends _{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),h}return{status:"valid",value:e.data}}};me.create=t=>new me({typeName:m.ZodNaN,...y(t)});_r=Symbol("zod_brand"),be=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},ke=class t extends _{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?h:a.status==="dirty"?(r.dirty(),H(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?h:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:m.ZodPipeline})}},oe=class extends _{_parse(e){let r=this._def.innerType._parse(e),s=n=>(V(n)&&(n.value=Object.freeze(n.value)),n);return ue(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};oe.create=(t,e)=>new oe({innerType:t,typeName:m.ZodReadonly,...y(e)});vr={object:A.lazycreate};(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"})(m||(m={}));xr=(t,e={message:`Input not instance of ${t.name}`})=>ct(r=>r instanceof t,e),ut=F.create,dt=J.create,br=me.create,kr=W.create,lt=G.create,wr=Y.create,Sr=le.create,Tr=K.create,Ar=X.create,Er=L.create,Cr=$.create,Or=N.create,Rr=fe.create,Nr=D.create,jr=A.create,Ir=A.strictCreate,Mr=Q.create,Pr=je.create,Zr=ee.create,$r=I.create,Dr=Ie.create,Vr=pe.create,Fr=he.create,Lr=Me.create,zr=te.create,Ur=re.create,Br=se.create,qr=ne.create,Hr=z.create,Jr=O.create,Wr=E.create,Gr=M.create,Yr=O.createWithPreprocess,Kr=ke.create,Xr=()=>ut().optional(),Qr=()=>dt().optional(),es=()=>lt().optional(),ts={string:(t=>F.create({...t,coerce:!0})),number:(t=>J.create({...t,coerce:!0})),boolean:(t=>G.create({...t,coerce:!0})),bigint:(t=>W.create({...t,coerce:!0})),date:(t=>Y.create({...t,coerce:!0}))},rs=h});var R={};Te(R,{BRAND:()=>_r,DIRTY:()=>H,EMPTY_PATH:()=>Yt,INVALID:()=>h,NEVER:()=>rs,OK:()=>w,ParseStatus:()=>b,Schema:()=>_,ZodAny:()=>L,ZodArray:()=>D,ZodBigInt:()=>W,ZodBoolean:()=>G,ZodBranded:()=>be,ZodCatch:()=>ie,ZodDate:()=>Y,ZodDefault:()=>ae,ZodDiscriminatedUnion:()=>je,ZodEffects:()=>O,ZodEnum:()=>se,ZodError:()=>T,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>Me,ZodIntersection:()=>ee,ZodIssueCode:()=>c,ZodLazy:()=>te,ZodLiteral:()=>re,ZodMap:()=>pe,ZodNaN:()=>me,ZodNativeEnum:()=>ne,ZodNever:()=>N,ZodNull:()=>X,ZodNullable:()=>M,ZodNumber:()=>J,ZodObject:()=>A,ZodOptional:()=>E,ZodParsedType:()=>f,ZodPipeline:()=>ke,ZodPromise:()=>z,ZodReadonly:()=>oe,ZodRecord:()=>Ie,ZodSchema:()=>_,ZodSet:()=>he,ZodString:()=>F,ZodSymbol:()=>le,ZodTransformer:()=>O,ZodTuple:()=>I,ZodType:()=>_,ZodUndefined:()=>K,ZodUnion:()=>Q,ZodUnknown:()=>$,ZodVoid:()=>fe,addIssueToContext:()=>u,any:()=>Er,array:()=>Nr,bigint:()=>kr,boolean:()=>lt,coerce:()=>ts,custom:()=>ct,date:()=>wr,datetimeRegex:()=>it,defaultErrorMap:()=>P,discriminatedUnion:()=>Pr,effect:()=>Jr,enum:()=>Br,function:()=>Lr,getErrorMap:()=>ce,getParsedType:()=>j,instanceof:()=>xr,intersection:()=>Zr,isAborted:()=>Re,isAsync:()=>ue,isDirty:()=>Ne,isValid:()=>V,late:()=>vr,lazy:()=>zr,literal:()=>Ur,makeIssue:()=>xe,map:()=>Vr,nan:()=>br,nativeEnum:()=>qr,never:()=>Or,null:()=>Ar,nullable:()=>Gr,number:()=>dt,object:()=>jr,objectUtil:()=>Le,oboolean:()=>es,onumber:()=>Qr,optional:()=>Wr,ostring:()=>Xr,pipeline:()=>Kr,preprocess:()=>Yr,promise:()=>Hr,quotelessJson:()=>Jt,record:()=>Dr,set:()=>Fr,setErrorMap:()=>Gt,strictObject:()=>Ir,string:()=>ut,symbol:()=>Sr,transformer:()=>Jr,tuple:()=>$r,undefined:()=>Tr,union:()=>Mr,unknown:()=>Cr,util:()=>v,void:()=>Rr});var He=x(()=>{Oe();Ue();et();ve();ft();Ce()});var pt=x(()=>{He();He()});var ss,ns,ge,ht=x(()=>{"use strict";pt();ss=R.enum(["normal","compact","minimal"]),ns=R.enum(["off","light","balanced","max"]),ge=R.object({enabled:R.boolean().default(!0),telemetryOptIn:R.boolean().default(!0),outputVerbosity:ss.default("compact"),reducer:ns.default("off"),filters:R.object({enableAll:R.boolean().default(!0),disabled:R.array(R.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})})});var St={};Te(St,{clearSettingsCache:()=>ds,loadSettingsCache:()=>kt,saveSettingsCache:()=>wt,updateSettingsCache:()=>us});import{readFile as _t,writeFile as vt,mkdir as xt,chmod as as,rm as we,rename as bt,readdir as is}from"node:fs/promises";import{randomUUID as os}from"node:crypto";import{join as ye}from"node:path";import{setTimeout as mt}from"node:timers/promises";async function kt(){try{let t=await _t(ye(k(),Je),"utf8"),e=JSON.parse(t);return ge.parse({...gt,...e})}catch{return gt}}async function wt(t){await xt(k(),{recursive:!0});let e=ye(k(),Je),r=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;await vt(r,JSON.stringify(t,null,2),{mode:384});try{await as(r,384),await bt(r,e)}catch(s){try{await we(r,{force:!0})}catch{}throw s}}async function yt(t){let e=[];for(let r of await is(t)){let s=/^([1-9]\d*)-[0-9a-f-]{36}\.json$/.exec(r);if(!s)continue;let n=ye(t,r);try{process.kill(Number(s[1]),0)}catch(a){let i=a.code;if(i==="ESRCH"){await we(n,{force:!0});continue}if(i!=="EPERM")throw a}try{let a=JSON.parse(await _t(n,"utf8"));if(!Number.isSafeInteger(a)||a<0)throw new Error("Invalid local settings lock");e.push({id:r,ticket:a})}catch(a){if(a.code!=="ENOENT")throw a}}return e}async function us(t){let e=cs.parse(t),r=ye(k(),"settings-cache-locks");await xt(r,{recursive:!0,mode:448});let s=`${process.pid}-${os()}.json`,n=ye(r,s),a=`${n}.tmp`,i=performance.now()+3e3,o=async d=>{for(await vt(a,String(d),{mode:384});;)try{await bt(a,n);return}catch(l){let g=l.code;if(process.platform!=="win32"||g!=="EPERM"&&g!=="EBUSY"||performance.now()>=i)throw l;await mt(10)}};try{await o(0);let d=Math.max(0,...(await yt(r)).map(l=>l.ticket))+1;if(!Number.isSafeInteger(d))throw new Error("Invalid local settings lock");for(await o(d);;){if(!(await yt(r)).some(g=>g.id!==s&&(g.ticket===0||g.ticket<d||g.ticket===d&&g.id<s))){let g=await kt(),S=ge.parse({...g,...e,filters:{...g.filters,...e.filters}});return await wt(S),S}if(performance.now()>=i)throw new Error("Timed out waiting for local settings lock after 3 seconds; another process may still be updating settings");await mt(10)}}finally{await Promise.all([we(n,{force:!0}),we(a,{force:!0})])}}async function ds(){try{await we(ye(k(),Je),{force:!0})}catch{}}var Je,gt,cs,Tt=x(()=>{"use strict";ht();_e();Je="settings-cache.json",gt=ge.parse({}),cs=ge.partial().extend({filters:ge.shape.filters.removeDefault().partial().optional()})});var It={};Te(It,{STATIC_COMMAND_NAMES:()=>Pe,commandInstalled:()=>jt,commandsInstallStatus:()=>vs,installCommand:()=>ys,isFresh:()=>hs,pruneCommands:()=>_s,pruneSkills:()=>gs,readBundleRefresh:()=>bs,readSkill:()=>ks,recordBundleRefresh:()=>xs,writeSkill:()=>ms});import{chmod as We,mkdir as Ze,readFile as Se,writeFile as $e,stat as Ge,readdir as ls,rm as Et}from"node:fs/promises";async function Ot(){try{let t=JSON.parse(await Se(Ve(),"utf8"));return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}catch{return[]}}async function Rt(t){try{await Ze(k(),{recursive:!0}),await $e(Ve(),JSON.stringify(t),{mode:384})}catch{}}function Nt(){let t=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(t)&&t>0?Math.min(t,At):At}async function hs(t){try{let e=await Ge(B(t)),r=Date.now()-e.mtimeMs;return r<ps&&r<=Nt()}catch{return!1}}async function ms(t,e){await Ze(Ee(),{recursive:!0}),await $e(B(t),e,{mode:384}),await We(B(t),384)}async function gs(t){let e=new Set(t),r;try{r=await ls(Ee())}catch{return}for(let s of r){if(!s.endsWith(".md"))continue;let n=s.slice(0,-3);if(!e.has(n))try{await Et(B(n))}catch{}}}async function ys(t,e){await Ze(Fe(),{recursive:!0});try{if(!(await Se(q(t),"utf8")).includes(Ct))return}catch{}await $e(q(t),e,{mode:384}),await We(q(t),384);let r=await Ot();r.includes(t)||await Rt([...r,t])}async function _s(t){let e=new Set([...t,...Pe]),r=await Ot(),s=new Set([...r,...fs]);for(let n of s)if(!e.has(n))try{if(!(await Se(q(n),"utf8")).includes(Ct))continue;await Et(q(n))}catch{}await Rt(r.filter(n=>e.has(n)))}async function vs(){let t=0;for(let e of Pe)await jt(e)&&t++;return{installed:t,total:Pe.length}}async function jt(t){try{return await Ge(q(t)),!0}catch{return!1}}async function xs(t){try{await Ze(k(),{recursive:!0}),await $e(Ae(),JSON.stringify({at:Date.now(),error:t}),{mode:384}),await We(Ae(),384)}catch{}}async function bs(){try{return JSON.parse(await Se(Ae(),"utf8"))}catch{return null}}async function ks(t){try{let e=await Ge(B(t));return Date.now()-e.mtimeMs>Nt()?null:await Se(B(t),"utf8")}catch{return null}}var Ct,Pe,fs,ps,At,Mt=x(()=>{"use strict";_e();Ct="managed-by: tokmizer",Pe=["tkr","tkr-gain","tkr-status","tkr-link","tkr-unlink","tkr-compression","tkr-telemetry","tkr-update","tkr-yolo"],fs=["power","tkr-reducer"];ps=3600*1e3,At=10080*60*1e3});import{join as ws}from"node:path";import{mkdir as wn,readFile as Ss,writeFile as Sn,unlink as Tn,rename as An}from"node:fs/promises";function As(){try{let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t&&t.length>0?t:"Etc/UTC"}catch{return"Etc/UTC"}}function Es(t){return t?.dir??k()}async function Pt(t){let e=Es(t);try{let r=await Ss(ws(e,Ts),"utf8"),s=JSON.parse(r),n=s.timeZone;return{...s,lastSettingsRevision:s.lastSettingsRevision??0,get timeZone(){return n??=As()},bonusActive:s.bonusActive??!1,...s.bonusResetAt!==void 0?{bonusResetAt:s.bonusResetAt}:{}}}catch{return null}}var Ts,Zt=x(()=>{"use strict";_e();Ts="state.json"});function $t(t,e=Date.now()){return t.plan}function Dt(t,e=Date.now()){return t.bonusActive??!1}var Vt=x(()=>{"use strict"});function Ft(t,e=!1){return!0}var Lt=x(()=>{"use strict"});var zt={};Te(zt,{reducerStillEntitled:()=>Cs});async function Cs(){let t=await Pt();return t?Ft($t(t),Dt(t)):!1}var Ut=x(()=>{"use strict";Zt();Vt();Lt()});_e();import{readFileSync as qt}from"node:fs";import{join as Ht}from"node:path";function Xe(){try{let t=JSON.parse(qt(Ht(k(),"settings-cache.json"),"utf8"));return t.enabled!==!1&&typeof t.reducer=="string"&&t.reducer!=="off"}catch{return!1}}async function Os(){if(!Xe())return;let{loadSettingsCache:t}=await Promise.resolve().then(()=>(Tt(),St)),{readSkill:e}=await Promise.resolve().then(()=>(Mt(),It)),{reducerStillEntitled:r}=await Promise.resolve().then(()=>(Ut(),zt)),s=await t();if(!s.enabled||s.reducer==="off"||!await r())return;let n=await e(`reducer-${s.reducer}`);n&&process.stdout.write(n)}Os().catch(()=>{});