invar-tools 1.7.1__py3-none-any.whl → 1.10.0__py3-none-any.whl
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.
- invar/__init__.py +8 -0
- invar/core/language.py +88 -0
- invar/core/models.py +106 -0
- invar/core/patterns/detector.py +6 -1
- invar/core/patterns/p0_exhaustive.py +15 -3
- invar/core/patterns/p0_literal.py +15 -3
- invar/core/patterns/p0_newtype.py +15 -3
- invar/core/patterns/p0_nonempty.py +15 -3
- invar/core/patterns/p0_validation.py +15 -3
- invar/core/patterns/registry.py +5 -1
- invar/core/patterns/types.py +5 -1
- invar/core/property_gen.py +4 -0
- invar/core/rules.py +84 -18
- invar/core/sync_helpers.py +27 -1
- invar/core/template_helpers.py +32 -0
- invar/core/ts_parsers.py +286 -0
- invar/core/ts_sig_parser.py +307 -0
- invar/node_tools/MANIFEST +7 -0
- invar/node_tools/__init__.py +51 -0
- invar/node_tools/fc-runner/cli.js +77 -0
- invar/node_tools/quick-check/cli.js +28 -0
- invar/node_tools/ts-analyzer/cli.js +480 -0
- invar/shell/claude_hooks.py +35 -12
- invar/shell/commands/guard.py +36 -1
- invar/shell/commands/init.py +133 -7
- invar/shell/commands/perception.py +157 -33
- invar/shell/commands/skill.py +187 -0
- invar/shell/commands/template_sync.py +65 -13
- invar/shell/commands/uninstall.py +77 -12
- invar/shell/commands/update.py +6 -14
- invar/shell/contract_coverage.py +1 -0
- invar/shell/fs.py +66 -13
- invar/shell/pi_hooks.py +213 -0
- invar/shell/prove/guard_ts.py +899 -0
- invar/shell/skill_manager.py +353 -0
- invar/shell/template_engine.py +28 -4
- invar/shell/templates.py +4 -4
- invar/templates/claude-md/python/critical-rules.md +33 -0
- invar/templates/claude-md/python/quick-reference.md +24 -0
- invar/templates/claude-md/typescript/critical-rules.md +40 -0
- invar/templates/claude-md/typescript/quick-reference.md +24 -0
- invar/templates/claude-md/universal/check-in.md +25 -0
- invar/templates/claude-md/universal/skills.md +73 -0
- invar/templates/claude-md/universal/workflow.md +55 -0
- invar/templates/commands/{audit.md → audit.md.jinja} +18 -1
- invar/templates/config/AGENT.md.jinja +256 -0
- invar/templates/config/CLAUDE.md.jinja +16 -209
- invar/templates/config/context.md.jinja +19 -0
- invar/templates/examples/{README.md → python/README.md} +2 -0
- invar/templates/examples/{conftest.py → python/conftest.py} +1 -1
- invar/templates/examples/{contracts.py → python/contracts.py} +81 -4
- invar/templates/examples/python/core_shell.py +227 -0
- invar/templates/examples/python/functional.py +613 -0
- invar/templates/examples/typescript/README.md +31 -0
- invar/templates/examples/typescript/contracts.ts +163 -0
- invar/templates/examples/typescript/core_shell.ts +374 -0
- invar/templates/examples/typescript/functional.ts +601 -0
- invar/templates/examples/typescript/workflow.md +95 -0
- invar/templates/hooks/PostToolUse.sh.jinja +10 -1
- invar/templates/hooks/PreToolUse.sh.jinja +38 -0
- invar/templates/hooks/Stop.sh.jinja +1 -1
- invar/templates/hooks/UserPromptSubmit.sh.jinja +7 -0
- invar/templates/hooks/pi/invar.ts.jinja +82 -0
- invar/templates/manifest.toml +8 -6
- invar/templates/onboard/assessment.md.jinja +214 -0
- invar/templates/onboard/patterns/python.md +347 -0
- invar/templates/onboard/patterns/typescript.md +452 -0
- invar/templates/onboard/roadmap.md.jinja +168 -0
- invar/templates/protocol/INVAR.md.jinja +51 -0
- invar/templates/protocol/python/architecture-examples.md +41 -0
- invar/templates/protocol/python/contracts-syntax.md +56 -0
- invar/templates/protocol/python/markers.md +44 -0
- invar/templates/protocol/python/tools.md +24 -0
- invar/templates/protocol/python/troubleshooting.md +38 -0
- invar/templates/protocol/typescript/architecture-examples.md +52 -0
- invar/templates/protocol/typescript/contracts-syntax.md +73 -0
- invar/templates/protocol/typescript/markers.md +48 -0
- invar/templates/protocol/typescript/tools.md +65 -0
- invar/templates/protocol/typescript/troubleshooting.md +104 -0
- invar/templates/protocol/universal/architecture.md +36 -0
- invar/templates/protocol/universal/completion.md +14 -0
- invar/templates/protocol/universal/contracts-concept.md +37 -0
- invar/templates/protocol/universal/header.md +17 -0
- invar/templates/protocol/universal/session.md +17 -0
- invar/templates/protocol/universal/six-laws.md +10 -0
- invar/templates/protocol/universal/usbv.md +14 -0
- invar/templates/protocol/universal/visible-workflow.md +25 -0
- invar/templates/skills/develop/SKILL.md.jinja +98 -3
- invar/templates/skills/extensions/_registry.yaml +93 -0
- invar/templates/skills/extensions/acceptance/SKILL.md +383 -0
- invar/templates/skills/extensions/invar-onboard/SKILL.md +448 -0
- invar/templates/skills/extensions/invar-onboard/patterns/python.md +347 -0
- invar/templates/skills/extensions/invar-onboard/patterns/typescript.md +452 -0
- invar/templates/skills/extensions/invar-onboard/templates/assessment.md.jinja +214 -0
- invar/templates/skills/extensions/invar-onboard/templates/roadmap.md.jinja +168 -0
- invar/templates/skills/extensions/security/SKILL.md +382 -0
- invar/templates/skills/extensions/security/patterns/_common.yaml +126 -0
- invar/templates/skills/extensions/security/patterns/python.yaml +155 -0
- invar/templates/skills/extensions/security/patterns/typescript.yaml +194 -0
- invar/templates/skills/investigate/SKILL.md.jinja +15 -0
- invar/templates/skills/propose/SKILL.md.jinja +33 -0
- invar/templates/skills/review/SKILL.md.jinja +346 -71
- {invar_tools-1.7.1.dist-info → invar_tools-1.10.0.dist-info}/METADATA +326 -19
- invar_tools-1.10.0.dist-info/RECORD +173 -0
- invar/templates/examples/core_shell.py +0 -127
- invar/templates/protocol/INVAR.md +0 -310
- invar_tools-1.7.1.dist-info/RECORD +0 -112
- /invar/templates/examples/{workflow.md → python/workflow.md} +0 -0
- {invar_tools-1.7.1.dist-info → invar_tools-1.10.0.dist-info}/WHEEL +0 -0
- {invar_tools-1.7.1.dist-info → invar_tools-1.10.0.dist-info}/entry_points.txt +0 -0
- {invar_tools-1.7.1.dist-info → invar_tools-1.10.0.dist-info}/licenses/LICENSE +0 -0
- {invar_tools-1.7.1.dist-info → invar_tools-1.10.0.dist-info}/licenses/LICENSE-GPL +0 -0
- {invar_tools-1.7.1.dist-info → invar_tools-1.10.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var je=Object.defineProperty;var c=(s,e)=>je(s,"name",{value:e,configurable:!0});var Fe=(s,e)=>{for(var t in e)je(s,t,{get:e[t],enumerable:!0})};var Se=require("node:child_process"),Z=require("node:fs"),E=require("node:path");var b={};Fe(b,{BRAND:()=>pt,DIRTY:()=>B,EMPTY_PATH:()=>We,INVALID:()=>m,NEVER:()=>Xt,OK:()=>w,ParseStatus:()=>k,Schema:()=>_,ZodAny:()=>F,ZodArray:()=>z,ZodBigInt:()=>W,ZodBoolean:()=>J,ZodBranded:()=>me,ZodCatch:()=>ne,ZodDate:()=>Q,ZodDefault:()=>re,ZodDiscriminatedUnion:()=>ve,ZodEffects:()=>A,ZodEnum:()=>te,ZodError:()=>T,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>ke,ZodIntersection:()=>X,ZodIssueCode:()=>d,ZodLazy:()=>K,ZodLiteral:()=>ee,ZodMap:()=>le,ZodNaN:()=>he,ZodNativeEnum:()=>se,ZodNever:()=>R,ZodNull:()=>H,ZodNullable:()=>$,ZodNumber:()=>q,ZodObject:()=>C,ZodOptional:()=>O,ZodParsedType:()=>l,ZodPipeline:()=>ye,ZodPromise:()=>U,ZodReadonly:()=>ae,ZodRecord:()=>xe,ZodSchema:()=>_,ZodSet:()=>fe,ZodString:()=>L,ZodSymbol:()=>de,ZodTransformer:()=>A,ZodTuple:()=>I,ZodType:()=>_,ZodUndefined:()=>Y,ZodUnion:()=>G,ZodUnknown:()=>D,ZodVoid:()=>ue,addIssueToContext:()=>u,any:()=>wt,array:()=>Ot,bigint:()=>_t,boolean:()=>ze,coerce:()=>Gt,custom:()=>Me,date:()=>vt,datetimeRegex:()=>$e,defaultErrorMap:()=>M,discriminatedUnion:()=>Et,effect:()=>Ut,enum:()=>Pt,function:()=>Vt,getErrorMap:()=>ie,getParsedType:()=>N,instanceof:()=>yt,intersection:()=>Nt,isAborted:()=>ge,isAsync:()=>oe,isDirty:()=>_e,isValid:()=>P,late:()=>mt,lazy:()=>Dt,literal:()=>zt,makeIssue:()=>pe,map:()=>Zt,nan:()=>gt,nativeEnum:()=>Lt,never:()=>Ct,null:()=>bt,nullable:()=>qt,number:()=>De,object:()=>jt,objectUtil:()=>we,oboolean:()=>Ht,onumber:()=>Yt,optional:()=>Bt,ostring:()=>Qt,pipeline:()=>Jt,preprocess:()=>Wt,promise:()=>Ft,quotelessJson:()=>Ue,record:()=>$t,set:()=>Mt,setErrorMap:()=>qe,strictObject:()=>At,string:()=>Ve,symbol:()=>xt,transformer:()=>Ut,tuple:()=>It,undefined:()=>kt,union:()=>Rt,unknown:()=>Tt,util:()=>v,void:()=>St});var v;(function(s){s.assertEqual=n=>{};function e(n){}c(e,"assertIs"),s.assertIs=e;function t(n){throw new Error}c(t,"assertNever"),s.assertNever=t,s.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},s.getValidEnumValues=n=>{let a=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return s.objectValues(i)},s.objectValues=n=>s.objectKeys(n).map(function(a){return n[a]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},s.find=(n,a)=>{for(let i of n)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}c(r,"joinValues"),s.joinValues=r,s.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var we;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));var l=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),N=c(s=>{switch(typeof s){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(s)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(s)?l.array:s===null?l.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?l.promise:typeof Map<"u"&&s instanceof Map?l.map:typeof Set<"u"&&s instanceof Set?l.set:typeof Date<"u"&&s instanceof Date?l.date:l.object;default:return l.unknown}},"getParsedType");var d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ue=c(s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),T=class s extends Error{static{c(this,"ZodError")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},r={_errors:[]},n=c(a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,h=0;for(;h<i.path.length;){let f=i.path[h];h===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],h++}}},"processError");return n(this),r}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};T.create=s=>new T(s);var Be=c((s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===l.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}},"errorMap"),M=Be;var Ae=M;function qe(s){Ae=s}c(qe,"setErrorMap");function ie(){return Ae}c(ie,"getErrorMap");var pe=c(s=>{let{data:e,path:t,errorMaps:r,issueData:n}=s,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",h=r.filter(f=>!!f).slice().reverse();for(let f of h)o=f(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},"makeIssue"),We=[];function u(s,e){let t=ie(),r=pe({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===M?void 0:M].filter(n=>!!n)});s.common.issues.push(r)}c(u,"addIssueToContext");var k=class s{static{c(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let a=await n.key,i=await n.value;r.push({key:a,value:i})}return s.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}},m=Object.freeze({status:"aborted"}),B=c(s=>({status:"dirty",value:s}),"DIRTY"),w=c(s=>({status:"valid",value:s}),"OK"),ge=c(s=>s.status==="aborted","isAborted"),_e=c(s=>s.status==="dirty","isDirty"),P=c(s=>s.status==="valid","isValid"),oe=c(s=>typeof Promise<"u"&&s instanceof Promise,"isAsync");var p;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var j=class{static{c(this,"ParseInputLazyPath")}constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Re=c((s,e)=>{if(P(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new T(s.common.issues);return this._error=t,this._error}}},"handleResult");function g(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:n}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:c((i,o)=>{let{message:h}=s;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:h??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:h??t??o.defaultError}},"customMap"),description:n}}c(g,"processCreateParams");var _=class{static{c(this,"ZodType")}get description(){return this._def.description}_getType(e){return N(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(oe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Re(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return P(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>P(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(oe(n)?n:Promise.resolve(n));return Re(r,a)}refine(e,t){let r=c(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,a)=>{let i=e(n),o=c(()=>a.addIssue({code:d.custom,...r(n)}),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(h=>h?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new A({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:c(t=>this["~validate"](t),"validate")}}optional(){return O.create(this,this._def)}nullable(){return $.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return z.create(this)}promise(){return U.create(this,this._def)}or(e){return G.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new A({...g(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new re({...g(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new me({typeName:y.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ne({...g(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ye.create(this,e)}readonly(){return ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Je=/^c[^\s-]{8,}$/i,Qe=/^[0-9a-z]+$/,Ye=/^[0-9A-HJKMNP-TV-Z]{26}$/i,He=/^[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,Ge=/^[a-z0-9_-]{21}$/i,Xe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ke=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,et=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Te,st=/^(?:(?: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])$/,rt=/^(?:(?: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])$/,nt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,at=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,it=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ne="((\\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])))",ct=new RegExp(`^${Ne}$`);function Ie(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}c(Ie,"timeRegexSource");function dt(s){return new RegExp(`^${Ie(s)}$`)}c(dt,"timeRegex");function $e(s){let e=`${Ne}T${Ie(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}c($e,"datetimeRegex");function ut(s,e){return!!((e==="v4"||!e)&&st.test(s)||(e==="v6"||!e)&&nt.test(s))}c(ut,"isValidIP");function lt(s,e){if(!Xe.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}c(lt,"isValidJWT");function ft(s,e){return!!((e==="v4"||!e)&&rt.test(s)||(e==="v6"||!e)&&at.test(s))}c(ft,"isValidCidr");var L=class s extends _{static{c(this,"ZodString")}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){let a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_type,expected:l.string,received:a.parsedType}),m}let r=new k,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?u(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&u(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")et.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"email",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Te||(Te=new RegExp(tt,"u")),Te.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"emoji",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")He.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"uuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"nanoid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Je.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Qe.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid2",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Ye.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ulid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),u(n,{validation:"url",code:d.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"regex",code:d.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),u(n,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?$e(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:d.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?ct.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:d.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?dt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:d.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Ke.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"duration",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?ut(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ip",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?lt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"jwt",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?ft(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cidr",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?it.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ot.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64url",code:d.invalid_string,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:d.invalid_string,...p.errToObj(r)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...p.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...p.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};L.create=s=>new L({checks:[],typeName:y.ZodString,coerce:s?.coerce??!1,...g(s)});function ht(s,e){let t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,a=Number.parseInt(s.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}c(ht,"floatSafeRemainder");var q=class s extends _{static{c(this,"ZodNumber")}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)!==l.number){let a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_type,expected:l.number,received:a.parsedType}),m}let r,n=new k;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ht(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};q.create=s=>new q({checks:[],typeName:y.ZodNumber,coerce:s?.coerce||!1,...g(s)});var W=class s extends _{static{c(this,"ZodBigInt")}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)!==l.bigint)return this._getInvalidInput(e);let r,n=new k;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:l.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};W.create=s=>new W({checks:[],typeName:y.ZodBigInt,coerce:s?.coerce??!1,...g(s)});var J=class extends _{static{c(this,"ZodBoolean")}_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:l.boolean,received:r.parsedType}),m}return w(e.data)}};J.create=s=>new J({typeName:y.ZodBoolean,coerce:s?.coerce||!1,...g(s)});var Q=class s extends _{static{c(this,"ZodDate")}_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){let a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_type,expected:l.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_date}),m}let r=new k,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Q.create=s=>new Q({checks:[],coerce:s?.coerce||!1,typeName:y.ZodDate,...g(s)});var de=class extends _{static{c(this,"ZodSymbol")}_parse(e){if(this._getType(e)!==l.symbol){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:l.symbol,received:r.parsedType}),m}return w(e.data)}};de.create=s=>new de({typeName:y.ZodSymbol,...g(s)});var Y=class extends _{static{c(this,"ZodUndefined")}_parse(e){if(this._getType(e)!==l.undefined){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:l.undefined,received:r.parsedType}),m}return w(e.data)}};Y.create=s=>new Y({typeName:y.ZodUndefined,...g(s)});var H=class extends _{static{c(this,"ZodNull")}_parse(e){if(this._getType(e)!==l.null){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:l.null,received:r.parsedType}),m}return w(e.data)}};H.create=s=>new H({typeName:y.ZodNull,...g(s)});var F=class extends _{static{c(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};F.create=s=>new F({typeName:y.ZodAny,...g(s)});var D=class extends _{static{c(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};D.create=s=>new D({typeName:y.ZodUnknown,...g(s)});var R=class extends _{static{c(this,"ZodNever")}_parse(e){let t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:l.never,received:t.parsedType}),m}};R.create=s=>new R({typeName:y.ZodNever,...g(s)});var ue=class extends _{static{c(this,"ZodVoid")}_parse(e){if(this._getType(e)!==l.undefined){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:l.void,received:r.parsedType}),m}return w(e.data)}};ue.create=s=>new ue({typeName:y.ZodVoid,...g(s)});var z=class s extends _{static{c(this,"ZodArray")}_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return u(t,{code:d.invalid_type,expected:l.array,received:t.parsedType}),m;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(u(t,{code:i?d.too_big:d.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(u(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(u(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new j(t,i,t.path,o)))).then(i=>k.mergeArray(r,i));let a=[...t.data].map((i,o)=>n.type._parseSync(new j(t,i,t.path,o)));return k.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};z.create=(s,e)=>new z({type:s,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...g(e)});function ce(s){if(s instanceof C){let e={};for(let t in s.shape){let r=s.shape[t];e[t]=O.create(ce(r))}return new C({...s._def,shape:c(()=>e,"shape")})}else return s instanceof z?new z({...s._def,type:ce(s.element)}):s instanceof O?O.create(ce(s.unwrap())):s instanceof $?$.create(ce(s.unwrap())):s instanceof I?I.create(s.items.map(e=>ce(e))):s}c(ce,"deepPartialify");var C=class s extends _{static{c(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){let f=this._getOrReturnCtx(e);return u(f,{code:d.invalid_type,expected:l.object,received:f.parsedType}),m}let{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof R&&this._def.unknownKeys==="strip"))for(let f in n.data)i.includes(f)||o.push(f);let h=[];for(let f of i){let x=a[f],S=n.data[f];h.push({key:{status:"valid",value:f},value:x._parse(new j(n,S,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof R){let f=this._def.unknownKeys;if(f==="passthrough")for(let x of o)h.push({key:{status:"valid",value:x},value:{status:"valid",value:n.data[x]}});else if(f==="strict")o.length>0&&(u(n,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let x of o){let S=n.data[x];h.push({key:{status:"valid",value:x},value:f._parse(new j(n,S,n.path,x)),alwaysSet:x in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let f=[];for(let x of h){let S=await x.key,Oe=await x.value;f.push({key:S,value:Oe,alwaysSet:x.alwaysSet})}return f}).then(f=>k.mergeObjectSync(r,f)):k.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:c((t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??n}:{message:n}},"errorMap")}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:c(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:c(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new s({...this._def,shape:c(()=>t,"shape")})}omit(e){let t={};for(let r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new s({...this._def,shape:c(()=>t,"shape")})}deepPartial(){return ce(this)}partial(e){let t={};for(let r of v.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new s({...this._def,shape:c(()=>t,"shape")})}required(e){let t={};for(let r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof O;)a=a._def.innerType;t[r]=a}return new s({...this._def,shape:c(()=>t,"shape")})}keyof(){return Ze(v.objectKeys(this.shape))}};C.create=(s,e)=>new C({shape:c(()=>s,"shape"),unknownKeys:"strip",catchall:R.create(),typeName:y.ZodObject,...g(e)});C.strictCreate=(s,e)=>new C({shape:c(()=>s,"shape"),unknownKeys:"strict",catchall:R.create(),typeName:y.ZodObject,...g(e)});C.lazycreate=(s,e)=>new C({shape:s,unknownKeys:"strip",catchall:R.create(),typeName:y.ZodObject,...g(e)});var G=class extends _{static{c(this,"ZodUnion")}_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return u(t,{code:d.invalid_union,unionErrors:i}),m}if(c(n,"handleResults"),t.common.async)return Promise.all(r.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let h of r){let f={...t,common:{...t.common,issues:[]},parent:null},x=h._parseSync({data:t.data,path:t.path,parent:f});if(x.status==="valid")return x;x.status==="dirty"&&!a&&(a={result:x,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(h=>new T(h));return u(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};G.create=(s,e)=>new G({options:s,typeName:y.ZodUnion,...g(e)});var V=c(s=>s instanceof K?V(s.schema):s instanceof A?V(s.innerType()):s instanceof ee?[s.value]:s instanceof te?s.options:s instanceof se?v.objectValues(s.enum):s instanceof re?V(s._def.innerType):s instanceof Y?[void 0]:s instanceof H?[null]:s instanceof O?[void 0,...V(s.unwrap())]:s instanceof $?[null,...V(s.unwrap())]:s instanceof me||s instanceof ae?V(s.unwrap()):s instanceof ne?V(s._def.innerType):[],"getDiscriminator"),ve=class s extends _{static{c(this,"ZodDiscriminatedUnion")}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.object)return u(t,{code:d.invalid_type,expected:l.object,received:t.parsedType}),m;let r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let a of t){let i=V(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new s({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(r)})}};function Ce(s,e){let t=N(s),r=N(e);if(s===e)return{valid:!0,data:s};if(t===l.object&&r===l.object){let n=v.objectKeys(e),a=v.objectKeys(s).filter(o=>n.indexOf(o)!==-1),i={...s,...e};for(let o of a){let h=Ce(s[o],e[o]);if(!h.valid)return{valid:!1};i[o]=h.data}return{valid:!0,data:i}}else if(t===l.array&&r===l.array){if(s.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<s.length;a++){let i=s[a],o=e[a],h=Ce(i,o);if(!h.valid)return{valid:!1};n.push(h.data)}return{valid:!0,data:n}}else return t===l.date&&r===l.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}c(Ce,"mergeValues");var X=class extends _{static{c(this,"ZodIntersection")}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=c((a,i)=>{if(ge(a)||ge(i))return m;let o=Ce(a.value,i.value);return o.valid?((_e(a)||_e(i))&&t.dirty(),{status:t.value,value:o.data}):(u(r,{code:d.invalid_intersection_types}),m)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};X.create=(s,e,t)=>new X({left:s,right:e,typeName:y.ZodIntersection,...g(t)});var I=class s extends _{static{c(this,"ZodTuple")}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.array)return u(r,{code:d.invalid_type,expected:l.array,received:r.parsedType}),m;if(r.data.length<this._def.items.length)return u(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&r.data.length>this._def.items.length&&(u(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((i,o)=>{let h=this._def.items[o]||this._def.rest;return h?h._parse(new j(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>k.mergeArray(t,i)):k.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};I.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:s,typeName:y.ZodTuple,rest:null,...g(e)})};var xe=class s extends _{static{c(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.object)return u(r,{code:d.invalid_type,expected:l.object,received:r.parsedType}),m;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in r.data)n.push({key:a._parse(new j(r,o,r.path,o)),value:i._parse(new j(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?k.mergeObjectAsync(t,n):k.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof _?new s({keyType:e,valueType:t,typeName:y.ZodRecord,...g(r)}):new s({keyType:L.create(),valueType:e,typeName:y.ZodRecord,...g(t)})}},le=class extends _{static{c(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.map)return u(r,{code:d.invalid_type,expected:l.map,received:r.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,h],f)=>({key:n._parse(new j(r,o,r.path,[f,"key"])),value:a._parse(new j(r,h,r.path,[f,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let h of i){let f=await h.key,x=await h.value;if(f.status==="aborted"||x.status==="aborted")return m;(f.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(f.value,x.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let h of i){let f=h.key,x=h.value;if(f.status==="aborted"||x.status==="aborted")return m;(f.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(f.value,x.value)}return{status:t.value,value:o}}}};le.create=(s,e,t)=>new le({valueType:e,keyType:s,typeName:y.ZodMap,...g(t)});var fe=class s extends _{static{c(this,"ZodSet")}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.set)return u(r,{code:d.invalid_type,expected:l.set,received:r.parsedType}),m;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(u(r,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(u(r,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(h){let f=new Set;for(let x of h){if(x.status==="aborted")return m;x.status==="dirty"&&t.dirty(),f.add(x.value)}return{status:t.value,value:f}}c(i,"finalizeSet");let o=[...r.data.values()].map((h,f)=>a._parse(new j(r,h,r.path,f)));return r.common.async?Promise.all(o).then(h=>i(h)):i(o)}min(e,t){return new s({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};fe.create=(s,e)=>new fe({valueType:s,minSize:null,maxSize:null,typeName:y.ZodSet,...g(e)});var ke=class s extends _{static{c(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.function)return u(t,{code:d.invalid_type,expected:l.function,received:t.parsedType}),m;function r(o,h){return pe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ie(),M].filter(f=>!!f),issueData:{code:d.invalid_arguments,argumentsError:h}})}c(r,"makeArgsIssue");function n(o,h){return pe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ie(),M].filter(f=>!!f),issueData:{code:d.invalid_return_type,returnTypeError:h}})}c(n,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof U){let o=this;return w(async function(...h){let f=new T([]),x=await o._def.args.parseAsync(h,a).catch(be=>{throw f.addIssue(r(h,be)),f}),S=await Reflect.apply(i,this,x);return await o._def.returns._def.type.parseAsync(S,a).catch(be=>{throw f.addIssue(n(S,be)),f})})}else{let o=this;return w(function(...h){let f=o._def.args.safeParse(h,a);if(!f.success)throw new T([r(h,f.error)]);let x=Reflect.apply(i,this,f.data),S=o._def.returns.safeParse(x,a);if(!S.success)throw new T([n(x,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:I.create(e).rest(D.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new s({args:e||I.create([]).rest(D.create()),returns:t||D.create(),typeName:y.ZodFunction,...g(r)})}},K=class extends _{static{c(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};K.create=(s,e)=>new K({getter:s,typeName:y.ZodLazy,...g(e)});var ee=class extends _{static{c(this,"ZodLiteral")}_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};ee.create=(s,e)=>new ee({value:s,typeName:y.ZodLiteral,...g(e)});function Ze(s,e){return new te({values:s,typeName:y.ZodEnum,...g(e)})}c(Ze,"createZodEnum");var te=class s extends _{static{c(this,"ZodEnum")}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{expected:v.joinValues(r),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{received:t.data,code:d.invalid_enum_value,options:r}),m}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};te.create=Ze;var se=class extends _{static{c(this,"ZodNativeEnum")}_parse(e){let t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==l.string&&r.parsedType!==l.number){let n=v.objectValues(t);return u(r,{expected:v.joinValues(n),received:r.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(t);return u(r,{received:r.data,code:d.invalid_enum_value,options:n}),m}return w(e.data)}get enum(){return this._def.values}};se.create=(s,e)=>new se({values:s,typeName:y.ZodNativeEnum,...g(e)});var U=class extends _{static{c(this,"ZodPromise")}unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return u(t,{code:d.invalid_type,expected:l.promise,received:t.parsedType}),m;let r=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return w(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};U.create=(s,e)=>new U({type:s,typeName:y.ZodPromise,...g(e)});var A=class extends _{static{c(this,"ZodEffects")}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:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:c(i=>{u(r,i),i.fatal?t.abort():t.dirty()},"addIssue"),get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;let h=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return h.status==="aborted"?m:h.status==="dirty"?B(h.value):t.value==="dirty"?B(h.value):h});{if(t.value==="aborted")return m;let o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?m:o.status==="dirty"?B(o.value):t.value==="dirty"?B(o.value):o}}if(n.type==="refinement"){let i=c(o=>{let h=n.refinement(o,a);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o},"executeRefinement");if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!P(i))return m;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>P(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);v.assertNever(n)}};A.create=(s,e,t)=>new A({schema:s,typeName:y.ZodEffects,effect:e,...g(t)});A.createWithPreprocess=(s,e,t)=>new A({schema:e,effect:{type:"preprocess",transform:s},typeName:y.ZodEffects,...g(t)});var O=class extends _{static{c(this,"ZodOptional")}_parse(e){return this._getType(e)===l.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};O.create=(s,e)=>new O({innerType:s,typeName:y.ZodOptional,...g(e)});var $=class extends _{static{c(this,"ZodNullable")}_parse(e){return this._getType(e)===l.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$.create=(s,e)=>new $({innerType:s,typeName:y.ZodNullable,...g(e)});var re=class extends _{static{c(this,"ZodDefault")}_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===l.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};re.create=(s,e)=>new re({innerType:s,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var ne=class extends _{static{c(this,"ZodCatch")}_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return oe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new T(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ne.create=(s,e)=>new ne({innerType:s,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var he=class extends _{static{c(this,"ZodNaN")}_parse(e){if(this._getType(e)!==l.nan){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:l.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}};he.create=s=>new he({typeName:y.ZodNaN,...g(s)});var pt=Symbol("zod_brand"),me=class extends _{static{c(this,"ZodBranded")}_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},ye=class s extends _{static{c(this,"ZodPipeline")}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return c(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),B(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new s({in:e,out:t,typeName:y.ZodPipeline})}},ae=class extends _{static{c(this,"ZodReadonly")}_parse(e){let t=this._def.innerType._parse(e),r=c(n=>(P(n)&&(n.value=Object.freeze(n.value)),n),"freeze");return oe(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};ae.create=(s,e)=>new ae({innerType:s,typeName:y.ZodReadonly,...g(e)});function Ee(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}c(Ee,"cleanParams");function Me(s,e={},t){return s?F.create().superRefine((r,n)=>{let a=s(r);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Ee(e,r),h=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:h})}});if(!a){let i=Ee(e,r),o=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:o})}}):F.create()}c(Me,"custom");var mt={object:C.lazycreate},y;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(y||(y={}));var yt=c((s,e={message:`Input not instance of ${s.name}`})=>Me(t=>t instanceof s,e),"instanceOfType"),Ve=L.create,De=q.create,gt=he.create,_t=W.create,ze=J.create,vt=Q.create,xt=de.create,kt=Y.create,bt=H.create,wt=F.create,Tt=D.create,Ct=R.create,St=ue.create,Ot=z.create,jt=C.create,At=C.strictCreate,Rt=G.create,Et=ve.create,Nt=X.create,It=I.create,$t=xe.create,Zt=le.create,Mt=fe.create,Vt=ke.create,Dt=K.create,zt=ee.create,Pt=te.create,Lt=se.create,Ft=U.create,Ut=A.create,Bt=O.create,qt=$.create,Wt=A.createWithPreprocess,Jt=ye.create,Qt=c(()=>Ve().optional(),"ostring"),Yt=c(()=>De().optional(),"onumber"),Ht=c(()=>ze().optional(),"oboolean"),Gt={string:c((s=>L.create({...s,coerce:!0})),"string"),number:c((s=>q.create({...s,coerce:!0})),"number"),boolean:c((s=>J.create({...s,coerce:!0})),"boolean"),bigint:c((s=>W.create({...s,coerce:!0})),"bigint"),date:c((s=>Q.create({...s,coerce:!0})),"date")};var Xt=m;var Kt=b.object({path:b.string().default("."),skipTsc:b.boolean().default(!1),skipEslint:b.boolean().default(!1),verbose:b.boolean().default(!1)}),Pe=b.object({passed:b.boolean(),cached:b.boolean(),duration_ms:b.number(),error:b.string().optional()}),Us=b.object({passed:b.boolean(),duration_ms:b.number(),checks:b.object({tsc:Pe.optional(),eslint:Pe.optional()})});function es(s){let e=(0,E.join)(s,"tsconfig.tsbuildinfo");if(!(0,Z.existsSync)(e))return!1;try{let t=(0,Z.statSync)(e);return Date.now()-t.mtimeMs<3600*1e3}catch{return!1}}c(es,"hasTscCache");function ts(s){let e=(0,E.join)(s,".eslintcache");return(0,Z.existsSync)(e)}c(ts,"hasEslintCache");function ss(s){let e=(0,E.resolve)(s),t=(0,E.resolve)("/");for(;e!==t;){let r=(0,E.join)(e,"tsconfig.json");if((0,Z.existsSync)(r))return r;e=(0,E.resolve)(e,"..")}return null}c(ss,"findTsconfig");function rs(s){let e=[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs"];for(let r of e)if((0,Z.existsSync)((0,E.join)(s,r)))return!0;let t=(0,E.join)(s,"package.json");if((0,Z.existsSync)(t))try{if(JSON.parse((0,Z.readFileSync)(t,"utf-8")).eslintConfig)return!0}catch{}return!1}c(rs,"hasEslintConfig");function ns(s,e){let t=Date.now(),r=es(s);if(!ss(s))return{passed:!0,cached:!1,duration_ms:Date.now()-t,error:"No tsconfig.json found, skipping tsc"};try{return(0,Se.execSync)("npx tsc --noEmit --incremental --pretty false",{cwd:s,stdio:e?"inherit":"pipe",encoding:"utf-8"}),{passed:!0,cached:r,duration_ms:Date.now()-t}}catch(a){let i=a instanceof Error&&"stderr"in a?String(a.stderr):String(a);return{passed:!1,cached:r,duration_ms:Date.now()-t,error:i.slice(0,500)}}}c(ns,"runTsc");function as(s,e){let t=Date.now(),r=ts(s);if(!rs(s))return{passed:!0,cached:!1,duration_ms:Date.now()-t,error:"No eslint config found, skipping eslint"};try{return(0,Se.execSync)('npx eslint --cache "src/**/*.ts"',{cwd:s,stdio:e?"inherit":"pipe",encoding:"utf-8"}),{passed:!0,cached:r,duration_ms:Date.now()-t}}catch(n){let a=n instanceof Error&&"stderr"in n?String(n.stderr):String(n);return{passed:!1,cached:r,duration_ms:Date.now()-t,error:a.slice(0,500)}}}c(as,"runEslint");function Le(s={}){let e=Kt.parse(s),t=(0,E.resolve)(e.path),r=Date.now(),n={passed:!0,duration_ms:0,checks:{}};if(!e.skipTsc){let a=ns(t,e.verbose);n.checks.tsc=a,a.passed||(n.passed=!1)}if(!e.skipEslint){let a=as(t,e.verbose);n.checks.eslint=a,a.passed||(n.passed=!1)}return n.duration_ms=Date.now()-r,n}c(Le,"quickCheck");function is(){console.log(`
|
|
3
|
+
@invar/quick-check - Fast pre-commit verification
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
npx @invar/quick-check [path] [options]
|
|
7
|
+
|
|
8
|
+
Arguments:
|
|
9
|
+
path Project path (default: current directory)
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
--json Output JSON format (for programmatic use)
|
|
13
|
+
--skip-tsc Skip TypeScript type checking
|
|
14
|
+
--skip-eslint Skip ESLint checks
|
|
15
|
+
--verbose Show detailed output
|
|
16
|
+
--help, -h Show this help message
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
npx @invar/quick-check # Check current directory
|
|
20
|
+
npx @invar/quick-check ./my-project # Check specific directory
|
|
21
|
+
npx @invar/quick-check --json # Output JSON for CI
|
|
22
|
+
npx @invar/quick-check --skip-eslint # Only run tsc
|
|
23
|
+
`)}c(is,"printHelp");function os(s,e){if(e)return JSON.stringify(s,null,2);let t=[],r=s.passed?"\u2713 PASSED":"\u2717 FAILED";if(t.push(`
|
|
24
|
+
${r} (${s.duration_ms}ms)
|
|
25
|
+
`),s.checks.tsc){let n=s.checks.tsc,a=n.passed?"\u2713":"\u2717",i=n.cached?" (cached)":"";t.push(` ${a} tsc: ${n.duration_ms}ms${i}`),n.error&&!n.passed&&t.push(` ${n.error.split(`
|
|
26
|
+
`)[0]}`)}if(s.checks.eslint){let n=s.checks.eslint,a=n.passed?"\u2713":"\u2717",i=n.cached?" (cached)":"";t.push(` ${a} eslint: ${n.duration_ms}ms${i}`),n.error&&!n.passed&&t.push(` ${n.error.split(`
|
|
27
|
+
`)[0]}`)}return t.join(`
|
|
28
|
+
`)}c(os,"formatResult");function cs(){let s=process.argv.slice(2),e={path:".",skipTsc:!1,skipEslint:!1,verbose:!1,json:!1},t=[];for(let n of s)n==="--help"||n==="-h"?(is(),process.exit(0)):n==="--json"?e.json=!0:n==="--skip-tsc"?e.skipTsc=!0:n==="--skip-eslint"?e.skipEslint=!0:n==="--verbose"?e.verbose=!0:n.startsWith("-")?(console.error(`Unknown option: ${n}`),process.exit(1)):t.push(n);t.length>0&&(e.path=t[0]);let r=Le(e);console.log(os(r,e.json)),process.exit(r.passed?0:1)}c(cs,"main");cs();
|