@novu/framework 0.24.3-alpha.7 → 0.24.3-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/express.d.ts +1 -1
- package/dist/express.js +1 -1
- package/dist/h3.d.ts +1 -1
- package/dist/h3.js +1 -1
- package/dist/{handler-VweGZ1Z4.d.ts → handler-_6lXMYuL.d.ts} +4 -4
- package/dist/index.d.ts +92 -3
- package/dist/index.js +16 -15
- package/dist/next.d.ts +1 -1
- package/dist/next.js +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/remix.d.ts +1 -1
- package/dist/remix.js +1 -1
- package/dist/sveltekit.d.ts +1 -1
- package/dist/sveltekit.js +1 -1
- package/package.json +1 -1
package/dist/next.d.ts
CHANGED
package/dist/next.js
CHANGED
|
@@ -15,7 +15,7 @@ var ke__default = /*#__PURE__*/_interopDefault(ke);
|
|
|
15
15
|
var Hs__default = /*#__PURE__*/_interopDefault(Hs);
|
|
16
16
|
var en__default = /*#__PURE__*/_interopDefault(en);
|
|
17
17
|
|
|
18
|
-
var Xs=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var y=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Ot=y(B=>{Object.defineProperty(B,"__esModule",{value:!0});B.getDefaultOptions=B.defaultOptions=B.ignoreOverride=void 0;B.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");B.defaultOptions={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",base64Strategy:"contentEncoding:base64"};var tn=r=>typeof r=="string"?{...B.defaultOptions,name:r}:{...B.defaultOptions,...r};B.getDefaultOptions=tn;});var gr=y(Rt=>{Object.defineProperty(Rt,"__esModule",{value:!0});Rt.getRefs=void 0;var rn=Ot(),sn=r=>{let e=(0, rn.getDefaultOptions)(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return {...e,currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};Rt.getRefs=sn;});var se=y(Ce=>{Object.defineProperty(Ce,"__esModule",{value:!0});Ce.setResponseValueAndErrors=Ce.addErrorMessage=void 0;function us(r,e,t,s){s?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t});}Ce.addErrorMessage=us;function nn(r,e,t,s,n){r[e]=t,us(r,e,s,n);}Ce.setResponseValueAndErrors=nn;});var Ke=y(E=>{Object.defineProperty(E,"__esModule",{value:!0});E.getParsedType=E.ZodParsedType=E.objectUtil=E.util=void 0;var cs;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(d=>typeof n[n[d]]!="number"),i={};for(let d of a)i[d]=n[d];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a;})(cs=E.util||(E.util={}));(function(r){r.mergeShapes=(e,t)=>({...e,...t});})(E.objectUtil||(E.objectUtil={}));E.ZodParsedType=cs.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var on=r=>{switch(typeof r){case"undefined":return E.ZodParsedType.undefined;case"string":return E.ZodParsedType.string;case"number":return isNaN(r)?E.ZodParsedType.nan:E.ZodParsedType.number;case"boolean":return E.ZodParsedType.boolean;case"function":return E.ZodParsedType.function;case"bigint":return E.ZodParsedType.bigint;case"symbol":return E.ZodParsedType.symbol;case"object":return Array.isArray(r)?E.ZodParsedType.array:r===null?E.ZodParsedType.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?E.ZodParsedType.promise:typeof Map<"u"&&r instanceof Map?E.ZodParsedType.map:typeof Set<"u"&&r instanceof Set?E.ZodParsedType.set:typeof Date<"u"&&r instanceof Date?E.ZodParsedType.date:E.ZodParsedType.object;default:return E.ZodParsedType.unknown}};E.getParsedType=on;});var Et=y(ne=>{Object.defineProperty(ne,"__esModule",{value:!0});ne.ZodError=ne.quotelessJson=ne.ZodIssueCode=void 0;var ls=Ke();ne.ZodIssueCode=ls.util.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 dn=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");ne.quotelessJson=dn;var ze=class r extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s];},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s];};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e;}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else {let d=s,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(d[l]=d[l]||{_errors:[]},d[l]._errors.push(t(i))):d[l]=d[l]||{_errors:[]},d=d[l],c++;}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ls.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return {formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};ne.ZodError=ze;ze.create=r=>new ze(r);});var Tr=y(vr=>{Object.defineProperty(vr,"__esModule",{value:!0});var le=Ke(),N=Et(),un=(r,e)=>{let t;switch(r.code){case N.ZodIssueCode.invalid_type:r.received===le.ZodParsedType.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case N.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,le.util.jsonStringifyReplacer)}`;break;case N.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${le.util.joinValues(r.keys,", ")}`;break;case N.ZodIssueCode.invalid_union:t="Invalid input";break;case N.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${le.util.joinValues(r.options)}`;break;case N.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${le.util.joinValues(r.options)}, received '${r.received}'`;break;case N.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case N.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case N.ZodIssueCode.invalid_date:t="Invalid date";break;case N.ZodIssueCode.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:le.util.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case N.ZodIssueCode.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case N.ZodIssueCode.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case N.ZodIssueCode.custom:t="Invalid input";break;case N.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case N.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case N.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,le.util.assertNever(r);}return {message:t}};vr.default=un;});var bt=y(G=>{var cn=G&&G.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(G,"__esModule",{value:!0});G.getErrorMap=G.setErrorMap=G.defaultErrorMap=void 0;var ps=cn(Tr());G.defaultErrorMap=ps.default;var fs=ps.default;function ln(r){fs=r;}G.setErrorMap=ln;function pn(){return fs}G.getErrorMap=pn;});var xr=y(R=>{var fn=R&&R.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(R,"__esModule",{value:!0});R.isAsync=R.isValid=R.isDirty=R.isAborted=R.OK=R.DIRTY=R.INVALID=R.ParseStatus=R.addIssueToContext=R.EMPTY_PATH=R.makeIssue=void 0;var hn=bt(),hs=fn(Tr()),mn=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return {...n,path:a,message:n.message};let d="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)d=l(i,{data:e,defaultError:d}).message;return {...n,path:a,message:d}};R.makeIssue=mn;R.EMPTY_PATH=[];function _n(r,e){let t=(0, hn.getErrorMap)(),s=(0, R.makeIssue)({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===hs.default?void 0:hs.default].filter(n=>!!n)});r.common.issues.push(s);}R.addIssueToContext=_n;var Ir=class r{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return R.INVALID;n.status==="dirty"&&e.dirty(),s.push(n.value);}return {status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,i=await n.value;s.push({key:a,value:i});}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return R.INVALID;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value);}return {status:e.value,value:s}}};R.ParseStatus=Ir;R.INVALID=Object.freeze({status:"aborted"});var yn=r=>({status:"dirty",value:r});R.DIRTY=yn;var gn=r=>({status:"valid",value:r});R.OK=gn;var vn=r=>r.status==="aborted";R.isAborted=vn;var Tn=r=>r.status==="dirty";R.isDirty=Tn;var In=r=>r.status==="valid";R.isValid=In;var xn=r=>typeof Promise<"u"&&r instanceof Promise;R.isAsync=xn;});var _s=y(ms=>{Object.defineProperty(ms,"__esModule",{value:!0});});var ys=y(Be=>{Object.defineProperty(Be,"__esModule",{value:!0});Be.errorUtil=void 0;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message;})(Be.errorUtil||(Be.errorUtil={}));});var As=y(o=>{var Pt=o&&o.__classPrivateFieldGet||function(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)},vs=o&&o.__classPrivateFieldSet||function(r,e,t,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ge,Ye;Object.defineProperty(o,"__esModule",{value:!0});o.boolean=o.bigint=o.array=o.any=o.coerce=o.ZodFirstPartyTypeKind=o.late=o.ZodSchema=o.Schema=o.custom=o.ZodReadonly=o.ZodPipeline=o.ZodBranded=o.BRAND=o.ZodNaN=o.ZodCatch=o.ZodDefault=o.ZodNullable=o.ZodOptional=o.ZodTransformer=o.ZodEffects=o.ZodPromise=o.ZodNativeEnum=o.ZodEnum=o.ZodLiteral=o.ZodLazy=o.ZodFunction=o.ZodSet=o.ZodMap=o.ZodRecord=o.ZodTuple=o.ZodIntersection=o.ZodDiscriminatedUnion=o.ZodUnion=o.ZodObject=o.ZodArray=o.ZodVoid=o.ZodNever=o.ZodUnknown=o.ZodAny=o.ZodNull=o.ZodUndefined=o.ZodSymbol=o.ZodDate=o.ZodBoolean=o.ZodBigInt=o.ZodNumber=o.ZodString=o.datetimeRegex=o.ZodType=void 0;o.NEVER=o.void=o.unknown=o.union=o.undefined=o.tuple=o.transformer=o.symbol=o.string=o.strictObject=o.set=o.record=o.promise=o.preprocess=o.pipeline=o.ostring=o.optional=o.onumber=o.oboolean=o.object=o.number=o.nullable=o.null=o.never=o.nativeEnum=o.nan=o.map=o.literal=o.lazy=o.intersection=o.instanceof=o.function=o.enum=o.effect=o.discriminatedUnion=o.date=void 0;var wt=bt(),m=ys(),u=xr(),h=Ke(),p=Et(),V=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n;}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}},gs=(r,e)=>{if((0, u.isValid)(e))return {success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:!1,get error(){if(this._error)return this._error;let t=new p.ZodError(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return {};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,d)=>{var c,l;let{message:f}=r;return i.code==="invalid_enum_value"?{message:f??d.defaultError}:typeof d.data>"u"?{message:(c=f??s)!==null&&c!==void 0?c:d.defaultError}:i.code!=="invalid_type"?{message:d.defaultError}:{message:(l=f??t)!==null&&l!==void 0?l:d.defaultError}},description:n}}var v=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this);}get description(){return this._def.description}_getType(e){return (0, h.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, u.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, h.getParsedType)(e)},a=this._parseSync({data:e,path:n.path,parent:n});return gs(n,a)}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, h.getParsedType)(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await((0, u.isAsync)(n)?n:Promise.resolve(n));return gs(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),d=()=>a.addIssue({code:p.ZodIssueCode.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(d(),!1)):i?!0:(d(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new j({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return L.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this,this._def)}promise(){return oe.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return ve.create(this,e,this._def)}transform(e){return new j({...g(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Re({...g(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Je({typeName:_.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ee({...g(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};o.ZodType=v;o.Schema=v;o.ZodSchema=v;var Rn=/^c[^\s-]{8,}$/i,En=/^[0-9a-z]+$/,bn=/^[0-9A-HJKMNP-TV-Z]{26}$/,wn=/^[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,Pn=/^[a-z0-9_-]{21}$/i,An=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,kn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Or,Cn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dn=/^(([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})))$/,Sn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ts="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Zn=new RegExp(`^${Ts}$`);function Is(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function jn(r){return new RegExp(`^${Is(r)}$`)}function xs(r){let e=`${Ts}T${Is(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}o.datetimeRegex=xs;function Mn(r,e){return !!((e==="v4"||!e)&&Cn.test(r)||(e==="v6"||!e)&&Dn.test(r))}var ae=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:a.parsedType}),u.INVALID}let s=new u.ParseStatus,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,d=e.data.length<a.value;(i||d)&&(n=this._getOrReturnCtx(e,n),i?(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty());}else if(a.kind==="email")kn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"email",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Or||(Or=new RegExp(Nn,"u")),Or.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")wn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Pn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Rn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")En.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")bn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data);}catch{n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"url",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty();}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?xs(a).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Zn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?jn(a).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?An.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Mn(e.data,a.version)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Sn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty()):h.util.assertNever(a);return {status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:p.ZodIssueCode.invalid_string,...m.errorUtil.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errorUtil.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(s=e?.local)!==null&&s!==void 0?s:!1,...m.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,m.errorUtil.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};o.ZodString=ae;ae.create=r=>{var e;return new ae({checks:[],typeName:_.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function Un(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}var pe=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.ZodParsedType.number){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:a.parsedType}),u.INVALID}let s,n=new u.ParseStatus;for(let a of this._def.checks)a.kind==="int"?h.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Un(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.not_finite,message:a.message}),n.dirty()):h.util.assertNever(a);return {status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.errorUtil.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.errorUtil.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&h.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return !0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);}return Number.isFinite(t)&&Number.isFinite(e)}};o.ZodNumber=pe;pe.create=r=>new pe({checks:[],typeName:_.ZodNumber,coerce:r?.coerce||!1,...g(r)});var fe=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.ZodParsedType.bigint){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:a.parsedType}),u.INVALID}let s,n=new u.ParseStatus;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):h.util.assertNever(a);return {status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.errorUtil.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.errorUtil.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};o.ZodBigInt=fe;fe.create=r=>{var e;return new fe({checks:[],typeName:_.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var he=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodBoolean=he;he.create=r=>new he({typeName:_.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var me=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:a.parsedType}),u.INVALID}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let s=new u.ParseStatus,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):h.util.assertNever(a);return {status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};o.ZodDate=me;me.create=r=>new me({checks:[],coerce:r?.coerce||!1,typeName:_.ZodDate,...g(r)});var Se=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodSymbol=Se;Se.create=r=>new Se({typeName:_.ZodSymbol,...g(r)});var _e=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodUndefined=_e;_e.create=r=>new _e({typeName:_.ZodUndefined,...g(r)});var ye=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodNull=ye;ye.create=r=>new ye({typeName:_.ZodNull,...g(r)});var ie=class extends v{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, u.OK)(e.data)}};o.ZodAny=ie;ie.create=r=>new ie({typeName:_.ZodAny,...g(r)});var H=class extends v{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, u.OK)(e.data)}};o.ZodUnknown=H;H.create=r=>new H({typeName:_.ZodUnknown,...g(r)});var W=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:t.parsedType}),u.INVALID}};o.ZodNever=W;W.create=r=>new W({typeName:_.ZodNever,...g(r)});var Ze=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodVoid=Ze;Ze.create=r=>new Ze({typeName:_.ZodVoid,...g(r)});var ee=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.ZodParsedType.array)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:t.parsedType}),u.INVALID;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,d=t.data.length<n.exactLength.value;(i||d)&&((0, u.addIssueToContext)(t,{code:i?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:d?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty());}if(n.minLength!==null&&t.data.length<n.minLength.value&&((0, u.addIssueToContext)(t,{code:p.ZodIssueCode.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&((0, u.addIssueToContext)(t,{code:p.ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,d)=>n.type._parseAsync(new V(t,i,t.path,d)))).then(i=>u.ParseStatus.mergeArray(s,i));let a=[...t.data].map((i,d)=>n.type._parseSync(new V(t,i,t.path,d)));return u.ParseStatus.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:m.errorUtil.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:m.errorUtil.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:m.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};o.ZodArray=ee;ee.create=(r,e)=>new ee({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...g(e)});function De(r){if(r instanceof D){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=L.create(De(s));}return new D({...r._def,shape:()=>e})}else return r instanceof ee?new ee({...r._def,type:De(r.element)}):r instanceof L?L.create(De(r.unwrap())):r instanceof J?J.create(De(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>De(e))):r}var D=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=h.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof W&&this._def.unknownKeys==="strip"))for(let l in n.data)i.includes(l)||d.push(l);let c=[];for(let l of i){let f=a[l],I=n.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new V(n,I,n.path,l)),alwaysSet:l in n.data});}if(this._def.catchall instanceof W){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of d)c.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(l==="strict")d.length>0&&((0, u.addIssueToContext)(n,{code:p.ZodIssueCode.unrecognized_keys,keys:d}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let f of d){let I=n.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new V(n,I,n.path,f)),alwaysSet:f in n.data});}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of c){let I=await f.key,A=await f.value;l.push({key:I,value:A,alwaysSet:f.alwaysSet});}return l}).then(l=>u.ParseStatus.mergeObjectSync(s,l)):u.ParseStatus.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return m.errorUtil.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,d;let c=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(d=m.errorUtil.errToObj(e).message)!==null&&d!==void 0?d:c}:{message:c}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return h.util.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s]);}),new r({...this._def,shape:()=>t})}omit(e){let t={};return h.util.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s]);}),new r({...this._def,shape:()=>t})}deepPartial(){return De(this)}partial(e){let t={};return h.util.objectKeys(this.shape).forEach(s=>{let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional();}),new r({...this._def,shape:()=>t})}required(e){let t={};return h.util.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else {let a=this.shape[s];for(;a instanceof L;)a=a._def.innerType;t[s]=a;}}),new r({...this._def,shape:()=>t})}keyof(){return Os(h.util.objectKeys(this.shape))}};o.ZodObject=D;D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:W.create(),typeName:_.ZodObject,...g(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:W.create(),typeName:_.ZodObject,...g(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:W.create(),typeName:_.ZodObject,...g(e)});var ge=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let d of a)if(d.result.status==="valid")return d.result;for(let d of a)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;let i=a.map(d=>new p.ZodError(d.ctx.common.issues));return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union,unionErrors:i}),u.INVALID}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return {result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:l}),l.common.issues.length&&i.push(l.common.issues);}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let d=i.map(c=>new p.ZodError(c));return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union,unionErrors:d}),u.INVALID}}get options(){return this._def.options}};o.ZodUnion=ge;ge.create=(r,e)=>new ge({options:r,typeName:_.ZodUnion,...g(e)});var Q=r=>r instanceof Te?Q(r.schema):r instanceof j?Q(r.innerType()):r instanceof Ie?[r.value]:r instanceof xe?r.options:r instanceof Oe?h.util.objectValues(r.enum):r instanceof Re?Q(r._def.innerType):r instanceof _e?[void 0]:r instanceof ye?[null]:r instanceof L?[void 0,...Q(r.unwrap())]:r instanceof J?[null,...Q(r.unwrap())]:r instanceof Je||r instanceof be?Q(r.unwrap()):r instanceof Ee?Q(r._def.innerType):[],At=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.object)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:t.parsedType}),u.INVALID;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):((0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=Q(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let d of i){if(n.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);n.set(d,a);}}return new r({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}};o.ZodDiscriminatedUnion=At;function Rr(r,e){let t=(0, h.getParsedType)(r),s=(0, h.getParsedType)(e);if(r===e)return {valid:!0,data:r};if(t===h.ZodParsedType.object&&s===h.ZodParsedType.object){let n=h.util.objectKeys(e),a=h.util.objectKeys(r).filter(d=>n.indexOf(d)!==-1),i={...r,...e};for(let d of a){let c=Rr(r[d],e[d]);if(!c.valid)return {valid:!1};i[d]=c.data;}return {valid:!0,data:i}}else if(t===h.ZodParsedType.array&&s===h.ZodParsedType.array){if(r.length!==e.length)return {valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],d=e[a],c=Rr(i,d);if(!c.valid)return {valid:!1};n.push(c.data);}return {valid:!0,data:n}}else return t===h.ZodParsedType.date&&s===h.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ve=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if((0, u.isAborted)(a)||(0, u.isAborted)(i))return u.INVALID;let d=Rr(a.value,i.value);return d.valid?(((0, u.isDirty)(a)||(0, u.isDirty)(i))&&t.dirty(),{status:t.value,value:d.data}):((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};o.ZodIntersection=ve;ve.create=(r,e,t)=>new ve({left:r,right:e,typeName:_.ZodIntersection,...g(t)});var Y=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.array)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:s.parsedType}),u.INVALID;if(s.data.length<this._def.items.length)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,d)=>{let c=this._def.items[d]||this._def.rest;return c?c._parse(new V(s,i,s.path,d)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>u.ParseStatus.mergeArray(t,i)):u.ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};o.ZodTuple=Y;Y.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y({items:r,typeName:_.ZodTuple,rest:null,...g(e)})};var kt=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.object)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:s.parsedType}),u.INVALID;let n=[],a=this._def.keyType,i=this._def.valueType;for(let d in s.data)n.push({key:a._parse(new V(s,d,s.path,d)),value:i._parse(new V(s,s.data[d],s.path,d)),alwaysSet:d in s.data});return s.common.async?u.ParseStatus.mergeObjectAsync(t,n):u.ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new r({keyType:e,valueType:t,typeName:_.ZodRecord,...g(s)}):new r({keyType:ae.create(),valueType:e,typeName:_.ZodRecord,...g(t)})}};o.ZodRecord=kt;var je=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.map)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:s.parsedType}),u.INVALID;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([d,c],l)=>({key:n._parse(new V(s,d,s.path,[l,"key"])),value:a._parse(new V(s,c,s.path,[l,"value"]))}));if(s.common.async){let d=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),d.set(l.value,f.value);}return {status:t.value,value:d}})}else {let d=new Map;for(let c of i){let l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),d.set(l.value,f.value);}return {status:t.value,value:d}}}};o.ZodMap=je;je.create=(r,e,t)=>new je({valueType:e,keyType:r,typeName:_.ZodMap,...g(t)});var Me=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.set)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:s.parsedType}),u.INVALID;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(c){let l=new Set;for(let f of c){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&t.dirty(),l.add(f.value);}return {status:t.value,value:l}}let d=[...s.data.values()].map((c,l)=>a._parse(new V(s,c,s.path,l)));return s.common.async?Promise.all(d).then(c=>i(c)):i(d)}min(e,t){return new r({...this._def,minSize:{value:e,message:m.errorUtil.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:m.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o.ZodSet=Me;Me.create=(r,e)=>new Me({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...g(e)});var Nt=class r extends v{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.function)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:t.parsedType}),u.INVALID;function s(d,c){return (0, u.makeIssue)({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, wt.getErrorMap)(),wt.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:c}})}function n(d,c){return (0, u.makeIssue)({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, wt.getErrorMap)(),wt.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof oe){let d=this;return (0, u.OK)(async function(...c){let l=new p.ZodError([]),f=await d._def.args.parseAsync(c,a).catch(q=>{throw l.addIssue(s(c,q)),l}),I=await Reflect.apply(i,this,f);return await d._def.returns._def.type.parseAsync(I,a).catch(q=>{throw l.addIssue(n(I,q)),l})})}else {let d=this;return (0, u.OK)(function(...c){let l=d._def.args.safeParse(c,a);if(!l.success)throw new p.ZodError([s(c,l.error)]);let f=Reflect.apply(i,this,l.data),I=d._def.returns.safeParse(f,a);if(!I.success)throw new p.ZodError([n(f,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Y.create(e).rest(H.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||Y.create([]).rest(H.create()),returns:t||H.create(),typeName:_.ZodFunction,...g(s)})}};o.ZodFunction=Nt;var Te=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};o.ZodLazy=Te;Te.create=(r,e)=>new Te({getter:r,typeName:_.ZodLazy,...g(e)});var Ie=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(t,{received:t.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};o.ZodLiteral=Ie;Ie.create=(r,e)=>new Ie({value:r,typeName:_.ZodLiteral,...g(e)});function Os(r,e){return new xe({values:r,typeName:_.ZodEnum,...g(e)})}var xe=class r extends v{constructor(){super(...arguments),Ge.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, u.addIssueToContext)(t,{expected:h.util.joinValues(s),received:t.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(Pt(this,Ge,"f")||vs(this,Ge,new Set(this._def.values),"f"),!Pt(this,Ge,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, u.addIssueToContext)(t,{received:t.data,code:p.ZodIssueCode.invalid_enum_value,options:s}),u.INVALID}return (0, u.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};o.ZodEnum=xe;Ge=new WeakMap;xe.create=Os;var Oe=class extends v{constructor(){super(...arguments),Ye.set(this,void 0);}_parse(e){let t=h.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.ZodParsedType.string&&s.parsedType!==h.ZodParsedType.number){let n=h.util.objectValues(t);return (0, u.addIssueToContext)(s,{expected:h.util.joinValues(n),received:s.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(Pt(this,Ye,"f")||vs(this,Ye,new Set(h.util.getValidEnumValues(this._def.values)),"f"),!Pt(this,Ye,"f").has(e.data)){let n=h.util.objectValues(t);return (0, u.addIssueToContext)(s,{received:s.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return (0, u.OK)(e.data)}get enum(){return this._def.values}};o.ZodNativeEnum=Oe;Ye=new WeakMap;Oe.create=(r,e)=>new Oe({values:r,typeName:_.ZodNativeEnum,...g(e)});var oe=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.promise&&t.common.async===!1)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:t.parsedType}),u.INVALID;let s=t.parsedType===h.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, u.OK)(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};o.ZodPromise=oe;oe.create=(r,e)=>new oe({type:r,typeName:_.ZodPromise,...g(e)});var j=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{(0, u.addIssueToContext)(s,i),i.fatal?t.abort():t.dirty();},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async d=>{if(t.value==="aborted")return u.INVALID;let c=await this._def.schema._parseAsync({data:d,path:s.path,parent:s});return c.status==="aborted"?u.INVALID:c.status==="dirty"||t.value==="dirty"?(0, u.DIRTY)(c.value):c});{if(t.value==="aborted")return u.INVALID;let d=this._def.schema._parseSync({data:i,path:s.path,parent:s});return d.status==="aborted"?u.INVALID:d.status==="dirty"||t.value==="dirty"?(0, u.DIRTY)(d.value):d}}if(n.type==="refinement"){let i=d=>{let c=n.refinement(d,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(s.common.async===!1){let d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return d.status==="aborted"?u.INVALID:(d.status==="dirty"&&t.dirty(),i(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>d.status==="aborted"?u.INVALID:(d.status==="dirty"&&t.dirty(),i(d.value).then(()=>({status:t.value,value:d.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0, u.isValid)(i))return i;let d=n.transform(i.value,a);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:d}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>(0, u.isValid)(i)?Promise.resolve(n.transform(i.value,a)).then(d=>({status:t.value,value:d})):i);h.util.assertNever(n);}};o.ZodEffects=j;o.ZodTransformer=j;j.create=(r,e,t)=>new j({schema:r,typeName:_.ZodEffects,effect:e,...g(t)});j.createWithPreprocess=(r,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...g(t)});var L=class extends v{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0, u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o.ZodOptional=L;L.create=(r,e)=>new L({innerType:r,typeName:_.ZodOptional,...g(e)});var J=class extends v{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0, u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o.ZodNullable=J;J.create=(r,e)=>new J({innerType:r,typeName:_.ZodNullable,...g(e)});var Re=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===h.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};o.ZodDefault=Re;Re.create=(r,e)=>new Re({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var Ee=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return (0, u.isAsync)(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new p.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new p.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};o.ZodCatch=Ee;Ee.create=(r,e)=>new Ee({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var Ue=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:s.parsedType}),u.INVALID}return {status:"valid",value:e.data}}};o.ZodNaN=Ue;Ue.create=r=>new Ue({typeName:_.ZodNaN,...g(r)});o.BRAND=Symbol("zod_brand");var Je=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};o.ZodBranded=Je;var Xe=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return (async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?u.INVALID:a.status==="dirty"?(t.dirty(),(0, u.DIRTY)(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?u.INVALID:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:_.ZodPipeline})}};o.ZodPipeline=Xe;var be=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=n=>((0, u.isValid)(n)&&(n.value=Object.freeze(n.value)),n);return (0, u.isAsync)(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};o.ZodReadonly=be;be.create=(r,e)=>new be({innerType:r,typeName:_.ZodReadonly,...g(e)});function Rs(r,e={},t){return r?ie.create().superRefine((s,n)=>{var a,i;if(!r(s)){let d=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,c=(i=(a=d.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,l=typeof d=="string"?{message:d}:d;n.addIssue({code:"custom",...l,fatal:c});}}):ie.create()}o.custom=Rs;o.late={object:D.lazycreate};var _;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly";})(_=o.ZodFirstPartyTypeKind||(o.ZodFirstPartyTypeKind={}));var Ln=(r,e={message:`Input not instance of ${r.name}`})=>Rs(t=>t instanceof r,e);o.instanceof=Ln;var Es=ae.create;o.string=Es;var bs=pe.create;o.number=bs;var Vn=Ue.create;o.nan=Vn;var $n=fe.create;o.bigint=$n;var ws=he.create;o.boolean=ws;var qn=me.create;o.date=qn;var Fn=Se.create;o.symbol=Fn;var Wn=_e.create;o.undefined=Wn;var Kn=ye.create;o.null=Kn;var zn=ie.create;o.any=zn;var Bn=H.create;o.unknown=Bn;var Gn=W.create;o.never=Gn;var Yn=Ze.create;o.void=Yn;var Jn=ee.create;o.array=Jn;var Xn=D.create;o.object=Xn;var Qn=D.strictCreate;o.strictObject=Qn;var Hn=ge.create;o.union=Hn;var ea=At.create;o.discriminatedUnion=ea;var ta=ve.create;o.intersection=ta;var ra=Y.create;o.tuple=ra;var sa=kt.create;o.record=sa;var na=je.create;o.map=na;var aa=Me.create;o.set=aa;var ia=Nt.create;o.function=ia;var oa=Te.create;o.lazy=oa;var da=Ie.create;o.literal=da;var ua=xe.create;o.enum=ua;var ca=Oe.create;o.nativeEnum=ca;var la=oe.create;o.promise=la;var Ps=j.create;o.effect=Ps;o.transformer=Ps;var pa=L.create;o.optional=pa;var fa=J.create;o.nullable=fa;var ha=j.createWithPreprocess;o.preprocess=ha;var ma=Xe.create;o.pipeline=ma;var _a=()=>Es().optional();o.ostring=_a;var ya=()=>bs().optional();o.onumber=ya;var ga=()=>ws().optional();o.oboolean=ga;o.coerce={string:r=>ae.create({...r,coerce:!0}),number:r=>pe.create({...r,coerce:!0}),boolean:r=>he.create({...r,coerce:!0}),bigint:r=>fe.create({...r,coerce:!0}),date:r=>me.create({...r,coerce:!0})};o.NEVER=u.INVALID;});var Er=y($=>{var va=$&&$.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}});}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t];}),Le=$&&$.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&va(e,r,t);};Object.defineProperty($,"__esModule",{value:!0});Le(bt(),$);Le(xr(),$);Le(_s(),$);Le(Ke(),$);Le(As(),$);Le(Et(),$);});var Ct=y(S=>{var ks=S&&S.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}});}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t];}),Ta=S&&S.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e});}:function(r,e){r.default=e;}),Ia=S&&S.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ks(e,r,t);return Ta(e,r),e},xa=S&&S.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ks(e,r,t);};Object.defineProperty(S,"__esModule",{value:!0});S.z=void 0;var Ns=Ia(Er());S.z=Ns;xa(Er(),S);S.default=Ns;});var br=y(Dt=>{Object.defineProperty(Dt,"__esModule",{value:!0});Dt.parseAnyDef=void 0;function Oa(){return {}}Dt.parseAnyDef=Oa;});var wr=y(Zt=>{Object.defineProperty(Zt,"__esModule",{value:!0});Zt.parseArrayDef=void 0;var Ra=Ct(),St=se(),Ea=P();function ba(r,e){let t={type:"array"};return r.type?._def?.typeName!==Ra.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, Ea.parseDef)(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&(0, St.setResponseValueAndErrors)(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&(0, St.setResponseValueAndErrors)(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&((0, St.setResponseValueAndErrors)(t,"minItems",r.exactLength.value,r.exactLength.message,e),(0, St.setResponseValueAndErrors)(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}Zt.parseArrayDef=ba;});var Pr=y(jt=>{Object.defineProperty(jt,"__esModule",{value:!0});jt.parseBigintDef=void 0;var we=se();function wa(r,e){let t={type:"integer",format:"int64"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?(0, we.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, we.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, we.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, we.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, we.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, we.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, we.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}jt.parseBigintDef=wa;});var Ar=y(Mt=>{Object.defineProperty(Mt,"__esModule",{value:!0});Mt.parseBooleanDef=void 0;function Pa(){return {type:"boolean"}}Mt.parseBooleanDef=Pa;});var kr=y(Ut=>{Object.defineProperty(Ut,"__esModule",{value:!0});Ut.parseBrandedDef=void 0;var Aa=P();function ka(r,e){return (0, Aa.parseDef)(r.type._def,e)}Ut.parseBrandedDef=ka;});var Nr=y(Lt=>{Object.defineProperty(Lt,"__esModule",{value:!0});Lt.parseCatchDef=void 0;var Na=P(),Ca=(r,e)=>(0, Na.parseDef)(r.innerType._def,e);Lt.parseCatchDef=Ca;});var Cr=y(Vt=>{Object.defineProperty(Vt,"__esModule",{value:!0});Vt.parseDateDef=void 0;var Cs=se();function Ds(r,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return {anyOf:s.map((n,a)=>Ds(r,e,n))};switch(s){case"string":case"format:date-time":return {type:"string",format:"date-time"};case"format:date":return {type:"string",format:"date"};case"integer":return Da(r,e)}}Vt.parseDateDef=Ds;var Da=(r,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of r.checks)switch(s.kind){case"min":(0, Cs.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e);break;case"max":(0, Cs.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e);break}return t};});var Dr=y($t=>{Object.defineProperty($t,"__esModule",{value:!0});$t.parseDefaultDef=void 0;var Sa=P();function Za(r,e){return {...(0, Sa.parseDef)(r.innerType._def,e),default:r.defaultValue()}}$t.parseDefaultDef=Za;});var Sr=y(qt=>{Object.defineProperty(qt,"__esModule",{value:!0});qt.parseEffectsDef=void 0;var ja=P();function Ma(r,e){return e.effectStrategy==="input"?(0, ja.parseDef)(r.schema._def,e):{}}qt.parseEffectsDef=Ma;});var Zr=y(Ft=>{Object.defineProperty(Ft,"__esModule",{value:!0});Ft.parseEnumDef=void 0;function Ua(r){return {type:"string",enum:r.values}}Ft.parseEnumDef=Ua;});var jr=y(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseIntersectionDef=void 0;var Ss=P(),La=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function Va(r,e){let t=[(0, Ss.parseDef)(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, Ss.parseDef)(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(a=>!!a),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return t.forEach(a=>{if(La(a))n.push(...a.allOf),a.unevaluatedProperties===void 0&&(s=void 0);else {let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:d,...c}=a;i=c;}else s=void 0;n.push(i);}}),n.length?{allOf:n,...s}:void 0}Wt.parseIntersectionDef=Va;});var Mr=y(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseLiteralDef=void 0;function $a(r,e){let t=typeof r.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(r.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[r.value]}:{type:t==="bigint"?"integer":t,const:r.value}}Kt.parseLiteralDef=$a;});var zt=y(M=>{Object.defineProperty(M,"__esModule",{value:!0});M.parseStringDef=M.zodPatterns=void 0;var Pe=se();M.zodPatterns={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[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}$",ipv4:"^(((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}))$",ipv6:"^(([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})))$",base64:"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$",nanoid:"^[a-zA-Z0-9_-]{21}$"};function qa(r,e){let t={type:"string"};function s(n){return e.patternStrategy==="escape"?Fa(n):n}if(r.checks)for(let n of r.checks)switch(n.kind){case"min":(0, Pe.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e);break;case"max":(0, Pe.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":K(t,"email",n.message,e);break;case"format:idn-email":K(t,"idn-email",n.message,e);break;case"pattern:zod":z(t,M.zodPatterns.email,n.message,e);break}break;case"url":K(t,"uri",n.message,e);break;case"uuid":K(t,"uuid",n.message,e);break;case"regex":z(t,n.regex.source,n.message,e);break;case"cuid":z(t,M.zodPatterns.cuid,n.message,e);break;case"cuid2":z(t,M.zodPatterns.cuid2,n.message,e);break;case"startsWith":z(t,"^"+s(n.value),n.message,e);break;case"endsWith":z(t,s(n.value)+"$",n.message,e);break;case"datetime":K(t,"date-time",n.message,e);break;case"date":K(t,"date",n.message,e);break;case"time":K(t,"time",n.message,e);break;case"duration":K(t,"duration",n.message,e);break;case"length":(0, Pe.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e),(0, Pe.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"includes":{z(t,s(n.value),n.message,e);break}case"ip":{n.version!=="v6"&&K(t,"ipv4",n.message,e),n.version!=="v4"&&K(t,"ipv6",n.message,e);break}case"emoji":z(t,M.zodPatterns.emoji,n.message,e);break;case"ulid":{z(t,M.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{K(t,"binary",n.message,e);break}case"contentEncoding:base64":{(0, Pe.setResponseValueAndErrors)(t,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{z(t,M.zodPatterns.base64,n.message,e);break}}break}case"nanoid":z(t,M.zodPatterns.nanoid,n.message,e);}return t}M.parseStringDef=qa;var Fa=r=>Array.from(r).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),K=(r,e,t,s)=>{r.format||r.anyOf?.some(n=>n.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&s.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):(0, Pe.setResponseValueAndErrors)(r,"format",e,t,s);},z=(r,e,t,s)=>{r.pattern||r.allOf?.some(n=>n.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&s.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:e,...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):(0, Pe.setResponseValueAndErrors)(r,"pattern",e,t,s);};});var Gt=y(Bt=>{Object.defineProperty(Bt,"__esModule",{value:!0});Bt.parseRecordDef=void 0;var Ur=Ct(),Zs=P(),Wa=zt();function Ka(r,e){if(e.target==="openApi3"&&r.keyType?._def.typeName===Ur.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((s,n)=>({...s,[n]:(0, Zs.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, Zs.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===Ur.ZodFirstPartyTypeKind.ZodString&&r.keyType._def.checks?.length){let s=Object.entries((0, Wa.parseStringDef)(r.keyType._def,e)).reduce((n,[a,i])=>a==="type"?n:{...n,[a]:i},{});return {...t,propertyNames:s}}else if(r.keyType?._def.typeName===Ur.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:r.keyType._def.values}};return t}Bt.parseRecordDef=Ka;});var Lr=y(Yt=>{Object.defineProperty(Yt,"__esModule",{value:!0});Yt.parseMapDef=void 0;var js=P(),za=Gt();function Ba(r,e){if(e.mapStrategy==="record")return (0, za.parseRecordDef)(r,e);let t=(0, js.parseDef)(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},s=(0, js.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return {type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}Yt.parseMapDef=Ba;});var Vr=y(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseNativeEnumDef=void 0;function Ga(r){let e=r.values,s=Object.keys(r.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),n=Array.from(new Set(s.map(a=>typeof a)));return {type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:s}}Jt.parseNativeEnumDef=Ga;});var $r=y(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseNeverDef=void 0;function Ya(){return {not:{}}}Xt.parseNeverDef=Ya;});var qr=y(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseNullDef=void 0;function Ja(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Qt.parseNullDef=Ja;});var Ht=y(de=>{Object.defineProperty(de,"__esModule",{value:!0});de.parseUnionDef=de.primitiveMappings=void 0;var Xa=P();de.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Qa(r,e){if(e.target==="openApi3")return Ms(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(s=>s._def.typeName in de.primitiveMappings&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((n,a)=>{let i=de.primitiveMappings[a._def.typeName];return i&&!n.includes(i)?[...n,i]:n},[]);return {type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((n,a)=>{let i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return [...n,i];case"bigint":return [...n,"integer"];case"object":if(a._def.value===null)return [...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(s.length===t.length){let n=s.filter((a,i,d)=>d.indexOf(a)===i);return {type:n.length>1?n:n[0],enum:t.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((s,n)=>[...s,...n._def.values.filter(a=>!s.includes(a))],[])};return Ms(r,e)}de.parseUnionDef=Qa;var Ms=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((s,n)=>(0, Xa.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${n}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};});var Fr=y(er=>{Object.defineProperty(er,"__esModule",{value:!0});er.parseNullableDef=void 0;var Us=P(),Ls=Ht();function Ha(r,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target==="openApi3"?{type:Ls.primitiveMappings[r.innerType._def.typeName],nullable:!0}:{type:[Ls.primitiveMappings[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=(0, Us.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=(0, Us.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}er.parseNullableDef=Ha;});var Wr=y(tr=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.parseNumberDef=void 0;var ue=se();function ei(r,e){let t={type:"number"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"int":t.type="integer",(0, ue.addErrorMessage)(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?(0, ue.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, ue.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, ue.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, ue.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, ue.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, ue.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, ue.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}tr.parseNumberDef=ei;});var zr=y(Ve=>{Object.defineProperty(Ve,"__esModule",{value:!0});Ve.parseObjectDef=Ve.parseObjectDefX=void 0;var Qe=P();function Kr(r,e){return e.removeAdditionalStrategy==="strict"?r.catchall._def.typeName==="ZodNever"?r.unknownKeys!=="strict":(0, Qe.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:r.catchall._def.typeName==="ZodNever"?r.unknownKeys==="passthrough":(0, Qe.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ti(r,e){Object.keys(r.shape()).reduce((s,n)=>{let a=r.shape()[n],i=a.isOptional();i||(a={...a._def.innerSchema});let d=(0, Qe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return d!==void 0&&(s.properties[n]=d,i||(s.required||(s.required=[]),s.required.push(n))),s},{type:"object",properties:{},additionalProperties:Kr(r,e)});let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,a])=>{if(a===void 0||a._def===void 0)return s;let i=(0, Qe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return i===void 0?s:{properties:{...s.properties,[n]:i},required:a.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:Kr(r,e)};return t.required.length||delete t.required,t}Ve.parseObjectDefX=ti;function ri(r,e){let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,a])=>{if(a===void 0||a._def===void 0)return s;let i=(0, Qe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return i===void 0?s:{properties:{...s.properties,[n]:i},required:a.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:Kr(r,e)};return t.required.length||delete t.required,t}Ve.parseObjectDef=ri;});var Br=y(rr=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.parseOptionalDef=void 0;var Vs=P(),si=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, Vs.parseDef)(r.innerType._def,e);let t=(0, Vs.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};rr.parseOptionalDef=si;});var Gr=y(nr=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.parsePipelineDef=void 0;var sr=P(),ni=(r,e)=>{if(e.pipeStrategy==="input")return (0, sr.parseDef)(r.in._def,e);if(e.pipeStrategy==="output")return (0, sr.parseDef)(r.out._def,e);let t=(0, sr.parseDef)(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=(0, sr.parseDef)(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,s].filter(n=>n!==void 0)}};nr.parsePipelineDef=ni;});var Yr=y(ar=>{Object.defineProperty(ar,"__esModule",{value:!0});ar.parsePromiseDef=void 0;var ai=P();function ii(r,e){return (0, ai.parseDef)(r.type._def,e)}ar.parsePromiseDef=ii;});var Jr=y(ir=>{Object.defineProperty(ir,"__esModule",{value:!0});ir.parseSetDef=void 0;var $s=se(),oi=P();function di(r,e){let s={type:"array",uniqueItems:!0,items:(0, oi.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&(0, $s.setResponseValueAndErrors)(s,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&(0, $s.setResponseValueAndErrors)(s,"maxItems",r.maxSize.value,r.maxSize.message,e),s}ir.parseSetDef=di;});var Qr=y(or=>{Object.defineProperty(or,"__esModule",{value:!0});or.parseTupleDef=void 0;var Xr=P();function ui(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,s)=>(0, Xr.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:(0, Xr.parseDef)(r.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,s)=>(0, Xr.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}or.parseTupleDef=ui;});var Hr=y(dr=>{Object.defineProperty(dr,"__esModule",{value:!0});dr.parseUndefinedDef=void 0;function ci(){return {not:{}}}dr.parseUndefinedDef=ci;});var es=y(ur=>{Object.defineProperty(ur,"__esModule",{value:!0});ur.parseUnknownDef=void 0;function li(){return {}}ur.parseUnknownDef=li;});var ts=y(cr=>{Object.defineProperty(cr,"__esModule",{value:!0});cr.parseReadonlyDef=void 0;var pi=P(),fi=(r,e)=>(0, pi.parseDef)(r.innerType._def,e);cr.parseReadonlyDef=fi;});var P=y(lr=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.parseDef=void 0;var x=Ct(),hi=br(),mi=wr(),_i=Pr(),yi=Ar(),gi=kr(),vi=Nr(),Ti=Cr(),Ii=Dr(),xi=Sr(),Oi=Zr(),Ri=jr(),Ei=Mr(),bi=Lr(),wi=Vr(),Pi=$r(),Ai=qr(),ki=Fr(),Ni=Wr(),Ci=zr(),Di=Br(),Si=Gr(),Zi=Yr(),ji=Gt(),Mi=Jr(),Ui=zt(),Li=Qr(),Vi=Hr(),$i=Ht(),qi=es(),Fi=ts(),Wi=Ot();function qs(r,e,t=!1){let s=e.seen.get(r);if(e.override){let i=e.override?.(r,e,s,t);if(i!==Wi.ignoreOverride)return i}if(s&&!t){let i=Ki(s,e);if(i!==void 0)return i}let n={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,n);let a=Bi(r,r.typeName,e);return a&&Gi(r,e,a),n.jsonSchema=a,a}lr.parseDef=qs;var Ki=(r,e)=>{switch(e.$refStrategy){case"root":return {$ref:r.path.join("/")};case"relative":return {$ref:zi(e.currentPath,r.path)};case"none":case"seen":return r.path.length<e.currentPath.length&&r.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},zi=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return [(r.length-t).toString(),...e.slice(t)].join("/")},Bi=(r,e,t)=>{switch(e){case x.ZodFirstPartyTypeKind.ZodString:return (0, Ui.parseStringDef)(r,t);case x.ZodFirstPartyTypeKind.ZodNumber:return (0, Ni.parseNumberDef)(r,t);case x.ZodFirstPartyTypeKind.ZodObject:return (0, Ci.parseObjectDef)(r,t);case x.ZodFirstPartyTypeKind.ZodBigInt:return (0, _i.parseBigintDef)(r,t);case x.ZodFirstPartyTypeKind.ZodBoolean:return (0, yi.parseBooleanDef)();case x.ZodFirstPartyTypeKind.ZodDate:return (0, Ti.parseDateDef)(r,t);case x.ZodFirstPartyTypeKind.ZodUndefined:return (0, Vi.parseUndefinedDef)();case x.ZodFirstPartyTypeKind.ZodNull:return (0, Ai.parseNullDef)(t);case x.ZodFirstPartyTypeKind.ZodArray:return (0, mi.parseArrayDef)(r,t);case x.ZodFirstPartyTypeKind.ZodUnion:case x.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, $i.parseUnionDef)(r,t);case x.ZodFirstPartyTypeKind.ZodIntersection:return (0, Ri.parseIntersectionDef)(r,t);case x.ZodFirstPartyTypeKind.ZodTuple:return (0, Li.parseTupleDef)(r,t);case x.ZodFirstPartyTypeKind.ZodRecord:return (0, ji.parseRecordDef)(r,t);case x.ZodFirstPartyTypeKind.ZodLiteral:return (0, Ei.parseLiteralDef)(r,t);case x.ZodFirstPartyTypeKind.ZodEnum:return (0, Oi.parseEnumDef)(r);case x.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, wi.parseNativeEnumDef)(r);case x.ZodFirstPartyTypeKind.ZodNullable:return (0, ki.parseNullableDef)(r,t);case x.ZodFirstPartyTypeKind.ZodOptional:return (0, Di.parseOptionalDef)(r,t);case x.ZodFirstPartyTypeKind.ZodMap:return (0, bi.parseMapDef)(r,t);case x.ZodFirstPartyTypeKind.ZodSet:return (0, Mi.parseSetDef)(r,t);case x.ZodFirstPartyTypeKind.ZodLazy:return qs(r.getter()._def,t);case x.ZodFirstPartyTypeKind.ZodPromise:return (0, Zi.parsePromiseDef)(r,t);case x.ZodFirstPartyTypeKind.ZodNaN:case x.ZodFirstPartyTypeKind.ZodNever:return (0, Pi.parseNeverDef)();case x.ZodFirstPartyTypeKind.ZodEffects:return (0, xi.parseEffectsDef)(r,t);case x.ZodFirstPartyTypeKind.ZodAny:return (0, hi.parseAnyDef)();case x.ZodFirstPartyTypeKind.ZodUnknown:return (0, qi.parseUnknownDef)();case x.ZodFirstPartyTypeKind.ZodDefault:return (0, Ii.parseDefaultDef)(r,t);case x.ZodFirstPartyTypeKind.ZodBranded:return (0, gi.parseBrandedDef)(r,t);case x.ZodFirstPartyTypeKind.ZodReadonly:return (0, Fi.parseReadonlyDef)(r,t);case x.ZodFirstPartyTypeKind.ZodCatch:return (0, vi.parseCatchDef)(r,t);case x.ZodFirstPartyTypeKind.ZodPipeline:return (0, Si.parsePipelineDef)(r,t);case x.ZodFirstPartyTypeKind.ZodFunction:case x.ZodFirstPartyTypeKind.ZodVoid:case x.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (s=>{})()}},Gi=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);});var rs=y(pr=>{Object.defineProperty(pr,"__esModule",{value:!0});pr.zodToJsonSchema=void 0;var Fs=P(),Yi=gr(),Ji=(r,e)=>{let t=(0, Yi.getRefs)(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[c,l])=>({...d,[c]:(0, Fs.parseDef)(l._def,{...t,currentPath:[...t.basePath,t.definitionPath,c]},!0)??{}}),{}):void 0,n=typeof e=="string"?e:e?.name,a=(0, Fs.parseDef)(r._def,n===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,n]},!1)??{},i=n===void 0?s?{...a,[t.definitionPath]:s}:a:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,n].join("/"),[t.definitionPath]:{...s,[n]:a}};return t.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="jsonSchema2019-09"&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),i};pr.zodToJsonSchema=Ji;});var Ws=y(T=>{var Xi=T&&T.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,n);}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t];}),O=T&&T.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Xi(e,r,t);};Object.defineProperty(T,"__esModule",{value:!0});O(Ot(),T);O(gr(),T);O(se(),T);O(P(),T);O(br(),T);O(wr(),T);O(Pr(),T);O(Ar(),T);O(kr(),T);O(Nr(),T);O(Cr(),T);O(Dr(),T);O(Sr(),T);O(Zr(),T);O(jr(),T);O(Mr(),T);O(Lr(),T);O(Vr(),T);O($r(),T);O(qr(),T);O(Fr(),T);O(Wr(),T);O(zr(),T);O(Br(),T);O(Gr(),T);O(Yr(),T);O(ts(),T);O(Gt(),T);O(Jr(),T);O(zt(),T);O(Qr(),T);O(Hr(),T);O(Ht(),T);O(es(),T);O(rs(),T);var Qi=rs();T.default=Qi.zodToJsonSchema;});var He=(t=>(t.EXECUTE="execute",t.PREVIEW="preview",t))(He||{}),et=(s=>(s.DISCOVER="discover",s.HEALTH_CHECK="health-check",s.CODE="code",s))(et||{});var F=(b=>(b.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",b.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",b.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",b.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",b.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",b.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",b.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",b.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",b.STEP_NOT_FOUND_ERROR="StepNotFoundError",b.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",b.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",b.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",b.EXECUTION_EVENT_DATA_INVALID_ERROR="ExecutionEventDataInvalidError",b.EXECUTION_EVENT_INPUT_INVALID_ERROR="ExecutionEventInputInvalidError",b.EXECUTION_STATE_INPUT_INVALID_ERROR="ExecutionStateInputInvalidError",b.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",b.INVALID_ACTION_ERROR="InvalidActionError",b.MISSING_API_KEY_ERROR="MissingApiKeyError",b.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",b.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",b.SIGNATURE_INVALID_ERROR="SignatureInvalidError",b.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",b.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",b.PLATFORM_ERROR="PlatformError",b.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",b))(F||{});var tt=(s=>(s.POST="POST",s.GET="GET",s.OPTIONS="OPTIONS",s))(tt||{});var X=class extends Error{data},rt=class extends X{statusCode=404},U=class extends X{statusCode=400},te=class extends X{statusCode=401},Ae=class extends X{statusCode=500},st=class extends X{statusCode=409};var nt=class extends U{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},at=class extends U{code="ExecutionEventDataInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`data\`. Please provide the correct event data.`),this.data=t;}},$e=class extends U{code="ExecutionEventInputInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`inputs\`. Please provide the correct event inputs.`),this.data=t;}},it=class extends U{code="ExecutionStateInputInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid input. Please provide the correct step input.`),this.data=s;}},ot=class extends U{code="ExecutionStateOutputInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=s;}},dt=class extends U{code="ExecutionStateResultInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=s;}},ut=class extends U{code="ExecutionProviderOutputInvalidError";constructor(e,t,s,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${s}\` has invalid output. Please provide the correct provider output.`),this.data=n;}};var is=()=>typeof Response<"u"?Response:Xs("cross-fetch").Response;var w={info:r=>ke__default.default.blue(r),warning:r=>ke__default.default.yellow(r),error:r=>ke__default.default.red(r),success:r=>ke__default.default.green(r),underline:r=>ke__default.default.underline(r),bold:r=>ke__default.default.bold(r)},k={SUCCESS:w.success("\u2714"),ERROR:w.error("\u2717"),WARNING:w.warning("\u26A0"),INFO:w.info("\u2139"),ARROW:w.bold("\u2192"),MOCK:w.info("\u25CB"),HYDRATED:w.bold(w.info("\u2192")),STEP:w.info("\u03C3"),ACTION:w.info("\u03B1"),DURATION:w.info("\u0394"),PROVIDER:w.info("\u2699"),OUTPUT:w.info("\u21E2"),INPUT:w.info("\u21E0"),WORKFLOW:w.info("\u03C9"),STATE:w.info("\u03C3"),EXECUTE:w.info("\u03B5"),PREVIEW:w.info("\u03C1")};var yr=r=>Object.values(r).map(e=>`\`${e}\``).join(", "),ct=r=>r.replaceAll(/(\w)(\w*)/g,(e,t,s)=>t.toUpperCase()+s.toLowerCase()).replaceAll(/[\s-]+/g,"");var lt=class extends X{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${yr(tt)}`},qe=class extends U{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${yr(t)}`);}};var pt=class extends Ae{code="PlatformError";message="Something went wrong. Please try again later."};var Fe=class extends st{constructor(e,t){super(`${ct(e)} with id: \`${t}\` already exists. Please use a different id.`);}},re=class extends rt{constructor(e,t){super(`${ct(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Ne=class extends Ae{constructor(e,t){super(`Failed to execute ${ct(e)} with id: \`${t}\`. Please try again later.`);}};var ft=class extends re{code="ProviderNotFoundError";constructor(e){super("provider",e);}},ht=class extends Ne{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var mt=class extends te{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `x-novu-signature` header is correct and try again.");}},_t=class extends te{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `x-novu-signature` header");}},yt=class extends te{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `x-novu-signature` header");}},gt=class extends te{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`x-novu-signature\` header`);}},vt=class extends te{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.apiKey`");}};var Tt=class extends re{code="StepNotFoundError";constructor(e){super("step",e);}};var We=class extends re{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},It=class extends Fe{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var xt=class{ajv;compiledSchemas;constructor(){this.ajv=new Hs__default.default({useDefaults:!0,removeAdditional:"all"}),en__default.default(this.ajv),this.compiledSchemas=new Map;}isSchema(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.oneOf}async validate(e,t){let s=this.compiledSchemas.get(t);return s||(s=this.ajv.compile(t),this.compiledSchemas.set(t,s)),s(e)?{success:!0,data:e}:{success:!1,errors:s.errors.map(a=>({path:a.instancePath,message:a.message}))}}transformToJsonSchema(e){return e}};var fr=class{isSchema(e){return e.safeParseAsync!==void 0}async validate(e,t){let s=t.safeParse(e);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.error.errors.map(n=>({path:`/${n.path.join("/")}`,message:n.message}))}}transformToJsonSchema(e){try{return Ws().zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var Ks=[new fr,new xt],zs=async(r,e)=>{for(let t of Ks)if(t.isSchema(r))return t.validate(e,r);throw new Error("Invalid schema")},Bs=r=>{for(let e of Ks)if(e.isSchema(r))return e.transformToJsonSchema(r);throw new Error("Invalid schema")};var Gs={name:"@novu/framework",version:"0.24.3-alpha.7",description:"The Code-First Notifications Workflow SDK.",main:"./dist/index.js",types:"./dist/index.d.ts",publishConfig:{registry:"https://registry.npmjs.org",access:"public"},private:!1,repository:{type:"git",url:"git+https://github.com/novuhq/novu.git"},files:["dist","README.md"],scripts:{preinstall:"npx only-allow pnpm",test:"vitest","test:watch":"vitest --watch",lint:"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore .",build:"tsup","build:watch":"tsup --watch","$comment:bump:prerelease":"This is a workaround to support `npm version prerelease` with lerna","bump:prerelease":"npm version prerelease --preid=alpha & PID=$!; (sleep 1 && kill -9 $PID) & wait $PID","release:alpha":"pnpm bump:prerelease || pnpm build && npm publish"},keywords:["novu","code-first","workflows","durable","sdk","notifications","email","sms","push","webhooks","next","nuxt","h3","express"],author:"Novu",license:"MIT",exports:{".":{require:"./dist/index.js",import:"./dist/index.js",types:"./dist/index.d.ts"},"./express":{require:"./dist/express.js",import:"./dist/express.js",types:"./dist/express.d.ts"},"./next":{require:"./dist/next.js",import:"./dist/next.js",types:"./dist/next.d.ts"},"./nuxt":{require:"./dist/nuxt.js",import:"./dist/nuxt.js",types:"./dist/nuxt.d.ts"},"./h3":{require:"./dist/h3.js",import:"./dist/h3.js",types:"./dist/h3.d.ts"},"./sveltekit":{require:"./dist/sveltekit.js",import:"./dist/sveltekit.js",types:"./dist/sveltekit.d.ts"},"./remix":{require:"./dist/remix.js",import:"./dist/remix.js",types:"./dist/remix.d.ts"}},devDependencies:{"@sveltejs/kit":"^2.5.10","@types/express":"^4.17.13","@types/json-schema":"^7.0.15","@types/node":"^20.11.20","@vercel/node":"^2.15.9",express:"^4.18.2",h3:"^1.11.1",next:"^13.5.4",prettier:"^3.2.5","ts-node":"^10.9.2",tsup:"^8.0.2",typescript:"^5.3.3",vitest:"^1.2.1",zod:"^3.23.0","zod-to-json-schema":"^3.23.0"},dependencies:{ajv:"^8.12.0","ajv-formats":"^2.1.1","better-ajv-errors":"^1.2.0",chalk:"^4.1.2","cross-fetch":"^4.0.0","json-schema-faker":"^0.5.6","json-schema-to-ts":"^3.0.0",liquidjs:"^10.13.1",ora:"^5.4.1"}};var ss=Gs.version;jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});var mr=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;apiKey;version=ss;strictAuthentication;static NOVU_SIGNATURE_HEADER="x-novu-signature";constructor(e){let t=this.buildOptions(e);this.apiKey=t.apiKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={apiKey:void 0,strictAuthentication:!0};return e?.apiKey!==void 0?t.apiKey=e.apiKey:process.env.NOVU_API_KEY!==void 0&&(t.apiKey=process.env.NOVU_API_KEY),e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(s=>s.workflowId===t.workflowId))throw new It(t.workflowId);this.discoveredWorkflows.push(t);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((s,n)=>s+n.steps.length,0);return {status:"ok",version:ss,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(s=>s.workflowId===e);if(t)return t;throw new We(e)}getStep(e,t){let n=this.getWorkflow(e).steps.find(a=>a.stepId===t);if(n)return n;throw new Tt(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(Bs(e))}async validate(e,t,s,n,a,i,d){let c=await zs(t,e);if(c.success)return c.data;switch(s){case"event":this.throwInvalidEvent(n,a,c.errors);case"step":this.throwInvalidStep(i,n,a,c.errors);case"provider":this.throwInvalidProvider(i,d,n,a,c.errors);default:throw new Error(`Invalid component: '${s}'`)}}throwInvalidProvider(e,t,s,n,a){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(s){case"output":throw new ut(n,e,t,a);default:throw new Error(`Invalid payload type: '${s}'`)}}throwInvalidStep(e,t,s,n){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new ot(s,e,n);case"result":throw new dt(s,e,n);case"input":throw new it(s,e,n);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,s){switch(e){case"input":throw new $e(t,s);case"data":throw new at(t,s);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(s,n,a)=>{let i=this.getStep(e.workflowId,s),d=to(e),c=await this.createStepInputs(i,d),l=e.action==="preview";if(!l&&await this.shouldSkip(a?.skip,c))return t({options:{skip:!0}}),{};let f=this.previewStep.bind(this),I=this.executeStep.bind(this),q=await(l?f:I)(e,{...i,providers:i.providers.map(C=>{let Z=a?.providers?.[C.type];if(!Z)throw new ft(C.type);return {...C,resolve:Z}}),resolve:n});return s===e.stepId&&t(q),q.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let n=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
|
|
18
|
+
var Xs=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var y=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Ot=y(B=>{Object.defineProperty(B,"__esModule",{value:!0});B.getDefaultOptions=B.defaultOptions=B.ignoreOverride=void 0;B.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");B.defaultOptions={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",base64Strategy:"contentEncoding:base64"};var tn=r=>typeof r=="string"?{...B.defaultOptions,name:r}:{...B.defaultOptions,...r};B.getDefaultOptions=tn;});var gr=y(Rt=>{Object.defineProperty(Rt,"__esModule",{value:!0});Rt.getRefs=void 0;var rn=Ot(),sn=r=>{let e=(0, rn.getDefaultOptions)(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return {...e,currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};Rt.getRefs=sn;});var se=y(Ce=>{Object.defineProperty(Ce,"__esModule",{value:!0});Ce.setResponseValueAndErrors=Ce.addErrorMessage=void 0;function us(r,e,t,s){s?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t});}Ce.addErrorMessage=us;function nn(r,e,t,s,n){r[e]=t,us(r,e,s,n);}Ce.setResponseValueAndErrors=nn;});var Ke=y(E=>{Object.defineProperty(E,"__esModule",{value:!0});E.getParsedType=E.ZodParsedType=E.objectUtil=E.util=void 0;var cs;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(d=>typeof n[n[d]]!="number"),i={};for(let d of a)i[d]=n[d];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a;})(cs=E.util||(E.util={}));(function(r){r.mergeShapes=(e,t)=>({...e,...t});})(E.objectUtil||(E.objectUtil={}));E.ZodParsedType=cs.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var on=r=>{switch(typeof r){case"undefined":return E.ZodParsedType.undefined;case"string":return E.ZodParsedType.string;case"number":return isNaN(r)?E.ZodParsedType.nan:E.ZodParsedType.number;case"boolean":return E.ZodParsedType.boolean;case"function":return E.ZodParsedType.function;case"bigint":return E.ZodParsedType.bigint;case"symbol":return E.ZodParsedType.symbol;case"object":return Array.isArray(r)?E.ZodParsedType.array:r===null?E.ZodParsedType.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?E.ZodParsedType.promise:typeof Map<"u"&&r instanceof Map?E.ZodParsedType.map:typeof Set<"u"&&r instanceof Set?E.ZodParsedType.set:typeof Date<"u"&&r instanceof Date?E.ZodParsedType.date:E.ZodParsedType.object;default:return E.ZodParsedType.unknown}};E.getParsedType=on;});var Et=y(ne=>{Object.defineProperty(ne,"__esModule",{value:!0});ne.ZodError=ne.quotelessJson=ne.ZodIssueCode=void 0;var ls=Ke();ne.ZodIssueCode=ls.util.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 dn=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");ne.quotelessJson=dn;var ze=class r extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s];},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s];};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e;}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else {let d=s,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(d[l]=d[l]||{_errors:[]},d[l]._errors.push(t(i))):d[l]=d[l]||{_errors:[]},d=d[l],c++;}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ls.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return {formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};ne.ZodError=ze;ze.create=r=>new ze(r);});var Tr=y(vr=>{Object.defineProperty(vr,"__esModule",{value:!0});var le=Ke(),N=Et(),un=(r,e)=>{let t;switch(r.code){case N.ZodIssueCode.invalid_type:r.received===le.ZodParsedType.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case N.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,le.util.jsonStringifyReplacer)}`;break;case N.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${le.util.joinValues(r.keys,", ")}`;break;case N.ZodIssueCode.invalid_union:t="Invalid input";break;case N.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${le.util.joinValues(r.options)}`;break;case N.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${le.util.joinValues(r.options)}, received '${r.received}'`;break;case N.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case N.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case N.ZodIssueCode.invalid_date:t="Invalid date";break;case N.ZodIssueCode.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:le.util.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case N.ZodIssueCode.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case N.ZodIssueCode.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case N.ZodIssueCode.custom:t="Invalid input";break;case N.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case N.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case N.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,le.util.assertNever(r);}return {message:t}};vr.default=un;});var bt=y(G=>{var cn=G&&G.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(G,"__esModule",{value:!0});G.getErrorMap=G.setErrorMap=G.defaultErrorMap=void 0;var ps=cn(Tr());G.defaultErrorMap=ps.default;var fs=ps.default;function ln(r){fs=r;}G.setErrorMap=ln;function pn(){return fs}G.getErrorMap=pn;});var xr=y(R=>{var fn=R&&R.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(R,"__esModule",{value:!0});R.isAsync=R.isValid=R.isDirty=R.isAborted=R.OK=R.DIRTY=R.INVALID=R.ParseStatus=R.addIssueToContext=R.EMPTY_PATH=R.makeIssue=void 0;var hn=bt(),hs=fn(Tr()),mn=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return {...n,path:a,message:n.message};let d="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)d=l(i,{data:e,defaultError:d}).message;return {...n,path:a,message:d}};R.makeIssue=mn;R.EMPTY_PATH=[];function _n(r,e){let t=(0, hn.getErrorMap)(),s=(0, R.makeIssue)({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===hs.default?void 0:hs.default].filter(n=>!!n)});r.common.issues.push(s);}R.addIssueToContext=_n;var Ir=class r{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return R.INVALID;n.status==="dirty"&&e.dirty(),s.push(n.value);}return {status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,i=await n.value;s.push({key:a,value:i});}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return R.INVALID;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value);}return {status:e.value,value:s}}};R.ParseStatus=Ir;R.INVALID=Object.freeze({status:"aborted"});var yn=r=>({status:"dirty",value:r});R.DIRTY=yn;var gn=r=>({status:"valid",value:r});R.OK=gn;var vn=r=>r.status==="aborted";R.isAborted=vn;var Tn=r=>r.status==="dirty";R.isDirty=Tn;var In=r=>r.status==="valid";R.isValid=In;var xn=r=>typeof Promise<"u"&&r instanceof Promise;R.isAsync=xn;});var _s=y(ms=>{Object.defineProperty(ms,"__esModule",{value:!0});});var ys=y(Be=>{Object.defineProperty(Be,"__esModule",{value:!0});Be.errorUtil=void 0;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message;})(Be.errorUtil||(Be.errorUtil={}));});var As=y(o=>{var Pt=o&&o.__classPrivateFieldGet||function(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)},vs=o&&o.__classPrivateFieldSet||function(r,e,t,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ge,Ye;Object.defineProperty(o,"__esModule",{value:!0});o.boolean=o.bigint=o.array=o.any=o.coerce=o.ZodFirstPartyTypeKind=o.late=o.ZodSchema=o.Schema=o.custom=o.ZodReadonly=o.ZodPipeline=o.ZodBranded=o.BRAND=o.ZodNaN=o.ZodCatch=o.ZodDefault=o.ZodNullable=o.ZodOptional=o.ZodTransformer=o.ZodEffects=o.ZodPromise=o.ZodNativeEnum=o.ZodEnum=o.ZodLiteral=o.ZodLazy=o.ZodFunction=o.ZodSet=o.ZodMap=o.ZodRecord=o.ZodTuple=o.ZodIntersection=o.ZodDiscriminatedUnion=o.ZodUnion=o.ZodObject=o.ZodArray=o.ZodVoid=o.ZodNever=o.ZodUnknown=o.ZodAny=o.ZodNull=o.ZodUndefined=o.ZodSymbol=o.ZodDate=o.ZodBoolean=o.ZodBigInt=o.ZodNumber=o.ZodString=o.datetimeRegex=o.ZodType=void 0;o.NEVER=o.void=o.unknown=o.union=o.undefined=o.tuple=o.transformer=o.symbol=o.string=o.strictObject=o.set=o.record=o.promise=o.preprocess=o.pipeline=o.ostring=o.optional=o.onumber=o.oboolean=o.object=o.number=o.nullable=o.null=o.never=o.nativeEnum=o.nan=o.map=o.literal=o.lazy=o.intersection=o.instanceof=o.function=o.enum=o.effect=o.discriminatedUnion=o.date=void 0;var wt=bt(),m=ys(),u=xr(),h=Ke(),p=Et(),V=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n;}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}},gs=(r,e)=>{if((0, u.isValid)(e))return {success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:!1,get error(){if(this._error)return this._error;let t=new p.ZodError(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return {};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,d)=>{var c,l;let{message:f}=r;return i.code==="invalid_enum_value"?{message:f??d.defaultError}:typeof d.data>"u"?{message:(c=f??s)!==null&&c!==void 0?c:d.defaultError}:i.code!=="invalid_type"?{message:d.defaultError}:{message:(l=f??t)!==null&&l!==void 0?l:d.defaultError}},description:n}}var v=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this);}get description(){return this._def.description}_getType(e){return (0, h.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, u.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, h.getParsedType)(e)},a=this._parseSync({data:e,path:n.path,parent:n});return gs(n,a)}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, h.getParsedType)(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await((0, u.isAsync)(n)?n:Promise.resolve(n));return gs(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),d=()=>a.addIssue({code:p.ZodIssueCode.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(d(),!1)):i?!0:(d(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new j({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return L.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this,this._def)}promise(){return oe.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return ve.create(this,e,this._def)}transform(e){return new j({...g(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Re({...g(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Je({typeName:_.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ee({...g(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};o.ZodType=v;o.Schema=v;o.ZodSchema=v;var Rn=/^c[^\s-]{8,}$/i,En=/^[0-9a-z]+$/,bn=/^[0-9A-HJKMNP-TV-Z]{26}$/,wn=/^[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,Pn=/^[a-z0-9_-]{21}$/i,An=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,kn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Or,Cn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dn=/^(([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})))$/,Sn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ts="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Zn=new RegExp(`^${Ts}$`);function Is(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function jn(r){return new RegExp(`^${Is(r)}$`)}function xs(r){let e=`${Ts}T${Is(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}o.datetimeRegex=xs;function Mn(r,e){return !!((e==="v4"||!e)&&Cn.test(r)||(e==="v6"||!e)&&Dn.test(r))}var ae=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:a.parsedType}),u.INVALID}let s=new u.ParseStatus,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,d=e.data.length<a.value;(i||d)&&(n=this._getOrReturnCtx(e,n),i?(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty());}else if(a.kind==="email")kn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"email",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Or||(Or=new RegExp(Nn,"u")),Or.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")wn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Pn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Rn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")En.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")bn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data);}catch{n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"url",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty();}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?xs(a).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Zn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?jn(a).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?An.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Mn(e.data,a.version)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Sn.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:a.message}),s.dirty()):h.util.assertNever(a);return {status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:p.ZodIssueCode.invalid_string,...m.errorUtil.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errorUtil.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(s=e?.local)!==null&&s!==void 0?s:!1,...m.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,m.errorUtil.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};o.ZodString=ae;ae.create=r=>{var e;return new ae({checks:[],typeName:_.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function Un(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}var pe=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.ZodParsedType.number){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:a.parsedType}),u.INVALID}let s,n=new u.ParseStatus;for(let a of this._def.checks)a.kind==="int"?h.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Un(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.not_finite,message:a.message}),n.dirty()):h.util.assertNever(a);return {status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.errorUtil.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.errorUtil.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&h.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return !0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);}return Number.isFinite(t)&&Number.isFinite(e)}};o.ZodNumber=pe;pe.create=r=>new pe({checks:[],typeName:_.ZodNumber,coerce:r?.coerce||!1,...g(r)});var fe=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.ZodParsedType.bigint){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:a.parsedType}),u.INVALID}let s,n=new u.ParseStatus;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),(0, u.addIssueToContext)(s,{code:p.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):h.util.assertNever(a);return {status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.errorUtil.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.errorUtil.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};o.ZodBigInt=fe;fe.create=r=>{var e;return new fe({checks:[],typeName:_.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var he=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodBoolean=he;he.create=r=>new he({typeName:_.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var me=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:a.parsedType}),u.INVALID}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(a,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let s=new u.ParseStatus,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),(0, u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):h.util.assertNever(a);return {status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};o.ZodDate=me;me.create=r=>new me({checks:[],coerce:r?.coerce||!1,typeName:_.ZodDate,...g(r)});var Se=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodSymbol=Se;Se.create=r=>new Se({typeName:_.ZodSymbol,...g(r)});var _e=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodUndefined=_e;_e.create=r=>new _e({typeName:_.ZodUndefined,...g(r)});var ye=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodNull=ye;ye.create=r=>new ye({typeName:_.ZodNull,...g(r)});var ie=class extends v{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, u.OK)(e.data)}};o.ZodAny=ie;ie.create=r=>new ie({typeName:_.ZodAny,...g(r)});var H=class extends v{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, u.OK)(e.data)}};o.ZodUnknown=H;H.create=r=>new H({typeName:_.ZodUnknown,...g(r)});var W=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:t.parsedType}),u.INVALID}};o.ZodNever=W;W.create=r=>new W({typeName:_.ZodNever,...g(r)});var Ze=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:s.parsedType}),u.INVALID}return (0, u.OK)(e.data)}};o.ZodVoid=Ze;Ze.create=r=>new Ze({typeName:_.ZodVoid,...g(r)});var ee=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.ZodParsedType.array)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:t.parsedType}),u.INVALID;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,d=t.data.length<n.exactLength.value;(i||d)&&((0, u.addIssueToContext)(t,{code:i?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:d?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty());}if(n.minLength!==null&&t.data.length<n.minLength.value&&((0, u.addIssueToContext)(t,{code:p.ZodIssueCode.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&((0, u.addIssueToContext)(t,{code:p.ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,d)=>n.type._parseAsync(new V(t,i,t.path,d)))).then(i=>u.ParseStatus.mergeArray(s,i));let a=[...t.data].map((i,d)=>n.type._parseSync(new V(t,i,t.path,d)));return u.ParseStatus.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:m.errorUtil.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:m.errorUtil.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:m.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};o.ZodArray=ee;ee.create=(r,e)=>new ee({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...g(e)});function De(r){if(r instanceof D){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=L.create(De(s));}return new D({...r._def,shape:()=>e})}else return r instanceof ee?new ee({...r._def,type:De(r.element)}):r instanceof L?L.create(De(r.unwrap())):r instanceof J?J.create(De(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>De(e))):r}var D=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=h.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof W&&this._def.unknownKeys==="strip"))for(let l in n.data)i.includes(l)||d.push(l);let c=[];for(let l of i){let f=a[l],I=n.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new V(n,I,n.path,l)),alwaysSet:l in n.data});}if(this._def.catchall instanceof W){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of d)c.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(l==="strict")d.length>0&&((0, u.addIssueToContext)(n,{code:p.ZodIssueCode.unrecognized_keys,keys:d}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let f of d){let I=n.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new V(n,I,n.path,f)),alwaysSet:f in n.data});}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of c){let I=await f.key,A=await f.value;l.push({key:I,value:A,alwaysSet:f.alwaysSet});}return l}).then(l=>u.ParseStatus.mergeObjectSync(s,l)):u.ParseStatus.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return m.errorUtil.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,d;let c=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(d=m.errorUtil.errToObj(e).message)!==null&&d!==void 0?d:c}:{message:c}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return h.util.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s]);}),new r({...this._def,shape:()=>t})}omit(e){let t={};return h.util.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s]);}),new r({...this._def,shape:()=>t})}deepPartial(){return De(this)}partial(e){let t={};return h.util.objectKeys(this.shape).forEach(s=>{let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional();}),new r({...this._def,shape:()=>t})}required(e){let t={};return h.util.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else {let a=this.shape[s];for(;a instanceof L;)a=a._def.innerType;t[s]=a;}}),new r({...this._def,shape:()=>t})}keyof(){return Os(h.util.objectKeys(this.shape))}};o.ZodObject=D;D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:W.create(),typeName:_.ZodObject,...g(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:W.create(),typeName:_.ZodObject,...g(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:W.create(),typeName:_.ZodObject,...g(e)});var ge=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let d of a)if(d.result.status==="valid")return d.result;for(let d of a)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;let i=a.map(d=>new p.ZodError(d.ctx.common.issues));return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union,unionErrors:i}),u.INVALID}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return {result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:l}),l.common.issues.length&&i.push(l.common.issues);}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let d=i.map(c=>new p.ZodError(c));return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union,unionErrors:d}),u.INVALID}}get options(){return this._def.options}};o.ZodUnion=ge;ge.create=(r,e)=>new ge({options:r,typeName:_.ZodUnion,...g(e)});var Q=r=>r instanceof Te?Q(r.schema):r instanceof j?Q(r.innerType()):r instanceof Ie?[r.value]:r instanceof xe?r.options:r instanceof Oe?h.util.objectValues(r.enum):r instanceof Re?Q(r._def.innerType):r instanceof _e?[void 0]:r instanceof ye?[null]:r instanceof L?[void 0,...Q(r.unwrap())]:r instanceof J?[null,...Q(r.unwrap())]:r instanceof Je||r instanceof be?Q(r.unwrap()):r instanceof Ee?Q(r._def.innerType):[],At=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.object)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:t.parsedType}),u.INVALID;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):((0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=Q(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let d of i){if(n.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);n.set(d,a);}}return new r({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}};o.ZodDiscriminatedUnion=At;function Rr(r,e){let t=(0, h.getParsedType)(r),s=(0, h.getParsedType)(e);if(r===e)return {valid:!0,data:r};if(t===h.ZodParsedType.object&&s===h.ZodParsedType.object){let n=h.util.objectKeys(e),a=h.util.objectKeys(r).filter(d=>n.indexOf(d)!==-1),i={...r,...e};for(let d of a){let c=Rr(r[d],e[d]);if(!c.valid)return {valid:!1};i[d]=c.data;}return {valid:!0,data:i}}else if(t===h.ZodParsedType.array&&s===h.ZodParsedType.array){if(r.length!==e.length)return {valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],d=e[a],c=Rr(i,d);if(!c.valid)return {valid:!1};n.push(c.data);}return {valid:!0,data:n}}else return t===h.ZodParsedType.date&&s===h.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ve=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if((0, u.isAborted)(a)||(0, u.isAborted)(i))return u.INVALID;let d=Rr(a.value,i.value);return d.valid?(((0, u.isDirty)(a)||(0, u.isDirty)(i))&&t.dirty(),{status:t.value,value:d.data}):((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};o.ZodIntersection=ve;ve.create=(r,e,t)=>new ve({left:r,right:e,typeName:_.ZodIntersection,...g(t)});var Y=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.array)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:s.parsedType}),u.INVALID;if(s.data.length<this._def.items.length)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,d)=>{let c=this._def.items[d]||this._def.rest;return c?c._parse(new V(s,i,s.path,d)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>u.ParseStatus.mergeArray(t,i)):u.ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};o.ZodTuple=Y;Y.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y({items:r,typeName:_.ZodTuple,rest:null,...g(e)})};var kt=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.object)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:s.parsedType}),u.INVALID;let n=[],a=this._def.keyType,i=this._def.valueType;for(let d in s.data)n.push({key:a._parse(new V(s,d,s.path,d)),value:i._parse(new V(s,s.data[d],s.path,d)),alwaysSet:d in s.data});return s.common.async?u.ParseStatus.mergeObjectAsync(t,n):u.ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new r({keyType:e,valueType:t,typeName:_.ZodRecord,...g(s)}):new r({keyType:ae.create(),valueType:e,typeName:_.ZodRecord,...g(t)})}};o.ZodRecord=kt;var je=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.map)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:s.parsedType}),u.INVALID;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([d,c],l)=>({key:n._parse(new V(s,d,s.path,[l,"key"])),value:a._parse(new V(s,c,s.path,[l,"value"]))}));if(s.common.async){let d=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),d.set(l.value,f.value);}return {status:t.value,value:d}})}else {let d=new Map;for(let c of i){let l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),d.set(l.value,f.value);}return {status:t.value,value:d}}}};o.ZodMap=je;je.create=(r,e,t)=>new je({valueType:e,keyType:r,typeName:_.ZodMap,...g(t)});var Me=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.ZodParsedType.set)return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:s.parsedType}),u.INVALID;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&((0, u.addIssueToContext)(s,{code:p.ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(c){let l=new Set;for(let f of c){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&t.dirty(),l.add(f.value);}return {status:t.value,value:l}}let d=[...s.data.values()].map((c,l)=>a._parse(new V(s,c,s.path,l)));return s.common.async?Promise.all(d).then(c=>i(c)):i(d)}min(e,t){return new r({...this._def,minSize:{value:e,message:m.errorUtil.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:m.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o.ZodSet=Me;Me.create=(r,e)=>new Me({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...g(e)});var Nt=class r extends v{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.function)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:t.parsedType}),u.INVALID;function s(d,c){return (0, u.makeIssue)({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, wt.getErrorMap)(),wt.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:c}})}function n(d,c){return (0, u.makeIssue)({data:d,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, wt.getErrorMap)(),wt.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof oe){let d=this;return (0, u.OK)(async function(...c){let l=new p.ZodError([]),f=await d._def.args.parseAsync(c,a).catch(q=>{throw l.addIssue(s(c,q)),l}),I=await Reflect.apply(i,this,f);return await d._def.returns._def.type.parseAsync(I,a).catch(q=>{throw l.addIssue(n(I,q)),l})})}else {let d=this;return (0, u.OK)(function(...c){let l=d._def.args.safeParse(c,a);if(!l.success)throw new p.ZodError([s(c,l.error)]);let f=Reflect.apply(i,this,l.data),I=d._def.returns.safeParse(f,a);if(!I.success)throw new p.ZodError([n(f,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Y.create(e).rest(H.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||Y.create([]).rest(H.create()),returns:t||H.create(),typeName:_.ZodFunction,...g(s)})}};o.ZodFunction=Nt;var Te=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};o.ZodLazy=Te;Te.create=(r,e)=>new Te({getter:r,typeName:_.ZodLazy,...g(e)});var Ie=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(t,{received:t.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};o.ZodLiteral=Ie;Ie.create=(r,e)=>new Ie({value:r,typeName:_.ZodLiteral,...g(e)});function Os(r,e){return new xe({values:r,typeName:_.ZodEnum,...g(e)})}var xe=class r extends v{constructor(){super(...arguments),Ge.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, u.addIssueToContext)(t,{expected:h.util.joinValues(s),received:t.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(Pt(this,Ge,"f")||vs(this,Ge,new Set(this._def.values),"f"),!Pt(this,Ge,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, u.addIssueToContext)(t,{received:t.data,code:p.ZodIssueCode.invalid_enum_value,options:s}),u.INVALID}return (0, u.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};o.ZodEnum=xe;Ge=new WeakMap;xe.create=Os;var Oe=class extends v{constructor(){super(...arguments),Ye.set(this,void 0);}_parse(e){let t=h.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.ZodParsedType.string&&s.parsedType!==h.ZodParsedType.number){let n=h.util.objectValues(t);return (0, u.addIssueToContext)(s,{expected:h.util.joinValues(n),received:s.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(Pt(this,Ye,"f")||vs(this,Ye,new Set(h.util.getValidEnumValues(this._def.values)),"f"),!Pt(this,Ye,"f").has(e.data)){let n=h.util.objectValues(t);return (0, u.addIssueToContext)(s,{received:s.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return (0, u.OK)(e.data)}get enum(){return this._def.values}};o.ZodNativeEnum=Oe;Ye=new WeakMap;Oe.create=(r,e)=>new Oe({values:r,typeName:_.ZodNativeEnum,...g(e)});var oe=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.promise&&t.common.async===!1)return (0, u.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:t.parsedType}),u.INVALID;let s=t.parsedType===h.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, u.OK)(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};o.ZodPromise=oe;oe.create=(r,e)=>new oe({type:r,typeName:_.ZodPromise,...g(e)});var j=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{(0, u.addIssueToContext)(s,i),i.fatal?t.abort():t.dirty();},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async d=>{if(t.value==="aborted")return u.INVALID;let c=await this._def.schema._parseAsync({data:d,path:s.path,parent:s});return c.status==="aborted"?u.INVALID:c.status==="dirty"||t.value==="dirty"?(0, u.DIRTY)(c.value):c});{if(t.value==="aborted")return u.INVALID;let d=this._def.schema._parseSync({data:i,path:s.path,parent:s});return d.status==="aborted"?u.INVALID:d.status==="dirty"||t.value==="dirty"?(0, u.DIRTY)(d.value):d}}if(n.type==="refinement"){let i=d=>{let c=n.refinement(d,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(s.common.async===!1){let d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return d.status==="aborted"?u.INVALID:(d.status==="dirty"&&t.dirty(),i(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>d.status==="aborted"?u.INVALID:(d.status==="dirty"&&t.dirty(),i(d.value).then(()=>({status:t.value,value:d.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0, u.isValid)(i))return i;let d=n.transform(i.value,a);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:d}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>(0, u.isValid)(i)?Promise.resolve(n.transform(i.value,a)).then(d=>({status:t.value,value:d})):i);h.util.assertNever(n);}};o.ZodEffects=j;o.ZodTransformer=j;j.create=(r,e,t)=>new j({schema:r,typeName:_.ZodEffects,effect:e,...g(t)});j.createWithPreprocess=(r,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...g(t)});var L=class extends v{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0, u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o.ZodOptional=L;L.create=(r,e)=>new L({innerType:r,typeName:_.ZodOptional,...g(e)});var J=class extends v{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0, u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o.ZodNullable=J;J.create=(r,e)=>new J({innerType:r,typeName:_.ZodNullable,...g(e)});var Re=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===h.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};o.ZodDefault=Re;Re.create=(r,e)=>new Re({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var Ee=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return (0, u.isAsync)(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new p.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new p.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};o.ZodCatch=Ee;Ee.create=(r,e)=>new Ee({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var Ue=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let s=this._getOrReturnCtx(e);return (0, u.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:s.parsedType}),u.INVALID}return {status:"valid",value:e.data}}};o.ZodNaN=Ue;Ue.create=r=>new Ue({typeName:_.ZodNaN,...g(r)});o.BRAND=Symbol("zod_brand");var Je=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};o.ZodBranded=Je;var Xe=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return (async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?u.INVALID:a.status==="dirty"?(t.dirty(),(0, u.DIRTY)(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?u.INVALID:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:_.ZodPipeline})}};o.ZodPipeline=Xe;var be=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=n=>((0, u.isValid)(n)&&(n.value=Object.freeze(n.value)),n);return (0, u.isAsync)(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};o.ZodReadonly=be;be.create=(r,e)=>new be({innerType:r,typeName:_.ZodReadonly,...g(e)});function Rs(r,e={},t){return r?ie.create().superRefine((s,n)=>{var a,i;if(!r(s)){let d=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,c=(i=(a=d.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,l=typeof d=="string"?{message:d}:d;n.addIssue({code:"custom",...l,fatal:c});}}):ie.create()}o.custom=Rs;o.late={object:D.lazycreate};var _;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly";})(_=o.ZodFirstPartyTypeKind||(o.ZodFirstPartyTypeKind={}));var Ln=(r,e={message:`Input not instance of ${r.name}`})=>Rs(t=>t instanceof r,e);o.instanceof=Ln;var Es=ae.create;o.string=Es;var bs=pe.create;o.number=bs;var Vn=Ue.create;o.nan=Vn;var $n=fe.create;o.bigint=$n;var ws=he.create;o.boolean=ws;var qn=me.create;o.date=qn;var Fn=Se.create;o.symbol=Fn;var Wn=_e.create;o.undefined=Wn;var Kn=ye.create;o.null=Kn;var zn=ie.create;o.any=zn;var Bn=H.create;o.unknown=Bn;var Gn=W.create;o.never=Gn;var Yn=Ze.create;o.void=Yn;var Jn=ee.create;o.array=Jn;var Xn=D.create;o.object=Xn;var Qn=D.strictCreate;o.strictObject=Qn;var Hn=ge.create;o.union=Hn;var ea=At.create;o.discriminatedUnion=ea;var ta=ve.create;o.intersection=ta;var ra=Y.create;o.tuple=ra;var sa=kt.create;o.record=sa;var na=je.create;o.map=na;var aa=Me.create;o.set=aa;var ia=Nt.create;o.function=ia;var oa=Te.create;o.lazy=oa;var da=Ie.create;o.literal=da;var ua=xe.create;o.enum=ua;var ca=Oe.create;o.nativeEnum=ca;var la=oe.create;o.promise=la;var Ps=j.create;o.effect=Ps;o.transformer=Ps;var pa=L.create;o.optional=pa;var fa=J.create;o.nullable=fa;var ha=j.createWithPreprocess;o.preprocess=ha;var ma=Xe.create;o.pipeline=ma;var _a=()=>Es().optional();o.ostring=_a;var ya=()=>bs().optional();o.onumber=ya;var ga=()=>ws().optional();o.oboolean=ga;o.coerce={string:r=>ae.create({...r,coerce:!0}),number:r=>pe.create({...r,coerce:!0}),boolean:r=>he.create({...r,coerce:!0}),bigint:r=>fe.create({...r,coerce:!0}),date:r=>me.create({...r,coerce:!0})};o.NEVER=u.INVALID;});var Er=y($=>{var va=$&&$.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}});}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t];}),Le=$&&$.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&va(e,r,t);};Object.defineProperty($,"__esModule",{value:!0});Le(bt(),$);Le(xr(),$);Le(_s(),$);Le(Ke(),$);Le(As(),$);Le(Et(),$);});var Ct=y(S=>{var ks=S&&S.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}});}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t];}),Ta=S&&S.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e});}:function(r,e){r.default=e;}),Ia=S&&S.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ks(e,r,t);return Ta(e,r),e},xa=S&&S.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ks(e,r,t);};Object.defineProperty(S,"__esModule",{value:!0});S.z=void 0;var Ns=Ia(Er());S.z=Ns;xa(Er(),S);S.default=Ns;});var br=y(Dt=>{Object.defineProperty(Dt,"__esModule",{value:!0});Dt.parseAnyDef=void 0;function Oa(){return {}}Dt.parseAnyDef=Oa;});var wr=y(Zt=>{Object.defineProperty(Zt,"__esModule",{value:!0});Zt.parseArrayDef=void 0;var Ra=Ct(),St=se(),Ea=P();function ba(r,e){let t={type:"array"};return r.type?._def?.typeName!==Ra.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, Ea.parseDef)(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&(0, St.setResponseValueAndErrors)(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&(0, St.setResponseValueAndErrors)(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&((0, St.setResponseValueAndErrors)(t,"minItems",r.exactLength.value,r.exactLength.message,e),(0, St.setResponseValueAndErrors)(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}Zt.parseArrayDef=ba;});var Pr=y(jt=>{Object.defineProperty(jt,"__esModule",{value:!0});jt.parseBigintDef=void 0;var we=se();function wa(r,e){let t={type:"integer",format:"int64"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?(0, we.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, we.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, we.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, we.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, we.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, we.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, we.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}jt.parseBigintDef=wa;});var Ar=y(Mt=>{Object.defineProperty(Mt,"__esModule",{value:!0});Mt.parseBooleanDef=void 0;function Pa(){return {type:"boolean"}}Mt.parseBooleanDef=Pa;});var kr=y(Ut=>{Object.defineProperty(Ut,"__esModule",{value:!0});Ut.parseBrandedDef=void 0;var Aa=P();function ka(r,e){return (0, Aa.parseDef)(r.type._def,e)}Ut.parseBrandedDef=ka;});var Nr=y(Lt=>{Object.defineProperty(Lt,"__esModule",{value:!0});Lt.parseCatchDef=void 0;var Na=P(),Ca=(r,e)=>(0, Na.parseDef)(r.innerType._def,e);Lt.parseCatchDef=Ca;});var Cr=y(Vt=>{Object.defineProperty(Vt,"__esModule",{value:!0});Vt.parseDateDef=void 0;var Cs=se();function Ds(r,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return {anyOf:s.map((n,a)=>Ds(r,e,n))};switch(s){case"string":case"format:date-time":return {type:"string",format:"date-time"};case"format:date":return {type:"string",format:"date"};case"integer":return Da(r,e)}}Vt.parseDateDef=Ds;var Da=(r,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of r.checks)switch(s.kind){case"min":(0, Cs.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e);break;case"max":(0, Cs.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e);break}return t};});var Dr=y($t=>{Object.defineProperty($t,"__esModule",{value:!0});$t.parseDefaultDef=void 0;var Sa=P();function Za(r,e){return {...(0, Sa.parseDef)(r.innerType._def,e),default:r.defaultValue()}}$t.parseDefaultDef=Za;});var Sr=y(qt=>{Object.defineProperty(qt,"__esModule",{value:!0});qt.parseEffectsDef=void 0;var ja=P();function Ma(r,e){return e.effectStrategy==="input"?(0, ja.parseDef)(r.schema._def,e):{}}qt.parseEffectsDef=Ma;});var Zr=y(Ft=>{Object.defineProperty(Ft,"__esModule",{value:!0});Ft.parseEnumDef=void 0;function Ua(r){return {type:"string",enum:r.values}}Ft.parseEnumDef=Ua;});var jr=y(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseIntersectionDef=void 0;var Ss=P(),La=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function Va(r,e){let t=[(0, Ss.parseDef)(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, Ss.parseDef)(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(a=>!!a),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return t.forEach(a=>{if(La(a))n.push(...a.allOf),a.unevaluatedProperties===void 0&&(s=void 0);else {let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:d,...c}=a;i=c;}else s=void 0;n.push(i);}}),n.length?{allOf:n,...s}:void 0}Wt.parseIntersectionDef=Va;});var Mr=y(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseLiteralDef=void 0;function $a(r,e){let t=typeof r.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(r.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[r.value]}:{type:t==="bigint"?"integer":t,const:r.value}}Kt.parseLiteralDef=$a;});var zt=y(M=>{Object.defineProperty(M,"__esModule",{value:!0});M.parseStringDef=M.zodPatterns=void 0;var Pe=se();M.zodPatterns={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[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}$",ipv4:"^(((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}))$",ipv6:"^(([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})))$",base64:"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$",nanoid:"^[a-zA-Z0-9_-]{21}$"};function qa(r,e){let t={type:"string"};function s(n){return e.patternStrategy==="escape"?Fa(n):n}if(r.checks)for(let n of r.checks)switch(n.kind){case"min":(0, Pe.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e);break;case"max":(0, Pe.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":K(t,"email",n.message,e);break;case"format:idn-email":K(t,"idn-email",n.message,e);break;case"pattern:zod":z(t,M.zodPatterns.email,n.message,e);break}break;case"url":K(t,"uri",n.message,e);break;case"uuid":K(t,"uuid",n.message,e);break;case"regex":z(t,n.regex.source,n.message,e);break;case"cuid":z(t,M.zodPatterns.cuid,n.message,e);break;case"cuid2":z(t,M.zodPatterns.cuid2,n.message,e);break;case"startsWith":z(t,"^"+s(n.value),n.message,e);break;case"endsWith":z(t,s(n.value)+"$",n.message,e);break;case"datetime":K(t,"date-time",n.message,e);break;case"date":K(t,"date",n.message,e);break;case"time":K(t,"time",n.message,e);break;case"duration":K(t,"duration",n.message,e);break;case"length":(0, Pe.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e),(0, Pe.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"includes":{z(t,s(n.value),n.message,e);break}case"ip":{n.version!=="v6"&&K(t,"ipv4",n.message,e),n.version!=="v4"&&K(t,"ipv6",n.message,e);break}case"emoji":z(t,M.zodPatterns.emoji,n.message,e);break;case"ulid":{z(t,M.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{K(t,"binary",n.message,e);break}case"contentEncoding:base64":{(0, Pe.setResponseValueAndErrors)(t,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{z(t,M.zodPatterns.base64,n.message,e);break}}break}case"nanoid":z(t,M.zodPatterns.nanoid,n.message,e);}return t}M.parseStringDef=qa;var Fa=r=>Array.from(r).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),K=(r,e,t,s)=>{r.format||r.anyOf?.some(n=>n.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&s.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):(0, Pe.setResponseValueAndErrors)(r,"format",e,t,s);},z=(r,e,t,s)=>{r.pattern||r.allOf?.some(n=>n.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&s.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:e,...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):(0, Pe.setResponseValueAndErrors)(r,"pattern",e,t,s);};});var Gt=y(Bt=>{Object.defineProperty(Bt,"__esModule",{value:!0});Bt.parseRecordDef=void 0;var Ur=Ct(),Zs=P(),Wa=zt();function Ka(r,e){if(e.target==="openApi3"&&r.keyType?._def.typeName===Ur.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((s,n)=>({...s,[n]:(0, Zs.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, Zs.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===Ur.ZodFirstPartyTypeKind.ZodString&&r.keyType._def.checks?.length){let s=Object.entries((0, Wa.parseStringDef)(r.keyType._def,e)).reduce((n,[a,i])=>a==="type"?n:{...n,[a]:i},{});return {...t,propertyNames:s}}else if(r.keyType?._def.typeName===Ur.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:r.keyType._def.values}};return t}Bt.parseRecordDef=Ka;});var Lr=y(Yt=>{Object.defineProperty(Yt,"__esModule",{value:!0});Yt.parseMapDef=void 0;var js=P(),za=Gt();function Ba(r,e){if(e.mapStrategy==="record")return (0, za.parseRecordDef)(r,e);let t=(0, js.parseDef)(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},s=(0, js.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return {type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}Yt.parseMapDef=Ba;});var Vr=y(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseNativeEnumDef=void 0;function Ga(r){let e=r.values,s=Object.keys(r.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),n=Array.from(new Set(s.map(a=>typeof a)));return {type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:s}}Jt.parseNativeEnumDef=Ga;});var $r=y(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseNeverDef=void 0;function Ya(){return {not:{}}}Xt.parseNeverDef=Ya;});var qr=y(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseNullDef=void 0;function Ja(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Qt.parseNullDef=Ja;});var Ht=y(de=>{Object.defineProperty(de,"__esModule",{value:!0});de.parseUnionDef=de.primitiveMappings=void 0;var Xa=P();de.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Qa(r,e){if(e.target==="openApi3")return Ms(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(s=>s._def.typeName in de.primitiveMappings&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((n,a)=>{let i=de.primitiveMappings[a._def.typeName];return i&&!n.includes(i)?[...n,i]:n},[]);return {type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((n,a)=>{let i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return [...n,i];case"bigint":return [...n,"integer"];case"object":if(a._def.value===null)return [...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(s.length===t.length){let n=s.filter((a,i,d)=>d.indexOf(a)===i);return {type:n.length>1?n:n[0],enum:t.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((s,n)=>[...s,...n._def.values.filter(a=>!s.includes(a))],[])};return Ms(r,e)}de.parseUnionDef=Qa;var Ms=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((s,n)=>(0, Xa.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${n}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};});var Fr=y(er=>{Object.defineProperty(er,"__esModule",{value:!0});er.parseNullableDef=void 0;var Us=P(),Ls=Ht();function Ha(r,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target==="openApi3"?{type:Ls.primitiveMappings[r.innerType._def.typeName],nullable:!0}:{type:[Ls.primitiveMappings[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=(0, Us.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=(0, Us.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}er.parseNullableDef=Ha;});var Wr=y(tr=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.parseNumberDef=void 0;var ue=se();function ei(r,e){let t={type:"number"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"int":t.type="integer",(0, ue.addErrorMessage)(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?(0, ue.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, ue.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, ue.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, ue.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, ue.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, ue.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, ue.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}tr.parseNumberDef=ei;});var zr=y(Ve=>{Object.defineProperty(Ve,"__esModule",{value:!0});Ve.parseObjectDef=Ve.parseObjectDefX=void 0;var Qe=P();function Kr(r,e){return e.removeAdditionalStrategy==="strict"?r.catchall._def.typeName==="ZodNever"?r.unknownKeys!=="strict":(0, Qe.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:r.catchall._def.typeName==="ZodNever"?r.unknownKeys==="passthrough":(0, Qe.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ti(r,e){Object.keys(r.shape()).reduce((s,n)=>{let a=r.shape()[n],i=a.isOptional();i||(a={...a._def.innerSchema});let d=(0, Qe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return d!==void 0&&(s.properties[n]=d,i||(s.required||(s.required=[]),s.required.push(n))),s},{type:"object",properties:{},additionalProperties:Kr(r,e)});let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,a])=>{if(a===void 0||a._def===void 0)return s;let i=(0, Qe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return i===void 0?s:{properties:{...s.properties,[n]:i},required:a.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:Kr(r,e)};return t.required.length||delete t.required,t}Ve.parseObjectDefX=ti;function ri(r,e){let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,a])=>{if(a===void 0||a._def===void 0)return s;let i=(0, Qe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return i===void 0?s:{properties:{...s.properties,[n]:i},required:a.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:Kr(r,e)};return t.required.length||delete t.required,t}Ve.parseObjectDef=ri;});var Br=y(rr=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.parseOptionalDef=void 0;var Vs=P(),si=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, Vs.parseDef)(r.innerType._def,e);let t=(0, Vs.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};rr.parseOptionalDef=si;});var Gr=y(nr=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.parsePipelineDef=void 0;var sr=P(),ni=(r,e)=>{if(e.pipeStrategy==="input")return (0, sr.parseDef)(r.in._def,e);if(e.pipeStrategy==="output")return (0, sr.parseDef)(r.out._def,e);let t=(0, sr.parseDef)(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=(0, sr.parseDef)(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,s].filter(n=>n!==void 0)}};nr.parsePipelineDef=ni;});var Yr=y(ar=>{Object.defineProperty(ar,"__esModule",{value:!0});ar.parsePromiseDef=void 0;var ai=P();function ii(r,e){return (0, ai.parseDef)(r.type._def,e)}ar.parsePromiseDef=ii;});var Jr=y(ir=>{Object.defineProperty(ir,"__esModule",{value:!0});ir.parseSetDef=void 0;var $s=se(),oi=P();function di(r,e){let s={type:"array",uniqueItems:!0,items:(0, oi.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&(0, $s.setResponseValueAndErrors)(s,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&(0, $s.setResponseValueAndErrors)(s,"maxItems",r.maxSize.value,r.maxSize.message,e),s}ir.parseSetDef=di;});var Qr=y(or=>{Object.defineProperty(or,"__esModule",{value:!0});or.parseTupleDef=void 0;var Xr=P();function ui(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,s)=>(0, Xr.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:(0, Xr.parseDef)(r.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,s)=>(0, Xr.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}or.parseTupleDef=ui;});var Hr=y(dr=>{Object.defineProperty(dr,"__esModule",{value:!0});dr.parseUndefinedDef=void 0;function ci(){return {not:{}}}dr.parseUndefinedDef=ci;});var es=y(ur=>{Object.defineProperty(ur,"__esModule",{value:!0});ur.parseUnknownDef=void 0;function li(){return {}}ur.parseUnknownDef=li;});var ts=y(cr=>{Object.defineProperty(cr,"__esModule",{value:!0});cr.parseReadonlyDef=void 0;var pi=P(),fi=(r,e)=>(0, pi.parseDef)(r.innerType._def,e);cr.parseReadonlyDef=fi;});var P=y(lr=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.parseDef=void 0;var x=Ct(),hi=br(),mi=wr(),_i=Pr(),yi=Ar(),gi=kr(),vi=Nr(),Ti=Cr(),Ii=Dr(),xi=Sr(),Oi=Zr(),Ri=jr(),Ei=Mr(),bi=Lr(),wi=Vr(),Pi=$r(),Ai=qr(),ki=Fr(),Ni=Wr(),Ci=zr(),Di=Br(),Si=Gr(),Zi=Yr(),ji=Gt(),Mi=Jr(),Ui=zt(),Li=Qr(),Vi=Hr(),$i=Ht(),qi=es(),Fi=ts(),Wi=Ot();function qs(r,e,t=!1){let s=e.seen.get(r);if(e.override){let i=e.override?.(r,e,s,t);if(i!==Wi.ignoreOverride)return i}if(s&&!t){let i=Ki(s,e);if(i!==void 0)return i}let n={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,n);let a=Bi(r,r.typeName,e);return a&&Gi(r,e,a),n.jsonSchema=a,a}lr.parseDef=qs;var Ki=(r,e)=>{switch(e.$refStrategy){case"root":return {$ref:r.path.join("/")};case"relative":return {$ref:zi(e.currentPath,r.path)};case"none":case"seen":return r.path.length<e.currentPath.length&&r.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},zi=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return [(r.length-t).toString(),...e.slice(t)].join("/")},Bi=(r,e,t)=>{switch(e){case x.ZodFirstPartyTypeKind.ZodString:return (0, Ui.parseStringDef)(r,t);case x.ZodFirstPartyTypeKind.ZodNumber:return (0, Ni.parseNumberDef)(r,t);case x.ZodFirstPartyTypeKind.ZodObject:return (0, Ci.parseObjectDef)(r,t);case x.ZodFirstPartyTypeKind.ZodBigInt:return (0, _i.parseBigintDef)(r,t);case x.ZodFirstPartyTypeKind.ZodBoolean:return (0, yi.parseBooleanDef)();case x.ZodFirstPartyTypeKind.ZodDate:return (0, Ti.parseDateDef)(r,t);case x.ZodFirstPartyTypeKind.ZodUndefined:return (0, Vi.parseUndefinedDef)();case x.ZodFirstPartyTypeKind.ZodNull:return (0, Ai.parseNullDef)(t);case x.ZodFirstPartyTypeKind.ZodArray:return (0, mi.parseArrayDef)(r,t);case x.ZodFirstPartyTypeKind.ZodUnion:case x.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, $i.parseUnionDef)(r,t);case x.ZodFirstPartyTypeKind.ZodIntersection:return (0, Ri.parseIntersectionDef)(r,t);case x.ZodFirstPartyTypeKind.ZodTuple:return (0, Li.parseTupleDef)(r,t);case x.ZodFirstPartyTypeKind.ZodRecord:return (0, ji.parseRecordDef)(r,t);case x.ZodFirstPartyTypeKind.ZodLiteral:return (0, Ei.parseLiteralDef)(r,t);case x.ZodFirstPartyTypeKind.ZodEnum:return (0, Oi.parseEnumDef)(r);case x.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, wi.parseNativeEnumDef)(r);case x.ZodFirstPartyTypeKind.ZodNullable:return (0, ki.parseNullableDef)(r,t);case x.ZodFirstPartyTypeKind.ZodOptional:return (0, Di.parseOptionalDef)(r,t);case x.ZodFirstPartyTypeKind.ZodMap:return (0, bi.parseMapDef)(r,t);case x.ZodFirstPartyTypeKind.ZodSet:return (0, Mi.parseSetDef)(r,t);case x.ZodFirstPartyTypeKind.ZodLazy:return qs(r.getter()._def,t);case x.ZodFirstPartyTypeKind.ZodPromise:return (0, Zi.parsePromiseDef)(r,t);case x.ZodFirstPartyTypeKind.ZodNaN:case x.ZodFirstPartyTypeKind.ZodNever:return (0, Pi.parseNeverDef)();case x.ZodFirstPartyTypeKind.ZodEffects:return (0, xi.parseEffectsDef)(r,t);case x.ZodFirstPartyTypeKind.ZodAny:return (0, hi.parseAnyDef)();case x.ZodFirstPartyTypeKind.ZodUnknown:return (0, qi.parseUnknownDef)();case x.ZodFirstPartyTypeKind.ZodDefault:return (0, Ii.parseDefaultDef)(r,t);case x.ZodFirstPartyTypeKind.ZodBranded:return (0, gi.parseBrandedDef)(r,t);case x.ZodFirstPartyTypeKind.ZodReadonly:return (0, Fi.parseReadonlyDef)(r,t);case x.ZodFirstPartyTypeKind.ZodCatch:return (0, vi.parseCatchDef)(r,t);case x.ZodFirstPartyTypeKind.ZodPipeline:return (0, Si.parsePipelineDef)(r,t);case x.ZodFirstPartyTypeKind.ZodFunction:case x.ZodFirstPartyTypeKind.ZodVoid:case x.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (s=>{})()}},Gi=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);});var rs=y(pr=>{Object.defineProperty(pr,"__esModule",{value:!0});pr.zodToJsonSchema=void 0;var Fs=P(),Yi=gr(),Ji=(r,e)=>{let t=(0, Yi.getRefs)(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[c,l])=>({...d,[c]:(0, Fs.parseDef)(l._def,{...t,currentPath:[...t.basePath,t.definitionPath,c]},!0)??{}}),{}):void 0,n=typeof e=="string"?e:e?.name,a=(0, Fs.parseDef)(r._def,n===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,n]},!1)??{},i=n===void 0?s?{...a,[t.definitionPath]:s}:a:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,n].join("/"),[t.definitionPath]:{...s,[n]:a}};return t.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="jsonSchema2019-09"&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),i};pr.zodToJsonSchema=Ji;});var Ws=y(T=>{var Xi=T&&T.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,n);}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t];}),O=T&&T.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Xi(e,r,t);};Object.defineProperty(T,"__esModule",{value:!0});O(Ot(),T);O(gr(),T);O(se(),T);O(P(),T);O(br(),T);O(wr(),T);O(Pr(),T);O(Ar(),T);O(kr(),T);O(Nr(),T);O(Cr(),T);O(Dr(),T);O(Sr(),T);O(Zr(),T);O(jr(),T);O(Mr(),T);O(Lr(),T);O(Vr(),T);O($r(),T);O(qr(),T);O(Fr(),T);O(Wr(),T);O(zr(),T);O(Br(),T);O(Gr(),T);O(Yr(),T);O(ts(),T);O(Gt(),T);O(Jr(),T);O(zt(),T);O(Qr(),T);O(Hr(),T);O(Ht(),T);O(es(),T);O(rs(),T);var Qi=rs();T.default=Qi.zodToJsonSchema;});var He=(t=>(t.EXECUTE="execute",t.PREVIEW="preview",t))(He||{}),et=(s=>(s.DISCOVER="discover",s.HEALTH_CHECK="health-check",s.CODE="code",s))(et||{});var F=(b=>(b.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",b.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",b.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",b.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",b.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",b.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",b.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",b.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",b.STEP_NOT_FOUND_ERROR="StepNotFoundError",b.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",b.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",b.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",b.EXECUTION_EVENT_DATA_INVALID_ERROR="ExecutionEventDataInvalidError",b.EXECUTION_EVENT_INPUT_INVALID_ERROR="ExecutionEventInputInvalidError",b.EXECUTION_STATE_INPUT_INVALID_ERROR="ExecutionStateInputInvalidError",b.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",b.INVALID_ACTION_ERROR="InvalidActionError",b.MISSING_API_KEY_ERROR="MissingApiKeyError",b.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",b.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",b.SIGNATURE_INVALID_ERROR="SignatureInvalidError",b.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",b.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",b.PLATFORM_ERROR="PlatformError",b.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",b))(F||{});var tt=(s=>(s.POST="POST",s.GET="GET",s.OPTIONS="OPTIONS",s))(tt||{});var X=class extends Error{data},rt=class extends X{statusCode=404},U=class extends X{statusCode=400},te=class extends X{statusCode=401},Ae=class extends X{statusCode=500},st=class extends X{statusCode=409};var nt=class extends U{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},at=class extends U{code="ExecutionEventDataInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`data\`. Please provide the correct event data.`),this.data=t;}},$e=class extends U{code="ExecutionEventInputInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`inputs\`. Please provide the correct event inputs.`),this.data=t;}},it=class extends U{code="ExecutionStateInputInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid input. Please provide the correct step input.`),this.data=s;}},ot=class extends U{code="ExecutionStateOutputInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=s;}},dt=class extends U{code="ExecutionStateResultInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=s;}},ut=class extends U{code="ExecutionProviderOutputInvalidError";constructor(e,t,s,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${s}\` has invalid output. Please provide the correct provider output.`),this.data=n;}};var is=()=>typeof Response<"u"?Response:Xs("cross-fetch").Response;var w={info:r=>ke__default.default.blue(r),warning:r=>ke__default.default.yellow(r),error:r=>ke__default.default.red(r),success:r=>ke__default.default.green(r),underline:r=>ke__default.default.underline(r),bold:r=>ke__default.default.bold(r)},k={SUCCESS:w.success("\u2714"),ERROR:w.error("\u2717"),WARNING:w.warning("\u26A0"),INFO:w.info("\u2139"),ARROW:w.bold("\u2192"),MOCK:w.info("\u25CB"),HYDRATED:w.bold(w.info("\u2192")),STEP:w.info("\u03C3"),ACTION:w.info("\u03B1"),DURATION:w.info("\u0394"),PROVIDER:w.info("\u2699"),OUTPUT:w.info("\u21E2"),INPUT:w.info("\u21E0"),WORKFLOW:w.info("\u03C9"),STATE:w.info("\u03C3"),EXECUTE:w.info("\u03B5"),PREVIEW:w.info("\u03C1")};var yr=r=>Object.values(r).map(e=>`\`${e}\``).join(", "),ct=r=>r.replaceAll(/(\w)(\w*)/g,(e,t,s)=>t.toUpperCase()+s.toLowerCase()).replaceAll(/[\s-]+/g,"");var lt=class extends X{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${yr(tt)}`},qe=class extends U{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${yr(t)}`);}};var pt=class extends Ae{code="PlatformError";message="Something went wrong. Please try again later."};var Fe=class extends st{constructor(e,t){super(`${ct(e)} with id: \`${t}\` already exists. Please use a different id.`);}},re=class extends rt{constructor(e,t){super(`${ct(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Ne=class extends Ae{constructor(e,t){super(`Failed to execute ${ct(e)} with id: \`${t}\`. Please try again later.`);}};var ft=class extends re{code="ProviderNotFoundError";constructor(e){super("provider",e);}},ht=class extends Ne{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var mt=class extends te{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `x-novu-signature` header is correct and try again.");}},_t=class extends te{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `x-novu-signature` header");}},yt=class extends te{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `x-novu-signature` header");}},gt=class extends te{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`x-novu-signature\` header`);}},vt=class extends te{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.apiKey`");}};var Tt=class extends re{code="StepNotFoundError";constructor(e){super("step",e);}};var We=class extends re{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},It=class extends Fe{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var xt=class{ajv;compiledSchemas;constructor(){this.ajv=new Hs__default.default({useDefaults:!0,removeAdditional:"all"}),en__default.default(this.ajv),this.compiledSchemas=new Map;}isSchema(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.oneOf}async validate(e,t){let s=this.compiledSchemas.get(t);return s||(s=this.ajv.compile(t),this.compiledSchemas.set(t,s)),s(e)?{success:!0,data:e}:{success:!1,errors:s.errors.map(a=>({path:a.instancePath,message:a.message}))}}transformToJsonSchema(e){return e}};var fr=class{isSchema(e){return e.safeParseAsync!==void 0}async validate(e,t){let s=t.safeParse(e);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.error.errors.map(n=>({path:`/${n.path.join("/")}`,message:n.message}))}}transformToJsonSchema(e){try{return Ws().zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var Ks=[new fr,new xt],zs=async(r,e)=>{for(let t of Ks)if(t.isSchema(r))return t.validate(e,r);throw new Error("Invalid schema")},Bs=r=>{for(let e of Ks)if(e.isSchema(r))return e.transformToJsonSchema(r);throw new Error("Invalid schema")};var Gs={name:"@novu/framework",version:"0.24.3-alpha.9",description:"The Code-First Notifications Workflow SDK.",main:"./dist/index.js",types:"./dist/index.d.ts",publishConfig:{registry:"https://registry.npmjs.org",access:"public"},private:!1,repository:{type:"git",url:"git+https://github.com/novuhq/novu.git"},files:["dist","README.md"],scripts:{preinstall:"npx only-allow pnpm",test:"vitest","test:watch":"vitest --watch",lint:"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore .",build:"tsup","build:watch":"tsup --watch","$comment:bump:prerelease":"This is a workaround to support `npm version prerelease` with lerna","bump:prerelease":"npm version prerelease --preid=alpha & PID=$!; (sleep 1 && kill -9 $PID) & wait $PID","release:alpha":"pnpm bump:prerelease || pnpm build && npm publish"},keywords:["novu","code-first","workflows","durable","sdk","notifications","email","sms","push","webhooks","next","nuxt","h3","express"],author:"Novu",license:"MIT",exports:{".":{require:"./dist/index.js",import:"./dist/index.js",types:"./dist/index.d.ts"},"./express":{require:"./dist/express.js",import:"./dist/express.js",types:"./dist/express.d.ts"},"./next":{require:"./dist/next.js",import:"./dist/next.js",types:"./dist/next.d.ts"},"./nuxt":{require:"./dist/nuxt.js",import:"./dist/nuxt.js",types:"./dist/nuxt.d.ts"},"./h3":{require:"./dist/h3.js",import:"./dist/h3.js",types:"./dist/h3.d.ts"},"./sveltekit":{require:"./dist/sveltekit.js",import:"./dist/sveltekit.js",types:"./dist/sveltekit.d.ts"},"./remix":{require:"./dist/remix.js",import:"./dist/remix.js",types:"./dist/remix.d.ts"}},devDependencies:{"@sveltejs/kit":"^2.5.10","@types/express":"^4.17.13","@types/json-schema":"^7.0.15","@types/node":"^20.11.20","@vercel/node":"^2.15.9",express:"^4.18.2",h3:"^1.11.1",next:"^13.5.4",prettier:"^3.2.5","ts-node":"^10.9.2",tsup:"^8.0.2",typescript:"^5.3.3",vitest:"^1.2.1",zod:"^3.23.0","zod-to-json-schema":"^3.23.0"},dependencies:{ajv:"^8.12.0","ajv-formats":"^2.1.1","better-ajv-errors":"^1.2.0",chalk:"^4.1.2","cross-fetch":"^4.0.0","json-schema-faker":"^0.5.6","json-schema-to-ts":"^3.0.0",liquidjs:"^10.13.1",ora:"^5.4.1"}};var ss=Gs.version;jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});var mr=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;apiKey;version=ss;strictAuthentication;static NOVU_SIGNATURE_HEADER="x-novu-signature";constructor(e){let t=this.buildOptions(e);this.apiKey=t.apiKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={apiKey:void 0,strictAuthentication:!0};return e?.apiKey!==void 0?t.apiKey=e.apiKey:process.env.NOVU_API_KEY!==void 0&&(t.apiKey=process.env.NOVU_API_KEY),e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(s=>s.workflowId===t.workflowId))throw new It(t.workflowId);this.discoveredWorkflows.push(t);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((s,n)=>s+n.steps.length,0);return {status:"ok",version:ss,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(s=>s.workflowId===e);if(t)return t;throw new We(e)}getStep(e,t){let n=this.getWorkflow(e).steps.find(a=>a.stepId===t);if(n)return n;throw new Tt(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(Bs(e))}async validate(e,t,s,n,a,i,d){let c=await zs(t,e);if(c.success)return c.data;switch(s){case"event":this.throwInvalidEvent(n,a,c.errors);case"step":this.throwInvalidStep(i,n,a,c.errors);case"provider":this.throwInvalidProvider(i,d,n,a,c.errors);default:throw new Error(`Invalid component: '${s}'`)}}throwInvalidProvider(e,t,s,n,a){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(s){case"output":throw new ut(n,e,t,a);default:throw new Error(`Invalid payload type: '${s}'`)}}throwInvalidStep(e,t,s,n){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new ot(s,e,n);case"result":throw new dt(s,e,n);case"input":throw new it(s,e,n);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,s){switch(e){case"input":throw new $e(t,s);case"data":throw new at(t,s);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(s,n,a)=>{let i=this.getStep(e.workflowId,s),d=to(e),c=await this.createStepInputs(i,d),l=e.action==="preview";if(!l&&await this.shouldSkip(a?.skip,c))return t({options:{skip:!0}}),{};let f=this.previewStep.bind(this),I=this.executeStep.bind(this),q=await(l?f:I)(e,{...i,providers:i.providers.map(C=>{let Z=a?.providers?.[C.type];if(!Z)throw new ft(C.type);return {...C,resolve:Z}}),resolve:n});return s===e.stepId&&t(q),q.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let n=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
|
|
19
19
|
${w.bold(w.underline(n))} '${e.workflowId}'`);let a=this.getWorkflow(e.workflowId),i=process.hrtime(),d={outputs:{},providers:{},options:{}},c,l=new Promise(ce=>{c=ce;}),f=ce=>{c(),d=ce;},I;try{if(e.action==="execute"&&!e.data)throw new $e(e.workflowId,{message:"Event `data` is required"});let ce=await this.createExecutionInputs(e,a);await Promise.race([l,a.execute({payload:ce,environment:{},input:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(e,f),sms:this.executeStepFactory(e,f),inApp:this.executeStepFactory(e,f),digest:this.executeStepFactory(e,f),delay:this.executeStepFactory(e,f),push:this.executeStepFactory(e,f),chat:this.executeStepFactory(e,f),custom:this.executeStepFactory(e,f)}})]);}catch(ce){I=ce;}let A=process.hrtime(i),q=A[0],C=A[1],Z=q*1e3+C/1e6,Ys=I?k.ERROR:k.SUCCESS,Js=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${Ys} ${Js} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Z,I),I)throw I;return {outputs:d.outputs,providers:d.providers,options:d.options,metadata:{status:"success",error:!1,duration:Z}}}async createExecutionInputs(e,t){let s=e.data;if(e.action==="preview"){let a=this.mock(t.data.schema);s=Object.assign(a,s);}return await this.validate(s,t.data.unknownSchema,"event","input",e.workflowId)}prettyPrintExecute(e,t,s){let n=s?k.ERROR:k.SUCCESS,a=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",i=s?"Failed to execute":a,d=s?w.error:w.success,c=`${n} ${i} workflowId: '${e.workflowId}`;console.log(`
|
|
20
20
|
${w.bold(d(c))}'`),console.log(` \u251C ${k.STEP} stepId: '${e.stepId}'`),console.log(` \u251C ${k.ACTION} action: '${e.action}'`),console.log(` \u2514 ${k.DURATION} duration: '${t.toFixed(2)}ms'
|
|
21
21
|
`);}async executeProviders(e,t){return t.providers.reduce(async(s,n)=>{let a=await s,i=this.previewProvider.bind(this),d=this.executeProvider.bind(this),l=await(e.action==="preview"?i:d)(e,t,n);return {...a,[n.type]:l}},Promise.resolve({}))}previewProvider(e,t,s){return console.log(` ${k.MOCK} Mocked provider: \`${s.type}\``),this.mock(s.outputs.schema)}async executeProvider(e,t,s){let n=hr__default.default({indent:2}).start(`Executing provider: \`${s.type}\``);try{if(e.stepId===t.stepId){let a=await this.createStepInputs(t,e),i=await s.resolve({inputs:a}),d=await this.validate(i,s.outputs.unknownSchema,"step","output",e.workflowId,t.stepId,s.type);return n.succeed(`Executed provider: \`${s.type}\``),d}else n.stopAndPersist({symbol:k.HYDRATED,text:`Hydrated provider: \`${s.type}\``});}catch(a){throw n.stopAndPersist({symbol:k.ERROR,text:`Failed to execute provider: \`${s.type}\``}),new ht(`Failed to execute provider: '${s.type}'.
|
package/dist/nuxt.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import { j as SupportedFrameworkName, a as ServeHandlerOptions } from './handler-
|
|
3
|
+
import { j as SupportedFrameworkName, a as ServeHandlerOptions } from './handler-_6lXMYuL.js';
|
|
4
4
|
import 'json-schema-to-ts';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|