@storm-software/config-tools 1.15.5 → 1.15.6

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.
@@ -406,10 +406,10 @@ ${[...A,ae].map((Ge,Oe)=>`${Oe+1}. ${Ge}`).join(`
406
406
  `)+T,O=A+1,A=p.indexOf(`
407
407
  `,O)}while(A!==-1);return $+=p.substr(O),$};XLe.exports={stringReplaceAll:K2t,stringEncaseCRLFWithFirstIndex:ebt}});var tMe=Ts((lSt,eMe)=>{"use strict";var tbt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,YLe=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,rbt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,nbt=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,ibt=new Map([["n",`
408
408
  `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function KLe(p){let h=p[0]==="u",T=p[1]==="{";return h&&!T&&p.length===5||p[0]==="x"&&p.length===3?String.fromCharCode(parseInt(p.slice(1),16)):h&&T?String.fromCodePoint(parseInt(p.slice(2,-1),16)):ibt.get(p)||p}function sbt(p,h){let T=[],A=h.trim().split(/\s*,\s*/g),O;for(let $ of A){let ae=Number($);if(!Number.isNaN(ae))T.push(ae);else if(O=$.match(rbt))T.push(O[2].replace(nbt,(we,Ge,Oe)=>Ge?KLe(Ge):Oe));else throw new Error(`Invalid Chalk template style argument: ${$} (in style '${p}')`)}return T}function abt(p){YLe.lastIndex=0;let h=[],T;for(;(T=YLe.exec(p))!==null;){let A=T[1];if(T[2]){let O=sbt(A,T[2]);h.push([A].concat(O))}else h.push([A])}return h}function ZLe(p,h){let T={};for(let O of h)for(let $ of O.styles)T[$[0]]=O.inverse?null:$.slice(1);let A=p;for(let[O,$]of Object.entries(T))if(Array.isArray($)){if(!(O in A))throw new Error(`Unknown Chalk style: ${O}`);A=$.length>0?A[O](...$):A[O]}return A}eMe.exports=(p,h)=>{let T=[],A=[],O=[];if(h.replace(tbt,($,ae,we,Ge,Oe,Ze)=>{if(ae)O.push(KLe(ae));else if(Ge){let Yr=O.join("");O=[],A.push(T.length===0?Yr:ZLe(p,T)(Yr)),T.push({inverse:we,styles:abt(Ge)})}else if(Oe){if(T.length===0)throw new Error("Found extraneous } in Chalk template literal");A.push(ZLe(p,T)(O.join(""))),O=[],T.pop()}else O.push(Ze)}),A.push(O.join("")),T.length>0){let $=`Chalk template literal is missing ${T.length} closing bracket${T.length===1?"":"s"} (\`}\`)`;throw new Error($)}return A.join("")}});var cMe=Ts((uSt,oMe)=>{"use strict";var sL=VLe(),{stdout:wfe,stderr:Efe}=HLe(),{stringReplaceAll:obt,stringEncaseCRLFWithFirstIndex:cbt}=QLe(),{isArray:Eq}=Array,nMe=["ansi","ansi","ansi256","ansi16m"],qA=Object.create(null),lbt=(p,h={})=>{if(h.level&&!(Number.isInteger(h.level)&&h.level>=0&&h.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let T=wfe?wfe.level:0;p.level=h.level===void 0?T:h.level},Afe=class{constructor(h){return iMe(h)}},iMe=p=>{let h={};return lbt(h,p),h.template=(...T)=>aMe(h.template,...T),Object.setPrototypeOf(h,Aq.prototype),Object.setPrototypeOf(h.template,h),h.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},h.template.Instance=Afe,h.template};function Aq(p){return iMe(p)}for(let[p,h]of Object.entries(sL))qA[p]={get(){let T=Dq(this,Dfe(h.open,h.close,this._styler),this._isEmpty);return Object.defineProperty(this,p,{value:T}),T}};qA.visible={get(){let p=Dq(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:p}),p}};var sMe=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let p of sMe)qA[p]={get(){let{level:h}=this;return function(...T){let A=Dfe(sL.color[nMe[h]][p](...T),sL.color.close,this._styler);return Dq(this,A,this._isEmpty)}}};for(let p of sMe){let h="bg"+p[0].toUpperCase()+p.slice(1);qA[h]={get(){let{level:T}=this;return function(...A){let O=Dfe(sL.bgColor[nMe[T]][p](...A),sL.bgColor.close,this._styler);return Dq(this,O,this._isEmpty)}}}}var ubt=Object.defineProperties(()=>{},{...qA,level:{enumerable:!0,get(){return this._generator.level},set(p){this._generator.level=p}}}),Dfe=(p,h,T)=>{let A,O;return T===void 0?(A=p,O=h):(A=T.openAll+p,O=h+T.closeAll),{open:p,close:h,openAll:A,closeAll:O,parent:T}},Dq=(p,h,T)=>{let A=(...O)=>Eq(O[0])&&Eq(O[0].raw)?rMe(A,aMe(A,...O)):rMe(A,O.length===1?""+O[0]:O.join(" "));return Object.setPrototypeOf(A,ubt),A._generator=p,A._styler=h,A._isEmpty=T,A},rMe=(p,h)=>{if(p.level<=0||!h)return p._isEmpty?"":h;let T=p._styler;if(T===void 0)return h;let{openAll:A,closeAll:O}=T;if(h.indexOf("\x1B")!==-1)for(;T!==void 0;)h=obt(h,T.close,T.open),T=T.parent;let $=h.indexOf(`
409
- `);return $!==-1&&(h=cbt(h,O,A,$)),A+h+O},Cfe,aMe=(p,...h)=>{let[T]=h;if(!Eq(T)||!Eq(T.raw))return h.join(" ");let A=h.slice(1),O=[T.raw[0]];for(let $=1;$<T.length;$++)O.push(String(A[$-1]).replace(/[{}\\]/g,"\\$&"),String(T.raw[$]));return Cfe===void 0&&(Cfe=tMe()),Cfe(p,O.join(""))};Object.defineProperties(Aq.prototype,qA);var Nq=Aq();Nq.supportsColor=wfe;Nq.stderr=Aq({level:Efe?Efe.level:0});Nq.stderr.supportsColor=Efe;oMe.exports=Nq});var pLe=Eue(fLe(),1),ofe,NA=(p,h)=>(0,pLe.cosmiconfig)(p,{cache:!0}).search(h),dLe=async p=>{if(ofe)return ofe;let h=await NA("storm",p);if((!h||h.isEmpty)&&(h=await NA("storm-software",p),(!h||h.isEmpty)&&(h=await NA("storm-stack",p),(!h||h.isEmpty)&&(h=await NA("storm-cloud",p),(!h||h.isEmpty)&&(h=await NA("acidic",p),(!h||h.isEmpty)&&(h=await NA("acid",p)))))),!h||Object.keys(h).length===0||h.isEmpty||!h.filepath){console.warn("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.config.js` file to the root of your workspace if it is not.");return}let T=h.config??{};return h.filepath&&(T.configFile=h.filepath),T.runtimeVersion="0.0.1",ofe=T,T};var sp={SILENT:0,FATAL:10,ERROR:20,WARN:30,INFO:40,SUCCESS:45,DEBUG:60,TRACE:70,ALL:100},av={SILENT:"silent",FATAL:"fatal",ERROR:"error",WARN:"warn",INFO:"info",DEBUG:"debug",TRACE:"trace",ALL:"all"};import{existsSync as b2t}from"fs";import{join as mLe}from"path";var x2t=30,T2t=0;function cfe(p,h){let T=p??process.cwd();if(h.some(A=>b2t(mLe(T,A))))return T;if(T!=="/"&&T2t++<x2t){let A=mLe(T,"..");return cfe(A,h)}}var gLe=["lerna.json","storm.config.js","storm.config.ts",".storm.json",".storm.yaml",".storm.yml",".storm.js",".storm.ts","nx.json","turbo.json","npm-workspace.json","yarn-workspace.json","pnpm-workspace.json","npm-workspace.yaml","yarn-workspace.yaml","pnpm-workspace.yaml","npm-workspace.yml","yarn-workspace.yml","pnpm-workspace.yml","npm-lock.json","yarn-lock.json","pnpm-lock.json","npm-lock.yaml","yarn-lock.yaml","pnpm-lock.yaml","npm-lock.yml","yarn-lock.yml","pnpm-lock.yml","bun.lockb"];function S2t(p){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH:cfe(p??process.cwd(),gLe)}function hLe(p){let h=S2t(p);if(!h)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
409
+ `);return $!==-1&&(h=cbt(h,O,A,$)),A+h+O},Cfe,aMe=(p,...h)=>{let[T]=h;if(!Eq(T)||!Eq(T.raw))return h.join(" ");let A=h.slice(1),O=[T.raw[0]];for(let $=1;$<T.length;$++)O.push(String(A[$-1]).replace(/[{}\\]/g,"\\$&"),String(T.raw[$]));return Cfe===void 0&&(Cfe=tMe()),Cfe(p,O.join(""))};Object.defineProperties(Aq.prototype,qA);var Nq=Aq();Nq.supportsColor=wfe;Nq.stderr=Aq({level:Efe?Efe.level:0});Nq.stderr.supportsColor=Efe;oMe.exports=Nq});var pLe=Eue(fLe(),1),ofe,NA=(p,h)=>(0,pLe.cosmiconfig)(p,{cache:!0}).search(h),dLe=async p=>{if(ofe)return ofe;let h=await NA("storm",p);if((!h||h.isEmpty)&&(h=await NA("storm-software",p),(!h||h.isEmpty)&&(h=await NA("storm-stack",p),(!h||h.isEmpty)&&(h=await NA("storm-cloud",p),(!h||h.isEmpty)&&(h=await NA("acidic",p),(!h||h.isEmpty)&&(h=await NA("acid",p)))))),!h||Object.keys(h).length===0||h.isEmpty||!h.filepath){console.warn("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.config.js` file to the root of your workspace if it is not.");return}let T=h.config??{};return h.filepath&&(T.configFile=h.filepath),T.runtimeVersion="0.0.1",ofe=T,T};var sp={SILENT:0,FATAL:10,ERROR:20,WARN:30,INFO:40,SUCCESS:45,DEBUG:60,TRACE:70,ALL:100},av={SILENT:"silent",FATAL:"fatal",ERROR:"error",WARN:"warn",INFO:"info",DEBUG:"debug",TRACE:"trace",ALL:"all"};import{existsSync as b2t}from"node:fs";import{join as mLe}from"node:path";var x2t=30,T2t=0;function cfe(p,h){let T=p??process.cwd();if(h.some(A=>b2t(mLe(T,A))))return T;if(T!=="/"&&T2t++<x2t){let A=mLe(T,"..");return cfe(A,h)}}var gLe=["lerna.json","storm.config.js","storm.config.ts",".storm.json",".storm.yaml",".storm.yml",".storm.js",".storm.ts","nx.json","turbo.json","npm-workspace.json","yarn-workspace.json","pnpm-workspace.json","npm-workspace.yaml","yarn-workspace.yaml","pnpm-workspace.yaml","npm-workspace.yml","yarn-workspace.yml","pnpm-workspace.yml","npm-lock.json","yarn-lock.json","pnpm-lock.json","npm-lock.yaml","yarn-lock.yaml","pnpm-lock.yaml","npm-lock.yml","yarn-lock.yml","pnpm-lock.yml","bun.lockb"];function S2t(p){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH:cfe(p??process.cwd(),gLe)}function hLe(p){let h=S2t(p);if(!h)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
410
410
  ${gLe.join(`
411
411
  `)}
412
- Path: ${p||process.cwd()}`);return h}import{existsSync as j2t,readFileSync as J2t}from"fs";import{join as wLe}from"path";var Tu;(function(p){p.assertEqual=O=>O;function h(O){}p.assertIs=h;function T(O){throw new Error}p.assertNever=T,p.arrayToEnum=O=>{let $={};for(let ae of O)$[ae]=ae;return $},p.getValidEnumValues=O=>{let $=p.objectKeys(O).filter(we=>typeof O[O[we]]!="number"),ae={};for(let we of $)ae[we]=O[we];return p.objectValues(ae)},p.objectValues=O=>p.objectKeys(O).map(function($){return O[$]}),p.objectKeys=typeof Object.keys=="function"?O=>Object.keys(O):O=>{let $=[];for(let ae in O)Object.prototype.hasOwnProperty.call(O,ae)&&$.push(ae);return $},p.find=(O,$)=>{for(let ae of O)if($(ae))return ae},p.isInteger=typeof Number.isInteger=="function"?O=>Number.isInteger(O):O=>typeof O=="number"&&isFinite(O)&&Math.floor(O)===O;function A(O,$=" | "){return O.map(ae=>typeof ae=="string"?`'${ae}'`:ae).join($)}p.joinValues=A,p.jsonStringifyReplacer=(O,$)=>typeof $=="bigint"?$.toString():$})(Tu||(Tu={}));var yLe;(function(p){p.mergeShapes=(h,T)=>({...h,...T})})(yLe||(yLe={}));var da=Tu.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),o8=p=>{switch(typeof p){case"undefined":return da.undefined;case"string":return da.string;case"number":return isNaN(p)?da.nan:da.number;case"boolean":return da.boolean;case"function":return da.function;case"bigint":return da.bigint;case"symbol":return da.symbol;case"object":return Array.isArray(p)?da.array:p===null?da.null:p.then&&typeof p.then=="function"&&p.catch&&typeof p.catch=="function"?da.promise:typeof Map<"u"&&p instanceof Map?da.map:typeof Set<"u"&&p instanceof Set?da.set:typeof Date<"u"&&p instanceof Date?da.date:da.object;default:return da.unknown}},fs=Tu.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"]);var ov=class extends Error{constructor(h){super(),this.issues=[],this.addIssue=A=>{this.issues=[...this.issues,A]},this.addIssues=(A=[])=>{this.issues=[...this.issues,...A]};let T=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,T):this.__proto__=T,this.name="ZodError",this.issues=h}get errors(){return this.issues}format(h){let T=h||function($){return $.message},A={_errors:[]},O=$=>{for(let ae of $.issues)if(ae.code==="invalid_union")ae.unionErrors.map(O);else if(ae.code==="invalid_return_type")O(ae.returnTypeError);else if(ae.code==="invalid_arguments")O(ae.argumentsError);else if(ae.path.length===0)A._errors.push(T(ae));else{let we=A,Ge=0;for(;Ge<ae.path.length;){let Oe=ae.path[Ge];Ge===ae.path.length-1?(we[Oe]=we[Oe]||{_errors:[]},we[Oe]._errors.push(T(ae))):we[Oe]=we[Oe]||{_errors:[]},we=we[Oe],Ge++}}};return O(this),A}toString(){return this.message}get message(){return JSON.stringify(this.issues,Tu.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(h=T=>T.message){let T={},A=[];for(let O of this.issues)O.path.length>0?(T[O.path[0]]=T[O.path[0]]||[],T[O.path[0]].push(h(O))):A.push(h(O));return{formErrors:A,fieldErrors:T}}get formErrors(){return this.flatten()}};ov.create=p=>new ov(p);var bq=(p,h)=>{let T;switch(p.code){case fs.invalid_type:p.received===da.undefined?T="Required":T=`Expected ${p.expected}, received ${p.received}`;break;case fs.invalid_literal:T=`Invalid literal value, expected ${JSON.stringify(p.expected,Tu.jsonStringifyReplacer)}`;break;case fs.unrecognized_keys:T=`Unrecognized key(s) in object: ${Tu.joinValues(p.keys,", ")}`;break;case fs.invalid_union:T="Invalid input";break;case fs.invalid_union_discriminator:T=`Invalid discriminator value. Expected ${Tu.joinValues(p.options)}`;break;case fs.invalid_enum_value:T=`Invalid enum value. Expected ${Tu.joinValues(p.options)}, received '${p.received}'`;break;case fs.invalid_arguments:T="Invalid function arguments";break;case fs.invalid_return_type:T="Invalid function return type";break;case fs.invalid_date:T="Invalid date";break;case fs.invalid_string:typeof p.validation=="object"?"includes"in p.validation?(T=`Invalid input: must include "${p.validation.includes}"`,typeof p.validation.position=="number"&&(T=`${T} at one or more positions greater than or equal to ${p.validation.position}`)):"startsWith"in p.validation?T=`Invalid input: must start with "${p.validation.startsWith}"`:"endsWith"in p.validation?T=`Invalid input: must end with "${p.validation.endsWith}"`:Tu.assertNever(p.validation):p.validation!=="regex"?T=`Invalid ${p.validation}`:T="Invalid";break;case fs.too_small:p.type==="array"?T=`Array must contain ${p.exact?"exactly":p.inclusive?"at least":"more than"} ${p.minimum} element(s)`:p.type==="string"?T=`String must contain ${p.exact?"exactly":p.inclusive?"at least":"over"} ${p.minimum} character(s)`:p.type==="number"?T=`Number must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${p.minimum}`:p.type==="date"?T=`Date must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(p.minimum))}`:T="Invalid input";break;case fs.too_big:p.type==="array"?T=`Array must contain ${p.exact?"exactly":p.inclusive?"at most":"less than"} ${p.maximum} element(s)`:p.type==="string"?T=`String must contain ${p.exact?"exactly":p.inclusive?"at most":"under"} ${p.maximum} character(s)`:p.type==="number"?T=`Number must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="bigint"?T=`BigInt must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="date"?T=`Date must be ${p.exact?"exactly":p.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(p.maximum))}`:T="Invalid input";break;case fs.custom:T="Invalid input";break;case fs.invalid_intersection_types:T="Intersection results could not be merged";break;case fs.not_multiple_of:T=`Number must be a multiple of ${p.multipleOf}`;break;case fs.not_finite:T="Number must be finite";break;default:T=h.defaultError,Tu.assertNever(p)}return{message:T}},k2t=bq;function ufe(){return k2t}var _fe=p=>{let{data:h,path:T,errorMaps:A,issueData:O}=p,$=[...T,...O.path||[]],ae={...O,path:$},we="",Ge=A.filter(Oe=>!!Oe).slice().reverse();for(let Oe of Ge)we=Oe(ae,{data:h,defaultError:we}).message;return{...O,path:$,message:O.message||we}};function Sa(p,h){let T=_fe({issueData:h,data:p.data,path:p.path,errorMaps:[p.common.contextualErrorMap,p.schemaErrorMap,ufe(),bq].filter(A=>!!A)});p.common.issues.push(T)}var O0=class p{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(h,T){let A=[];for(let O of T){if(O.status==="aborted")return Nc;O.status==="dirty"&&h.dirty(),A.push(O.value)}return{status:h.value,value:A}}static async mergeObjectAsync(h,T){let A=[];for(let O of T)A.push({key:await O.key,value:await O.value});return p.mergeObjectSync(h,A)}static mergeObjectSync(h,T){let A={};for(let O of T){let{key:$,value:ae}=O;if($.status==="aborted"||ae.status==="aborted")return Nc;$.status==="dirty"&&h.dirty(),ae.status==="dirty"&&h.dirty(),$.value!=="__proto__"&&(typeof ae.value<"u"||O.alwaysSet)&&(A[$.value]=ae.value)}return{status:h.value,value:A}}},Nc=Object.freeze({status:"aborted"}),C2t=p=>({status:"dirty",value:p}),Ph=p=>({status:"valid",value:p}),vLe=p=>p.status==="aborted",bLe=p=>p.status==="dirty",xq=p=>p.status==="valid",ffe=p=>typeof Promise<"u"&&p instanceof Promise,yo;(function(p){p.errToObj=h=>typeof h=="string"?{message:h}:h||{},p.toString=h=>typeof h=="string"?h:h?.message})(yo||(yo={}));var cv=class{constructor(h,T,A,O){this._cachedPath=[],this.parent=h,this.data=T,this._path=A,this._key=O}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xLe=(p,h)=>{if(xq(h))return{success:!0,data:h.value};if(!p.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 ov(p.common.issues);return this._error=T,this._error}}};function Dc(p){if(!p)return{};let{errorMap:h,invalid_type_error:T,required_error:A,description:O}=p;if(h&&(T||A))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return h?{errorMap:h,description:O}:{errorMap:(ae,we)=>ae.code!=="invalid_type"?{message:we.defaultError}:typeof we.data>"u"?{message:A??we.defaultError}:{message:T??we.defaultError},description:O}}var cl=class{constructor(h){this.spa=this.safeParseAsync,this._def=h,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)}get description(){return this._def.description}_getType(h){return o8(h.data)}_getOrReturnCtx(h,T){return T||{common:h.parent.common,data:h.data,parsedType:o8(h.data),schemaErrorMap:this._def.errorMap,path:h.path,parent:h.parent}}_processInputParams(h){return{status:new O0,ctx:{common:h.parent.common,data:h.data,parsedType:o8(h.data),schemaErrorMap:this._def.errorMap,path:h.path,parent:h.parent}}}_parseSync(h){let T=this._parse(h);if(ffe(T))throw new Error("Synchronous parse encountered promise.");return T}_parseAsync(h){let T=this._parse(h);return Promise.resolve(T)}parse(h,T){let A=this.safeParse(h,T);if(A.success)return A.data;throw A.error}safeParse(h,T){var A;let O={common:{issues:[],async:(A=T?.async)!==null&&A!==void 0?A:!1,contextualErrorMap:T?.errorMap},path:T?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:h,parsedType:o8(h)},$=this._parseSync({data:h,path:O.path,parent:O});return xLe(O,$)}async parseAsync(h,T){let A=await this.safeParseAsync(h,T);if(A.success)return A.data;throw A.error}async safeParseAsync(h,T){let A={common:{issues:[],contextualErrorMap:T?.errorMap,async:!0},path:T?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:h,parsedType:o8(h)},O=this._parse({data:h,path:A.path,parent:A}),$=await(ffe(O)?O:Promise.resolve(O));return xLe(A,$)}refine(h,T){let A=O=>typeof T=="string"||typeof T>"u"?{message:T}:typeof T=="function"?T(O):T;return this._refinement((O,$)=>{let ae=h(O),we=()=>$.addIssue({code:fs.custom,...A(O)});return typeof Promise<"u"&&ae instanceof Promise?ae.then(Ge=>Ge?!0:(we(),!1)):ae?!0:(we(),!1)})}refinement(h,T){return this._refinement((A,O)=>h(A)?!0:(O.addIssue(typeof T=="function"?T(A,O):T),!1))}_refinement(h){return new U2({schema:this,typeName:qo.ZodEffects,effect:{type:"refinement",refinement:h}})}superRefine(h){return this._refinement(h)}optional(){return Ox.create(this,this._def)}nullable(){return _4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return u4.create(this,this._def)}promise(){return c8.create(this,this._def)}or(h){return MA.create([this,h],this._def)}and(h){return FA.create(this,h,this._def)}transform(h){return new U2({...Dc(this._def),schema:this,typeName:qo.ZodEffects,effect:{type:"transform",transform:h}})}default(h){let T=typeof h=="function"?h:()=>h;return new zA({...Dc(this._def),innerType:this,defaultValue:T,typeName:qo.ZodDefault})}brand(){return new hfe({typeName:qo.ZodBranded,type:this,...Dc(this._def)})}catch(h){let T=typeof h=="function"?h:()=>h;return new eL({...Dc(this._def),innerType:this,catchValue:T,typeName:qo.ZodCatch})}describe(h){let T=this.constructor;return new T({...this._def,description:h})}pipe(h){return Tq.create(this,h)}readonly(){return rL.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w2t=/^c[^\s-]{8,}$/i,E2t=/^[a-z][a-z0-9]*$/,A2t=/^[0-9A-HJKMNP-TV-Z]{26}$/,D2t=/^[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,N2t=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,I2t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lfe,P2t=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,O2t=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,L2t=p=>p.precision?p.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${p.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${p.precision}}Z$`):p.precision===0?p.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):p.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function M2t(p,h){return!!((h==="v4"||!h)&&P2t.test(p)||(h==="v6"||!h)&&O2t.test(p))}var PA=class p extends cl{_parse(h){if(this._def.coerce&&(h.data=String(h.data)),this._getType(h)!==da.string){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.string,received:$.parsedType}),Nc}let A=new O0,O;for(let $ of this._def.checks)if($.kind==="min")h.data.length<$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),A.dirty());else if($.kind==="max")h.data.length>$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),A.dirty());else if($.kind==="length"){let ae=h.data.length>$.value,we=h.data.length<$.value;(ae||we)&&(O=this._getOrReturnCtx(h,O),ae?Sa(O,{code:fs.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message}):we&&Sa(O,{code:fs.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message}),A.dirty())}else if($.kind==="email")N2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"email",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="emoji")lfe||(lfe=new RegExp(I2t,"u")),lfe.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"emoji",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="uuid")D2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"uuid",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="cuid")w2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"cuid",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="cuid2")E2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"cuid2",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="ulid")A2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"ulid",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="url")try{new URL(h.data)}catch{O=this._getOrReturnCtx(h,O),Sa(O,{validation:"url",code:fs.invalid_string,message:$.message}),A.dirty()}else $.kind==="regex"?($.regex.lastIndex=0,$.regex.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"regex",code:fs.invalid_string,message:$.message}),A.dirty())):$.kind==="trim"?h.data=h.data.trim():$.kind==="includes"?h.data.includes($.value,$.position)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),A.dirty()):$.kind==="toLowerCase"?h.data=h.data.toLowerCase():$.kind==="toUpperCase"?h.data=h.data.toUpperCase():$.kind==="startsWith"?h.data.startsWith($.value)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:{startsWith:$.value},message:$.message}),A.dirty()):$.kind==="endsWith"?h.data.endsWith($.value)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:{endsWith:$.value},message:$.message}),A.dirty()):$.kind==="datetime"?L2t($).test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:"datetime",message:$.message}),A.dirty()):$.kind==="ip"?M2t(h.data,$.version)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"ip",code:fs.invalid_string,message:$.message}),A.dirty()):Tu.assertNever($);return{status:A.value,value:h.data}}_regex(h,T,A){return this.refinement(O=>h.test(O),{validation:T,code:fs.invalid_string,...yo.errToObj(A)})}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}email(h){return this._addCheck({kind:"email",...yo.errToObj(h)})}url(h){return this._addCheck({kind:"url",...yo.errToObj(h)})}emoji(h){return this._addCheck({kind:"emoji",...yo.errToObj(h)})}uuid(h){return this._addCheck({kind:"uuid",...yo.errToObj(h)})}cuid(h){return this._addCheck({kind:"cuid",...yo.errToObj(h)})}cuid2(h){return this._addCheck({kind:"cuid2",...yo.errToObj(h)})}ulid(h){return this._addCheck({kind:"ulid",...yo.errToObj(h)})}ip(h){return this._addCheck({kind:"ip",...yo.errToObj(h)})}datetime(h){var T;return typeof h=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:h}):this._addCheck({kind:"datetime",precision:typeof h?.precision>"u"?null:h?.precision,offset:(T=h?.offset)!==null&&T!==void 0?T:!1,...yo.errToObj(h?.message)})}regex(h,T){return this._addCheck({kind:"regex",regex:h,...yo.errToObj(T)})}includes(h,T){return this._addCheck({kind:"includes",value:h,position:T?.position,...yo.errToObj(T?.message)})}startsWith(h,T){return this._addCheck({kind:"startsWith",value:h,...yo.errToObj(T)})}endsWith(h,T){return this._addCheck({kind:"endsWith",value:h,...yo.errToObj(T)})}min(h,T){return this._addCheck({kind:"min",value:h,...yo.errToObj(T)})}max(h,T){return this._addCheck({kind:"max",value:h,...yo.errToObj(T)})}length(h,T){return this._addCheck({kind:"length",value:h,...yo.errToObj(T)})}nonempty(h){return this.min(1,yo.errToObj(h))}trim(){return new p({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new p({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new p({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(h=>h.kind==="datetime")}get isEmail(){return!!this._def.checks.find(h=>h.kind==="email")}get isURL(){return!!this._def.checks.find(h=>h.kind==="url")}get isEmoji(){return!!this._def.checks.find(h=>h.kind==="emoji")}get isUUID(){return!!this._def.checks.find(h=>h.kind==="uuid")}get isCUID(){return!!this._def.checks.find(h=>h.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(h=>h.kind==="cuid2")}get isULID(){return!!this._def.checks.find(h=>h.kind==="ulid")}get isIP(){return!!this._def.checks.find(h=>h.kind==="ip")}get minLength(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h}get maxLength(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h}};PA.create=p=>{var h;return new PA({checks:[],typeName:qo.ZodString,coerce:(h=p?.coerce)!==null&&h!==void 0?h:!1,...Dc(p)})};function F2t(p,h){let T=(p.toString().split(".")[1]||"").length,A=(h.toString().split(".")[1]||"").length,O=T>A?T:A,$=parseInt(p.toFixed(O).replace(".","")),ae=parseInt(h.toFixed(O).replace(".",""));return $%ae/Math.pow(10,O)}var qO=class p extends cl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(h){if(this._def.coerce&&(h.data=Number(h.data)),this._getType(h)!==da.number){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.number,received:$.parsedType}),Nc}let A,O=new O0;for(let $ of this._def.checks)$.kind==="int"?Tu.isInteger(h.data)||(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.invalid_type,expected:"integer",received:"float",message:$.message}),O.dirty()):$.kind==="min"?($.inclusive?h.data<$.value:h.data<=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),O.dirty()):$.kind==="max"?($.inclusive?h.data>$.value:h.data>=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),O.dirty()):$.kind==="multipleOf"?F2t(h.data,$.value)!==0&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.not_multiple_of,multipleOf:$.value,message:$.message}),O.dirty()):$.kind==="finite"?Number.isFinite(h.data)||(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.not_finite,message:$.message}),O.dirty()):Tu.assertNever($);return{status:O.value,value:h.data}}gte(h,T){return this.setLimit("min",h,!0,yo.toString(T))}gt(h,T){return this.setLimit("min",h,!1,yo.toString(T))}lte(h,T){return this.setLimit("max",h,!0,yo.toString(T))}lt(h,T){return this.setLimit("max",h,!1,yo.toString(T))}setLimit(h,T,A,O){return new p({...this._def,checks:[...this._def.checks,{kind:h,value:T,inclusive:A,message:yo.toString(O)}]})}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}int(h){return this._addCheck({kind:"int",message:yo.toString(h)})}positive(h){return this._addCheck({kind:"min",value:0,inclusive:!1,message:yo.toString(h)})}negative(h){return this._addCheck({kind:"max",value:0,inclusive:!1,message:yo.toString(h)})}nonpositive(h){return this._addCheck({kind:"max",value:0,inclusive:!0,message:yo.toString(h)})}nonnegative(h){return this._addCheck({kind:"min",value:0,inclusive:!0,message:yo.toString(h)})}multipleOf(h,T){return this._addCheck({kind:"multipleOf",value:h,message:yo.toString(T)})}finite(h){return this._addCheck({kind:"finite",message:yo.toString(h)})}safe(h){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:yo.toString(h)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:yo.toString(h)})}get minValue(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h}get maxValue(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h}get isInt(){return!!this._def.checks.find(h=>h.kind==="int"||h.kind==="multipleOf"&&Tu.isInteger(h.value))}get isFinite(){let h=null,T=null;for(let A of this._def.checks){if(A.kind==="finite"||A.kind==="int"||A.kind==="multipleOf")return!0;A.kind==="min"?(T===null||A.value>T)&&(T=A.value):A.kind==="max"&&(h===null||A.value<h)&&(h=A.value)}return Number.isFinite(T)&&Number.isFinite(h)}};qO.create=p=>new qO({checks:[],typeName:qo.ZodNumber,coerce:p?.coerce||!1,...Dc(p)});var $O=class p extends cl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(h){if(this._def.coerce&&(h.data=BigInt(h.data)),this._getType(h)!==da.bigint){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.bigint,received:$.parsedType}),Nc}let A,O=new O0;for(let $ of this._def.checks)$.kind==="min"?($.inclusive?h.data<$.value:h.data<=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),O.dirty()):$.kind==="max"?($.inclusive?h.data>$.value:h.data>=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),O.dirty()):$.kind==="multipleOf"?h.data%$.value!==BigInt(0)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.not_multiple_of,multipleOf:$.value,message:$.message}),O.dirty()):Tu.assertNever($);return{status:O.value,value:h.data}}gte(h,T){return this.setLimit("min",h,!0,yo.toString(T))}gt(h,T){return this.setLimit("min",h,!1,yo.toString(T))}lte(h,T){return this.setLimit("max",h,!0,yo.toString(T))}lt(h,T){return this.setLimit("max",h,!1,yo.toString(T))}setLimit(h,T,A,O){return new p({...this._def,checks:[...this._def.checks,{kind:h,value:T,inclusive:A,message:yo.toString(O)}]})}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}positive(h){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:yo.toString(h)})}negative(h){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:yo.toString(h)})}nonpositive(h){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:yo.toString(h)})}nonnegative(h){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:yo.toString(h)})}multipleOf(h,T){return this._addCheck({kind:"multipleOf",value:h,message:yo.toString(T)})}get minValue(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h}get maxValue(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h}};$O.create=p=>{var h;return new $O({checks:[],typeName:qo.ZodBigInt,coerce:(h=p?.coerce)!==null&&h!==void 0?h:!1,...Dc(p)})};var GO=class extends cl{_parse(h){if(this._def.coerce&&(h.data=!!h.data),this._getType(h)!==da.boolean){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.boolean,received:A.parsedType}),Nc}return Ph(h.data)}};GO.create=p=>new GO({typeName:qo.ZodBoolean,coerce:p?.coerce||!1,...Dc(p)});var HO=class p extends cl{_parse(h){if(this._def.coerce&&(h.data=new Date(h.data)),this._getType(h)!==da.date){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.date,received:$.parsedType}),Nc}if(isNaN(h.data.getTime())){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_date}),Nc}let A=new O0,O;for(let $ of this._def.checks)$.kind==="min"?h.data.getTime()<$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),A.dirty()):$.kind==="max"?h.data.getTime()>$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),A.dirty()):Tu.assertNever($);return{status:A.value,value:new Date(h.data.getTime())}}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}min(h,T){return this._addCheck({kind:"min",value:h.getTime(),message:yo.toString(T)})}max(h,T){return this._addCheck({kind:"max",value:h.getTime(),message:yo.toString(T)})}get minDate(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h!=null?new Date(h):null}get maxDate(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h!=null?new Date(h):null}};HO.create=p=>new HO({checks:[],coerce:p?.coerce||!1,typeName:qo.ZodDate,...Dc(p)});var XO=class extends cl{_parse(h){if(this._getType(h)!==da.symbol){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.symbol,received:A.parsedType}),Nc}return Ph(h.data)}};XO.create=p=>new XO({typeName:qo.ZodSymbol,...Dc(p)});var OA=class extends cl{_parse(h){if(this._getType(h)!==da.undefined){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.undefined,received:A.parsedType}),Nc}return Ph(h.data)}};OA.create=p=>new OA({typeName:qo.ZodUndefined,...Dc(p)});var LA=class extends cl{_parse(h){if(this._getType(h)!==da.null){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.null,received:A.parsedType}),Nc}return Ph(h.data)}};LA.create=p=>new LA({typeName:qo.ZodNull,...Dc(p)});var QO=class extends cl{constructor(){super(...arguments),this._any=!0}_parse(h){return Ph(h.data)}};QO.create=p=>new QO({typeName:qo.ZodAny,...Dc(p)});var l4=class extends cl{constructor(){super(...arguments),this._unknown=!0}_parse(h){return Ph(h.data)}};l4.create=p=>new l4({typeName:qo.ZodUnknown,...Dc(p)});var Lx=class extends cl{_parse(h){let T=this._getOrReturnCtx(h);return Sa(T,{code:fs.invalid_type,expected:da.never,received:T.parsedType}),Nc}};Lx.create=p=>new Lx({typeName:qo.ZodNever,...Dc(p)});var YO=class extends cl{_parse(h){if(this._getType(h)!==da.undefined){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.void,received:A.parsedType}),Nc}return Ph(h.data)}};YO.create=p=>new YO({typeName:qo.ZodVoid,...Dc(p)});var u4=class p extends cl{_parse(h){let{ctx:T,status:A}=this._processInputParams(h),O=this._def;if(T.parsedType!==da.array)return Sa(T,{code:fs.invalid_type,expected:da.array,received:T.parsedType}),Nc;if(O.exactLength!==null){let ae=T.data.length>O.exactLength.value,we=T.data.length<O.exactLength.value;(ae||we)&&(Sa(T,{code:ae?fs.too_big:fs.too_small,minimum:we?O.exactLength.value:void 0,maximum:ae?O.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:O.exactLength.message}),A.dirty())}if(O.minLength!==null&&T.data.length<O.minLength.value&&(Sa(T,{code:fs.too_small,minimum:O.minLength.value,type:"array",inclusive:!0,exact:!1,message:O.minLength.message}),A.dirty()),O.maxLength!==null&&T.data.length>O.maxLength.value&&(Sa(T,{code:fs.too_big,maximum:O.maxLength.value,type:"array",inclusive:!0,exact:!1,message:O.maxLength.message}),A.dirty()),T.common.async)return Promise.all([...T.data].map((ae,we)=>O.type._parseAsync(new cv(T,ae,T.path,we)))).then(ae=>O0.mergeArray(A,ae));let $=[...T.data].map((ae,we)=>O.type._parseSync(new cv(T,ae,T.path,we)));return O0.mergeArray(A,$)}get element(){return this._def.type}min(h,T){return new p({...this._def,minLength:{value:h,message:yo.toString(T)}})}max(h,T){return new p({...this._def,maxLength:{value:h,message:yo.toString(T)}})}length(h,T){return new p({...this._def,exactLength:{value:h,message:yo.toString(T)}})}nonempty(h){return this.min(1,h)}};u4.create=(p,h)=>new u4({type:p,minLength:null,maxLength:null,exactLength:null,typeName:qo.ZodArray,...Dc(h)});function IA(p){if(p instanceof V1){let h={};for(let T in p.shape){let A=p.shape[T];h[T]=Ox.create(IA(A))}return new V1({...p._def,shape:()=>h})}else return p instanceof u4?new u4({...p._def,type:IA(p.element)}):p instanceof Ox?Ox.create(IA(p.unwrap())):p instanceof _4?_4.create(IA(p.unwrap())):p instanceof NS?NS.create(p.items.map(h=>IA(h))):p}var V1=class p extends cl{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let h=this._def.shape(),T=Tu.objectKeys(h);return this._cached={shape:h,keys:T}}_parse(h){if(this._getType(h)!==da.object){let Oe=this._getOrReturnCtx(h);return Sa(Oe,{code:fs.invalid_type,expected:da.object,received:Oe.parsedType}),Nc}let{status:A,ctx:O}=this._processInputParams(h),{shape:$,keys:ae}=this._getCached(),we=[];if(!(this._def.catchall instanceof Lx&&this._def.unknownKeys==="strip"))for(let Oe in O.data)ae.includes(Oe)||we.push(Oe);let Ge=[];for(let Oe of ae){let Ze=$[Oe],Yr=O.data[Oe];Ge.push({key:{status:"valid",value:Oe},value:Ze._parse(new cv(O,Yr,O.path,Oe)),alwaysSet:Oe in O.data})}if(this._def.catchall instanceof Lx){let Oe=this._def.unknownKeys;if(Oe==="passthrough")for(let Ze of we)Ge.push({key:{status:"valid",value:Ze},value:{status:"valid",value:O.data[Ze]}});else if(Oe==="strict")we.length>0&&(Sa(O,{code:fs.unrecognized_keys,keys:we}),A.dirty());else if(Oe!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Oe=this._def.catchall;for(let Ze of we){let Yr=O.data[Ze];Ge.push({key:{status:"valid",value:Ze},value:Oe._parse(new cv(O,Yr,O.path,Ze)),alwaysSet:Ze in O.data})}}return O.common.async?Promise.resolve().then(async()=>{let Oe=[];for(let Ze of Ge){let Yr=await Ze.key;Oe.push({key:Yr,value:await Ze.value,alwaysSet:Ze.alwaysSet})}return Oe}).then(Oe=>O0.mergeObjectSync(A,Oe)):O0.mergeObjectSync(A,Ge)}get shape(){return this._def.shape()}strict(h){return yo.errToObj,new p({...this._def,unknownKeys:"strict",...h!==void 0?{errorMap:(T,A)=>{var O,$,ae,we;let Ge=(ae=($=(O=this._def).errorMap)===null||$===void 0?void 0:$.call(O,T,A).message)!==null&&ae!==void 0?ae:A.defaultError;return T.code==="unrecognized_keys"?{message:(we=yo.errToObj(h).message)!==null&&we!==void 0?we:Ge}:{message:Ge}}}:{}})}strip(){return new p({...this._def,unknownKeys:"strip"})}passthrough(){return new p({...this._def,unknownKeys:"passthrough"})}extend(h){return new p({...this._def,shape:()=>({...this._def.shape(),...h})})}merge(h){return new p({unknownKeys:h._def.unknownKeys,catchall:h._def.catchall,shape:()=>({...this._def.shape(),...h._def.shape()}),typeName:qo.ZodObject})}setKey(h,T){return this.augment({[h]:T})}catchall(h){return new p({...this._def,catchall:h})}pick(h){let T={};return Tu.objectKeys(h).forEach(A=>{h[A]&&this.shape[A]&&(T[A]=this.shape[A])}),new p({...this._def,shape:()=>T})}omit(h){let T={};return Tu.objectKeys(this.shape).forEach(A=>{h[A]||(T[A]=this.shape[A])}),new p({...this._def,shape:()=>T})}deepPartial(){return IA(this)}partial(h){let T={};return Tu.objectKeys(this.shape).forEach(A=>{let O=this.shape[A];h&&!h[A]?T[A]=O:T[A]=O.optional()}),new p({...this._def,shape:()=>T})}required(h){let T={};return Tu.objectKeys(this.shape).forEach(A=>{if(h&&!h[A])T[A]=this.shape[A];else{let $=this.shape[A];for(;$ instanceof Ox;)$=$._def.innerType;T[A]=$}}),new p({...this._def,shape:()=>T})}keyof(){return TLe(Tu.objectKeys(this.shape))}};V1.create=(p,h)=>new V1({shape:()=>p,unknownKeys:"strip",catchall:Lx.create(),typeName:qo.ZodObject,...Dc(h)});V1.strictCreate=(p,h)=>new V1({shape:()=>p,unknownKeys:"strict",catchall:Lx.create(),typeName:qo.ZodObject,...Dc(h)});V1.lazycreate=(p,h)=>new V1({shape:p,unknownKeys:"strip",catchall:Lx.create(),typeName:qo.ZodObject,...Dc(h)});var MA=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A=this._def.options;function O($){for(let we of $)if(we.result.status==="valid")return we.result;for(let we of $)if(we.result.status==="dirty")return T.common.issues.push(...we.ctx.common.issues),we.result;let ae=$.map(we=>new ov(we.ctx.common.issues));return Sa(T,{code:fs.invalid_union,unionErrors:ae}),Nc}if(T.common.async)return Promise.all(A.map(async $=>{let ae={...T,common:{...T.common,issues:[]},parent:null};return{result:await $._parseAsync({data:T.data,path:T.path,parent:ae}),ctx:ae}})).then(O);{let $,ae=[];for(let Ge of A){let Oe={...T,common:{...T.common,issues:[]},parent:null},Ze=Ge._parseSync({data:T.data,path:T.path,parent:Oe});if(Ze.status==="valid")return Ze;Ze.status==="dirty"&&!$&&($={result:Ze,ctx:Oe}),Oe.common.issues.length&&ae.push(Oe.common.issues)}if($)return T.common.issues.push(...$.ctx.common.issues),$.result;let we=ae.map(Ge=>new ov(Ge));return Sa(T,{code:fs.invalid_union,unionErrors:we}),Nc}}get options(){return this._def.options}};MA.create=(p,h)=>new MA({options:p,typeName:qo.ZodUnion,...Dc(h)});var vq=p=>p instanceof RA?vq(p.schema):p instanceof U2?vq(p.innerType()):p instanceof BA?[p.value]:p instanceof jA?p.options:p instanceof JA?Object.keys(p.enum):p instanceof zA?vq(p._def.innerType):p instanceof OA?[void 0]:p instanceof LA?[null]:null,pfe=class p extends cl{_parse(h){let{ctx:T}=this._processInputParams(h);if(T.parsedType!==da.object)return Sa(T,{code:fs.invalid_type,expected:da.object,received:T.parsedType}),Nc;let A=this.discriminator,O=T.data[A],$=this.optionsMap.get(O);return $?T.common.async?$._parseAsync({data:T.data,path:T.path,parent:T}):$._parseSync({data:T.data,path:T.path,parent:T}):(Sa(T,{code:fs.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[A]}),Nc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(h,T,A){let O=new Map;for(let $ of T){let ae=vq($.shape[h]);if(!ae)throw new Error(`A discriminator value for key \`${h}\` could not be extracted from all schema options`);for(let we of ae){if(O.has(we))throw new Error(`Discriminator property ${String(h)} has duplicate value ${String(we)}`);O.set(we,$)}}return new p({typeName:qo.ZodDiscriminatedUnion,discriminator:h,options:T,optionsMap:O,...Dc(A)})}};function dfe(p,h){let T=o8(p),A=o8(h);if(p===h)return{valid:!0,data:p};if(T===da.object&&A===da.object){let O=Tu.objectKeys(h),$=Tu.objectKeys(p).filter(we=>O.indexOf(we)!==-1),ae={...p,...h};for(let we of $){let Ge=dfe(p[we],h[we]);if(!Ge.valid)return{valid:!1};ae[we]=Ge.data}return{valid:!0,data:ae}}else if(T===da.array&&A===da.array){if(p.length!==h.length)return{valid:!1};let O=[];for(let $=0;$<p.length;$++){let ae=p[$],we=h[$],Ge=dfe(ae,we);if(!Ge.valid)return{valid:!1};O.push(Ge.data)}return{valid:!0,data:O}}else return T===da.date&&A===da.date&&+p==+h?{valid:!0,data:p}:{valid:!1}}var FA=class extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h),O=($,ae)=>{if(vLe($)||vLe(ae))return Nc;let we=dfe($.value,ae.value);return we.valid?((bLe($)||bLe(ae))&&T.dirty(),{status:T.value,value:we.data}):(Sa(A,{code:fs.invalid_intersection_types}),Nc)};return A.common.async?Promise.all([this._def.left._parseAsync({data:A.data,path:A.path,parent:A}),this._def.right._parseAsync({data:A.data,path:A.path,parent:A})]).then(([$,ae])=>O($,ae)):O(this._def.left._parseSync({data:A.data,path:A.path,parent:A}),this._def.right._parseSync({data:A.data,path:A.path,parent:A}))}};FA.create=(p,h,T)=>new FA({left:p,right:h,typeName:qo.ZodIntersection,...Dc(T)});var NS=class p extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.array)return Sa(A,{code:fs.invalid_type,expected:da.array,received:A.parsedType}),Nc;if(A.data.length<this._def.items.length)return Sa(A,{code:fs.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Nc;!this._def.rest&&A.data.length>this._def.items.length&&(Sa(A,{code:fs.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T.dirty());let $=[...A.data].map((ae,we)=>{let Ge=this._def.items[we]||this._def.rest;return Ge?Ge._parse(new cv(A,ae,A.path,we)):null}).filter(ae=>!!ae);return A.common.async?Promise.all($).then(ae=>O0.mergeArray(T,ae)):O0.mergeArray(T,$)}get items(){return this._def.items}rest(h){return new p({...this._def,rest:h})}};NS.create=(p,h)=>{if(!Array.isArray(p))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new NS({items:p,typeName:qo.ZodTuple,rest:null,...Dc(h)})};var mfe=class p extends cl{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.object)return Sa(A,{code:fs.invalid_type,expected:da.object,received:A.parsedType}),Nc;let O=[],$=this._def.keyType,ae=this._def.valueType;for(let we in A.data)O.push({key:$._parse(new cv(A,we,A.path,we)),value:ae._parse(new cv(A,A.data[we],A.path,we))});return A.common.async?O0.mergeObjectAsync(T,O):O0.mergeObjectSync(T,O)}get element(){return this._def.valueType}static create(h,T,A){return T instanceof cl?new p({keyType:h,valueType:T,typeName:qo.ZodRecord,...Dc(A)}):new p({keyType:PA.create(),valueType:h,typeName:qo.ZodRecord,...Dc(T)})}},ZO=class extends cl{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.map)return Sa(A,{code:fs.invalid_type,expected:da.map,received:A.parsedType}),Nc;let O=this._def.keyType,$=this._def.valueType,ae=[...A.data.entries()].map(([we,Ge],Oe)=>({key:O._parse(new cv(A,we,A.path,[Oe,"key"])),value:$._parse(new cv(A,Ge,A.path,[Oe,"value"]))}));if(A.common.async){let we=new Map;return Promise.resolve().then(async()=>{for(let Ge of ae){let Oe=await Ge.key,Ze=await Ge.value;if(Oe.status==="aborted"||Ze.status==="aborted")return Nc;(Oe.status==="dirty"||Ze.status==="dirty")&&T.dirty(),we.set(Oe.value,Ze.value)}return{status:T.value,value:we}})}else{let we=new Map;for(let Ge of ae){let Oe=Ge.key,Ze=Ge.value;if(Oe.status==="aborted"||Ze.status==="aborted")return Nc;(Oe.status==="dirty"||Ze.status==="dirty")&&T.dirty(),we.set(Oe.value,Ze.value)}return{status:T.value,value:we}}}};ZO.create=(p,h,T)=>new ZO({valueType:h,keyType:p,typeName:qo.ZodMap,...Dc(T)});var KO=class p extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.set)return Sa(A,{code:fs.invalid_type,expected:da.set,received:A.parsedType}),Nc;let O=this._def;O.minSize!==null&&A.data.size<O.minSize.value&&(Sa(A,{code:fs.too_small,minimum:O.minSize.value,type:"set",inclusive:!0,exact:!1,message:O.minSize.message}),T.dirty()),O.maxSize!==null&&A.data.size>O.maxSize.value&&(Sa(A,{code:fs.too_big,maximum:O.maxSize.value,type:"set",inclusive:!0,exact:!1,message:O.maxSize.message}),T.dirty());let $=this._def.valueType;function ae(Ge){let Oe=new Set;for(let Ze of Ge){if(Ze.status==="aborted")return Nc;Ze.status==="dirty"&&T.dirty(),Oe.add(Ze.value)}return{status:T.value,value:Oe}}let we=[...A.data.values()].map((Ge,Oe)=>$._parse(new cv(A,Ge,A.path,Oe)));return A.common.async?Promise.all(we).then(Ge=>ae(Ge)):ae(we)}min(h,T){return new p({...this._def,minSize:{value:h,message:yo.toString(T)}})}max(h,T){return new p({...this._def,maxSize:{value:h,message:yo.toString(T)}})}size(h,T){return this.min(h,T).max(h,T)}nonempty(h){return this.min(1,h)}};KO.create=(p,h)=>new KO({valueType:p,minSize:null,maxSize:null,typeName:qo.ZodSet,...Dc(h)});var gfe=class p extends cl{constructor(){super(...arguments),this.validate=this.implement}_parse(h){let{ctx:T}=this._processInputParams(h);if(T.parsedType!==da.function)return Sa(T,{code:fs.invalid_type,expected:da.function,received:T.parsedType}),Nc;function A(we,Ge){return _fe({data:we,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,ufe(),bq].filter(Oe=>!!Oe),issueData:{code:fs.invalid_arguments,argumentsError:Ge}})}function O(we,Ge){return _fe({data:we,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,ufe(),bq].filter(Oe=>!!Oe),issueData:{code:fs.invalid_return_type,returnTypeError:Ge}})}let $={errorMap:T.common.contextualErrorMap},ae=T.data;if(this._def.returns instanceof c8){let we=this;return Ph(async function(...Ge){let Oe=new ov([]),Ze=await we._def.args.parseAsync(Ge,$).catch(Ki=>{throw Oe.addIssue(A(Ge,Ki)),Oe}),Yr=await Reflect.apply(ae,this,Ze);return await we._def.returns._def.type.parseAsync(Yr,$).catch(Ki=>{throw Oe.addIssue(O(Yr,Ki)),Oe})})}else{let we=this;return Ph(function(...Ge){let Oe=we._def.args.safeParse(Ge,$);if(!Oe.success)throw new ov([A(Ge,Oe.error)]);let Ze=Reflect.apply(ae,this,Oe.data),Yr=we._def.returns.safeParse(Ze,$);if(!Yr.success)throw new ov([O(Ze,Yr.error)]);return Yr.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...h){return new p({...this._def,args:NS.create(h).rest(l4.create())})}returns(h){return new p({...this._def,returns:h})}implement(h){return this.parse(h)}strictImplement(h){return this.parse(h)}static create(h,T,A){return new p({args:h||NS.create([]).rest(l4.create()),returns:T||l4.create(),typeName:qo.ZodFunction,...Dc(A)})}},RA=class extends cl{get schema(){return this._def.getter()}_parse(h){let{ctx:T}=this._processInputParams(h);return this._def.getter()._parse({data:T.data,path:T.path,parent:T})}};RA.create=(p,h)=>new RA({getter:p,typeName:qo.ZodLazy,...Dc(h)});var BA=class extends cl{_parse(h){if(h.data!==this._def.value){let T=this._getOrReturnCtx(h);return Sa(T,{received:T.data,code:fs.invalid_literal,expected:this._def.value}),Nc}return{status:"valid",value:h.data}}get value(){return this._def.value}};BA.create=(p,h)=>new BA({value:p,typeName:qo.ZodLiteral,...Dc(h)});function TLe(p,h){return new jA({values:p,typeName:qo.ZodEnum,...Dc(h)})}var jA=class p extends cl{_parse(h){if(typeof h.data!="string"){let T=this._getOrReturnCtx(h),A=this._def.values;return Sa(T,{expected:Tu.joinValues(A),received:T.parsedType,code:fs.invalid_type}),Nc}if(this._def.values.indexOf(h.data)===-1){let T=this._getOrReturnCtx(h),A=this._def.values;return Sa(T,{received:T.data,code:fs.invalid_enum_value,options:A}),Nc}return Ph(h.data)}get options(){return this._def.values}get enum(){let h={};for(let T of this._def.values)h[T]=T;return h}get Values(){let h={};for(let T of this._def.values)h[T]=T;return h}get Enum(){let h={};for(let T of this._def.values)h[T]=T;return h}extract(h){return p.create(h)}exclude(h){return p.create(this.options.filter(T=>!h.includes(T)))}};jA.create=TLe;var JA=class extends cl{_parse(h){let T=Tu.getValidEnumValues(this._def.values),A=this._getOrReturnCtx(h);if(A.parsedType!==da.string&&A.parsedType!==da.number){let O=Tu.objectValues(T);return Sa(A,{expected:Tu.joinValues(O),received:A.parsedType,code:fs.invalid_type}),Nc}if(T.indexOf(h.data)===-1){let O=Tu.objectValues(T);return Sa(A,{received:A.data,code:fs.invalid_enum_value,options:O}),Nc}return Ph(h.data)}get enum(){return this._def.values}};JA.create=(p,h)=>new JA({values:p,typeName:qo.ZodNativeEnum,...Dc(h)});var c8=class extends cl{unwrap(){return this._def.type}_parse(h){let{ctx:T}=this._processInputParams(h);if(T.parsedType!==da.promise&&T.common.async===!1)return Sa(T,{code:fs.invalid_type,expected:da.promise,received:T.parsedType}),Nc;let A=T.parsedType===da.promise?T.data:Promise.resolve(T.data);return Ph(A.then(O=>this._def.type.parseAsync(O,{path:T.path,errorMap:T.common.contextualErrorMap})))}};c8.create=(p,h)=>new c8({type:p,typeName:qo.ZodPromise,...Dc(h)});var U2=class extends cl{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(h){let{status:T,ctx:A}=this._processInputParams(h),O=this._def.effect||null,$={addIssue:ae=>{Sa(A,ae),ae.fatal?T.abort():T.dirty()},get path(){return A.path}};if($.addIssue=$.addIssue.bind($),O.type==="preprocess"){let ae=O.transform(A.data,$);return A.common.issues.length?{status:"dirty",value:A.data}:A.common.async?Promise.resolve(ae).then(we=>this._def.schema._parseAsync({data:we,path:A.path,parent:A})):this._def.schema._parseSync({data:ae,path:A.path,parent:A})}if(O.type==="refinement"){let ae=we=>{let Ge=O.refinement(we,$);if(A.common.async)return Promise.resolve(Ge);if(Ge instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return we};if(A.common.async===!1){let we=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});return we.status==="aborted"?Nc:(we.status==="dirty"&&T.dirty(),ae(we.value),{status:T.value,value:we.value})}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then(we=>we.status==="aborted"?Nc:(we.status==="dirty"&&T.dirty(),ae(we.value).then(()=>({status:T.value,value:we.value}))))}if(O.type==="transform")if(A.common.async===!1){let ae=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(!xq(ae))return ae;let we=O.transform(ae.value,$);if(we instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:T.value,value:we}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then(ae=>xq(ae)?Promise.resolve(O.transform(ae.value,$)).then(we=>({status:T.value,value:we})):ae);Tu.assertNever(O)}};U2.create=(p,h,T)=>new U2({schema:p,typeName:qo.ZodEffects,effect:h,...Dc(T)});U2.createWithPreprocess=(p,h,T)=>new U2({schema:h,effect:{type:"preprocess",transform:p},typeName:qo.ZodEffects,...Dc(T)});var Ox=class extends cl{_parse(h){return this._getType(h)===da.undefined?Ph(void 0):this._def.innerType._parse(h)}unwrap(){return this._def.innerType}};Ox.create=(p,h)=>new Ox({innerType:p,typeName:qo.ZodOptional,...Dc(h)});var _4=class extends cl{_parse(h){return this._getType(h)===da.null?Ph(null):this._def.innerType._parse(h)}unwrap(){return this._def.innerType}};_4.create=(p,h)=>new _4({innerType:p,typeName:qo.ZodNullable,...Dc(h)});var zA=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A=T.data;return T.parsedType===da.undefined&&(A=this._def.defaultValue()),this._def.innerType._parse({data:A,path:T.path,parent:T})}removeDefault(){return this._def.innerType}};zA.create=(p,h)=>new zA({innerType:p,typeName:qo.ZodDefault,defaultValue:typeof h.default=="function"?h.default:()=>h.default,...Dc(h)});var eL=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A={...T,common:{...T.common,issues:[]}},O=this._def.innerType._parse({data:A.data,path:A.path,parent:{...A}});return ffe(O)?O.then($=>({status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new ov(A.common.issues)},input:A.data})})):{status:"valid",value:O.status==="valid"?O.value:this._def.catchValue({get error(){return new ov(A.common.issues)},input:A.data})}}removeCatch(){return this._def.innerType}};eL.create=(p,h)=>new eL({innerType:p,typeName:qo.ZodCatch,catchValue:typeof h.catch=="function"?h.catch:()=>h.catch,...Dc(h)});var tL=class extends cl{_parse(h){if(this._getType(h)!==da.nan){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.nan,received:A.parsedType}),Nc}return{status:"valid",value:h.data}}};tL.create=p=>new tL({typeName:qo.ZodNaN,...Dc(p)});var hTt=Symbol("zod_brand"),hfe=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A=T.data;return this._def.type._parse({data:A,path:T.path,parent:T})}unwrap(){return this._def.type}},Tq=class p extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:A.data,path:A.path,parent:A});return $.status==="aborted"?Nc:$.status==="dirty"?(T.dirty(),C2t($.value)):this._def.out._parseAsync({data:$.value,path:A.path,parent:A})})();{let O=this._def.in._parseSync({data:A.data,path:A.path,parent:A});return O.status==="aborted"?Nc:O.status==="dirty"?(T.dirty(),{status:"dirty",value:O.value}):this._def.out._parseSync({data:O.value,path:A.path,parent:A})}}static create(h,T){return new p({in:h,out:T,typeName:qo.ZodPipeline})}},rL=class extends cl{_parse(h){let T=this._def.innerType._parse(h);return xq(T)&&(T.value=Object.freeze(T.value)),T}};rL.create=(p,h)=>new rL({innerType:p,typeName:qo.ZodReadonly,...Dc(h)});var yTt={object:V1.lazycreate},qo;(function(p){p.ZodString="ZodString",p.ZodNumber="ZodNumber",p.ZodNaN="ZodNaN",p.ZodBigInt="ZodBigInt",p.ZodBoolean="ZodBoolean",p.ZodDate="ZodDate",p.ZodSymbol="ZodSymbol",p.ZodUndefined="ZodUndefined",p.ZodNull="ZodNull",p.ZodAny="ZodAny",p.ZodUnknown="ZodUnknown",p.ZodNever="ZodNever",p.ZodVoid="ZodVoid",p.ZodArray="ZodArray",p.ZodObject="ZodObject",p.ZodUnion="ZodUnion",p.ZodDiscriminatedUnion="ZodDiscriminatedUnion",p.ZodIntersection="ZodIntersection",p.ZodTuple="ZodTuple",p.ZodRecord="ZodRecord",p.ZodMap="ZodMap",p.ZodSet="ZodSet",p.ZodFunction="ZodFunction",p.ZodLazy="ZodLazy",p.ZodLiteral="ZodLiteral",p.ZodEnum="ZodEnum",p.ZodEffects="ZodEffects",p.ZodNativeEnum="ZodNativeEnum",p.ZodOptional="ZodOptional",p.ZodNullable="ZodNullable",p.ZodDefault="ZodDefault",p.ZodCatch="ZodCatch",p.ZodPromise="ZodPromise",p.ZodBranded="ZodBranded",p.ZodPipeline="ZodPipeline",p.ZodReadonly="ZodReadonly"})(qo||(qo={}));var tf=PA.create,vTt=qO.create,bTt=tL.create,xTt=$O.create,yfe=GO.create,TTt=HO.create,STt=XO.create,kTt=OA.create,CTt=LA.create,SLe=QO.create,wTt=l4.create,ETt=Lx.create,ATt=YO.create,DTt=u4.create,vfe=V1.create,NTt=V1.strictCreate,ITt=MA.create,PTt=pfe.create,OTt=FA.create,LTt=NS.create,kLe=mfe.create,MTt=ZO.create,FTt=KO.create,RTt=gfe.create,BTt=RA.create,jTt=BA.create,Sq=jA.create,JTt=JA.create,zTt=c8.create,UTt=U2.create,VTt=Ox.create,WTt=_4.create,qTt=U2.createWithPreprocess,$Tt=Tq.create;var B2t=vfe({primary:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The primary color of the workspace"),background:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d232a").describe("The background color of the workspace"),success:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#087f5b").describe("The success color of the workspace"),info:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The informational color of the workspace"),warning:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace"),error:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#990000").describe("The error color of the workspace"),fatal:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#7d1a1a").describe("The fatal color of the workspace")}).describe("Colors used for various workspace elements"),CLe=vfe({name:tf().trim().toLowerCase().optional().describe("The name of the package"),namespace:tf().trim().toLowerCase().optional().describe("The namespace of the package"),organization:tf().trim().default("storm-software").describe("The organization of the workspace"),repository:tf().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),license:tf().trim().default("Apache License 2.0").describe("The root directory of the package"),homepage:tf().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),branch:tf().trim().default("main").describe("The branch of the workspace"),preMajor:yfe().default(!1).describe("An indicator specifying if the package is still in it's pre-major version"),owner:tf().trim().default("@storm-software/development").describe("The owner of the package"),worker:tf().trim().default("stormie-bot").describe("The worker of the package (this is the bot that will be used to perform various tasks)"),env:Sq(["development","staging","production"]).default("production").describe("The current runtime environment of the package"),ci:yfe().default(!0).describe("An indicator specifying if the current environment is a CI environment"),workspaceRoot:tf().trim().optional().describe("The root directory of the workspace"),packageDirectory:tf().trim().optional().describe("The root directory of the package"),buildDirectory:tf().trim().default("dist").describe("The build directory for the workspace"),runtimeDirectory:tf().trim().default("node_modules/.storm").describe("The runtime directory of Storm"),runtimeVersion:tf().trim().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/).default("1.0.0").describe("The global version of the Storm runtime"),packageManager:Sq(["npm","yarn","pnpm","bun"]).default("npm").describe("The package manager used by the repository"),timezone:tf().trim().default("America/New_York").describe("The default timezone of the workspace"),locale:tf().trim().default("en-US").describe("The default locale of the workspace"),logLevel:Sq(["silent","fatal","error","warn","info","debug","trace","all"]).default("debug").describe("The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."),configFile:tf().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),colors:B2t.describe("Storm theme config values used for styling various package elements"),extensions:kLe(SLe()).optional().default({}).describe("Configuration of each used extension")}).describe("Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo.");var ELe={primary:"#1fb2a6",background:"#1d232a",success:"#087f5b",info:"#0ea5e9",warning:"#fcc419",error:"#990000",fatal:"#7d1a1a"},nL={name:"storm",namespace:"storm-software",license:"Apache License 2.0",homepage:"https://stormsoftware.org",preMajor:!1,owner:"@storm-software/development",worker:"stormie-bot",runtimeDirectory:"node_modules/.storm",packageManager:"npm",timezone:"America/New_York",locale:"en-US",env:"production",branch:"main",organization:"storm-software",ci:!0,configFile:null,runtimeVersion:"1.0.0",colors:{...ELe},extensions:{}},ALe=(p={},h)=>{let T="storm-workspace",A="storm-software",O="https://github.com/storm-software/storm-ops",$=nL.license,ae=nL.homepage,we=hLe(h);if(j2t(wLe(we,"package.json"))){let Ge=J2t(wLe(we,"package.json"),{encoding:"utf-8"});if(Ge){let Oe=JSON.parse(Ge);Oe.name&&(T=Oe.name),Oe.namespace&&(A=Oe.namespace),Oe.repository?.url&&(O=Oe.repository?.url),Oe.license&&($=Oe.license),Oe.homepage&&(ae=Oe.homepage)}}return CLe.parse({...p,...nL,colors:{...p.colors,...ELe},workspaceRoot:we,name:T,namespace:A,repository:O,license:$??nL.license,homepage:ae??nL.homepage,extensions:{...p.extensions}})};var kq=p=>{switch(p){case"all":return sp.ALL;case"trace":return sp.TRACE;case"debug":return sp.DEBUG;case"info":return sp.INFO;case"warn":return sp.WARN;case"error":return sp.ERROR;case"fatal":return sp.FATAL;case"silent":return sp.SILENT;default:return sp.INFO}},DLe=p=>p>=sp.ALL?av.ALL:p>=sp.TRACE?av.TRACE:p>=sp.DEBUG?av.DEBUG:p>=sp.INFO?av.INFO:p>=sp.WARN?av.WARN:p>=sp.ERROR?av.ERROR:p>=sp.FATAL?av.FATAL:p<=sp.SILENT?av.SILENT:av.INFO;var Nfe=Eue(cMe(),1);var _bt=p=>{let h=`STORM_EXTENSION_${p.toUpperCase()}_`;return Object.keys(process.env).filter(T=>T.startsWith(h)).reduce((T,A)=>{let O=A.replace(h,"").split("_").map($=>$.length>0?$.trim().charAt(0).toUpperCase()+$.trim().slice(1):"").join("");return O&&(T[O]=process.env[A]),T},{})},lMe=()=>{let p="STORM_",h={name:process.env[`${p}NAME`],namespace:process.env[`${p}NAMESPACE`],owner:process.env[`${p}OWNER`],worker:process.env[`${p}WORKER`],organization:process.env[`${p}ORGANIZATION`],packageManager:process.env[`${p}PACKAGE_MANAGER`],license:process.env[`${p}LICENSE`],homepage:process.env[`${p}HOMEPAGE`],timezone:process.env[`${p}TIMEZONE`]??process.env.TZ,locale:process.env[`${p}LOCALE`]??process.env.LOCALE,configFile:process.env[`${p}CONFIG_FILE`],workspaceRoot:process.env[`${p}WORKSPACE_ROOT`],packageDirectory:process.env[`${p}PACKAGE_DIRECTORY`],buildDirectory:process.env[`${p}BUILD_DIRECTORY`],runtimeVersion:process.env[`${p}RUNTIME_VERSION`],runtimeDirectory:process.env[`${p}RUNTIME_DIRECTORY`],env:process.env[`${p}ENV`]??process.env.NODE_ENV??process.env.ENVIRONMENT,ci:!!(process.env[`${p}CI`]??process.env.CI??process.env.CONTINUOUS_INTEGRATION),colors:{primary:process.env[`${p}COLOR_PRIMARY`],background:process.env[`${p}COLOR_BACKGROUND`],success:process.env[`${p}COLOR_SUCCESS`],info:process.env[`${p}COLOR_INFO`],warning:process.env[`${p}COLOR_WARNING`],error:process.env[`${p}COLOR_ERROR`],fatal:process.env[`${p}COLOR_FATAL`]},repository:process.env[`${p}REPOSITORY`],branch:process.env[`${p}BRANCH`],preMajor:!!process.env[`${p}PRE_MAJOR`],logLevel:process.env[`${p}LOG_LEVEL`]!==null&&process.env[`${p}LOG_LEVEL`]!==void 0?Number.isSafeInteger(Number.parseInt(process.env[`${p}LOG_LEVEL`]))?DLe(Number.parseInt(process.env[`${p}LOG_LEVEL`])):process.env[`${p}LOG_LEVEL`]:av.INFO,extensions:{}},T=process.env[`${p}CONFIG`];if(T){let O=JSON.parse(T);h={...h,...O,colors:{...h.colors,...O.colors},extensions:{...h.extensions,...O.extensions}}}let A=`${p}EXTENSION_`;return Object.keys(process.env).filter(O=>O.startsWith(A)).reduce((O,$)=>{let ae=$.substring(p.length,$.indexOf("_",p.length)).split("_").map(we=>we.length>0?we.trim().charAt(0).toUpperCase()+we.trim().slice(1):"").join("");return ae&&(O.extensions[ae]=_bt(ae)),O},h)};var fbt=(p,h)=>{for(let T of Object.keys(h??{}))if(h[T]){let A=T?.replace(/([A-Z])+/g,$=>$?$[0].toUpperCase()+$.slice(1):"").split(/(?=[A-Z])|[\.\-\s_]/).map($=>$.toLowerCase())??[],O;if(A.length===0)return;A.length===1?O=A[0].toUpperCase():O=A.reduce(($,ae)=>`${$}_${ae.toLowerCase()}`),process.env[`STORM_EXTENSION_${p.toUpperCase()}_${O.toUpperCase()}`]=h[T]}},uMe=p=>{let h="STORM_";p.name&&(process.env[`${h}NAME`]=p.name),p.namespace&&(process.env[`${h}NAMESPACE`]=p.namespace),p.owner&&(process.env[`${h}OWNER`]=p.owner),p.worker&&(process.env[`${h}WORKER`]=p.worker),p.organization&&(process.env[`${h}ORGANIZATION`]=p.organization),p.packageManager&&(process.env[`${h}PACKAGE_MANAGER`]=p.packageManager),p.license&&(process.env[`${h}LICENSE`]=p.license),p.homepage&&(process.env[`${h}HOMEPAGE`]=p.homepage),p.timezone&&(process.env[`${h}TIMEZONE`]=p.timezone,process.env.TZ=p.timezone,process.env.DEFAULT_TIMEZONE=p.timezone),p.locale&&(process.env[`${h}LOCALE`]=p.locale,process.env.LOCALE=p.locale,process.env.DEFAULT_LOCALE=p.locale,process.env.LANG=p.locale?`${p.locale.replaceAll("-","_")}.UTF-8`:"en_US.UTF-8"),p.configFile&&(process.env[`${h}CONFIG_FILE`]=p.configFile),p.workspaceRoot&&(process.env[`${h}WORKSPACE_ROOT`]=p.workspaceRoot,process.env.NX_WORKSPACE_ROOT=p.workspaceRoot,process.env.NX_WORKSPACE_ROOT_PATH=p.workspaceRoot),p.packageDirectory&&(process.env[`${h}PACKAGE_DIRECTORY`]=p.packageDirectory),p.buildDirectory&&(process.env[`${h}BUILD_DIRECTORY`]=p.buildDirectory),p.runtimeVersion&&(process.env[`${h}RUNTIME_VERSION`]=p.runtimeVersion),p.runtimeDirectory&&(process.env[`${h}RUNTIME_DIRECTORY`]=p.runtimeDirectory),p.env&&(process.env[`${h}ENV`]=p.env,process.env.NODE_ENV=p.env,process.env.ENVIRONMENT=p.env),p.ci&&(process.env[`${h}CI`]=String(p.ci),process.env.CI=String(p.ci),process.env.CONTINUOUS_INTEGRATION=String(p.ci)),p.colors.primary&&(process.env[`${h}COLOR_PRIMARY`]=p.colors.primary),p.colors.background&&(process.env[`${h}COLOR_BACKGROUND`]=p.colors.background),p.colors.success&&(process.env[`${h}COLOR_SUCCESS`]=p.colors.success),p.colors.info&&(process.env[`${h}COLOR_INFO`]=p.colors.info),p.colors.warning&&(process.env[`${h}COLOR_WARNING`]=p.colors.warning),p.colors.error&&(process.env[`${h}COLOR_ERROR`]=p.colors.error),p.colors.fatal&&(process.env[`${h}COLOR_FATAL`]=p.colors.fatal),p.repository&&(process.env[`${h}REPOSITORY`]=p.repository),p.branch&&(process.env[`${h}BRANCH`]=p.branch),p.preMajor&&(process.env[`${h}PRE_MAJOR`]=String(p.preMajor)),p.logLevel&&(process.env[`${h}LOG_LEVEL`]=String(p.logLevel),process.env.LOG_LEVEL=String(p.logLevel),process.env.NX_VERBOSE_LOGGING=String(kq(p.logLevel)>=sp.DEBUG),process.env.RUST_BACKTRACE=kq(p.logLevel)>=sp.DEBUG?"full":"none"),process.env[`${h}CONFIG`]=JSON.stringify(p);for(let T of Object.keys(p.extensions??{}))p.extensions[T]&&Object.keys(p.extensions[T])&&fbt(T,p.extensions[T])};var PSt=async()=>{let p=ALe({...await dLe(),...lMe()});return uMe(p),p};export{PSt as prepareWorkspace};
412
+ Path: ${p||process.cwd()}`);return h}import{existsSync as j2t,readFileSync as J2t}from"node:fs";import{join as wLe}from"node:path";var Tu;(function(p){p.assertEqual=O=>O;function h(O){}p.assertIs=h;function T(O){throw new Error}p.assertNever=T,p.arrayToEnum=O=>{let $={};for(let ae of O)$[ae]=ae;return $},p.getValidEnumValues=O=>{let $=p.objectKeys(O).filter(we=>typeof O[O[we]]!="number"),ae={};for(let we of $)ae[we]=O[we];return p.objectValues(ae)},p.objectValues=O=>p.objectKeys(O).map(function($){return O[$]}),p.objectKeys=typeof Object.keys=="function"?O=>Object.keys(O):O=>{let $=[];for(let ae in O)Object.prototype.hasOwnProperty.call(O,ae)&&$.push(ae);return $},p.find=(O,$)=>{for(let ae of O)if($(ae))return ae},p.isInteger=typeof Number.isInteger=="function"?O=>Number.isInteger(O):O=>typeof O=="number"&&isFinite(O)&&Math.floor(O)===O;function A(O,$=" | "){return O.map(ae=>typeof ae=="string"?`'${ae}'`:ae).join($)}p.joinValues=A,p.jsonStringifyReplacer=(O,$)=>typeof $=="bigint"?$.toString():$})(Tu||(Tu={}));var yLe;(function(p){p.mergeShapes=(h,T)=>({...h,...T})})(yLe||(yLe={}));var da=Tu.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),o8=p=>{switch(typeof p){case"undefined":return da.undefined;case"string":return da.string;case"number":return isNaN(p)?da.nan:da.number;case"boolean":return da.boolean;case"function":return da.function;case"bigint":return da.bigint;case"symbol":return da.symbol;case"object":return Array.isArray(p)?da.array:p===null?da.null:p.then&&typeof p.then=="function"&&p.catch&&typeof p.catch=="function"?da.promise:typeof Map<"u"&&p instanceof Map?da.map:typeof Set<"u"&&p instanceof Set?da.set:typeof Date<"u"&&p instanceof Date?da.date:da.object;default:return da.unknown}},fs=Tu.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"]);var ov=class extends Error{constructor(h){super(),this.issues=[],this.addIssue=A=>{this.issues=[...this.issues,A]},this.addIssues=(A=[])=>{this.issues=[...this.issues,...A]};let T=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,T):this.__proto__=T,this.name="ZodError",this.issues=h}get errors(){return this.issues}format(h){let T=h||function($){return $.message},A={_errors:[]},O=$=>{for(let ae of $.issues)if(ae.code==="invalid_union")ae.unionErrors.map(O);else if(ae.code==="invalid_return_type")O(ae.returnTypeError);else if(ae.code==="invalid_arguments")O(ae.argumentsError);else if(ae.path.length===0)A._errors.push(T(ae));else{let we=A,Ge=0;for(;Ge<ae.path.length;){let Oe=ae.path[Ge];Ge===ae.path.length-1?(we[Oe]=we[Oe]||{_errors:[]},we[Oe]._errors.push(T(ae))):we[Oe]=we[Oe]||{_errors:[]},we=we[Oe],Ge++}}};return O(this),A}toString(){return this.message}get message(){return JSON.stringify(this.issues,Tu.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(h=T=>T.message){let T={},A=[];for(let O of this.issues)O.path.length>0?(T[O.path[0]]=T[O.path[0]]||[],T[O.path[0]].push(h(O))):A.push(h(O));return{formErrors:A,fieldErrors:T}}get formErrors(){return this.flatten()}};ov.create=p=>new ov(p);var bq=(p,h)=>{let T;switch(p.code){case fs.invalid_type:p.received===da.undefined?T="Required":T=`Expected ${p.expected}, received ${p.received}`;break;case fs.invalid_literal:T=`Invalid literal value, expected ${JSON.stringify(p.expected,Tu.jsonStringifyReplacer)}`;break;case fs.unrecognized_keys:T=`Unrecognized key(s) in object: ${Tu.joinValues(p.keys,", ")}`;break;case fs.invalid_union:T="Invalid input";break;case fs.invalid_union_discriminator:T=`Invalid discriminator value. Expected ${Tu.joinValues(p.options)}`;break;case fs.invalid_enum_value:T=`Invalid enum value. Expected ${Tu.joinValues(p.options)}, received '${p.received}'`;break;case fs.invalid_arguments:T="Invalid function arguments";break;case fs.invalid_return_type:T="Invalid function return type";break;case fs.invalid_date:T="Invalid date";break;case fs.invalid_string:typeof p.validation=="object"?"includes"in p.validation?(T=`Invalid input: must include "${p.validation.includes}"`,typeof p.validation.position=="number"&&(T=`${T} at one or more positions greater than or equal to ${p.validation.position}`)):"startsWith"in p.validation?T=`Invalid input: must start with "${p.validation.startsWith}"`:"endsWith"in p.validation?T=`Invalid input: must end with "${p.validation.endsWith}"`:Tu.assertNever(p.validation):p.validation!=="regex"?T=`Invalid ${p.validation}`:T="Invalid";break;case fs.too_small:p.type==="array"?T=`Array must contain ${p.exact?"exactly":p.inclusive?"at least":"more than"} ${p.minimum} element(s)`:p.type==="string"?T=`String must contain ${p.exact?"exactly":p.inclusive?"at least":"over"} ${p.minimum} character(s)`:p.type==="number"?T=`Number must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${p.minimum}`:p.type==="date"?T=`Date must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(p.minimum))}`:T="Invalid input";break;case fs.too_big:p.type==="array"?T=`Array must contain ${p.exact?"exactly":p.inclusive?"at most":"less than"} ${p.maximum} element(s)`:p.type==="string"?T=`String must contain ${p.exact?"exactly":p.inclusive?"at most":"under"} ${p.maximum} character(s)`:p.type==="number"?T=`Number must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="bigint"?T=`BigInt must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="date"?T=`Date must be ${p.exact?"exactly":p.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(p.maximum))}`:T="Invalid input";break;case fs.custom:T="Invalid input";break;case fs.invalid_intersection_types:T="Intersection results could not be merged";break;case fs.not_multiple_of:T=`Number must be a multiple of ${p.multipleOf}`;break;case fs.not_finite:T="Number must be finite";break;default:T=h.defaultError,Tu.assertNever(p)}return{message:T}},k2t=bq;function ufe(){return k2t}var _fe=p=>{let{data:h,path:T,errorMaps:A,issueData:O}=p,$=[...T,...O.path||[]],ae={...O,path:$},we="",Ge=A.filter(Oe=>!!Oe).slice().reverse();for(let Oe of Ge)we=Oe(ae,{data:h,defaultError:we}).message;return{...O,path:$,message:O.message||we}};function Sa(p,h){let T=_fe({issueData:h,data:p.data,path:p.path,errorMaps:[p.common.contextualErrorMap,p.schemaErrorMap,ufe(),bq].filter(A=>!!A)});p.common.issues.push(T)}var O0=class p{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(h,T){let A=[];for(let O of T){if(O.status==="aborted")return Nc;O.status==="dirty"&&h.dirty(),A.push(O.value)}return{status:h.value,value:A}}static async mergeObjectAsync(h,T){let A=[];for(let O of T)A.push({key:await O.key,value:await O.value});return p.mergeObjectSync(h,A)}static mergeObjectSync(h,T){let A={};for(let O of T){let{key:$,value:ae}=O;if($.status==="aborted"||ae.status==="aborted")return Nc;$.status==="dirty"&&h.dirty(),ae.status==="dirty"&&h.dirty(),$.value!=="__proto__"&&(typeof ae.value<"u"||O.alwaysSet)&&(A[$.value]=ae.value)}return{status:h.value,value:A}}},Nc=Object.freeze({status:"aborted"}),C2t=p=>({status:"dirty",value:p}),Ph=p=>({status:"valid",value:p}),vLe=p=>p.status==="aborted",bLe=p=>p.status==="dirty",xq=p=>p.status==="valid",ffe=p=>typeof Promise<"u"&&p instanceof Promise,yo;(function(p){p.errToObj=h=>typeof h=="string"?{message:h}:h||{},p.toString=h=>typeof h=="string"?h:h?.message})(yo||(yo={}));var cv=class{constructor(h,T,A,O){this._cachedPath=[],this.parent=h,this.data=T,this._path=A,this._key=O}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xLe=(p,h)=>{if(xq(h))return{success:!0,data:h.value};if(!p.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 ov(p.common.issues);return this._error=T,this._error}}};function Dc(p){if(!p)return{};let{errorMap:h,invalid_type_error:T,required_error:A,description:O}=p;if(h&&(T||A))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return h?{errorMap:h,description:O}:{errorMap:(ae,we)=>ae.code!=="invalid_type"?{message:we.defaultError}:typeof we.data>"u"?{message:A??we.defaultError}:{message:T??we.defaultError},description:O}}var cl=class{constructor(h){this.spa=this.safeParseAsync,this._def=h,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)}get description(){return this._def.description}_getType(h){return o8(h.data)}_getOrReturnCtx(h,T){return T||{common:h.parent.common,data:h.data,parsedType:o8(h.data),schemaErrorMap:this._def.errorMap,path:h.path,parent:h.parent}}_processInputParams(h){return{status:new O0,ctx:{common:h.parent.common,data:h.data,parsedType:o8(h.data),schemaErrorMap:this._def.errorMap,path:h.path,parent:h.parent}}}_parseSync(h){let T=this._parse(h);if(ffe(T))throw new Error("Synchronous parse encountered promise.");return T}_parseAsync(h){let T=this._parse(h);return Promise.resolve(T)}parse(h,T){let A=this.safeParse(h,T);if(A.success)return A.data;throw A.error}safeParse(h,T){var A;let O={common:{issues:[],async:(A=T?.async)!==null&&A!==void 0?A:!1,contextualErrorMap:T?.errorMap},path:T?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:h,parsedType:o8(h)},$=this._parseSync({data:h,path:O.path,parent:O});return xLe(O,$)}async parseAsync(h,T){let A=await this.safeParseAsync(h,T);if(A.success)return A.data;throw A.error}async safeParseAsync(h,T){let A={common:{issues:[],contextualErrorMap:T?.errorMap,async:!0},path:T?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:h,parsedType:o8(h)},O=this._parse({data:h,path:A.path,parent:A}),$=await(ffe(O)?O:Promise.resolve(O));return xLe(A,$)}refine(h,T){let A=O=>typeof T=="string"||typeof T>"u"?{message:T}:typeof T=="function"?T(O):T;return this._refinement((O,$)=>{let ae=h(O),we=()=>$.addIssue({code:fs.custom,...A(O)});return typeof Promise<"u"&&ae instanceof Promise?ae.then(Ge=>Ge?!0:(we(),!1)):ae?!0:(we(),!1)})}refinement(h,T){return this._refinement((A,O)=>h(A)?!0:(O.addIssue(typeof T=="function"?T(A,O):T),!1))}_refinement(h){return new U2({schema:this,typeName:qo.ZodEffects,effect:{type:"refinement",refinement:h}})}superRefine(h){return this._refinement(h)}optional(){return Ox.create(this,this._def)}nullable(){return _4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return u4.create(this,this._def)}promise(){return c8.create(this,this._def)}or(h){return MA.create([this,h],this._def)}and(h){return FA.create(this,h,this._def)}transform(h){return new U2({...Dc(this._def),schema:this,typeName:qo.ZodEffects,effect:{type:"transform",transform:h}})}default(h){let T=typeof h=="function"?h:()=>h;return new zA({...Dc(this._def),innerType:this,defaultValue:T,typeName:qo.ZodDefault})}brand(){return new hfe({typeName:qo.ZodBranded,type:this,...Dc(this._def)})}catch(h){let T=typeof h=="function"?h:()=>h;return new eL({...Dc(this._def),innerType:this,catchValue:T,typeName:qo.ZodCatch})}describe(h){let T=this.constructor;return new T({...this._def,description:h})}pipe(h){return Tq.create(this,h)}readonly(){return rL.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w2t=/^c[^\s-]{8,}$/i,E2t=/^[a-z][a-z0-9]*$/,A2t=/^[0-9A-HJKMNP-TV-Z]{26}$/,D2t=/^[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,N2t=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,I2t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lfe,P2t=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,O2t=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,L2t=p=>p.precision?p.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${p.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${p.precision}}Z$`):p.precision===0?p.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):p.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function M2t(p,h){return!!((h==="v4"||!h)&&P2t.test(p)||(h==="v6"||!h)&&O2t.test(p))}var PA=class p extends cl{_parse(h){if(this._def.coerce&&(h.data=String(h.data)),this._getType(h)!==da.string){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.string,received:$.parsedType}),Nc}let A=new O0,O;for(let $ of this._def.checks)if($.kind==="min")h.data.length<$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),A.dirty());else if($.kind==="max")h.data.length>$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),A.dirty());else if($.kind==="length"){let ae=h.data.length>$.value,we=h.data.length<$.value;(ae||we)&&(O=this._getOrReturnCtx(h,O),ae?Sa(O,{code:fs.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message}):we&&Sa(O,{code:fs.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message}),A.dirty())}else if($.kind==="email")N2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"email",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="emoji")lfe||(lfe=new RegExp(I2t,"u")),lfe.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"emoji",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="uuid")D2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"uuid",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="cuid")w2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"cuid",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="cuid2")E2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"cuid2",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="ulid")A2t.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"ulid",code:fs.invalid_string,message:$.message}),A.dirty());else if($.kind==="url")try{new URL(h.data)}catch{O=this._getOrReturnCtx(h,O),Sa(O,{validation:"url",code:fs.invalid_string,message:$.message}),A.dirty()}else $.kind==="regex"?($.regex.lastIndex=0,$.regex.test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"regex",code:fs.invalid_string,message:$.message}),A.dirty())):$.kind==="trim"?h.data=h.data.trim():$.kind==="includes"?h.data.includes($.value,$.position)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),A.dirty()):$.kind==="toLowerCase"?h.data=h.data.toLowerCase():$.kind==="toUpperCase"?h.data=h.data.toUpperCase():$.kind==="startsWith"?h.data.startsWith($.value)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:{startsWith:$.value},message:$.message}),A.dirty()):$.kind==="endsWith"?h.data.endsWith($.value)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:{endsWith:$.value},message:$.message}),A.dirty()):$.kind==="datetime"?L2t($).test(h.data)||(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.invalid_string,validation:"datetime",message:$.message}),A.dirty()):$.kind==="ip"?M2t(h.data,$.version)||(O=this._getOrReturnCtx(h,O),Sa(O,{validation:"ip",code:fs.invalid_string,message:$.message}),A.dirty()):Tu.assertNever($);return{status:A.value,value:h.data}}_regex(h,T,A){return this.refinement(O=>h.test(O),{validation:T,code:fs.invalid_string,...yo.errToObj(A)})}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}email(h){return this._addCheck({kind:"email",...yo.errToObj(h)})}url(h){return this._addCheck({kind:"url",...yo.errToObj(h)})}emoji(h){return this._addCheck({kind:"emoji",...yo.errToObj(h)})}uuid(h){return this._addCheck({kind:"uuid",...yo.errToObj(h)})}cuid(h){return this._addCheck({kind:"cuid",...yo.errToObj(h)})}cuid2(h){return this._addCheck({kind:"cuid2",...yo.errToObj(h)})}ulid(h){return this._addCheck({kind:"ulid",...yo.errToObj(h)})}ip(h){return this._addCheck({kind:"ip",...yo.errToObj(h)})}datetime(h){var T;return typeof h=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:h}):this._addCheck({kind:"datetime",precision:typeof h?.precision>"u"?null:h?.precision,offset:(T=h?.offset)!==null&&T!==void 0?T:!1,...yo.errToObj(h?.message)})}regex(h,T){return this._addCheck({kind:"regex",regex:h,...yo.errToObj(T)})}includes(h,T){return this._addCheck({kind:"includes",value:h,position:T?.position,...yo.errToObj(T?.message)})}startsWith(h,T){return this._addCheck({kind:"startsWith",value:h,...yo.errToObj(T)})}endsWith(h,T){return this._addCheck({kind:"endsWith",value:h,...yo.errToObj(T)})}min(h,T){return this._addCheck({kind:"min",value:h,...yo.errToObj(T)})}max(h,T){return this._addCheck({kind:"max",value:h,...yo.errToObj(T)})}length(h,T){return this._addCheck({kind:"length",value:h,...yo.errToObj(T)})}nonempty(h){return this.min(1,yo.errToObj(h))}trim(){return new p({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new p({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new p({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(h=>h.kind==="datetime")}get isEmail(){return!!this._def.checks.find(h=>h.kind==="email")}get isURL(){return!!this._def.checks.find(h=>h.kind==="url")}get isEmoji(){return!!this._def.checks.find(h=>h.kind==="emoji")}get isUUID(){return!!this._def.checks.find(h=>h.kind==="uuid")}get isCUID(){return!!this._def.checks.find(h=>h.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(h=>h.kind==="cuid2")}get isULID(){return!!this._def.checks.find(h=>h.kind==="ulid")}get isIP(){return!!this._def.checks.find(h=>h.kind==="ip")}get minLength(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h}get maxLength(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h}};PA.create=p=>{var h;return new PA({checks:[],typeName:qo.ZodString,coerce:(h=p?.coerce)!==null&&h!==void 0?h:!1,...Dc(p)})};function F2t(p,h){let T=(p.toString().split(".")[1]||"").length,A=(h.toString().split(".")[1]||"").length,O=T>A?T:A,$=parseInt(p.toFixed(O).replace(".","")),ae=parseInt(h.toFixed(O).replace(".",""));return $%ae/Math.pow(10,O)}var qO=class p extends cl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(h){if(this._def.coerce&&(h.data=Number(h.data)),this._getType(h)!==da.number){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.number,received:$.parsedType}),Nc}let A,O=new O0;for(let $ of this._def.checks)$.kind==="int"?Tu.isInteger(h.data)||(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.invalid_type,expected:"integer",received:"float",message:$.message}),O.dirty()):$.kind==="min"?($.inclusive?h.data<$.value:h.data<=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),O.dirty()):$.kind==="max"?($.inclusive?h.data>$.value:h.data>=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),O.dirty()):$.kind==="multipleOf"?F2t(h.data,$.value)!==0&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.not_multiple_of,multipleOf:$.value,message:$.message}),O.dirty()):$.kind==="finite"?Number.isFinite(h.data)||(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.not_finite,message:$.message}),O.dirty()):Tu.assertNever($);return{status:O.value,value:h.data}}gte(h,T){return this.setLimit("min",h,!0,yo.toString(T))}gt(h,T){return this.setLimit("min",h,!1,yo.toString(T))}lte(h,T){return this.setLimit("max",h,!0,yo.toString(T))}lt(h,T){return this.setLimit("max",h,!1,yo.toString(T))}setLimit(h,T,A,O){return new p({...this._def,checks:[...this._def.checks,{kind:h,value:T,inclusive:A,message:yo.toString(O)}]})}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}int(h){return this._addCheck({kind:"int",message:yo.toString(h)})}positive(h){return this._addCheck({kind:"min",value:0,inclusive:!1,message:yo.toString(h)})}negative(h){return this._addCheck({kind:"max",value:0,inclusive:!1,message:yo.toString(h)})}nonpositive(h){return this._addCheck({kind:"max",value:0,inclusive:!0,message:yo.toString(h)})}nonnegative(h){return this._addCheck({kind:"min",value:0,inclusive:!0,message:yo.toString(h)})}multipleOf(h,T){return this._addCheck({kind:"multipleOf",value:h,message:yo.toString(T)})}finite(h){return this._addCheck({kind:"finite",message:yo.toString(h)})}safe(h){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:yo.toString(h)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:yo.toString(h)})}get minValue(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h}get maxValue(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h}get isInt(){return!!this._def.checks.find(h=>h.kind==="int"||h.kind==="multipleOf"&&Tu.isInteger(h.value))}get isFinite(){let h=null,T=null;for(let A of this._def.checks){if(A.kind==="finite"||A.kind==="int"||A.kind==="multipleOf")return!0;A.kind==="min"?(T===null||A.value>T)&&(T=A.value):A.kind==="max"&&(h===null||A.value<h)&&(h=A.value)}return Number.isFinite(T)&&Number.isFinite(h)}};qO.create=p=>new qO({checks:[],typeName:qo.ZodNumber,coerce:p?.coerce||!1,...Dc(p)});var $O=class p extends cl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(h){if(this._def.coerce&&(h.data=BigInt(h.data)),this._getType(h)!==da.bigint){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.bigint,received:$.parsedType}),Nc}let A,O=new O0;for(let $ of this._def.checks)$.kind==="min"?($.inclusive?h.data<$.value:h.data<=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),O.dirty()):$.kind==="max"?($.inclusive?h.data>$.value:h.data>=$.value)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),O.dirty()):$.kind==="multipleOf"?h.data%$.value!==BigInt(0)&&(A=this._getOrReturnCtx(h,A),Sa(A,{code:fs.not_multiple_of,multipleOf:$.value,message:$.message}),O.dirty()):Tu.assertNever($);return{status:O.value,value:h.data}}gte(h,T){return this.setLimit("min",h,!0,yo.toString(T))}gt(h,T){return this.setLimit("min",h,!1,yo.toString(T))}lte(h,T){return this.setLimit("max",h,!0,yo.toString(T))}lt(h,T){return this.setLimit("max",h,!1,yo.toString(T))}setLimit(h,T,A,O){return new p({...this._def,checks:[...this._def.checks,{kind:h,value:T,inclusive:A,message:yo.toString(O)}]})}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}positive(h){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:yo.toString(h)})}negative(h){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:yo.toString(h)})}nonpositive(h){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:yo.toString(h)})}nonnegative(h){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:yo.toString(h)})}multipleOf(h,T){return this._addCheck({kind:"multipleOf",value:h,message:yo.toString(T)})}get minValue(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h}get maxValue(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h}};$O.create=p=>{var h;return new $O({checks:[],typeName:qo.ZodBigInt,coerce:(h=p?.coerce)!==null&&h!==void 0?h:!1,...Dc(p)})};var GO=class extends cl{_parse(h){if(this._def.coerce&&(h.data=!!h.data),this._getType(h)!==da.boolean){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.boolean,received:A.parsedType}),Nc}return Ph(h.data)}};GO.create=p=>new GO({typeName:qo.ZodBoolean,coerce:p?.coerce||!1,...Dc(p)});var HO=class p extends cl{_parse(h){if(this._def.coerce&&(h.data=new Date(h.data)),this._getType(h)!==da.date){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_type,expected:da.date,received:$.parsedType}),Nc}if(isNaN(h.data.getTime())){let $=this._getOrReturnCtx(h);return Sa($,{code:fs.invalid_date}),Nc}let A=new O0,O;for(let $ of this._def.checks)$.kind==="min"?h.data.getTime()<$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),A.dirty()):$.kind==="max"?h.data.getTime()>$.value&&(O=this._getOrReturnCtx(h,O),Sa(O,{code:fs.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),A.dirty()):Tu.assertNever($);return{status:A.value,value:new Date(h.data.getTime())}}_addCheck(h){return new p({...this._def,checks:[...this._def.checks,h]})}min(h,T){return this._addCheck({kind:"min",value:h.getTime(),message:yo.toString(T)})}max(h,T){return this._addCheck({kind:"max",value:h.getTime(),message:yo.toString(T)})}get minDate(){let h=null;for(let T of this._def.checks)T.kind==="min"&&(h===null||T.value>h)&&(h=T.value);return h!=null?new Date(h):null}get maxDate(){let h=null;for(let T of this._def.checks)T.kind==="max"&&(h===null||T.value<h)&&(h=T.value);return h!=null?new Date(h):null}};HO.create=p=>new HO({checks:[],coerce:p?.coerce||!1,typeName:qo.ZodDate,...Dc(p)});var XO=class extends cl{_parse(h){if(this._getType(h)!==da.symbol){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.symbol,received:A.parsedType}),Nc}return Ph(h.data)}};XO.create=p=>new XO({typeName:qo.ZodSymbol,...Dc(p)});var OA=class extends cl{_parse(h){if(this._getType(h)!==da.undefined){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.undefined,received:A.parsedType}),Nc}return Ph(h.data)}};OA.create=p=>new OA({typeName:qo.ZodUndefined,...Dc(p)});var LA=class extends cl{_parse(h){if(this._getType(h)!==da.null){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.null,received:A.parsedType}),Nc}return Ph(h.data)}};LA.create=p=>new LA({typeName:qo.ZodNull,...Dc(p)});var QO=class extends cl{constructor(){super(...arguments),this._any=!0}_parse(h){return Ph(h.data)}};QO.create=p=>new QO({typeName:qo.ZodAny,...Dc(p)});var l4=class extends cl{constructor(){super(...arguments),this._unknown=!0}_parse(h){return Ph(h.data)}};l4.create=p=>new l4({typeName:qo.ZodUnknown,...Dc(p)});var Lx=class extends cl{_parse(h){let T=this._getOrReturnCtx(h);return Sa(T,{code:fs.invalid_type,expected:da.never,received:T.parsedType}),Nc}};Lx.create=p=>new Lx({typeName:qo.ZodNever,...Dc(p)});var YO=class extends cl{_parse(h){if(this._getType(h)!==da.undefined){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.void,received:A.parsedType}),Nc}return Ph(h.data)}};YO.create=p=>new YO({typeName:qo.ZodVoid,...Dc(p)});var u4=class p extends cl{_parse(h){let{ctx:T,status:A}=this._processInputParams(h),O=this._def;if(T.parsedType!==da.array)return Sa(T,{code:fs.invalid_type,expected:da.array,received:T.parsedType}),Nc;if(O.exactLength!==null){let ae=T.data.length>O.exactLength.value,we=T.data.length<O.exactLength.value;(ae||we)&&(Sa(T,{code:ae?fs.too_big:fs.too_small,minimum:we?O.exactLength.value:void 0,maximum:ae?O.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:O.exactLength.message}),A.dirty())}if(O.minLength!==null&&T.data.length<O.minLength.value&&(Sa(T,{code:fs.too_small,minimum:O.minLength.value,type:"array",inclusive:!0,exact:!1,message:O.minLength.message}),A.dirty()),O.maxLength!==null&&T.data.length>O.maxLength.value&&(Sa(T,{code:fs.too_big,maximum:O.maxLength.value,type:"array",inclusive:!0,exact:!1,message:O.maxLength.message}),A.dirty()),T.common.async)return Promise.all([...T.data].map((ae,we)=>O.type._parseAsync(new cv(T,ae,T.path,we)))).then(ae=>O0.mergeArray(A,ae));let $=[...T.data].map((ae,we)=>O.type._parseSync(new cv(T,ae,T.path,we)));return O0.mergeArray(A,$)}get element(){return this._def.type}min(h,T){return new p({...this._def,minLength:{value:h,message:yo.toString(T)}})}max(h,T){return new p({...this._def,maxLength:{value:h,message:yo.toString(T)}})}length(h,T){return new p({...this._def,exactLength:{value:h,message:yo.toString(T)}})}nonempty(h){return this.min(1,h)}};u4.create=(p,h)=>new u4({type:p,minLength:null,maxLength:null,exactLength:null,typeName:qo.ZodArray,...Dc(h)});function IA(p){if(p instanceof V1){let h={};for(let T in p.shape){let A=p.shape[T];h[T]=Ox.create(IA(A))}return new V1({...p._def,shape:()=>h})}else return p instanceof u4?new u4({...p._def,type:IA(p.element)}):p instanceof Ox?Ox.create(IA(p.unwrap())):p instanceof _4?_4.create(IA(p.unwrap())):p instanceof NS?NS.create(p.items.map(h=>IA(h))):p}var V1=class p extends cl{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let h=this._def.shape(),T=Tu.objectKeys(h);return this._cached={shape:h,keys:T}}_parse(h){if(this._getType(h)!==da.object){let Oe=this._getOrReturnCtx(h);return Sa(Oe,{code:fs.invalid_type,expected:da.object,received:Oe.parsedType}),Nc}let{status:A,ctx:O}=this._processInputParams(h),{shape:$,keys:ae}=this._getCached(),we=[];if(!(this._def.catchall instanceof Lx&&this._def.unknownKeys==="strip"))for(let Oe in O.data)ae.includes(Oe)||we.push(Oe);let Ge=[];for(let Oe of ae){let Ze=$[Oe],Yr=O.data[Oe];Ge.push({key:{status:"valid",value:Oe},value:Ze._parse(new cv(O,Yr,O.path,Oe)),alwaysSet:Oe in O.data})}if(this._def.catchall instanceof Lx){let Oe=this._def.unknownKeys;if(Oe==="passthrough")for(let Ze of we)Ge.push({key:{status:"valid",value:Ze},value:{status:"valid",value:O.data[Ze]}});else if(Oe==="strict")we.length>0&&(Sa(O,{code:fs.unrecognized_keys,keys:we}),A.dirty());else if(Oe!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Oe=this._def.catchall;for(let Ze of we){let Yr=O.data[Ze];Ge.push({key:{status:"valid",value:Ze},value:Oe._parse(new cv(O,Yr,O.path,Ze)),alwaysSet:Ze in O.data})}}return O.common.async?Promise.resolve().then(async()=>{let Oe=[];for(let Ze of Ge){let Yr=await Ze.key;Oe.push({key:Yr,value:await Ze.value,alwaysSet:Ze.alwaysSet})}return Oe}).then(Oe=>O0.mergeObjectSync(A,Oe)):O0.mergeObjectSync(A,Ge)}get shape(){return this._def.shape()}strict(h){return yo.errToObj,new p({...this._def,unknownKeys:"strict",...h!==void 0?{errorMap:(T,A)=>{var O,$,ae,we;let Ge=(ae=($=(O=this._def).errorMap)===null||$===void 0?void 0:$.call(O,T,A).message)!==null&&ae!==void 0?ae:A.defaultError;return T.code==="unrecognized_keys"?{message:(we=yo.errToObj(h).message)!==null&&we!==void 0?we:Ge}:{message:Ge}}}:{}})}strip(){return new p({...this._def,unknownKeys:"strip"})}passthrough(){return new p({...this._def,unknownKeys:"passthrough"})}extend(h){return new p({...this._def,shape:()=>({...this._def.shape(),...h})})}merge(h){return new p({unknownKeys:h._def.unknownKeys,catchall:h._def.catchall,shape:()=>({...this._def.shape(),...h._def.shape()}),typeName:qo.ZodObject})}setKey(h,T){return this.augment({[h]:T})}catchall(h){return new p({...this._def,catchall:h})}pick(h){let T={};return Tu.objectKeys(h).forEach(A=>{h[A]&&this.shape[A]&&(T[A]=this.shape[A])}),new p({...this._def,shape:()=>T})}omit(h){let T={};return Tu.objectKeys(this.shape).forEach(A=>{h[A]||(T[A]=this.shape[A])}),new p({...this._def,shape:()=>T})}deepPartial(){return IA(this)}partial(h){let T={};return Tu.objectKeys(this.shape).forEach(A=>{let O=this.shape[A];h&&!h[A]?T[A]=O:T[A]=O.optional()}),new p({...this._def,shape:()=>T})}required(h){let T={};return Tu.objectKeys(this.shape).forEach(A=>{if(h&&!h[A])T[A]=this.shape[A];else{let $=this.shape[A];for(;$ instanceof Ox;)$=$._def.innerType;T[A]=$}}),new p({...this._def,shape:()=>T})}keyof(){return TLe(Tu.objectKeys(this.shape))}};V1.create=(p,h)=>new V1({shape:()=>p,unknownKeys:"strip",catchall:Lx.create(),typeName:qo.ZodObject,...Dc(h)});V1.strictCreate=(p,h)=>new V1({shape:()=>p,unknownKeys:"strict",catchall:Lx.create(),typeName:qo.ZodObject,...Dc(h)});V1.lazycreate=(p,h)=>new V1({shape:p,unknownKeys:"strip",catchall:Lx.create(),typeName:qo.ZodObject,...Dc(h)});var MA=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A=this._def.options;function O($){for(let we of $)if(we.result.status==="valid")return we.result;for(let we of $)if(we.result.status==="dirty")return T.common.issues.push(...we.ctx.common.issues),we.result;let ae=$.map(we=>new ov(we.ctx.common.issues));return Sa(T,{code:fs.invalid_union,unionErrors:ae}),Nc}if(T.common.async)return Promise.all(A.map(async $=>{let ae={...T,common:{...T.common,issues:[]},parent:null};return{result:await $._parseAsync({data:T.data,path:T.path,parent:ae}),ctx:ae}})).then(O);{let $,ae=[];for(let Ge of A){let Oe={...T,common:{...T.common,issues:[]},parent:null},Ze=Ge._parseSync({data:T.data,path:T.path,parent:Oe});if(Ze.status==="valid")return Ze;Ze.status==="dirty"&&!$&&($={result:Ze,ctx:Oe}),Oe.common.issues.length&&ae.push(Oe.common.issues)}if($)return T.common.issues.push(...$.ctx.common.issues),$.result;let we=ae.map(Ge=>new ov(Ge));return Sa(T,{code:fs.invalid_union,unionErrors:we}),Nc}}get options(){return this._def.options}};MA.create=(p,h)=>new MA({options:p,typeName:qo.ZodUnion,...Dc(h)});var vq=p=>p instanceof RA?vq(p.schema):p instanceof U2?vq(p.innerType()):p instanceof BA?[p.value]:p instanceof jA?p.options:p instanceof JA?Object.keys(p.enum):p instanceof zA?vq(p._def.innerType):p instanceof OA?[void 0]:p instanceof LA?[null]:null,pfe=class p extends cl{_parse(h){let{ctx:T}=this._processInputParams(h);if(T.parsedType!==da.object)return Sa(T,{code:fs.invalid_type,expected:da.object,received:T.parsedType}),Nc;let A=this.discriminator,O=T.data[A],$=this.optionsMap.get(O);return $?T.common.async?$._parseAsync({data:T.data,path:T.path,parent:T}):$._parseSync({data:T.data,path:T.path,parent:T}):(Sa(T,{code:fs.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[A]}),Nc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(h,T,A){let O=new Map;for(let $ of T){let ae=vq($.shape[h]);if(!ae)throw new Error(`A discriminator value for key \`${h}\` could not be extracted from all schema options`);for(let we of ae){if(O.has(we))throw new Error(`Discriminator property ${String(h)} has duplicate value ${String(we)}`);O.set(we,$)}}return new p({typeName:qo.ZodDiscriminatedUnion,discriminator:h,options:T,optionsMap:O,...Dc(A)})}};function dfe(p,h){let T=o8(p),A=o8(h);if(p===h)return{valid:!0,data:p};if(T===da.object&&A===da.object){let O=Tu.objectKeys(h),$=Tu.objectKeys(p).filter(we=>O.indexOf(we)!==-1),ae={...p,...h};for(let we of $){let Ge=dfe(p[we],h[we]);if(!Ge.valid)return{valid:!1};ae[we]=Ge.data}return{valid:!0,data:ae}}else if(T===da.array&&A===da.array){if(p.length!==h.length)return{valid:!1};let O=[];for(let $=0;$<p.length;$++){let ae=p[$],we=h[$],Ge=dfe(ae,we);if(!Ge.valid)return{valid:!1};O.push(Ge.data)}return{valid:!0,data:O}}else return T===da.date&&A===da.date&&+p==+h?{valid:!0,data:p}:{valid:!1}}var FA=class extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h),O=($,ae)=>{if(vLe($)||vLe(ae))return Nc;let we=dfe($.value,ae.value);return we.valid?((bLe($)||bLe(ae))&&T.dirty(),{status:T.value,value:we.data}):(Sa(A,{code:fs.invalid_intersection_types}),Nc)};return A.common.async?Promise.all([this._def.left._parseAsync({data:A.data,path:A.path,parent:A}),this._def.right._parseAsync({data:A.data,path:A.path,parent:A})]).then(([$,ae])=>O($,ae)):O(this._def.left._parseSync({data:A.data,path:A.path,parent:A}),this._def.right._parseSync({data:A.data,path:A.path,parent:A}))}};FA.create=(p,h,T)=>new FA({left:p,right:h,typeName:qo.ZodIntersection,...Dc(T)});var NS=class p extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.array)return Sa(A,{code:fs.invalid_type,expected:da.array,received:A.parsedType}),Nc;if(A.data.length<this._def.items.length)return Sa(A,{code:fs.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Nc;!this._def.rest&&A.data.length>this._def.items.length&&(Sa(A,{code:fs.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T.dirty());let $=[...A.data].map((ae,we)=>{let Ge=this._def.items[we]||this._def.rest;return Ge?Ge._parse(new cv(A,ae,A.path,we)):null}).filter(ae=>!!ae);return A.common.async?Promise.all($).then(ae=>O0.mergeArray(T,ae)):O0.mergeArray(T,$)}get items(){return this._def.items}rest(h){return new p({...this._def,rest:h})}};NS.create=(p,h)=>{if(!Array.isArray(p))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new NS({items:p,typeName:qo.ZodTuple,rest:null,...Dc(h)})};var mfe=class p extends cl{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.object)return Sa(A,{code:fs.invalid_type,expected:da.object,received:A.parsedType}),Nc;let O=[],$=this._def.keyType,ae=this._def.valueType;for(let we in A.data)O.push({key:$._parse(new cv(A,we,A.path,we)),value:ae._parse(new cv(A,A.data[we],A.path,we))});return A.common.async?O0.mergeObjectAsync(T,O):O0.mergeObjectSync(T,O)}get element(){return this._def.valueType}static create(h,T,A){return T instanceof cl?new p({keyType:h,valueType:T,typeName:qo.ZodRecord,...Dc(A)}):new p({keyType:PA.create(),valueType:h,typeName:qo.ZodRecord,...Dc(T)})}},ZO=class extends cl{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.map)return Sa(A,{code:fs.invalid_type,expected:da.map,received:A.parsedType}),Nc;let O=this._def.keyType,$=this._def.valueType,ae=[...A.data.entries()].map(([we,Ge],Oe)=>({key:O._parse(new cv(A,we,A.path,[Oe,"key"])),value:$._parse(new cv(A,Ge,A.path,[Oe,"value"]))}));if(A.common.async){let we=new Map;return Promise.resolve().then(async()=>{for(let Ge of ae){let Oe=await Ge.key,Ze=await Ge.value;if(Oe.status==="aborted"||Ze.status==="aborted")return Nc;(Oe.status==="dirty"||Ze.status==="dirty")&&T.dirty(),we.set(Oe.value,Ze.value)}return{status:T.value,value:we}})}else{let we=new Map;for(let Ge of ae){let Oe=Ge.key,Ze=Ge.value;if(Oe.status==="aborted"||Ze.status==="aborted")return Nc;(Oe.status==="dirty"||Ze.status==="dirty")&&T.dirty(),we.set(Oe.value,Ze.value)}return{status:T.value,value:we}}}};ZO.create=(p,h,T)=>new ZO({valueType:h,keyType:p,typeName:qo.ZodMap,...Dc(T)});var KO=class p extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.parsedType!==da.set)return Sa(A,{code:fs.invalid_type,expected:da.set,received:A.parsedType}),Nc;let O=this._def;O.minSize!==null&&A.data.size<O.minSize.value&&(Sa(A,{code:fs.too_small,minimum:O.minSize.value,type:"set",inclusive:!0,exact:!1,message:O.minSize.message}),T.dirty()),O.maxSize!==null&&A.data.size>O.maxSize.value&&(Sa(A,{code:fs.too_big,maximum:O.maxSize.value,type:"set",inclusive:!0,exact:!1,message:O.maxSize.message}),T.dirty());let $=this._def.valueType;function ae(Ge){let Oe=new Set;for(let Ze of Ge){if(Ze.status==="aborted")return Nc;Ze.status==="dirty"&&T.dirty(),Oe.add(Ze.value)}return{status:T.value,value:Oe}}let we=[...A.data.values()].map((Ge,Oe)=>$._parse(new cv(A,Ge,A.path,Oe)));return A.common.async?Promise.all(we).then(Ge=>ae(Ge)):ae(we)}min(h,T){return new p({...this._def,minSize:{value:h,message:yo.toString(T)}})}max(h,T){return new p({...this._def,maxSize:{value:h,message:yo.toString(T)}})}size(h,T){return this.min(h,T).max(h,T)}nonempty(h){return this.min(1,h)}};KO.create=(p,h)=>new KO({valueType:p,minSize:null,maxSize:null,typeName:qo.ZodSet,...Dc(h)});var gfe=class p extends cl{constructor(){super(...arguments),this.validate=this.implement}_parse(h){let{ctx:T}=this._processInputParams(h);if(T.parsedType!==da.function)return Sa(T,{code:fs.invalid_type,expected:da.function,received:T.parsedType}),Nc;function A(we,Ge){return _fe({data:we,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,ufe(),bq].filter(Oe=>!!Oe),issueData:{code:fs.invalid_arguments,argumentsError:Ge}})}function O(we,Ge){return _fe({data:we,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,ufe(),bq].filter(Oe=>!!Oe),issueData:{code:fs.invalid_return_type,returnTypeError:Ge}})}let $={errorMap:T.common.contextualErrorMap},ae=T.data;if(this._def.returns instanceof c8){let we=this;return Ph(async function(...Ge){let Oe=new ov([]),Ze=await we._def.args.parseAsync(Ge,$).catch(Ki=>{throw Oe.addIssue(A(Ge,Ki)),Oe}),Yr=await Reflect.apply(ae,this,Ze);return await we._def.returns._def.type.parseAsync(Yr,$).catch(Ki=>{throw Oe.addIssue(O(Yr,Ki)),Oe})})}else{let we=this;return Ph(function(...Ge){let Oe=we._def.args.safeParse(Ge,$);if(!Oe.success)throw new ov([A(Ge,Oe.error)]);let Ze=Reflect.apply(ae,this,Oe.data),Yr=we._def.returns.safeParse(Ze,$);if(!Yr.success)throw new ov([O(Ze,Yr.error)]);return Yr.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...h){return new p({...this._def,args:NS.create(h).rest(l4.create())})}returns(h){return new p({...this._def,returns:h})}implement(h){return this.parse(h)}strictImplement(h){return this.parse(h)}static create(h,T,A){return new p({args:h||NS.create([]).rest(l4.create()),returns:T||l4.create(),typeName:qo.ZodFunction,...Dc(A)})}},RA=class extends cl{get schema(){return this._def.getter()}_parse(h){let{ctx:T}=this._processInputParams(h);return this._def.getter()._parse({data:T.data,path:T.path,parent:T})}};RA.create=(p,h)=>new RA({getter:p,typeName:qo.ZodLazy,...Dc(h)});var BA=class extends cl{_parse(h){if(h.data!==this._def.value){let T=this._getOrReturnCtx(h);return Sa(T,{received:T.data,code:fs.invalid_literal,expected:this._def.value}),Nc}return{status:"valid",value:h.data}}get value(){return this._def.value}};BA.create=(p,h)=>new BA({value:p,typeName:qo.ZodLiteral,...Dc(h)});function TLe(p,h){return new jA({values:p,typeName:qo.ZodEnum,...Dc(h)})}var jA=class p extends cl{_parse(h){if(typeof h.data!="string"){let T=this._getOrReturnCtx(h),A=this._def.values;return Sa(T,{expected:Tu.joinValues(A),received:T.parsedType,code:fs.invalid_type}),Nc}if(this._def.values.indexOf(h.data)===-1){let T=this._getOrReturnCtx(h),A=this._def.values;return Sa(T,{received:T.data,code:fs.invalid_enum_value,options:A}),Nc}return Ph(h.data)}get options(){return this._def.values}get enum(){let h={};for(let T of this._def.values)h[T]=T;return h}get Values(){let h={};for(let T of this._def.values)h[T]=T;return h}get Enum(){let h={};for(let T of this._def.values)h[T]=T;return h}extract(h){return p.create(h)}exclude(h){return p.create(this.options.filter(T=>!h.includes(T)))}};jA.create=TLe;var JA=class extends cl{_parse(h){let T=Tu.getValidEnumValues(this._def.values),A=this._getOrReturnCtx(h);if(A.parsedType!==da.string&&A.parsedType!==da.number){let O=Tu.objectValues(T);return Sa(A,{expected:Tu.joinValues(O),received:A.parsedType,code:fs.invalid_type}),Nc}if(T.indexOf(h.data)===-1){let O=Tu.objectValues(T);return Sa(A,{received:A.data,code:fs.invalid_enum_value,options:O}),Nc}return Ph(h.data)}get enum(){return this._def.values}};JA.create=(p,h)=>new JA({values:p,typeName:qo.ZodNativeEnum,...Dc(h)});var c8=class extends cl{unwrap(){return this._def.type}_parse(h){let{ctx:T}=this._processInputParams(h);if(T.parsedType!==da.promise&&T.common.async===!1)return Sa(T,{code:fs.invalid_type,expected:da.promise,received:T.parsedType}),Nc;let A=T.parsedType===da.promise?T.data:Promise.resolve(T.data);return Ph(A.then(O=>this._def.type.parseAsync(O,{path:T.path,errorMap:T.common.contextualErrorMap})))}};c8.create=(p,h)=>new c8({type:p,typeName:qo.ZodPromise,...Dc(h)});var U2=class extends cl{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(h){let{status:T,ctx:A}=this._processInputParams(h),O=this._def.effect||null,$={addIssue:ae=>{Sa(A,ae),ae.fatal?T.abort():T.dirty()},get path(){return A.path}};if($.addIssue=$.addIssue.bind($),O.type==="preprocess"){let ae=O.transform(A.data,$);return A.common.issues.length?{status:"dirty",value:A.data}:A.common.async?Promise.resolve(ae).then(we=>this._def.schema._parseAsync({data:we,path:A.path,parent:A})):this._def.schema._parseSync({data:ae,path:A.path,parent:A})}if(O.type==="refinement"){let ae=we=>{let Ge=O.refinement(we,$);if(A.common.async)return Promise.resolve(Ge);if(Ge instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return we};if(A.common.async===!1){let we=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});return we.status==="aborted"?Nc:(we.status==="dirty"&&T.dirty(),ae(we.value),{status:T.value,value:we.value})}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then(we=>we.status==="aborted"?Nc:(we.status==="dirty"&&T.dirty(),ae(we.value).then(()=>({status:T.value,value:we.value}))))}if(O.type==="transform")if(A.common.async===!1){let ae=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(!xq(ae))return ae;let we=O.transform(ae.value,$);if(we instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:T.value,value:we}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then(ae=>xq(ae)?Promise.resolve(O.transform(ae.value,$)).then(we=>({status:T.value,value:we})):ae);Tu.assertNever(O)}};U2.create=(p,h,T)=>new U2({schema:p,typeName:qo.ZodEffects,effect:h,...Dc(T)});U2.createWithPreprocess=(p,h,T)=>new U2({schema:h,effect:{type:"preprocess",transform:p},typeName:qo.ZodEffects,...Dc(T)});var Ox=class extends cl{_parse(h){return this._getType(h)===da.undefined?Ph(void 0):this._def.innerType._parse(h)}unwrap(){return this._def.innerType}};Ox.create=(p,h)=>new Ox({innerType:p,typeName:qo.ZodOptional,...Dc(h)});var _4=class extends cl{_parse(h){return this._getType(h)===da.null?Ph(null):this._def.innerType._parse(h)}unwrap(){return this._def.innerType}};_4.create=(p,h)=>new _4({innerType:p,typeName:qo.ZodNullable,...Dc(h)});var zA=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A=T.data;return T.parsedType===da.undefined&&(A=this._def.defaultValue()),this._def.innerType._parse({data:A,path:T.path,parent:T})}removeDefault(){return this._def.innerType}};zA.create=(p,h)=>new zA({innerType:p,typeName:qo.ZodDefault,defaultValue:typeof h.default=="function"?h.default:()=>h.default,...Dc(h)});var eL=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A={...T,common:{...T.common,issues:[]}},O=this._def.innerType._parse({data:A.data,path:A.path,parent:{...A}});return ffe(O)?O.then($=>({status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new ov(A.common.issues)},input:A.data})})):{status:"valid",value:O.status==="valid"?O.value:this._def.catchValue({get error(){return new ov(A.common.issues)},input:A.data})}}removeCatch(){return this._def.innerType}};eL.create=(p,h)=>new eL({innerType:p,typeName:qo.ZodCatch,catchValue:typeof h.catch=="function"?h.catch:()=>h.catch,...Dc(h)});var tL=class extends cl{_parse(h){if(this._getType(h)!==da.nan){let A=this._getOrReturnCtx(h);return Sa(A,{code:fs.invalid_type,expected:da.nan,received:A.parsedType}),Nc}return{status:"valid",value:h.data}}};tL.create=p=>new tL({typeName:qo.ZodNaN,...Dc(p)});var hTt=Symbol("zod_brand"),hfe=class extends cl{_parse(h){let{ctx:T}=this._processInputParams(h),A=T.data;return this._def.type._parse({data:A,path:T.path,parent:T})}unwrap(){return this._def.type}},Tq=class p extends cl{_parse(h){let{status:T,ctx:A}=this._processInputParams(h);if(A.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:A.data,path:A.path,parent:A});return $.status==="aborted"?Nc:$.status==="dirty"?(T.dirty(),C2t($.value)):this._def.out._parseAsync({data:$.value,path:A.path,parent:A})})();{let O=this._def.in._parseSync({data:A.data,path:A.path,parent:A});return O.status==="aborted"?Nc:O.status==="dirty"?(T.dirty(),{status:"dirty",value:O.value}):this._def.out._parseSync({data:O.value,path:A.path,parent:A})}}static create(h,T){return new p({in:h,out:T,typeName:qo.ZodPipeline})}},rL=class extends cl{_parse(h){let T=this._def.innerType._parse(h);return xq(T)&&(T.value=Object.freeze(T.value)),T}};rL.create=(p,h)=>new rL({innerType:p,typeName:qo.ZodReadonly,...Dc(h)});var yTt={object:V1.lazycreate},qo;(function(p){p.ZodString="ZodString",p.ZodNumber="ZodNumber",p.ZodNaN="ZodNaN",p.ZodBigInt="ZodBigInt",p.ZodBoolean="ZodBoolean",p.ZodDate="ZodDate",p.ZodSymbol="ZodSymbol",p.ZodUndefined="ZodUndefined",p.ZodNull="ZodNull",p.ZodAny="ZodAny",p.ZodUnknown="ZodUnknown",p.ZodNever="ZodNever",p.ZodVoid="ZodVoid",p.ZodArray="ZodArray",p.ZodObject="ZodObject",p.ZodUnion="ZodUnion",p.ZodDiscriminatedUnion="ZodDiscriminatedUnion",p.ZodIntersection="ZodIntersection",p.ZodTuple="ZodTuple",p.ZodRecord="ZodRecord",p.ZodMap="ZodMap",p.ZodSet="ZodSet",p.ZodFunction="ZodFunction",p.ZodLazy="ZodLazy",p.ZodLiteral="ZodLiteral",p.ZodEnum="ZodEnum",p.ZodEffects="ZodEffects",p.ZodNativeEnum="ZodNativeEnum",p.ZodOptional="ZodOptional",p.ZodNullable="ZodNullable",p.ZodDefault="ZodDefault",p.ZodCatch="ZodCatch",p.ZodPromise="ZodPromise",p.ZodBranded="ZodBranded",p.ZodPipeline="ZodPipeline",p.ZodReadonly="ZodReadonly"})(qo||(qo={}));var tf=PA.create,vTt=qO.create,bTt=tL.create,xTt=$O.create,yfe=GO.create,TTt=HO.create,STt=XO.create,kTt=OA.create,CTt=LA.create,SLe=QO.create,wTt=l4.create,ETt=Lx.create,ATt=YO.create,DTt=u4.create,vfe=V1.create,NTt=V1.strictCreate,ITt=MA.create,PTt=pfe.create,OTt=FA.create,LTt=NS.create,kLe=mfe.create,MTt=ZO.create,FTt=KO.create,RTt=gfe.create,BTt=RA.create,jTt=BA.create,Sq=jA.create,JTt=JA.create,zTt=c8.create,UTt=U2.create,VTt=Ox.create,WTt=_4.create,qTt=U2.createWithPreprocess,$Tt=Tq.create;var B2t=vfe({primary:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The primary color of the workspace"),background:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d232a").describe("The background color of the workspace"),success:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#087f5b").describe("The success color of the workspace"),info:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The informational color of the workspace"),warning:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace"),error:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#990000").describe("The error color of the workspace"),fatal:tf().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#7d1a1a").describe("The fatal color of the workspace")}).describe("Colors used for various workspace elements"),CLe=vfe({name:tf().trim().toLowerCase().optional().describe("The name of the package"),namespace:tf().trim().toLowerCase().optional().describe("The namespace of the package"),organization:tf().trim().default("storm-software").describe("The organization of the workspace"),repository:tf().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),license:tf().trim().default("Apache License 2.0").describe("The root directory of the package"),homepage:tf().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),branch:tf().trim().default("main").describe("The branch of the workspace"),preMajor:yfe().default(!1).describe("An indicator specifying if the package is still in it's pre-major version"),owner:tf().trim().default("@storm-software/development").describe("The owner of the package"),worker:tf().trim().default("stormie-bot").describe("The worker of the package (this is the bot that will be used to perform various tasks)"),env:Sq(["development","staging","production"]).default("production").describe("The current runtime environment of the package"),ci:yfe().default(!0).describe("An indicator specifying if the current environment is a CI environment"),workspaceRoot:tf().trim().optional().describe("The root directory of the workspace"),packageDirectory:tf().trim().optional().describe("The root directory of the package"),buildDirectory:tf().trim().default("dist").describe("The build directory for the workspace"),runtimeDirectory:tf().trim().default("node_modules/.storm").describe("The runtime directory of Storm"),runtimeVersion:tf().trim().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/).default("1.0.0").describe("The global version of the Storm runtime"),packageManager:Sq(["npm","yarn","pnpm","bun"]).default("npm").describe("The package manager used by the repository"),timezone:tf().trim().default("America/New_York").describe("The default timezone of the workspace"),locale:tf().trim().default("en-US").describe("The default locale of the workspace"),logLevel:Sq(["silent","fatal","error","warn","info","debug","trace","all"]).default("debug").describe("The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."),configFile:tf().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),colors:B2t.describe("Storm theme config values used for styling various package elements"),extensions:kLe(SLe()).optional().default({}).describe("Configuration of each used extension")}).describe("Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo.");var ELe={primary:"#1fb2a6",background:"#1d232a",success:"#087f5b",info:"#0ea5e9",warning:"#fcc419",error:"#990000",fatal:"#7d1a1a"},nL={name:"storm",namespace:"storm-software",license:"Apache License 2.0",homepage:"https://stormsoftware.org",preMajor:!1,owner:"@storm-software/development",worker:"stormie-bot",runtimeDirectory:"node_modules/.storm",packageManager:"npm",timezone:"America/New_York",locale:"en-US",env:"production",branch:"main",organization:"storm-software",ci:!0,configFile:null,runtimeVersion:"1.0.0",colors:{...ELe},extensions:{}},ALe=(p={},h)=>{let T="storm-workspace",A="storm-software",O="https://github.com/storm-software/storm-ops",$=nL.license,ae=nL.homepage,we=hLe(h);if(j2t(wLe(we,"package.json"))){let Ge=J2t(wLe(we,"package.json"),{encoding:"utf-8"});if(Ge){let Oe=JSON.parse(Ge);Oe.name&&(T=Oe.name),Oe.namespace&&(A=Oe.namespace),Oe.repository?.url&&(O=Oe.repository?.url),Oe.license&&($=Oe.license),Oe.homepage&&(ae=Oe.homepage)}}return CLe.parse({...p,...nL,colors:{...p.colors,...ELe},workspaceRoot:we,name:T,namespace:A,repository:O,license:$??nL.license,homepage:ae??nL.homepage,extensions:{...p.extensions}})};var kq=p=>{switch(p){case"all":return sp.ALL;case"trace":return sp.TRACE;case"debug":return sp.DEBUG;case"info":return sp.INFO;case"warn":return sp.WARN;case"error":return sp.ERROR;case"fatal":return sp.FATAL;case"silent":return sp.SILENT;default:return sp.INFO}},DLe=p=>p>=sp.ALL?av.ALL:p>=sp.TRACE?av.TRACE:p>=sp.DEBUG?av.DEBUG:p>=sp.INFO?av.INFO:p>=sp.WARN?av.WARN:p>=sp.ERROR?av.ERROR:p>=sp.FATAL?av.FATAL:p<=sp.SILENT?av.SILENT:av.INFO;var Nfe=Eue(cMe(),1);var _bt=p=>{let h=`STORM_EXTENSION_${p.toUpperCase()}_`;return Object.keys(process.env).filter(T=>T.startsWith(h)).reduce((T,A)=>{let O=A.replace(h,"").split("_").map($=>$.length>0?$.trim().charAt(0).toUpperCase()+$.trim().slice(1):"").join("");return O&&(T[O]=process.env[A]),T},{})},lMe=()=>{let p="STORM_",h={name:process.env[`${p}NAME`],namespace:process.env[`${p}NAMESPACE`],owner:process.env[`${p}OWNER`],worker:process.env[`${p}WORKER`],organization:process.env[`${p}ORGANIZATION`],packageManager:process.env[`${p}PACKAGE_MANAGER`],license:process.env[`${p}LICENSE`],homepage:process.env[`${p}HOMEPAGE`],timezone:process.env[`${p}TIMEZONE`]??process.env.TZ,locale:process.env[`${p}LOCALE`]??process.env.LOCALE,configFile:process.env[`${p}CONFIG_FILE`],workspaceRoot:process.env[`${p}WORKSPACE_ROOT`],packageDirectory:process.env[`${p}PACKAGE_DIRECTORY`],buildDirectory:process.env[`${p}BUILD_DIRECTORY`],runtimeVersion:process.env[`${p}RUNTIME_VERSION`],runtimeDirectory:process.env[`${p}RUNTIME_DIRECTORY`],env:process.env[`${p}ENV`]??process.env.NODE_ENV??process.env.ENVIRONMENT,ci:!!(process.env[`${p}CI`]??process.env.CI??process.env.CONTINUOUS_INTEGRATION),colors:{primary:process.env[`${p}COLOR_PRIMARY`],background:process.env[`${p}COLOR_BACKGROUND`],success:process.env[`${p}COLOR_SUCCESS`],info:process.env[`${p}COLOR_INFO`],warning:process.env[`${p}COLOR_WARNING`],error:process.env[`${p}COLOR_ERROR`],fatal:process.env[`${p}COLOR_FATAL`]},repository:process.env[`${p}REPOSITORY`],branch:process.env[`${p}BRANCH`],preMajor:!!process.env[`${p}PRE_MAJOR`],logLevel:process.env[`${p}LOG_LEVEL`]!==null&&process.env[`${p}LOG_LEVEL`]!==void 0?Number.isSafeInteger(Number.parseInt(process.env[`${p}LOG_LEVEL`]))?DLe(Number.parseInt(process.env[`${p}LOG_LEVEL`])):process.env[`${p}LOG_LEVEL`]:av.INFO,extensions:{}},T=process.env[`${p}CONFIG`];if(T){let O=JSON.parse(T);h={...h,...O,colors:{...h.colors,...O.colors},extensions:{...h.extensions,...O.extensions}}}let A=`${p}EXTENSION_`;return Object.keys(process.env).filter(O=>O.startsWith(A)).reduce((O,$)=>{let ae=$.substring(p.length,$.indexOf("_",p.length)).split("_").map(we=>we.length>0?we.trim().charAt(0).toUpperCase()+we.trim().slice(1):"").join("");return ae&&(O.extensions[ae]=_bt(ae)),O},h)};var fbt=(p,h)=>{for(let T of Object.keys(h??{}))if(h[T]){let A=T?.replace(/([A-Z])+/g,$=>$?$[0].toUpperCase()+$.slice(1):"").split(/(?=[A-Z])|[\.\-\s_]/).map($=>$.toLowerCase())??[],O;if(A.length===0)return;A.length===1?O=A[0].toUpperCase():O=A.reduce(($,ae)=>`${$}_${ae.toLowerCase()}`),process.env[`STORM_EXTENSION_${p.toUpperCase()}_${O.toUpperCase()}`]=h[T]}},uMe=p=>{let h="STORM_";p.name&&(process.env[`${h}NAME`]=p.name),p.namespace&&(process.env[`${h}NAMESPACE`]=p.namespace),p.owner&&(process.env[`${h}OWNER`]=p.owner),p.worker&&(process.env[`${h}WORKER`]=p.worker),p.organization&&(process.env[`${h}ORGANIZATION`]=p.organization),p.packageManager&&(process.env[`${h}PACKAGE_MANAGER`]=p.packageManager),p.license&&(process.env[`${h}LICENSE`]=p.license),p.homepage&&(process.env[`${h}HOMEPAGE`]=p.homepage),p.timezone&&(process.env[`${h}TIMEZONE`]=p.timezone,process.env.TZ=p.timezone,process.env.DEFAULT_TIMEZONE=p.timezone),p.locale&&(process.env[`${h}LOCALE`]=p.locale,process.env.LOCALE=p.locale,process.env.DEFAULT_LOCALE=p.locale,process.env.LANG=p.locale?`${p.locale.replaceAll("-","_")}.UTF-8`:"en_US.UTF-8"),p.configFile&&(process.env[`${h}CONFIG_FILE`]=p.configFile),p.workspaceRoot&&(process.env[`${h}WORKSPACE_ROOT`]=p.workspaceRoot,process.env.NX_WORKSPACE_ROOT=p.workspaceRoot,process.env.NX_WORKSPACE_ROOT_PATH=p.workspaceRoot),p.packageDirectory&&(process.env[`${h}PACKAGE_DIRECTORY`]=p.packageDirectory),p.buildDirectory&&(process.env[`${h}BUILD_DIRECTORY`]=p.buildDirectory),p.runtimeVersion&&(process.env[`${h}RUNTIME_VERSION`]=p.runtimeVersion),p.runtimeDirectory&&(process.env[`${h}RUNTIME_DIRECTORY`]=p.runtimeDirectory),p.env&&(process.env[`${h}ENV`]=p.env,process.env.NODE_ENV=p.env,process.env.ENVIRONMENT=p.env),p.ci&&(process.env[`${h}CI`]=String(p.ci),process.env.CI=String(p.ci),process.env.CONTINUOUS_INTEGRATION=String(p.ci)),p.colors.primary&&(process.env[`${h}COLOR_PRIMARY`]=p.colors.primary),p.colors.background&&(process.env[`${h}COLOR_BACKGROUND`]=p.colors.background),p.colors.success&&(process.env[`${h}COLOR_SUCCESS`]=p.colors.success),p.colors.info&&(process.env[`${h}COLOR_INFO`]=p.colors.info),p.colors.warning&&(process.env[`${h}COLOR_WARNING`]=p.colors.warning),p.colors.error&&(process.env[`${h}COLOR_ERROR`]=p.colors.error),p.colors.fatal&&(process.env[`${h}COLOR_FATAL`]=p.colors.fatal),p.repository&&(process.env[`${h}REPOSITORY`]=p.repository),p.branch&&(process.env[`${h}BRANCH`]=p.branch),p.preMajor&&(process.env[`${h}PRE_MAJOR`]=String(p.preMajor)),p.logLevel&&(process.env[`${h}LOG_LEVEL`]=String(p.logLevel),process.env.LOG_LEVEL=String(p.logLevel),process.env.NX_VERBOSE_LOGGING=String(kq(p.logLevel)>=sp.DEBUG),process.env.RUST_BACKTRACE=kq(p.logLevel)>=sp.DEBUG?"full":"none"),process.env[`${h}CONFIG`]=JSON.stringify(p);for(let T of Object.keys(p.extensions??{}))p.extensions[T]&&Object.keys(p.extensions[T])&&fbt(T,p.extensions[T])};var PSt=async()=>{let p=ALe({...await dLe(),...lMe()});return uMe(p),p};export{PSt as prepareWorkspace};
413
413
  /*! Bundled license information:
414
414
 
415
415
  typescript/lib/typescript.js: