@tokmizer/plugin 0.5.14 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/plugin.json +1 -1
- package/dist/bin/tkr-codex-hook.js +9 -9
- package/dist/bin/tkr-daemon.js +10 -10
- package/dist/bin/tkr-exec.js +14 -14
- package/dist/bin/tkr-shim.js +10 -10
- package/dist/bin/tkr.js +59 -59
- package/dist/hooks-host/post-tool-use.js +12 -12
- package/dist/hooks-host/reducer-stop.js +1 -1
- package/dist/index.js +8 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __tkrCreateRequire } from "node:module"; const require = __tkrCreateRequire(import.meta.url);
|
|
2
|
-
var Kr=Object.defineProperty;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var ze=(t,e)=>{for(var r in e)Kr(t,r,{get:e[r],enumerable:!0})};var x,ut,f,M,Ae=b(()=>{(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},t.getValidEnumValues=s=>{let a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(let i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ut||(ut={}));f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),M=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 u,Hr,R,Le=b(()=>{Ae();u=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Hr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let 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},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),n}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,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};R.create=t=>new R(t)});var qr,L,lt=b(()=>{Le();Ae();qr=(t,e)=>{let r;switch(t.code){case u.invalid_type:t.received===f.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case u.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:r=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case u.invalid_union:r="Invalid input";break;case u.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case u.invalid_enum_value:r=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case u.invalid_arguments:r="Invalid function arguments";break;case u.invalid_return_type:r="Invalid function return type";break;case u.invalid_date:r="Invalid date";break;case u.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}"`:x.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case u.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 u.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 u.custom:r="Invalid input";break;case u.invalid_intersection_types:r="Intersection results could not be merged";break;case u.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case u.not_finite:r="Number must be finite";break;default:r=e.defaultError,x.assertNever(t)}return{message:r}},L=qr});function Gr(t){zt=t}function ge(){return zt}var zt,Fe=b(()=>{lt();zt=L});function d(t,e){let r=ge(),n=Te({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===L?void 0:L].filter(s=>!!s)});t.common.issues.push(n)}var Te,Wr,E,g,X,A,Ve,Ue,B,ye,dt=b(()=>{Fe();lt();Te=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},Wr=[];E=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 n=[];for(let s of r){if(s.status==="aborted")return g;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let a=await s.key,i=await s.value;n.push({key:a,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return g;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},g=Object.freeze({status:"aborted"}),X=t=>({status:"dirty",value:t}),A=t=>({status:"valid",value:t}),Ve=t=>t.status==="aborted",Ue=t=>t.status==="dirty",B=t=>t.status==="valid",ye=t=>typeof Promise<"u"&&t instanceof Promise});var Lt=b(()=>{});var p,Ft=b(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}))});function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}function Kt(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 pn(t){return new RegExp(`^${Kt(t)}$`)}function Ht(t){let e=`${Bt}T${Kt(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 mn(t,e){return!!((e==="v4"||!e)&&an.test(t)||(e==="v6"||!e)&&cn.test(t))}function hn(t,e){if(!tn.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function gn(t,e){return!!((e==="v4"||!e)&&on.test(t)||(e==="v6"||!e)&&un.test(t))}function yn(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}function _e(t){if(t instanceof C){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=I.create(_e(n))}return new C({...t._def,shape:()=>e})}else return t instanceof U?new U({...t._def,type:_e(t.element)}):t instanceof I?I.create(_e(t.unwrap())):t instanceof $?$.create(_e(t.unwrap())):t instanceof j?j.create(t.items.map(e=>_e(e))):t}function pt(t,e){let r=M(t),n=M(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&n===f.object){let s=x.objectKeys(e),a=x.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(let o of a){let c=pt(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===f.array&&n===f.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<t.length;a++){let i=t[a],o=e[a],c=pt(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===f.date&&n===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function qt(t,e){return new ue({values:t,typeName:y.ZodEnum,..._(e)})}function Ut(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Gt(t,e={},r){return t?H.create().superRefine((n,s)=>{let a=t(n);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Ut(e,n),c=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:c})}});if(!a){let i=Ut(e,n),o=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:o})}}):H.create()}var O,Vt,v,Yr,Jr,Xr,Qr,en,tn,rn,nn,sn,ft,an,on,cn,un,ln,dn,Bt,fn,K,Q,ee,te,re,ve,ne,se,H,V,N,xe,U,C,ae,F,Be,ie,j,Ke,ke,be,He,oe,ce,ue,le,q,D,I,$,de,fe,we,_n,Re,Ce,pe,vn,y,xn,Wt,Yt,kn,bn,Jt,wn,En,Sn,An,Tn,Rn,Cn,In,On,Dn,Nn,Pn,Mn,jn,$n,Zn,zn,Ln,Fn,Vn,Un,Bn,Kn,Hn,qn,Gn,Wn,Yn,Jn,Xn,Qn,es,ts,rs,Xt=b(()=>{Le();Fe();Ft();dt();Ae();O=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Vt=(t,e)=>{if(B(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 R(t.common.issues);return this._error=r,this._error}}};v=class{get description(){return this._def.description}_getType(e){return M(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ye(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 n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Vt(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return B(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>B(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ye(s)?s:Promise.resolve(s));return Vt(n,a)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:u.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new D({schema:this,typeName:y.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 I.create(this,this._def)}nullable(){return $.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return U.create(this)}promise(){return q.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new D({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new de({..._(this._def),innerType:this,defaultValue:r,typeName:y.ZodDefault})}brand(){return new Re({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fe({..._(this._def),innerType:this,catchValue:r,typeName:y.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ce.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Yr=/^c[^\s-]{8,}$/i,Jr=/^[0-9a-z]+$/,Xr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qr=/^[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,en=/^[a-z0-9_-]{21}$/i,tn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rn=/^[-+]?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)?)??$/,nn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",an=/^(?:(?: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])$/,on=/^(?:(?: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])$/,cn=/^(([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]))$/,un=/^(([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])$/,ln=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bt="((\\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])))",fn=new RegExp(`^${Bt}$`);K=class t extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_type,expected:f.string,received:a.parsedType}),g}let n=new E,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?d(s,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(s,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")nn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")ft||(ft=new RegExp(sn,"u")),ft.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Qr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")en.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Yr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Jr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Xr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:u.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"regex",code:u.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Ht(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?fn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?pn(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?rn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?mn(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?hn(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?gn(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ln.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?dn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:u.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:u.invalid_string,...p.errToObj(n)})}_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}};K.create=t=>new K({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});Q=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_type,expected:f.number,received:a.parsedType}),g}let n,s=new E;for(let a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:u.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?yn(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:u.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.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,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:p.toString(s)}]})}_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"&&x.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Q.create=t=>new Q({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});ee=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let n,s=new E;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return d(r,{code:u.invalid_type,expected:f.bigint,received:r.parsedType}),g}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,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:p.toString(s)}]})}_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}};ee.create=t=>new ee({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});te=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.boolean,received:n.parsedType}),g}return A(e.data)}};te.create=t=>new te({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});re=class t extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_type,expected:f.date,received:a.parsedType}),g}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_date}),g}let n=new E,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.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}};re.create=t=>new re({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});ve=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.symbol,received:n.parsedType}),g}return A(e.data)}};ve.create=t=>new ve({typeName:y.ZodSymbol,..._(t)});ne=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.undefined,received:n.parsedType}),g}return A(e.data)}};ne.create=t=>new ne({typeName:y.ZodUndefined,..._(t)});se=class extends v{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.null,received:n.parsedType}),g}return A(e.data)}};se.create=t=>new se({typeName:y.ZodNull,..._(t)});H=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}};H.create=t=>new H({typeName:y.ZodAny,..._(t)});V=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}};V.create=t=>new V({typeName:y.ZodUnknown,..._(t)});N=class extends v{_parse(e){let r=this._getOrReturnCtx(e);return d(r,{code:u.invalid_type,expected:f.never,received:r.parsedType}),g}};N.create=t=>new N({typeName:y.ZodNever,..._(t)});xe=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.void,received:n.parsedType}),g}return A(e.data)}};xe.create=t=>new xe({typeName:y.ZodVoid,..._(t)});U=class t extends v{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==f.array)return d(r,{code:u.invalid_type,expected:f.array,received:r.parsedType}),g;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(d(r,{code:i?u.too_big:u.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(d(r,{code:u.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(d(r,{code:u.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new O(r,i,r.path,o)))).then(i=>E.mergeArray(n,i));let a=[...r.data].map((i,o)=>s.type._parseSync(new O(r,i,r.path,o)));return E.mergeArray(n,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)}};U.create=(t,e)=>new U({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});C=class t extends v{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=x.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 d(l,{code:u.invalid_type,expected:f.object,received:l.parsedType}),g}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||o.push(l);let c=[];for(let l of i){let h=a[l],k=s.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new O(s,k,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof N){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")o.length>0&&(d(s,{code:u.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let h of o){let k=s.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new O(s,k,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of c){let k=await h.key,w=await h.value;l.push({key:k,value:w,alwaysSet:h.alwaysSet})}return l}).then(l=>E.mergeObjectSync(n,l)):E.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}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:y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of x.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of x.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return _e(this)}partial(e){let r={};for(let n of x.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of x.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof I;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return qt(x.objectKeys(this.shape))}};C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:N.create(),typeName:y.ZodObject,..._(e)});C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:N.create(),typeName:y.ZodObject,..._(e)});C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:N.create(),typeName:y.ZodObject,..._(e)});ae=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new R(o.ctx.common.issues));return d(r,{code:u.invalid_union,unionErrors:i}),g}if(r.common.async)return Promise.all(n.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(s);{let a,i=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,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(c=>new R(c));return d(r,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}};ae.create=(t,e)=>new ae({options:t,typeName:y.ZodUnion,..._(e)});F=t=>t instanceof oe?F(t.schema):t instanceof D?F(t.innerType()):t instanceof ce?[t.value]:t instanceof ue?t.options:t instanceof le?x.objectValues(t.enum):t instanceof de?F(t._def.innerType):t instanceof ne?[void 0]:t instanceof se?[null]:t instanceof I?[void 0,...F(t.unwrap())]:t instanceof $?[null,...F(t.unwrap())]:t instanceof Re||t instanceof pe?F(t.unwrap()):t instanceof fe?F(t._def.innerType):[],Be=class t extends v{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return d(r,{code:u.invalid_type,expected:f.object,received:r.parsedType}),g;let n=this.discriminator,s=r.data[n],a=this.optionsMap.get(s);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}):(d(r,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let a of r){let i=F(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,..._(n)})}};ie=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Ve(a)||Ve(i))return g;let o=pt(a.value,i.value);return o.valid?((Ue(a)||Ue(i))&&r.dirty(),{status:r.value,value:o.data}):(d(n,{code:u.invalid_intersection_types}),g)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ie.create=(t,e,r)=>new ie({left:t,right:e,typeName:y.ZodIntersection,..._(r)});j=class t extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return d(n,{code:u.invalid_type,expected:f.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return d(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new O(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>E.mergeArray(r,i)):E.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};j.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};Ke=class t extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return d(n,{code:u.invalid_type,expected:f.object,received:n.parsedType}),g;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new O(n,o,n.path,o)),value:i._parse(new O(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?E.mergeObjectAsync(r,s):E.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof v?new t({keyType:e,valueType:r,typeName:y.ZodRecord,..._(n)}):new t({keyType:K.create(),valueType:e,typeName:y.ZodRecord,..._(r)})}},ke=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return d(n,{code:u.invalid_type,expected:f.map,received:n.parsedType}),g;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:s._parse(new O(n,o,n.path,[l,"key"])),value:a._parse(new O(n,c,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of i){let l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}}}};ke.create=(t,e,r)=>new ke({valueType:e,keyType:t,typeName:y.ZodMap,..._(r)});be=class t extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return d(n,{code:u.invalid_type,expected:f.set,received:n.parsedType}),g;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(d(n,{code:u.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(d(n,{code:u.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let a=this._def.valueType;function i(c){let l=new Set;for(let h of c){if(h.status==="aborted")return g;h.status==="dirty"&&r.dirty(),l.add(h.value)}return{status:r.value,value:l}}let o=[...n.data.values()].map((c,l)=>a._parse(new O(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):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)}};be.create=(t,e)=>new be({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});He=class t extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return d(r,{code:u.invalid_type,expected:f.function,received:r.parsedType}),g;function n(o,c){return Te({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ge(),L].filter(l=>!!l),issueData:{code:u.invalid_arguments,argumentsError:c}})}function s(o,c){return Te({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ge(),L].filter(l=>!!l),issueData:{code:u.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof q){let o=this;return A(async function(...c){let l=new R([]),h=await o._def.args.parseAsync(c,a).catch(T=>{throw l.addIssue(n(c,T)),l}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(T=>{throw l.addIssue(s(k,T)),l})})}else{let o=this;return A(function(...c){let l=o._def.args.safeParse(c,a);if(!l.success)throw new R([n(c,l.error)]);let h=Reflect.apply(i,this,l.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new R([s(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:j.create(e).rest(V.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,n){return new t({args:e||j.create([]).rest(V.create()),returns:r||V.create(),typeName:y.ZodFunction,..._(n)})}},oe=class extends v{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})}};oe.create=(t,e)=>new oe({getter:t,typeName:y.ZodLazy,..._(e)});ce=class extends v{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return d(r,{received:r.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};ce.create=(t,e)=>new ce({value:t,typeName:y.ZodLiteral,..._(e)});ue=class t extends v{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return d(r,{expected:x.joinValues(n),received:r.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return d(r,{received:r.data,code:u.invalid_enum_value,options:n}),g}return A(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(n=>!e.includes(n)),{...this._def,...r})}};ue.create=qt;le=class extends v{_parse(e){let r=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let s=x.objectValues(r);return d(n,{expected:x.joinValues(s),received:n.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=x.objectValues(r);return d(n,{received:n.data,code:u.invalid_enum_value,options:s}),g}return A(e.data)}get enum(){return this._def.values}};le.create=(t,e)=>new le({values:t,typeName:y.ZodNativeEnum,..._(e)});q=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.promise&&r.common.async===!1)return d(r,{code:u.invalid_type,expected:f.promise,received:r.parsedType}),g;let n=r.parsedType===f.promise?r.data:Promise.resolve(r.data);return A(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};q.create=(t,e)=>new q({type:t,typeName:y.ZodPromise,..._(e)});D=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{d(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return g;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?g:c.status==="dirty"?X(c.value):r.value==="dirty"?X(c.value):c});{if(r.value==="aborted")return g;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?g:o.status==="dirty"?X(o.value):r.value==="dirty"?X(o.value):o}}if(s.type==="refinement"){let i=o=>{let c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?g:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?g:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!B(i))return g;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>B(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):g);x.assertNever(s)}};D.create=(t,e,r)=>new D({schema:t,typeName:y.ZodEffects,effect:e,..._(r)});D.createWithPreprocess=(t,e,r)=>new D({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,..._(r)});I=class extends v{_parse(e){return this._getType(e)===f.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(t,e)=>new I({innerType:t,typeName:y.ZodOptional,..._(e)});$=class extends v{_parse(e){return this._getType(e)===f.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$.create=(t,e)=>new $({innerType:t,typeName:y.ZodNullable,..._(e)});de=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};de.create=(t,e)=>new de({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});fe=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ye(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new R(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new R(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});we=class extends v{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}};we.create=t=>new we({typeName:y.ZodNaN,..._(t)});_n=Symbol("zod_brand"),Re=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ce=class t extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?g:a.status==="dirty"?(r.dirty(),X(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?g:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:y.ZodPipeline})}},pe=class extends v{_parse(e){let r=this._def.innerType._parse(e),n=s=>(B(s)&&(s.value=Object.freeze(s.value)),s);return ye(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};pe.create=(t,e)=>new pe({innerType:t,typeName:y.ZodReadonly,..._(e)});vn={object:C.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"})(y||(y={}));xn=(t,e={message:`Input not instance of ${t.name}`})=>Gt(r=>r instanceof t,e),Wt=K.create,Yt=Q.create,kn=we.create,bn=ee.create,Jt=te.create,wn=re.create,En=ve.create,Sn=ne.create,An=se.create,Tn=H.create,Rn=V.create,Cn=N.create,In=xe.create,On=U.create,Dn=C.create,Nn=C.strictCreate,Pn=ae.create,Mn=Be.create,jn=ie.create,$n=j.create,Zn=Ke.create,zn=ke.create,Ln=be.create,Fn=He.create,Vn=oe.create,Un=ce.create,Bn=ue.create,Kn=le.create,Hn=q.create,qn=D.create,Gn=I.create,Wn=$.create,Yn=D.createWithPreprocess,Jn=Ce.create,Xn=()=>Wt().optional(),Qn=()=>Yt().optional(),es=()=>Jt().optional(),ts={string:(t=>K.create({...t,coerce:!0})),number:(t=>Q.create({...t,coerce:!0})),boolean:(t=>te.create({...t,coerce:!0})),bigint:(t=>ee.create({...t,coerce:!0})),date:(t=>re.create({...t,coerce:!0}))},rs=g});var m={};ze(m,{BRAND:()=>_n,DIRTY:()=>X,EMPTY_PATH:()=>Wr,INVALID:()=>g,NEVER:()=>rs,OK:()=>A,ParseStatus:()=>E,Schema:()=>v,ZodAny:()=>H,ZodArray:()=>U,ZodBigInt:()=>ee,ZodBoolean:()=>te,ZodBranded:()=>Re,ZodCatch:()=>fe,ZodDate:()=>re,ZodDefault:()=>de,ZodDiscriminatedUnion:()=>Be,ZodEffects:()=>D,ZodEnum:()=>ue,ZodError:()=>R,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>He,ZodIntersection:()=>ie,ZodIssueCode:()=>u,ZodLazy:()=>oe,ZodLiteral:()=>ce,ZodMap:()=>ke,ZodNaN:()=>we,ZodNativeEnum:()=>le,ZodNever:()=>N,ZodNull:()=>se,ZodNullable:()=>$,ZodNumber:()=>Q,ZodObject:()=>C,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ce,ZodPromise:()=>q,ZodReadonly:()=>pe,ZodRecord:()=>Ke,ZodSchema:()=>v,ZodSet:()=>be,ZodString:()=>K,ZodSymbol:()=>ve,ZodTransformer:()=>D,ZodTuple:()=>j,ZodType:()=>v,ZodUndefined:()=>ne,ZodUnion:()=>ae,ZodUnknown:()=>V,ZodVoid:()=>xe,addIssueToContext:()=>d,any:()=>Tn,array:()=>On,bigint:()=>bn,boolean:()=>Jt,coerce:()=>ts,custom:()=>Gt,date:()=>wn,datetimeRegex:()=>Ht,defaultErrorMap:()=>L,discriminatedUnion:()=>Mn,effect:()=>qn,enum:()=>Bn,function:()=>Fn,getErrorMap:()=>ge,getParsedType:()=>M,instanceof:()=>xn,intersection:()=>jn,isAborted:()=>Ve,isAsync:()=>ye,isDirty:()=>Ue,isValid:()=>B,late:()=>vn,lazy:()=>Vn,literal:()=>Un,makeIssue:()=>Te,map:()=>zn,nan:()=>kn,nativeEnum:()=>Kn,never:()=>Cn,null:()=>An,nullable:()=>Wn,number:()=>Yt,object:()=>Dn,objectUtil:()=>ut,oboolean:()=>es,onumber:()=>Qn,optional:()=>Gn,ostring:()=>Xn,pipeline:()=>Jn,preprocess:()=>Yn,promise:()=>Hn,quotelessJson:()=>Hr,record:()=>Zn,set:()=>Ln,setErrorMap:()=>Gr,strictObject:()=>Nn,string:()=>Wt,symbol:()=>En,transformer:()=>qn,tuple:()=>$n,undefined:()=>Sn,union:()=>Pn,unknown:()=>Rn,util:()=>x,void:()=>In});var mt=b(()=>{Fe();dt();Lt();Ae();Xt();Le()});var qe=b(()=>{mt();mt()});import{createHash as ns}from"node:crypto";function Ge(t){let e=Qt.get(t);return e||(e=ns("sha256").update(`tkr:${t}`).digest("hex").slice(0,16),Qt.set(t,e)),e}var ss,as,er,Qt,We=b(()=>{"use strict";qe();ss=m.enum(["normal","compact","minimal"]),as=m.enum(["off","light","balanced","max"]),er=m.object({enabled:m.boolean().default(!0),telemetryOptIn:m.boolean().default(!0),outputVerbosity:ss.default("compact"),reducer:as.default("off"),filters:m.object({enableAll:m.boolean().default(!0),disabled:m.array(m.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})}),Qt=new Map});import tr from"node:os";import{join as me}from"node:path";function S(){return process.env.TOKMIZER_HOME||me(tr.homedir(),".tokmizer")}function Ie(){return me(S(),"install-id")}function ht(){return me(S(),"bundle-refresh.json")}function Ye(){return me(S(),"skills")}function Oe(t){return me(Ye(),`${t}.md`)}function Je(){return process.env.TOKMIZER_CLAUDE_COMMANDS_DIR||me(tr.homedir(),".claude","commands")}function De(t){return me(Je(),`${t}.md`)}var G=b(()=>{"use strict"});import Ee from"node:os";import{createHash as is,randomUUID as os}from"node:crypto";import{readFile as rr,writeFile as nr,mkdir as cs}from"node:fs/promises";async function yt(){try{let r=(await rr(Ie(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(r))return r}catch{}await cs(S(),{recursive:!0});let t=os();try{return await nr(Ie(),t,{mode:384,flag:"wx"}),t}catch{try{let e=(await rr(Ie(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(e))return e}catch{}return await nr(Ie(),t,{mode:384}),t}}function gt(t){return is("sha256").update(t).digest("hex")}function us(){let t=Ee.networkInterfaces();for(let e of Object.keys(t))for(let r of t[e]??[])if(!r.internal&&r.mac&&r.mac!=="00:00:00:00:00:00")return r.mac;return"no-mac"}async function P(){let t=await yt(),e=Ee.hostname(),r=Ee.platform(),n=Ee.release(),s=Ee.cpus(),a=s[0]?.model??"unknown",i=s.length,o=gt(us()),c=gt(Ee.userInfo().username),l=[e,r,n,a,String(i),o,c,t].join("|");return{fingerprint:gt(l),installId:t,hostname:e,os:r,osVersion:n,cpuModel:a,cpuCores:i,macHash:o,usernameHash:c}}var he=b(()=>{"use strict";G()});import{join as _t}from"node:path";import{mkdir as ls,readFile as ds,writeFile as fs,unlink as ps,rename as ms}from"node:fs/promises";function Se(){try{let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t&&t.length>0?t:"Etc/UTC"}catch{return"Etc/UTC"}}function xt(t){return t?.dir??S()}async function Z(t){let e=xt(t);try{let r=await ds(_t(e,vt),"utf8"),n=JSON.parse(r);return{...n,lastSettingsRevision:n.lastSettingsRevision??0,timeZone:n.timeZone??Se(),bonusActive:n.bonusActive??!1,...n.bonusResetAt!==void 0?{bonusResetAt:n.bonusResetAt}:{}}}catch{return null}}async function Xe(t,e){let r=xt(e);await ls(r,{recursive:!0});let n=_t(r,vt),s=`${n}.tmp`;await fs(s,JSON.stringify(t,null,2),{mode:384}),await ms(s,n)}async function sr(t){let e=xt(t);try{await ps(_t(e,vt))}catch{return}}var vt,_i,Ne=b(()=>{"use strict";G();vt="state.json",_i={lastSettingsRevision:0,timeZone:Se(),bonusActive:!1}});import{createRequire as hs}from"node:module";function ys(){for(let t of["../package.json","../../package.json"])try{let e=gs(t).version;if(typeof e=="string"&&e)return e}catch{}return"0.0.0"}var gs,W,Qe=b(()=>{"use strict";gs=hs(import.meta.url);W=ys()});var ar,ir=b(()=>{"use strict";ar=`-----BEGIN PUBLIC KEY-----
|
|
2
|
+
var Kr=Object.defineProperty;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var ze=(t,e)=>{for(var r in e)Kr(t,r,{get:e[r],enumerable:!0})};var x,ct,f,j,Ae=b(()=>{(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},t.getValidEnumValues=s=>{let a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(let i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ct||(ct={}));f=x.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 u,Hr,R,Le=b(()=>{Ae();u=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Hr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let 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},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),n}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,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};R.create=t=>new R(t)});var qr,L,ut=b(()=>{Le();Ae();qr=(t,e)=>{let r;switch(t.code){case u.invalid_type:t.received===f.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case u.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:r=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case u.invalid_union:r="Invalid input";break;case u.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case u.invalid_enum_value:r=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case u.invalid_arguments:r="Invalid function arguments";break;case u.invalid_return_type:r="Invalid function return type";break;case u.invalid_date:r="Invalid date";break;case u.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}"`:x.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case u.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 u.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 u.custom:r="Invalid input";break;case u.invalid_intersection_types:r="Intersection results could not be merged";break;case u.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case u.not_finite:r="Number must be finite";break;default:r=e.defaultError,x.assertNever(t)}return{message:r}},L=qr});function Gr(t){Lt=t}function ge(){return Lt}var Lt,Fe=b(()=>{ut();Lt=L});function d(t,e){let r=ge(),n=Te({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===L?void 0:L].filter(s=>!!s)});t.common.issues.push(n)}var Te,Wr,S,g,X,A,Ve,Ue,B,ye,lt=b(()=>{Fe();ut();Te=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},Wr=[];S=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 n=[];for(let s of r){if(s.status==="aborted")return g;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let a=await s.key,i=await s.value;n.push({key:a,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return g;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},g=Object.freeze({status:"aborted"}),X=t=>({status:"dirty",value:t}),A=t=>({status:"valid",value:t}),Ve=t=>t.status==="aborted",Ue=t=>t.status==="dirty",B=t=>t.status==="valid",ye=t=>typeof Promise<"u"&&t instanceof Promise});var Ft=b(()=>{});var p,Vt=b(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}))});function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}function Ht(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 pn(t){return new RegExp(`^${Ht(t)}$`)}function qt(t){let e=`${Kt}T${Ht(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 mn(t,e){return!!((e==="v4"||!e)&&an.test(t)||(e==="v6"||!e)&&cn.test(t))}function hn(t,e){if(!tn.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function gn(t,e){return!!((e==="v4"||!e)&&on.test(t)||(e==="v6"||!e)&&un.test(t))}function yn(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}function _e(t){if(t instanceof C){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=I.create(_e(n))}return new C({...t._def,shape:()=>e})}else return t instanceof U?new U({...t._def,type:_e(t.element)}):t instanceof I?I.create(_e(t.unwrap())):t instanceof Z?Z.create(_e(t.unwrap())):t instanceof $?$.create(t.items.map(e=>_e(e))):t}function ft(t,e){let r=j(t),n=j(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&n===f.object){let s=x.objectKeys(e),a=x.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(let o of a){let c=ft(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===f.array&&n===f.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<t.length;a++){let i=t[a],o=e[a],c=ft(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===f.date&&n===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Gt(t,e){return new ue({values:t,typeName:y.ZodEnum,..._(e)})}function Bt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Wt(t,e={},r){return t?H.create().superRefine((n,s)=>{let a=t(n);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Bt(e,n),c=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:c})}});if(!a){let i=Bt(e,n),o=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:o})}}):H.create()}var D,Ut,v,Yr,Jr,Xr,Qr,en,tn,rn,nn,sn,dt,an,on,cn,un,ln,dn,Kt,fn,K,Q,ee,te,re,ve,ne,se,H,V,N,xe,U,C,ae,F,Be,ie,$,Ke,ke,be,He,oe,ce,ue,le,q,O,I,Z,de,fe,we,_n,Re,Ce,pe,vn,y,xn,Yt,Jt,kn,bn,Xt,wn,En,Sn,An,Tn,Rn,Cn,In,Dn,On,Nn,Pn,Mn,jn,$n,Zn,zn,Ln,Fn,Vn,Un,Bn,Kn,Hn,qn,Gn,Wn,Yn,Jn,Xn,Qn,es,ts,rs,Qt=b(()=>{Le();Fe();Vt();lt();Ae();D=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ut=(t,e)=>{if(B(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 R(t.common.issues);return this._error=r,this._error}}};v=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 S,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(ye(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 n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Ut(n,s)}"~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 n=this._parseSync({data:e,path:[],parent:r});return B(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>B(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ye(s)?s:Promise.resolve(s));return Ut(n,a)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:u.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new O({schema:this,typeName:y.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 I.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return U.create(this)}promise(){return q.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new O({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new de({..._(this._def),innerType:this,defaultValue:r,typeName:y.ZodDefault})}brand(){return new Re({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fe({..._(this._def),innerType:this,catchValue:r,typeName:y.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ce.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Yr=/^c[^\s-]{8,}$/i,Jr=/^[0-9a-z]+$/,Xr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qr=/^[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,en=/^[a-z0-9_-]{21}$/i,tn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rn=/^[-+]?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)?)??$/,nn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",an=/^(?:(?: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])$/,on=/^(?:(?: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])$/,cn=/^(([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]))$/,un=/^(([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])$/,ln=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kt="((\\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])))",fn=new RegExp(`^${Kt}$`);K=class t extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_type,expected:f.string,received:a.parsedType}),g}let n=new S,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?d(s,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(s,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")nn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")dt||(dt=new RegExp(sn,"u")),dt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Qr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")en.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Yr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Jr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Xr.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:u.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"regex",code:u.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?qt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?fn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?pn(a).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?rn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?mn(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?hn(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?gn(e.data,a.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ln.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?dn.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:u.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:u.invalid_string,...p.errToObj(n)})}_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}};K.create=t=>new K({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});Q=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_type,expected:f.number,received:a.parsedType}),g}let n,s=new S;for(let a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:u.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?yn(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:u.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.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,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:p.toString(s)}]})}_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"&&x.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Q.create=t=>new Q({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});ee=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let n,s=new S;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return d(r,{code:u.invalid_type,expected:f.bigint,received:r.parsedType}),g}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,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:p.toString(s)}]})}_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}};ee.create=t=>new ee({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});te=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.boolean,received:n.parsedType}),g}return A(e.data)}};te.create=t=>new te({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});re=class t extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_type,expected:f.date,received:a.parsedType}),g}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:u.invalid_date}),g}let n=new S,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.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}};re.create=t=>new re({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});ve=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.symbol,received:n.parsedType}),g}return A(e.data)}};ve.create=t=>new ve({typeName:y.ZodSymbol,..._(t)});ne=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.undefined,received:n.parsedType}),g}return A(e.data)}};ne.create=t=>new ne({typeName:y.ZodUndefined,..._(t)});se=class extends v{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.null,received:n.parsedType}),g}return A(e.data)}};se.create=t=>new se({typeName:y.ZodNull,..._(t)});H=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}};H.create=t=>new H({typeName:y.ZodAny,..._(t)});V=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}};V.create=t=>new V({typeName:y.ZodUnknown,..._(t)});N=class extends v{_parse(e){let r=this._getOrReturnCtx(e);return d(r,{code:u.invalid_type,expected:f.never,received:r.parsedType}),g}};N.create=t=>new N({typeName:y.ZodNever,..._(t)});xe=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.void,received:n.parsedType}),g}return A(e.data)}};xe.create=t=>new xe({typeName:y.ZodVoid,..._(t)});U=class t extends v{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==f.array)return d(r,{code:u.invalid_type,expected:f.array,received:r.parsedType}),g;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(d(r,{code:i?u.too_big:u.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(d(r,{code:u.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(d(r,{code:u.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new D(r,i,r.path,o)))).then(i=>S.mergeArray(n,i));let a=[...r.data].map((i,o)=>s.type._parseSync(new D(r,i,r.path,o)));return S.mergeArray(n,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)}};U.create=(t,e)=>new U({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});C=class t extends v{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=x.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 d(l,{code:u.invalid_type,expected:f.object,received:l.parsedType}),g}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||o.push(l);let c=[];for(let l of i){let h=a[l],k=s.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new D(s,k,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof N){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")o.length>0&&(d(s,{code:u.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let h of o){let k=s.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new D(s,k,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of c){let k=await h.key,w=await h.value;l.push({key:k,value:w,alwaysSet:h.alwaysSet})}return l}).then(l=>S.mergeObjectSync(n,l)):S.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}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:y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of x.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of x.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return _e(this)}partial(e){let r={};for(let n of x.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of x.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof I;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return Gt(x.objectKeys(this.shape))}};C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:N.create(),typeName:y.ZodObject,..._(e)});C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:N.create(),typeName:y.ZodObject,..._(e)});C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:N.create(),typeName:y.ZodObject,..._(e)});ae=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new R(o.ctx.common.issues));return d(r,{code:u.invalid_union,unionErrors:i}),g}if(r.common.async)return Promise.all(n.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(s);{let a,i=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,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(c=>new R(c));return d(r,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}};ae.create=(t,e)=>new ae({options:t,typeName:y.ZodUnion,..._(e)});F=t=>t instanceof oe?F(t.schema):t instanceof O?F(t.innerType()):t instanceof ce?[t.value]:t instanceof ue?t.options:t instanceof le?x.objectValues(t.enum):t instanceof de?F(t._def.innerType):t instanceof ne?[void 0]:t instanceof se?[null]:t instanceof I?[void 0,...F(t.unwrap())]:t instanceof Z?[null,...F(t.unwrap())]:t instanceof Re||t instanceof pe?F(t.unwrap()):t instanceof fe?F(t._def.innerType):[],Be=class t extends v{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return d(r,{code:u.invalid_type,expected:f.object,received:r.parsedType}),g;let n=this.discriminator,s=r.data[n],a=this.optionsMap.get(s);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}):(d(r,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let a of r){let i=F(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,..._(n)})}};ie=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Ve(a)||Ve(i))return g;let o=ft(a.value,i.value);return o.valid?((Ue(a)||Ue(i))&&r.dirty(),{status:r.value,value:o.data}):(d(n,{code:u.invalid_intersection_types}),g)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ie.create=(t,e,r)=>new ie({left:t,right:e,typeName:y.ZodIntersection,..._(r)});$=class t extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return d(n,{code:u.invalid_type,expected:f.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return d(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new D(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>S.mergeArray(r,i)):S.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};$.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};Ke=class t extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return d(n,{code:u.invalid_type,expected:f.object,received:n.parsedType}),g;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new D(n,o,n.path,o)),value:i._parse(new D(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?S.mergeObjectAsync(r,s):S.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof v?new t({keyType:e,valueType:r,typeName:y.ZodRecord,..._(n)}):new t({keyType:K.create(),valueType:e,typeName:y.ZodRecord,..._(r)})}},ke=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return d(n,{code:u.invalid_type,expected:f.map,received:n.parsedType}),g;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:s._parse(new D(n,o,n.path,[l,"key"])),value:a._parse(new D(n,c,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of i){let l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}}}};ke.create=(t,e,r)=>new ke({valueType:e,keyType:t,typeName:y.ZodMap,..._(r)});be=class t extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return d(n,{code:u.invalid_type,expected:f.set,received:n.parsedType}),g;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(d(n,{code:u.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(d(n,{code:u.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let a=this._def.valueType;function i(c){let l=new Set;for(let h of c){if(h.status==="aborted")return g;h.status==="dirty"&&r.dirty(),l.add(h.value)}return{status:r.value,value:l}}let o=[...n.data.values()].map((c,l)=>a._parse(new D(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):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)}};be.create=(t,e)=>new be({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});He=class t extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return d(r,{code:u.invalid_type,expected:f.function,received:r.parsedType}),g;function n(o,c){return Te({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ge(),L].filter(l=>!!l),issueData:{code:u.invalid_arguments,argumentsError:c}})}function s(o,c){return Te({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ge(),L].filter(l=>!!l),issueData:{code:u.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof q){let o=this;return A(async function(...c){let l=new R([]),h=await o._def.args.parseAsync(c,a).catch(T=>{throw l.addIssue(n(c,T)),l}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(T=>{throw l.addIssue(s(k,T)),l})})}else{let o=this;return A(function(...c){let l=o._def.args.safeParse(c,a);if(!l.success)throw new R([n(c,l.error)]);let h=Reflect.apply(i,this,l.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new R([s(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:$.create(e).rest(V.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,n){return new t({args:e||$.create([]).rest(V.create()),returns:r||V.create(),typeName:y.ZodFunction,..._(n)})}},oe=class extends v{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})}};oe.create=(t,e)=>new oe({getter:t,typeName:y.ZodLazy,..._(e)});ce=class extends v{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return d(r,{received:r.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};ce.create=(t,e)=>new ce({value:t,typeName:y.ZodLiteral,..._(e)});ue=class t extends v{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return d(r,{expected:x.joinValues(n),received:r.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return d(r,{received:r.data,code:u.invalid_enum_value,options:n}),g}return A(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(n=>!e.includes(n)),{...this._def,...r})}};ue.create=Gt;le=class extends v{_parse(e){let r=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let s=x.objectValues(r);return d(n,{expected:x.joinValues(s),received:n.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=x.objectValues(r);return d(n,{received:n.data,code:u.invalid_enum_value,options:s}),g}return A(e.data)}get enum(){return this._def.values}};le.create=(t,e)=>new le({values:t,typeName:y.ZodNativeEnum,..._(e)});q=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.promise&&r.common.async===!1)return d(r,{code:u.invalid_type,expected:f.promise,received:r.parsedType}),g;let n=r.parsedType===f.promise?r.data:Promise.resolve(r.data);return A(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};q.create=(t,e)=>new q({type:t,typeName:y.ZodPromise,..._(e)});O=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{d(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return g;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?g:c.status==="dirty"?X(c.value):r.value==="dirty"?X(c.value):c});{if(r.value==="aborted")return g;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?g:o.status==="dirty"?X(o.value):r.value==="dirty"?X(o.value):o}}if(s.type==="refinement"){let i=o=>{let c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?g:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?g:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!B(i))return g;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>B(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):g);x.assertNever(s)}};O.create=(t,e,r)=>new O({schema:t,typeName:y.ZodEffects,effect:e,..._(r)});O.createWithPreprocess=(t,e,r)=>new O({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,..._(r)});I=class extends v{_parse(e){return this._getType(e)===f.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(t,e)=>new I({innerType:t,typeName:y.ZodOptional,..._(e)});Z=class extends v{_parse(e){return this._getType(e)===f.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(t,e)=>new Z({innerType:t,typeName:y.ZodNullable,..._(e)});de=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};de.create=(t,e)=>new de({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});fe=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ye(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new R(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new R(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});we=class extends v{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:f.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}};we.create=t=>new we({typeName:y.ZodNaN,..._(t)});_n=Symbol("zod_brand"),Re=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ce=class t extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?g:a.status==="dirty"?(r.dirty(),X(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?g:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:y.ZodPipeline})}},pe=class extends v{_parse(e){let r=this._def.innerType._parse(e),n=s=>(B(s)&&(s.value=Object.freeze(s.value)),s);return ye(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};pe.create=(t,e)=>new pe({innerType:t,typeName:y.ZodReadonly,..._(e)});vn={object:C.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"})(y||(y={}));xn=(t,e={message:`Input not instance of ${t.name}`})=>Wt(r=>r instanceof t,e),Yt=K.create,Jt=Q.create,kn=we.create,bn=ee.create,Xt=te.create,wn=re.create,En=ve.create,Sn=ne.create,An=se.create,Tn=H.create,Rn=V.create,Cn=N.create,In=xe.create,Dn=U.create,On=C.create,Nn=C.strictCreate,Pn=ae.create,Mn=Be.create,jn=ie.create,$n=$.create,Zn=Ke.create,zn=ke.create,Ln=be.create,Fn=He.create,Vn=oe.create,Un=ce.create,Bn=ue.create,Kn=le.create,Hn=q.create,qn=O.create,Gn=I.create,Wn=Z.create,Yn=O.createWithPreprocess,Jn=Ce.create,Xn=()=>Yt().optional(),Qn=()=>Jt().optional(),es=()=>Xt().optional(),ts={string:(t=>K.create({...t,coerce:!0})),number:(t=>Q.create({...t,coerce:!0})),boolean:(t=>te.create({...t,coerce:!0})),bigint:(t=>ee.create({...t,coerce:!0})),date:(t=>re.create({...t,coerce:!0}))},rs=g});var m={};ze(m,{BRAND:()=>_n,DIRTY:()=>X,EMPTY_PATH:()=>Wr,INVALID:()=>g,NEVER:()=>rs,OK:()=>A,ParseStatus:()=>S,Schema:()=>v,ZodAny:()=>H,ZodArray:()=>U,ZodBigInt:()=>ee,ZodBoolean:()=>te,ZodBranded:()=>Re,ZodCatch:()=>fe,ZodDate:()=>re,ZodDefault:()=>de,ZodDiscriminatedUnion:()=>Be,ZodEffects:()=>O,ZodEnum:()=>ue,ZodError:()=>R,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>He,ZodIntersection:()=>ie,ZodIssueCode:()=>u,ZodLazy:()=>oe,ZodLiteral:()=>ce,ZodMap:()=>ke,ZodNaN:()=>we,ZodNativeEnum:()=>le,ZodNever:()=>N,ZodNull:()=>se,ZodNullable:()=>Z,ZodNumber:()=>Q,ZodObject:()=>C,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ce,ZodPromise:()=>q,ZodReadonly:()=>pe,ZodRecord:()=>Ke,ZodSchema:()=>v,ZodSet:()=>be,ZodString:()=>K,ZodSymbol:()=>ve,ZodTransformer:()=>O,ZodTuple:()=>$,ZodType:()=>v,ZodUndefined:()=>ne,ZodUnion:()=>ae,ZodUnknown:()=>V,ZodVoid:()=>xe,addIssueToContext:()=>d,any:()=>Tn,array:()=>Dn,bigint:()=>bn,boolean:()=>Xt,coerce:()=>ts,custom:()=>Wt,date:()=>wn,datetimeRegex:()=>qt,defaultErrorMap:()=>L,discriminatedUnion:()=>Mn,effect:()=>qn,enum:()=>Bn,function:()=>Fn,getErrorMap:()=>ge,getParsedType:()=>j,instanceof:()=>xn,intersection:()=>jn,isAborted:()=>Ve,isAsync:()=>ye,isDirty:()=>Ue,isValid:()=>B,late:()=>vn,lazy:()=>Vn,literal:()=>Un,makeIssue:()=>Te,map:()=>zn,nan:()=>kn,nativeEnum:()=>Kn,never:()=>Cn,null:()=>An,nullable:()=>Wn,number:()=>Jt,object:()=>On,objectUtil:()=>ct,oboolean:()=>es,onumber:()=>Qn,optional:()=>Gn,ostring:()=>Xn,pipeline:()=>Jn,preprocess:()=>Yn,promise:()=>Hn,quotelessJson:()=>Hr,record:()=>Zn,set:()=>Ln,setErrorMap:()=>Gr,strictObject:()=>Nn,string:()=>Yt,symbol:()=>En,transformer:()=>qn,tuple:()=>$n,undefined:()=>Sn,union:()=>Pn,unknown:()=>Rn,util:()=>x,void:()=>In});var pt=b(()=>{Fe();lt();Ft();Ae();Qt();Le()});var qe=b(()=>{pt();pt()});import{createHash as ns}from"node:crypto";function Ge(t){let e=er.get(t);return e||(e=ns("sha256").update(`tkr:${t}`).digest("hex").slice(0,16),er.set(t,e)),e}var ss,as,tr,er,We=b(()=>{"use strict";qe();ss=m.enum(["normal","compact","minimal"]),as=m.enum(["off","light","balanced","max"]),tr=m.object({enabled:m.boolean().default(!0),telemetryOptIn:m.boolean().default(!0),outputVerbosity:ss.default("compact"),reducer:as.default("off"),filters:m.object({enableAll:m.boolean().default(!0),disabled:m.array(m.string().max(64)).max(100).default([])}).default({enableAll:!0,disabled:[]})}),er=new Map});import rr from"node:os";import{join as me}from"node:path";function E(){return process.env.TOKMIZER_HOME||me(rr.homedir(),".tokmizer")}function Ie(){return me(E(),"install-id")}function mt(){return me(E(),"bundle-refresh.json")}function Ye(){return me(E(),"skills")}function De(t){return me(Ye(),`${t}.md`)}function Je(){return process.env.TOKMIZER_CLAUDE_COMMANDS_DIR||me(rr.homedir(),".claude","commands")}function Oe(t){return me(Je(),`${t}.md`)}var G=b(()=>{"use strict"});import Ee from"node:os";import{createHash as is,randomUUID as os}from"node:crypto";import{readFile as nr,writeFile as sr,mkdir as cs}from"node:fs/promises";async function gt(){try{let r=(await nr(Ie(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(r))return r}catch{}await cs(E(),{recursive:!0});let t=os();try{return await sr(Ie(),t,{mode:384,flag:"wx"}),t}catch{try{let e=(await nr(Ie(),"utf8")).trim();if(/^[0-9a-f-]{36}$/i.test(e))return e}catch{}return await sr(Ie(),t,{mode:384}),t}}function ht(t){return is("sha256").update(t).digest("hex")}function us(){let t=Ee.networkInterfaces();for(let e of Object.keys(t))for(let r of t[e]??[])if(!r.internal&&r.mac&&r.mac!=="00:00:00:00:00:00")return r.mac;return"no-mac"}async function P(){let t=await gt(),e=Ee.hostname(),r=Ee.platform(),n=Ee.release(),s=Ee.cpus(),a=s[0]?.model??"unknown",i=s.length,o=ht(us()),c=ht(Ee.userInfo().username),l=[e,r,n,a,String(i),o,c,t].join("|");return{fingerprint:ht(l),installId:t,hostname:e,os:r,osVersion:n,cpuModel:a,cpuCores:i,macHash:o,usernameHash:c}}var he=b(()=>{"use strict";G()});import{join as yt}from"node:path";import{mkdir as ls,readFile as ds,writeFile as fs,unlink as ps,rename as ms}from"node:fs/promises";function Se(){try{let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t&&t.length>0?t:"Etc/UTC"}catch{return"Etc/UTC"}}function vt(t){return t?.dir??E()}async function M(t){let e=vt(t);try{let r=await ds(yt(e,_t),"utf8"),n=JSON.parse(r);return{...n,lastSettingsRevision:n.lastSettingsRevision??0,timeZone:n.timeZone??Se(),bonusActive:n.bonusActive??!1,...n.bonusResetAt!==void 0?{bonusResetAt:n.bonusResetAt}:{}}}catch{return null}}async function Xe(t,e){let r=vt(e);await ls(r,{recursive:!0});let n=yt(r,_t),s=`${n}.tmp`;await fs(s,JSON.stringify(t,null,2),{mode:384}),await ms(s,n)}async function ar(t){let e=vt(t);try{await ps(yt(e,_t))}catch{return}}var _t,ki,Ne=b(()=>{"use strict";G();_t="state.json",ki={lastSettingsRevision:0,timeZone:Se(),bonusActive:!1}});import{createRequire as hs}from"node:module";function ys(){for(let t of["../package.json","../../package.json"])try{let e=gs(t).version;if(typeof e=="string"&&e)return e}catch{}return"0.0.0"}var gs,W,Qe=b(()=>{"use strict";gs=hs(import.meta.url);W=ys()});var ir,or=b(()=>{"use strict";ir=`-----BEGIN PUBLIC KEY-----
|
|
3
3
|
MCowBQYDK2VwAyEAj/kMlXlhTIGHRKxOKMuGFa1S1ybxxwgdYcAE0YM9fgU=
|
|
4
4
|
-----END PUBLIC KEY-----
|
|
5
|
-
`});import{createHmac as _s,createPublicKey as vs,verify as xs}from"node:crypto";function
|
|
6
|
-
`)}function bs(t,e,r,n){try{let s=vs({key:n,format:"pem"});return xs(null,Buffer.from(`${e}.${t}`,"utf8"),s,Buffer.from(r,"base64url"))}catch{return!1}}async function J(t){let e=await t.text(),r=
|
|
7
|
-
`,
|
|
8
|
-
`,{mode:384}),oa(r,384)}catch{return}}function
|
|
9
|
-
`))if(a.trim())try{s.push(JSON.parse(a))}catch{continue}return s.length===0?(
|
|
5
|
+
`});import{createHmac as _s,createPublicKey as vs,verify as xs}from"node:crypto";function xt(){return((process.env.TOKMIZER_DEV==="1"?process.env.TOKMIZER_RESP_SIGNING_PUBLIC_KEY_PEM:void 0)??ir).replace(/\\n/g,`
|
|
6
|
+
`)}function bs(t,e,r,n){try{let s=vs({key:n,format:"pem"});return xs(null,Buffer.from(`${e}.${t}`,"utf8"),s,Buffer.from(r,"base64url"))}catch{return!1}}async function J(t){let e=await t.text(),r=xt(),n=t.headers?.get?.("x-tokmizer-resp-ts")??null;if(n!==null){let i=Number(n);if(!Number.isFinite(i)||Date.now()-i>ks)throw new Y("http","stale server response (resp-ts outside freshness window)")}if(!r||!r.includes("BEGIN PUBLIC KEY"))throw new Y("http","no signing public key configured; refusing to trust server response");let s=t.headers?.get?.("x-tokmizer-resp-sig")??null,a=Number(n);if(!s||n===null||!Number.isFinite(a))throw new Y("http","missing server response signature");if(!bs(e,a,s,r))throw new Y("http","invalid server response signature");return JSON.parse(e)}function ws(t,e,r){return _s("sha256",r).update(`${e}.${t}`).digest("hex")}async function z(t,e,r,n){let s=Date.now(),a=r===void 0?"":JSON.stringify(r),i=n.signingSecret?ws(a,s,n.signingSecret):"0".repeat(64),o={"content-type":"application/json","x-tokmizer-fingerprint":n.fingerprint,"x-tokmizer-install-id":n.installId,"x-tokmizer-sig":i,"x-tokmizer-ts":String(s),"x-tokmizer-plugin-version":W};n.bearer&&(o.authorization=`Bearer ${n.bearer}`);let c=n.timeoutMs??5e3,l=t!=="GET"&&t!=="DELETE",h={method:t,headers:o,signal:AbortSignal.timeout(c)};l&&(h.body=a);try{return await fetch(`${n.baseUrl}${e}`,h)}catch(k){let w=k.name;throw w==="TimeoutError"||w==="AbortError"?new Y("timeout",`${t} ${e} timed out after ${c}ms`):new Y("network",`${t} ${e} failed: ${k.message}`)}}var ks,Y,Pe=b(()=>{"use strict";Qe();or();ks=300*1e3;Y=class extends Error{constructor(r,n,s){super(n);this.kind=r;this.status=s;this.name="TransportError"}kind;status}});var _r,vr=b(()=>{"use strict";qe();_r=m.object({slug:m.string().min(1).max(64),description:m.string().max(255).optional(),match_command:m.string().min(1),priority:m.number().int().default(50),strip_ansi:m.boolean().default(!1),strip_lines_matching:m.array(m.string()).default([]),truncate_lines_at:m.number().int().positive().max(1e4).optional(),max_lines:m.number().int().positive().max(1e5).optional(),transform:m.string().max(64).optional(),on_empty:m.string().max(255).optional()})});function kr(t){return JSON.stringify(t)+et}function*br(t){let e=0;for(;;){let r=t.indexOf(et,e);if(r<0)return;yield t.slice(e,r),e=r+1}}function tt(){return`${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var Ls,Fs,Vs,Us,to,ro,no,xr,et,so,wr=b(()=>{"use strict";qe();vr();Ls=m.object({id:m.string().min(1).max(64),op:m.literal("filter"),cmd:m.string().min(1).max(2048),plan:m.enum(["trial","smart","pro"]),installId:m.string().min(1).max(64).optional()}),Fs=m.object({id:m.string().min(1).max(64),op:m.literal("ping")}),Vs=m.object({id:m.string().min(1).max(64),op:m.literal("shutdown"),installId:m.string().min(1).max(64)}),Us=m.object({id:m.string().min(1).max(64),op:m.literal("reload"),installId:m.string().min(1).max(64).optional()}),to=m.discriminatedUnion("op",[Ls,Fs,Vs,Us]),ro=m.object({id:m.string(),ok:m.literal(!0),data:m.unknown()}),no=m.object({id:m.string(),ok:m.literal(!1),err:m.string(),retryAfterMs:m.number().int().nonnegative().optional()}),xr=m.object({filter:_r.nullable(),cacheHit:m.boolean().optional()}),et=`
|
|
7
|
+
`,so=64*1024});import{join as At}from"node:path";import{existsSync as Er,statSync as Bs,unlinkSync as Ks,mkdirSync as Hs,chmodSync as qs}from"node:fs";function rt(){if(process.platform==="win32")return{path:`\\\\.\\pipe\\tokmizer-${process.env.USERNAME??"tokmizer"}`,isPipe:!0};let t=typeof process.getuid=="function"?process.getuid():0,e=process.env.XDG_RUNTIME_DIR;if(e&&Er(e))return{path:At(e,`tokmizer-${t}.sock`),isPipe:!1};let r=At(E(),"run");try{Hs(r,{recursive:!0,mode:448}),qs(r,448)}catch{}return{path:At(r,"daemon.sock"),isPipe:!1}}async function Sr(){let{path:t,isPipe:e}=rt();if(e||!Er(t))return;try{if(!Bs(t).isSocket())return}catch{return}let r=await import("node:net");if(!await new Promise(s=>{let a=r.createConnection(t),i=o=>{a.removeAllListeners();try{a.destroy()}catch{}s(o)};a.once("connect",()=>i(!0)),a.once("error",o=>{let c=o.code;i(c!=="ECONNREFUSED"&&c!=="ENOENT")}),setTimeout(()=>i(!0),250)}))try{Ks(t)}catch{}}var uo,Ar=b(()=>{"use strict";G();uo=5*6e4});var Nr={};ze(Nr,{connectDaemon:()=>aa});import{createConnection as Gs}from"node:net";import{spawn as Ws}from"node:child_process";import{existsSync as Or,openSync as Tr,closeSync as Ys,unlinkSync as Rr,writeFileSync as Cr}from"node:fs";import{dirname as Js,join as Xs}from"node:path";import{fileURLToPath as Qs}from"node:url";async function ra(t,e){return new Promise((r,n)=>{let s=Gs(t),a=o=>{if(s.removeAllListeners("connect"),s.removeAllListeners("error"),clearTimeout(i),o){try{s.destroy()}catch{}n(o)}else r(s)},i=setTimeout(()=>a(new Error("connect timeout")),e);s.once("connect",()=>a(null)),s.once("error",o=>a(o))})}function na(){return process.env.TOKMIZER_DAEMON_BIN?process.env.TOKMIZER_DAEMON_BIN:Qs(new URL("../bin/tkr-daemon.js",import.meta.url))}async function Dr(t,e=3e3){let r=Math.ceil(e/75);for(let n=0;n<r;n++){if(Or(t))return!0;await new Promise(s=>setTimeout(s,75))}return!1}async function sa(t){let e=na();if(!Or(e))throw new Error(`tkr-daemon binary not found at ${e}`);let{path:r}=rt(),n=Xs(Js(r),"daemon.spawn.lock"),s=null;try{s=Tr(n,"wx"),Cr(s,String(process.pid))}catch(a){if(a.code==="EEXIST"){if(await Dr(r,5e3))return;try{Rr(n)}catch{}s=Tr(n,"wx"),Cr(s,String(process.pid))}else throw a}try{if(Ws(process.execPath,[e],{detached:!0,stdio:["ignore","ignore","ignore"],env:{...process.env,TOKMIZER_DAEMON_INSTALL_ID:t}}).unref(),!await Dr(r,3e3))throw new Error("tkr-daemon failed to bind socket within 3s")}finally{if(s!==null){try{Ys(s)}catch{}try{Rr(n)}catch{}}}}async function aa(t={}){let{path:e}=t.socketPath?{path:t.socketPath}:rt(),r=await gt(),n=null,s=0;for(;s<=Ir;)try{n=await ra(e,ea);break}catch{if(s+=1,s>Ir)throw new Error(`tkr-daemon unreachable at ${e}`);await Sr(),await sa(r)}if(!n)throw new Error("tkr-daemon: socket setup failed");let a=new Map,i="";n.setEncoding("utf8"),n.on("data",c=>{i+=c;let l=-1;for(let k=0;k<i.length;k++)i[k]===et&&(l=k);if(l<0)return;let h=[];for(let k of br(i.slice(0,l+1)))h.push(k);i=i.slice(l+1);for(let k of h)if(k)try{let w=JSON.parse(k),T=a.get(w.id);if(!T)continue;clearTimeout(T.timer),a.delete(w.id),T.resolve(w)}catch{}}),n.on("close",()=>{for(let c of a.values())clearTimeout(c.timer),c.reject(new Error("daemon socket closed"));a.clear()}),n.on("error",()=>{});function o(c){return new Promise((l,h)=>{let k=setTimeout(()=>{a.delete(c.id),h(new Error(`daemon request timeout (${c.op})`))},ta);a.set(c.id,{resolve:l,reject:h,timer:k}),n.write(kr(c))})}return{filter:async(c,l)=>{let h=await o({id:tt(),op:"filter",cmd:c.slice(0,2048),plan:l,installId:r});if(!h.ok)return null;let k=xr.safeParse(h.data);return k.success?k.data.filter:null},ping:async()=>{let c=await o({id:tt(),op:"ping"});if(!c.ok)throw new Error(c.err);return c.data},reload:async()=>{let c=await o({id:tt(),op:"reload",installId:r});if(!c.ok)throw new Error(c.err);return c.data},close:()=>{try{n.end()}catch{}}}}var ea,ta,Ir,Pr=b(()=>{"use strict";wr();Ar();he();ea=500,ta=3e3,Ir=1});function Me(t){let e=t;for(let[r,n]of ia)e=e.replace(r,n);return e}var ia,Tt=b(()=>{"use strict";ia=[[/(authorization\s*:\s*)([A-Za-z][A-Za-z0-9._-]*)\s+[^\s'"]+/gi,"$1$2 [REDACTED]"],[/(authorization\s*:\s*)[A-Za-z0-9._\-+/=]{8,}/gi,"$1[REDACTED]"],[/(bearer\s+)[A-Za-z0-9._\-+/=]{8,}/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-b|--cookie)[=\s]+['"]?)[^\s'";=]+=[^\s'";]+(?:\s*;\s*[^\s'";=]+=[^\s'";]+)*/gi,"$1[REDACTED]"],[/((?:^|[\s'"])(?:Set-)?Cookie\s*:\s*)[^\s'";=]+=[^\s'";]+(?:\s*;\s*[^\s'";=]+=[^\s'";]+)*/gi,"$1[REDACTED]"],[/(--?(?:password|passwd|passphrase|apipass|pass|pwd|token|api[-_]?key|secret|bearer|cookie|jwt)(?:-[a-z0-9]+)*[=\s]+)\S+/gi,"$1[REDACTED]"],[/((?:^|\s)-b[=\s]?['"]?)[^\s'"=]+=[^\s'"]+/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?[^\s:/'"]*:)(\/[^/\s'"][^\s'"]*|[^\s/'"0-9][^\s'"]*|[0-9][^\s'"]*[^\s'"0-9][^\s'"]*)/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?[^\s:/'"]*[^\s:/'"0-9][^\s:/'"]*:)(?:\/[^/\s'"]|[^\s/'"])[^\s'"]*/gi,"$1[REDACTED]"],[/((?:^|\s)(?:-u[=\s]?|(?:--user|-a)[=\s])['"]?:)(?:\/[^/\s'"]|[^\s/'"])[^\s'"]*/gi,"$1[REDACTED]"],[/((?:[A-Za-z0-9]+-)*(?:X-Api-Key|Private-Token|[A-Za-z0-9]+-(?:Token|Key|Auth|Secret))\s*:\s*)[^\s'"]+/gi,"$1[REDACTED]"],[/((?:^|[\s'"])(?:Set-)?Cookie\s*:\s*)[^\s'"]+/gi,"$1[REDACTED]"],[/(-i\s+)(\/[^\s]+|~\/[^\s]+|[A-Z]:\\[^\s]+)/g,"$1[REDACTED]"],[/([a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^:/\s@]*:)[^\s]+(@[^@/\s]+)/g,"$1[REDACTED]$2"],[/(AWS_(?:ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN)\s*=\s*)\S+/g,"$1[REDACTED]"],[/(GOOGLE_APPLICATION_CREDENTIALS\s*=\s*)\S+/g,"$1[REDACTED]"],[/(AZURE_(?:CLIENT_SECRET|TENANT_ID|CLIENT_ID)\s*=\s*)\S+/g,"$1[REDACTED]"],[/(sk-(?:proj-)?[A-Za-z0-9_-]{20,})/g,"sk-[REDACTED]"],[/\b(OPENAI_API_KEY\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(ANTHROPIC_API_KEY\s*=\s*)\S+/g,"$1[REDACTED]"],[/(sk-ant-[A-Za-z0-9_-]{20,})/g,"sk-ant-[REDACTED]"],[/\b(GH(?:_|ITHUB_)?TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(GITLAB_TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/\b(SLACK_(?:BOT_)?TOKEN\s*=\s*)\S+/g,"$1[REDACTED]"],[/(xox[bpsoa]-[A-Za-z0-9-]{10,})/g,"xox[REDACTED]"],[/(xapp-[A-Za-z0-9-]{10,})/g,"[REDACTED]"],[/(sk_(?:test|live)_[A-Za-z0-9]{16,})/g,"sk_[REDACTED]"],[/(gh[a-z])_[A-Za-z0-9]{20,}/g,"$1_[REDACTED]"],[/(github_pat)_[A-Za-z0-9_]{20,}/g,"$1_[REDACTED]"],[/(gl(?:pat|rt|soat|imt|dt|ft|agent|oas|cbt|ptt))-[A-Za-z0-9_-]{16,}/g,"$1-[REDACTED]"],[/(npm_[A-Za-z0-9_-]{20,})/g,"npm_[REDACTED]"],[/(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{16,}/g,"[REDACTED_AWS_KEY]"],[/AIza[A-Za-z0-9_-]{35}/g,"[REDACTED_GOOGLE_KEY]"],[/hv[sb]\.[A-Za-z0-9_-]{20,}/g,"[REDACTED_VAULT_TOKEN]"],[/dop_v1_[A-Za-z0-9]{40,}/g,"[REDACTED]"],[/dckr_pat_[A-Za-z0-9_-]{20,}/g,"[REDACTED]"],[/pypi-[A-Za-z0-9_-]{16,}/g,"[REDACTED]"],[/rk_(?:live|test)_[A-Za-z0-9]{16,}/g,"[REDACTED]"],[/whsec_[A-Za-z0-9]{16,}/g,"[REDACTED]"],[/SG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}/g,"[REDACTED]"],[/(eyJ[A-Za-z0-9_-]{6,}(?:\.[A-Za-z0-9_-]{4,}){1,2})/g,"[REDACTED_JWT]"],[/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[\s\S]*?-----END[^\n]*-----|\r?\n[A-Za-z0-9+/=][A-Za-z0-9+/=\r\n]*)?/g,"[REDACTED_PEM]"],[/\b((?:--?)?[A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|PASS|APIKEY|KEY|CRED|CREDS|CREDENTIAL|CREDENTIALS|AUTH|_PWD)[A-Za-z0-9_]*['"]?\s*=\s*)(?:"[^"]*"|'[^']*'|[^"'\s]\S*)/gi,"$1[REDACTED]"],[/\b([A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|PASS|APIKEY|KEY|CRED|CREDS|CREDENTIAL|CREDENTIALS|_PWD)[A-Za-z0-9_]*['"]?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s'",}]+)/gi,"$1[REDACTED]"],[/((?:^|[\s'"{,])['"]?(?:[A-Za-z0-9_]+_)?auth['"]?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s'",}]+)/gi,"$1[REDACTED]"],[/(\bpwd\s*[=:]\s*)(?:"[^"]*"|'[^']*'|[^/~\s][^\s;'"]*)/gi,"$1[REDACTED]"],[/([=:]\s*["']?)[A-Za-z0-9_\-+/=]{40,}/g,"$1[REDACTED]"]]});import{join as st}from"node:path";import{appendFileSync as Dt,chmodSync as oa,existsSync as je,mkdirSync as Ot,readFileSync as Rt,renameSync as Nt,rmdirSync as Mr,statSync as jr,unlinkSync as nt,utimesSync as ca,writeFileSync as ua}from"node:fs";function Pt(t){return st($e(),`${t}.lock`)}function fa(t){let e=Pt(t);try{return Ot($e(),{recursive:!0,mode:448}),Ot(e),!0}catch{try{Date.now()-jr(e).mtimeMs>da&&Mr(e)}catch{return!1}return!1}}function pa(t){try{ca(Pt(t),new Date,new Date)}catch{return}}function ma(t){try{Mr(Pt(t))}catch{return}}function $e(){return st(E(),"spool")}function $r(t){return st($e(),`${t}.jsonl`)}function Mt(t){return st($e(),`${t}.pending.jsonl`)}function at(t,e){try{Ot($e(),{recursive:!0,mode:448});let r=$r(t);if(je(r)&&jr(r).size>=la)return;Dt(r,JSON.stringify(e)+`
|
|
8
|
+
`,{mode:384}),oa(r,384)}catch{return}}function ha(t){try{let e=Mt(t),r=$r(t),n=`${r}.merging`;if(je(n)&&(Dt(e,Rt(n,"utf8"),{mode:384}),nt(n)),je(e))je(r)&&(Nt(r,n),Dt(e,Rt(n,"utf8"),{mode:384}),nt(n));else{if(!je(r))return[];Nt(r,e)}let s=[];for(let a of Rt(e,"utf8").split(`
|
|
9
|
+
`))if(a.trim())try{s.push(JSON.parse(a))}catch{continue}return s.length===0?(nt(e),[]):s}catch{return[]}}function Zr(t){try{nt(Mt(t))}catch{return}}function ga(t,e){if(e.length===0){Zr(t);return}let r=Mt(t),n=`${r}.tmp`;ua(n,e.map(s=>JSON.stringify(s)).join(`
|
|
10
10
|
`)+`
|
|
11
|
-
`,{mode:384}),Nt(n,r)}async function
|
|
11
|
+
`,{mode:384}),Nt(n,r)}async function it(t,e,r={}){if(It.has(t)||!fa(t))return"fail";It.add(t);try{let n=ha(t);if(n.length===0)return"empty";let s=await M();if(!s)return"fail";if(r.requirePro&&s.plan!=="pro")return Zr(t),"ok";let a=r.baseUrl??process.env.TOKMIZER_BASE_URL??"https://tokmizer.com",i=await P();for(let o=0;o<n.length;o+=Ct){pa(t);let c=await z("POST",e,{events:n.slice(o,o+Ct)},{baseUrl:a,bearer:s.jwt,signingSecret:s.signingSecret,fingerprint:i.fingerprint,installId:i.installId});if(!c.ok)return c.status===401||c.status===403?"auth":"fail";ga(t,n.slice(o+Ct))}return"ok"}catch{return"fail"}finally{It.delete(t),ma(t)}}var la,Ct,da,It,jt=b(()=>{"use strict";G();Ne();he();Pe();la=512*1024,Ct=100,da=12e4,It=new Set});var Lr={};ze(Lr,{commandName:()=>ot,flushTelemetry:()=>Sa,recordTelemetry:()=>Ea});function zr(t){let e=t.toLowerCase();return e.startsWith("git")||xa.has(e)}function ot(t){let e=t.trim().split(/\s+/).filter(o=>o.length>0),r=0;for(;r<e.length&&va.test(e[r]??"");)r+=1;let n=e[r];if(!n||!ya.test(n)||n.length>ba||zr(n)||ka.test(n)||Me(n)!==n)return"";let s=e[r+1];return s&&zr(s)?"":(s&&wa.has(n.toLowerCase())&&_a.test(s)?`${n} ${s}`:n).slice(0,64)}async function Ea(t){if(!t.telemetryOptIn)return;let e=ot(t.cmd),r=e&&Me(e)===e?e:"other";at("telemetry",{cmd:r,tokensSaved:Math.max(0,Math.round(t.tokensSaved)),optimized:t.optimized})}async function Sa(t){return it("telemetry","/api/v1/telemetry",{baseUrl:t})}var ya,_a,va,xa,ka,ba,wa,$t=b(()=>{"use strict";Tt();jt();ya=/^[a-z0-9][a-z0-9._-]*$/i,_a=/^[a-z][a-z-]+$/,va=/^[A-Za-z_][A-Za-z0-9_]*=/,xa=new Set(["gh","glab","gup","hub","gist"]),ka=/^(gh[a-z]_|github_pat_|gl(?:pat|rt|soat|imt|dt|ft|agent|oas)-|npm_|xox|sk-|sk_|eyj|a(?:kia|sia|gpa|ida|roa|npa)|aiza|hv[sb]\.)/i,ba=24,wa=new Set(["docker","podman","npm","pnpm","yarn","npx","bun","deno","cargo","rustup","go","pip","pip3","uv","poetry","brew","apt","apt-get","dnf","yum","pacman","kubectl","helm","terraform","aws","gcloud","az","systemctl","composer","bundle","gem","dotnet","prisma","tkr","rtk","token"])});var Fr={};ze(Fr,{flush:()=>Ta,recordEvent:()=>Aa});async function Aa(t){if(t.plan!=="pro")return;let e=ot(t.cmd);!e||Me(e)!==e||at("learn",{cmd:e,filterId:t.filterId==null?null:Ge(t.filterId),rawBytes:t.rawBytes,filteredBytes:t.filteredBytes})}async function Ta(t){return it("learn","/api/v1/learn",{baseUrl:t,requirePro:!0})}var Vr=b(()=>{"use strict";$t();Tt();jt();We()});We();he();Ne();Pe();G();import{readFile as $o,writeFile as Ra,mkdir as Zo}from"node:fs/promises";Pe();Ne();he();import{createPublicKey as Es,verify as Ss}from"node:crypto";function As(t,e){let r=xt();if(!r||!r.includes("BEGIN PUBLIC KEY"))throw new Error("Tokmizer plugin: no valid signing public key. Set TOKMIZER_RESP_SIGNING_PUBLIC_KEY_PEM or rebuild plugin against a prod key.");let n=Es({key:r,format:"pem"});try{let s=Buffer.from(e,"base64url");return Ss(null,Buffer.from(t,"utf8"),n,s)}catch{return!1}}var Ts=/^[a-z0-9][a-z0-9-]*$/;async function cr(t){let e=await M();if(!e)throw new Error("Plugin not activated.");let r=await P(),n=await z("GET","/api/v1/skills/bundle",void 0,{baseUrl:t,bearer:e.jwt,signingSecret:e.signingSecret,fingerprint:r.fingerprint,installId:r.installId,timeoutMs:8e3});if(!n.ok)throw new Error(`bundle fetch failed ${n.status}`);let s=await J(n),a=[];for(let i of s.bundles){if(!Ts.test(i.slug))throw new Error(`invalid bundle slug ${i.slug}`);let o=[...i.fragments].sort((c,l)=>c.position-l.position);for(let c of o)if(!As(c.body,c.hash))throw new Error(`fragment signature mismatch on ${i.slug}[${c.position}]`);a.push({slug:i.slug,version:i.version,body:o.map(c=>c.body).join(`
|
|
12
12
|
|
|
13
|
-
`)})}return a}G();import{chmod as
|
|
13
|
+
`)})}return a}G();import{chmod as kt,mkdir as bt,readFile as Rs,writeFile as wt,stat as Cs,readdir as ur,rm as lr}from"node:fs/promises";var Is="managed-by: tokmizer",Ds=3600*1e3,Os=10080*60*1e3;function Ns(){let t=Number(process.env.TOKMIZER_MAX_BUNDLE_AGE_MS);return Number.isFinite(t)&&t>0?t:Os}async function dr(t){try{let e=await Cs(De(t)),r=Date.now()-e.mtimeMs;return r<Ds&&r<=Ns()}catch{return!1}}async function fr(t,e){await bt(Ye(),{recursive:!0}),await wt(De(t),e,{mode:384}),await kt(De(t),384)}async function pr(t){let e=new Set(t),r;try{r=await ur(Ye())}catch{return}for(let n of r){if(!n.endsWith(".md"))continue;let s=n.slice(0,-3);if(!e.has(s))try{await lr(De(s))}catch{}}}async function mr(t,e){await bt(Je(),{recursive:!0}),await wt(Oe(t),e,{mode:384}),await kt(Oe(t),384)}async function Et(t){let e=new Set(t),r;try{r=await ur(Je())}catch{return}for(let n of r){if(!n.endsWith(".md"))continue;let s=n.slice(0,-3);if(!e.has(s))try{if(!(await Rs(Oe(s),"utf8")).includes(Is))continue;await lr(Oe(s))}catch{}}}async function St(t){try{await bt(E(),{recursive:!0}),await wt(mt(),JSON.stringify({at:Date.now(),error:t}),{mode:384}),await kt(mt(),384)}catch{}}var hr={welcome:"Link your paid Tokmizer account.",needToken:"Tokmizer already works for free on this device. Linking is only to attach a paid plan.",getToken:"Subscribe at tokmizer.com/#pricing, then grab your key from your dashboard.",askToken:"Paste your dashboard key, then press Enter:",activating:"Linking...",activated:t=>`Linked. You are on the ${t} plan.`,failed:t=>`Activation failed: ${t}`,trialEnded:"Your trial has ended. Renew at tokmizer.com/dashboard/billing",suspended:t=>`Your token is suspended. ${t}`,revoked:"Your token has been revoked. Contact support at tokmizer.com/contact",rotated:"Token rotated. Paste your new token from tokmizer.com/dashboard/token",offline:"Network required. Tokmizer needs an internet connection.",deviceCap:"Device limit reached. Manage devices at tokmizer.com/dashboard/devices"};Ne();he();Pe();We();G();import{readFile as Li,writeFile as Ps,mkdir as Ms,chmod as js}from"node:fs/promises";import{join as $s}from"node:path";var Zs="settings-cache.json",Bi=tr.parse({});async function gr(t){await Ms(E(),{recursive:!0});let e=$s(E(),Zs);await Ps(e,JSON.stringify(t,null,2),{mode:384});try{await js(e,384)}catch{}}async function zs(t,e){let r=await M();if(!r)throw new Error("Not activated. Run: tkr link");let n=process.env.TOKMIZER_BASE_URL??"https://tokmizer.com",s=await P(),a=await z(t,"/api/v1/settings",e,{baseUrl:n,bearer:r.jwt,signingSecret:r.signingSecret,fingerprint:s.fingerprint,installId:s.installId,timeoutMs:8e3});if(!a.ok)throw new Error(`Settings ${t} failed: ${a.status}`);let i=await J(a);return await gr(i.settings),i}async function yr(){return zs("GET")}Qe();var Ur="-command",Br=3;async function Zt(t,e){if(!(!e&&await dr("power")))try{let r=await cr(t),n=[],s=[];for(let a of r)if(a.slug.endsWith(Ur)){let i=a.slug.slice(0,-Ur.length);await mr(i,a.body),s.push(i)}else await fr(a.slug,a.body),n.push(a.slug);await pr(n),await Et(s),await St(null)}catch(r){await St(r instanceof Error?r.message:String(r))}}async function Ca(t,e){let r;for(let n=0;n<e.attempts;n++)try{return await t()}catch(s){if(r=s,n===e.attempts-1)break;let a=500*Math.pow(3,n)+Math.floor(Math.random()*300);await new Promise(i=>setTimeout(i,a))}throw r}async function Ia(t){let e=await P(),r=Se(),n={token:t.token,...t.email?{email:t.email}:{},pluginVersion:W,timeZone:r,...e},s=await Ca(()=>z("POST","/api/v1/license/activate",n,{baseUrl:t.baseUrl,bearer:t.token,fingerprint:e.fingerprint,installId:e.installId,timeoutMs:1e4}),{attempts:3});if(!s.ok)throw s.status>=500?new Error("Tokmizer servers are temporarily unreachable. Try again in a minute."):new Error(hr.failed(`${s.status} ${await s.text()}`));let a=await J(s),i={token:t.token,jwt:a.jwt,signingSecret:a.signingSecret,plan:a.plan,status:a.status,trialEndsAt:a.trialEndsAt,subEndsAt:a.subEndsAt,jwtVersion:a.jwtVersion,installId:e.installId,fingerprint:e.fingerprint,pluginVersion:W,...t.email||a.boundEmail?{email:t.email??a.boundEmail??""}:{},timeZone:r,bonusActive:!1,linked:!0,lastHeartbeatOkAt:Date.now()};return await Xe(i),await Zt(t.baseUrl,!0),i}function Da(t){try{return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date)}catch{return new Date().toISOString().slice(0,10)}}async function Ze(t,e){let r=await M();return r&&r.token!==t.token?!1:(await Xe(e),!0)}async function Oa(t){let e=await M();if(!e)return null;let r=await P(),n=e.timeZone??Se(),s={ts:Date.now(),localDate:Da(n),timeZone:n},a;try{a=await z("POST","/api/v1/license/heartbeat",s,{baseUrl:t,bearer:e.jwt,signingSecret:e.signingSecret,fingerprint:r.fingerprint,installId:r.installId,timeoutMs:5e3})}catch{return e}if(a.status===401){let w=(e.heartbeatAuthFails??0)+1,T={...e,heartbeatAuthFails:w},zt=e.linked===!0||!!e.email||e.plan==="smart"||e.plan==="pro";if(w>=Br&&zt&&(T.relinkRequired=!0),!await Ze(e,T))return null;if(w>=Br&&!zt){try{await Ra(`${E()}/state.replaced.json`,JSON.stringify(e),{mode:384})}catch{}try{return await Na(t)}catch{return null}}return null}if(a.status===451){let w=await M();if(w&&w.token!==e.token)return null;await ar();try{await Et([])}catch{}return null}if(a.status===426)return await Ze(e,{...e,updateRequired:!0}),null;if(a.status===423)return await Ze(e,{...e,relinkRequired:!0}),null;if(!a.ok){if(a.status===400)try{(await a.json())?.code==="stale_ts"&&await Ze(e,{...e,clockSkewDetected:!0})}catch{}return e}let i;try{i=await J(a)}catch{return e}let o=i.settingsRevision??0,c=e.lastSettingsRevision??0,l=o>c,h=i.plan!==e.plan,k={...e,jwt:i.jwt,plan:i.plan,status:i.status,trialEndsAt:i.trialEndsAt,subEndsAt:i.subEndsAt,jwtVersion:i.jwtVersion,lastSettingsRevision:o,lastHeartbeatOkAt:Date.now(),heartbeatAuthFails:0,relinkRequired:!1,updateRequired:!1,clockSkewDetected:!1,timeZone:n,bonusActive:i.bonusActive??!1,...i.bonusResetAt!==void 0?{bonusResetAt:i.bonusResetAt}:{},...i.latestPluginVersion?{latestPluginVersion:i.latestPluginVersion}:{},...Array.isArray(i.allowedFilters)?{allowedFilters:i.allowedFilters.map(Ge)}:{}};if(!await Ze(e,k))return M();if(l)try{await yr()}catch{}if(l||h)try{let{connectDaemon:w}=await Promise.resolve().then(()=>(Pr(),Nr)),T=await w();try{await T.reload()}finally{T.close()}}catch{}await Zt(t,l||h);try{let{flushTelemetry:w}=await Promise.resolve().then(()=>($t(),Lr)),{flush:T}=await Promise.resolve().then(()=>(Vr(),Fr));await w(t),await T(t)}catch{}return k}var Wo=5*6e4;async function Na(t){let e=await P(),r=Se(),n={pluginVersion:W,timeZone:r,...e},s=await z("POST","/api/v1/license/enroll",n,{baseUrl:t,fingerprint:e.fingerprint,installId:e.installId,timeoutMs:4e3});if(!s.ok)throw new Error(`enroll failed ${s.status}`);let a=await J(s),i={token:a.token,jwt:a.jwt,signingSecret:a.signingSecret,plan:a.plan,status:a.status,trialEndsAt:a.trialEndsAt,subEndsAt:a.subEndsAt,jwtVersion:a.jwtVersion,installId:e.installId,fingerprint:e.fingerprint,pluginVersion:W,email:"",timeZone:r,bonusActive:!1,linked:!1,lastHeartbeatOkAt:Date.now()};return await Xe(i),await Zt(t,!0),i}he();Qe();export{W as PLUGIN_VERSION,Ia as activate,P as buildFingerprint,Oa as heartbeat};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokmizer/plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "Tokmizer reduces token consumption for AI coding tools (Claude Code, Codex, Cursor, Aider, Gemini CLI, Cline, Windsurf, Copilot). Cross-OS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|