@novu/framework 0.24.3-alpha.10 → 0.24.3-alpha.12

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/nuxt.js CHANGED
@@ -5,25 +5,25 @@ var jsonSchemaFaker = require('json-schema-faker');
5
5
  var liquidjs = require('liquidjs');
6
6
  var gr = require('ora');
7
7
  var Ce = require('chalk');
8
- var Xn = require('ajv');
9
- var Qn = require('ajv-formats');
8
+ var Qn = require('ajv');
9
+ var eo = require('ajv-formats');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
13
13
  var gr__default = /*#__PURE__*/_interopDefault(gr);
14
14
  var Ce__default = /*#__PURE__*/_interopDefault(Ce);
15
- var Xn__default = /*#__PURE__*/_interopDefault(Xn);
16
15
  var Qn__default = /*#__PURE__*/_interopDefault(Qn);
16
+ var eo__default = /*#__PURE__*/_interopDefault(eo);
17
17
 
18
- var _=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Et=_(W=>{Object.defineProperty(W,"__esModule",{value:!0});W.getDefaultOptions=W.defaultOptions=W.ignoreOverride=void 0;W.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");W.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",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};var eo=r=>typeof r=="string"?{...W.defaultOptions,name:r}:{...W.defaultOptions,...r};W.getDefaultOptions=eo;});var Sr=_(bt=>{Object.defineProperty(bt,"__esModule",{value:!0});bt.getRefs=void 0;var to=Et(),ro=r=>{let e=(0, to.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}]))}};bt.getRefs=ro;});var te=_(Ne=>{Object.defineProperty(Ne,"__esModule",{value:!0});Ne.setResponseValueAndErrors=Ne.addErrorMessage=void 0;function Ns(r,e,t,s){s?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t});}Ne.addErrorMessage=Ns;function so(r,e,t,s,n){r[e]=t,Ns(r,e,s,n);}Ne.setResponseValueAndErrors=so;});var ze=_(I=>{Object.defineProperty(I,"__esModule",{value:!0});I.getParsedType=I.ZodParsedType=I.objectUtil=I.util=void 0;var ks;(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 o={};for(let a of n)o[a]=a;return o},r.getValidEnumValues=n=>{let o=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),a={};for(let i of o)a[i]=n[i];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(o){return n[o]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&o.push(a);return o},r.find=(n,o)=>{for(let a of n)if(o(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,o=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}r.joinValues=s,r.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o;})(ks=I.util||(I.util={}));(function(r){r.mergeShapes=(e,t)=>({...e,...t});})(I.objectUtil||(I.objectUtil={}));I.ZodParsedType=ks.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var oo=r=>{switch(typeof r){case"undefined":return I.ZodParsedType.undefined;case"string":return I.ZodParsedType.string;case"number":return isNaN(r)?I.ZodParsedType.nan:I.ZodParsedType.number;case"boolean":return I.ZodParsedType.boolean;case"function":return I.ZodParsedType.function;case"bigint":return I.ZodParsedType.bigint;case"symbol":return I.ZodParsedType.symbol;case"object":return Array.isArray(r)?I.ZodParsedType.array:r===null?I.ZodParsedType.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?I.ZodParsedType.promise:typeof Map<"u"&&r instanceof Map?I.ZodParsedType.map:typeof Set<"u"&&r instanceof Set?I.ZodParsedType.set:typeof Date<"u"&&r instanceof Date?I.ZodParsedType.date:I.ZodParsedType.object;default:return I.ZodParsedType.unknown}};I.getParsedType=oo;});var Pt=_(re=>{Object.defineProperty(re,"__esModule",{value:!0});re.ZodError=re.quotelessJson=re.ZodIssueCode=void 0;var Ds=ze();re.ZodIssueCode=Ds.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 ao=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");re.quotelessJson=ao;var He=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(o){return o.message},s={_errors:[]},n=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else {let i=s,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(a))):i[l]=i[l]||{_errors:[]},i=i[l],u++;}}};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,Ds.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()}};re.ZodError=He;He.create=r=>new He(r);});var kr=_(Nr=>{Object.defineProperty(Nr,"__esModule",{value:!0});var ue=ze(),C=Pt(),io=(r,e)=>{let t;switch(r.code){case C.ZodIssueCode.invalid_type:r.received===ue.ZodParsedType.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case C.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ue.util.jsonStringifyReplacer)}`;break;case C.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${ue.util.joinValues(r.keys,", ")}`;break;case C.ZodIssueCode.invalid_union:t="Invalid input";break;case C.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ue.util.joinValues(r.options)}`;break;case C.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${ue.util.joinValues(r.options)}, received '${r.received}'`;break;case C.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case C.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case C.ZodIssueCode.invalid_date:t="Invalid date";break;case C.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}"`:ue.util.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case C.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 C.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 C.ZodIssueCode.custom:t="Invalid input";break;case C.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case C.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case C.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,ue.util.assertNever(r);}return {message:t}};Nr.default=io;});var At=_(B=>{var co=B&&B.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(B,"__esModule",{value:!0});B.getErrorMap=B.setErrorMap=B.defaultErrorMap=void 0;var Zs=co(kr());B.defaultErrorMap=Zs.default;var js=Zs.default;function uo(r){js=r;}B.setErrorMap=uo;function lo(){return js}B.getErrorMap=lo;});var Zr=_(O=>{var fo=O&&O.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(O,"__esModule",{value:!0});O.isAsync=O.isValid=O.isDirty=O.isAborted=O.OK=O.DIRTY=O.INVALID=O.ParseStatus=O.addIssueToContext=O.EMPTY_PATH=O.makeIssue=void 0;var po=At(),Ms=fo(kr()),ho=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,o=[...t,...n.path||[]],a={...n,path:o};if(n.message!==void 0)return {...n,path:o,message:n.message};let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(a,{data:e,defaultError:i}).message;return {...n,path:o,message:i}};O.makeIssue=ho;O.EMPTY_PATH=[];function mo(r,e){let t=(0, po.getErrorMap)(),s=(0, O.makeIssue)({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Ms.default?void 0:Ms.default].filter(n=>!!n)});r.common.issues.push(s);}O.addIssueToContext=mo;var Dr=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 O.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 o=await n.key,a=await n.value;s.push({key:o,value:a});}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:o,value:a}=n;if(o.status==="aborted"||a.status==="aborted")return O.INVALID;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(s[o.value]=a.value);}return {status:e.value,value:s}}};O.ParseStatus=Dr;O.INVALID=Object.freeze({status:"aborted"});var yo=r=>({status:"dirty",value:r});O.DIRTY=yo;var _o=r=>({status:"valid",value:r});O.OK=_o;var go=r=>r.status==="aborted";O.isAborted=go;var vo=r=>r.status==="dirty";O.isDirty=vo;var wo=r=>r.status==="valid";O.isValid=wo;var To=r=>typeof Promise<"u"&&r instanceof Promise;O.isAsync=To;});var Ls=_(Us=>{Object.defineProperty(Us,"__esModule",{value:!0});});var qs=_(Ge=>{Object.defineProperty(Ge,"__esModule",{value:!0});Ge.errorUtil=void 0;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message;})(Ge.errorUtil||(Ge.errorUtil={}));});var Xs=_(d=>{var St=d&&d.__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)},$s=d&&d.__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},Je,Ye;Object.defineProperty(d,"__esModule",{value:!0});d.boolean=d.bigint=d.array=d.any=d.coerce=d.ZodFirstPartyTypeKind=d.late=d.ZodSchema=d.Schema=d.custom=d.ZodReadonly=d.ZodPipeline=d.ZodBranded=d.BRAND=d.ZodNaN=d.ZodCatch=d.ZodDefault=d.ZodNullable=d.ZodOptional=d.ZodTransformer=d.ZodEffects=d.ZodPromise=d.ZodNativeEnum=d.ZodEnum=d.ZodLiteral=d.ZodLazy=d.ZodFunction=d.ZodSet=d.ZodMap=d.ZodRecord=d.ZodTuple=d.ZodIntersection=d.ZodDiscriminatedUnion=d.ZodUnion=d.ZodObject=d.ZodArray=d.ZodVoid=d.ZodNever=d.ZodUnknown=d.ZodAny=d.ZodNull=d.ZodUndefined=d.ZodSymbol=d.ZodDate=d.ZodBoolean=d.ZodBigInt=d.ZodNumber=d.ZodString=d.datetimeRegex=d.ZodType=void 0;d.NEVER=d.void=d.unknown=d.union=d.undefined=d.tuple=d.transformer=d.symbol=d.string=d.strictObject=d.set=d.record=d.promise=d.preprocess=d.pipeline=d.ostring=d.optional=d.onumber=d.oboolean=d.object=d.number=d.nullable=d.null=d.never=d.nativeEnum=d.nan=d.map=d.literal=d.lazy=d.intersection=d.instanceof=d.function=d.enum=d.effect=d.discriminatedUnion=d.date=void 0;var Ct=At(),m=qs(),c=Zr(),p=ze(),f=Pt(),M=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}},Vs=(r,e)=>{if((0, c.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 f.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:(a,i)=>{var u,l;let{message:h}=r;return a.code==="invalid_enum_value"?{message:h??i.defaultError}:typeof i.data>"u"?{message:(u=h??s)!==null&&u!==void 0?u:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(l=h??t)!==null&&l!==void 0?l:i.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, p.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, p.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new c.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, p.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, c.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, p.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Vs(n,o)}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, p.getParsedType)(e)},n=this._parse({data:e,path:s.path,parent:s}),o=await((0, c.isAsync)(n)?n:Promise.resolve(n));return Vs(s,o)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,o)=>{let a=e(n),i=()=>o.addIssue({code:f.ZodIssueCode.custom,...s(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(i(),!1)):a?!0:(i(),!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 k({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return j.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return oe.create(this,this._def)}or(e){return _e.create([this,e],this._def)}and(e){return ge.create(this,e,this._def)}transform(e){return new k({...g(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Oe({...g(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Xe({typeName:y.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new xe({...g(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Qe.create(this,e)}readonly(){return Ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};d.ZodType=v;d.Schema=v;d.ZodSchema=v;var Oo=/^c[^\s-]{8,}$/i,xo=/^[0-9a-z]+$/,Io=/^[0-9A-HJKMNP-TV-Z]{26}$/,Eo=/^[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,bo=/^[a-z0-9_-]{21}$/i,Po=/^[-+]?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)?)??$/,Ao=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Co="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",jr,So=/^(?:(?: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])$/,No=/^(([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})))$/,ko=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fs="((\\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])))",Do=new RegExp(`^${Fs}$`);function Ws(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 Zo(r){return new RegExp(`^${Ws(r)}$`)}function Bs(r){let e=`${Fs}T${Ws(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}d.datetimeRegex=Bs;function jo(r,e){return !!((e==="v4"||!e)&&So.test(r)||(e==="v6"||!e)&&No.test(r))}var se=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.ZodParsedType.string){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.string,received:o.parsedType}),c.INVALID}let s=new c.ParseStatus,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){let a=e.data.length>o.value,i=e.data.length<o.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),s.dirty());}else if(o.kind==="email")Ao.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"email",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="emoji")jr||(jr=new RegExp(Co,"u")),jr.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="uuid")Eo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="nanoid")bo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid")Oo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid2")xo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="ulid")Io.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"ulid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="url")try{new URL(e.data);}catch{n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"url",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty();}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"regex",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),s.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:{startsWith:o.value},message:o.message}),s.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:o.value},message:o.message}),s.dirty()):o.kind==="datetime"?Bs(o).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:o.message}),s.dirty()):o.kind==="date"?Do.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:"date",message:o.message}),s.dirty()):o.kind==="time"?Zo(o).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:"time",message:o.message}),s.dirty()):o.kind==="duration"?Po.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty()):o.kind==="ip"?jo(e.data,o.version)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty()):o.kind==="base64"?ko.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty()):p.util.assertNever(o);return {status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:f.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}};d.ZodString=se;se.create=r=>{var e;return new se({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function Mo(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,o=parseInt(r.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return o%a/Math.pow(10,n)}var le=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)!==p.ZodParsedType.number){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.number,received:o.parsedType}),c.INVALID}let s,n=new c.ParseStatus;for(let o of this._def.checks)o.kind==="int"?p.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Mo(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.not_finite,message:o.message}),n.dirty()):p.util.assertNever(o);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"&&p.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)}};d.ZodNumber=le;le.create=r=>new le({checks:[],typeName:y.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)!==p.ZodParsedType.bigint){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.bigint,received:o.parsedType}),c.INVALID}let s,n=new c.ParseStatus;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):p.util.assertNever(o);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}};d.ZodBigInt=fe;fe.create=r=>{var e;return new fe({checks:[],typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var pe=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.ZodParsedType.boolean){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.boolean,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodBoolean=pe;pe.create=r=>new pe({typeName:y.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var he=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.ZodParsedType.date){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.date,received:o.parsedType}),c.INVALID}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_date}),c.INVALID}let s=new c.ParseStatus,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),s.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):p.util.assertNever(o);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}};d.ZodDate=he;he.create=r=>new he({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,...g(r)});var De=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.symbol){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.symbol,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodSymbol=De;De.create=r=>new De({typeName:y.ZodSymbol,...g(r)});var me=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.undefined,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodUndefined=me;me.create=r=>new me({typeName:y.ZodUndefined,...g(r)});var ye=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.null){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.null,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodNull=ye;ye.create=r=>new ye({typeName:y.ZodNull,...g(r)});var ne=class extends v{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, c.OK)(e.data)}};d.ZodAny=ne;ne.create=r=>new ne({typeName:y.ZodAny,...g(r)});var J=class extends v{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, c.OK)(e.data)}};d.ZodUnknown=J;J.create=r=>new J({typeName:y.ZodUnknown,...g(r)});var V=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.never,received:t.parsedType}),c.INVALID}};d.ZodNever=V;V.create=r=>new V({typeName:y.ZodNever,...g(r)});var Ze=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.void,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodVoid=Ze;Ze.create=r=>new Ze({typeName:y.ZodVoid,...g(r)});var Y=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==p.ZodParsedType.array)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:t.parsedType}),c.INVALID;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(a||i)&&((0, c.addIssueToContext)(t,{code:a?f.ZodIssueCode.too_big:f.ZodIssueCode.too_small,minimum:i?n.exactLength.value:void 0,maximum:a?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, c.addIssueToContext)(t,{code:f.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, c.addIssueToContext)(t,{code:f.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((a,i)=>n.type._parseAsync(new M(t,a,t.path,i)))).then(a=>c.ParseStatus.mergeArray(s,a));let o=[...t.data].map((a,i)=>n.type._parseSync(new M(t,a,t.path,i)));return c.ParseStatus.mergeArray(s,o)}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)}};d.ZodArray=Y;Y.create=(r,e)=>new Y({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...g(e)});function ke(r){if(r instanceof S){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=j.create(ke(s));}return new S({...r._def,shape:()=>e})}else return r instanceof Y?new Y({...r._def,type:ke(r.element)}):r instanceof j?j.create(ke(r.unwrap())):r instanceof z?z.create(ke(r.unwrap())):r instanceof K?K.create(r.items.map(e=>ke(e))):r}var S=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=p.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.ZodParsedType.object){let l=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(l,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:l.parsedType}),c.INVALID}let{status:s,ctx:n}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||i.push(l);let u=[];for(let l of a){let h=o[l],x=n.data[l];u.push({key:{status:"valid",value:l},value:h._parse(new M(n,x,n.path,l)),alwaysSet:l in n.data});}if(this._def.catchall instanceof V){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of i)u.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(l==="strict")i.length>0&&((0, c.addIssueToContext)(n,{code:f.ZodIssueCode.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let h of i){let x=n.data[h];u.push({key:{status:"valid",value:h},value:l._parse(new M(n,x,n.path,h)),alwaysSet:h in n.data});}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of u){let x=await h.key,L=await h.value;l.push({key:x,value:L,alwaysSet:h.alwaysSet});}return l}).then(l=>c.ParseStatus.mergeObjectSync(s,l)):c.ParseStatus.mergeObjectSync(s,u)}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,o,a,i;let u=(a=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,t,s).message)!==null&&a!==void 0?a:s.defaultError;return t.code==="unrecognized_keys"?{message:(i=m.errorUtil.errToObj(e).message)!==null&&i!==void 0?i:u}:{message:u}}}:{}})}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:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return p.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 p.util.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s]);}),new r({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){let t={};return p.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 p.util.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else {let o=this.shape[s];for(;o instanceof j;)o=o._def.innerType;t[s]=o;}}),new r({...this._def,shape:()=>t})}keyof(){return Ks(p.util.objectKeys(this.shape))}};d.ZodObject=S;S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:V.create(),typeName:y.ZodObject,...g(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:V.create(),typeName:y.ZodObject,...g(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:V.create(),typeName:y.ZodObject,...g(e)});var _e=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(i=>new f.ZodError(i.ctx.common.issues));return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),c.INVALID}if(t.common.async)return Promise.all(s.map(async o=>{let a={...t,common:{...t.common,issues:[]},parent:null};return {result:await o._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let o,a=[];for(let u of s){let l={...t,common:{...t.common,issues:[]},parent:null},h=u._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:l}),l.common.issues.length&&a.push(l.common.issues);}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(u=>new f.ZodError(u));return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:i}),c.INVALID}}get options(){return this._def.options}};d.ZodUnion=_e;_e.create=(r,e)=>new _e({options:r,typeName:y.ZodUnion,...g(e)});var G=r=>r instanceof ve?G(r.schema):r instanceof k?G(r.innerType()):r instanceof we?[r.value]:r instanceof Te?r.options:r instanceof Re?p.util.objectValues(r.enum):r instanceof Oe?G(r._def.innerType):r instanceof me?[void 0]:r instanceof ye?[null]:r instanceof j?[void 0,...G(r.unwrap())]:r instanceof z?[null,...G(r.unwrap())]:r instanceof Xe||r instanceof Ie?G(r.unwrap()):r instanceof xe?G(r._def.innerType):[],Nt=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.ZodParsedType.object)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:t.parsedType}),c.INVALID;let s=this.discriminator,n=t.data[s],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):((0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),c.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 o of t){let a=G(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of a){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o);}}return new r({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}};d.ZodDiscriminatedUnion=Nt;function Mr(r,e){let t=(0, p.getParsedType)(r),s=(0, p.getParsedType)(e);if(r===e)return {valid:!0,data:r};if(t===p.ZodParsedType.object&&s===p.ZodParsedType.object){let n=p.util.objectKeys(e),o=p.util.objectKeys(r).filter(i=>n.indexOf(i)!==-1),a={...r,...e};for(let i of o){let u=Mr(r[i],e[i]);if(!u.valid)return {valid:!1};a[i]=u.data;}return {valid:!0,data:a}}else if(t===p.ZodParsedType.array&&s===p.ZodParsedType.array){if(r.length!==e.length)return {valid:!1};let n=[];for(let o=0;o<r.length;o++){let a=r[o],i=e[o],u=Mr(a,i);if(!u.valid)return {valid:!1};n.push(u.data);}return {valid:!0,data:n}}else return t===p.ZodParsedType.date&&s===p.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ge=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(o,a)=>{if((0, c.isAborted)(o)||(0, c.isAborted)(a))return c.INVALID;let i=Mr(o.value,a.value);return i.valid?(((0, c.isDirty)(o)||(0, c.isDirty)(a))&&t.dirty(),{status:t.value,value:i.data}):((0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_intersection_types}),c.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(([o,a])=>n(o,a)):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}))}};d.ZodIntersection=ge;ge.create=(r,e,t)=>new ge({left:r,right:e,typeName:y.ZodIntersection,...g(t)});var K=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.ZodParsedType.array)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:s.parsedType}),c.INVALID;if(s.data.length<this._def.items.length)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...s.data].map((a,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new M(s,a,s.path,i)):null}).filter(a=>!!a);return s.common.async?Promise.all(o).then(a=>c.ParseStatus.mergeArray(t,a)):c.ParseStatus.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};d.ZodTuple=K;K.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new K({items:r,typeName:y.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!==p.ZodParsedType.object)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:s.parsedType}),c.INVALID;let n=[],o=this._def.keyType,a=this._def.valueType;for(let i in s.data)n.push({key:o._parse(new M(s,i,s.path,i)),value:a._parse(new M(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?c.ParseStatus.mergeObjectAsync(t,n):c.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:y.ZodRecord,...g(s)}):new r({keyType:se.create(),valueType:e,typeName:y.ZodRecord,...g(t)})}};d.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!==p.ZodParsedType.map)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.map,received:s.parsedType}),c.INVALID;let n=this._def.keyType,o=this._def.valueType,a=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new M(s,i,s.path,[l,"key"])),value:o._parse(new M(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,h=await u.value;if(l.status==="aborted"||h.status==="aborted")return c.INVALID;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),i.set(l.value,h.value);}return {status:t.value,value:i}})}else {let i=new Map;for(let u of a){let l=u.key,h=u.value;if(l.status==="aborted"||h.status==="aborted")return c.INVALID;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),i.set(l.value,h.value);}return {status:t.value,value:i}}}};d.ZodMap=je;je.create=(r,e,t)=>new je({valueType:e,keyType:r,typeName:y.ZodMap,...g(t)});var Me=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.ZodParsedType.set)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.set,received:s.parsedType}),c.INVALID;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&((0, c.addIssueToContext)(s,{code:f.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, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let o=this._def.valueType;function a(u){let l=new Set;for(let h of u){if(h.status==="aborted")return c.INVALID;h.status==="dirty"&&t.dirty(),l.add(h.value);}return {status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>o._parse(new M(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>a(u)):a(i)}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)}};d.ZodSet=Me;Me.create=(r,e)=>new Me({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...g(e)});var Dt=class r extends v{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.ZodParsedType.function)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.function,received:t.parsedType}),c.INVALID;function s(i,u){return (0, c.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ct.getErrorMap)(),Ct.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:u}})}function n(i,u){return (0, c.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ct.getErrorMap)(),Ct.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let o={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof oe){let i=this;return (0, c.OK)(async function(...u){let l=new f.ZodError([]),h=await i._def.args.parseAsync(u,o).catch(X=>{throw l.addIssue(s(u,X)),l}),x=await Reflect.apply(a,this,h);return await i._def.returns._def.type.parseAsync(x,o).catch(X=>{throw l.addIssue(n(x,X)),l})})}else {let i=this;return (0, c.OK)(function(...u){let l=i._def.args.safeParse(u,o);if(!l.success)throw new f.ZodError([s(u,l.error)]);let h=Reflect.apply(a,this,l.data),x=i._def.returns.safeParse(h,o);if(!x.success)throw new f.ZodError([n(h,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:K.create(e).rest(J.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||K.create([]).rest(J.create()),returns:t||J.create(),typeName:y.ZodFunction,...g(s)})}};d.ZodFunction=Dt;var ve=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})}};d.ZodLazy=ve;ve.create=(r,e)=>new ve({getter:r,typeName:y.ZodLazy,...g(e)});var we=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),c.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};d.ZodLiteral=we;we.create=(r,e)=>new we({value:r,typeName:y.ZodLiteral,...g(e)});function Ks(r,e){return new Te({values:r,typeName:y.ZodEnum,...g(e)})}var Te=class r extends v{constructor(){super(...arguments),Je.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, c.addIssueToContext)(t,{expected:p.util.joinValues(s),received:t.parsedType,code:f.ZodIssueCode.invalid_type}),c.INVALID}if(St(this,Je,"f")||$s(this,Je,new Set(this._def.values),"f"),!St(this,Je,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, c.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_enum_value,options:s}),c.INVALID}return (0, c.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})}};d.ZodEnum=Te;Je=new WeakMap;Te.create=Ks;var Re=class extends v{constructor(){super(...arguments),Ye.set(this,void 0);}_parse(e){let t=p.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.ZodParsedType.string&&s.parsedType!==p.ZodParsedType.number){let n=p.util.objectValues(t);return (0, c.addIssueToContext)(s,{expected:p.util.joinValues(n),received:s.parsedType,code:f.ZodIssueCode.invalid_type}),c.INVALID}if(St(this,Ye,"f")||$s(this,Ye,new Set(p.util.getValidEnumValues(this._def.values)),"f"),!St(this,Ye,"f").has(e.data)){let n=p.util.objectValues(t);return (0, c.addIssueToContext)(s,{received:s.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),c.INVALID}return (0, c.OK)(e.data)}get enum(){return this._def.values}};d.ZodNativeEnum=Re;Ye=new WeakMap;Re.create=(r,e)=>new Re({values:r,typeName:y.ZodNativeEnum,...g(e)});var oe=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.ZodParsedType.promise&&t.common.async===!1)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.promise,received:t.parsedType}),c.INVALID;let s=t.parsedType===p.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, c.OK)(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};d.ZodPromise=oe;oe.create=(r,e)=>new oe({type:r,typeName:y.ZodPromise,...g(e)});var k=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:a=>{(0, c.addIssueToContext)(s,a),a.fatal?t.abort():t.dirty();},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let a=n.transform(s.data,o);if(s.common.async)return Promise.resolve(a).then(async i=>{if(t.value==="aborted")return c.INVALID;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?c.INVALID:u.status==="dirty"||t.value==="dirty"?(0, c.DIRTY)(u.value):u});{if(t.value==="aborted")return c.INVALID;let i=this._def.schema._parseSync({data:a,path:s.path,parent:s});return i.status==="aborted"?c.INVALID:i.status==="dirty"||t.value==="dirty"?(0, c.DIRTY)(i.value):i}}if(n.type==="refinement"){let a=i=>{let u=n.refinement(i,o);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?c.INVALID:(i.status==="dirty"&&t.dirty(),a(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?c.INVALID:(i.status==="dirty"&&t.dirty(),a(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0, c.isValid)(a))return a;let i=n.transform(a.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>(0, c.isValid)(a)?Promise.resolve(n.transform(a.value,o)).then(i=>({status:t.value,value:i})):a);p.util.assertNever(n);}};d.ZodEffects=k;d.ZodTransformer=k;k.create=(r,e,t)=>new k({schema:r,typeName:y.ZodEffects,effect:e,...g(t)});k.createWithPreprocess=(r,e,t)=>new k({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...g(t)});var j=class extends v{_parse(e){return this._getType(e)===p.ZodParsedType.undefined?(0, c.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};d.ZodOptional=j;j.create=(r,e)=>new j({innerType:r,typeName:y.ZodOptional,...g(e)});var z=class extends v{_parse(e){return this._getType(e)===p.ZodParsedType.null?(0, c.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};d.ZodNullable=z;z.create=(r,e)=>new z({innerType:r,typeName:y.ZodNullable,...g(e)});var Oe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===p.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};d.ZodDefault=Oe;Oe.create=(r,e)=>new Oe({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var xe=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, c.isAsync)(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new f.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new f.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};d.ZodCatch=xe;xe.create=(r,e)=>new xe({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var Ue=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.nan){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.nan,received:s.parsedType}),c.INVALID}return {status:"valid",value:e.data}}};d.ZodNaN=Ue;Ue.create=r=>new Ue({typeName:y.ZodNaN,...g(r)});d.BRAND=Symbol("zod_brand");var Xe=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}};d.ZodBranded=Xe;var Qe=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return (async()=>{let o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?c.INVALID:o.status==="dirty"?(t.dirty(),(0, c.DIRTY)(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?c.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:y.ZodPipeline})}};d.ZodPipeline=Qe;var Ie=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=n=>((0, c.isValid)(n)&&(n.value=Object.freeze(n.value)),n);return (0, c.isAsync)(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};d.ZodReadonly=Ie;Ie.create=(r,e)=>new Ie({innerType:r,typeName:y.ZodReadonly,...g(e)});function zs(r,e={},t){return r?ne.create().superRefine((s,n)=>{var o,a;if(!r(s)){let i=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,u=(a=(o=i.fatal)!==null&&o!==void 0?o:t)!==null&&a!==void 0?a:!0,l=typeof i=="string"?{message:i}:i;n.addIssue({code:"custom",...l,fatal:u});}}):ne.create()}d.custom=zs;d.late={object:S.lazycreate};var y;(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";})(y=d.ZodFirstPartyTypeKind||(d.ZodFirstPartyTypeKind={}));var Uo=(r,e={message:`Input not instance of ${r.name}`})=>zs(t=>t instanceof r,e);d.instanceof=Uo;var Hs=se.create;d.string=Hs;var Gs=le.create;d.number=Gs;var Lo=Ue.create;d.nan=Lo;var qo=fe.create;d.bigint=qo;var Js=pe.create;d.boolean=Js;var Vo=he.create;d.date=Vo;var $o=De.create;d.symbol=$o;var Fo=me.create;d.undefined=Fo;var Wo=ye.create;d.null=Wo;var Bo=ne.create;d.any=Bo;var Ko=J.create;d.unknown=Ko;var zo=V.create;d.never=zo;var Ho=Ze.create;d.void=Ho;var Go=Y.create;d.array=Go;var Jo=S.create;d.object=Jo;var Yo=S.strictCreate;d.strictObject=Yo;var Xo=_e.create;d.union=Xo;var Qo=Nt.create;d.discriminatedUnion=Qo;var ea=ge.create;d.intersection=ea;var ta=K.create;d.tuple=ta;var ra=kt.create;d.record=ra;var sa=je.create;d.map=sa;var na=Me.create;d.set=na;var oa=Dt.create;d.function=oa;var aa=ve.create;d.lazy=aa;var ia=we.create;d.literal=ia;var da=Te.create;d.enum=da;var ca=Re.create;d.nativeEnum=ca;var ua=oe.create;d.promise=ua;var Ys=k.create;d.effect=Ys;d.transformer=Ys;var la=j.create;d.optional=la;var fa=z.create;d.nullable=fa;var pa=k.createWithPreprocess;d.preprocess=pa;var ha=Qe.create;d.pipeline=ha;var ma=()=>Hs().optional();d.ostring=ma;var ya=()=>Gs().optional();d.onumber=ya;var _a=()=>Js().optional();d.oboolean=_a;d.coerce={string:r=>se.create({...r,coerce:!0}),number:r=>le.create({...r,coerce:!0}),boolean:r=>pe.create({...r,coerce:!0}),bigint:r=>fe.create({...r,coerce:!0}),date:r=>he.create({...r,coerce:!0})};d.NEVER=c.INVALID;});var Ur=_(U=>{var ga=U&&U.__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=U&&U.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ga(e,r,t);};Object.defineProperty(U,"__esModule",{value:!0});Le(At(),U);Le(Zr(),U);Le(Ls(),U);Le(ze(),U);Le(Xs(),U);Le(Pt(),U);});var Zt=_(N=>{var Qs=N&&N.__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];}),va=N&&N.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e});}:function(r,e){r.default=e;}),wa=N&&N.__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)&&Qs(e,r,t);return va(e,r),e},Ta=N&&N.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Qs(e,r,t);};Object.defineProperty(N,"__esModule",{value:!0});N.z=void 0;var en=wa(Ur());N.z=en;Ta(Ur(),N);N.default=en;});var Lr=_(jt=>{Object.defineProperty(jt,"__esModule",{value:!0});jt.parseAnyDef=void 0;function Ra(){return {}}jt.parseAnyDef=Ra;});var qr=_(Ut=>{Object.defineProperty(Ut,"__esModule",{value:!0});Ut.parseArrayDef=void 0;var Oa=Zt(),Mt=te(),xa=P();function Ia(r,e){let t={type:"array"};return r.type?._def?.typeName!==Oa.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, xa.parseDef)(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&(0, Mt.setResponseValueAndErrors)(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&(0, Mt.setResponseValueAndErrors)(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&((0, Mt.setResponseValueAndErrors)(t,"minItems",r.exactLength.value,r.exactLength.message,e),(0, Mt.setResponseValueAndErrors)(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}Ut.parseArrayDef=Ia;});var Vr=_(Lt=>{Object.defineProperty(Lt,"__esModule",{value:!0});Lt.parseBigintDef=void 0;var Ee=te();function Ea(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, Ee.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, Ee.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, Ee.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, Ee.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, Ee.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, Ee.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, Ee.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}Lt.parseBigintDef=Ea;});var $r=_(qt=>{Object.defineProperty(qt,"__esModule",{value:!0});qt.parseBooleanDef=void 0;function ba(){return {type:"boolean"}}qt.parseBooleanDef=ba;});var Fr=_(Vt=>{Object.defineProperty(Vt,"__esModule",{value:!0});Vt.parseBrandedDef=void 0;var Pa=P();function Aa(r,e){return (0, Pa.parseDef)(r.type._def,e)}Vt.parseBrandedDef=Aa;});var Wr=_($t=>{Object.defineProperty($t,"__esModule",{value:!0});$t.parseCatchDef=void 0;var Ca=P(),Sa=(r,e)=>(0, Ca.parseDef)(r.innerType._def,e);$t.parseCatchDef=Sa;});var Br=_(Ft=>{Object.defineProperty(Ft,"__esModule",{value:!0});Ft.parseDateDef=void 0;var tn=te();function rn(r,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return {anyOf:s.map((n,o)=>rn(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 Na(r,e)}}Ft.parseDateDef=rn;var Na=(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, tn.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e);break;case"max":(0, tn.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e);break}return t};});var Kr=_(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseDefaultDef=void 0;var ka=P();function Da(r,e){return {...(0, ka.parseDef)(r.innerType._def,e),default:r.defaultValue()}}Wt.parseDefaultDef=Da;});var zr=_(Bt=>{Object.defineProperty(Bt,"__esModule",{value:!0});Bt.parseEffectsDef=void 0;var Za=P();function ja(r,e){return e.effectStrategy==="input"?(0, Za.parseDef)(r.schema._def,e):{}}Bt.parseEffectsDef=ja;});var Hr=_(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseEnumDef=void 0;function Ma(r){return {type:"string",enum:r.values}}Kt.parseEnumDef=Ma;});var Gr=_(zt=>{Object.defineProperty(zt,"__esModule",{value:!0});zt.parseIntersectionDef=void 0;var sn=P(),Ua=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function La(r,e){let t=[(0, sn.parseDef)(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, sn.parseDef)(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return t.forEach(o=>{if(Ua(o))n.push(...o.allOf),o.unevaluatedProperties===void 0&&(s=void 0);else {let a=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:i,...u}=o;a=u;}else s=void 0;n.push(a);}}),n.length?{allOf:n,...s}:void 0}zt.parseIntersectionDef=La;});var Jr=_(Ht=>{Object.defineProperty(Ht,"__esModule",{value:!0});Ht.parseLiteralDef=void 0;function qa(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}}Ht.parseLiteralDef=qa;});var Gt=_(D=>{Object.defineProperty(D,"__esModule",{value:!0});D.parseStringDef=D.zodPatterns=void 0;var be=te();D.zodPatterns={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,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:RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u"),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][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])$/,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 Va(r,e){let t={type:"string"};function s(n){return e.patternStrategy==="escape"?$a(n):n}if(r.checks)for(let n of r.checks)switch(n.kind){case"min":(0, be.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e);break;case"max":(0, be.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":$(t,"email",n.message,e);break;case"format:idn-email":$(t,"idn-email",n.message,e);break;case"pattern:zod":F(t,D.zodPatterns.email,n.message,e);break}break;case"url":$(t,"uri",n.message,e);break;case"uuid":$(t,"uuid",n.message,e);break;case"regex":F(t,n.regex,n.message,e);break;case"cuid":F(t,D.zodPatterns.cuid,n.message,e);break;case"cuid2":F(t,D.zodPatterns.cuid2,n.message,e);break;case"startsWith":F(t,RegExp(`^${s(n.value)}`),n.message,e);break;case"endsWith":F(t,RegExp(`${s(n.value)}$`),n.message,e);break;case"datetime":$(t,"date-time",n.message,e);break;case"date":$(t,"date",n.message,e);break;case"time":$(t,"time",n.message,e);break;case"duration":$(t,"duration",n.message,e);break;case"length":(0, be.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e),(0, be.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"includes":{F(t,RegExp(s(n.value)),n.message,e);break}case"ip":{n.version!=="v6"&&$(t,"ipv4",n.message,e),n.version!=="v4"&&$(t,"ipv6",n.message,e);break}case"emoji":F(t,D.zodPatterns.emoji,n.message,e);break;case"ulid":{F(t,D.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{$(t,"binary",n.message,e);break}case"contentEncoding:base64":{(0, be.setResponseValueAndErrors)(t,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{F(t,D.zodPatterns.base64,n.message,e);break}}break}case"nanoid":F(t,D.zodPatterns.nanoid,n.message,e);}return t}D.parseStringDef=Va;var $a=r=>Array.from(r).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),$=(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, be.setResponseValueAndErrors)(r,"format",e,t,s);},F=(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:nn(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):(0, be.setResponseValueAndErrors)(r,"pattern",nn(e,s),t,s);},nn=(r,e)=>{if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},s=t.i?r.source.toLowerCase():r.source,n="",o=!1,a=!1,i=!1;for(let u=0;u<s.length;u++){if(o){n+=s[u],o=!1;continue}if(t.i){if(a){if(s[u].match(/[a-z]/)){i?(n+=s[u],n+=`${s[u-2]}-${s[u]}`.toUpperCase(),i=!1):s[u+1]==="-"&&s[u+2]?.match(/[a-z]/)?(n+=s[u],i=!0):n+=`${s[u]}${s[u].toUpperCase()}`;continue}}else if(s[u].match(/[a-z]/)){n+=`[${s[u]}${s[u].toUpperCase()}]`;continue}}if(t.m){if(s[u]==="^"){n+=`(^|(?<=[\r
18
+ var _=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Et=_(W=>{Object.defineProperty(W,"__esModule",{value:!0});W.getDefaultOptions=W.defaultOptions=W.ignoreOverride=void 0;W.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");W.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",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};var to=r=>typeof r=="string"?{...W.defaultOptions,name:r}:{...W.defaultOptions,...r};W.getDefaultOptions=to;});var Sr=_(bt=>{Object.defineProperty(bt,"__esModule",{value:!0});bt.getRefs=void 0;var ro=Et(),so=r=>{let e=(0, ro.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}]))}};bt.getRefs=so;});var te=_(Ne=>{Object.defineProperty(Ne,"__esModule",{value:!0});Ne.setResponseValueAndErrors=Ne.addErrorMessage=void 0;function Ns(r,e,t,s){s?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t});}Ne.addErrorMessage=Ns;function no(r,e,t,s,n){r[e]=t,Ns(r,e,s,n);}Ne.setResponseValueAndErrors=no;});var ze=_(I=>{Object.defineProperty(I,"__esModule",{value:!0});I.getParsedType=I.ZodParsedType=I.objectUtil=I.util=void 0;var ks;(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 o={};for(let a of n)o[a]=a;return o},r.getValidEnumValues=n=>{let o=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),a={};for(let i of o)a[i]=n[i];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(o){return n[o]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&o.push(a);return o},r.find=(n,o)=>{for(let a of n)if(o(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,o=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}r.joinValues=s,r.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o;})(ks=I.util||(I.util={}));(function(r){r.mergeShapes=(e,t)=>({...e,...t});})(I.objectUtil||(I.objectUtil={}));I.ZodParsedType=ks.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var ao=r=>{switch(typeof r){case"undefined":return I.ZodParsedType.undefined;case"string":return I.ZodParsedType.string;case"number":return isNaN(r)?I.ZodParsedType.nan:I.ZodParsedType.number;case"boolean":return I.ZodParsedType.boolean;case"function":return I.ZodParsedType.function;case"bigint":return I.ZodParsedType.bigint;case"symbol":return I.ZodParsedType.symbol;case"object":return Array.isArray(r)?I.ZodParsedType.array:r===null?I.ZodParsedType.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?I.ZodParsedType.promise:typeof Map<"u"&&r instanceof Map?I.ZodParsedType.map:typeof Set<"u"&&r instanceof Set?I.ZodParsedType.set:typeof Date<"u"&&r instanceof Date?I.ZodParsedType.date:I.ZodParsedType.object;default:return I.ZodParsedType.unknown}};I.getParsedType=ao;});var Pt=_(re=>{Object.defineProperty(re,"__esModule",{value:!0});re.ZodError=re.quotelessJson=re.ZodIssueCode=void 0;var Ds=ze();re.ZodIssueCode=Ds.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 io=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");re.quotelessJson=io;var He=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(o){return o.message},s={_errors:[]},n=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else {let i=s,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(a))):i[l]=i[l]||{_errors:[]},i=i[l],u++;}}};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,Ds.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()}};re.ZodError=He;He.create=r=>new He(r);});var kr=_(Nr=>{Object.defineProperty(Nr,"__esModule",{value:!0});var ue=ze(),C=Pt(),co=(r,e)=>{let t;switch(r.code){case C.ZodIssueCode.invalid_type:r.received===ue.ZodParsedType.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case C.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ue.util.jsonStringifyReplacer)}`;break;case C.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${ue.util.joinValues(r.keys,", ")}`;break;case C.ZodIssueCode.invalid_union:t="Invalid input";break;case C.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ue.util.joinValues(r.options)}`;break;case C.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${ue.util.joinValues(r.options)}, received '${r.received}'`;break;case C.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case C.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case C.ZodIssueCode.invalid_date:t="Invalid date";break;case C.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}"`:ue.util.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case C.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 C.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 C.ZodIssueCode.custom:t="Invalid input";break;case C.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case C.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case C.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,ue.util.assertNever(r);}return {message:t}};Nr.default=co;});var At=_(B=>{var uo=B&&B.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(B,"__esModule",{value:!0});B.getErrorMap=B.setErrorMap=B.defaultErrorMap=void 0;var Zs=uo(kr());B.defaultErrorMap=Zs.default;var js=Zs.default;function lo(r){js=r;}B.setErrorMap=lo;function fo(){return js}B.getErrorMap=fo;});var Zr=_(O=>{var po=O&&O.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(O,"__esModule",{value:!0});O.isAsync=O.isValid=O.isDirty=O.isAborted=O.OK=O.DIRTY=O.INVALID=O.ParseStatus=O.addIssueToContext=O.EMPTY_PATH=O.makeIssue=void 0;var ho=At(),Ms=po(kr()),mo=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,o=[...t,...n.path||[]],a={...n,path:o};if(n.message!==void 0)return {...n,path:o,message:n.message};let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(a,{data:e,defaultError:i}).message;return {...n,path:o,message:i}};O.makeIssue=mo;O.EMPTY_PATH=[];function yo(r,e){let t=(0, ho.getErrorMap)(),s=(0, O.makeIssue)({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Ms.default?void 0:Ms.default].filter(n=>!!n)});r.common.issues.push(s);}O.addIssueToContext=yo;var Dr=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 O.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 o=await n.key,a=await n.value;s.push({key:o,value:a});}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:o,value:a}=n;if(o.status==="aborted"||a.status==="aborted")return O.INVALID;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(s[o.value]=a.value);}return {status:e.value,value:s}}};O.ParseStatus=Dr;O.INVALID=Object.freeze({status:"aborted"});var _o=r=>({status:"dirty",value:r});O.DIRTY=_o;var go=r=>({status:"valid",value:r});O.OK=go;var vo=r=>r.status==="aborted";O.isAborted=vo;var wo=r=>r.status==="dirty";O.isDirty=wo;var To=r=>r.status==="valid";O.isValid=To;var Ro=r=>typeof Promise<"u"&&r instanceof Promise;O.isAsync=Ro;});var Ls=_(Us=>{Object.defineProperty(Us,"__esModule",{value:!0});});var qs=_(Ge=>{Object.defineProperty(Ge,"__esModule",{value:!0});Ge.errorUtil=void 0;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message;})(Ge.errorUtil||(Ge.errorUtil={}));});var Xs=_(d=>{var St=d&&d.__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)},$s=d&&d.__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},Je,Ye;Object.defineProperty(d,"__esModule",{value:!0});d.boolean=d.bigint=d.array=d.any=d.coerce=d.ZodFirstPartyTypeKind=d.late=d.ZodSchema=d.Schema=d.custom=d.ZodReadonly=d.ZodPipeline=d.ZodBranded=d.BRAND=d.ZodNaN=d.ZodCatch=d.ZodDefault=d.ZodNullable=d.ZodOptional=d.ZodTransformer=d.ZodEffects=d.ZodPromise=d.ZodNativeEnum=d.ZodEnum=d.ZodLiteral=d.ZodLazy=d.ZodFunction=d.ZodSet=d.ZodMap=d.ZodRecord=d.ZodTuple=d.ZodIntersection=d.ZodDiscriminatedUnion=d.ZodUnion=d.ZodObject=d.ZodArray=d.ZodVoid=d.ZodNever=d.ZodUnknown=d.ZodAny=d.ZodNull=d.ZodUndefined=d.ZodSymbol=d.ZodDate=d.ZodBoolean=d.ZodBigInt=d.ZodNumber=d.ZodString=d.datetimeRegex=d.ZodType=void 0;d.NEVER=d.void=d.unknown=d.union=d.undefined=d.tuple=d.transformer=d.symbol=d.string=d.strictObject=d.set=d.record=d.promise=d.preprocess=d.pipeline=d.ostring=d.optional=d.onumber=d.oboolean=d.object=d.number=d.nullable=d.null=d.never=d.nativeEnum=d.nan=d.map=d.literal=d.lazy=d.intersection=d.instanceof=d.function=d.enum=d.effect=d.discriminatedUnion=d.date=void 0;var Ct=At(),m=qs(),c=Zr(),p=ze(),f=Pt(),M=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}},Vs=(r,e)=>{if((0, c.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 f.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:(a,i)=>{var u,l;let{message:h}=r;return a.code==="invalid_enum_value"?{message:h??i.defaultError}:typeof i.data>"u"?{message:(u=h??s)!==null&&u!==void 0?u:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(l=h??t)!==null&&l!==void 0?l:i.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, p.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, p.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new c.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, p.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, c.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, p.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Vs(n,o)}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, p.getParsedType)(e)},n=this._parse({data:e,path:s.path,parent:s}),o=await((0, c.isAsync)(n)?n:Promise.resolve(n));return Vs(s,o)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,o)=>{let a=e(n),i=()=>o.addIssue({code:f.ZodIssueCode.custom,...s(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(i(),!1)):a?!0:(i(),!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 k({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return j.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return oe.create(this,this._def)}or(e){return _e.create([this,e],this._def)}and(e){return ge.create(this,e,this._def)}transform(e){return new k({...g(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Oe({...g(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Xe({typeName:y.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new xe({...g(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Qe.create(this,e)}readonly(){return Ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};d.ZodType=v;d.Schema=v;d.ZodSchema=v;var xo=/^c[^\s-]{8,}$/i,Io=/^[0-9a-z]+$/,Eo=/^[0-9A-HJKMNP-TV-Z]{26}$/,bo=/^[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,Po=/^[a-z0-9_-]{21}$/i,Ao=/^[-+]?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)?)??$/,Co=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,So="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",jr,No=/^(?:(?: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])$/,ko=/^(([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})))$/,Do=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fs="((\\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])))",Zo=new RegExp(`^${Fs}$`);function Ws(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 jo(r){return new RegExp(`^${Ws(r)}$`)}function Bs(r){let e=`${Fs}T${Ws(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}d.datetimeRegex=Bs;function Mo(r,e){return !!((e==="v4"||!e)&&No.test(r)||(e==="v6"||!e)&&ko.test(r))}var se=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.ZodParsedType.string){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.string,received:o.parsedType}),c.INVALID}let s=new c.ParseStatus,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){let a=e.data.length>o.value,i=e.data.length<o.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),s.dirty());}else if(o.kind==="email")Co.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"email",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="emoji")jr||(jr=new RegExp(So,"u")),jr.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="uuid")bo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="nanoid")Po.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid")xo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid2")Io.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="ulid")Eo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"ulid",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty());else if(o.kind==="url")try{new URL(e.data);}catch{n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"url",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty();}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"regex",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),s.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:{startsWith:o.value},message:o.message}),s.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:o.value},message:o.message}),s.dirty()):o.kind==="datetime"?Bs(o).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:o.message}),s.dirty()):o.kind==="date"?Zo.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:"date",message:o.message}),s.dirty()):o.kind==="time"?jo(o).test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_string,validation:"time",message:o.message}),s.dirty()):o.kind==="duration"?Ao.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty()):o.kind==="ip"?Mo(e.data,o.version)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty()):o.kind==="base64"?Do.test(e.data)||(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:o.message}),s.dirty()):p.util.assertNever(o);return {status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:f.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}};d.ZodString=se;se.create=r=>{var e;return new se({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function Uo(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,o=parseInt(r.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return o%a/Math.pow(10,n)}var le=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)!==p.ZodParsedType.number){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.number,received:o.parsedType}),c.INVALID}let s,n=new c.ParseStatus;for(let o of this._def.checks)o.kind==="int"?p.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Uo(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.not_finite,message:o.message}),n.dirty()):p.util.assertNever(o);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"&&p.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)}};d.ZodNumber=le;le.create=r=>new le({checks:[],typeName:y.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)!==p.ZodParsedType.bigint){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.bigint,received:o.parsedType}),c.INVALID}let s,n=new c.ParseStatus;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),(0, c.addIssueToContext)(s,{code:f.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):p.util.assertNever(o);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}};d.ZodBigInt=fe;fe.create=r=>{var e;return new fe({checks:[],typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var pe=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.ZodParsedType.boolean){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.boolean,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodBoolean=pe;pe.create=r=>new pe({typeName:y.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var he=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.ZodParsedType.date){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.date,received:o.parsedType}),c.INVALID}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_date}),c.INVALID}let s=new c.ParseStatus,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),s.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),(0, c.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):p.util.assertNever(o);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}};d.ZodDate=he;he.create=r=>new he({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,...g(r)});var De=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.symbol){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.symbol,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodSymbol=De;De.create=r=>new De({typeName:y.ZodSymbol,...g(r)});var me=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.undefined,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodUndefined=me;me.create=r=>new me({typeName:y.ZodUndefined,...g(r)});var ye=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.null){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.null,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodNull=ye;ye.create=r=>new ye({typeName:y.ZodNull,...g(r)});var ne=class extends v{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, c.OK)(e.data)}};d.ZodAny=ne;ne.create=r=>new ne({typeName:y.ZodAny,...g(r)});var J=class extends v{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, c.OK)(e.data)}};d.ZodUnknown=J;J.create=r=>new J({typeName:y.ZodUnknown,...g(r)});var V=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.never,received:t.parsedType}),c.INVALID}};d.ZodNever=V;V.create=r=>new V({typeName:y.ZodNever,...g(r)});var Ze=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.void,received:s.parsedType}),c.INVALID}return (0, c.OK)(e.data)}};d.ZodVoid=Ze;Ze.create=r=>new Ze({typeName:y.ZodVoid,...g(r)});var Y=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==p.ZodParsedType.array)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:t.parsedType}),c.INVALID;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(a||i)&&((0, c.addIssueToContext)(t,{code:a?f.ZodIssueCode.too_big:f.ZodIssueCode.too_small,minimum:i?n.exactLength.value:void 0,maximum:a?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, c.addIssueToContext)(t,{code:f.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, c.addIssueToContext)(t,{code:f.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((a,i)=>n.type._parseAsync(new M(t,a,t.path,i)))).then(a=>c.ParseStatus.mergeArray(s,a));let o=[...t.data].map((a,i)=>n.type._parseSync(new M(t,a,t.path,i)));return c.ParseStatus.mergeArray(s,o)}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)}};d.ZodArray=Y;Y.create=(r,e)=>new Y({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...g(e)});function ke(r){if(r instanceof S){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=j.create(ke(s));}return new S({...r._def,shape:()=>e})}else return r instanceof Y?new Y({...r._def,type:ke(r.element)}):r instanceof j?j.create(ke(r.unwrap())):r instanceof z?z.create(ke(r.unwrap())):r instanceof K?K.create(r.items.map(e=>ke(e))):r}var S=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=p.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.ZodParsedType.object){let l=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(l,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:l.parsedType}),c.INVALID}let{status:s,ctx:n}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||i.push(l);let u=[];for(let l of a){let h=o[l],x=n.data[l];u.push({key:{status:"valid",value:l},value:h._parse(new M(n,x,n.path,l)),alwaysSet:l in n.data});}if(this._def.catchall instanceof V){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of i)u.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(l==="strict")i.length>0&&((0, c.addIssueToContext)(n,{code:f.ZodIssueCode.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let h of i){let x=n.data[h];u.push({key:{status:"valid",value:h},value:l._parse(new M(n,x,n.path,h)),alwaysSet:h in n.data});}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of u){let x=await h.key,L=await h.value;l.push({key:x,value:L,alwaysSet:h.alwaysSet});}return l}).then(l=>c.ParseStatus.mergeObjectSync(s,l)):c.ParseStatus.mergeObjectSync(s,u)}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,o,a,i;let u=(a=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,t,s).message)!==null&&a!==void 0?a:s.defaultError;return t.code==="unrecognized_keys"?{message:(i=m.errorUtil.errToObj(e).message)!==null&&i!==void 0?i:u}:{message:u}}}:{}})}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:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return p.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 p.util.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s]);}),new r({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){let t={};return p.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 p.util.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else {let o=this.shape[s];for(;o instanceof j;)o=o._def.innerType;t[s]=o;}}),new r({...this._def,shape:()=>t})}keyof(){return Ks(p.util.objectKeys(this.shape))}};d.ZodObject=S;S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:V.create(),typeName:y.ZodObject,...g(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:V.create(),typeName:y.ZodObject,...g(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:V.create(),typeName:y.ZodObject,...g(e)});var _e=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(i=>new f.ZodError(i.ctx.common.issues));return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),c.INVALID}if(t.common.async)return Promise.all(s.map(async o=>{let a={...t,common:{...t.common,issues:[]},parent:null};return {result:await o._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let o,a=[];for(let u of s){let l={...t,common:{...t.common,issues:[]},parent:null},h=u._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:l}),l.common.issues.length&&a.push(l.common.issues);}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(u=>new f.ZodError(u));return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:i}),c.INVALID}}get options(){return this._def.options}};d.ZodUnion=_e;_e.create=(r,e)=>new _e({options:r,typeName:y.ZodUnion,...g(e)});var G=r=>r instanceof ve?G(r.schema):r instanceof k?G(r.innerType()):r instanceof we?[r.value]:r instanceof Te?r.options:r instanceof Re?p.util.objectValues(r.enum):r instanceof Oe?G(r._def.innerType):r instanceof me?[void 0]:r instanceof ye?[null]:r instanceof j?[void 0,...G(r.unwrap())]:r instanceof z?[null,...G(r.unwrap())]:r instanceof Xe||r instanceof Ie?G(r.unwrap()):r instanceof xe?G(r._def.innerType):[],Nt=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.ZodParsedType.object)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:t.parsedType}),c.INVALID;let s=this.discriminator,n=t.data[s],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):((0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),c.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 o of t){let a=G(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of a){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o);}}return new r({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...g(s)})}};d.ZodDiscriminatedUnion=Nt;function Mr(r,e){let t=(0, p.getParsedType)(r),s=(0, p.getParsedType)(e);if(r===e)return {valid:!0,data:r};if(t===p.ZodParsedType.object&&s===p.ZodParsedType.object){let n=p.util.objectKeys(e),o=p.util.objectKeys(r).filter(i=>n.indexOf(i)!==-1),a={...r,...e};for(let i of o){let u=Mr(r[i],e[i]);if(!u.valid)return {valid:!1};a[i]=u.data;}return {valid:!0,data:a}}else if(t===p.ZodParsedType.array&&s===p.ZodParsedType.array){if(r.length!==e.length)return {valid:!1};let n=[];for(let o=0;o<r.length;o++){let a=r[o],i=e[o],u=Mr(a,i);if(!u.valid)return {valid:!1};n.push(u.data);}return {valid:!0,data:n}}else return t===p.ZodParsedType.date&&s===p.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ge=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(o,a)=>{if((0, c.isAborted)(o)||(0, c.isAborted)(a))return c.INVALID;let i=Mr(o.value,a.value);return i.valid?(((0, c.isDirty)(o)||(0, c.isDirty)(a))&&t.dirty(),{status:t.value,value:i.data}):((0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_intersection_types}),c.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(([o,a])=>n(o,a)):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}))}};d.ZodIntersection=ge;ge.create=(r,e,t)=>new ge({left:r,right:e,typeName:y.ZodIntersection,...g(t)});var K=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.ZodParsedType.array)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.array,received:s.parsedType}),c.INVALID;if(s.data.length<this._def.items.length)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...s.data].map((a,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new M(s,a,s.path,i)):null}).filter(a=>!!a);return s.common.async?Promise.all(o).then(a=>c.ParseStatus.mergeArray(t,a)):c.ParseStatus.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};d.ZodTuple=K;K.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new K({items:r,typeName:y.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!==p.ZodParsedType.object)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.object,received:s.parsedType}),c.INVALID;let n=[],o=this._def.keyType,a=this._def.valueType;for(let i in s.data)n.push({key:o._parse(new M(s,i,s.path,i)),value:a._parse(new M(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?c.ParseStatus.mergeObjectAsync(t,n):c.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:y.ZodRecord,...g(s)}):new r({keyType:se.create(),valueType:e,typeName:y.ZodRecord,...g(t)})}};d.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!==p.ZodParsedType.map)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.map,received:s.parsedType}),c.INVALID;let n=this._def.keyType,o=this._def.valueType,a=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new M(s,i,s.path,[l,"key"])),value:o._parse(new M(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,h=await u.value;if(l.status==="aborted"||h.status==="aborted")return c.INVALID;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),i.set(l.value,h.value);}return {status:t.value,value:i}})}else {let i=new Map;for(let u of a){let l=u.key,h=u.value;if(l.status==="aborted"||h.status==="aborted")return c.INVALID;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),i.set(l.value,h.value);}return {status:t.value,value:i}}}};d.ZodMap=je;je.create=(r,e,t)=>new je({valueType:e,keyType:r,typeName:y.ZodMap,...g(t)});var Me=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.ZodParsedType.set)return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.set,received:s.parsedType}),c.INVALID;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&((0, c.addIssueToContext)(s,{code:f.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, c.addIssueToContext)(s,{code:f.ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let o=this._def.valueType;function a(u){let l=new Set;for(let h of u){if(h.status==="aborted")return c.INVALID;h.status==="dirty"&&t.dirty(),l.add(h.value);}return {status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>o._parse(new M(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>a(u)):a(i)}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)}};d.ZodSet=Me;Me.create=(r,e)=>new Me({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...g(e)});var Dt=class r extends v{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.ZodParsedType.function)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.function,received:t.parsedType}),c.INVALID;function s(i,u){return (0, c.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ct.getErrorMap)(),Ct.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:u}})}function n(i,u){return (0, c.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ct.getErrorMap)(),Ct.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let o={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof oe){let i=this;return (0, c.OK)(async function(...u){let l=new f.ZodError([]),h=await i._def.args.parseAsync(u,o).catch(X=>{throw l.addIssue(s(u,X)),l}),x=await Reflect.apply(a,this,h);return await i._def.returns._def.type.parseAsync(x,o).catch(X=>{throw l.addIssue(n(x,X)),l})})}else {let i=this;return (0, c.OK)(function(...u){let l=i._def.args.safeParse(u,o);if(!l.success)throw new f.ZodError([s(u,l.error)]);let h=Reflect.apply(a,this,l.data),x=i._def.returns.safeParse(h,o);if(!x.success)throw new f.ZodError([n(h,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:K.create(e).rest(J.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||K.create([]).rest(J.create()),returns:t||J.create(),typeName:y.ZodFunction,...g(s)})}};d.ZodFunction=Dt;var ve=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})}};d.ZodLazy=ve;ve.create=(r,e)=>new ve({getter:r,typeName:y.ZodLazy,...g(e)});var we=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),c.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};d.ZodLiteral=we;we.create=(r,e)=>new we({value:r,typeName:y.ZodLiteral,...g(e)});function Ks(r,e){return new Te({values:r,typeName:y.ZodEnum,...g(e)})}var Te=class r extends v{constructor(){super(...arguments),Je.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, c.addIssueToContext)(t,{expected:p.util.joinValues(s),received:t.parsedType,code:f.ZodIssueCode.invalid_type}),c.INVALID}if(St(this,Je,"f")||$s(this,Je,new Set(this._def.values),"f"),!St(this,Je,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return (0, c.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_enum_value,options:s}),c.INVALID}return (0, c.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})}};d.ZodEnum=Te;Je=new WeakMap;Te.create=Ks;var Re=class extends v{constructor(){super(...arguments),Ye.set(this,void 0);}_parse(e){let t=p.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.ZodParsedType.string&&s.parsedType!==p.ZodParsedType.number){let n=p.util.objectValues(t);return (0, c.addIssueToContext)(s,{expected:p.util.joinValues(n),received:s.parsedType,code:f.ZodIssueCode.invalid_type}),c.INVALID}if(St(this,Ye,"f")||$s(this,Ye,new Set(p.util.getValidEnumValues(this._def.values)),"f"),!St(this,Ye,"f").has(e.data)){let n=p.util.objectValues(t);return (0, c.addIssueToContext)(s,{received:s.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),c.INVALID}return (0, c.OK)(e.data)}get enum(){return this._def.values}};d.ZodNativeEnum=Re;Ye=new WeakMap;Re.create=(r,e)=>new Re({values:r,typeName:y.ZodNativeEnum,...g(e)});var oe=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.ZodParsedType.promise&&t.common.async===!1)return (0, c.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.promise,received:t.parsedType}),c.INVALID;let s=t.parsedType===p.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, c.OK)(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};d.ZodPromise=oe;oe.create=(r,e)=>new oe({type:r,typeName:y.ZodPromise,...g(e)});var k=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:a=>{(0, c.addIssueToContext)(s,a),a.fatal?t.abort():t.dirty();},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let a=n.transform(s.data,o);if(s.common.async)return Promise.resolve(a).then(async i=>{if(t.value==="aborted")return c.INVALID;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?c.INVALID:u.status==="dirty"||t.value==="dirty"?(0, c.DIRTY)(u.value):u});{if(t.value==="aborted")return c.INVALID;let i=this._def.schema._parseSync({data:a,path:s.path,parent:s});return i.status==="aborted"?c.INVALID:i.status==="dirty"||t.value==="dirty"?(0, c.DIRTY)(i.value):i}}if(n.type==="refinement"){let a=i=>{let u=n.refinement(i,o);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?c.INVALID:(i.status==="dirty"&&t.dirty(),a(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?c.INVALID:(i.status==="dirty"&&t.dirty(),a(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0, c.isValid)(a))return a;let i=n.transform(a.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>(0, c.isValid)(a)?Promise.resolve(n.transform(a.value,o)).then(i=>({status:t.value,value:i})):a);p.util.assertNever(n);}};d.ZodEffects=k;d.ZodTransformer=k;k.create=(r,e,t)=>new k({schema:r,typeName:y.ZodEffects,effect:e,...g(t)});k.createWithPreprocess=(r,e,t)=>new k({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...g(t)});var j=class extends v{_parse(e){return this._getType(e)===p.ZodParsedType.undefined?(0, c.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};d.ZodOptional=j;j.create=(r,e)=>new j({innerType:r,typeName:y.ZodOptional,...g(e)});var z=class extends v{_parse(e){return this._getType(e)===p.ZodParsedType.null?(0, c.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};d.ZodNullable=z;z.create=(r,e)=>new z({innerType:r,typeName:y.ZodNullable,...g(e)});var Oe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===p.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};d.ZodDefault=Oe;Oe.create=(r,e)=>new Oe({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var xe=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, c.isAsync)(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new f.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new f.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};d.ZodCatch=xe;xe.create=(r,e)=>new xe({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var Ue=class extends v{_parse(e){if(this._getType(e)!==p.ZodParsedType.nan){let s=this._getOrReturnCtx(e);return (0, c.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:p.ZodParsedType.nan,received:s.parsedType}),c.INVALID}return {status:"valid",value:e.data}}};d.ZodNaN=Ue;Ue.create=r=>new Ue({typeName:y.ZodNaN,...g(r)});d.BRAND=Symbol("zod_brand");var Xe=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}};d.ZodBranded=Xe;var Qe=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return (async()=>{let o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?c.INVALID:o.status==="dirty"?(t.dirty(),(0, c.DIRTY)(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?c.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:y.ZodPipeline})}};d.ZodPipeline=Qe;var Ie=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=n=>((0, c.isValid)(n)&&(n.value=Object.freeze(n.value)),n);return (0, c.isAsync)(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};d.ZodReadonly=Ie;Ie.create=(r,e)=>new Ie({innerType:r,typeName:y.ZodReadonly,...g(e)});function zs(r,e={},t){return r?ne.create().superRefine((s,n)=>{var o,a;if(!r(s)){let i=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,u=(a=(o=i.fatal)!==null&&o!==void 0?o:t)!==null&&a!==void 0?a:!0,l=typeof i=="string"?{message:i}:i;n.addIssue({code:"custom",...l,fatal:u});}}):ne.create()}d.custom=zs;d.late={object:S.lazycreate};var y;(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";})(y=d.ZodFirstPartyTypeKind||(d.ZodFirstPartyTypeKind={}));var Lo=(r,e={message:`Input not instance of ${r.name}`})=>zs(t=>t instanceof r,e);d.instanceof=Lo;var Hs=se.create;d.string=Hs;var Gs=le.create;d.number=Gs;var qo=Ue.create;d.nan=qo;var Vo=fe.create;d.bigint=Vo;var Js=pe.create;d.boolean=Js;var $o=he.create;d.date=$o;var Fo=De.create;d.symbol=Fo;var Wo=me.create;d.undefined=Wo;var Bo=ye.create;d.null=Bo;var Ko=ne.create;d.any=Ko;var zo=J.create;d.unknown=zo;var Ho=V.create;d.never=Ho;var Go=Ze.create;d.void=Go;var Jo=Y.create;d.array=Jo;var Yo=S.create;d.object=Yo;var Xo=S.strictCreate;d.strictObject=Xo;var Qo=_e.create;d.union=Qo;var ea=Nt.create;d.discriminatedUnion=ea;var ta=ge.create;d.intersection=ta;var ra=K.create;d.tuple=ra;var sa=kt.create;d.record=sa;var na=je.create;d.map=na;var oa=Me.create;d.set=oa;var aa=Dt.create;d.function=aa;var ia=ve.create;d.lazy=ia;var da=we.create;d.literal=da;var ca=Te.create;d.enum=ca;var ua=Re.create;d.nativeEnum=ua;var la=oe.create;d.promise=la;var Ys=k.create;d.effect=Ys;d.transformer=Ys;var fa=j.create;d.optional=fa;var pa=z.create;d.nullable=pa;var ha=k.createWithPreprocess;d.preprocess=ha;var ma=Qe.create;d.pipeline=ma;var ya=()=>Hs().optional();d.ostring=ya;var _a=()=>Gs().optional();d.onumber=_a;var ga=()=>Js().optional();d.oboolean=ga;d.coerce={string:r=>se.create({...r,coerce:!0}),number:r=>le.create({...r,coerce:!0}),boolean:r=>pe.create({...r,coerce:!0}),bigint:r=>fe.create({...r,coerce:!0}),date:r=>he.create({...r,coerce:!0})};d.NEVER=c.INVALID;});var Ur=_(U=>{var va=U&&U.__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=U&&U.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&va(e,r,t);};Object.defineProperty(U,"__esModule",{value:!0});Le(At(),U);Le(Zr(),U);Le(Ls(),U);Le(ze(),U);Le(Xs(),U);Le(Pt(),U);});var Zt=_(N=>{var Qs=N&&N.__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];}),wa=N&&N.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e});}:function(r,e){r.default=e;}),Ta=N&&N.__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)&&Qs(e,r,t);return wa(e,r),e},Ra=N&&N.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Qs(e,r,t);};Object.defineProperty(N,"__esModule",{value:!0});N.z=void 0;var en=Ta(Ur());N.z=en;Ra(Ur(),N);N.default=en;});var Lr=_(jt=>{Object.defineProperty(jt,"__esModule",{value:!0});jt.parseAnyDef=void 0;function Oa(){return {}}jt.parseAnyDef=Oa;});var qr=_(Ut=>{Object.defineProperty(Ut,"__esModule",{value:!0});Ut.parseArrayDef=void 0;var xa=Zt(),Mt=te(),Ia=P();function Ea(r,e){let t={type:"array"};return r.type?._def?.typeName!==xa.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, Ia.parseDef)(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&(0, Mt.setResponseValueAndErrors)(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&(0, Mt.setResponseValueAndErrors)(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&((0, Mt.setResponseValueAndErrors)(t,"minItems",r.exactLength.value,r.exactLength.message,e),(0, Mt.setResponseValueAndErrors)(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}Ut.parseArrayDef=Ea;});var Vr=_(Lt=>{Object.defineProperty(Lt,"__esModule",{value:!0});Lt.parseBigintDef=void 0;var Ee=te();function ba(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, Ee.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, Ee.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, Ee.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, Ee.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, Ee.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, Ee.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, Ee.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}Lt.parseBigintDef=ba;});var $r=_(qt=>{Object.defineProperty(qt,"__esModule",{value:!0});qt.parseBooleanDef=void 0;function Pa(){return {type:"boolean"}}qt.parseBooleanDef=Pa;});var Fr=_(Vt=>{Object.defineProperty(Vt,"__esModule",{value:!0});Vt.parseBrandedDef=void 0;var Aa=P();function Ca(r,e){return (0, Aa.parseDef)(r.type._def,e)}Vt.parseBrandedDef=Ca;});var Wr=_($t=>{Object.defineProperty($t,"__esModule",{value:!0});$t.parseCatchDef=void 0;var Sa=P(),Na=(r,e)=>(0, Sa.parseDef)(r.innerType._def,e);$t.parseCatchDef=Na;});var Br=_(Ft=>{Object.defineProperty(Ft,"__esModule",{value:!0});Ft.parseDateDef=void 0;var tn=te();function rn(r,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return {anyOf:s.map((n,o)=>rn(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 ka(r,e)}}Ft.parseDateDef=rn;var ka=(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, tn.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e);break;case"max":(0, tn.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e);break}return t};});var Kr=_(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseDefaultDef=void 0;var Da=P();function Za(r,e){return {...(0, Da.parseDef)(r.innerType._def,e),default:r.defaultValue()}}Wt.parseDefaultDef=Za;});var zr=_(Bt=>{Object.defineProperty(Bt,"__esModule",{value:!0});Bt.parseEffectsDef=void 0;var ja=P();function Ma(r,e){return e.effectStrategy==="input"?(0, ja.parseDef)(r.schema._def,e):{}}Bt.parseEffectsDef=Ma;});var Hr=_(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseEnumDef=void 0;function Ua(r){return {type:"string",enum:r.values}}Kt.parseEnumDef=Ua;});var Gr=_(zt=>{Object.defineProperty(zt,"__esModule",{value:!0});zt.parseIntersectionDef=void 0;var sn=P(),La=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function qa(r,e){let t=[(0, sn.parseDef)(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, sn.parseDef)(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return t.forEach(o=>{if(La(o))n.push(...o.allOf),o.unevaluatedProperties===void 0&&(s=void 0);else {let a=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:i,...u}=o;a=u;}else s=void 0;n.push(a);}}),n.length?{allOf:n,...s}:void 0}zt.parseIntersectionDef=qa;});var Jr=_(Ht=>{Object.defineProperty(Ht,"__esModule",{value:!0});Ht.parseLiteralDef=void 0;function Va(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}}Ht.parseLiteralDef=Va;});var Gt=_(D=>{Object.defineProperty(D,"__esModule",{value:!0});D.parseStringDef=D.zodPatterns=void 0;var be=te();D.zodPatterns={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,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:RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u"),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][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])$/,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 $a(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, be.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e);break;case"max":(0, be.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":$(t,"email",n.message,e);break;case"format:idn-email":$(t,"idn-email",n.message,e);break;case"pattern:zod":F(t,D.zodPatterns.email,n.message,e);break}break;case"url":$(t,"uri",n.message,e);break;case"uuid":$(t,"uuid",n.message,e);break;case"regex":F(t,n.regex,n.message,e);break;case"cuid":F(t,D.zodPatterns.cuid,n.message,e);break;case"cuid2":F(t,D.zodPatterns.cuid2,n.message,e);break;case"startsWith":F(t,RegExp(`^${s(n.value)}`),n.message,e);break;case"endsWith":F(t,RegExp(`${s(n.value)}$`),n.message,e);break;case"datetime":$(t,"date-time",n.message,e);break;case"date":$(t,"date",n.message,e);break;case"time":$(t,"time",n.message,e);break;case"duration":$(t,"duration",n.message,e);break;case"length":(0, be.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e),(0, be.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"includes":{F(t,RegExp(s(n.value)),n.message,e);break}case"ip":{n.version!=="v6"&&$(t,"ipv4",n.message,e),n.version!=="v4"&&$(t,"ipv6",n.message,e);break}case"emoji":F(t,D.zodPatterns.emoji,n.message,e);break;case"ulid":{F(t,D.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{$(t,"binary",n.message,e);break}case"contentEncoding:base64":{(0, be.setResponseValueAndErrors)(t,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{F(t,D.zodPatterns.base64,n.message,e);break}}break}case"nanoid":F(t,D.zodPatterns.nanoid,n.message,e);}return t}D.parseStringDef=$a;var Fa=r=>Array.from(r).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),$=(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, be.setResponseValueAndErrors)(r,"format",e,t,s);},F=(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:nn(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):(0, be.setResponseValueAndErrors)(r,"pattern",nn(e,s),t,s);},nn=(r,e)=>{if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},s=t.i?r.source.toLowerCase():r.source,n="",o=!1,a=!1,i=!1;for(let u=0;u<s.length;u++){if(o){n+=s[u],o=!1;continue}if(t.i){if(a){if(s[u].match(/[a-z]/)){i?(n+=s[u],n+=`${s[u-2]}-${s[u]}`.toUpperCase(),i=!1):s[u+1]==="-"&&s[u+2]?.match(/[a-z]/)?(n+=s[u],i=!0):n+=`${s[u]}${s[u].toUpperCase()}`;continue}}else if(s[u].match(/[a-z]/)){n+=`[${s[u]}${s[u].toUpperCase()}]`;continue}}if(t.m){if(s[u]==="^"){n+=`(^|(?<=[\r
19
19
  ]))`;continue}else if(s[u]==="$"){n+=`($|(?=[\r
20
20
  ]))`;continue}}if(t.s&&s[u]==="."){n+=a?`${s[u]}\r
21
21
  `:`[${s[u]}\r
22
- ]`;continue}n+=s[u],s[u]==="\\"?o=!0:a&&s[u]==="]"?a=!1:!a&&s[u]==="["&&(a=!0);}try{let u=new RegExp(n);}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return n};});var Yt=_(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseRecordDef=void 0;var Yr=Zt(),on=P(),Fa=Gt();function Wa(r,e){if(e.target==="openApi3"&&r.keyType?._def.typeName===Yr.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((s,n)=>({...s,[n]:(0, on.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, on.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===Yr.ZodFirstPartyTypeKind.ZodString&&r.keyType._def.checks?.length){let s=Object.entries((0, Fa.parseStringDef)(r.keyType._def,e)).reduce((n,[o,a])=>o==="type"?n:{...n,[o]:a},{});return {...t,propertyNames:s}}else if(r.keyType?._def.typeName===Yr.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:r.keyType._def.values}};return t}Jt.parseRecordDef=Wa;});var Xr=_(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseMapDef=void 0;var an=P(),Ba=Yt();function Ka(r,e){if(e.mapStrategy==="record")return (0, Ba.parseRecordDef)(r,e);let t=(0, an.parseDef)(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},s=(0, an.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}}}Xt.parseMapDef=Ka;});var Qr=_(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseNativeEnumDef=void 0;function za(r){let e=r.values,s=Object.keys(r.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),n=Array.from(new Set(s.map(o=>typeof o)));return {type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:s}}Qt.parseNativeEnumDef=za;});var es=_(er=>{Object.defineProperty(er,"__esModule",{value:!0});er.parseNeverDef=void 0;function Ha(){return {not:{}}}er.parseNeverDef=Ha;});var ts=_(tr=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.parseNullDef=void 0;function Ga(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}tr.parseNullDef=Ga;});var rr=_(ae=>{Object.defineProperty(ae,"__esModule",{value:!0});ae.parseUnionDef=ae.primitiveMappings=void 0;var Ja=P();ae.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ya(r,e){if(e.target==="openApi3")return dn(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(s=>s._def.typeName in ae.primitiveMappings&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((n,o)=>{let a=ae.primitiveMappings[o._def.typeName];return a&&!n.includes(a)?[...n,a]: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,o)=>{let a=typeof o._def.value;switch(a){case"string":case"number":case"boolean":return [...n,a];case"bigint":return [...n,"integer"];case"object":if(o._def.value===null)return [...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(s.length===t.length){let n=s.filter((o,a,i)=>i.indexOf(o)===a);return {type:n.length>1?n:n[0],enum:t.reduce((o,a)=>o.includes(a._def.value)?o:[...o,a._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((s,n)=>[...s,...n._def.values.filter(o=>!s.includes(o))],[])};return dn(r,e)}ae.parseUnionDef=Ya;var dn=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((s,n)=>(0, Ja.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 rs=_(sr=>{Object.defineProperty(sr,"__esModule",{value:!0});sr.parseNullableDef=void 0;var cn=P(),un=rr();function Xa(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:un.primitiveMappings[r.innerType._def.typeName],nullable:!0}:{type:[un.primitiveMappings[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=(0, cn.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=(0, cn.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}sr.parseNullableDef=Xa;});var ss=_(nr=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.parseNumberDef=void 0;var ie=te();function Qa(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, ie.addErrorMessage)(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?(0, ie.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, ie.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, ie.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, ie.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, ie.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, ie.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, ie.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}nr.parseNumberDef=Qa;});var os=_(qe=>{Object.defineProperty(qe,"__esModule",{value:!0});qe.parseObjectDef=qe.parseObjectDefX=void 0;var et=P();function ns(r,e){return e.removeAdditionalStrategy==="strict"?r.catchall._def.typeName==="ZodNever"?r.unknownKeys!=="strict":(0, et.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:r.catchall._def.typeName==="ZodNever"?r.unknownKeys==="passthrough":(0, et.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ei(r,e){Object.keys(r.shape()).reduce((s,n)=>{let o=r.shape()[n],a=o.isOptional();a||(o={...o._def.innerSchema});let i=(0, et.parseDef)(o._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return i!==void 0&&(s.properties[n]=i,a||(s.required||(s.required=[]),s.required.push(n))),s},{type:"object",properties:{},additionalProperties:ns(r,e)});let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,o])=>{if(o===void 0||o._def===void 0)return s;let a=(0, et.parseDef)(o._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return a===void 0?s:{properties:{...s.properties,[n]:a},required:o.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:ns(r,e)};return t.required.length||delete t.required,t}qe.parseObjectDefX=ei;function ti(r,e){let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,o])=>{if(o===void 0||o._def===void 0)return s;let a=(0, et.parseDef)(o._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return a===void 0?s:{properties:{...s.properties,[n]:a},required:o.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:ns(r,e)};return t.required.length||delete t.required,t}qe.parseObjectDef=ti;});var as=_(or=>{Object.defineProperty(or,"__esModule",{value:!0});or.parseOptionalDef=void 0;var ln=P(),ri=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, ln.parseDef)(r.innerType._def,e);let t=(0, ln.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};or.parseOptionalDef=ri;});var is=_(ir=>{Object.defineProperty(ir,"__esModule",{value:!0});ir.parsePipelineDef=void 0;var ar=P(),si=(r,e)=>{if(e.pipeStrategy==="input")return (0, ar.parseDef)(r.in._def,e);if(e.pipeStrategy==="output")return (0, ar.parseDef)(r.out._def,e);let t=(0, ar.parseDef)(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=(0, ar.parseDef)(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,s].filter(n=>n!==void 0)}};ir.parsePipelineDef=si;});var ds=_(dr=>{Object.defineProperty(dr,"__esModule",{value:!0});dr.parsePromiseDef=void 0;var ni=P();function oi(r,e){return (0, ni.parseDef)(r.type._def,e)}dr.parsePromiseDef=oi;});var cs=_(cr=>{Object.defineProperty(cr,"__esModule",{value:!0});cr.parseSetDef=void 0;var fn=te(),ai=P();function ii(r,e){let s={type:"array",uniqueItems:!0,items:(0, ai.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&(0, fn.setResponseValueAndErrors)(s,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&(0, fn.setResponseValueAndErrors)(s,"maxItems",r.maxSize.value,r.maxSize.message,e),s}cr.parseSetDef=ii;});var ls=_(ur=>{Object.defineProperty(ur,"__esModule",{value:!0});ur.parseTupleDef=void 0;var us=P();function di(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,s)=>(0, us.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:(0, us.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, us.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}ur.parseTupleDef=di;});var fs=_(lr=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.parseUndefinedDef=void 0;function ci(){return {not:{}}}lr.parseUndefinedDef=ci;});var ps=_(fr=>{Object.defineProperty(fr,"__esModule",{value:!0});fr.parseUnknownDef=void 0;function ui(){return {}}fr.parseUnknownDef=ui;});var hs=_(pr=>{Object.defineProperty(pr,"__esModule",{value:!0});pr.parseReadonlyDef=void 0;var li=P(),fi=(r,e)=>(0, li.parseDef)(r.innerType._def,e);pr.parseReadonlyDef=fi;});var P=_(hr=>{Object.defineProperty(hr,"__esModule",{value:!0});hr.parseDef=void 0;var T=Zt(),pi=Lr(),hi=qr(),mi=Vr(),yi=$r(),_i=Fr(),gi=Wr(),vi=Br(),wi=Kr(),Ti=zr(),Ri=Hr(),Oi=Gr(),xi=Jr(),Ii=Xr(),Ei=Qr(),bi=es(),Pi=ts(),Ai=rs(),Ci=ss(),Si=os(),Ni=as(),ki=is(),Di=ds(),Zi=Yt(),ji=cs(),Mi=Gt(),Ui=ls(),Li=fs(),qi=rr(),Vi=ps(),$i=hs(),Fi=Et();function pn(r,e,t=!1){let s=e.seen.get(r);if(e.override){let a=e.override?.(r,e,s,t);if(a!==Fi.ignoreOverride)return a}if(s&&!t){let a=Wi(s,e);if(a!==void 0)return a}let n={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,n);let o=Ki(r,r.typeName,e);return o&&zi(r,e,o),n.jsonSchema=o,o}hr.parseDef=pn;var Wi=(r,e)=>{switch(e.$refStrategy){case"root":return {$ref:r.path.join("/")};case"relative":return {$ref:Bi(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}},Bi=(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("/")},Ki=(r,e,t)=>{switch(e){case T.ZodFirstPartyTypeKind.ZodString:return (0, Mi.parseStringDef)(r,t);case T.ZodFirstPartyTypeKind.ZodNumber:return (0, Ci.parseNumberDef)(r,t);case T.ZodFirstPartyTypeKind.ZodObject:return (0, Si.parseObjectDef)(r,t);case T.ZodFirstPartyTypeKind.ZodBigInt:return (0, mi.parseBigintDef)(r,t);case T.ZodFirstPartyTypeKind.ZodBoolean:return (0, yi.parseBooleanDef)();case T.ZodFirstPartyTypeKind.ZodDate:return (0, vi.parseDateDef)(r,t);case T.ZodFirstPartyTypeKind.ZodUndefined:return (0, Li.parseUndefinedDef)();case T.ZodFirstPartyTypeKind.ZodNull:return (0, Pi.parseNullDef)(t);case T.ZodFirstPartyTypeKind.ZodArray:return (0, hi.parseArrayDef)(r,t);case T.ZodFirstPartyTypeKind.ZodUnion:case T.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, qi.parseUnionDef)(r,t);case T.ZodFirstPartyTypeKind.ZodIntersection:return (0, Oi.parseIntersectionDef)(r,t);case T.ZodFirstPartyTypeKind.ZodTuple:return (0, Ui.parseTupleDef)(r,t);case T.ZodFirstPartyTypeKind.ZodRecord:return (0, Zi.parseRecordDef)(r,t);case T.ZodFirstPartyTypeKind.ZodLiteral:return (0, xi.parseLiteralDef)(r,t);case T.ZodFirstPartyTypeKind.ZodEnum:return (0, Ri.parseEnumDef)(r);case T.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, Ei.parseNativeEnumDef)(r);case T.ZodFirstPartyTypeKind.ZodNullable:return (0, Ai.parseNullableDef)(r,t);case T.ZodFirstPartyTypeKind.ZodOptional:return (0, Ni.parseOptionalDef)(r,t);case T.ZodFirstPartyTypeKind.ZodMap:return (0, Ii.parseMapDef)(r,t);case T.ZodFirstPartyTypeKind.ZodSet:return (0, ji.parseSetDef)(r,t);case T.ZodFirstPartyTypeKind.ZodLazy:return pn(r.getter()._def,t);case T.ZodFirstPartyTypeKind.ZodPromise:return (0, Di.parsePromiseDef)(r,t);case T.ZodFirstPartyTypeKind.ZodNaN:case T.ZodFirstPartyTypeKind.ZodNever:return (0, bi.parseNeverDef)();case T.ZodFirstPartyTypeKind.ZodEffects:return (0, Ti.parseEffectsDef)(r,t);case T.ZodFirstPartyTypeKind.ZodAny:return (0, pi.parseAnyDef)();case T.ZodFirstPartyTypeKind.ZodUnknown:return (0, Vi.parseUnknownDef)();case T.ZodFirstPartyTypeKind.ZodDefault:return (0, wi.parseDefaultDef)(r,t);case T.ZodFirstPartyTypeKind.ZodBranded:return (0, _i.parseBrandedDef)(r,t);case T.ZodFirstPartyTypeKind.ZodReadonly:return (0, $i.parseReadonlyDef)(r,t);case T.ZodFirstPartyTypeKind.ZodCatch:return (0, gi.parseCatchDef)(r,t);case T.ZodFirstPartyTypeKind.ZodPipeline:return (0, ki.parsePipelineDef)(r,t);case T.ZodFirstPartyTypeKind.ZodFunction:case T.ZodFirstPartyTypeKind.ZodVoid:case T.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (s=>{})()}},zi=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);});var ms=_(mr=>{Object.defineProperty(mr,"__esModule",{value:!0});mr.zodToJsonSchema=void 0;var hn=P(),Hi=Sr(),Gi=(r,e)=>{let t=(0, Hi.getRefs)(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,h])=>({...u,[l]:(0, hn.parseDef)(h._def,{...t,currentPath:[...t.basePath,t.definitionPath,l]},!0)??{}}),{}):void 0,n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=(0, hn.parseDef)(r._def,n===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,n]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(o.title=a);let i=n===void 0?s?{...o,[t.definitionPath]:s}:o:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,n].join("/"),[t.definitionPath]:{...s,[n]:o}};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};mr.zodToJsonSchema=Gi;});var mn=_(w=>{var Ji=w&&w.__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];}),R=w&&w.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ji(e,r,t);};Object.defineProperty(w,"__esModule",{value:!0});R(Et(),w);R(Sr(),w);R(te(),w);R(P(),w);R(Lr(),w);R(qr(),w);R(Vr(),w);R($r(),w);R(Fr(),w);R(Wr(),w);R(Br(),w);R(Kr(),w);R(zr(),w);R(Hr(),w);R(Gr(),w);R(Jr(),w);R(Xr(),w);R(Qr(),w);R(es(),w);R(ts(),w);R(rs(),w);R(ss(),w);R(os(),w);R(as(),w);R(is(),w);R(ds(),w);R(hs(),w);R(Yt(),w);R(cs(),w);R(Gt(),w);R(ls(),w);R(fs(),w);R(rr(),w);R(ps(),w);R(ms(),w);var Yi=ms();w.default=Yi.zodToJsonSchema;});var gs=/\+/g;function Tr(r=""){try{return decodeURIComponent(""+r)}catch{return ""+r}}function Rn(r){return Tr(r.replace(gs," "))}function On(r){return Tr(r.replace(gs," "))}function xn(r=""){let e={};r[0]==="?"&&(r=r.slice(1));for(let t of r.split("&")){let s=t.match(/([^=]+)=?(.*)/)||[];if(s.length<2)continue;let n=Rn(s[1]);if(n==="__proto__"||n==="constructor")continue;let o=On(s[2]||"");e[n]===void 0?e[n]=o:Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o];}return e}var In=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,En=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,bn=/^([/\\]\s*){2,}[^/\\]/;function Pn(r,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?In.test(r):En.test(r)||(e.acceptRelative?bn.test(r):!1)}function vs(r){return xn(Rr(r).search)}var An=Symbol.for("ufo:protocolRelative");function Rr(r="",e){let t=r.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(t){let[,x,L=""]=t;return {protocol:x.toLowerCase(),pathname:L,href:x+L,auth:"",host:"",search:"",hash:""}}if(!Pn(r,{acceptRelative:!0}))return e?Rr(e+r):_s(r);let[,s="",n,o=""]=r.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,a="",i=""]=o.match(/([^#/?]*)(.*)?/)||[],{pathname:u,search:l,hash:h}=_s(i.replace(/\/(?=[A-Za-z]:)/,""));return {protocol:s.toLowerCase(),auth:n?n.slice(0,Math.max(0,n.length-1)):"",host:a,pathname:u,search:l,hash:h,[An]:!s}}function _s(r=""){let[e="",t="",s=""]=(r.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return {pathname:e,search:t,hash:s}}var Cn=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Sn=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Nn=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function kn(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Dn(r);return}return e}function Dn(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`);}function ws(r,e={}){if(typeof r!="string")return r;let t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){let s=t.toLowerCase();if(s==="true")return !0;if(s==="false")return !1;if(s==="undefined")return;if(s==="null")return null;if(s==="nan")return Number.NaN;if(s==="infinity")return Number.POSITIVE_INFINITY;if(s==="-infinity")return Number.NEGATIVE_INFINITY}if(!Nn.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(Cn.test(r)||Sn.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,kn)}return JSON.parse(r)}catch(s){if(e.strict)throw s;return r}}function Pr(r,e){try{return e in r}catch{return !1}}var jn=Object.defineProperty,Mn=(r,e,t)=>e in r?jn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ce=(r,e,t)=>(Mn(r,typeof e!="symbol"?e+"":e,t),t),$e=class extends Error{constructor(e,t={}){super(e,t),ce(this,"statusCode",500),ce(this,"fatal",!1),ce(this,"unhandled",!1),ce(this,"statusMessage"),ce(this,"data"),ce(this,"cause"),t.cause&&!this.cause&&(this.cause=t.cause);}toJSON(){let e={message:this.message,statusCode:br(this.statusCode,500)};return this.statusMessage&&(e.statusMessage=Es(this.statusMessage)),this.data!==void 0&&(e.data=this.data),e}};ce($e,"__h3_error__",!0);function Os(r){if(typeof r=="string")return new $e(r);if(Un(r))return r;let e=new $e(r.message??r.statusMessage??"",{cause:r.cause||r});if(Pr(r,"stack"))try{Object.defineProperty(e,"stack",{get(){return r.stack}});}catch{try{e.stack=r.stack;}catch{}}if(r.data&&(e.data=r.data),r.statusCode?e.statusCode=br(r.statusCode,e.statusCode):r.status&&(e.statusCode=br(r.status,e.statusCode)),r.statusMessage?e.statusMessage=r.statusMessage:r.statusText&&(e.statusMessage=r.statusText),e.statusMessage){let t=e.statusMessage;Es(e.statusMessage)!==t&&console.warn("[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default.");}return r.fatal!==void 0&&(e.fatal=r.fatal),r.unhandled!==void 0&&(e.unhandled=r.unhandled),e}function Un(r){return r?.constructor?.__h3_error__===!0}function xs(r){return vs(r.path||"")}function Ln(r,e,t){if(t&&r.method==="HEAD")return !0;if(typeof e=="string"){if(r.method===e)return !0}else if(e.includes(r.method))return !0;return !1}function qn(r,e,t){if(!Ln(r,e,t))throw Os({statusCode:405,statusMessage:"HTTP method is not allowed."})}function Vn(r){let e={};for(let t in r.node.req.headers){let s=r.node.req.headers[t];e[t]=Array.isArray(s)?s.filter(Boolean).join(", "):s;}return e}function $n(r,e){return Vn(r)[e.toLowerCase()]}var Ar=$n;var Ts=Symbol.for("h3RawBody"),Er=Symbol.for("h3ParsedBody"),Fn=["PATCH","POST","PUT","DELETE"];function Wn(r,e="utf8"){qn(r,Fn);let t=r._requestBody||r.web?.request?.body||r.node.req[Ts]||r.node.req.rawBody||r.node.req.body;if(t){let o=Promise.resolve(t).then(a=>Buffer.isBuffer(a)?a:typeof a.pipeTo=="function"?new Promise((i,u)=>{let l=[];a.pipeTo(new WritableStream({write(h){l.push(h);},close(){i(Buffer.concat(l));},abort(h){u(h);}})).catch(u);}):typeof a.pipe=="function"?new Promise((i,u)=>{let l=[];a.on("data",h=>{l.push(h);}).on("end",()=>{i(Buffer.concat(l));}).on("error",u);}):a.constructor===Object?Buffer.from(JSON.stringify(a)):Buffer.from(a));return e?o.then(a=>a.toString(e)):o}if(!Number.parseInt(r.node.req.headers["content-length"]||""))return Promise.resolve(void 0);let s=r.node.req[Ts]=new Promise((o,a)=>{let i=[];r.node.req.on("error",u=>{a(u);}).on("data",u=>{i.push(u);}).on("end",()=>{o(Buffer.concat(i));});});return e?s.then(o=>o.toString(e)):s}async function Is(r,e={}){let t=r.node.req;if(Pr(t,Er))return t[Er];let s=t.headers["content-type"]||"",n=await Wn(r),o;return s==="application/json"?o=Rs(n,e.strict??!0):s.startsWith("application/x-www-form-urlencoded")?o=Bn(n):s.startsWith("text/")?o=n:o=Rs(n,e.strict??!1),t[Er]=o,o}function Rs(r="",e){if(r)try{return ws(r,{strict:e})}catch{throw Os({statusCode:400,statusMessage:"Bad Request",message:"Invalid JSON body"})}}function Bn(r){let e=new URLSearchParams(r),t=Object.create(null);for(let[s,n]of e.entries())Pr(t,s)?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(n)):t[s]=n;return t}var Kn=/[^\u0009\u0020-\u007E]/g;function Es(r=""){return r.replace(Kn,"")}function br(r,e=200){return !r||(typeof r=="string"&&(r=Number.parseInt(r,10)),r<100||r>999)?e:r}var zn=typeof setImmediate>"u"?r=>r():setImmediate;function bs(r,e,t){return t&&Hn(r,t),new Promise(s=>{zn(()=>{r.handled||r.node.res.end(e),s();});})}function Hn(r,e){e&&r.node.res.statusCode!==304&&!r.node.res.getHeader("content-type")&&r.node.res.setHeader("content-type",e);}function Gn(r,e){for(let[t,s]of Object.entries(e))r.node.res.setHeader(t,s);}var Ps=Gn;var rt=(s=>(s.TRIGGER="trigger",s.EXECUTE="execute",s.PREVIEW="preview",s))(rt||{}),st=(s=>(s.DISCOVER="discover",s.HEALTH_CHECK="health-check",s.CODE="code",s))(st||{});var q=(E=>(E.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",E.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",E.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",E.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",E.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",E.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",E.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",E.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",E.STEP_NOT_FOUND_ERROR="StepNotFoundError",E.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",E.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",E.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",E.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",E.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",E.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",E.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",E.INVALID_ACTION_ERROR="InvalidActionError",E.MISSING_API_KEY_ERROR="MissingApiKeyError",E.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",E.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",E.SIGNATURE_INVALID_ERROR="SignatureInvalidError",E.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",E.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",E.PLATFORM_ERROR="PlatformError",E.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",E))(q||{});var nt=(s=>(s.POST="POST",s.GET="GET",s.OPTIONS="OPTIONS",s))(nt||{});var H=class extends Error{data},ot=class extends H{statusCode=404},Z=class extends H{statusCode=400},Q=class extends H{statusCode=401},Ae=class extends H{statusCode=500},at=class extends H{statusCode=409};var it=class extends Z{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};}},Fe=class extends Z{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},dt=class extends Z{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},ct=class extends Z{code="ExecutionStateControlInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=s;}},ut=class extends Z{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;}},lt=class extends Z{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;}},ft=class extends Z{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 b={info:r=>Ce__default.default.blue(r),warning:r=>Ce__default.default.yellow(r),error:r=>Ce__default.default.red(r),success:r=>Ce__default.default.green(r),underline:r=>Ce__default.default.underline(r),bold:r=>Ce__default.default.bold(r)},A={SUCCESS:b.success("\u2714"),ERROR:b.error("\u2717"),WARNING:b.warning("\u26A0"),INFO:b.info("\u2139"),ARROW:b.bold("\u2192"),MOCK:b.info("\u25CB"),HYDRATED:b.bold(b.info("\u2192")),STEP:b.info("\u03C3"),ACTION:b.info("\u03B1"),DURATION:b.info("\u0394"),PROVIDER:b.info("\u2699"),OUTPUT:b.info("\u21E2"),INPUT:b.info("\u21E0"),WORKFLOW:b.info("\u03C9"),STATE:b.info("\u03C3"),EXECUTE:b.info("\u03B5"),PREVIEW:b.info("\u03C1")};var Cr=r=>Object.values(r).map(e=>`\`${e}\``).join(", "),pt=r=>r.replaceAll(/(\w)(\w*)/g,(e,t,s)=>t.toUpperCase()+s.toLowerCase()).replaceAll(/[\s-]+/g,"");var Cs=(r,e="https://api.novu.co/v1")=>({post:async(t,s)=>await fetch(e+t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${r}`},body:JSON.stringify(s)})});var ht=class extends H{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${Cr(nt)}`},We=class extends Z{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${Cr(t)}`);}};var mt=class extends Ae{code="PlatformError";message="Something went wrong. Please try again later."};var Be=class extends at{constructor(e,t){super(`${pt(e)} with id: \`${t}\` already exists. Please use a different id.`);}},ee=class extends ot{constructor(e,t){super(`${pt(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Se=class extends Ae{constructor(e,t){super(`Failed to execute ${pt(e)} with id: \`${t}\`. Please try again later.`);}};var yt=class extends ee{code="ProviderNotFoundError";constructor(e){super("provider",e);}},_t=class extends Se{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var gt=class extends Q{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");}},vt=class extends Q{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},wt=class extends Q{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},Tt=class extends Q{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);}},Rt=class extends Q{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.apiKey`");}};var Ot=class extends ee{code="StepNotFoundError";constructor(e){super("step",e);}};var Ke=class extends ee{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},xt=class extends Be{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var It=class{ajv;compiledSchemas;constructor(){this.ajv=new Xn__default.default({useDefaults:!0,removeAdditional:"all"}),Qn__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(o=>({path:o.instancePath,message:o.message}))}}transformToJsonSchema(e){return e}};var yr=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 mn().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 yn=[new yr,new It],_n=async(r,e)=>{for(let t of yn)if(t.isSchema(r))return t.validate(e,r);throw new Error("Invalid schema")},gn=r=>{for(let e of yn)if(e.isSchema(r))return e.transformToJsonSchema(r);throw new Error("Invalid schema")};var vn={name:"@novu/framework",version:"0.24.3-alpha.10",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:{"@novu/shared":"0.24.2",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 tt=vn.version,_r="2024-06-26";jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});var vr=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;apiKey;version=tt;strictAuthentication;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.NODE_ENV==="development"&&(t.strictAuthentication=!1),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(s=>s.workflowId===t.workflowId))throw new xt(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",sdkVersion:tt,frameworkVersion:_r,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(s=>s.workflowId===e);if(t)return t;throw new Ke(e)}getStep(e,t){let n=this.getWorkflow(e).steps.find(o=>o.stepId===t);if(n)return n;throw new Ot(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(gn(e))}async validate(e,t,s,n,o,a,i){let u=await _n(t,e);if(u.success)return u.data;switch(s){case"event":this.throwInvalidEvent(n,o,u.errors);case"step":this.throwInvalidStep(a,n,o,u.errors);case"provider":this.throwInvalidProvider(a,i,n,o,u.errors);default:throw new Error(`Invalid component: '${s}'`)}}throwInvalidProvider(e,t,s,n,o){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(s){case"output":throw new ft(n,e,t,o);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 ut(s,e,n);case"result":throw new lt(s,e,n);case"controls":throw new ct(s,e,n);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,s){switch(e){case"controls":throw new dt(t,s);case"payload":throw new Fe(t,s);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(s,n,o)=>{let a=this.getStep(e.workflowId,s),i=ed(e),u=await this.createStepControls(a,i),l=e.action==="preview";if(!l&&await this.shouldSkip(o?.skip,u))return t({options:{skip:!0}}),{};let h=this.previewStep.bind(this),x=this.executeStep.bind(this),X=await(l?h:x)(e,{...a,providers:a.providers.map(Pe=>{let Ve=o?.providers?.[Pe.type];if(!Ve)throw new yt(Pe.type);return {...Pe,resolve:Ve}}),resolve:n});return s===e.stepId&&t(X),X.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let n=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
23
- ${b.bold(b.underline(n))} '${e.workflowId}'`);let o=this.getWorkflow(e.workflowId),a=process.hrtime(),i={outputs:{},providers:{},options:{}},u,l=new Promise(de=>{u=de;}),h=de=>{u(),i=de;},x;try{if(e.action==="execute"&&!e.payload&&!e.data)throw new Fe(e.workflowId,{message:"Event `payload` is required"});let de=await this.createExecutionPayload(e,o);await Promise.race([l,o.execute({payload:de,environment:{},inputs:{},controls:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(e,h),sms:this.executeStepFactory(e,h),inApp:this.executeStepFactory(e,h),digest:this.executeStepFactory(e,h),delay:this.executeStepFactory(e,h),push:this.executeStepFactory(e,h),chat:this.executeStepFactory(e,h),custom:this.executeStepFactory(e,h)}})]);}catch(de){x=de;}let L=process.hrtime(a),X=L[0],Pe=L[1],Ve=X*1e3+Pe/1e6,wn=x?A.ERROR:A.SUCCESS,Tn=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${wn} ${Tn} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Ve,x),x)throw x;return {outputs:i.outputs,providers:i.providers,options:i.options,metadata:{status:"success",error:!1,duration:Ve}}}async createExecutionPayload(e,t){let s=e.payload||e.data;if(e.action==="preview"){let o=this.mock(t.payload.schema);s=Object.assign(o,s);}return await this.validate(s,t.payload.unknownSchema,"event","payload",e.workflowId)}prettyPrintExecute(e,t,s){let n=s?A.ERROR:A.SUCCESS,o=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",a=s?"Failed to execute":o,i=s?b.error:b.success,u=`${n} ${a} workflowId: '${e.workflowId}`;console.log(`
22
+ ]`;continue}n+=s[u],s[u]==="\\"?o=!0:a&&s[u]==="]"?a=!1:!a&&s[u]==="["&&(a=!0);}try{let u=new RegExp(n);}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return n};});var Yt=_(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseRecordDef=void 0;var Yr=Zt(),on=P(),Wa=Gt();function Ba(r,e){if(e.target==="openApi3"&&r.keyType?._def.typeName===Yr.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((s,n)=>({...s,[n]:(0, on.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, on.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===Yr.ZodFirstPartyTypeKind.ZodString&&r.keyType._def.checks?.length){let s=Object.entries((0, Wa.parseStringDef)(r.keyType._def,e)).reduce((n,[o,a])=>o==="type"?n:{...n,[o]:a},{});return {...t,propertyNames:s}}else if(r.keyType?._def.typeName===Yr.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:r.keyType._def.values}};return t}Jt.parseRecordDef=Ba;});var Xr=_(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseMapDef=void 0;var an=P(),Ka=Yt();function za(r,e){if(e.mapStrategy==="record")return (0, Ka.parseRecordDef)(r,e);let t=(0, an.parseDef)(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},s=(0, an.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}}}Xt.parseMapDef=za;});var Qr=_(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseNativeEnumDef=void 0;function Ha(r){let e=r.values,s=Object.keys(r.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),n=Array.from(new Set(s.map(o=>typeof o)));return {type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:s}}Qt.parseNativeEnumDef=Ha;});var es=_(er=>{Object.defineProperty(er,"__esModule",{value:!0});er.parseNeverDef=void 0;function Ga(){return {not:{}}}er.parseNeverDef=Ga;});var ts=_(tr=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.parseNullDef=void 0;function Ja(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}tr.parseNullDef=Ja;});var rr=_(ae=>{Object.defineProperty(ae,"__esModule",{value:!0});ae.parseUnionDef=ae.primitiveMappings=void 0;var Ya=P();ae.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Xa(r,e){if(e.target==="openApi3")return dn(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(s=>s._def.typeName in ae.primitiveMappings&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((n,o)=>{let a=ae.primitiveMappings[o._def.typeName];return a&&!n.includes(a)?[...n,a]: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,o)=>{let a=typeof o._def.value;switch(a){case"string":case"number":case"boolean":return [...n,a];case"bigint":return [...n,"integer"];case"object":if(o._def.value===null)return [...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(s.length===t.length){let n=s.filter((o,a,i)=>i.indexOf(o)===a);return {type:n.length>1?n:n[0],enum:t.reduce((o,a)=>o.includes(a._def.value)?o:[...o,a._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((s,n)=>[...s,...n._def.values.filter(o=>!s.includes(o))],[])};return dn(r,e)}ae.parseUnionDef=Xa;var dn=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((s,n)=>(0, Ya.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 rs=_(sr=>{Object.defineProperty(sr,"__esModule",{value:!0});sr.parseNullableDef=void 0;var cn=P(),un=rr();function Qa(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:un.primitiveMappings[r.innerType._def.typeName],nullable:!0}:{type:[un.primitiveMappings[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=(0, cn.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=(0, cn.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}sr.parseNullableDef=Qa;});var ss=_(nr=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.parseNumberDef=void 0;var ie=te();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, ie.addErrorMessage)(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?(0, ie.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e):(0, ie.setResponseValueAndErrors)(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),(0, ie.setResponseValueAndErrors)(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?(0, ie.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e):(0, ie.setResponseValueAndErrors)(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),(0, ie.setResponseValueAndErrors)(t,"maximum",s.value,s.message,e));break;case"multipleOf":(0, ie.setResponseValueAndErrors)(t,"multipleOf",s.value,s.message,e);break}return t}nr.parseNumberDef=ei;});var os=_(qe=>{Object.defineProperty(qe,"__esModule",{value:!0});qe.parseObjectDef=qe.parseObjectDefX=void 0;var et=P();function ns(r,e){return e.removeAdditionalStrategy==="strict"?r.catchall._def.typeName==="ZodNever"?r.unknownKeys!=="strict":(0, et.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:r.catchall._def.typeName==="ZodNever"?r.unknownKeys==="passthrough":(0, et.parseDef)(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ti(r,e){Object.keys(r.shape()).reduce((s,n)=>{let o=r.shape()[n],a=o.isOptional();a||(o={...o._def.innerSchema});let i=(0, et.parseDef)(o._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return i!==void 0&&(s.properties[n]=i,a||(s.required||(s.required=[]),s.required.push(n))),s},{type:"object",properties:{},additionalProperties:ns(r,e)});let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,o])=>{if(o===void 0||o._def===void 0)return s;let a=(0, et.parseDef)(o._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return a===void 0?s:{properties:{...s.properties,[n]:a},required:o.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:ns(r,e)};return t.required.length||delete t.required,t}qe.parseObjectDefX=ti;function ri(r,e){let t={type:"object",...Object.entries(r.shape()).reduce((s,[n,o])=>{if(o===void 0||o._def===void 0)return s;let a=(0, et.parseDef)(o._def,{...e,currentPath:[...e.currentPath,"properties",n],propertyPath:[...e.currentPath,"properties",n]});return a===void 0?s:{properties:{...s.properties,[n]:a},required:o.isOptional()?s.required:[...s.required,n]}},{properties:{},required:[]}),additionalProperties:ns(r,e)};return t.required.length||delete t.required,t}qe.parseObjectDef=ri;});var as=_(or=>{Object.defineProperty(or,"__esModule",{value:!0});or.parseOptionalDef=void 0;var ln=P(),si=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, ln.parseDef)(r.innerType._def,e);let t=(0, ln.parseDef)(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};or.parseOptionalDef=si;});var is=_(ir=>{Object.defineProperty(ir,"__esModule",{value:!0});ir.parsePipelineDef=void 0;var ar=P(),ni=(r,e)=>{if(e.pipeStrategy==="input")return (0, ar.parseDef)(r.in._def,e);if(e.pipeStrategy==="output")return (0, ar.parseDef)(r.out._def,e);let t=(0, ar.parseDef)(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=(0, ar.parseDef)(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,s].filter(n=>n!==void 0)}};ir.parsePipelineDef=ni;});var ds=_(dr=>{Object.defineProperty(dr,"__esModule",{value:!0});dr.parsePromiseDef=void 0;var oi=P();function ai(r,e){return (0, oi.parseDef)(r.type._def,e)}dr.parsePromiseDef=ai;});var cs=_(cr=>{Object.defineProperty(cr,"__esModule",{value:!0});cr.parseSetDef=void 0;var fn=te(),ii=P();function di(r,e){let s={type:"array",uniqueItems:!0,items:(0, ii.parseDef)(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&(0, fn.setResponseValueAndErrors)(s,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&(0, fn.setResponseValueAndErrors)(s,"maxItems",r.maxSize.value,r.maxSize.message,e),s}cr.parseSetDef=di;});var ls=_(ur=>{Object.defineProperty(ur,"__esModule",{value:!0});ur.parseTupleDef=void 0;var us=P();function ci(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,s)=>(0, us.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:(0, us.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, us.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}ur.parseTupleDef=ci;});var fs=_(lr=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.parseUndefinedDef=void 0;function ui(){return {not:{}}}lr.parseUndefinedDef=ui;});var ps=_(fr=>{Object.defineProperty(fr,"__esModule",{value:!0});fr.parseUnknownDef=void 0;function li(){return {}}fr.parseUnknownDef=li;});var hs=_(pr=>{Object.defineProperty(pr,"__esModule",{value:!0});pr.parseReadonlyDef=void 0;var fi=P(),pi=(r,e)=>(0, fi.parseDef)(r.innerType._def,e);pr.parseReadonlyDef=pi;});var P=_(hr=>{Object.defineProperty(hr,"__esModule",{value:!0});hr.parseDef=void 0;var T=Zt(),hi=Lr(),mi=qr(),yi=Vr(),_i=$r(),gi=Fr(),vi=Wr(),wi=Br(),Ti=Kr(),Ri=zr(),Oi=Hr(),xi=Gr(),Ii=Jr(),Ei=Xr(),bi=Qr(),Pi=es(),Ai=ts(),Ci=rs(),Si=ss(),Ni=os(),ki=as(),Di=is(),Zi=ds(),ji=Yt(),Mi=cs(),Ui=Gt(),Li=ls(),qi=fs(),Vi=rr(),$i=ps(),Fi=hs(),Wi=Et();function pn(r,e,t=!1){let s=e.seen.get(r);if(e.override){let a=e.override?.(r,e,s,t);if(a!==Wi.ignoreOverride)return a}if(s&&!t){let a=Bi(s,e);if(a!==void 0)return a}let n={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,n);let o=zi(r,r.typeName,e);return o&&Hi(r,e,o),n.jsonSchema=o,o}hr.parseDef=pn;var Bi=(r,e)=>{switch(e.$refStrategy){case"root":return {$ref:r.path.join("/")};case"relative":return {$ref:Ki(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}},Ki=(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("/")},zi=(r,e,t)=>{switch(e){case T.ZodFirstPartyTypeKind.ZodString:return (0, Ui.parseStringDef)(r,t);case T.ZodFirstPartyTypeKind.ZodNumber:return (0, Si.parseNumberDef)(r,t);case T.ZodFirstPartyTypeKind.ZodObject:return (0, Ni.parseObjectDef)(r,t);case T.ZodFirstPartyTypeKind.ZodBigInt:return (0, yi.parseBigintDef)(r,t);case T.ZodFirstPartyTypeKind.ZodBoolean:return (0, _i.parseBooleanDef)();case T.ZodFirstPartyTypeKind.ZodDate:return (0, wi.parseDateDef)(r,t);case T.ZodFirstPartyTypeKind.ZodUndefined:return (0, qi.parseUndefinedDef)();case T.ZodFirstPartyTypeKind.ZodNull:return (0, Ai.parseNullDef)(t);case T.ZodFirstPartyTypeKind.ZodArray:return (0, mi.parseArrayDef)(r,t);case T.ZodFirstPartyTypeKind.ZodUnion:case T.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, Vi.parseUnionDef)(r,t);case T.ZodFirstPartyTypeKind.ZodIntersection:return (0, xi.parseIntersectionDef)(r,t);case T.ZodFirstPartyTypeKind.ZodTuple:return (0, Li.parseTupleDef)(r,t);case T.ZodFirstPartyTypeKind.ZodRecord:return (0, ji.parseRecordDef)(r,t);case T.ZodFirstPartyTypeKind.ZodLiteral:return (0, Ii.parseLiteralDef)(r,t);case T.ZodFirstPartyTypeKind.ZodEnum:return (0, Oi.parseEnumDef)(r);case T.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, bi.parseNativeEnumDef)(r);case T.ZodFirstPartyTypeKind.ZodNullable:return (0, Ci.parseNullableDef)(r,t);case T.ZodFirstPartyTypeKind.ZodOptional:return (0, ki.parseOptionalDef)(r,t);case T.ZodFirstPartyTypeKind.ZodMap:return (0, Ei.parseMapDef)(r,t);case T.ZodFirstPartyTypeKind.ZodSet:return (0, Mi.parseSetDef)(r,t);case T.ZodFirstPartyTypeKind.ZodLazy:return pn(r.getter()._def,t);case T.ZodFirstPartyTypeKind.ZodPromise:return (0, Zi.parsePromiseDef)(r,t);case T.ZodFirstPartyTypeKind.ZodNaN:case T.ZodFirstPartyTypeKind.ZodNever:return (0, Pi.parseNeverDef)();case T.ZodFirstPartyTypeKind.ZodEffects:return (0, Ri.parseEffectsDef)(r,t);case T.ZodFirstPartyTypeKind.ZodAny:return (0, hi.parseAnyDef)();case T.ZodFirstPartyTypeKind.ZodUnknown:return (0, $i.parseUnknownDef)();case T.ZodFirstPartyTypeKind.ZodDefault:return (0, Ti.parseDefaultDef)(r,t);case T.ZodFirstPartyTypeKind.ZodBranded:return (0, gi.parseBrandedDef)(r,t);case T.ZodFirstPartyTypeKind.ZodReadonly:return (0, Fi.parseReadonlyDef)(r,t);case T.ZodFirstPartyTypeKind.ZodCatch:return (0, vi.parseCatchDef)(r,t);case T.ZodFirstPartyTypeKind.ZodPipeline:return (0, Di.parsePipelineDef)(r,t);case T.ZodFirstPartyTypeKind.ZodFunction:case T.ZodFirstPartyTypeKind.ZodVoid:case T.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (s=>{})()}},Hi=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);});var ms=_(mr=>{Object.defineProperty(mr,"__esModule",{value:!0});mr.zodToJsonSchema=void 0;var hn=P(),Gi=Sr(),Ji=(r,e)=>{let t=(0, Gi.getRefs)(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,h])=>({...u,[l]:(0, hn.parseDef)(h._def,{...t,currentPath:[...t.basePath,t.definitionPath,l]},!0)??{}}),{}):void 0,n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=(0, hn.parseDef)(r._def,n===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,n]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(o.title=a);let i=n===void 0?s?{...o,[t.definitionPath]:s}:o:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,n].join("/"),[t.definitionPath]:{...s,[n]:o}};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};mr.zodToJsonSchema=Ji;});var mn=_(w=>{var Yi=w&&w.__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];}),R=w&&w.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Yi(e,r,t);};Object.defineProperty(w,"__esModule",{value:!0});R(Et(),w);R(Sr(),w);R(te(),w);R(P(),w);R(Lr(),w);R(qr(),w);R(Vr(),w);R($r(),w);R(Fr(),w);R(Wr(),w);R(Br(),w);R(Kr(),w);R(zr(),w);R(Hr(),w);R(Gr(),w);R(Jr(),w);R(Xr(),w);R(Qr(),w);R(es(),w);R(ts(),w);R(rs(),w);R(ss(),w);R(os(),w);R(as(),w);R(is(),w);R(ds(),w);R(hs(),w);R(Yt(),w);R(cs(),w);R(Gt(),w);R(ls(),w);R(fs(),w);R(rr(),w);R(ps(),w);R(ms(),w);var Xi=ms();w.default=Xi.zodToJsonSchema;});var gs=/\+/g;function Tr(r=""){try{return decodeURIComponent(""+r)}catch{return ""+r}}function On(r){return Tr(r.replace(gs," "))}function xn(r){return Tr(r.replace(gs," "))}function In(r=""){let e={};r[0]==="?"&&(r=r.slice(1));for(let t of r.split("&")){let s=t.match(/([^=]+)=?(.*)/)||[];if(s.length<2)continue;let n=On(s[1]);if(n==="__proto__"||n==="constructor")continue;let o=xn(s[2]||"");e[n]===void 0?e[n]=o:Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o];}return e}var En=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,bn=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,Pn=/^([/\\]\s*){2,}[^/\\]/;function An(r,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?En.test(r):bn.test(r)||(e.acceptRelative?Pn.test(r):!1)}function vs(r){return In(Rr(r).search)}var Cn=Symbol.for("ufo:protocolRelative");function Rr(r="",e){let t=r.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(t){let[,x,L=""]=t;return {protocol:x.toLowerCase(),pathname:L,href:x+L,auth:"",host:"",search:"",hash:""}}if(!An(r,{acceptRelative:!0}))return e?Rr(e+r):_s(r);let[,s="",n,o=""]=r.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,a="",i=""]=o.match(/([^#/?]*)(.*)?/)||[],{pathname:u,search:l,hash:h}=_s(i.replace(/\/(?=[A-Za-z]:)/,""));return {protocol:s.toLowerCase(),auth:n?n.slice(0,Math.max(0,n.length-1)):"",host:a,pathname:u,search:l,hash:h,[Cn]:!s}}function _s(r=""){let[e="",t="",s=""]=(r.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return {pathname:e,search:t,hash:s}}var Sn=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Nn=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,kn=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Dn(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Zn(r);return}return e}function Zn(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`);}function ws(r,e={}){if(typeof r!="string")return r;let t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){let s=t.toLowerCase();if(s==="true")return !0;if(s==="false")return !1;if(s==="undefined")return;if(s==="null")return null;if(s==="nan")return Number.NaN;if(s==="infinity")return Number.POSITIVE_INFINITY;if(s==="-infinity")return Number.NEGATIVE_INFINITY}if(!kn.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(Sn.test(r)||Nn.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,Dn)}return JSON.parse(r)}catch(s){if(e.strict)throw s;return r}}function Pr(r,e){try{return e in r}catch{return !1}}var Mn=Object.defineProperty,Un=(r,e,t)=>e in r?Mn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ce=(r,e,t)=>(Un(r,typeof e!="symbol"?e+"":e,t),t),$e=class extends Error{constructor(e,t={}){super(e,t),ce(this,"statusCode",500),ce(this,"fatal",!1),ce(this,"unhandled",!1),ce(this,"statusMessage"),ce(this,"data"),ce(this,"cause"),t.cause&&!this.cause&&(this.cause=t.cause);}toJSON(){let e={message:this.message,statusCode:br(this.statusCode,500)};return this.statusMessage&&(e.statusMessage=Es(this.statusMessage)),this.data!==void 0&&(e.data=this.data),e}};ce($e,"__h3_error__",!0);function Os(r){if(typeof r=="string")return new $e(r);if(Ln(r))return r;let e=new $e(r.message??r.statusMessage??"",{cause:r.cause||r});if(Pr(r,"stack"))try{Object.defineProperty(e,"stack",{get(){return r.stack}});}catch{try{e.stack=r.stack;}catch{}}if(r.data&&(e.data=r.data),r.statusCode?e.statusCode=br(r.statusCode,e.statusCode):r.status&&(e.statusCode=br(r.status,e.statusCode)),r.statusMessage?e.statusMessage=r.statusMessage:r.statusText&&(e.statusMessage=r.statusText),e.statusMessage){let t=e.statusMessage;Es(e.statusMessage)!==t&&console.warn("[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default.");}return r.fatal!==void 0&&(e.fatal=r.fatal),r.unhandled!==void 0&&(e.unhandled=r.unhandled),e}function Ln(r){return r?.constructor?.__h3_error__===!0}function xs(r){return vs(r.path||"")}function qn(r,e,t){if(t&&r.method==="HEAD")return !0;if(typeof e=="string"){if(r.method===e)return !0}else if(e.includes(r.method))return !0;return !1}function Vn(r,e,t){if(!qn(r,e,t))throw Os({statusCode:405,statusMessage:"HTTP method is not allowed."})}function $n(r){let e={};for(let t in r.node.req.headers){let s=r.node.req.headers[t];e[t]=Array.isArray(s)?s.filter(Boolean).join(", "):s;}return e}function Fn(r,e){return $n(r)[e.toLowerCase()]}var Ar=Fn;var Ts=Symbol.for("h3RawBody"),Er=Symbol.for("h3ParsedBody"),Wn=["PATCH","POST","PUT","DELETE"];function Bn(r,e="utf8"){Vn(r,Wn);let t=r._requestBody||r.web?.request?.body||r.node.req[Ts]||r.node.req.rawBody||r.node.req.body;if(t){let o=Promise.resolve(t).then(a=>Buffer.isBuffer(a)?a:typeof a.pipeTo=="function"?new Promise((i,u)=>{let l=[];a.pipeTo(new WritableStream({write(h){l.push(h);},close(){i(Buffer.concat(l));},abort(h){u(h);}})).catch(u);}):typeof a.pipe=="function"?new Promise((i,u)=>{let l=[];a.on("data",h=>{l.push(h);}).on("end",()=>{i(Buffer.concat(l));}).on("error",u);}):a.constructor===Object?Buffer.from(JSON.stringify(a)):Buffer.from(a));return e?o.then(a=>a.toString(e)):o}if(!Number.parseInt(r.node.req.headers["content-length"]||""))return Promise.resolve(void 0);let s=r.node.req[Ts]=new Promise((o,a)=>{let i=[];r.node.req.on("error",u=>{a(u);}).on("data",u=>{i.push(u);}).on("end",()=>{o(Buffer.concat(i));});});return e?s.then(o=>o.toString(e)):s}async function Is(r,e={}){let t=r.node.req;if(Pr(t,Er))return t[Er];let s=t.headers["content-type"]||"",n=await Bn(r),o;return s==="application/json"?o=Rs(n,e.strict??!0):s.startsWith("application/x-www-form-urlencoded")?o=Kn(n):s.startsWith("text/")?o=n:o=Rs(n,e.strict??!1),t[Er]=o,o}function Rs(r="",e){if(r)try{return ws(r,{strict:e})}catch{throw Os({statusCode:400,statusMessage:"Bad Request",message:"Invalid JSON body"})}}function Kn(r){let e=new URLSearchParams(r),t=Object.create(null);for(let[s,n]of e.entries())Pr(t,s)?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(n)):t[s]=n;return t}var zn=/[^\u0009\u0020-\u007E]/g;function Es(r=""){return r.replace(zn,"")}function br(r,e=200){return !r||(typeof r=="string"&&(r=Number.parseInt(r,10)),r<100||r>999)?e:r}var Hn=typeof setImmediate>"u"?r=>r():setImmediate;function bs(r,e,t){return t&&Gn(r,t),new Promise(s=>{Hn(()=>{r.handled||r.node.res.end(e),s();});})}function Gn(r,e){e&&r.node.res.statusCode!==304&&!r.node.res.getHeader("content-type")&&r.node.res.setHeader("content-type",e);}function Jn(r,e){for(let[t,s]of Object.entries(e))r.node.res.setHeader(t,s);}var Ps=Jn;var rt=(s=>(s.TRIGGER="trigger",s.EXECUTE="execute",s.PREVIEW="preview",s))(rt||{}),st=(s=>(s.DISCOVER="discover",s.HEALTH_CHECK="health-check",s.CODE="code",s))(st||{});var q=(E=>(E.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",E.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",E.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",E.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",E.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",E.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",E.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",E.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",E.STEP_NOT_FOUND_ERROR="StepNotFoundError",E.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",E.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",E.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",E.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",E.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",E.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",E.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",E.INVALID_ACTION_ERROR="InvalidActionError",E.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",E.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",E.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",E.SIGNATURE_INVALID_ERROR="SignatureInvalidError",E.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",E.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",E.PLATFORM_ERROR="PlatformError",E.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",E))(q||{});var nt=(s=>(s.POST="POST",s.GET="GET",s.OPTIONS="OPTIONS",s))(nt||{});var H=class extends Error{data},ot=class extends H{statusCode=404},Z=class extends H{statusCode=400},Q=class extends H{statusCode=401},Ae=class extends H{statusCode=500},at=class extends H{statusCode=409};var it=class extends Z{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};}},Fe=class extends Z{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},dt=class extends Z{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},ct=class extends Z{code="ExecutionStateControlInvalidError";constructor(e,t,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=s;}},ut=class extends Z{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;}},lt=class extends Z{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;}},ft=class extends Z{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 b={info:r=>Ce__default.default.blue(r),warning:r=>Ce__default.default.yellow(r),error:r=>Ce__default.default.red(r),success:r=>Ce__default.default.green(r),underline:r=>Ce__default.default.underline(r),bold:r=>Ce__default.default.bold(r)},A={SUCCESS:b.success("\u2714"),ERROR:b.error("\u2717"),WARNING:b.warning("\u26A0"),INFO:b.info("\u2139"),ARROW:b.bold("\u2192"),MOCK:b.info("\u25CB"),HYDRATED:b.bold(b.info("\u2192")),STEP:b.info("\u03C3"),ACTION:b.info("\u03B1"),DURATION:b.info("\u0394"),PROVIDER:b.info("\u2699"),OUTPUT:b.info("\u21E2"),INPUT:b.info("\u21E0"),WORKFLOW:b.info("\u03C9"),STATE:b.info("\u03C3"),EXECUTE:b.info("\u03B5"),PREVIEW:b.info("\u03C1")};var Cr=r=>Object.values(r).map(e=>`\`${e}\``).join(", "),pt=r=>r.replaceAll(/(\w)(\w*)/g,(e,t,s)=>t.toUpperCase()+s.toLowerCase()).replaceAll(/[\s-]+/g,"");var Cs=(r,e="https://api.novu.co")=>{let t=process.env.NOVU_API_URL||e;return {post:async(s,n)=>(await fetch(t+"/v1"+s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${r}`},body:JSON.stringify(n)})).json()}};var ht=class extends H{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${Cr(nt)}`},We=class extends Z{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${Cr(t)}`);}};var mt=class extends Ae{code="PlatformError";message="Something went wrong. Please try again later."};var Be=class extends at{constructor(e,t){super(`${pt(e)} with id: \`${t}\` already exists. Please use a different id.`);}},ee=class extends ot{constructor(e,t){super(`${pt(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Se=class extends Ae{constructor(e,t){super(`Failed to execute ${pt(e)} with id: \`${t}\`. Please try again later.`);}};var yt=class extends ee{code="ProviderNotFoundError";constructor(e){super("provider",e);}},_t=class extends Se{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var gt=class extends Q{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");}},vt=class extends Q{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},wt=class extends Q{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},Tt=class extends Q{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);}},Rt=class extends Q{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");}};var Ot=class extends ee{code="StepNotFoundError";constructor(e){super("step",e);}};var Ke=class extends ee{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},xt=class extends Be{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var It=class{ajv;compiledSchemas;constructor(){this.ajv=new Qn__default.default({useDefaults:!0,removeAdditional:"all"}),eo__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(o=>({path:o.instancePath,message:o.message}))}}transformToJsonSchema(e){return e}};var yr=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 mn().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 yn=[new yr,new It],_n=async(r,e)=>{for(let t of yn)if(t.isSchema(r))return t.validate(e,r);throw new Error("Invalid schema")},gn=r=>{for(let e of yn)if(e.isSchema(r))return e.transformToJsonSchema(r);throw new Error("Invalid schema")};var vn={name:"@novu/framework",version:"0.24.3-alpha.11",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:{"@novu/shared":"^0.24.2",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 tt=vn.version,_r="2024-06-26";jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});function wn(){return process.env.NODE_ENV==="development"}var vr=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;secretKey;version=tt;strictAuthentication;constructor(e){let t=this.buildOptions(e);this.secretKey=t.secretKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={secretKey:void 0,strictAuthentication:!0};if(t.secretKey=e?.secretKey||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY,!wn()&&!t.secretKey)throw new Error("Missing secret key. Set the NOVU_SECRET_KEY environment variable or pass secretKey to the client options.");return e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:wn()&&(t.strictAuthentication=!1),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(s=>s.workflowId===t.workflowId))throw new xt(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",sdkVersion:tt,frameworkVersion:_r,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(s=>s.workflowId===e);if(t)return t;throw new Ke(e)}getStep(e,t){let n=this.getWorkflow(e).steps.find(o=>o.stepId===t);if(n)return n;throw new Ot(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(gn(e))}async validate(e,t,s,n,o,a,i){let u=await _n(t,e);if(u.success)return u.data;switch(s){case"event":this.throwInvalidEvent(n,o,u.errors);case"step":this.throwInvalidStep(a,n,o,u.errors);case"provider":this.throwInvalidProvider(a,i,n,o,u.errors);default:throw new Error(`Invalid component: '${s}'`)}}throwInvalidProvider(e,t,s,n,o){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(s){case"output":throw new ft(n,e,t,o);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 ut(s,e,n);case"result":throw new lt(s,e,n);case"controls":throw new ct(s,e,n);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,s){switch(e){case"controls":throw new dt(t,s);case"payload":throw new Fe(t,s);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(s,n,o)=>{let a=this.getStep(e.workflowId,s),i=td(e),u=await this.createStepControls(a,i),l=e.action==="preview";if(!l&&await this.shouldSkip(o?.skip,u))return t({options:{skip:!0}}),{};let h=this.previewStep.bind(this),x=this.executeStep.bind(this),X=await(l?h:x)(e,{...a,providers:a.providers.map(Pe=>{let Ve=o?.providers?.[Pe.type];if(!Ve)throw new yt(Pe.type);return {...Pe,resolve:Ve}}),resolve:n});return s===e.stepId&&t(X),X.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let n=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
23
+ ${b.bold(b.underline(n))} '${e.workflowId}'`);let o=this.getWorkflow(e.workflowId),a=process.hrtime(),i={outputs:{},providers:{},options:{}},u,l=new Promise(de=>{u=de;}),h=de=>{u(),i=de;},x;try{if(e.action==="execute"&&!e.payload&&!e.data)throw new Fe(e.workflowId,{message:"Event `payload` is required"});let de=await this.createExecutionPayload(e,o);await Promise.race([l,o.execute({payload:de,environment:{},inputs:{},controls:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(e,h),sms:this.executeStepFactory(e,h),inApp:this.executeStepFactory(e,h),digest:this.executeStepFactory(e,h),delay:this.executeStepFactory(e,h),push:this.executeStepFactory(e,h),chat:this.executeStepFactory(e,h),custom:this.executeStepFactory(e,h)}})]);}catch(de){x=de;}let L=process.hrtime(a),X=L[0],Pe=L[1],Ve=X*1e3+Pe/1e6,Tn=x?A.ERROR:A.SUCCESS,Rn=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${Tn} ${Rn} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Ve,x),x)throw x;return {outputs:i.outputs,providers:i.providers,options:i.options,metadata:{status:"success",error:!1,duration:Ve}}}async createExecutionPayload(e,t){let s=e.payload||e.data;if(e.action==="preview"){let o=this.mock(t.payload.schema);s=Object.assign(o,s);}return await this.validate(s,t.payload.unknownSchema,"event","payload",e.workflowId)}prettyPrintExecute(e,t,s){let n=s?A.ERROR:A.SUCCESS,o=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",a=s?"Failed to execute":o,i=s?b.error:b.success,u=`${n} ${a} workflowId: '${e.workflowId}`;console.log(`
24
24
  ${b.bold(i(u))}'`),console.log(` \u251C ${A.STEP} stepId: '${e.stepId}'`),console.log(` \u251C ${A.ACTION} action: '${e.action}'`),console.log(` \u2514 ${A.DURATION} duration: '${t.toFixed(2)}ms'
25
25
  `);}async executeProviders(e,t,s){return t.providers.reduce(async(n,o)=>{let a=await n,i=this.previewProvider.bind(this),u=this.executeProvider.bind(this),h=await(e.action==="preview"?i:u)(e,t,o,s);return {...a,[o.type]:h}},Promise.resolve({}))}previewProvider(e,t,s,n){return console.log(` ${A.MOCK} Mocked provider: \`${s.type}\``),this.mock(s.outputs.schema)}async executeProvider(e,t,s,n){let o=gr__default.default({indent:2}).start(`Executing provider: \`${s.type}\``);try{if(e.stepId===t.stepId){let a=await this.createStepControls(t,e),i=await s.resolve({controls:a,outputs:n}),u=await this.validate(i,s.outputs.unknownSchema,"step","output",e.workflowId,t.stepId,s.type);return o.succeed(`Executed provider: \`${s.type}\``),u}else o.stopAndPersist({symbol:A.HYDRATED,text:`Hydrated provider: \`${s.type}\``});}catch(a){throw o.stopAndPersist({symbol:A.ERROR,text:`Failed to execute provider: \`${s.type}\``}),new _t(`Failed to execute provider: '${s.type}'.
26
- ${a.message}`)}}async executeStep(e,t){if(e.stepId===t.stepId){let s=gr__default.default({indent:1}).start(`Executing stepId: \`${t.stepId}\``);try{let n=await this.createStepControls(t,e),o=await this.compileControls(n,e),a=await t.resolve(o),i=await this.validate(a,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId),u=await this.executeProviders(e,t,i);return s.succeed(`Executed stepId: \`${t.stepId}\``),{outputs:i,providers:u}}catch(n){throw s.stopAndPersist({prefixText:"",symbol:A.ERROR,text:`Failed to execute stepId: \`${t.stepId}\``}),n}}else {let s=gr__default.default({indent:1}).start(`Hydrating stepId: \`${t.stepId}\``);try{let n=e.state.find(o=>o.stepId===t.stepId);if(n){let o=await this.validate(n.outputs,t.results.unknownSchema,"step","result",e.workflowId,t.stepId);return s.stopAndPersist({symbol:A.HYDRATED,text:`Hydrated stepId: \`${t.stepId}\``}),{outputs:o,providers:await this.executeProviders(e,t,o)}}else throw new it(e.workflowId,t.stepId)}catch(n){throw s.stopAndPersist({symbol:A.ERROR,text:`Failed to hydrate stepId: \`${t.stepId}\``}),n}}}async compileControls(e,t){let s=this.templateEngine.parse(JSON.stringify(e)),n=await this.templateEngine.render(s,{...t.payload||t.data,subscriber:t.subscriber});return JSON.parse(n)}async createStepControls(e,t){let s=t.controls||t.inputs;return await this.validate(s,e.controls.unknownSchema,"step","controls",t.workflowId,e.stepId)}async previewStep(e,t){let s=gr__default.default({indent:1}).start(`Previewing stepId: \`${t.stepId}\``);try{if(e.stepId===t.stepId){let n=await this.createStepControls(t,e),o=await this.compileControls(n,e),a=await t.resolve(o),i=await this.validate(a,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId);return s.stopAndPersist({symbol:A.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:i,providers:await this.executeProviders(e,t,i)}}else {let n=this.mock(t.results.schema);return s.stopAndPersist({symbol:A.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:n,providers:await this.executeProviders(e,t,n)}}}catch(n){throw s.stopAndPersist({symbol:A.ERROR,text:`Failed to preview stepId: \`${t.stepId}\``}),n}}getStepCode(e,t){return {code:this.getStep(e,t).resolve.toString()}}getWorkflowCode(e){return {code:this.getWorkflow(e).execute.toString()}}getCode(e,t){let s;if(e)t?s=this.getStepCode(e,t):s=this.getWorkflowCode(e);else throw new Ke(e);return s}};function ed(r){return JSON.parse(JSON.stringify(r))}var wr=class{frameworkName;handler;client;hmacEnabled;http;constructor(e){this.handler=e.handler,this.client=e.client?e.client:new vr,this.client.addWorkflows(e.workflows),this.http=Cs(this.client.apiKey),this.frameworkName=e.frameworkName,this.hmacEnabled=this.client.strictAuthentication;}createHandler(){return async(...e)=>{let t=await this.handler(...e),s=await this.handleAction({actions:t});return t.transformResponse(s)}}getStaticHeaders(){let e=`novu-framework:v${this.client.version}`;return {"content-type":"application/json","access-control-allow-origin":"*","access-control-allow-methods":"GET, POST","access-control-allow-headers":"*","access-control-max-age":"604800","novu-framework-version":_r,"novu-framework-sdk":tt,"novu-framework-api":this.frameworkName,"user-agent":e}}createResponse(e,t){return {status:e,body:JSON.stringify(t),headers:{...this.getStaticHeaders()}}}createError(e){return {status:e.statusCode,body:JSON.stringify({message:e.message,data:e.data,code:e.code}),headers:this.getStaticHeaders()}}async handleAction({actions:e}){let t=await e.url(),s=await e.method(),n=t.searchParams.get("action")||"",o=t.searchParams.get("workflowId")||"",a=t.searchParams.get("stepId")||"",i=await e.headers("novu-signature")||await e.headers("x-novu-signature")||"",u=await e.headers("novu-anonymous")||await e.headers("x-novu-anonymous")||"",l=t.searchParams.get("source")||"",h={};try{s==="POST"&&(h=await e.body());}catch{}try{n!=="health-check"&&this.validateHmac(h,i);let x=this.getPostActionMap(h,o,a,n,u,l),L=this.getGetActionMap(o,a);if(s==="POST")return await this.handlePostAction(n,x);if(s==="GET")return await this.handleGetAction(n,L);if(s==="OPTIONS")return this.createResponse(200,{})}catch(x){return this.handleError(x)}return this.createError(new ht(s))}getPostActionMap(e,t,s,n,o,a){return {trigger:this.triggerAction({workflowId:t,...e}),execute:async()=>{let i=await this.client.executeWorkflow({...e,workflowId:t,stepId:s,action:n});return this.createResponse(200,i)},preview:async()=>{let i=await this.client.executeWorkflow({...e,workflowId:t,stepId:s,action:n});return this.createResponse(200,i)}}}triggerAction(e){return async()=>{let t={name:e.workflowId,to:e.to,payload:e?.payload||{},transactionId:e.transactionId,overrides:e.overrides||{},...e.actor&&{actor:e.actor},...e.tenant&&{tenant:e.tenant},...e.bridgeUrl&&{bridgeUrl:e.bridgeUrl}},s=await this.http.post("/events/trigger",t);return this.createResponse(200,s)}}getGetActionMap(e,t){return {discover:async()=>{let s=await this.client.discover();return this.createResponse(200,s)},"health-check":async()=>{let s=await this.client.healthCheck();return this.createResponse(200,s)},code:async()=>{let s=await this.client.getCode(e,t);return this.createResponse(200,s)}}}async handlePostAction(e,t){if(Object.values(rt).includes(e)){let s=t[e];return s()}else throw new We(e,rt)}async handleGetAction(e,t){if(Object.values(st).includes(e)){let s=t[e];return s()}else throw new We(e,st)}isClientError(e){return Object.values(q).includes(e.code)}handleError(e){return this.isClientError(e)?(e.statusCode===500&&console.error(e),this.createError(e)):e.response.status===400?this.createError(e.response):(console.error(e),this.createError(new mt))}validateHmac(e,t){if(!this.hmacEnabled)return;if(!t)throw new vt;if(!this.client.apiKey)throw new Rt;let[s,n]=t.split(",");if(!s||!n)throw new wt;let[o,a]=s.split("="),[i,u]=n.split("=");if(Number(o)<Date.now()-1500)throw new Tt;if(!(this.hashHmac(this.client.apiKey,`${a}.${JSON.stringify(e)}`)===u))throw new gt}hashHmac(e,t){return crypto.createHmac("sha256",e).update(t).digest("hex")}};var sd="nuxt",ll=r=>new wr({frameworkName:sd,...r,handler:t=>({queryString:s=>String(xs(t)[s]),body:()=>Is(t),headers:s=>Ar(t,s),url:()=>new URL(String(t.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(Ar(t,"host"))}`),method:()=>t.method,transformResponse:s=>{let{res:n}=t.node;return n.statusCode=s.status,Ps(t,s.headers),bs(t,s.body)}})}).createHandler();
26
+ ${a.message}`)}}async executeStep(e,t){if(e.stepId===t.stepId){let s=gr__default.default({indent:1}).start(`Executing stepId: \`${t.stepId}\``);try{let n=await this.createStepControls(t,e),o=await this.compileControls(n,e),a=await t.resolve(o),i=await this.validate(a,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId),u=await this.executeProviders(e,t,i);return s.succeed(`Executed stepId: \`${t.stepId}\``),{outputs:i,providers:u}}catch(n){throw s.stopAndPersist({prefixText:"",symbol:A.ERROR,text:`Failed to execute stepId: \`${t.stepId}\``}),n}}else {let s=gr__default.default({indent:1}).start(`Hydrating stepId: \`${t.stepId}\``);try{let n=e.state.find(o=>o.stepId===t.stepId);if(n){let o=await this.validate(n.outputs,t.results.unknownSchema,"step","result",e.workflowId,t.stepId);return s.stopAndPersist({symbol:A.HYDRATED,text:`Hydrated stepId: \`${t.stepId}\``}),{outputs:o,providers:await this.executeProviders(e,t,o)}}else throw new it(e.workflowId,t.stepId)}catch(n){throw s.stopAndPersist({symbol:A.ERROR,text:`Failed to hydrate stepId: \`${t.stepId}\``}),n}}}async compileControls(e,t){let s=this.templateEngine.parse(JSON.stringify(e)),n=await this.templateEngine.render(s,{...t.payload||t.data,subscriber:t.subscriber});return JSON.parse(n)}async createStepControls(e,t){let s=t.controls||t.inputs;return await this.validate(s,e.controls.unknownSchema,"step","controls",t.workflowId,e.stepId)}async previewStep(e,t){let s=gr__default.default({indent:1}).start(`Previewing stepId: \`${t.stepId}\``);try{if(e.stepId===t.stepId){let n=await this.createStepControls(t,e),o=await this.compileControls(n,e),a=await t.resolve(o),i=await this.validate(a,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId);return s.stopAndPersist({symbol:A.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:i,providers:await this.executeProviders(e,t,i)}}else {let n=this.mock(t.results.schema);return s.stopAndPersist({symbol:A.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:n,providers:await this.executeProviders(e,t,n)}}}catch(n){throw s.stopAndPersist({symbol:A.ERROR,text:`Failed to preview stepId: \`${t.stepId}\``}),n}}getStepCode(e,t){return {code:this.getStep(e,t).resolve.toString()}}getWorkflowCode(e){return {code:this.getWorkflow(e).execute.toString()}}getCode(e,t){let s;if(e)t?s=this.getStepCode(e,t):s=this.getWorkflowCode(e);else throw new Ke(e);return s}};function td(r){return JSON.parse(JSON.stringify(r))}var wr=class{frameworkName;handler;client;hmacEnabled;http;constructor(e){this.handler=e.handler,this.client=e.client?e.client:new vr,this.client.addWorkflows(e.workflows),this.http=Cs(this.client.secretKey),this.frameworkName=e.frameworkName,this.hmacEnabled=this.client.strictAuthentication;}createHandler(){return async(...e)=>{let t=await this.handler(...e),s=await this.handleAction({actions:t});return t.transformResponse(s)}}getStaticHeaders(){let e=`novu-framework:v${this.client.version}`;return {"content-type":"application/json","access-control-allow-origin":"*","access-control-allow-methods":"GET, POST","access-control-allow-headers":"*","access-control-max-age":"604800","novu-framework-version":_r,"novu-framework-sdk":tt,"novu-framework-api":this.frameworkName,"user-agent":e}}createResponse(e,t){return {status:e,body:JSON.stringify(t),headers:{...this.getStaticHeaders()}}}createError(e){return {status:e.statusCode,body:JSON.stringify({message:e.message,data:e.data,code:e.code}),headers:this.getStaticHeaders()}}async handleAction({actions:e}){let t=await e.url(),s=await e.method(),n=t.searchParams.get("action")||"",o=t.searchParams.get("workflowId")||"",a=t.searchParams.get("stepId")||"",i=await e.headers("novu-signature")||await e.headers("x-novu-signature")||"",u=await e.headers("novu-anonymous")||await e.headers("x-novu-anonymous")||"",l=t.searchParams.get("source")||"",h={};try{s==="POST"&&(h=await e.body());}catch{}try{n!=="health-check"&&this.validateHmac(h,i);let x=this.getPostActionMap(h,o,a,n,u,l),L=this.getGetActionMap(o,a);if(s==="POST")return await this.handlePostAction(n,x);if(s==="GET")return await this.handleGetAction(n,L);if(s==="OPTIONS")return this.createResponse(200,{})}catch(x){return this.handleError(x)}return this.createError(new ht(s))}getPostActionMap(e,t,s,n,o,a){return {trigger:this.triggerAction({workflowId:t,...e}),execute:async()=>{let i=await this.client.executeWorkflow({...e,workflowId:t,stepId:s,action:n});return this.createResponse(200,i)},preview:async()=>{let i=await this.client.executeWorkflow({...e,workflowId:t,stepId:s,action:n});return this.createResponse(200,i)}}}triggerAction(e){return async()=>{let t={name:e.workflowId,to:e.to,payload:e?.payload||{},transactionId:e.transactionId,overrides:e.overrides||{},...e.actor&&{actor:e.actor},...e.tenant&&{tenant:e.tenant},...e.bridgeUrl&&{bridgeUrl:e.bridgeUrl}},s=await this.http.post("/events/trigger",t);return this.createResponse(200,s)}}getGetActionMap(e,t){return {discover:async()=>{let s=await this.client.discover();return this.createResponse(200,s)},"health-check":async()=>{let s=await this.client.healthCheck();return this.createResponse(200,s)},code:async()=>{let s=await this.client.getCode(e,t);return this.createResponse(200,s)}}}async handlePostAction(e,t){if(Object.values(rt).includes(e)){let s=t[e];return s()}else throw new We(e,rt)}async handleGetAction(e,t){if(Object.values(st).includes(e)){let s=t[e];return s()}else throw new We(e,st)}isClientError(e){return Object.values(q).includes(e.code)}handleError(e){return this.isClientError(e)?(e.statusCode===500&&console.error(e),this.createError(e)):e.response.status===400?this.createError(e.response):(console.error(e),this.createError(new mt))}validateHmac(e,t){if(!this.hmacEnabled)return;if(!t)throw new vt;if(!this.client.secretKey)throw new Rt;let[s,n]=t.split(",");if(!s||!n)throw new wt;let[o,a]=s.split("="),[i,u]=n.split("=");if(Number(o)<Date.now()-1500)throw new Tt;if(!(this.hashHmac(this.client.secretKey,`${a}.${JSON.stringify(e)}`)===u))throw new gt}hashHmac(e,t){return crypto.createHmac("sha256",e).update(t).digest("hex")}};var nd="nuxt",fl=r=>new wr({frameworkName:nd,...r,handler:t=>({queryString:s=>String(xs(t)[s]),body:()=>Is(t),headers:s=>Ar(t,s),url:()=>new URL(String(t.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(Ar(t,"host"))}`),method:()=>t.method,transformResponse:s=>{let{res:n}=t.node;return n.statusCode=s.status,Ps(t,s.headers),bs(t,s.body)}})}).createHandler();
27
27
 
28
- exports.frameworkName = sd;
29
- exports.serve = ll;
28
+ exports.frameworkName = nd;
29
+ exports.serve = fl;