@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/express.d.ts +1 -1
- package/dist/express.js +9 -9
- package/dist/h3.d.ts +1 -1
- package/dist/h3.js +9 -9
- package/dist/{handler-y6PZIhGI.d.ts → handler-PIXNhv7t.d.ts} +9 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -14
- package/dist/next.d.ts +1 -1
- package/dist/next.js +9 -9
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +9 -9
- package/dist/remix.d.ts +1 -1
- package/dist/remix.js +13 -13
- package/dist/sveltekit.d.ts +1 -1
- package/dist/sveltekit.js +13 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,26 +4,26 @@ var jsonSchemaFaker = require('json-schema-faker');
|
|
|
4
4
|
var liquidjs = require('liquidjs');
|
|
5
5
|
var Ai = require('ora');
|
|
6
6
|
var Ne = require('chalk');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var Pr = require('ajv');
|
|
8
|
+
var Rr = require('ajv-formats');
|
|
9
9
|
var crypto = require('crypto');
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
|
|
13
13
|
var Ai__default = /*#__PURE__*/_interopDefault(Ai);
|
|
14
14
|
var Ne__default = /*#__PURE__*/_interopDefault(Ne);
|
|
15
|
-
var Ir__default = /*#__PURE__*/_interopDefault(Ir);
|
|
16
15
|
var Pr__default = /*#__PURE__*/_interopDefault(Pr);
|
|
16
|
+
var Rr__default = /*#__PURE__*/_interopDefault(Rr);
|
|
17
17
|
|
|
18
|
-
var b=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nt=b(G=>{Object.defineProperty(G,"__esModule",{value:!0});G.getDefaultOptions=G.defaultOptions=G.ignoreOverride=void 0;G.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");G.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 Rr=i=>typeof i=="string"?{...G.defaultOptions,name:i}:{...G.defaultOptions,...i};G.getDefaultOptions=Rr;});var Ri=b(Mt=>{Object.defineProperty(Mt,"__esModule",{value:!0});Mt.getRefs=void 0;var Er=Nt(),Dr=i=>{let e=(0, Er.getDefaultOptions)(i),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(([n,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};Mt.getRefs=Dr;});var oe=b($e=>{Object.defineProperty($e,"__esModule",{value:!0});$e.setResponseValueAndErrors=$e.addErrorMessage=void 0;function kn(i,e,t,n){n?.errorMessages&&t&&(i.errorMessage={...i.errorMessage,[e]:t});}$e.addErrorMessage=kn;function Cr(i,e,t,n,r){i[e]=t,kn(i,e,n,r);}$e.setResponseValueAndErrors=Cr;});var Xe=b(S=>{Object.defineProperty(S,"__esModule",{value:!0});S.getParsedType=S.ZodParsedType=S.objectUtil=S.util=void 0;var On;(function(i){i.assertEqual=r=>r;function e(r){}i.assertIs=e;function t(r){throw new Error}i.assertNever=t,i.arrayToEnum=r=>{let s={};for(let o of r)s[o]=o;return s},i.getValidEnumValues=r=>{let s=i.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(let a of s)o[a]=r[a];return i.objectValues(o)},i.objectValues=r=>i.objectKeys(r).map(function(s){return r[s]}),i.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},i.find=(r,s)=>{for(let o of r)if(s(o))return o},i.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}i.joinValues=n,i.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s;})(On=S.util||(S.util={}));(function(i){i.mergeShapes=(e,t)=>({...e,...t});})(S.objectUtil||(S.objectUtil={}));S.ZodParsedType=On.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Nr=i=>{switch(typeof i){case"undefined":return S.ZodParsedType.undefined;case"string":return S.ZodParsedType.string;case"number":return isNaN(i)?S.ZodParsedType.nan:S.ZodParsedType.number;case"boolean":return S.ZodParsedType.boolean;case"function":return S.ZodParsedType.function;case"bigint":return S.ZodParsedType.bigint;case"symbol":return S.ZodParsedType.symbol;case"object":return Array.isArray(i)?S.ZodParsedType.array:i===null?S.ZodParsedType.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?S.ZodParsedType.promise:typeof Map<"u"&&i instanceof Map?S.ZodParsedType.map:typeof Set<"u"&&i instanceof Set?S.ZodParsedType.set:typeof Date<"u"&&i instanceof Date?S.ZodParsedType.date:S.ZodParsedType.object;default:return S.ZodParsedType.unknown}};S.getParsedType=Nr;});var Zt=b(ae=>{Object.defineProperty(ae,"__esModule",{value:!0});ae.ZodError=ae.quotelessJson=ae.ZodIssueCode=void 0;var Sn=Xe();ae.ZodIssueCode=Sn.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 Mr=i=>JSON.stringify(i,null,2).replace(/"([^"]+)":/g,"$1:");ae.quotelessJson=Mr;var Qe=class i extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n];},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n];};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(s){return s.message},n={_errors:[]},r=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else {let a=n,d=0;for(;d<o.path.length;){let p=o.path[d];d===o.path.length-1?(a[p]=a[p]||{_errors:[]},a[p]._errors.push(t(o))):a[p]=a[p]||{_errors:[]},a=a[p],d++;}}};return r(this),n}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sn.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return {formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ae.ZodError=Qe;Qe.create=i=>new Qe(i);});var Di=b(Ei=>{Object.defineProperty(Ei,"__esModule",{value:!0});var fe=Xe(),j=Zt(),Zr=(i,e)=>{let t;switch(i.code){case j.ZodIssueCode.invalid_type:i.received===fe.ZodParsedType.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case j.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,fe.util.jsonStringifyReplacer)}`;break;case j.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${fe.util.joinValues(i.keys,", ")}`;break;case j.ZodIssueCode.invalid_union:t="Invalid input";break;case j.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${fe.util.joinValues(i.options)}`;break;case j.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${fe.util.joinValues(i.options)}, received '${i.received}'`;break;case j.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case j.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case j.ZodIssueCode.invalid_date:t="Invalid date";break;case j.ZodIssueCode.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:fe.util.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case j.ZodIssueCode.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case j.ZodIssueCode.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case j.ZodIssueCode.custom:t="Invalid input";break;case j.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case j.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case j.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,fe.util.assertNever(i);}return {message:t}};Ei.default=Zr;});var $t=b(J=>{var $r=J&&J.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(J,"__esModule",{value:!0});J.getErrorMap=J.setErrorMap=J.defaultErrorMap=void 0;var An=$r(Di());J.defaultErrorMap=An.default;var In=An.default;function Ur(i){In=i;}J.setErrorMap=Ur;function qr(){return In}J.getErrorMap=qr;});var ji=b(O=>{var Vr=O&&O.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};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 Lr=$t(),Pn=Vr(Di()),Yr=i=>{let{data:e,path:t,errorMaps:n,issueData:r}=i,s=[...t,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return {...r,path:s,message:r.message};let a="",d=n.filter(p=>!!p).slice().reverse();for(let p of d)a=p(o,{data:e,defaultError:a}).message;return {...r,path:s,message:a}};O.makeIssue=Yr;O.EMPTY_PATH=[];function Fr(i,e){let t=(0, Lr.getErrorMap)(),n=(0, O.makeIssue)({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===Pn.default?void 0:Pn.default].filter(r=>!!r)});i.common.issues.push(n);}O.addIssueToContext=Fr;var Ci=class i{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return O.INVALID;r.status==="dirty"&&e.dirty(),n.push(r.value);}return {status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let s=await r.key,o=await r.value;n.push({key:s,value:o});}return i.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return O.INVALID;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[s.value]=o.value);}return {status:e.value,value:n}}};O.ParseStatus=Ci;O.INVALID=Object.freeze({status:"aborted"});var Wr=i=>({status:"dirty",value:i});O.DIRTY=Wr;var Br=i=>({status:"valid",value:i});O.OK=Br;var Kr=i=>i.status==="aborted";O.isAborted=Kr;var zr=i=>i.status==="dirty";O.isDirty=zr;var Gr=i=>i.status==="valid";O.isValid=Gr;var Jr=i=>typeof Promise<"u"&&i instanceof Promise;O.isAsync=Jr;});var En=b(Rn=>{Object.defineProperty(Rn,"__esModule",{value:!0});});var Dn=b(He=>{Object.defineProperty(He,"__esModule",{value:!0});He.errorUtil=void 0;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e?.message;})(He.errorUtil||(He.errorUtil={}));});var Fn=b(c=>{var qt=c&&c.__classPrivateFieldGet||function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},jn=c&&c.__classPrivateFieldSet||function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},et,tt;Object.defineProperty(c,"__esModule",{value:!0});c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.custom=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.datetimeRegex=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=c.discriminatedUnion=c.date=void 0;var Ut=$t(),_=Dn(),l=ji(),m=Xe(),f=Zt(),L=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r;}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}},Cn=(i,e)=>{if((0, l.isValid)(e))return {success:!0,data:e.value};if(!i.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(i.common.issues);return this._error=t,this._error}}};function v(i){if(!i)return {};let{errorMap:e,invalid_type_error:t,required_error:n,description:r}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{var d,p;let{message:y}=i;return o.code==="invalid_enum_value"?{message:y??a.defaultError}:typeof a.data>"u"?{message:(d=y??n)!==null&&d!==void 0?d:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(p=y??t)!==null&&p!==void 0?p:a.defaultError}},description:r}}var T=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, m.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new l.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, l.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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let r={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, m.getParsedType)(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Cn(r,s)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, m.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await((0, l.isAsync)(r)?r:Promise.resolve(r));return Cn(n,s)}refine(e,t){let n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,s)=>{let o=e(r),a=()=>s.addIssue({code:f.ZodIssueCode.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new $({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return V.create(this,this._def)}nullable(){return Q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ie.create(this,this._def)}promise(){return de.create(this,this._def)}or(e){return Te.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new $({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Ae({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new it({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ie({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return nt.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=T;c.Schema=T;c.ZodSchema=T;var Qr=/^c[^\s-]{8,}$/i,Hr=/^[0-9a-z]+$/,es=/^[0-9A-HJKMNP-TV-Z]{26}$/,ts=/^[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,is=/^[a-z0-9_-]{21}$/i,ns=/^[-+]?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)?)??$/,rs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ss="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ni,os=/^(?:(?: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])$/,as=/^(([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})))$/,cs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nn="((\\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])))",ls=new RegExp(`^${Nn}$`);function Mn(i){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ds(i){return new RegExp(`^${Mn(i)}$`)}function Zn(i){let e=`${Nn}T${Mn(i)}`,t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}c.datetimeRegex=Zn;function us(i,e){return !!((e==="v4"||!e)&&os.test(i)||(e==="v6"||!e)&&as.test(i))}var ce=class i extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.ZodParsedType.string){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.string,received:s.parsedType}),l.INVALID}let n=new l.ParseStatus,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(r=this._getOrReturnCtx(e,r),o?(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty());}else if(s.kind==="email")rs.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"email",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Ni||(Ni=new RegExp(ss,"u")),Ni.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")ts.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")is.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Qr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Hr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")es.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"ulid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data);}catch{r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"url",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty();}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"regex",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Zn(s).test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?ls.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ds(s).test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?ns.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?us(e.data,s.version)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?cs.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):m.util.assertNever(s);return {status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:f.ZodIssueCode.invalid_string,..._.errorUtil.errToObj(n)})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errorUtil.errToObj(e)})}datetime(e){var t,n;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:(n=e?.local)!==null&&n!==void 0?n:!1,..._.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,..._.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",..._.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,..._.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,_.errorUtil.errToObj(e))}trim(){return new i({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i({...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}};c.ZodString=ce;ce.create=i=>{var e;return new ce({checks:[],typeName:g.ZodString,coerce:(e=i?.coerce)!==null&&e!==void 0?e:!1,...v(i)})};function ps(i,e){let t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,s=parseInt(i.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return s%o/Math.pow(10,r)}var me=class i extends T{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)!==m.ZodParsedType.number){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:s.parsedType}),l.INVALID}let n,r=new l.ParseStatus;for(let s of this._def.checks)s.kind==="int"?m.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?ps(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.not_finite,message:s.message}),r.dirty()):m.util.assertNever(s);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.errorUtil.toString(t))}setLimit(e,t,n,r){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.errorUtil.toString(r)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.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"&&m.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return !0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);}return Number.isFinite(t)&&Number.isFinite(e)}};c.ZodNumber=me;me.create=i=>new me({checks:[],typeName:g.ZodNumber,coerce:i?.coerce||!1,...v(i)});var ye=class i extends T{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)!==m.ZodParsedType.bigint){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.bigint,received:s.parsedType}),l.INVALID}let n,r=new l.ParseStatus;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):m.util.assertNever(s);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.errorUtil.toString(t))}setLimit(e,t,n,r){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.errorUtil.toString(r)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.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}};c.ZodBigInt=ye;ye.create=i=>{var e;return new ye({checks:[],typeName:g.ZodBigInt,coerce:(e=i?.coerce)!==null&&e!==void 0?e:!1,...v(i)})};var _e=class extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodBoolean=_e;_e.create=i=>new _e({typeName:g.ZodBoolean,coerce:i?.coerce||!1,...v(i)});var ge=class i extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.ZodParsedType.date){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.date,received:s.parsedType}),l.INVALID}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_date}),l.INVALID}let n=new l.ParseStatus,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):m.util.assertNever(s);return {status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.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}};c.ZodDate=ge;ge.create=i=>new ge({checks:[],coerce:i?.coerce||!1,typeName:g.ZodDate,...v(i)});var qe=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodSymbol=qe;qe.create=i=>new qe({typeName:g.ZodSymbol,...v(i)});var be=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodUndefined=be;be.create=i=>new be({typeName:g.ZodUndefined,...v(i)});var ve=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodNull=ve;ve.create=i=>new ve({typeName:g.ZodNull,...v(i)});var le=class extends T{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, l.OK)(e.data)}};c.ZodAny=le;le.create=i=>new le({typeName:g.ZodAny,...v(i)});var te=class extends T{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, l.OK)(e.data)}};c.ZodUnknown=te;te.create=i=>new te({typeName:g.ZodUnknown,...v(i)});var W=class extends T{_parse(e){let t=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:t.parsedType}),l.INVALID}};c.ZodNever=W;W.create=i=>new W({typeName:g.ZodNever,...v(i)});var Ve=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodVoid=Ve;Ve.create=i=>new Ve({typeName:g.ZodVoid,...v(i)});var ie=class i extends T{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.ZodParsedType.array)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:t.parsedType}),l.INVALID;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(o||a)&&((0, l.addIssueToContext)(t,{code:o?f.ZodIssueCode.too_big:f.ZodIssueCode.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty());}if(r.minLength!==null&&t.data.length<r.minLength.value&&((0, l.addIssueToContext)(t,{code:f.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&((0, l.addIssueToContext)(t,{code:f.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new L(t,o,t.path,a)))).then(o=>l.ParseStatus.mergeArray(n,o));let s=[...t.data].map((o,a)=>r.type._parseSync(new L(t,o,t.path,a)));return l.ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new i({...this._def,minLength:{value:e,message:_.errorUtil.toString(t)}})}max(e,t){return new i({...this._def,maxLength:{value:e,message:_.errorUtil.toString(t)}})}length(e,t){return new i({...this._def,exactLength:{value:e,message:_.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=ie;ie.create=(i,e)=>new ie({type:i,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function Ue(i){if(i instanceof M){let e={};for(let t in i.shape){let n=i.shape[t];e[t]=V.create(Ue(n));}return new M({...i._def,shape:()=>e})}else return i instanceof ie?new ie({...i._def,type:Ue(i.element)}):i instanceof V?V.create(Ue(i.unwrap())):i instanceof Q?Q.create(Ue(i.unwrap())):i instanceof X?X.create(i.items.map(e=>Ue(e))):i}var M=class i extends T{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=m.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.ZodParsedType.object){let p=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(p,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:p.parsedType}),l.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof W&&this._def.unknownKeys==="strip"))for(let p in r.data)o.includes(p)||a.push(p);let d=[];for(let p of o){let y=s[p],I=r.data[p];d.push({key:{status:"valid",value:p},value:y._parse(new L(r,I,r.path,p)),alwaysSet:p in r.data});}if(this._def.catchall instanceof W){let p=this._def.unknownKeys;if(p==="passthrough")for(let y of a)d.push({key:{status:"valid",value:y},value:{status:"valid",value:r.data[y]}});else if(p==="strict")a.length>0&&((0, l.addIssueToContext)(r,{code:f.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let p=this._def.catchall;for(let y of a){let I=r.data[y];d.push({key:{status:"valid",value:y},value:p._parse(new L(r,I,r.path,y)),alwaysSet:y in r.data});}}return r.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of d){let I=await y.key,ne=await y.value;p.push({key:I,value:ne,alwaysSet:y.alwaysSet});}return p}).then(p=>l.ParseStatus.mergeObjectSync(n,p)):l.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return _.errorUtil.errToObj,new i({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var r,s,o,a;let d=(o=(s=(r=this._def).errorMap)===null||s===void 0?void 0:s.call(r,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(a=_.errorUtil.errToObj(e).message)!==null&&a!==void 0?a:d}:{message:d}}}:{}})}strip(){return new i({...this._def,unknownKeys:"strip"})}passthrough(){return new i({...this._def,unknownKeys:"passthrough"})}extend(e){return new i({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new i({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new i({...this._def,catchall:e})}pick(e){let t={};return m.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n]);}),new i({...this._def,shape:()=>t})}omit(e){let t={};return m.util.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n]);}),new i({...this._def,shape:()=>t})}deepPartial(){return Ue(this)}partial(e){let t={};return m.util.objectKeys(this.shape).forEach(n=>{let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional();}),new i({...this._def,shape:()=>t})}required(e){let t={};return m.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else {let s=this.shape[n];for(;s instanceof V;)s=s._def.innerType;t[n]=s;}}),new i({...this._def,shape:()=>t})}keyof(){return $n(m.util.objectKeys(this.shape))}};c.ZodObject=M;M.create=(i,e)=>new M({shape:()=>i,unknownKeys:"strip",catchall:W.create(),typeName:g.ZodObject,...v(e)});M.strictCreate=(i,e)=>new M({shape:()=>i,unknownKeys:"strict",catchall:W.create(),typeName:g.ZodObject,...v(e)});M.lazycreate=(i,e)=>new M({shape:i,unknownKeys:"strip",catchall:W.create(),typeName:g.ZodObject,...v(e)});var Te=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new f.ZodError(a.ctx.common.issues));return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:o}),l.INVALID}if(t.common.async)return Promise.all(n.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return {result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let s,o=[];for(let d of n){let p={...t,common:{...t.common,issues:[]},parent:null},y=d._parseSync({data:t.data,path:t.path,parent:p});if(y.status==="valid")return y;y.status==="dirty"&&!s&&(s={result:y,ctx:p}),p.common.issues.length&&o.push(p.common.issues);}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(d=>new f.ZodError(d));return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),l.INVALID}}get options(){return this._def.options}};c.ZodUnion=Te;Te.create=(i,e)=>new Te({options:i,typeName:g.ZodUnion,...v(e)});var ee=i=>i instanceof we?ee(i.schema):i instanceof $?ee(i.innerType()):i instanceof ke?[i.value]:i instanceof Oe?i.options:i instanceof Se?m.util.objectValues(i.enum):i instanceof Ae?ee(i._def.innerType):i instanceof be?[void 0]:i instanceof ve?[null]:i instanceof V?[void 0,...ee(i.unwrap())]:i instanceof Q?[null,...ee(i.unwrap())]:i instanceof it||i instanceof Pe?ee(i.unwrap()):i instanceof Ie?ee(i._def.innerType):[],Vt=class i extends T{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.ZodParsedType.object)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:t.parsedType}),l.INVALID;let n=this.discriminator,r=t.data[n],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):((0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),l.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let s of t){let o=ee(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,s);}}return new i({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...v(n)})}};c.ZodDiscriminatedUnion=Vt;function Mi(i,e){let t=(0, m.getParsedType)(i),n=(0, m.getParsedType)(e);if(i===e)return {valid:!0,data:i};if(t===m.ZodParsedType.object&&n===m.ZodParsedType.object){let r=m.util.objectKeys(e),s=m.util.objectKeys(i).filter(a=>r.indexOf(a)!==-1),o={...i,...e};for(let a of s){let d=Mi(i[a],e[a]);if(!d.valid)return {valid:!1};o[a]=d.data;}return {valid:!0,data:o}}else if(t===m.ZodParsedType.array&&n===m.ZodParsedType.array){if(i.length!==e.length)return {valid:!1};let r=[];for(let s=0;s<i.length;s++){let o=i[s],a=e[s],d=Mi(o,a);if(!d.valid)return {valid:!1};r.push(d.data);}return {valid:!0,data:r}}else return t===m.ZodParsedType.date&&n===m.ZodParsedType.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}var xe=class extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(s,o)=>{if((0, l.isAborted)(s)||(0, l.isAborted)(o))return l.INVALID;let a=Mi(s.value,o.value);return a.valid?(((0, l.isDirty)(s)||(0, l.isDirty)(o))&&t.dirty(),{status:t.value,value:a.data}):((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_intersection_types}),l.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=xe;xe.create=(i,e,t)=>new xe({left:i,right:e,typeName:g.ZodIntersection,...v(t)});var X=class i extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:n.parsedType}),l.INVALID;if(n.data.length<this._def.items.length)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new L(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>l.ParseStatus.mergeArray(t,o)):l.ParseStatus.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new i({...this._def,rest:e})}};c.ZodTuple=X;X.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new X({items:i,typeName:g.ZodTuple,rest:null,...v(e)})};var Lt=class i extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.object)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:n.parsedType}),l.INVALID;let r=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)r.push({key:s._parse(new L(n,a,n.path,a)),value:o._parse(new L(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?l.ParseStatus.mergeObjectAsync(t,r):l.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof T?new i({keyType:e,valueType:t,typeName:g.ZodRecord,...v(n)}):new i({keyType:ce.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}};c.ZodRecord=Lt;var Le=class extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.map)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.map,received:n.parsedType}),l.INVALID;let r=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,d],p)=>({key:r._parse(new L(n,a,n.path,[p,"key"])),value:s._parse(new L(n,d,n.path,[p,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of o){let p=await d.key,y=await d.value;if(p.status==="aborted"||y.status==="aborted")return l.INVALID;(p.status==="dirty"||y.status==="dirty")&&t.dirty(),a.set(p.value,y.value);}return {status:t.value,value:a}})}else {let a=new Map;for(let d of o){let p=d.key,y=d.value;if(p.status==="aborted"||y.status==="aborted")return l.INVALID;(p.status==="dirty"||y.status==="dirty")&&t.dirty(),a.set(p.value,y.value);}return {status:t.value,value:a}}}};c.ZodMap=Le;Le.create=(i,e,t)=>new Le({valueType:e,keyType:i,typeName:g.ZodMap,...v(t)});var Ye=class i extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.set,received:n.parsedType}),l.INVALID;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let s=this._def.valueType;function o(d){let p=new Set;for(let y of d){if(y.status==="aborted")return l.INVALID;y.status==="dirty"&&t.dirty(),p.add(y.value);}return {status:t.value,value:p}}let a=[...n.data.values()].map((d,p)=>s._parse(new L(n,d,n.path,p)));return n.common.async?Promise.all(a).then(d=>o(d)):o(a)}min(e,t){return new i({...this._def,minSize:{value:e,message:_.errorUtil.toString(t)}})}max(e,t){return new i({...this._def,maxSize:{value:e,message:_.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};c.ZodSet=Ye;Ye.create=(i,e)=>new Ye({valueType:i,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});var Yt=class i extends T{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.ZodParsedType.function)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.function,received:t.parsedType}),l.INVALID;function n(a,d){return (0, l.makeIssue)({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ut.getErrorMap)(),Ut.defaultErrorMap].filter(p=>!!p),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:d}})}function r(a,d){return (0, l.makeIssue)({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ut.getErrorMap)(),Ut.defaultErrorMap].filter(p=>!!p),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof de){let a=this;return (0, l.OK)(async function(...d){let p=new f.ZodError([]),y=await a._def.args.parseAsync(d,s).catch(R=>{throw p.addIssue(n(d,R)),p}),I=await Reflect.apply(o,this,y);return await a._def.returns._def.type.parseAsync(I,s).catch(R=>{throw p.addIssue(r(I,R)),p})})}else {let a=this;return (0, l.OK)(function(...d){let p=a._def.args.safeParse(d,s);if(!p.success)throw new f.ZodError([n(d,p.error)]);let y=Reflect.apply(o,this,p.data),I=a._def.returns.safeParse(y,s);if(!I.success)throw new f.ZodError([r(y,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new i({...this._def,args:X.create(e).rest(te.create())})}returns(e){return new i({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new i({args:e||X.create([]).rest(te.create()),returns:t||te.create(),typeName:g.ZodFunction,...v(n)})}};c.ZodFunction=Yt;var we=class extends T{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})}};c.ZodLazy=we;we.create=(i,e)=>new we({getter:i,typeName:g.ZodLazy,...v(e)});var ke=class extends T{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),l.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=ke;ke.create=(i,e)=>new ke({value:i,typeName:g.ZodLiteral,...v(e)});function $n(i,e){return new Oe({values:i,typeName:g.ZodEnum,...v(e)})}var Oe=class i extends T{constructor(){super(...arguments),et.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return (0, l.addIssueToContext)(t,{expected:m.util.joinValues(n),received:t.parsedType,code:f.ZodIssueCode.invalid_type}),l.INVALID}if(qt(this,et,"f")||jn(this,et,new Set(this._def.values),"f"),!qt(this,et,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return (0, l.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),l.INVALID}return (0, l.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 i.create(e,{...this._def,...t})}exclude(e,t=this._def){return i.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};c.ZodEnum=Oe;et=new WeakMap;Oe.create=$n;var Se=class extends T{constructor(){super(...arguments),tt.set(this,void 0);}_parse(e){let t=m.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.ZodParsedType.string&&n.parsedType!==m.ZodParsedType.number){let r=m.util.objectValues(t);return (0, l.addIssueToContext)(n,{expected:m.util.joinValues(r),received:n.parsedType,code:f.ZodIssueCode.invalid_type}),l.INVALID}if(qt(this,tt,"f")||jn(this,tt,new Set(m.util.getValidEnumValues(this._def.values)),"f"),!qt(this,tt,"f").has(e.data)){let r=m.util.objectValues(t);return (0, l.addIssueToContext)(n,{received:n.data,code:f.ZodIssueCode.invalid_enum_value,options:r}),l.INVALID}return (0, l.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=Se;tt=new WeakMap;Se.create=(i,e)=>new Se({values:i,typeName:g.ZodNativeEnum,...v(e)});var de=class extends T{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.ZodParsedType.promise&&t.common.async===!1)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:t.parsedType}),l.INVALID;let n=t.parsedType===m.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, l.OK)(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};c.ZodPromise=de;de.create=(i,e)=>new de({type:i,typeName:g.ZodPromise,...v(e)});var $=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{(0, l.addIssueToContext)(n,o),o.fatal?t.abort():t.dirty();},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let o=r.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return l.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?l.INVALID:d.status==="dirty"||t.value==="dirty"?(0, l.DIRTY)(d.value):d});{if(t.value==="aborted")return l.INVALID;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?l.INVALID:a.status==="dirty"||t.value==="dirty"?(0, l.DIRTY)(a.value):a}}if(r.type==="refinement"){let o=a=>{let d=r.refinement(a,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?l.INVALID:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?l.INVALID:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0, l.isValid)(o))return o;let a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>(0, l.isValid)(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:t.value,value:a})):o);m.util.assertNever(r);}};c.ZodEffects=$;c.ZodTransformer=$;$.create=(i,e,t)=>new $({schema:i,typeName:g.ZodEffects,effect:e,...v(t)});$.createWithPreprocess=(i,e,t)=>new $({schema:e,effect:{type:"preprocess",transform:i},typeName:g.ZodEffects,...v(t)});var V=class extends T{_parse(e){return this._getType(e)===m.ZodParsedType.undefined?(0, l.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=V;V.create=(i,e)=>new V({innerType:i,typeName:g.ZodOptional,...v(e)});var Q=class extends T{_parse(e){return this._getType(e)===m.ZodParsedType.null?(0, l.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=Q;Q.create=(i,e)=>new Q({innerType:i,typeName:g.ZodNullable,...v(e)});var Ae=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};c.ZodDefault=Ae;Ae.create=(i,e)=>new Ae({innerType:i,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var Ie=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return (0, l.isAsync)(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=Ie;Ie.create=(i,e)=>new Ie({innerType:i,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var Fe=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),l.INVALID}return {status:"valid",value:e.data}}};c.ZodNaN=Fe;Fe.create=i=>new Fe({typeName:g.ZodNaN,...v(i)});c.BRAND=Symbol("zod_brand");var it=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};c.ZodBranded=it;var nt=class i extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return (async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:s.status==="dirty"?(t.dirty(),(0, l.DIRTY)(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?l.INVALID:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new i({in:e,out:t,typeName:g.ZodPipeline})}};c.ZodPipeline=nt;var Pe=class extends T{_parse(e){let t=this._def.innerType._parse(e),n=r=>((0, l.isValid)(r)&&(r.value=Object.freeze(r.value)),r);return (0, l.isAsync)(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};c.ZodReadonly=Pe;Pe.create=(i,e)=>new Pe({innerType:i,typeName:g.ZodReadonly,...v(e)});function Un(i,e={},t){return i?le.create().superRefine((n,r)=>{var s,o;if(!i(n)){let a=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(o=(s=a.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,p=typeof a=="string"?{message:a}:a;r.addIssue({code:"custom",...p,fatal:d});}}):le.create()}c.custom=Un;c.late={object:M.lazycreate};var g;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly";})(g=c.ZodFirstPartyTypeKind||(c.ZodFirstPartyTypeKind={}));var hs=(i,e={message:`Input not instance of ${i.name}`})=>Un(t=>t instanceof i,e);c.instanceof=hs;var qn=ce.create;c.string=qn;var Vn=me.create;c.number=Vn;var fs=Fe.create;c.nan=fs;var ms=ye.create;c.bigint=ms;var Ln=_e.create;c.boolean=Ln;var ys=ge.create;c.date=ys;var _s=qe.create;c.symbol=_s;var gs=be.create;c.undefined=gs;var bs=ve.create;c.null=bs;var vs=le.create;c.any=vs;var Ts=te.create;c.unknown=Ts;var xs=W.create;c.never=xs;var ws=Ve.create;c.void=ws;var ks=ie.create;c.array=ks;var Os=M.create;c.object=Os;var Ss=M.strictCreate;c.strictObject=Ss;var As=Te.create;c.union=As;var Is=Vt.create;c.discriminatedUnion=Is;var Ps=xe.create;c.intersection=Ps;var Rs=X.create;c.tuple=Rs;var Es=Lt.create;c.record=Es;var Ds=Le.create;c.map=Ds;var Cs=Ye.create;c.set=Cs;var js=Yt.create;c.function=js;var Ns=we.create;c.lazy=Ns;var Ms=ke.create;c.literal=Ms;var Zs=Oe.create;c.enum=Zs;var $s=Se.create;c.nativeEnum=$s;var Us=de.create;c.promise=Us;var Yn=$.create;c.effect=Yn;c.transformer=Yn;var qs=V.create;c.optional=qs;var Vs=Q.create;c.nullable=Vs;var Ls=$.createWithPreprocess;c.preprocess=Ls;var Ys=nt.create;c.pipeline=Ys;var Fs=()=>qn().optional();c.ostring=Fs;var Ws=()=>Vn().optional();c.onumber=Ws;var Bs=()=>Ln().optional();c.oboolean=Bs;c.coerce={string:i=>ce.create({...i,coerce:!0}),number:i=>me.create({...i,coerce:!0}),boolean:i=>_e.create({...i,coerce:!0}),bigint:i=>ye.create({...i,coerce:!0}),date:i=>ge.create({...i,coerce:!0})};c.NEVER=l.INVALID;});var Zi=b(Y=>{var Ks=Y&&Y.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t),Object.defineProperty(i,n,{enumerable:!0,get:function(){return e[t]}});}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),We=Y&&Y.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ks(e,i,t);};Object.defineProperty(Y,"__esModule",{value:!0});We($t(),Y);We(ji(),Y);We(En(),Y);We(Xe(),Y);We(Fn(),Y);We(Zt(),Y);});var Ft=b(Z=>{var Wn=Z&&Z.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t),Object.defineProperty(i,n,{enumerable:!0,get:function(){return e[t]}});}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),zs=Z&&Z.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e});}:function(i,e){i.default=e;}),Gs=Z&&Z.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Wn(e,i,t);return zs(e,i),e},Js=Z&&Z.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Wn(e,i,t);};Object.defineProperty(Z,"__esModule",{value:!0});Z.z=void 0;var Bn=Gs(Zi());Z.z=Bn;Js(Zi(),Z);Z.default=Bn;});var $i=b(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseAnyDef=void 0;function Xs(){return {}}Wt.parseAnyDef=Xs;});var Ui=b(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseArrayDef=void 0;var Qs=Ft(),Bt=oe(),Hs=D();function eo(i,e){let t={type:"array"};return i.type?._def?.typeName!==Qs.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, Hs.parseDef)(i.type._def,{...e,currentPath:[...e.currentPath,"items"]})),i.minLength&&(0, Bt.setResponseValueAndErrors)(t,"minItems",i.minLength.value,i.minLength.message,e),i.maxLength&&(0, Bt.setResponseValueAndErrors)(t,"maxItems",i.maxLength.value,i.maxLength.message,e),i.exactLength&&((0, Bt.setResponseValueAndErrors)(t,"minItems",i.exactLength.value,i.exactLength.message,e),(0, Bt.setResponseValueAndErrors)(t,"maxItems",i.exactLength.value,i.exactLength.message,e)),t}Kt.parseArrayDef=eo;});var qi=b(zt=>{Object.defineProperty(zt,"__esModule",{value:!0});zt.parseBigintDef=void 0;var Re=oe();function to(i,e){let t={type:"integer",format:"int64"};if(!i.checks)return t;for(let n of i.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?(0, Re.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e):(0, Re.setResponseValueAndErrors)(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),(0, Re.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0, Re.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e):(0, Re.setResponseValueAndErrors)(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),(0, Re.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e));break;case"multipleOf":(0, Re.setResponseValueAndErrors)(t,"multipleOf",n.value,n.message,e);break}return t}zt.parseBigintDef=to;});var Vi=b(Gt=>{Object.defineProperty(Gt,"__esModule",{value:!0});Gt.parseBooleanDef=void 0;function io(){return {type:"boolean"}}Gt.parseBooleanDef=io;});var Li=b(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseBrandedDef=void 0;var no=D();function ro(i,e){return (0, no.parseDef)(i.type._def,e)}Jt.parseBrandedDef=ro;});var Yi=b(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseCatchDef=void 0;var so=D(),oo=(i,e)=>(0, so.parseDef)(i.innerType._def,e);Xt.parseCatchDef=oo;});var Fi=b(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseDateDef=void 0;var Kn=oe();function zn(i,e,t){let n=t??e.dateStrategy;if(Array.isArray(n))return {anyOf:n.map((r,s)=>zn(i,e,r))};switch(n){case"string":case"format:date-time":return {type:"string",format:"date-time"};case"format:date":return {type:"string",format:"date"};case"integer":return ao(i,e)}}Qt.parseDateDef=zn;var ao=(i,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let n of i.checks)switch(n.kind){case"min":(0, Kn.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e);break;case"max":(0, Kn.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e);break}return t};});var Wi=b(Ht=>{Object.defineProperty(Ht,"__esModule",{value:!0});Ht.parseDefaultDef=void 0;var co=D();function lo(i,e){return {...(0, co.parseDef)(i.innerType._def,e),default:i.defaultValue()}}Ht.parseDefaultDef=lo;});var Bi=b(ei=>{Object.defineProperty(ei,"__esModule",{value:!0});ei.parseEffectsDef=void 0;var uo=D();function po(i,e){return e.effectStrategy==="input"?(0, uo.parseDef)(i.schema._def,e):{}}ei.parseEffectsDef=po;});var Ki=b(ti=>{Object.defineProperty(ti,"__esModule",{value:!0});ti.parseEnumDef=void 0;function ho(i){return {type:"string",enum:i.values}}ti.parseEnumDef=ho;});var zi=b(ii=>{Object.defineProperty(ii,"__esModule",{value:!0});ii.parseIntersectionDef=void 0;var Gn=D(),fo=i=>"type"in i&&i.type==="string"?!1:"allOf"in i;function mo(i,e){let t=[(0, Gn.parseDef)(i.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, Gn.parseDef)(i.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(s=>{if(fo(s))r.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else {let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...d}=s;o=d;}else n=void 0;r.push(o);}}),r.length?{allOf:r,...n}:void 0}ii.parseIntersectionDef=mo;});var Gi=b(ni=>{Object.defineProperty(ni,"__esModule",{value:!0});ni.parseLiteralDef=void 0;function yo(i,e){let t=typeof i.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(i.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[i.value]}:{type:t==="bigint"?"integer":t,const:i.value}}ni.parseLiteralDef=yo;});var ri=b(U=>{Object.defineProperty(U,"__esModule",{value:!0});U.parseStringDef=U.zodPatterns=void 0;var Ee=oe();U.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 _o(i,e){let t={type:"string"};function n(r){return e.patternStrategy==="escape"?go(r):r}if(i.checks)for(let r of i.checks)switch(r.kind){case"min":(0, Ee.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,r.value):r.value,r.message,e);break;case"max":(0, Ee.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case"email":switch(e.emailStrategy){case"format:email":B(t,"email",r.message,e);break;case"format:idn-email":B(t,"idn-email",r.message,e);break;case"pattern:zod":K(t,U.zodPatterns.email,r.message,e);break}break;case"url":B(t,"uri",r.message,e);break;case"uuid":B(t,"uuid",r.message,e);break;case"regex":K(t,r.regex,r.message,e);break;case"cuid":K(t,U.zodPatterns.cuid,r.message,e);break;case"cuid2":K(t,U.zodPatterns.cuid2,r.message,e);break;case"startsWith":K(t,RegExp(`^${n(r.value)}`),r.message,e);break;case"endsWith":K(t,RegExp(`${n(r.value)}$`),r.message,e);break;case"datetime":B(t,"date-time",r.message,e);break;case"date":B(t,"date",r.message,e);break;case"time":B(t,"time",r.message,e);break;case"duration":B(t,"duration",r.message,e);break;case"length":(0, Ee.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,r.value):r.value,r.message,e),(0, Ee.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case"includes":{K(t,RegExp(n(r.value)),r.message,e);break}case"ip":{r.version!=="v6"&&B(t,"ipv4",r.message,e),r.version!=="v4"&&B(t,"ipv6",r.message,e);break}case"emoji":K(t,U.zodPatterns.emoji,r.message,e);break;case"ulid":{K(t,U.zodPatterns.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{B(t,"binary",r.message,e);break}case"contentEncoding:base64":{(0, Ee.setResponseValueAndErrors)(t,"contentEncoding","base64",r.message,e);break}case"pattern:zod":{K(t,U.zodPatterns.base64,r.message,e);break}}break}case"nanoid":K(t,U.zodPatterns.nanoid,r.message,e);}return t}U.parseStringDef=_o;var go=i=>Array.from(i).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),B=(i,e,t,n)=>{i.format||i.anyOf?.some(r=>r.format)?(i.anyOf||(i.anyOf=[]),i.format&&(i.anyOf.push({format:i.format,...i.errorMessage&&n.errorMessages&&{errorMessage:{format:i.errorMessage.format}}}),delete i.format,i.errorMessage&&(delete i.errorMessage.format,Object.keys(i.errorMessage).length===0&&delete i.errorMessage)),i.anyOf.push({format:e,...t&&n.errorMessages&&{errorMessage:{format:t}}})):(0, Ee.setResponseValueAndErrors)(i,"format",e,t,n);},K=(i,e,t,n)=>{i.pattern||i.allOf?.some(r=>r.pattern)?(i.allOf||(i.allOf=[]),i.pattern&&(i.allOf.push({pattern:i.pattern,...i.errorMessage&&n.errorMessages&&{errorMessage:{pattern:i.errorMessage.pattern}}}),delete i.pattern,i.errorMessage&&(delete i.errorMessage.pattern,Object.keys(i.errorMessage).length===0&&delete i.errorMessage)),i.allOf.push({pattern:Jn(e,n),...t&&n.errorMessages&&{errorMessage:{pattern:t}}})):(0, Ee.setResponseValueAndErrors)(i,"pattern",Jn(e,n),t,n);},Jn=(i,e)=>{if(!e.applyRegexFlags||!i.flags)return i.source;let t={i:i.flags.includes("i"),m:i.flags.includes("m"),s:i.flags.includes("s")},n=t.i?i.source.toLowerCase():i.source,r="",s=!1,o=!1,a=!1;for(let d=0;d<n.length;d++){if(s){r+=n[d],s=!1;continue}if(t.i){if(o){if(n[d].match(/[a-z]/)){a?(r+=n[d],r+=`${n[d-2]}-${n[d]}`.toUpperCase(),a=!1):n[d+1]==="-"&&n[d+2]?.match(/[a-z]/)?(r+=n[d],a=!0):r+=`${n[d]}${n[d].toUpperCase()}`;continue}}else if(n[d].match(/[a-z]/)){r+=`[${n[d]}${n[d].toUpperCase()}]`;continue}}if(t.m){if(n[d]==="^"){r+=`(^|(?<=[\r
|
|
18
|
+
var b=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nt=b(G=>{Object.defineProperty(G,"__esModule",{value:!0});G.getDefaultOptions=G.defaultOptions=G.ignoreOverride=void 0;G.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");G.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 Er=i=>typeof i=="string"?{...G.defaultOptions,name:i}:{...G.defaultOptions,...i};G.getDefaultOptions=Er;});var Ri=b(Mt=>{Object.defineProperty(Mt,"__esModule",{value:!0});Mt.getRefs=void 0;var Dr=Nt(),Cr=i=>{let e=(0, Dr.getDefaultOptions)(i),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(([n,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};Mt.getRefs=Cr;});var oe=b($e=>{Object.defineProperty($e,"__esModule",{value:!0});$e.setResponseValueAndErrors=$e.addErrorMessage=void 0;function kn(i,e,t,n){n?.errorMessages&&t&&(i.errorMessage={...i.errorMessage,[e]:t});}$e.addErrorMessage=kn;function jr(i,e,t,n,r){i[e]=t,kn(i,e,n,r);}$e.setResponseValueAndErrors=jr;});var Xe=b(S=>{Object.defineProperty(S,"__esModule",{value:!0});S.getParsedType=S.ZodParsedType=S.objectUtil=S.util=void 0;var On;(function(i){i.assertEqual=r=>r;function e(r){}i.assertIs=e;function t(r){throw new Error}i.assertNever=t,i.arrayToEnum=r=>{let s={};for(let o of r)s[o]=o;return s},i.getValidEnumValues=r=>{let s=i.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(let a of s)o[a]=r[a];return i.objectValues(o)},i.objectValues=r=>i.objectKeys(r).map(function(s){return r[s]}),i.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},i.find=(r,s)=>{for(let o of r)if(s(o))return o},i.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}i.joinValues=n,i.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s;})(On=S.util||(S.util={}));(function(i){i.mergeShapes=(e,t)=>({...e,...t});})(S.objectUtil||(S.objectUtil={}));S.ZodParsedType=On.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Mr=i=>{switch(typeof i){case"undefined":return S.ZodParsedType.undefined;case"string":return S.ZodParsedType.string;case"number":return isNaN(i)?S.ZodParsedType.nan:S.ZodParsedType.number;case"boolean":return S.ZodParsedType.boolean;case"function":return S.ZodParsedType.function;case"bigint":return S.ZodParsedType.bigint;case"symbol":return S.ZodParsedType.symbol;case"object":return Array.isArray(i)?S.ZodParsedType.array:i===null?S.ZodParsedType.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?S.ZodParsedType.promise:typeof Map<"u"&&i instanceof Map?S.ZodParsedType.map:typeof Set<"u"&&i instanceof Set?S.ZodParsedType.set:typeof Date<"u"&&i instanceof Date?S.ZodParsedType.date:S.ZodParsedType.object;default:return S.ZodParsedType.unknown}};S.getParsedType=Mr;});var Zt=b(ae=>{Object.defineProperty(ae,"__esModule",{value:!0});ae.ZodError=ae.quotelessJson=ae.ZodIssueCode=void 0;var Sn=Xe();ae.ZodIssueCode=Sn.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 Zr=i=>JSON.stringify(i,null,2).replace(/"([^"]+)":/g,"$1:");ae.quotelessJson=Zr;var Qe=class i extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n];},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n];};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(s){return s.message},n={_errors:[]},r=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else {let a=n,d=0;for(;d<o.path.length;){let p=o.path[d];d===o.path.length-1?(a[p]=a[p]||{_errors:[]},a[p]._errors.push(t(o))):a[p]=a[p]||{_errors:[]},a=a[p],d++;}}};return r(this),n}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sn.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return {formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ae.ZodError=Qe;Qe.create=i=>new Qe(i);});var Di=b(Ei=>{Object.defineProperty(Ei,"__esModule",{value:!0});var fe=Xe(),j=Zt(),$r=(i,e)=>{let t;switch(i.code){case j.ZodIssueCode.invalid_type:i.received===fe.ZodParsedType.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case j.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,fe.util.jsonStringifyReplacer)}`;break;case j.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${fe.util.joinValues(i.keys,", ")}`;break;case j.ZodIssueCode.invalid_union:t="Invalid input";break;case j.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${fe.util.joinValues(i.options)}`;break;case j.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${fe.util.joinValues(i.options)}, received '${i.received}'`;break;case j.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case j.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case j.ZodIssueCode.invalid_date:t="Invalid date";break;case j.ZodIssueCode.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:fe.util.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case j.ZodIssueCode.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case j.ZodIssueCode.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case j.ZodIssueCode.custom:t="Invalid input";break;case j.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case j.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case j.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,fe.util.assertNever(i);}return {message:t}};Ei.default=$r;});var $t=b(J=>{var Ur=J&&J.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(J,"__esModule",{value:!0});J.getErrorMap=J.setErrorMap=J.defaultErrorMap=void 0;var An=Ur(Di());J.defaultErrorMap=An.default;var In=An.default;function qr(i){In=i;}J.setErrorMap=qr;function Vr(){return In}J.getErrorMap=Vr;});var ji=b(O=>{var Lr=O&&O.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};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 Yr=$t(),Pn=Lr(Di()),Fr=i=>{let{data:e,path:t,errorMaps:n,issueData:r}=i,s=[...t,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return {...r,path:s,message:r.message};let a="",d=n.filter(p=>!!p).slice().reverse();for(let p of d)a=p(o,{data:e,defaultError:a}).message;return {...r,path:s,message:a}};O.makeIssue=Fr;O.EMPTY_PATH=[];function Wr(i,e){let t=(0, Yr.getErrorMap)(),n=(0, O.makeIssue)({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===Pn.default?void 0:Pn.default].filter(r=>!!r)});i.common.issues.push(n);}O.addIssueToContext=Wr;var Ci=class i{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return O.INVALID;r.status==="dirty"&&e.dirty(),n.push(r.value);}return {status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let s=await r.key,o=await r.value;n.push({key:s,value:o});}return i.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return O.INVALID;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[s.value]=o.value);}return {status:e.value,value:n}}};O.ParseStatus=Ci;O.INVALID=Object.freeze({status:"aborted"});var Br=i=>({status:"dirty",value:i});O.DIRTY=Br;var Kr=i=>({status:"valid",value:i});O.OK=Kr;var zr=i=>i.status==="aborted";O.isAborted=zr;var Gr=i=>i.status==="dirty";O.isDirty=Gr;var Jr=i=>i.status==="valid";O.isValid=Jr;var Xr=i=>typeof Promise<"u"&&i instanceof Promise;O.isAsync=Xr;});var En=b(Rn=>{Object.defineProperty(Rn,"__esModule",{value:!0});});var Dn=b(He=>{Object.defineProperty(He,"__esModule",{value:!0});He.errorUtil=void 0;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e?.message;})(He.errorUtil||(He.errorUtil={}));});var Fn=b(c=>{var qt=c&&c.__classPrivateFieldGet||function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},jn=c&&c.__classPrivateFieldSet||function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},et,tt;Object.defineProperty(c,"__esModule",{value:!0});c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.custom=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.datetimeRegex=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=c.discriminatedUnion=c.date=void 0;var Ut=$t(),_=Dn(),l=ji(),m=Xe(),f=Zt(),L=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r;}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}},Cn=(i,e)=>{if((0, l.isValid)(e))return {success:!0,data:e.value};if(!i.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(i.common.issues);return this._error=t,this._error}}};function v(i){if(!i)return {};let{errorMap:e,invalid_type_error:t,required_error:n,description:r}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{var d,p;let{message:y}=i;return o.code==="invalid_enum_value"?{message:y??a.defaultError}:typeof a.data>"u"?{message:(d=y??n)!==null&&d!==void 0?d:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(p=y??t)!==null&&p!==void 0?p:a.defaultError}},description:r}}var T=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, m.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new l.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, l.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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let r={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, m.getParsedType)(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Cn(r,s)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, m.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await((0, l.isAsync)(r)?r:Promise.resolve(r));return Cn(n,s)}refine(e,t){let n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,s)=>{let o=e(r),a=()=>s.addIssue({code:f.ZodIssueCode.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new $({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return V.create(this,this._def)}nullable(){return Q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ie.create(this,this._def)}promise(){return de.create(this,this._def)}or(e){return Te.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new $({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Ae({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new it({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ie({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return nt.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=T;c.Schema=T;c.ZodSchema=T;var Hr=/^c[^\s-]{8,}$/i,es=/^[0-9a-z]+$/,ts=/^[0-9A-HJKMNP-TV-Z]{26}$/,is=/^[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,ns=/^[a-z0-9_-]{21}$/i,rs=/^[-+]?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)?)??$/,ss=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,os="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ni,as=/^(?:(?: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])$/,cs=/^(([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})))$/,ls=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nn="((\\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])))",ds=new RegExp(`^${Nn}$`);function Mn(i){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`),e}function us(i){return new RegExp(`^${Mn(i)}$`)}function Zn(i){let e=`${Nn}T${Mn(i)}`,t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}c.datetimeRegex=Zn;function ps(i,e){return !!((e==="v4"||!e)&&as.test(i)||(e==="v6"||!e)&&cs.test(i))}var ce=class i extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.ZodParsedType.string){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.string,received:s.parsedType}),l.INVALID}let n=new l.ParseStatus,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(r=this._getOrReturnCtx(e,r),o?(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty());}else if(s.kind==="email")ss.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"email",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Ni||(Ni=new RegExp(os,"u")),Ni.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")is.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")ns.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Hr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")es.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")ts.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"ulid",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data);}catch{r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"url",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty();}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"regex",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Zn(s).test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?ds.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?us(s).test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?rs.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?ps(e.data,s.version)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?ls.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):m.util.assertNever(s);return {status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:f.ZodIssueCode.invalid_string,..._.errorUtil.errToObj(n)})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errorUtil.errToObj(e)})}datetime(e){var t,n;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:(n=e?.local)!==null&&n!==void 0?n:!1,..._.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,..._.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",..._.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,..._.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,_.errorUtil.errToObj(e))}trim(){return new i({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i({...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}};c.ZodString=ce;ce.create=i=>{var e;return new ce({checks:[],typeName:g.ZodString,coerce:(e=i?.coerce)!==null&&e!==void 0?e:!1,...v(i)})};function hs(i,e){let t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,s=parseInt(i.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return s%o/Math.pow(10,r)}var me=class i extends T{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)!==m.ZodParsedType.number){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:s.parsedType}),l.INVALID}let n,r=new l.ParseStatus;for(let s of this._def.checks)s.kind==="int"?m.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?hs(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.not_finite,message:s.message}),r.dirty()):m.util.assertNever(s);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.errorUtil.toString(t))}setLimit(e,t,n,r){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.errorUtil.toString(r)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.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"&&m.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return !0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);}return Number.isFinite(t)&&Number.isFinite(e)}};c.ZodNumber=me;me.create=i=>new me({checks:[],typeName:g.ZodNumber,coerce:i?.coerce||!1,...v(i)});var ye=class i extends T{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)!==m.ZodParsedType.bigint){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.bigint,received:s.parsedType}),l.INVALID}let n,r=new l.ParseStatus;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):m.util.assertNever(s);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.errorUtil.toString(t))}setLimit(e,t,n,r){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.errorUtil.toString(r)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.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}};c.ZodBigInt=ye;ye.create=i=>{var e;return new ye({checks:[],typeName:g.ZodBigInt,coerce:(e=i?.coerce)!==null&&e!==void 0?e:!1,...v(i)})};var _e=class extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodBoolean=_e;_e.create=i=>new _e({typeName:g.ZodBoolean,coerce:i?.coerce||!1,...v(i)});var ge=class i extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.ZodParsedType.date){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.date,received:s.parsedType}),l.INVALID}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:f.ZodIssueCode.invalid_date}),l.INVALID}let n=new l.ParseStatus,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):m.util.assertNever(s);return {status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.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}};c.ZodDate=ge;ge.create=i=>new ge({checks:[],coerce:i?.coerce||!1,typeName:g.ZodDate,...v(i)});var qe=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodSymbol=qe;qe.create=i=>new qe({typeName:g.ZodSymbol,...v(i)});var be=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodUndefined=be;be.create=i=>new be({typeName:g.ZodUndefined,...v(i)});var ve=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodNull=ve;ve.create=i=>new ve({typeName:g.ZodNull,...v(i)});var le=class extends T{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, l.OK)(e.data)}};c.ZodAny=le;le.create=i=>new le({typeName:g.ZodAny,...v(i)});var te=class extends T{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, l.OK)(e.data)}};c.ZodUnknown=te;te.create=i=>new te({typeName:g.ZodUnknown,...v(i)});var W=class extends T{_parse(e){let t=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:t.parsedType}),l.INVALID}};c.ZodNever=W;W.create=i=>new W({typeName:g.ZodNever,...v(i)});var Ve=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};c.ZodVoid=Ve;Ve.create=i=>new Ve({typeName:g.ZodVoid,...v(i)});var ie=class i extends T{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.ZodParsedType.array)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:t.parsedType}),l.INVALID;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(o||a)&&((0, l.addIssueToContext)(t,{code:o?f.ZodIssueCode.too_big:f.ZodIssueCode.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty());}if(r.minLength!==null&&t.data.length<r.minLength.value&&((0, l.addIssueToContext)(t,{code:f.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&((0, l.addIssueToContext)(t,{code:f.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new L(t,o,t.path,a)))).then(o=>l.ParseStatus.mergeArray(n,o));let s=[...t.data].map((o,a)=>r.type._parseSync(new L(t,o,t.path,a)));return l.ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new i({...this._def,minLength:{value:e,message:_.errorUtil.toString(t)}})}max(e,t){return new i({...this._def,maxLength:{value:e,message:_.errorUtil.toString(t)}})}length(e,t){return new i({...this._def,exactLength:{value:e,message:_.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=ie;ie.create=(i,e)=>new ie({type:i,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function Ue(i){if(i instanceof M){let e={};for(let t in i.shape){let n=i.shape[t];e[t]=V.create(Ue(n));}return new M({...i._def,shape:()=>e})}else return i instanceof ie?new ie({...i._def,type:Ue(i.element)}):i instanceof V?V.create(Ue(i.unwrap())):i instanceof Q?Q.create(Ue(i.unwrap())):i instanceof X?X.create(i.items.map(e=>Ue(e))):i}var M=class i extends T{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=m.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.ZodParsedType.object){let p=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(p,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:p.parsedType}),l.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof W&&this._def.unknownKeys==="strip"))for(let p in r.data)o.includes(p)||a.push(p);let d=[];for(let p of o){let y=s[p],I=r.data[p];d.push({key:{status:"valid",value:p},value:y._parse(new L(r,I,r.path,p)),alwaysSet:p in r.data});}if(this._def.catchall instanceof W){let p=this._def.unknownKeys;if(p==="passthrough")for(let y of a)d.push({key:{status:"valid",value:y},value:{status:"valid",value:r.data[y]}});else if(p==="strict")a.length>0&&((0, l.addIssueToContext)(r,{code:f.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let p=this._def.catchall;for(let y of a){let I=r.data[y];d.push({key:{status:"valid",value:y},value:p._parse(new L(r,I,r.path,y)),alwaysSet:y in r.data});}}return r.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of d){let I=await y.key,ne=await y.value;p.push({key:I,value:ne,alwaysSet:y.alwaysSet});}return p}).then(p=>l.ParseStatus.mergeObjectSync(n,p)):l.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return _.errorUtil.errToObj,new i({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var r,s,o,a;let d=(o=(s=(r=this._def).errorMap)===null||s===void 0?void 0:s.call(r,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(a=_.errorUtil.errToObj(e).message)!==null&&a!==void 0?a:d}:{message:d}}}:{}})}strip(){return new i({...this._def,unknownKeys:"strip"})}passthrough(){return new i({...this._def,unknownKeys:"passthrough"})}extend(e){return new i({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new i({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new i({...this._def,catchall:e})}pick(e){let t={};return m.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n]);}),new i({...this._def,shape:()=>t})}omit(e){let t={};return m.util.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n]);}),new i({...this._def,shape:()=>t})}deepPartial(){return Ue(this)}partial(e){let t={};return m.util.objectKeys(this.shape).forEach(n=>{let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional();}),new i({...this._def,shape:()=>t})}required(e){let t={};return m.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else {let s=this.shape[n];for(;s instanceof V;)s=s._def.innerType;t[n]=s;}}),new i({...this._def,shape:()=>t})}keyof(){return $n(m.util.objectKeys(this.shape))}};c.ZodObject=M;M.create=(i,e)=>new M({shape:()=>i,unknownKeys:"strip",catchall:W.create(),typeName:g.ZodObject,...v(e)});M.strictCreate=(i,e)=>new M({shape:()=>i,unknownKeys:"strict",catchall:W.create(),typeName:g.ZodObject,...v(e)});M.lazycreate=(i,e)=>new M({shape:i,unknownKeys:"strip",catchall:W.create(),typeName:g.ZodObject,...v(e)});var Te=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new f.ZodError(a.ctx.common.issues));return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:o}),l.INVALID}if(t.common.async)return Promise.all(n.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return {result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let s,o=[];for(let d of n){let p={...t,common:{...t.common,issues:[]},parent:null},y=d._parseSync({data:t.data,path:t.path,parent:p});if(y.status==="valid")return y;y.status==="dirty"&&!s&&(s={result:y,ctx:p}),p.common.issues.length&&o.push(p.common.issues);}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(d=>new f.ZodError(d));return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),l.INVALID}}get options(){return this._def.options}};c.ZodUnion=Te;Te.create=(i,e)=>new Te({options:i,typeName:g.ZodUnion,...v(e)});var ee=i=>i instanceof we?ee(i.schema):i instanceof $?ee(i.innerType()):i instanceof ke?[i.value]:i instanceof Oe?i.options:i instanceof Se?m.util.objectValues(i.enum):i instanceof Ae?ee(i._def.innerType):i instanceof be?[void 0]:i instanceof ve?[null]:i instanceof V?[void 0,...ee(i.unwrap())]:i instanceof Q?[null,...ee(i.unwrap())]:i instanceof it||i instanceof Pe?ee(i.unwrap()):i instanceof Ie?ee(i._def.innerType):[],Vt=class i extends T{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.ZodParsedType.object)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:t.parsedType}),l.INVALID;let n=this.discriminator,r=t.data[n],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):((0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),l.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let s of t){let o=ee(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,s);}}return new i({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...v(n)})}};c.ZodDiscriminatedUnion=Vt;function Mi(i,e){let t=(0, m.getParsedType)(i),n=(0, m.getParsedType)(e);if(i===e)return {valid:!0,data:i};if(t===m.ZodParsedType.object&&n===m.ZodParsedType.object){let r=m.util.objectKeys(e),s=m.util.objectKeys(i).filter(a=>r.indexOf(a)!==-1),o={...i,...e};for(let a of s){let d=Mi(i[a],e[a]);if(!d.valid)return {valid:!1};o[a]=d.data;}return {valid:!0,data:o}}else if(t===m.ZodParsedType.array&&n===m.ZodParsedType.array){if(i.length!==e.length)return {valid:!1};let r=[];for(let s=0;s<i.length;s++){let o=i[s],a=e[s],d=Mi(o,a);if(!d.valid)return {valid:!1};r.push(d.data);}return {valid:!0,data:r}}else return t===m.ZodParsedType.date&&n===m.ZodParsedType.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}var xe=class extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(s,o)=>{if((0, l.isAborted)(s)||(0, l.isAborted)(o))return l.INVALID;let a=Mi(s.value,o.value);return a.valid?(((0, l.isDirty)(s)||(0, l.isDirty)(o))&&t.dirty(),{status:t.value,value:a.data}):((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_intersection_types}),l.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=xe;xe.create=(i,e,t)=>new xe({left:i,right:e,typeName:g.ZodIntersection,...v(t)});var X=class i extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:n.parsedType}),l.INVALID;if(n.data.length<this._def.items.length)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new L(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>l.ParseStatus.mergeArray(t,o)):l.ParseStatus.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new i({...this._def,rest:e})}};c.ZodTuple=X;X.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new X({items:i,typeName:g.ZodTuple,rest:null,...v(e)})};var Lt=class i extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.object)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:n.parsedType}),l.INVALID;let r=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)r.push({key:s._parse(new L(n,a,n.path,a)),value:o._parse(new L(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?l.ParseStatus.mergeObjectAsync(t,r):l.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof T?new i({keyType:e,valueType:t,typeName:g.ZodRecord,...v(n)}):new i({keyType:ce.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}};c.ZodRecord=Lt;var Le=class extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.map)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.map,received:n.parsedType}),l.INVALID;let r=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,d],p)=>({key:r._parse(new L(n,a,n.path,[p,"key"])),value:s._parse(new L(n,d,n.path,[p,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of o){let p=await d.key,y=await d.value;if(p.status==="aborted"||y.status==="aborted")return l.INVALID;(p.status==="dirty"||y.status==="dirty")&&t.dirty(),a.set(p.value,y.value);}return {status:t.value,value:a}})}else {let a=new Map;for(let d of o){let p=d.key,y=d.value;if(p.status==="aborted"||y.status==="aborted")return l.INVALID;(p.status==="dirty"||y.status==="dirty")&&t.dirty(),a.set(p.value,y.value);}return {status:t.value,value:a}}}};c.ZodMap=Le;Le.create=(i,e,t)=>new Le({valueType:e,keyType:i,typeName:g.ZodMap,...v(t)});var Ye=class i extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.set,received:n.parsedType}),l.INVALID;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&((0, l.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let s=this._def.valueType;function o(d){let p=new Set;for(let y of d){if(y.status==="aborted")return l.INVALID;y.status==="dirty"&&t.dirty(),p.add(y.value);}return {status:t.value,value:p}}let a=[...n.data.values()].map((d,p)=>s._parse(new L(n,d,n.path,p)));return n.common.async?Promise.all(a).then(d=>o(d)):o(a)}min(e,t){return new i({...this._def,minSize:{value:e,message:_.errorUtil.toString(t)}})}max(e,t){return new i({...this._def,maxSize:{value:e,message:_.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};c.ZodSet=Ye;Ye.create=(i,e)=>new Ye({valueType:i,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});var Yt=class i extends T{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.ZodParsedType.function)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.function,received:t.parsedType}),l.INVALID;function n(a,d){return (0, l.makeIssue)({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ut.getErrorMap)(),Ut.defaultErrorMap].filter(p=>!!p),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:d}})}function r(a,d){return (0, l.makeIssue)({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, Ut.getErrorMap)(),Ut.defaultErrorMap].filter(p=>!!p),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof de){let a=this;return (0, l.OK)(async function(...d){let p=new f.ZodError([]),y=await a._def.args.parseAsync(d,s).catch(R=>{throw p.addIssue(n(d,R)),p}),I=await Reflect.apply(o,this,y);return await a._def.returns._def.type.parseAsync(I,s).catch(R=>{throw p.addIssue(r(I,R)),p})})}else {let a=this;return (0, l.OK)(function(...d){let p=a._def.args.safeParse(d,s);if(!p.success)throw new f.ZodError([n(d,p.error)]);let y=Reflect.apply(o,this,p.data),I=a._def.returns.safeParse(y,s);if(!I.success)throw new f.ZodError([r(y,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new i({...this._def,args:X.create(e).rest(te.create())})}returns(e){return new i({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new i({args:e||X.create([]).rest(te.create()),returns:t||te.create(),typeName:g.ZodFunction,...v(n)})}};c.ZodFunction=Yt;var we=class extends T{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})}};c.ZodLazy=we;we.create=(i,e)=>new we({getter:i,typeName:g.ZodLazy,...v(e)});var ke=class extends T{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),l.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=ke;ke.create=(i,e)=>new ke({value:i,typeName:g.ZodLiteral,...v(e)});function $n(i,e){return new Oe({values:i,typeName:g.ZodEnum,...v(e)})}var Oe=class i extends T{constructor(){super(...arguments),et.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return (0, l.addIssueToContext)(t,{expected:m.util.joinValues(n),received:t.parsedType,code:f.ZodIssueCode.invalid_type}),l.INVALID}if(qt(this,et,"f")||jn(this,et,new Set(this._def.values),"f"),!qt(this,et,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return (0, l.addIssueToContext)(t,{received:t.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),l.INVALID}return (0, l.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 i.create(e,{...this._def,...t})}exclude(e,t=this._def){return i.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};c.ZodEnum=Oe;et=new WeakMap;Oe.create=$n;var Se=class extends T{constructor(){super(...arguments),tt.set(this,void 0);}_parse(e){let t=m.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.ZodParsedType.string&&n.parsedType!==m.ZodParsedType.number){let r=m.util.objectValues(t);return (0, l.addIssueToContext)(n,{expected:m.util.joinValues(r),received:n.parsedType,code:f.ZodIssueCode.invalid_type}),l.INVALID}if(qt(this,tt,"f")||jn(this,tt,new Set(m.util.getValidEnumValues(this._def.values)),"f"),!qt(this,tt,"f").has(e.data)){let r=m.util.objectValues(t);return (0, l.addIssueToContext)(n,{received:n.data,code:f.ZodIssueCode.invalid_enum_value,options:r}),l.INVALID}return (0, l.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=Se;tt=new WeakMap;Se.create=(i,e)=>new Se({values:i,typeName:g.ZodNativeEnum,...v(e)});var de=class extends T{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.ZodParsedType.promise&&t.common.async===!1)return (0, l.addIssueToContext)(t,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:t.parsedType}),l.INVALID;let n=t.parsedType===m.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, l.OK)(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};c.ZodPromise=de;de.create=(i,e)=>new de({type:i,typeName:g.ZodPromise,...v(e)});var $=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{(0, l.addIssueToContext)(n,o),o.fatal?t.abort():t.dirty();},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let o=r.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return l.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?l.INVALID:d.status==="dirty"||t.value==="dirty"?(0, l.DIRTY)(d.value):d});{if(t.value==="aborted")return l.INVALID;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?l.INVALID:a.status==="dirty"||t.value==="dirty"?(0, l.DIRTY)(a.value):a}}if(r.type==="refinement"){let o=a=>{let d=r.refinement(a,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?l.INVALID:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?l.INVALID:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0, l.isValid)(o))return o;let a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>(0, l.isValid)(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:t.value,value:a})):o);m.util.assertNever(r);}};c.ZodEffects=$;c.ZodTransformer=$;$.create=(i,e,t)=>new $({schema:i,typeName:g.ZodEffects,effect:e,...v(t)});$.createWithPreprocess=(i,e,t)=>new $({schema:e,effect:{type:"preprocess",transform:i},typeName:g.ZodEffects,...v(t)});var V=class extends T{_parse(e){return this._getType(e)===m.ZodParsedType.undefined?(0, l.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=V;V.create=(i,e)=>new V({innerType:i,typeName:g.ZodOptional,...v(e)});var Q=class extends T{_parse(e){return this._getType(e)===m.ZodParsedType.null?(0, l.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=Q;Q.create=(i,e)=>new Q({innerType:i,typeName:g.ZodNullable,...v(e)});var Ae=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};c.ZodDefault=Ae;Ae.create=(i,e)=>new Ae({innerType:i,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var Ie=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return (0, l.isAsync)(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=Ie;Ie.create=(i,e)=>new Ie({innerType:i,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var Fe=class extends T{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),l.INVALID}return {status:"valid",value:e.data}}};c.ZodNaN=Fe;Fe.create=i=>new Fe({typeName:g.ZodNaN,...v(i)});c.BRAND=Symbol("zod_brand");var it=class extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};c.ZodBranded=it;var nt=class i extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return (async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:s.status==="dirty"?(t.dirty(),(0, l.DIRTY)(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?l.INVALID:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new i({in:e,out:t,typeName:g.ZodPipeline})}};c.ZodPipeline=nt;var Pe=class extends T{_parse(e){let t=this._def.innerType._parse(e),n=r=>((0, l.isValid)(r)&&(r.value=Object.freeze(r.value)),r);return (0, l.isAsync)(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};c.ZodReadonly=Pe;Pe.create=(i,e)=>new Pe({innerType:i,typeName:g.ZodReadonly,...v(e)});function Un(i,e={},t){return i?le.create().superRefine((n,r)=>{var s,o;if(!i(n)){let a=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(o=(s=a.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,p=typeof a=="string"?{message:a}:a;r.addIssue({code:"custom",...p,fatal:d});}}):le.create()}c.custom=Un;c.late={object:M.lazycreate};var g;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly";})(g=c.ZodFirstPartyTypeKind||(c.ZodFirstPartyTypeKind={}));var fs=(i,e={message:`Input not instance of ${i.name}`})=>Un(t=>t instanceof i,e);c.instanceof=fs;var qn=ce.create;c.string=qn;var Vn=me.create;c.number=Vn;var ms=Fe.create;c.nan=ms;var ys=ye.create;c.bigint=ys;var Ln=_e.create;c.boolean=Ln;var _s=ge.create;c.date=_s;var gs=qe.create;c.symbol=gs;var bs=be.create;c.undefined=bs;var vs=ve.create;c.null=vs;var Ts=le.create;c.any=Ts;var xs=te.create;c.unknown=xs;var ws=W.create;c.never=ws;var ks=Ve.create;c.void=ks;var Os=ie.create;c.array=Os;var Ss=M.create;c.object=Ss;var As=M.strictCreate;c.strictObject=As;var Is=Te.create;c.union=Is;var Ps=Vt.create;c.discriminatedUnion=Ps;var Rs=xe.create;c.intersection=Rs;var Es=X.create;c.tuple=Es;var Ds=Lt.create;c.record=Ds;var Cs=Le.create;c.map=Cs;var js=Ye.create;c.set=js;var Ns=Yt.create;c.function=Ns;var Ms=we.create;c.lazy=Ms;var Zs=ke.create;c.literal=Zs;var $s=Oe.create;c.enum=$s;var Us=Se.create;c.nativeEnum=Us;var qs=de.create;c.promise=qs;var Yn=$.create;c.effect=Yn;c.transformer=Yn;var Vs=V.create;c.optional=Vs;var Ls=Q.create;c.nullable=Ls;var Ys=$.createWithPreprocess;c.preprocess=Ys;var Fs=nt.create;c.pipeline=Fs;var Ws=()=>qn().optional();c.ostring=Ws;var Bs=()=>Vn().optional();c.onumber=Bs;var Ks=()=>Ln().optional();c.oboolean=Ks;c.coerce={string:i=>ce.create({...i,coerce:!0}),number:i=>me.create({...i,coerce:!0}),boolean:i=>_e.create({...i,coerce:!0}),bigint:i=>ye.create({...i,coerce:!0}),date:i=>ge.create({...i,coerce:!0})};c.NEVER=l.INVALID;});var Zi=b(Y=>{var zs=Y&&Y.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t),Object.defineProperty(i,n,{enumerable:!0,get:function(){return e[t]}});}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),We=Y&&Y.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&zs(e,i,t);};Object.defineProperty(Y,"__esModule",{value:!0});We($t(),Y);We(ji(),Y);We(En(),Y);We(Xe(),Y);We(Fn(),Y);We(Zt(),Y);});var Ft=b(Z=>{var Wn=Z&&Z.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t),Object.defineProperty(i,n,{enumerable:!0,get:function(){return e[t]}});}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),Gs=Z&&Z.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e});}:function(i,e){i.default=e;}),Js=Z&&Z.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Wn(e,i,t);return Gs(e,i),e},Xs=Z&&Z.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Wn(e,i,t);};Object.defineProperty(Z,"__esModule",{value:!0});Z.z=void 0;var Bn=Js(Zi());Z.z=Bn;Xs(Zi(),Z);Z.default=Bn;});var $i=b(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseAnyDef=void 0;function Qs(){return {}}Wt.parseAnyDef=Qs;});var Ui=b(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseArrayDef=void 0;var Hs=Ft(),Bt=oe(),eo=D();function to(i,e){let t={type:"array"};return i.type?._def?.typeName!==Hs.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, eo.parseDef)(i.type._def,{...e,currentPath:[...e.currentPath,"items"]})),i.minLength&&(0, Bt.setResponseValueAndErrors)(t,"minItems",i.minLength.value,i.minLength.message,e),i.maxLength&&(0, Bt.setResponseValueAndErrors)(t,"maxItems",i.maxLength.value,i.maxLength.message,e),i.exactLength&&((0, Bt.setResponseValueAndErrors)(t,"minItems",i.exactLength.value,i.exactLength.message,e),(0, Bt.setResponseValueAndErrors)(t,"maxItems",i.exactLength.value,i.exactLength.message,e)),t}Kt.parseArrayDef=to;});var qi=b(zt=>{Object.defineProperty(zt,"__esModule",{value:!0});zt.parseBigintDef=void 0;var Re=oe();function io(i,e){let t={type:"integer",format:"int64"};if(!i.checks)return t;for(let n of i.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?(0, Re.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e):(0, Re.setResponseValueAndErrors)(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),(0, Re.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0, Re.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e):(0, Re.setResponseValueAndErrors)(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),(0, Re.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e));break;case"multipleOf":(0, Re.setResponseValueAndErrors)(t,"multipleOf",n.value,n.message,e);break}return t}zt.parseBigintDef=io;});var Vi=b(Gt=>{Object.defineProperty(Gt,"__esModule",{value:!0});Gt.parseBooleanDef=void 0;function no(){return {type:"boolean"}}Gt.parseBooleanDef=no;});var Li=b(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseBrandedDef=void 0;var ro=D();function so(i,e){return (0, ro.parseDef)(i.type._def,e)}Jt.parseBrandedDef=so;});var Yi=b(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseCatchDef=void 0;var oo=D(),ao=(i,e)=>(0, oo.parseDef)(i.innerType._def,e);Xt.parseCatchDef=ao;});var Fi=b(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseDateDef=void 0;var Kn=oe();function zn(i,e,t){let n=t??e.dateStrategy;if(Array.isArray(n))return {anyOf:n.map((r,s)=>zn(i,e,r))};switch(n){case"string":case"format:date-time":return {type:"string",format:"date-time"};case"format:date":return {type:"string",format:"date"};case"integer":return co(i,e)}}Qt.parseDateDef=zn;var co=(i,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let n of i.checks)switch(n.kind){case"min":(0, Kn.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e);break;case"max":(0, Kn.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e);break}return t};});var Wi=b(Ht=>{Object.defineProperty(Ht,"__esModule",{value:!0});Ht.parseDefaultDef=void 0;var lo=D();function uo(i,e){return {...(0, lo.parseDef)(i.innerType._def,e),default:i.defaultValue()}}Ht.parseDefaultDef=uo;});var Bi=b(ei=>{Object.defineProperty(ei,"__esModule",{value:!0});ei.parseEffectsDef=void 0;var po=D();function ho(i,e){return e.effectStrategy==="input"?(0, po.parseDef)(i.schema._def,e):{}}ei.parseEffectsDef=ho;});var Ki=b(ti=>{Object.defineProperty(ti,"__esModule",{value:!0});ti.parseEnumDef=void 0;function fo(i){return {type:"string",enum:i.values}}ti.parseEnumDef=fo;});var zi=b(ii=>{Object.defineProperty(ii,"__esModule",{value:!0});ii.parseIntersectionDef=void 0;var Gn=D(),mo=i=>"type"in i&&i.type==="string"?!1:"allOf"in i;function yo(i,e){let t=[(0, Gn.parseDef)(i.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, Gn.parseDef)(i.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(s=>{if(mo(s))r.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else {let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...d}=s;o=d;}else n=void 0;r.push(o);}}),r.length?{allOf:r,...n}:void 0}ii.parseIntersectionDef=yo;});var Gi=b(ni=>{Object.defineProperty(ni,"__esModule",{value:!0});ni.parseLiteralDef=void 0;function _o(i,e){let t=typeof i.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(i.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[i.value]}:{type:t==="bigint"?"integer":t,const:i.value}}ni.parseLiteralDef=_o;});var ri=b(U=>{Object.defineProperty(U,"__esModule",{value:!0});U.parseStringDef=U.zodPatterns=void 0;var Ee=oe();U.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 go(i,e){let t={type:"string"};function n(r){return e.patternStrategy==="escape"?bo(r):r}if(i.checks)for(let r of i.checks)switch(r.kind){case"min":(0, Ee.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,r.value):r.value,r.message,e);break;case"max":(0, Ee.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case"email":switch(e.emailStrategy){case"format:email":B(t,"email",r.message,e);break;case"format:idn-email":B(t,"idn-email",r.message,e);break;case"pattern:zod":K(t,U.zodPatterns.email,r.message,e);break}break;case"url":B(t,"uri",r.message,e);break;case"uuid":B(t,"uuid",r.message,e);break;case"regex":K(t,r.regex,r.message,e);break;case"cuid":K(t,U.zodPatterns.cuid,r.message,e);break;case"cuid2":K(t,U.zodPatterns.cuid2,r.message,e);break;case"startsWith":K(t,RegExp(`^${n(r.value)}`),r.message,e);break;case"endsWith":K(t,RegExp(`${n(r.value)}$`),r.message,e);break;case"datetime":B(t,"date-time",r.message,e);break;case"date":B(t,"date",r.message,e);break;case"time":B(t,"time",r.message,e);break;case"duration":B(t,"duration",r.message,e);break;case"length":(0, Ee.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,r.value):r.value,r.message,e),(0, Ee.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case"includes":{K(t,RegExp(n(r.value)),r.message,e);break}case"ip":{r.version!=="v6"&&B(t,"ipv4",r.message,e),r.version!=="v4"&&B(t,"ipv6",r.message,e);break}case"emoji":K(t,U.zodPatterns.emoji,r.message,e);break;case"ulid":{K(t,U.zodPatterns.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{B(t,"binary",r.message,e);break}case"contentEncoding:base64":{(0, Ee.setResponseValueAndErrors)(t,"contentEncoding","base64",r.message,e);break}case"pattern:zod":{K(t,U.zodPatterns.base64,r.message,e);break}}break}case"nanoid":K(t,U.zodPatterns.nanoid,r.message,e);}return t}U.parseStringDef=go;var bo=i=>Array.from(i).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),B=(i,e,t,n)=>{i.format||i.anyOf?.some(r=>r.format)?(i.anyOf||(i.anyOf=[]),i.format&&(i.anyOf.push({format:i.format,...i.errorMessage&&n.errorMessages&&{errorMessage:{format:i.errorMessage.format}}}),delete i.format,i.errorMessage&&(delete i.errorMessage.format,Object.keys(i.errorMessage).length===0&&delete i.errorMessage)),i.anyOf.push({format:e,...t&&n.errorMessages&&{errorMessage:{format:t}}})):(0, Ee.setResponseValueAndErrors)(i,"format",e,t,n);},K=(i,e,t,n)=>{i.pattern||i.allOf?.some(r=>r.pattern)?(i.allOf||(i.allOf=[]),i.pattern&&(i.allOf.push({pattern:i.pattern,...i.errorMessage&&n.errorMessages&&{errorMessage:{pattern:i.errorMessage.pattern}}}),delete i.pattern,i.errorMessage&&(delete i.errorMessage.pattern,Object.keys(i.errorMessage).length===0&&delete i.errorMessage)),i.allOf.push({pattern:Jn(e,n),...t&&n.errorMessages&&{errorMessage:{pattern:t}}})):(0, Ee.setResponseValueAndErrors)(i,"pattern",Jn(e,n),t,n);},Jn=(i,e)=>{if(!e.applyRegexFlags||!i.flags)return i.source;let t={i:i.flags.includes("i"),m:i.flags.includes("m"),s:i.flags.includes("s")},n=t.i?i.source.toLowerCase():i.source,r="",s=!1,o=!1,a=!1;for(let d=0;d<n.length;d++){if(s){r+=n[d],s=!1;continue}if(t.i){if(o){if(n[d].match(/[a-z]/)){a?(r+=n[d],r+=`${n[d-2]}-${n[d]}`.toUpperCase(),a=!1):n[d+1]==="-"&&n[d+2]?.match(/[a-z]/)?(r+=n[d],a=!0):r+=`${n[d]}${n[d].toUpperCase()}`;continue}}else if(n[d].match(/[a-z]/)){r+=`[${n[d]}${n[d].toUpperCase()}]`;continue}}if(t.m){if(n[d]==="^"){r+=`(^|(?<=[\r
|
|
19
19
|
]))`;continue}else if(n[d]==="$"){r+=`($|(?=[\r
|
|
20
20
|
]))`;continue}}if(t.s&&n[d]==="."){r+=o?`${n[d]}\r
|
|
21
21
|
`:`[${n[d]}\r
|
|
22
|
-
]`;continue}r+=n[d],n[d]==="\\"?s=!0:o&&n[d]==="]"?o=!1:!o&&n[d]==="["&&(o=!0);}try{let d=new RegExp(r);}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`),i.source}return r};});var oi=b(si=>{Object.defineProperty(si,"__esModule",{value:!0});si.parseRecordDef=void 0;var Ji=Ft(),Xn=D(),bo=ri();function vo(i,e){if(e.target==="openApi3"&&i.keyType?._def.typeName===Ji.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:i.keyType._def.values,properties:i.keyType._def.values.reduce((n,r)=>({...n,[r]:(0, Xn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, Xn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(i.keyType?._def.typeName===Ji.ZodFirstPartyTypeKind.ZodString&&i.keyType._def.checks?.length){let n=Object.entries((0, bo.parseStringDef)(i.keyType._def,e)).reduce((r,[s,o])=>s==="type"?r:{...r,[s]:o},{});return {...t,propertyNames:n}}else if(i.keyType?._def.typeName===Ji.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:i.keyType._def.values}};return t}si.parseRecordDef=vo;});var Xi=b(ai=>{Object.defineProperty(ai,"__esModule",{value:!0});ai.parseMapDef=void 0;var Qn=D(),To=oi();function xo(i,e){if(e.mapStrategy==="record")return (0, To.parseRecordDef)(i,e);let t=(0, Qn.parseDef)(i.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0, Qn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return {type:"array",maxItems:125,items:{type:"array",items:[t,n],minItems:2,maxItems:2}}}ai.parseMapDef=xo;});var Qi=b(ci=>{Object.defineProperty(ci,"__esModule",{value:!0});ci.parseNativeEnumDef=void 0;function wo(i){let e=i.values,n=Object.keys(i.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),r=Array.from(new Set(n.map(s=>typeof s)));return {type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}ci.parseNativeEnumDef=wo;});var Hi=b(li=>{Object.defineProperty(li,"__esModule",{value:!0});li.parseNeverDef=void 0;function ko(){return {not:{}}}li.parseNeverDef=ko;});var en=b(di=>{Object.defineProperty(di,"__esModule",{value:!0});di.parseNullDef=void 0;function Oo(i){return i.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}di.parseNullDef=Oo;});var ui=b(ue=>{Object.defineProperty(ue,"__esModule",{value:!0});ue.parseUnionDef=ue.primitiveMappings=void 0;var So=D();ue.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ao(i,e){if(e.target==="openApi3")return Hn(i,e);let t=i.options instanceof Map?Array.from(i.options.values()):i.options;if(t.every(n=>n._def.typeName in ue.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=t.reduce((r,s)=>{let o=ue.primitiveMappings[s._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return {type:n.length>1?n:n[0]}}else if(t.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=t.reduce((r,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return [...r,o];case"bigint":return [...r,"integer"];case"object":if(s._def.value===null)return [...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(n.length===t.length){let r=n.filter((s,o,a)=>a.indexOf(s)===o);return {type:r.length>1?r:r[0],enum:t.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(t.every(n=>n._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((n,r)=>[...n,...r._def.values.filter(s=>!n.includes(s))],[])};return Hn(i,e)}ue.parseUnionDef=Ao;var Hn=(i,e)=>{let t=(i.options instanceof Map?Array.from(i.options.values()):i.options).map((n,r)=>(0, So.parseDef)(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return t.length?{anyOf:t}:void 0};});var tn=b(pi=>{Object.defineProperty(pi,"__esModule",{value:!0});pi.parseNullableDef=void 0;var er=D(),tr=ui();function Io(i,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(i.innerType._def.typeName)&&(!i.innerType._def.checks||!i.innerType._def.checks.length))return e.target==="openApi3"?{type:tr.primitiveMappings[i.innerType._def.typeName],nullable:!0}:{type:[tr.primitiveMappings[i.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0, er.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let t=(0, er.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}pi.parseNullableDef=Io;});var nn=b(hi=>{Object.defineProperty(hi,"__esModule",{value:!0});hi.parseNumberDef=void 0;var pe=oe();function Po(i,e){let t={type:"number"};if(!i.checks)return t;for(let n of i.checks)switch(n.kind){case"int":t.type="integer",(0, pe.addErrorMessage)(t,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0, pe.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e):(0, pe.setResponseValueAndErrors)(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),(0, pe.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0, pe.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e):(0, pe.setResponseValueAndErrors)(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),(0, pe.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e));break;case"multipleOf":(0, pe.setResponseValueAndErrors)(t,"multipleOf",n.value,n.message,e);break}return t}hi.parseNumberDef=Po;});var sn=b(Be=>{Object.defineProperty(Be,"__esModule",{value:!0});Be.parseObjectDef=Be.parseObjectDefX=void 0;var rt=D();function rn(i,e){return e.removeAdditionalStrategy==="strict"?i.catchall._def.typeName==="ZodNever"?i.unknownKeys!=="strict":(0, rt.parseDef)(i.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:i.catchall._def.typeName==="ZodNever"?i.unknownKeys==="passthrough":(0, rt.parseDef)(i.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Ro(i,e){Object.keys(i.shape()).reduce((n,r)=>{let s=i.shape()[r],o=s.isOptional();o||(s={...s._def.innerSchema});let a=(0, rt.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return a!==void 0&&(n.properties[r]=a,o||(n.required||(n.required=[]),n.required.push(r))),n},{type:"object",properties:{},additionalProperties:rn(i,e)});let t={type:"object",...Object.entries(i.shape()).reduce((n,[r,s])=>{if(s===void 0||s._def===void 0)return n;let o=(0, rt.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return o===void 0?n:{properties:{...n.properties,[r]:o},required:s.isOptional()?n.required:[...n.required,r]}},{properties:{},required:[]}),additionalProperties:rn(i,e)};return t.required.length||delete t.required,t}Be.parseObjectDefX=Ro;function Eo(i,e){let t={type:"object",...Object.entries(i.shape()).reduce((n,[r,s])=>{if(s===void 0||s._def===void 0)return n;let o=(0, rt.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return o===void 0?n:{properties:{...n.properties,[r]:o},required:s.isOptional()?n.required:[...n.required,r]}},{properties:{},required:[]}),additionalProperties:rn(i,e)};return t.required.length||delete t.required,t}Be.parseObjectDef=Eo;});var on=b(fi=>{Object.defineProperty(fi,"__esModule",{value:!0});fi.parseOptionalDef=void 0;var ir=D(),Do=(i,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, ir.parseDef)(i.innerType._def,e);let t=(0, ir.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};fi.parseOptionalDef=Do;});var an=b(yi=>{Object.defineProperty(yi,"__esModule",{value:!0});yi.parsePipelineDef=void 0;var mi=D(),Co=(i,e)=>{if(e.pipeStrategy==="input")return (0, mi.parseDef)(i.in._def,e);if(e.pipeStrategy==="output")return (0, mi.parseDef)(i.out._def,e);let t=(0, mi.parseDef)(i.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0, mi.parseDef)(i.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,n].filter(r=>r!==void 0)}};yi.parsePipelineDef=Co;});var cn=b(_i=>{Object.defineProperty(_i,"__esModule",{value:!0});_i.parsePromiseDef=void 0;var jo=D();function No(i,e){return (0, jo.parseDef)(i.type._def,e)}_i.parsePromiseDef=No;});var ln=b(gi=>{Object.defineProperty(gi,"__esModule",{value:!0});gi.parseSetDef=void 0;var nr=oe(),Mo=D();function Zo(i,e){let n={type:"array",uniqueItems:!0,items:(0, Mo.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return i.minSize&&(0, nr.setResponseValueAndErrors)(n,"minItems",i.minSize.value,i.minSize.message,e),i.maxSize&&(0, nr.setResponseValueAndErrors)(n,"maxItems",i.maxSize.value,i.maxSize.message,e),n}gi.parseSetDef=Zo;});var un=b(bi=>{Object.defineProperty(bi,"__esModule",{value:!0});bi.parseTupleDef=void 0;var dn=D();function $o(i,e){return i.rest?{type:"array",minItems:i.items.length,items:i.items.map((t,n)=>(0, dn.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[]),additionalItems:(0, dn.parseDef)(i.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:i.items.length,maxItems:i.items.length,items:i.items.map((t,n)=>(0, dn.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[])}}bi.parseTupleDef=$o;});var pn=b(vi=>{Object.defineProperty(vi,"__esModule",{value:!0});vi.parseUndefinedDef=void 0;function Uo(){return {not:{}}}vi.parseUndefinedDef=Uo;});var hn=b(Ti=>{Object.defineProperty(Ti,"__esModule",{value:!0});Ti.parseUnknownDef=void 0;function qo(){return {}}Ti.parseUnknownDef=qo;});var fn=b(xi=>{Object.defineProperty(xi,"__esModule",{value:!0});xi.parseReadonlyDef=void 0;var Vo=D(),Lo=(i,e)=>(0, Vo.parseDef)(i.innerType._def,e);xi.parseReadonlyDef=Lo;});var D=b(wi=>{Object.defineProperty(wi,"__esModule",{value:!0});wi.parseDef=void 0;var w=Ft(),Yo=$i(),Fo=Ui(),Wo=qi(),Bo=Vi(),Ko=Li(),zo=Yi(),Go=Fi(),Jo=Wi(),Xo=Bi(),Qo=Ki(),Ho=zi(),ea=Gi(),ta=Xi(),ia=Qi(),na=Hi(),ra=en(),sa=tn(),oa=nn(),aa=sn(),ca=on(),la=an(),da=cn(),ua=oi(),pa=ln(),ha=ri(),fa=un(),ma=pn(),ya=ui(),_a=hn(),ga=fn(),ba=Nt();function rr(i,e,t=!1){let n=e.seen.get(i);if(e.override){let o=e.override?.(i,e,n,t);if(o!==ba.ignoreOverride)return o}if(n&&!t){let o=va(n,e);if(o!==void 0)return o}let r={def:i,path:e.currentPath,jsonSchema:void 0};e.seen.set(i,r);let s=xa(i,i.typeName,e);return s&&wa(i,e,s),r.jsonSchema=s,s}wi.parseDef=rr;var va=(i,e)=>{switch(e.$refStrategy){case"root":return {$ref:i.path.join("/")};case"relative":return {$ref:Ta(e.currentPath,i.path)};case"none":case"seen":return i.path.length<e.currentPath.length&&i.path.every((t,n)=>e.currentPath[n]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},Ta=(i,e)=>{let t=0;for(;t<i.length&&t<e.length&&i[t]===e[t];t++);return [(i.length-t).toString(),...e.slice(t)].join("/")},xa=(i,e,t)=>{switch(e){case w.ZodFirstPartyTypeKind.ZodString:return (0, ha.parseStringDef)(i,t);case w.ZodFirstPartyTypeKind.ZodNumber:return (0, oa.parseNumberDef)(i,t);case w.ZodFirstPartyTypeKind.ZodObject:return (0, aa.parseObjectDef)(i,t);case w.ZodFirstPartyTypeKind.ZodBigInt:return (0, Wo.parseBigintDef)(i,t);case w.ZodFirstPartyTypeKind.ZodBoolean:return (0, Bo.parseBooleanDef)();case w.ZodFirstPartyTypeKind.ZodDate:return (0, Go.parseDateDef)(i,t);case w.ZodFirstPartyTypeKind.ZodUndefined:return (0, ma.parseUndefinedDef)();case w.ZodFirstPartyTypeKind.ZodNull:return (0, ra.parseNullDef)(t);case w.ZodFirstPartyTypeKind.ZodArray:return (0, Fo.parseArrayDef)(i,t);case w.ZodFirstPartyTypeKind.ZodUnion:case w.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, ya.parseUnionDef)(i,t);case w.ZodFirstPartyTypeKind.ZodIntersection:return (0, Ho.parseIntersectionDef)(i,t);case w.ZodFirstPartyTypeKind.ZodTuple:return (0, fa.parseTupleDef)(i,t);case w.ZodFirstPartyTypeKind.ZodRecord:return (0, ua.parseRecordDef)(i,t);case w.ZodFirstPartyTypeKind.ZodLiteral:return (0, ea.parseLiteralDef)(i,t);case w.ZodFirstPartyTypeKind.ZodEnum:return (0, Qo.parseEnumDef)(i);case w.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, ia.parseNativeEnumDef)(i);case w.ZodFirstPartyTypeKind.ZodNullable:return (0, sa.parseNullableDef)(i,t);case w.ZodFirstPartyTypeKind.ZodOptional:return (0, ca.parseOptionalDef)(i,t);case w.ZodFirstPartyTypeKind.ZodMap:return (0, ta.parseMapDef)(i,t);case w.ZodFirstPartyTypeKind.ZodSet:return (0, pa.parseSetDef)(i,t);case w.ZodFirstPartyTypeKind.ZodLazy:return rr(i.getter()._def,t);case w.ZodFirstPartyTypeKind.ZodPromise:return (0, da.parsePromiseDef)(i,t);case w.ZodFirstPartyTypeKind.ZodNaN:case w.ZodFirstPartyTypeKind.ZodNever:return (0, na.parseNeverDef)();case w.ZodFirstPartyTypeKind.ZodEffects:return (0, Xo.parseEffectsDef)(i,t);case w.ZodFirstPartyTypeKind.ZodAny:return (0, Yo.parseAnyDef)();case w.ZodFirstPartyTypeKind.ZodUnknown:return (0, _a.parseUnknownDef)();case w.ZodFirstPartyTypeKind.ZodDefault:return (0, Jo.parseDefaultDef)(i,t);case w.ZodFirstPartyTypeKind.ZodBranded:return (0, Ko.parseBrandedDef)(i,t);case w.ZodFirstPartyTypeKind.ZodReadonly:return (0, ga.parseReadonlyDef)(i,t);case w.ZodFirstPartyTypeKind.ZodCatch:return (0, zo.parseCatchDef)(i,t);case w.ZodFirstPartyTypeKind.ZodPipeline:return (0, la.parsePipelineDef)(i,t);case w.ZodFirstPartyTypeKind.ZodFunction:case w.ZodFirstPartyTypeKind.ZodVoid:case w.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (n=>{})()}},wa=(i,e,t)=>(i.description&&(t.description=i.description,e.markdownDescription&&(t.markdownDescription=i.description)),t);});var mn=b(ki=>{Object.defineProperty(ki,"__esModule",{value:!0});ki.zodToJsonSchema=void 0;var sr=D(),ka=Ri(),Oa=(i,e)=>{let t=(0, ka.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[p,y])=>({...d,[p]:(0, sr.parseDef)(y._def,{...t,currentPath:[...t.basePath,t.definitionPath,p]},!0)??{}}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(0, sr.parseDef)(i._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??{},o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o);let a=r===void 0?n?{...s,[t.definitionPath]:n}:s:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...n,[r]:s}};return t.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":t.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a};ki.zodToJsonSchema=Oa;});var or=b(x=>{var Sa=x&&x.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,r);}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),k=x&&x.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Sa(e,i,t);};Object.defineProperty(x,"__esModule",{value:!0});k(Nt(),x);k(Ri(),x);k(oe(),x);k(D(),x);k($i(),x);k(Ui(),x);k(qi(),x);k(Vi(),x);k(Li(),x);k(Yi(),x);k(Fi(),x);k(Wi(),x);k(Bi(),x);k(Ki(),x);k(zi(),x);k(Gi(),x);k(Xi(),x);k(Qi(),x);k(Hi(),x);k(en(),x);k(tn(),x);k(nn(),x);k(sn(),x);k(on(),x);k(an(),x);k(cn(),x);k(fn(),x);k(oi(),x);k(ln(),x);k(ri(),x);k(un(),x);k(pn(),x);k(ui(),x);k(hn(),x);k(mn(),x);var Aa=mn();x.default=Aa.zodToJsonSchema;});var at=(n=>(n.TRIGGER="trigger",n.EXECUTE="execute",n.PREVIEW="preview",n))(at||{}),ct=(n=>(n.DISCOVER="discover",n.HEALTH_CHECK="health-check",n.CODE="code",n))(ct||{});var Sr=(t=>(t.SYNC="/v1/bridge/sync",t.DIFF="/v1/bridge/diff",t))(Sr||{}),vn=5,Tn=1500;var F=(P=>(P.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",P.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",P.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",P.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",P.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",P.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",P.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",P.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",P.STEP_NOT_FOUND_ERROR="StepNotFoundError",P.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",P.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",P.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",P.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",P.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",P.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",P.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",P.INVALID_ACTION_ERROR="InvalidActionError",P.MISSING_API_KEY_ERROR="MissingApiKeyError",P.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",P.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",P.SIGNATURE_INVALID_ERROR="SignatureInvalidError",P.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",P.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",P.PLATFORM_ERROR="PlatformError",P.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",P))(F||{});var Ii=(R=>(R.NOVU_SIGNATURE="novu-signature",R.NOVU_ANONYMOUS="novu-anonymous",R.NOVU_SIGNATURE_DEPRECATED="x-novu-signature",R.NOVU_ANONYMOUS_DEPRECATED="x-novu-anonymous",R.NOVU_FRAMEWORK_SDK="novu-framework-sdk",R.NOVU_FRAMEWORK_API="novu-framework-api",R.NOVU_FRAMEWORK_VERSION="novu-framework-version",R.USER_AGENT="user-agent",R.CONTENT_TYPE="content-type",R.ACCESS_CONTROL_ALLOW_ORIGIN="access-control-allow-origin",R.ACCESS_CONTROL_ALLOW_METHODS="access-control-allow-methods",R.ACCESS_CONTROL_ALLOW_HEADERS="access-control-allow-headers",R.ACCESS_CONTROL_MAX_AGE="access-control-max-age",R))(Ii||{});var lt=(n=>(n.POST="POST",n.GET="GET",n.OPTIONS="OPTIONS",n))(lt||{});var xn=(r=>(r.WORKFLOW_ID="workflowId",r.STEP_ID="stepId",r.ACTION="action",r.SOURCE="source",r))(xn||{});var dt=(u=>(u[u.CONTINUE=100]="CONTINUE",u[u.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",u[u.PROCESSING=102]="PROCESSING",u[u.EARLYHINTS=103]="EARLYHINTS",u[u.OK=200]="OK",u[u.CREATED=201]="CREATED",u[u.ACCEPTED=202]="ACCEPTED",u[u.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",u[u.NO_CONTENT=204]="NO_CONTENT",u[u.RESET_CONTENT=205]="RESET_CONTENT",u[u.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",u[u.AMBIGUOUS=300]="AMBIGUOUS",u[u.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",u[u.FOUND=302]="FOUND",u[u.SEE_OTHER=303]="SEE_OTHER",u[u.NOT_MODIFIED=304]="NOT_MODIFIED",u[u.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",u[u.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",u[u.BAD_REQUEST=400]="BAD_REQUEST",u[u.UNAUTHORIZED=401]="UNAUTHORIZED",u[u.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",u[u.FORBIDDEN=403]="FORBIDDEN",u[u.NOT_FOUND=404]="NOT_FOUND",u[u.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",u[u.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",u[u.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",u[u.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",u[u.CONFLICT=409]="CONFLICT",u[u.GONE=410]="GONE",u[u.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",u[u.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",u[u.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",u[u.URI_TOO_LONG=414]="URI_TOO_LONG",u[u.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",u[u.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",u[u.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",u[u.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",u[u.MISDIRECTED=421]="MISDIRECTED",u[u.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",u[u.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",u[u.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",u[u.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",u[u.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",u[u.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",u[u.BAD_GATEWAY=502]="BAD_GATEWAY",u[u.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",u[u.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",u[u.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",u))(dt||{}),pc=[500];var ut=(n=>(n.WORKFLOW="workflow",n.PROVIDER="provider",n.STEP="step",n))(ut||{});var pt=(s=>(s.EMAIL="email",s.SMS="sms",s.PUSH="push",s.CHAT="chat",s.IN_APP="in_app",s))(pt||{}),Ar=(n=>(n.DIGEST="digest",n.DELAY="delay",n.CUSTOM="custom",n))(Ar||{});var H=class extends Error{data},ht=class extends H{statusCode=404},q=class extends H{statusCode=400},re=class extends H{statusCode=401},je=class extends H{statusCode=500},ft=class extends H{statusCode=409};var mt=class extends q{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};}},ze=class extends q{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},yt=class extends q{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},_t=class extends q{code="ExecutionStateControlInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=n;}},gt=class extends q{code="ExecutionStateOutputInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=n;}},bt=class extends q{code="ExecutionStateResultInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=n;}},vt=class extends q{code="ExecutionProviderOutputInvalidError";constructor(e,t,n,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${n}\` has invalid output. Please provide the correct provider output.`),this.data=r;}};var A={info:i=>Ne__default.default.blue(i),warning:i=>Ne__default.default.yellow(i),error:i=>Ne__default.default.red(i),success:i=>Ne__default.default.green(i),underline:i=>Ne__default.default.underline(i),bold:i=>Ne__default.default.bold(i)},E={SUCCESS:A.success("\u2714"),ERROR:A.error("\u2717"),WARNING:A.warning("\u26A0"),INFO:A.info("\u2139"),ARROW:A.bold("\u2192"),MOCK:A.info("\u25CB"),HYDRATED:A.bold(A.info("\u2192")),STEP:A.info("\u03C3"),ACTION:A.info("\u03B1"),DURATION:A.info("\u0394"),PROVIDER:A.info("\u2699"),OUTPUT:A.info("\u21E2"),INPUT:A.info("\u21E0"),WORKFLOW:A.info("\u03C9"),STATE:A.info("\u03C3"),EXECUTE:A.info("\u03B5"),PREVIEW:A.info("\u03C1")};var Pi=i=>Object.values(i).map(e=>`\`${e}\``).join(", "),Tt=i=>i.replaceAll(/(\w)(\w*)/g,(e,t,n)=>t.toUpperCase()+n.toLowerCase()).replaceAll(/[\s-]+/g,"");var wn=(i,e="https://api.novu.co/v1")=>({post:async(t,n)=>await fetch(e+t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${i}`},body:JSON.stringify(n)})});var xt=class extends H{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${Pi(lt)}`},Ge=class extends q{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${Pi(t)}`);}};var wt=class extends je{code="PlatformError";message="Something went wrong. Please try again later."};var Me=class extends ft{constructor(e,t){super(`${Tt(e)} with id: \`${t}\` already exists. Please use a different id.`);}},se=class extends ht{constructor(e,t){super(`${Tt(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Ze=class extends je{constructor(e,t){super(`Failed to execute ${Tt(e)} with id: \`${t}\`. Please try again later.`);}};var kt=class extends se{code="ProviderNotFoundError";constructor(e){super("provider",e);}},Ot=class extends Ze{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var St=class extends re{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.");}},At=class extends re{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},It=class extends re{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},Pt=class extends re{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 re{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.apiKey`");}};var Et=class extends se{code="StepNotFoundError";constructor(e){super("step",e);}},Dt=class extends Me{code="StepAlreadyExistsError";constructor(e){super("step",e);}};var Je=class extends se{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},Ct=class extends Me{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var jt=class{ajv;compiledSchemas;constructor(){this.ajv=new Ir__default.default({useDefaults:!0,removeAdditional:"all"}),Pr__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 n=this.compiledSchemas.get(t);return n||(n=this.ajv.compile(t),this.compiledSchemas.set(t,n)),n(e)?{success:!0,data:e}:{success:!1,errors:n.errors.map(s=>({path:s.instancePath,message:s.message}))}}transformToJsonSchema(e){return e}};var Oi=class{isSchema(e){return e.safeParseAsync!==void 0}async validate(e,t){let n=t.safeParse(e);return n.success?{success:!0,data:n.data}:{success:!1,errors:n.error.errors.map(r=>({path:`/${r.path.join("/")}`,message:r.message}))}}transformToJsonSchema(e){try{return or().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 ar=[new Oi,new jt],cr=async(i,e)=>{for(let t of ar)if(t.isSchema(i))return t.validate(e,i);throw new Error("Invalid schema")},C=i=>{for(let e of ar)if(e.isSchema(i))return e.transformToJsonSchema(i);throw new Error("Invalid schema")};var lr={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 st=lr.version,Si="2024-06-26";jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});var ot=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;apiKey;version=st;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(n=>n.workflowId===t.workflowId))throw new Ct(t.workflowId);this.discoveredWorkflows.push(t);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((n,r)=>n+r.steps.length,0);return {status:"ok",sdkVersion:st,frameworkVersion:Si,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(n=>n.workflowId===e);if(t)return t;throw new Je(e)}getStep(e,t){let r=this.getWorkflow(e).steps.find(s=>s.stepId===t);if(r)return r;throw new Et(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(C(e))}async validate(e,t,n,r,s,o,a){let d=await cr(t,e);if(d.success)return d.data;switch(n){case"event":this.throwInvalidEvent(r,s,d.errors);case"step":this.throwInvalidStep(o,r,s,d.errors);case"provider":this.throwInvalidProvider(o,a,r,s,d.errors);default:throw new Error(`Invalid component: '${n}'`)}}throwInvalidProvider(e,t,n,r,s){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(n){case"output":throw new vt(r,e,t,s);default:throw new Error(`Invalid payload type: '${n}'`)}}throwInvalidStep(e,t,n,r){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new gt(n,e,r);case"result":throw new bt(n,e,r);case"controls":throw new _t(n,e,r);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,n){switch(e){case"controls":throw new yt(t,n);case"payload":throw new ze(t,n);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(n,r,s)=>{let o=this.getStep(e.workflowId,n),a=Ra(e),d=await this.createStepControls(o,a),p=e.action==="preview";if(!p&&await this.shouldSkip(s?.skip,d))return t({options:{skip:!0}}),{};let y=this.previewStep.bind(this),I=this.executeStep.bind(this),R=await(p?y:I)(e,{...o,providers:o.providers.map(Ce=>{let Ke=s?.providers?.[Ce.type];if(!Ke)throw new kt(Ce.type);return {...Ce,resolve:Ke}}),resolve:r});return n===e.stepId&&t(R),R.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let r=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
|
|
23
|
-
${A.bold(A.underline(r))} '${e.workflowId}'`);let s=this.getWorkflow(e.workflowId),o=process.hrtime(),a={outputs:{},providers:{},options:{}},d,p=new Promise(he=>{d=he;}),y=he=>{d(),a=he;},I;try{if(e.action==="execute"&&!e.payload&&!e.data)throw new ze(e.workflowId,{message:"Event `payload` is required"});let he=await this.createExecutionPayload(e,s);await Promise.race([p,s.execute({payload:he,environment:{},inputs:{},controls:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(e,y),sms:this.executeStepFactory(e,y),inApp:this.executeStepFactory(e,y),digest:this.executeStepFactory(e,y),delay:this.executeStepFactory(e,y),push:this.executeStepFactory(e,y),chat:this.executeStepFactory(e,y),custom:this.executeStepFactory(e,y)}})]);}catch(he){I=he;}let ne=process.hrtime(o),R=ne[0],Ce=ne[1],Ke=R*1e3+Ce/1e6,
|
|
22
|
+
]`;continue}r+=n[d],n[d]==="\\"?s=!0:o&&n[d]==="]"?o=!1:!o&&n[d]==="["&&(o=!0);}try{let d=new RegExp(r);}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`),i.source}return r};});var oi=b(si=>{Object.defineProperty(si,"__esModule",{value:!0});si.parseRecordDef=void 0;var Ji=Ft(),Xn=D(),vo=ri();function To(i,e){if(e.target==="openApi3"&&i.keyType?._def.typeName===Ji.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:i.keyType._def.values,properties:i.keyType._def.values.reduce((n,r)=>({...n,[r]:(0, Xn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, Xn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(i.keyType?._def.typeName===Ji.ZodFirstPartyTypeKind.ZodString&&i.keyType._def.checks?.length){let n=Object.entries((0, vo.parseStringDef)(i.keyType._def,e)).reduce((r,[s,o])=>s==="type"?r:{...r,[s]:o},{});return {...t,propertyNames:n}}else if(i.keyType?._def.typeName===Ji.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:i.keyType._def.values}};return t}si.parseRecordDef=To;});var Xi=b(ai=>{Object.defineProperty(ai,"__esModule",{value:!0});ai.parseMapDef=void 0;var Qn=D(),xo=oi();function wo(i,e){if(e.mapStrategy==="record")return (0, xo.parseRecordDef)(i,e);let t=(0, Qn.parseDef)(i.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0, Qn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return {type:"array",maxItems:125,items:{type:"array",items:[t,n],minItems:2,maxItems:2}}}ai.parseMapDef=wo;});var Qi=b(ci=>{Object.defineProperty(ci,"__esModule",{value:!0});ci.parseNativeEnumDef=void 0;function ko(i){let e=i.values,n=Object.keys(i.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),r=Array.from(new Set(n.map(s=>typeof s)));return {type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}ci.parseNativeEnumDef=ko;});var Hi=b(li=>{Object.defineProperty(li,"__esModule",{value:!0});li.parseNeverDef=void 0;function Oo(){return {not:{}}}li.parseNeverDef=Oo;});var en=b(di=>{Object.defineProperty(di,"__esModule",{value:!0});di.parseNullDef=void 0;function So(i){return i.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}di.parseNullDef=So;});var ui=b(ue=>{Object.defineProperty(ue,"__esModule",{value:!0});ue.parseUnionDef=ue.primitiveMappings=void 0;var Ao=D();ue.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Io(i,e){if(e.target==="openApi3")return Hn(i,e);let t=i.options instanceof Map?Array.from(i.options.values()):i.options;if(t.every(n=>n._def.typeName in ue.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=t.reduce((r,s)=>{let o=ue.primitiveMappings[s._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return {type:n.length>1?n:n[0]}}else if(t.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=t.reduce((r,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return [...r,o];case"bigint":return [...r,"integer"];case"object":if(s._def.value===null)return [...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(n.length===t.length){let r=n.filter((s,o,a)=>a.indexOf(s)===o);return {type:r.length>1?r:r[0],enum:t.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(t.every(n=>n._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((n,r)=>[...n,...r._def.values.filter(s=>!n.includes(s))],[])};return Hn(i,e)}ue.parseUnionDef=Io;var Hn=(i,e)=>{let t=(i.options instanceof Map?Array.from(i.options.values()):i.options).map((n,r)=>(0, Ao.parseDef)(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return t.length?{anyOf:t}:void 0};});var tn=b(pi=>{Object.defineProperty(pi,"__esModule",{value:!0});pi.parseNullableDef=void 0;var er=D(),tr=ui();function Po(i,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(i.innerType._def.typeName)&&(!i.innerType._def.checks||!i.innerType._def.checks.length))return e.target==="openApi3"?{type:tr.primitiveMappings[i.innerType._def.typeName],nullable:!0}:{type:[tr.primitiveMappings[i.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0, er.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let t=(0, er.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}pi.parseNullableDef=Po;});var nn=b(hi=>{Object.defineProperty(hi,"__esModule",{value:!0});hi.parseNumberDef=void 0;var pe=oe();function Ro(i,e){let t={type:"number"};if(!i.checks)return t;for(let n of i.checks)switch(n.kind){case"int":t.type="integer",(0, pe.addErrorMessage)(t,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0, pe.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e):(0, pe.setResponseValueAndErrors)(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),(0, pe.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0, pe.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e):(0, pe.setResponseValueAndErrors)(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),(0, pe.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e));break;case"multipleOf":(0, pe.setResponseValueAndErrors)(t,"multipleOf",n.value,n.message,e);break}return t}hi.parseNumberDef=Ro;});var sn=b(Be=>{Object.defineProperty(Be,"__esModule",{value:!0});Be.parseObjectDef=Be.parseObjectDefX=void 0;var rt=D();function rn(i,e){return e.removeAdditionalStrategy==="strict"?i.catchall._def.typeName==="ZodNever"?i.unknownKeys!=="strict":(0, rt.parseDef)(i.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:i.catchall._def.typeName==="ZodNever"?i.unknownKeys==="passthrough":(0, rt.parseDef)(i.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Eo(i,e){Object.keys(i.shape()).reduce((n,r)=>{let s=i.shape()[r],o=s.isOptional();o||(s={...s._def.innerSchema});let a=(0, rt.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return a!==void 0&&(n.properties[r]=a,o||(n.required||(n.required=[]),n.required.push(r))),n},{type:"object",properties:{},additionalProperties:rn(i,e)});let t={type:"object",...Object.entries(i.shape()).reduce((n,[r,s])=>{if(s===void 0||s._def===void 0)return n;let o=(0, rt.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return o===void 0?n:{properties:{...n.properties,[r]:o},required:s.isOptional()?n.required:[...n.required,r]}},{properties:{},required:[]}),additionalProperties:rn(i,e)};return t.required.length||delete t.required,t}Be.parseObjectDefX=Eo;function Do(i,e){let t={type:"object",...Object.entries(i.shape()).reduce((n,[r,s])=>{if(s===void 0||s._def===void 0)return n;let o=(0, rt.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return o===void 0?n:{properties:{...n.properties,[r]:o},required:s.isOptional()?n.required:[...n.required,r]}},{properties:{},required:[]}),additionalProperties:rn(i,e)};return t.required.length||delete t.required,t}Be.parseObjectDef=Do;});var on=b(fi=>{Object.defineProperty(fi,"__esModule",{value:!0});fi.parseOptionalDef=void 0;var ir=D(),Co=(i,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, ir.parseDef)(i.innerType._def,e);let t=(0, ir.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};fi.parseOptionalDef=Co;});var an=b(yi=>{Object.defineProperty(yi,"__esModule",{value:!0});yi.parsePipelineDef=void 0;var mi=D(),jo=(i,e)=>{if(e.pipeStrategy==="input")return (0, mi.parseDef)(i.in._def,e);if(e.pipeStrategy==="output")return (0, mi.parseDef)(i.out._def,e);let t=(0, mi.parseDef)(i.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0, mi.parseDef)(i.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,n].filter(r=>r!==void 0)}};yi.parsePipelineDef=jo;});var cn=b(_i=>{Object.defineProperty(_i,"__esModule",{value:!0});_i.parsePromiseDef=void 0;var No=D();function Mo(i,e){return (0, No.parseDef)(i.type._def,e)}_i.parsePromiseDef=Mo;});var ln=b(gi=>{Object.defineProperty(gi,"__esModule",{value:!0});gi.parseSetDef=void 0;var nr=oe(),Zo=D();function $o(i,e){let n={type:"array",uniqueItems:!0,items:(0, Zo.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return i.minSize&&(0, nr.setResponseValueAndErrors)(n,"minItems",i.minSize.value,i.minSize.message,e),i.maxSize&&(0, nr.setResponseValueAndErrors)(n,"maxItems",i.maxSize.value,i.maxSize.message,e),n}gi.parseSetDef=$o;});var un=b(bi=>{Object.defineProperty(bi,"__esModule",{value:!0});bi.parseTupleDef=void 0;var dn=D();function Uo(i,e){return i.rest?{type:"array",minItems:i.items.length,items:i.items.map((t,n)=>(0, dn.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[]),additionalItems:(0, dn.parseDef)(i.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:i.items.length,maxItems:i.items.length,items:i.items.map((t,n)=>(0, dn.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[])}}bi.parseTupleDef=Uo;});var pn=b(vi=>{Object.defineProperty(vi,"__esModule",{value:!0});vi.parseUndefinedDef=void 0;function qo(){return {not:{}}}vi.parseUndefinedDef=qo;});var hn=b(Ti=>{Object.defineProperty(Ti,"__esModule",{value:!0});Ti.parseUnknownDef=void 0;function Vo(){return {}}Ti.parseUnknownDef=Vo;});var fn=b(xi=>{Object.defineProperty(xi,"__esModule",{value:!0});xi.parseReadonlyDef=void 0;var Lo=D(),Yo=(i,e)=>(0, Lo.parseDef)(i.innerType._def,e);xi.parseReadonlyDef=Yo;});var D=b(wi=>{Object.defineProperty(wi,"__esModule",{value:!0});wi.parseDef=void 0;var w=Ft(),Fo=$i(),Wo=Ui(),Bo=qi(),Ko=Vi(),zo=Li(),Go=Yi(),Jo=Fi(),Xo=Wi(),Qo=Bi(),Ho=Ki(),ea=zi(),ta=Gi(),ia=Xi(),na=Qi(),ra=Hi(),sa=en(),oa=tn(),aa=nn(),ca=sn(),la=on(),da=an(),ua=cn(),pa=oi(),ha=ln(),fa=ri(),ma=un(),ya=pn(),_a=ui(),ga=hn(),ba=fn(),va=Nt();function rr(i,e,t=!1){let n=e.seen.get(i);if(e.override){let o=e.override?.(i,e,n,t);if(o!==va.ignoreOverride)return o}if(n&&!t){let o=Ta(n,e);if(o!==void 0)return o}let r={def:i,path:e.currentPath,jsonSchema:void 0};e.seen.set(i,r);let s=wa(i,i.typeName,e);return s&&ka(i,e,s),r.jsonSchema=s,s}wi.parseDef=rr;var Ta=(i,e)=>{switch(e.$refStrategy){case"root":return {$ref:i.path.join("/")};case"relative":return {$ref:xa(e.currentPath,i.path)};case"none":case"seen":return i.path.length<e.currentPath.length&&i.path.every((t,n)=>e.currentPath[n]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},xa=(i,e)=>{let t=0;for(;t<i.length&&t<e.length&&i[t]===e[t];t++);return [(i.length-t).toString(),...e.slice(t)].join("/")},wa=(i,e,t)=>{switch(e){case w.ZodFirstPartyTypeKind.ZodString:return (0, fa.parseStringDef)(i,t);case w.ZodFirstPartyTypeKind.ZodNumber:return (0, aa.parseNumberDef)(i,t);case w.ZodFirstPartyTypeKind.ZodObject:return (0, ca.parseObjectDef)(i,t);case w.ZodFirstPartyTypeKind.ZodBigInt:return (0, Bo.parseBigintDef)(i,t);case w.ZodFirstPartyTypeKind.ZodBoolean:return (0, Ko.parseBooleanDef)();case w.ZodFirstPartyTypeKind.ZodDate:return (0, Jo.parseDateDef)(i,t);case w.ZodFirstPartyTypeKind.ZodUndefined:return (0, ya.parseUndefinedDef)();case w.ZodFirstPartyTypeKind.ZodNull:return (0, sa.parseNullDef)(t);case w.ZodFirstPartyTypeKind.ZodArray:return (0, Wo.parseArrayDef)(i,t);case w.ZodFirstPartyTypeKind.ZodUnion:case w.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, _a.parseUnionDef)(i,t);case w.ZodFirstPartyTypeKind.ZodIntersection:return (0, ea.parseIntersectionDef)(i,t);case w.ZodFirstPartyTypeKind.ZodTuple:return (0, ma.parseTupleDef)(i,t);case w.ZodFirstPartyTypeKind.ZodRecord:return (0, pa.parseRecordDef)(i,t);case w.ZodFirstPartyTypeKind.ZodLiteral:return (0, ta.parseLiteralDef)(i,t);case w.ZodFirstPartyTypeKind.ZodEnum:return (0, Ho.parseEnumDef)(i);case w.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, na.parseNativeEnumDef)(i);case w.ZodFirstPartyTypeKind.ZodNullable:return (0, oa.parseNullableDef)(i,t);case w.ZodFirstPartyTypeKind.ZodOptional:return (0, la.parseOptionalDef)(i,t);case w.ZodFirstPartyTypeKind.ZodMap:return (0, ia.parseMapDef)(i,t);case w.ZodFirstPartyTypeKind.ZodSet:return (0, ha.parseSetDef)(i,t);case w.ZodFirstPartyTypeKind.ZodLazy:return rr(i.getter()._def,t);case w.ZodFirstPartyTypeKind.ZodPromise:return (0, ua.parsePromiseDef)(i,t);case w.ZodFirstPartyTypeKind.ZodNaN:case w.ZodFirstPartyTypeKind.ZodNever:return (0, ra.parseNeverDef)();case w.ZodFirstPartyTypeKind.ZodEffects:return (0, Qo.parseEffectsDef)(i,t);case w.ZodFirstPartyTypeKind.ZodAny:return (0, Fo.parseAnyDef)();case w.ZodFirstPartyTypeKind.ZodUnknown:return (0, ga.parseUnknownDef)();case w.ZodFirstPartyTypeKind.ZodDefault:return (0, Xo.parseDefaultDef)(i,t);case w.ZodFirstPartyTypeKind.ZodBranded:return (0, zo.parseBrandedDef)(i,t);case w.ZodFirstPartyTypeKind.ZodReadonly:return (0, ba.parseReadonlyDef)(i,t);case w.ZodFirstPartyTypeKind.ZodCatch:return (0, Go.parseCatchDef)(i,t);case w.ZodFirstPartyTypeKind.ZodPipeline:return (0, da.parsePipelineDef)(i,t);case w.ZodFirstPartyTypeKind.ZodFunction:case w.ZodFirstPartyTypeKind.ZodVoid:case w.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (n=>{})()}},ka=(i,e,t)=>(i.description&&(t.description=i.description,e.markdownDescription&&(t.markdownDescription=i.description)),t);});var mn=b(ki=>{Object.defineProperty(ki,"__esModule",{value:!0});ki.zodToJsonSchema=void 0;var sr=D(),Oa=Ri(),Sa=(i,e)=>{let t=(0, Oa.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[p,y])=>({...d,[p]:(0, sr.parseDef)(y._def,{...t,currentPath:[...t.basePath,t.definitionPath,p]},!0)??{}}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(0, sr.parseDef)(i._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??{},o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o);let a=r===void 0?n?{...s,[t.definitionPath]:n}:s:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...n,[r]:s}};return t.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":t.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a};ki.zodToJsonSchema=Sa;});var or=b(x=>{var Aa=x&&x.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,r);}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),k=x&&x.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Aa(e,i,t);};Object.defineProperty(x,"__esModule",{value:!0});k(Nt(),x);k(Ri(),x);k(oe(),x);k(D(),x);k($i(),x);k(Ui(),x);k(qi(),x);k(Vi(),x);k(Li(),x);k(Yi(),x);k(Fi(),x);k(Wi(),x);k(Bi(),x);k(Ki(),x);k(zi(),x);k(Gi(),x);k(Xi(),x);k(Qi(),x);k(Hi(),x);k(en(),x);k(tn(),x);k(nn(),x);k(sn(),x);k(on(),x);k(an(),x);k(cn(),x);k(fn(),x);k(oi(),x);k(ln(),x);k(ri(),x);k(un(),x);k(pn(),x);k(ui(),x);k(hn(),x);k(mn(),x);var Ia=mn();x.default=Ia.zodToJsonSchema;});var at=(n=>(n.TRIGGER="trigger",n.EXECUTE="execute",n.PREVIEW="preview",n))(at||{}),ct=(n=>(n.DISCOVER="discover",n.HEALTH_CHECK="health-check",n.CODE="code",n))(ct||{});var Ar=(t=>(t.SYNC="/v1/bridge/sync",t.DIFF="/v1/bridge/diff",t))(Ar||{}),vn=5,Tn=1500;var F=(P=>(P.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",P.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",P.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",P.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",P.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",P.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",P.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",P.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",P.STEP_NOT_FOUND_ERROR="StepNotFoundError",P.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",P.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",P.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",P.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",P.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",P.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",P.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",P.INVALID_ACTION_ERROR="InvalidActionError",P.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",P.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",P.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",P.SIGNATURE_INVALID_ERROR="SignatureInvalidError",P.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",P.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",P.PLATFORM_ERROR="PlatformError",P.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",P))(F||{});var Ii=(R=>(R.NOVU_SIGNATURE="novu-signature",R.NOVU_ANONYMOUS="novu-anonymous",R.NOVU_SIGNATURE_DEPRECATED="x-novu-signature",R.NOVU_ANONYMOUS_DEPRECATED="x-novu-anonymous",R.NOVU_FRAMEWORK_SDK="novu-framework-sdk",R.NOVU_FRAMEWORK_API="novu-framework-api",R.NOVU_FRAMEWORK_VERSION="novu-framework-version",R.USER_AGENT="user-agent",R.CONTENT_TYPE="content-type",R.ACCESS_CONTROL_ALLOW_ORIGIN="access-control-allow-origin",R.ACCESS_CONTROL_ALLOW_METHODS="access-control-allow-methods",R.ACCESS_CONTROL_ALLOW_HEADERS="access-control-allow-headers",R.ACCESS_CONTROL_MAX_AGE="access-control-max-age",R))(Ii||{});var lt=(n=>(n.POST="POST",n.GET="GET",n.OPTIONS="OPTIONS",n))(lt||{});var xn=(r=>(r.WORKFLOW_ID="workflowId",r.STEP_ID="stepId",r.ACTION="action",r.SOURCE="source",r))(xn||{});var dt=(u=>(u[u.CONTINUE=100]="CONTINUE",u[u.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",u[u.PROCESSING=102]="PROCESSING",u[u.EARLYHINTS=103]="EARLYHINTS",u[u.OK=200]="OK",u[u.CREATED=201]="CREATED",u[u.ACCEPTED=202]="ACCEPTED",u[u.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",u[u.NO_CONTENT=204]="NO_CONTENT",u[u.RESET_CONTENT=205]="RESET_CONTENT",u[u.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",u[u.AMBIGUOUS=300]="AMBIGUOUS",u[u.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",u[u.FOUND=302]="FOUND",u[u.SEE_OTHER=303]="SEE_OTHER",u[u.NOT_MODIFIED=304]="NOT_MODIFIED",u[u.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",u[u.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",u[u.BAD_REQUEST=400]="BAD_REQUEST",u[u.UNAUTHORIZED=401]="UNAUTHORIZED",u[u.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",u[u.FORBIDDEN=403]="FORBIDDEN",u[u.NOT_FOUND=404]="NOT_FOUND",u[u.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",u[u.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",u[u.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",u[u.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",u[u.CONFLICT=409]="CONFLICT",u[u.GONE=410]="GONE",u[u.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",u[u.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",u[u.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",u[u.URI_TOO_LONG=414]="URI_TOO_LONG",u[u.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",u[u.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",u[u.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",u[u.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",u[u.MISDIRECTED=421]="MISDIRECTED",u[u.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",u[u.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",u[u.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",u[u.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",u[u.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",u[u.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",u[u.BAD_GATEWAY=502]="BAD_GATEWAY",u[u.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",u[u.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",u[u.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",u))(dt||{}),hc=[500];var ut=(n=>(n.WORKFLOW="workflow",n.PROVIDER="provider",n.STEP="step",n))(ut||{});var pt=(s=>(s.EMAIL="email",s.SMS="sms",s.PUSH="push",s.CHAT="chat",s.IN_APP="in_app",s))(pt||{}),Ir=(n=>(n.DIGEST="digest",n.DELAY="delay",n.CUSTOM="custom",n))(Ir||{});var H=class extends Error{data},ht=class extends H{statusCode=404},q=class extends H{statusCode=400},re=class extends H{statusCode=401},je=class extends H{statusCode=500},ft=class extends H{statusCode=409};var mt=class extends q{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};}},ze=class extends q{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},yt=class extends q{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},_t=class extends q{code="ExecutionStateControlInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=n;}},gt=class extends q{code="ExecutionStateOutputInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=n;}},bt=class extends q{code="ExecutionStateResultInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=n;}},vt=class extends q{code="ExecutionProviderOutputInvalidError";constructor(e,t,n,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${n}\` has invalid output. Please provide the correct provider output.`),this.data=r;}};var A={info:i=>Ne__default.default.blue(i),warning:i=>Ne__default.default.yellow(i),error:i=>Ne__default.default.red(i),success:i=>Ne__default.default.green(i),underline:i=>Ne__default.default.underline(i),bold:i=>Ne__default.default.bold(i)},E={SUCCESS:A.success("\u2714"),ERROR:A.error("\u2717"),WARNING:A.warning("\u26A0"),INFO:A.info("\u2139"),ARROW:A.bold("\u2192"),MOCK:A.info("\u25CB"),HYDRATED:A.bold(A.info("\u2192")),STEP:A.info("\u03C3"),ACTION:A.info("\u03B1"),DURATION:A.info("\u0394"),PROVIDER:A.info("\u2699"),OUTPUT:A.info("\u21E2"),INPUT:A.info("\u21E0"),WORKFLOW:A.info("\u03C9"),STATE:A.info("\u03C3"),EXECUTE:A.info("\u03B5"),PREVIEW:A.info("\u03C1")};var Pi=i=>Object.values(i).map(e=>`\`${e}\``).join(", "),Tt=i=>i.replaceAll(/(\w)(\w*)/g,(e,t,n)=>t.toUpperCase()+n.toLowerCase()).replaceAll(/[\s-]+/g,"");var wn=(i,e="https://api.novu.co")=>{let t=process.env.NOVU_API_URL||e;return {post:async(n,r)=>(await fetch(t+"/v1"+n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${i}`},body:JSON.stringify(r)})).json()}};var xt=class extends H{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${Pi(lt)}`},Ge=class extends q{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${Pi(t)}`);}};var wt=class extends je{code="PlatformError";message="Something went wrong. Please try again later."};var Me=class extends ft{constructor(e,t){super(`${Tt(e)} with id: \`${t}\` already exists. Please use a different id.`);}},se=class extends ht{constructor(e,t){super(`${Tt(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Ze=class extends je{constructor(e,t){super(`Failed to execute ${Tt(e)} with id: \`${t}\`. Please try again later.`);}};var kt=class extends se{code="ProviderNotFoundError";constructor(e){super("provider",e);}},Ot=class extends Ze{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var St=class extends re{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.");}},At=class extends re{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},It=class extends re{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},Pt=class extends re{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 re{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");}};var Et=class extends se{code="StepNotFoundError";constructor(e){super("step",e);}},Dt=class extends Me{code="StepAlreadyExistsError";constructor(e){super("step",e);}};var Je=class extends se{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},Ct=class extends Me{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var jt=class{ajv;compiledSchemas;constructor(){this.ajv=new Pr__default.default({useDefaults:!0,removeAdditional:"all"}),Rr__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 n=this.compiledSchemas.get(t);return n||(n=this.ajv.compile(t),this.compiledSchemas.set(t,n)),n(e)?{success:!0,data:e}:{success:!1,errors:n.errors.map(s=>({path:s.instancePath,message:s.message}))}}transformToJsonSchema(e){return e}};var Oi=class{isSchema(e){return e.safeParseAsync!==void 0}async validate(e,t){let n=t.safeParse(e);return n.success?{success:!0,data:n.data}:{success:!1,errors:n.error.errors.map(r=>({path:`/${r.path.join("/")}`,message:r.message}))}}transformToJsonSchema(e){try{return or().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 ar=[new Oi,new jt],cr=async(i,e)=>{for(let t of ar)if(t.isSchema(i))return t.validate(e,i);throw new Error("Invalid schema")},C=i=>{for(let e of ar)if(e.isSchema(i))return e.transformToJsonSchema(i);throw new Error("Invalid schema")};var lr={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 st=lr.version,Si="2024-06-26";jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});function dr(){return process.env.NODE_ENV==="development"}var ot=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;secretKey;version=st;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,!dr()&&!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:dr()&&(t.strictAuthentication=!1),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(n=>n.workflowId===t.workflowId))throw new Ct(t.workflowId);this.discoveredWorkflows.push(t);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((n,r)=>n+r.steps.length,0);return {status:"ok",sdkVersion:st,frameworkVersion:Si,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(n=>n.workflowId===e);if(t)return t;throw new Je(e)}getStep(e,t){let r=this.getWorkflow(e).steps.find(s=>s.stepId===t);if(r)return r;throw new Et(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(C(e))}async validate(e,t,n,r,s,o,a){let d=await cr(t,e);if(d.success)return d.data;switch(n){case"event":this.throwInvalidEvent(r,s,d.errors);case"step":this.throwInvalidStep(o,r,s,d.errors);case"provider":this.throwInvalidProvider(o,a,r,s,d.errors);default:throw new Error(`Invalid component: '${n}'`)}}throwInvalidProvider(e,t,n,r,s){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(n){case"output":throw new vt(r,e,t,s);default:throw new Error(`Invalid payload type: '${n}'`)}}throwInvalidStep(e,t,n,r){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new gt(n,e,r);case"result":throw new bt(n,e,r);case"controls":throw new _t(n,e,r);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,n){switch(e){case"controls":throw new yt(t,n);case"payload":throw new ze(t,n);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(n,r,s)=>{let o=this.getStep(e.workflowId,n),a=Ea(e),d=await this.createStepControls(o,a),p=e.action==="preview";if(!p&&await this.shouldSkip(s?.skip,d))return t({options:{skip:!0}}),{};let y=this.previewStep.bind(this),I=this.executeStep.bind(this),R=await(p?y:I)(e,{...o,providers:o.providers.map(Ce=>{let Ke=s?.providers?.[Ce.type];if(!Ke)throw new kt(Ce.type);return {...Ce,resolve:Ke}}),resolve:r});return n===e.stepId&&t(R),R.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let r=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
|
|
23
|
+
${A.bold(A.underline(r))} '${e.workflowId}'`);let s=this.getWorkflow(e.workflowId),o=process.hrtime(),a={outputs:{},providers:{},options:{}},d,p=new Promise(he=>{d=he;}),y=he=>{d(),a=he;},I;try{if(e.action==="execute"&&!e.payload&&!e.data)throw new ze(e.workflowId,{message:"Event `payload` is required"});let he=await this.createExecutionPayload(e,s);await Promise.race([p,s.execute({payload:he,environment:{},inputs:{},controls:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(e,y),sms:this.executeStepFactory(e,y),inApp:this.executeStepFactory(e,y),digest:this.executeStepFactory(e,y),delay:this.executeStepFactory(e,y),push:this.executeStepFactory(e,y),chat:this.executeStepFactory(e,y),custom:this.executeStepFactory(e,y)}})]);}catch(he){I=he;}let ne=process.hrtime(o),R=ne[0],Ce=ne[1],Ke=R*1e3+Ce/1e6,Or=I?E.ERROR:E.SUCCESS,Sr=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${Or} ${Sr} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Ke,I),I)throw I;return {outputs:a.outputs,providers:a.providers,options:a.options,metadata:{status:"success",error:!1,duration:Ke}}}async createExecutionPayload(e,t){let n=e.payload||e.data;if(e.action==="preview"){let s=this.mock(t.payload.schema);n=Object.assign(s,n);}return await this.validate(n,t.payload.unknownSchema,"event","payload",e.workflowId)}prettyPrintExecute(e,t,n){let r=n?E.ERROR:E.SUCCESS,s=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",o=n?"Failed to execute":s,a=n?A.error:A.success,d=`${r} ${o} workflowId: '${e.workflowId}`;console.log(`
|
|
24
24
|
${A.bold(a(d))}'`),console.log(` \u251C ${E.STEP} stepId: '${e.stepId}'`),console.log(` \u251C ${E.ACTION} action: '${e.action}'`),console.log(` \u2514 ${E.DURATION} duration: '${t.toFixed(2)}ms'
|
|
25
25
|
`);}async executeProviders(e,t,n){return t.providers.reduce(async(r,s)=>{let o=await r,a=this.previewProvider.bind(this),d=this.executeProvider.bind(this),y=await(e.action==="preview"?a:d)(e,t,s,n);return {...o,[s.type]:y}},Promise.resolve({}))}previewProvider(e,t,n,r){return console.log(` ${E.MOCK} Mocked provider: \`${n.type}\``),this.mock(n.outputs.schema)}async executeProvider(e,t,n,r){let s=Ai__default.default({indent:2}).start(`Executing provider: \`${n.type}\``);try{if(e.stepId===t.stepId){let o=await this.createStepControls(t,e),a=await n.resolve({controls:o,outputs:r}),d=await this.validate(a,n.outputs.unknownSchema,"step","output",e.workflowId,t.stepId,n.type);return s.succeed(`Executed provider: \`${n.type}\``),d}else s.stopAndPersist({symbol:E.HYDRATED,text:`Hydrated provider: \`${n.type}\``});}catch(o){throw s.stopAndPersist({symbol:E.ERROR,text:`Failed to execute provider: \`${n.type}\``}),new Ot(`Failed to execute provider: '${n.type}'.
|
|
26
|
-
${o.message}`)}}async executeStep(e,t){if(e.stepId===t.stepId){let n=Ai__default.default({indent:1}).start(`Executing stepId: \`${t.stepId}\``);try{let r=await this.createStepControls(t,e),s=await this.compileControls(r,e),o=await t.resolve(s),a=await this.validate(o,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId),d=await this.executeProviders(e,t,a);return n.succeed(`Executed stepId: \`${t.stepId}\``),{outputs:a,providers:d}}catch(r){throw n.stopAndPersist({prefixText:"",symbol:E.ERROR,text:`Failed to execute stepId: \`${t.stepId}\``}),r}}else {let n=Ai__default.default({indent:1}).start(`Hydrating stepId: \`${t.stepId}\``);try{let r=e.state.find(s=>s.stepId===t.stepId);if(r){let s=await this.validate(r.outputs,t.results.unknownSchema,"step","result",e.workflowId,t.stepId);return n.stopAndPersist({symbol:E.HYDRATED,text:`Hydrated stepId: \`${t.stepId}\``}),{outputs:s,providers:await this.executeProviders(e,t,s)}}else throw new mt(e.workflowId,t.stepId)}catch(r){throw n.stopAndPersist({symbol:E.ERROR,text:`Failed to hydrate stepId: \`${t.stepId}\``}),r}}}async compileControls(e,t){let n=this.templateEngine.parse(JSON.stringify(e)),r=await this.templateEngine.render(n,{...t.payload||t.data,subscriber:t.subscriber});return JSON.parse(r)}async createStepControls(e,t){let n=t.controls||t.inputs;return await this.validate(n,e.controls.unknownSchema,"step","controls",t.workflowId,e.stepId)}async previewStep(e,t){let n=Ai__default.default({indent:1}).start(`Previewing stepId: \`${t.stepId}\``);try{if(e.stepId===t.stepId){let r=await this.createStepControls(t,e),s=await this.compileControls(r,e),o=await t.resolve(s),a=await this.validate(o,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId);return n.stopAndPersist({symbol:E.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:a,providers:await this.executeProviders(e,t,a)}}else {let r=this.mock(t.results.schema);return n.stopAndPersist({symbol:E.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:r,providers:await this.executeProviders(e,t,r)}}}catch(r){throw n.stopAndPersist({symbol:E.ERROR,text:`Failed to preview stepId: \`${t.stepId}\``}),r}}getStepCode(e,t){return {code:this.getStep(e,t).resolve.toString()}}getWorkflowCode(e){return {code:this.getWorkflow(e).execute.toString()}}getCode(e,t){let n;if(e)t?n=this.getStepCode(e,t):n=this.getWorkflowCode(e);else throw new Je(e);return n}};function Ra(i){return JSON.parse(JSON.stringify(i))}var Ea=(p=>(p.PENDING="pending",p.QUEUED="queued",p.RUNNING="running",p.COMPLETED="completed",p.FAILED="failed",p.DELAYED="delayed",p.CANCELED="canceled",p.MERGED="merged",p.SKIPPED="skipped",p))(Ea||{});var Da=(h=>(h.EVERY_SECOND="* * * * * *",h.EVERY_5_SECONDS="*/5 * * * * *",h.EVERY_10_SECONDS="*/10 * * * * *",h.EVERY_30_SECONDS="*/30 * * * * *",h.EVERY_MINUTE="*/1 * * * *",h.EVERY_5_MINUTES="0 */5 * * * *",h.EVERY_10_MINUTES="0 */10 * * * *",h.EVERY_30_MINUTES="0 */30 * * * *",h.EVERY_HOUR="0 0-23/1 * * *",h.EVERY_2_HOURS="0 0-23/2 * * *",h.EVERY_3_HOURS="0 0-23/3 * * *",h.EVERY_4_HOURS="0 0-23/4 * * *",h.EVERY_5_HOURS="0 0-23/5 * * *",h.EVERY_6_HOURS="0 0-23/6 * * *",h.EVERY_7_HOURS="0 0-23/7 * * *",h.EVERY_8_HOURS="0 0-23/8 * * *",h.EVERY_9_HOURS="0 0-23/9 * * *",h.EVERY_10_HOURS="0 0-23/10 * * *",h.EVERY_11_HOURS="0 0-23/11 * * *",h.EVERY_12_HOURS="0 0-23/12 * * *",h.EVERY_DAY_AT_1AM="0 01 * * *",h.EVERY_DAY_AT_2AM="0 02 * * *",h.EVERY_DAY_AT_3AM="0 03 * * *",h.EVERY_DAY_AT_4AM="0 04 * * *",h.EVERY_DAY_AT_5AM="0 05 * * *",h.EVERY_DAY_AT_6AM="0 06 * * *",h.EVERY_DAY_AT_7AM="0 07 * * *",h.EVERY_DAY_AT_8AM="0 08 * * *",h.EVERY_DAY_AT_9AM="0 09 * * *",h.EVERY_DAY_AT_10AM="0 10 * * *",h.EVERY_DAY_AT_11AM="0 11 * * *",h.EVERY_DAY_AT_NOON="0 12 * * *",h.EVERY_DAY_AT_1PM="0 13 * * *",h.EVERY_DAY_AT_2PM="0 14 * * *",h.EVERY_DAY_AT_3PM="0 15 * * *",h.EVERY_DAY_AT_4PM="0 16 * * *",h.EVERY_DAY_AT_5PM="0 17 * * *",h.EVERY_DAY_AT_6PM="0 18 * * *",h.EVERY_DAY_AT_7PM="0 19 * * *",h.EVERY_DAY_AT_8PM="0 20 * * *",h.EVERY_DAY_AT_9PM="0 21 * * *",h.EVERY_DAY_AT_10PM="0 22 * * *",h.EVERY_DAY_AT_11PM="0 23 * * *",h.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",h.EVERY_WEEK="0 0 * * 0",h.EVERY_WEEKDAY="0 0 * * 1-5",h.EVERY_WEEKEND="0 0 * * 6,0",h.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",h.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",h.EVERY_2ND_HOUR="0 */2 * * *",h.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",h.EVERY_2ND_MONTH="0 0 1 */2 *",h.EVERY_QUARTER="0 0 1 */3 *",h.EVERY_6_MONTHS="0 0 1 */6 *",h.EVERY_YEAR="0 0 1 0 *",h.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",h.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",h.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",h.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",h.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",h.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",h.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",h.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",h.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",h.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",h.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",h.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",h.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",h.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",h.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",h.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",h.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",h.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",h.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",h.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",h.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",h.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",h.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",h.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",h.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",h.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",h.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",h.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",h))(Da||{});var _n=class{frameworkName;handler;client;hmacEnabled;http;constructor(e){this.handler=e.handler,this.client=e.client?e.client:new ot,this.client.addWorkflows(e.workflows),this.http=wn(this.client.apiKey),this.frameworkName=e.frameworkName,this.hmacEnabled=this.client.strictAuthentication;}createHandler(){return async(...e)=>{let t=await this.handler(...e),n=await this.handleAction({actions:t});return t.transformResponse(n)}}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":Si,"novu-framework-sdk":st,"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(),n=await e.method(),r=t.searchParams.get("action")||"",s=t.searchParams.get("workflowId")||"",o=t.searchParams.get("stepId")||"",a=await e.headers("novu-signature")||await e.headers("x-novu-signature")||"",d=await e.headers("novu-anonymous")||await e.headers("x-novu-anonymous")||"",p=t.searchParams.get("source")||"",y={};try{n==="POST"&&(y=await e.body());}catch{}try{r!=="health-check"&&this.validateHmac(y,a);let I=this.getPostActionMap(y,s,o,r,d,p),ne=this.getGetActionMap(s,o);if(n==="POST")return await this.handlePostAction(r,I);if(n==="GET")return await this.handleGetAction(r,ne);if(n==="OPTIONS")return this.createResponse(200,{})}catch(I){return this.handleError(I)}return this.createError(new xt(n))}getPostActionMap(e,t,n,r,s,o){return {trigger:this.triggerAction({workflowId:t,...e}),execute:async()=>{let a=await this.client.executeWorkflow({...e,workflowId:t,stepId:n,action:r});return this.createResponse(200,a)},preview:async()=>{let a=await this.client.executeWorkflow({...e,workflowId:t,stepId:n,action:r});return this.createResponse(200,a)}}}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}},n=await this.http.post("/events/trigger",t);return this.createResponse(200,n)}}getGetActionMap(e,t){return {discover:async()=>{let n=await this.client.discover();return this.createResponse(200,n)},"health-check":async()=>{let n=await this.client.healthCheck();return this.createResponse(200,n)},code:async()=>{let n=await this.client.getCode(e,t);return this.createResponse(200,n)}}}async handlePostAction(e,t){if(Object.values(at).includes(e)){let n=t[e];return n()}else throw new Ge(e,at)}async handleGetAction(e,t){if(Object.values(ct).includes(e)){let n=t[e];return n()}else throw new Ge(e,ct)}isClientError(e){return Object.values(F).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 wt))}validateHmac(e,t){if(!this.hmacEnabled)return;if(!t)throw new At;if(!this.client.apiKey)throw new Rt;let[n,r]=t.split(",");if(!n||!r)throw new It;let[s,o]=n.split("="),[a,d]=r.split("=");if(Number(s)<Date.now()-1500)throw new Pt;if(!(this.hashHmac(this.client.apiKey,`${o}.${JSON.stringify(e)}`)===d))throw new St}hashHmac(e,t){return crypto.createHmac("sha256",e).update(t).digest("hex")}};var ja={type:"object",properties:{webhookUrl:{type:"string",format:"uri"},text:{type:"string"},blocks:{type:"array",items:{type:"object",properties:{type:{enum:["image","context","actions","divider","section","input","file","header","video","rich_text"]}},required:["type"],additionalProperties:!0,allOf:[{if:{properties:{type:{const:"image"}}},then:{$ref:"#/definitions/ImageBlock"}},{if:{properties:{type:{const:"context"}}},then:{$ref:"#/definitions/ContextBlock"}},{if:{properties:{type:{const:"actions"}}},then:{$ref:"#/definitions/ActionsBlock"}},{if:{properties:{type:{const:"divider"}}},then:{$ref:"#/definitions/DividerBlock"}},{if:{properties:{type:{const:"section"}}},then:{$ref:"#/definitions/SectionBlock"}},{if:{properties:{type:{const:"Input"}}},then:{$ref:"#/definitions/InputBlock"}},{if:{properties:{type:{const:"Video"}}},then:{$ref:"#/definitions/VideoBlock"}},{if:{properties:{type:{const:"rich_text"}}},then:{$ref:"#/definitions/RichTextBlock"}}]}}},definitions:{KnownBlock:{oneOf:[{$ref:"#/definitions/ImageBlock"},{$ref:"#/definitions/ContextBlock"},{$ref:"#/definitions/ActionsBlock"},{$ref:"#/definitions/DividerBlock"},{$ref:"#/definitions/SectionBlock"},{$ref:"#/definitions/InputBlock"},{$ref:"#/definitions/FileBlock"},{$ref:"#/definitions/HeaderBlock"},{$ref:"#/definitions/VideoBlock"},{$ref:"#/definitions/RichTextBlock"}]},ImageBlock:{type:"object",properties:{type:{type:"string",const:"image",description:"The type of block. For an image block, `type` is always `image`."},block_id:{type:"string"},image_url:{type:"string",description:"The URL of the image to be displayed. Maximum length for this field is 3000 characters."},alt_text:{type:"string",description:`A plain-text summary of the image. This should not contain any markup.
|
|
26
|
+
${o.message}`)}}async executeStep(e,t){if(e.stepId===t.stepId){let n=Ai__default.default({indent:1}).start(`Executing stepId: \`${t.stepId}\``);try{let r=await this.createStepControls(t,e),s=await this.compileControls(r,e),o=await t.resolve(s),a=await this.validate(o,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId),d=await this.executeProviders(e,t,a);return n.succeed(`Executed stepId: \`${t.stepId}\``),{outputs:a,providers:d}}catch(r){throw n.stopAndPersist({prefixText:"",symbol:E.ERROR,text:`Failed to execute stepId: \`${t.stepId}\``}),r}}else {let n=Ai__default.default({indent:1}).start(`Hydrating stepId: \`${t.stepId}\``);try{let r=e.state.find(s=>s.stepId===t.stepId);if(r){let s=await this.validate(r.outputs,t.results.unknownSchema,"step","result",e.workflowId,t.stepId);return n.stopAndPersist({symbol:E.HYDRATED,text:`Hydrated stepId: \`${t.stepId}\``}),{outputs:s,providers:await this.executeProviders(e,t,s)}}else throw new mt(e.workflowId,t.stepId)}catch(r){throw n.stopAndPersist({symbol:E.ERROR,text:`Failed to hydrate stepId: \`${t.stepId}\``}),r}}}async compileControls(e,t){let n=this.templateEngine.parse(JSON.stringify(e)),r=await this.templateEngine.render(n,{...t.payload||t.data,subscriber:t.subscriber});return JSON.parse(r)}async createStepControls(e,t){let n=t.controls||t.inputs;return await this.validate(n,e.controls.unknownSchema,"step","controls",t.workflowId,e.stepId)}async previewStep(e,t){let n=Ai__default.default({indent:1}).start(`Previewing stepId: \`${t.stepId}\``);try{if(e.stepId===t.stepId){let r=await this.createStepControls(t,e),s=await this.compileControls(r,e),o=await t.resolve(s),a=await this.validate(o,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId);return n.stopAndPersist({symbol:E.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:a,providers:await this.executeProviders(e,t,a)}}else {let r=this.mock(t.results.schema);return n.stopAndPersist({symbol:E.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:r,providers:await this.executeProviders(e,t,r)}}}catch(r){throw n.stopAndPersist({symbol:E.ERROR,text:`Failed to preview stepId: \`${t.stepId}\``}),r}}getStepCode(e,t){return {code:this.getStep(e,t).resolve.toString()}}getWorkflowCode(e){return {code:this.getWorkflow(e).execute.toString()}}getCode(e,t){let n;if(e)t?n=this.getStepCode(e,t):n=this.getWorkflowCode(e);else throw new Je(e);return n}};function Ea(i){return JSON.parse(JSON.stringify(i))}var Da=(p=>(p.PENDING="pending",p.QUEUED="queued",p.RUNNING="running",p.COMPLETED="completed",p.FAILED="failed",p.DELAYED="delayed",p.CANCELED="canceled",p.MERGED="merged",p.SKIPPED="skipped",p))(Da||{});var Ca=(h=>(h.EVERY_SECOND="* * * * * *",h.EVERY_5_SECONDS="*/5 * * * * *",h.EVERY_10_SECONDS="*/10 * * * * *",h.EVERY_30_SECONDS="*/30 * * * * *",h.EVERY_MINUTE="*/1 * * * *",h.EVERY_5_MINUTES="0 */5 * * * *",h.EVERY_10_MINUTES="0 */10 * * * *",h.EVERY_30_MINUTES="0 */30 * * * *",h.EVERY_HOUR="0 0-23/1 * * *",h.EVERY_2_HOURS="0 0-23/2 * * *",h.EVERY_3_HOURS="0 0-23/3 * * *",h.EVERY_4_HOURS="0 0-23/4 * * *",h.EVERY_5_HOURS="0 0-23/5 * * *",h.EVERY_6_HOURS="0 0-23/6 * * *",h.EVERY_7_HOURS="0 0-23/7 * * *",h.EVERY_8_HOURS="0 0-23/8 * * *",h.EVERY_9_HOURS="0 0-23/9 * * *",h.EVERY_10_HOURS="0 0-23/10 * * *",h.EVERY_11_HOURS="0 0-23/11 * * *",h.EVERY_12_HOURS="0 0-23/12 * * *",h.EVERY_DAY_AT_1AM="0 01 * * *",h.EVERY_DAY_AT_2AM="0 02 * * *",h.EVERY_DAY_AT_3AM="0 03 * * *",h.EVERY_DAY_AT_4AM="0 04 * * *",h.EVERY_DAY_AT_5AM="0 05 * * *",h.EVERY_DAY_AT_6AM="0 06 * * *",h.EVERY_DAY_AT_7AM="0 07 * * *",h.EVERY_DAY_AT_8AM="0 08 * * *",h.EVERY_DAY_AT_9AM="0 09 * * *",h.EVERY_DAY_AT_10AM="0 10 * * *",h.EVERY_DAY_AT_11AM="0 11 * * *",h.EVERY_DAY_AT_NOON="0 12 * * *",h.EVERY_DAY_AT_1PM="0 13 * * *",h.EVERY_DAY_AT_2PM="0 14 * * *",h.EVERY_DAY_AT_3PM="0 15 * * *",h.EVERY_DAY_AT_4PM="0 16 * * *",h.EVERY_DAY_AT_5PM="0 17 * * *",h.EVERY_DAY_AT_6PM="0 18 * * *",h.EVERY_DAY_AT_7PM="0 19 * * *",h.EVERY_DAY_AT_8PM="0 20 * * *",h.EVERY_DAY_AT_9PM="0 21 * * *",h.EVERY_DAY_AT_10PM="0 22 * * *",h.EVERY_DAY_AT_11PM="0 23 * * *",h.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",h.EVERY_WEEK="0 0 * * 0",h.EVERY_WEEKDAY="0 0 * * 1-5",h.EVERY_WEEKEND="0 0 * * 6,0",h.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",h.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",h.EVERY_2ND_HOUR="0 */2 * * *",h.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",h.EVERY_2ND_MONTH="0 0 1 */2 *",h.EVERY_QUARTER="0 0 1 */3 *",h.EVERY_6_MONTHS="0 0 1 */6 *",h.EVERY_YEAR="0 0 1 0 *",h.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",h.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",h.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",h.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",h.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",h.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",h.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",h.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",h.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",h.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",h.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",h.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",h.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",h.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",h.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",h.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",h.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",h.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",h.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",h.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",h.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",h.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",h.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",h.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",h.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",h.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",h.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",h.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",h))(Ca||{});var _n=class{frameworkName;handler;client;hmacEnabled;http;constructor(e){this.handler=e.handler,this.client=e.client?e.client:new ot,this.client.addWorkflows(e.workflows),this.http=wn(this.client.secretKey),this.frameworkName=e.frameworkName,this.hmacEnabled=this.client.strictAuthentication;}createHandler(){return async(...e)=>{let t=await this.handler(...e),n=await this.handleAction({actions:t});return t.transformResponse(n)}}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":Si,"novu-framework-sdk":st,"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(),n=await e.method(),r=t.searchParams.get("action")||"",s=t.searchParams.get("workflowId")||"",o=t.searchParams.get("stepId")||"",a=await e.headers("novu-signature")||await e.headers("x-novu-signature")||"",d=await e.headers("novu-anonymous")||await e.headers("x-novu-anonymous")||"",p=t.searchParams.get("source")||"",y={};try{n==="POST"&&(y=await e.body());}catch{}try{r!=="health-check"&&this.validateHmac(y,a);let I=this.getPostActionMap(y,s,o,r,d,p),ne=this.getGetActionMap(s,o);if(n==="POST")return await this.handlePostAction(r,I);if(n==="GET")return await this.handleGetAction(r,ne);if(n==="OPTIONS")return this.createResponse(200,{})}catch(I){return this.handleError(I)}return this.createError(new xt(n))}getPostActionMap(e,t,n,r,s,o){return {trigger:this.triggerAction({workflowId:t,...e}),execute:async()=>{let a=await this.client.executeWorkflow({...e,workflowId:t,stepId:n,action:r});return this.createResponse(200,a)},preview:async()=>{let a=await this.client.executeWorkflow({...e,workflowId:t,stepId:n,action:r});return this.createResponse(200,a)}}}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}},n=await this.http.post("/events/trigger",t);return this.createResponse(200,n)}}getGetActionMap(e,t){return {discover:async()=>{let n=await this.client.discover();return this.createResponse(200,n)},"health-check":async()=>{let n=await this.client.healthCheck();return this.createResponse(200,n)},code:async()=>{let n=await this.client.getCode(e,t);return this.createResponse(200,n)}}}async handlePostAction(e,t){if(Object.values(at).includes(e)){let n=t[e];return n()}else throw new Ge(e,at)}async handleGetAction(e,t){if(Object.values(ct).includes(e)){let n=t[e];return n()}else throw new Ge(e,ct)}isClientError(e){return Object.values(F).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 wt))}validateHmac(e,t){if(!this.hmacEnabled)return;if(!t)throw new At;if(!this.client.secretKey)throw new Rt;let[n,r]=t.split(",");if(!n||!r)throw new It;let[s,o]=n.split("="),[a,d]=r.split("=");if(Number(s)<Date.now()-1500)throw new Pt;if(!(this.hashHmac(this.client.secretKey,`${o}.${JSON.stringify(e)}`)===d))throw new St}hashHmac(e,t){return crypto.createHmac("sha256",e).update(t).digest("hex")}};var Na={type:"object",properties:{webhookUrl:{type:"string",format:"uri"},text:{type:"string"},blocks:{type:"array",items:{type:"object",properties:{type:{enum:["image","context","actions","divider","section","input","file","header","video","rich_text"]}},required:["type"],additionalProperties:!0,allOf:[{if:{properties:{type:{const:"image"}}},then:{$ref:"#/definitions/ImageBlock"}},{if:{properties:{type:{const:"context"}}},then:{$ref:"#/definitions/ContextBlock"}},{if:{properties:{type:{const:"actions"}}},then:{$ref:"#/definitions/ActionsBlock"}},{if:{properties:{type:{const:"divider"}}},then:{$ref:"#/definitions/DividerBlock"}},{if:{properties:{type:{const:"section"}}},then:{$ref:"#/definitions/SectionBlock"}},{if:{properties:{type:{const:"Input"}}},then:{$ref:"#/definitions/InputBlock"}},{if:{properties:{type:{const:"Video"}}},then:{$ref:"#/definitions/VideoBlock"}},{if:{properties:{type:{const:"rich_text"}}},then:{$ref:"#/definitions/RichTextBlock"}}]}}},definitions:{KnownBlock:{oneOf:[{$ref:"#/definitions/ImageBlock"},{$ref:"#/definitions/ContextBlock"},{$ref:"#/definitions/ActionsBlock"},{$ref:"#/definitions/DividerBlock"},{$ref:"#/definitions/SectionBlock"},{$ref:"#/definitions/InputBlock"},{$ref:"#/definitions/FileBlock"},{$ref:"#/definitions/HeaderBlock"},{$ref:"#/definitions/VideoBlock"},{$ref:"#/definitions/RichTextBlock"}]},ImageBlock:{type:"object",properties:{type:{type:"string",const:"image",description:"The type of block. For an image block, `type` is always `image`."},block_id:{type:"string"},image_url:{type:"string",description:"The URL of the image to be displayed. Maximum length for this field is 3000 characters."},alt_text:{type:"string",description:`A plain-text summary of the image. This should not contain any markup.
|
|
27
27
|
Maximum length for this field is 2000 characters.`},title:{$ref:"#/definitions/PlainTextElement",description:`An optional title for the image in the form of a {@link PlainTextElement } object.
|
|
28
28
|
Maximum length for the text in this field is 2000 characters.`}},required:["alt_text","image_url","type"],additionalProperties:!1,description:"Displays an image. A simple image block, designed to make those cat photos really pop."},PlainTextElement:{type:"object",properties:{type:{type:"string",const:"plain_text",description:"The formatting to use for this text object."},text:{type:"string",description:"The text for the block. The minimum length is 1 and maximum length is 3000 characters."},emoji:{type:"boolean",description:"Indicates whether emojis in a text field should be escaped into the colon emoji format."}},required:["type","text"],additionalProperties:!1,description:"Defines an object containing some text."},ContextBlock:{type:"object",properties:{type:{type:"string",const:"context",description:"The type of block. For a context block, `type` is always `context`."},block_id:{type:"string"},elements:{type:"array",items:{anyOf:[{$ref:"#/definitions/ImageElement"},{$ref:"#/definitions/PlainTextElement"},{$ref:"#/definitions/MrkdwnElement"}]},description:`An array of {@link ImageElement }, {@link PlainTextElement } or {@link MrkdwnElement } objects.
|
|
29
29
|
Maximum number of items is 10.`}},required:["elements","type"],additionalProperties:!1,description:"Displays contextual info, which can include both images and text."},ImageElement:{type:"object",properties:{type:{type:"string",const:"image",description:"The type of element. In this case `type` is always `image`."},image_url:{type:"string",description:"The URL of the image to be displayed."},alt_text:{type:"string",description:"A plain-text summary of the image. This should not contain any markup."}},required:["type","image_url","alt_text"],additionalProperties:!1,description:"Displays an image as part of a larger block of content. Use this `image` block if you want a block with\nonly an image in it."},MrkdwnElement:{type:"object",properties:{type:{type:"string",const:"mrkdwn",description:"The formatting to use for this text object."},text:{type:"string",description:`The text for the block. This field accepts any of the standard text formatting markup.
|
|
@@ -104,25 +104,25 @@ that contain remote files. If you want to add remote files to messages,
|
|
|
104
104
|
Maximum length for the text in this field is 150 characters.`}},required:["text","type"],additionalProperties:!1,description:"Displays a larger-sized text block. A `header` is a plain-text block that displays in a larger, bold\nfont. Use it to delineate between different groups of content in your app's surfaces."},VideoBlock:{type:"object",properties:{type:{type:"string",const:"video",description:"The type of block. For a video block, `type` is always `video`."},block_id:{type:"string",description:"A string acting as a unique identifier for a block. If not specified, a `block_id` will be generated.\nYou can use this `block_id` when you receive an interaction payload to\n{@link https://api.slack.com/interactivity/handling#payloads identify the source of the action}.\nMaximum length for this field is 255 characters. `block_id` should be unique for each message and each iteration of\na message. If a message is updated, use a new `block_id`."},video_url:{type:"string",description:`The URL to be embedded. Must match any existing
|
|
105
105
|
{@link https://api.slack.com/reference/messaging/link-unfurling#configuring_domains unfurl domains} within the app
|
|
106
106
|
and point to a HTTPS URL.`},thumbnail_url:{type:"string",description:"The thumbnail image URL."},alt_text:{type:"string",description:"A tooltip for the video. Required for accessibility."},title:{$ref:"#/definitions/PlainTextElement",description:"Video title as a {@link PlainTextElement } object. `text` within must be less than 200 characters."},title_url:{type:"string",description:`Hyperlink for the title text. Must correspond to the non-embeddable URL for the video.
|
|
107
|
-
Must go to an HTTPS URL.`},author_name:{type:"string",description:"Author name to be displayed. Must be less than 50 characters."},provider_name:{type:"string",description:"The originating application or domain of the video, e.g. YouTube."},provider_icon_url:{type:"string",description:"Icon for the video provider, e.g. YouTube icon."},description:{$ref:"#/definitions/PlainTextElement",description:"Description for video using a {@link PlainTextElement } object."}},required:["alt_text","thumbnail_url","title","type","video_url"],additionalProperties:!1,description:"Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g.\nlink unfurls, messages, modals, App Home) \u2014 anywhere you can put blocks! To use the video block within your app, you\nmust have the {@link https://api.slack.com/scopes/links.embed:write `links.embed:write` scope}."}},additionalProperties:!1},
|
|
107
|
+
Must go to an HTTPS URL.`},author_name:{type:"string",description:"Author name to be displayed. Must be less than 50 characters."},provider_name:{type:"string",description:"The originating application or domain of the video, e.g. YouTube."},provider_icon_url:{type:"string",description:"Icon for the video provider, e.g. YouTube icon."},description:{$ref:"#/definitions/PlainTextElement",description:"Description for video using a {@link PlainTextElement } object."}},required:["alt_text","thumbnail_url","title","type","video_url"],additionalProperties:!1,description:"Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g.\nlink unfurls, messages, modals, App Home) \u2014 anywhere you can put blocks! To use the video block within your app, you\nmust have the {@link https://api.slack.com/scopes/links.embed:write `links.embed:write` scope}."}},additionalProperties:!1},ur={output:Na};var pr={slack:ur};var Ma={type:"object",properties:{ipPoolName:{type:"string"}},required:["ipPoolName"],additionalProperties:!1},hr={output:Ma};var fr={sendgrid:hr};var mr={};var yr={};var _r={};var gr={chat:pr,sms:_r,email:fr,push:yr,in_app:mr};var Za={type:"object",properties:{type:{enum:["regular"],default:"regular"},amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]}},required:["amount","unit"],additionalProperties:!1},$a={type:"object",properties:{duration:{type:"number"}},required:["duration"],additionalProperties:!1},gn={output:Za,result:$a};var Ua={type:"object",properties:{amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]},digestKey:{type:"string"},lookBackWindow:{type:"object",properties:{amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]}},required:["amount","unit"],additionalProperties:!1}},required:["amount","unit"],additionalProperties:!1},qa={type:"object",properties:{cron:{type:"string"},digestKey:{type:"string"}},required:["cron"],additionalProperties:!1},Va={oneOf:[Ua,qa]},La={type:"object",properties:{events:{type:"array",items:{type:"object",properties:{id:{type:"string"},time:{type:"string"},payload:{type:"object"}},required:["id","time","payload"],additionalProperties:!1}}},required:["events"],additionalProperties:!1},bn={output:Va,result:La};var Ya={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},Fa={type:"object",properties:{},required:[],additionalProperties:!1},br={output:Ya,result:Fa};var Wa={type:"object",properties:{subject:{type:"string"},body:{type:"string"}},required:["subject","body"],additionalProperties:!1},Ba={type:"object",properties:{},required:[],additionalProperties:!1},vr={output:Wa,result:Ba};var Ka={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},za={type:"object",properties:{seen:{type:"boolean"},read:{type:"boolean"},lastSeenDate:{type:"string",format:"date-time",nullable:!0},lastReadDate:{type:"string",format:"date-time",nullable:!0}},required:["seen","read","lastSeenDate","lastReadDate"],additionalProperties:!1},Tr={output:Ka,result:za};var Ga={type:"object",properties:{subject:{type:"string"},body:{type:"string"}},required:["subject","body"],additionalProperties:!1},Ja={type:"object",properties:{},required:[],additionalProperties:!1},xr={output:Ga,result:Ja};var Xa={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},Qa={type:"object",properties:{},required:[],additionalProperties:!1},wr={output:Xa,result:Qa};var z={chat:br,sms:wr,push:xr,email:vr,in_app:Tr};var N={type:"object",properties:{},required:[],additionalProperties:!1};function Ha(i,e,t){let n=t||{},r={workflowId:i,options:{...n,inputSchema:C(n.controlSchema||n.inputSchema||N),controlSchema:C(n.controlSchema||n.inputSchema||N),payloadSchema:C(n.payloadSchema||N)},steps:[],code:e.toString(),data:{schema:C(n.payloadSchema||N),unknownSchema:n.payloadSchema||N},payload:{schema:C(n.payloadSchema||N),unknownSchema:n.payloadSchema||N},inputs:{schema:C(n.controlSchema||n.inputSchema||N),unknownSchema:n.controlSchema||n.inputSchema||N},controls:{schema:C(n.controlSchema||n.inputSchema||N),unknownSchema:n.controlSchema||n.inputSchema||N},execute:e};return e({payload:{},subscriber:{},environment:{},controls:{},step:{push:De(r,"push",z.push.output,z.push.result),chat:De(r,"chat",z.chat.output,z.chat.result),email:De(r,"email",z.email.output,z.email.result),sms:De(r,"sms",z.sms.output,z.sms.result),inApp:De(r,"in_app",z.in_app.output,z.in_app.result),digest:De(r,"digest",bn.output,bn.result),delay:De(r,"delay",gn.output,gn.result),custom:tc(r,"custom")}}),ic(r),r}function De(i,e,t,n){return async(r,s,o={})=>{let a=o?.controlSchema||o?.inputSchema||N,d={stepId:r,type:e,inputs:{schema:C(a),unknownSchema:a},controls:{schema:C(a),unknownSchema:a},outputs:{schema:C(t),unknownSchema:t},results:{schema:C(n),unknownSchema:n},resolve:s,code:s.toString(),options:o,providers:[]};kr(i,r,d),Object.values(pt).includes(e)&&Object.keys(o.providers||{}).length>0&&ec(d,e,o.providers||{});}}function kr(i,e,t){if(i.steps.some(n=>n.stepId===e))throw new Dt(e);i.steps.push(t);}function ec(i,e,t){let n=gr[e];Object.entries(t).forEach(([r,s])=>{let o=n[r];i.providers.push({type:r,code:s.toString(),resolve:s,outputs:{schema:C(o.output),unknownSchema:o.output}});});}function tc(i,e){return async(t,n,r={})=>{let s=r?.controlSchema||r?.inputSchema||N,o=r?.outputSchema||N;kr(i,t,{stepId:t,type:e,inputs:{schema:C(s),unknownSchema:s},controls:{schema:C(s),unknownSchema:s},outputs:{schema:C(o),unknownSchema:o},results:{schema:C(o),unknownSchema:o},resolve:n,code:n.toString(),options:r,providers:[]});}}function ic(i){console.log(`
|
|
108
108
|
${A.bold(A.underline("Discovered workflowId:"))} '${i.workflowId}'`),i.steps.forEach((e,t)=>{let n=t===i.steps.length-1?"\u2514":"\u251C";console.log(`${n} ${E.STEP} Discovered stepId: '${e.stepId}' Type: '${e.type}'`),e.providers.forEach((r,s)=>{let o=s===e.providers.length-1?"\u2514":"\u251C";console.log(` ${o} ${E.PROVIDER} Discovered provider: '${r.type}'`);});});}
|
|
109
109
|
|
|
110
|
-
exports.ActionStepEnum =
|
|
110
|
+
exports.ActionStepEnum = Ir;
|
|
111
111
|
exports.ChannelStepEnum = pt;
|
|
112
112
|
exports.Client = ot;
|
|
113
|
-
exports.CronExpression =
|
|
113
|
+
exports.CronExpression = Ca;
|
|
114
114
|
exports.ErrorCodeEnum = F;
|
|
115
115
|
exports.GetActionEnum = ct;
|
|
116
116
|
exports.HttpHeaderKeysEnum = Ii;
|
|
117
117
|
exports.HttpMethodEnum = lt;
|
|
118
118
|
exports.HttpQueryKeysEnum = xn;
|
|
119
119
|
exports.HttpStatusEnum = dt;
|
|
120
|
-
exports.JobStatusEnum =
|
|
121
|
-
exports.NovuApiEndpointsEnum =
|
|
120
|
+
exports.JobStatusEnum = Da;
|
|
121
|
+
exports.NovuApiEndpointsEnum = Ar;
|
|
122
122
|
exports.NovuRequestHandler = _n;
|
|
123
123
|
exports.PostActionEnum = at;
|
|
124
|
-
exports.RETRYABLE_ERROR_STATUS_CODES =
|
|
124
|
+
exports.RETRYABLE_ERROR_STATUS_CODES = hc;
|
|
125
125
|
exports.ResourceEnum = ut;
|
|
126
126
|
exports.SIGNATURE_TIMESTAMP_TOLERANCE = Tn;
|
|
127
127
|
exports.SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES = vn;
|
|
128
|
-
exports.workflow =
|
|
128
|
+
exports.workflow = Ha;
|