@onlive.ai/flow-client 0.0.3

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.
@@ -0,0 +1 @@
1
+ (function(S,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(S=typeof globalThis<"u"?globalThis:S||self,g(S.OnliveFlowClient={}))})(this,function(S){"use strict";var nn=Object.defineProperty;var rn=(S,g,z)=>g in S?nn(S,g,{enumerable:!0,configurable:!0,writable:!0,value:z}):S[g]=z;var q=(S,g,z)=>rn(S,typeof g!="symbol"?g+"":g,z);var g;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(g||(g={}));var z;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(z||(z={}));const f=g.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),N=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},c=g.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"]),Fe=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class T extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,h=0;for(;h<i.path.length;){const l=i.path[h];h===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],h++}}};return s(this),n}static assert(e){if(!(e instanceof T))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}T.create=r=>new T(r);const W=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,g.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${g.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${g.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:g.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,g.assertNever(r)}return{message:t}};let Oe=W;function Be(r){Oe=r}function pe(){return Oe}const me=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const h=n.filter(l=>!!l).slice().reverse();for(const l of h)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},qe=[];function u(r,e){const t=pe(),n=me({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===W?void 0:W].filter(s=>!!s)});r.common.issues.push(n)}class k{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return k.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),J=r=>({status:"dirty",value:r}),w=r=>({status:"valid",value:r}),ke=r=>r.status==="aborted",we=r=>r.status==="dirty",D=r=>r.status==="valid",K=r=>typeof Promise<"u"&&r instanceof Promise;function ye(r,e,t,n){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function je(r,e,t,n,s){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var Q,ee;class j{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}}const Re=(r,e)=>{if(D(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new T(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;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:s}:{errorMap:(i,o)=>{var h,l;const{message:_}=r;return i.code==="invalid_enum_value"?{message:_??o.defaultError}:typeof o.data>"u"?{message:(h=_??n)!==null&&h!==void 0?h:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(l=_??t)!==null&&l!==void 0?l:o.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return N(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(K(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Re(s,a)}"~validate"(e){var t,n;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return D(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>D(a)?{value:a.value}:{issues:s.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(K(s)?s:Promise.resolve(s));return Re(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(h=>h?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new O({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return A.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return I.create(this)}promise(){return X.create(this,this._def)}or(e){return se.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new O({...v(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ue({...v(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Ze({typeName:m.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new le({...v(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fe.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const We=/^c[^\s-]{8,}$/i,Je=/^[0-9a-z]+$/,He=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ye=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ge=/^[a-z0-9_-]{21}$/i,Xe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ke=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Qe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,et="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Te;const tt=/^(?:(?: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])$/,nt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,st=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,at=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,it=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ae="((\\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])))",ot=new RegExp(`^${Ae}$`);function Ne(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function dt(r){return new RegExp(`^${Ne(r)}$`)}function Ee(r){let e=`${Ae}T${Ne(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ct(r,e){return!!((e==="v4"||!e)&&tt.test(r)||(e==="v6"||!e)&&rt.test(r))}function ut(r,e){if(!Xe.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function lt(r,e){return!!((e==="v4"||!e)&&nt.test(r)||(e==="v6"||!e)&&st.test(r))}class C extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),y}const n=new k;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?u(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&u(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Qe.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Te||(Te=new RegExp(et,"u")),Te.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Ye.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ge.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")We.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Je.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")He.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),u(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Ee(a).test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ot.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?dt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Ke.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ct(e.data,a.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?ut(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?lt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?at.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?it.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):g.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new C({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...p.errToObj(e==null?void 0: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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new C({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}C.create=r=>{var e;return new C({checks:[],typeName:m.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function ft(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class M extends b{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)!==f.number){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),y}let n;const s=new k;for(const a of this._def.checks)a.kind==="int"?g.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?ft(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.not_finite,message:a.message}),s.dirty()):g.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const 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"&&g.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const 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)}}M.create=r=>new M({checks:[],typeName:m.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class P extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let n;const s=new k;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):g.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new P({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}P.create=r=>{var e;return new P({checks:[],typeName:m.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};class te extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),y}return w(e.data)}}te.create=r=>new te({typeName:m.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class U extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_date}),y}const n=new k;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):g.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const 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(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}U.create=r=>new U({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:m.ZodDate,...v(r)});class ge extends b{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),y}return w(e.data)}}ge.create=r=>new ge({typeName:m.ZodSymbol,...v(r)});class ne extends b{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),y}return w(e.data)}}ne.create=r=>new ne({typeName:m.ZodUndefined,...v(r)});class re extends b{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),y}return w(e.data)}}re.create=r=>new re({typeName:m.ZodNull,...v(r)});class H extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}}H.create=r=>new H({typeName:m.ZodAny,...v(r)});class F extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}}F.create=r=>new F({typeName:m.ZodUnknown,...v(r)});class E extends b{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),y}}E.create=r=>new E({typeName:m.ZodNever,...v(r)});class _e extends b{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),y}return w(e.data)}}_e.create=r=>new _e({typeName:m.ZodVoid,...v(r)});class I extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return u(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(u(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(u(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(u(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new j(t,i,t.path,o)))).then(i=>k.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new j(t,i,t.path,o)));return k.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new I({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new I({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new I({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}I.create=(r,e)=>new I({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...v(e)});function Y(r){if(r instanceof x){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=A.create(Y(n))}return new x({...r._def,shape:()=>e})}else return r instanceof I?new I({...r._def,type:Y(r.element)}):r instanceof A?A.create(Y(r.unwrap())):r instanceof L?L.create(Y(r.unwrap())):r instanceof R?R.create(r.items.map(e=>Y(e))):r}class x extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=g.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const l=this._getOrReturnCtx(e);return u(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(const l in s.data)i.includes(l)||o.push(l);const h=[];for(const l of i){const _=a[l],Z=s.data[l];h.push({key:{status:"valid",value:l},value:_._parse(new j(s,Z,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof E){const l=this._def.unknownKeys;if(l==="passthrough")for(const _ of o)h.push({key:{status:"valid",value:_},value:{status:"valid",value:s.data[_]}});else if(l==="strict")o.length>0&&(u(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const _ of o){const Z=s.data[_];h.push({key:{status:"valid",value:_},value:l._parse(new j(s,Z,s.path,_)),alwaysSet:_ in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const _ of h){const Z=await _.key,Ue=await _.value;l.push({key:Z,value:Ue,alwaysSet:_.alwaysSet})}return l}).then(l=>k.mergeObjectSync(n,l)):k.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const h=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:h}:{message:h}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};return g.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new x({...this._def,shape:()=>t})}omit(e){const t={};return g.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new x({...this._def,shape:()=>t})}deepPartial(){return Y(this)}partial(e){const t={};return g.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new x({...this._def,shape:()=>t})}required(e){const t={};return g.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof A;)a=a._def.innerType;t[n]=a}}),new x({...this._def,shape:()=>t})}keyof(){return $e(g.objectKeys(this.shape))}}x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:m.ZodObject,...v(e)}),x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:m.ZodObject,...v(e)}),x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:m.ZodObject,...v(e)});class se extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new T(o.ctx.common.issues));return u(t,{code:c.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const h of n){const l={...t,common:{...t.common,issues:[]},parent:null},_=h._parseSync({data:t.data,path:t.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(h=>new T(h));return u(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}se.create=(r,e)=>new se({options:r,typeName:m.ZodUnion,...v(e)});const $=r=>r instanceof oe?$(r.schema):r instanceof O?$(r.innerType()):r instanceof de?[r.value]:r instanceof V?r.options:r instanceof ce?g.objectValues(r.enum):r instanceof ue?$(r._def.innerType):r instanceof ne?[void 0]:r instanceof re?[null]:r instanceof A?[void 0,...$(r.unwrap())]:r instanceof L?[null,...$(r.unwrap())]:r instanceof Ze||r instanceof he?$(r.unwrap()):r instanceof le?$(r._def.innerType):[];class ve extends b{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return u(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),y;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=$(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new ve({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}}function Se(r,e){const t=N(r),n=N(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){const s=g.objectKeys(e),a=g.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const h=Se(r[o],e[o]);if(!h.valid)return{valid:!1};i[o]=h.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],h=Se(i,o);if(!h.valid)return{valid:!1};s.push(h.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ae extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(ke(a)||ke(i))return y;const o=Se(a.value,i.value);return o.valid?((we(a)||we(i))&&t.dirty(),{status:t.value,value:o.data}):(u(n,{code:c.invalid_intersection_types}),y)};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(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ae.create=(r,e,t)=>new ae({left:r,right:e,typeName:m.ZodIntersection,...v(t)});class R extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return u(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return u(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(u(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const h=this._def.items[o]||this._def.rest;return h?h._parse(new j(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>k.mergeArray(t,i)):k.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new R({...this._def,rest:e})}}R.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new R({items:r,typeName:m.ZodTuple,rest:null,...v(e)})};class ie extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return u(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new j(n,o,n.path,o)),value:i._parse(new j(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?k.mergeObjectAsync(t,s):k.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof b?new ie({keyType:e,valueType:t,typeName:m.ZodRecord,...v(n)}):new ie({keyType:C.create(),valueType:e,typeName:m.ZodRecord,...v(t)})}}class be extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return u(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,h],l)=>({key:s._parse(new j(n,o,n.path,[l,"key"])),value:a._parse(new j(n,h,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const h of i){const l=await h.key,_=await h.value;if(l.status==="aborted"||_.status==="aborted")return y;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(l.value,_.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const h of i){const l=h.key,_=h.value;if(l.status==="aborted"||_.status==="aborted")return y;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(l.value,_.value)}return{status:t.value,value:o}}}}be.create=(r,e,t)=>new be({valueType:e,keyType:r,typeName:m.ZodMap,...v(t)});class B extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return u(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(u(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(u(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(h){const l=new Set;for(const _ of h){if(_.status==="aborted")return y;_.status==="dirty"&&t.dirty(),l.add(_.value)}return{status:t.value,value:l}}const o=[...n.data.values()].map((h,l)=>a._parse(new j(n,h,n.path,l)));return n.common.async?Promise.all(o).then(h=>i(h)):i(o)}min(e,t){return new B({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new B({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}B.create=(r,e)=>new B({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...v(e)});class G extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return u(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),y;function n(o,h){return me({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pe(),W].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:h}})}function s(o,h){return me({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pe(),W].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:h}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof X){const o=this;return w(async function(...h){const l=new T([]),_=await o._def.args.parseAsync(h,a).catch(Ie=>{throw l.addIssue(n(h,Ie)),l}),Z=await Reflect.apply(i,this,_);return await o._def.returns._def.type.parseAsync(Z,a).catch(Ie=>{throw l.addIssue(s(Z,Ie)),l})})}else{const o=this;return w(function(...h){const l=o._def.args.safeParse(h,a);if(!l.success)throw new T([n(h,l.error)]);const _=Reflect.apply(i,this,l.data),Z=o._def.returns.safeParse(_,a);if(!Z.success)throw new T([s(_,Z.error)]);return Z.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new G({...this._def,args:R.create(e).rest(F.create())})}returns(e){return new G({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new G({args:e||R.create([]).rest(F.create()),returns:t||F.create(),typeName:m.ZodFunction,...v(n)})}}class oe extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}oe.create=(r,e)=>new oe({getter:r,typeName:m.ZodLazy,...v(e)});class de extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}de.create=(r,e)=>new de({value:r,typeName:m.ZodLiteral,...v(e)});function $e(r,e){return new V({values:r,typeName:m.ZodEnum,...v(e)})}class V extends b{constructor(){super(...arguments),Q.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return u(t,{expected:g.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}if(ye(this,Q)||je(this,Q,new Set(this._def.values)),!ye(this,Q).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return u(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return w(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}Q=new WeakMap,V.create=$e;class ce extends b{constructor(){super(...arguments),ee.set(this,void 0)}_parse(e){const t=g.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=g.objectValues(t);return u(n,{expected:g.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(ye(this,ee)||je(this,ee,new Set(g.getValidEnumValues(this._def.values))),!ye(this,ee).has(e.data)){const s=g.objectValues(t);return u(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return w(e.data)}get enum(){return this._def.values}}ee=new WeakMap,ce.create=(r,e)=>new ce({values:r,typeName:m.ZodNativeEnum,...v(e)});class X extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return u(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),y;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return w(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}X.create=(r,e)=>new X({type:r,typeName:m.ZodPromise,...v(e)});class O extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{u(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const h=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return h.status==="aborted"?y:h.status==="dirty"||t.value==="dirty"?J(h.value):h});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?J(o.value):o}}if(s.type==="refinement"){const i=o=>{const h=s.refinement(o,a);if(n.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!D(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>D(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);g.assertNever(s)}}O.create=(r,e,t)=>new O({schema:r,typeName:m.ZodEffects,effect:e,...v(t)}),O.createWithPreprocess=(r,e,t)=>new O({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...v(t)});class A extends b{_parse(e){return this._getType(e)===f.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}A.create=(r,e)=>new A({innerType:r,typeName:m.ZodOptional,...v(e)});class L extends b{_parse(e){return this._getType(e)===f.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(r,e)=>new L({innerType:r,typeName:m.ZodNullable,...v(e)});class ue extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ue.create=(r,e)=>new ue({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class le extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return K(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}le.create=(r,e)=>new le({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class xe extends b{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return u(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}xe.create=r=>new xe({typeName:m.ZodNaN,...v(r)});const ht=Symbol("zod_brand");class Ze extends b{_parse(e){const{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}}class fe extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),J(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new fe({in:e,out:t,typeName:m.ZodPipeline})}}class he extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(D(s)&&(s.value=Object.freeze(s.value)),s);return K(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}he.create=(r,e)=>new he({innerType:r,typeName:m.ZodReadonly,...v(e)});function ze(r,e={},t){return r?H.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,h=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,l=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...l,fatal:h})}}):H.create()}const pt={object:x.lazycreate};var m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));const mt=(r,e={message:`Input not instance of ${r.name}`})=>ze(t=>t instanceof r,e),Me=C.create,Pe=M.create,yt=xe.create,gt=P.create,Ve=te.create,_t=U.create,vt=ge.create,bt=ne.create,xt=re.create,kt=H.create,wt=F.create,Tt=E.create,St=_e.create,Zt=I.create,Ct=x.create,It=x.strictCreate,Ot=se.create,jt=ve.create,Rt=ae.create,At=R.create,Nt=ie.create,Et=be.create,$t=B.create,zt=G.create,Mt=oe.create,Pt=de.create,Vt=V.create,Lt=ce.create,Dt=X.create,Le=O.create,Ut=A.create,Ft=L.create,Bt=O.createWithPreprocess,qt=fe.create;var d=Object.freeze({__proto__:null,defaultErrorMap:W,setErrorMap:Be,getErrorMap:pe,makeIssue:me,EMPTY_PATH:qe,addIssueToContext:u,ParseStatus:k,INVALID:y,DIRTY:J,OK:w,isAborted:ke,isDirty:we,isValid:D,isAsync:K,get util(){return g},get objectUtil(){return z},ZodParsedType:f,getParsedType:N,ZodType:b,datetimeRegex:Ee,ZodString:C,ZodNumber:M,ZodBigInt:P,ZodBoolean:te,ZodDate:U,ZodSymbol:ge,ZodUndefined:ne,ZodNull:re,ZodAny:H,ZodUnknown:F,ZodNever:E,ZodVoid:_e,ZodArray:I,ZodObject:x,ZodUnion:se,ZodDiscriminatedUnion:ve,ZodIntersection:ae,ZodTuple:R,ZodRecord:ie,ZodMap:be,ZodSet:B,ZodFunction:G,ZodLazy:oe,ZodLiteral:de,ZodEnum:V,ZodNativeEnum:ce,ZodPromise:X,ZodEffects:O,ZodTransformer:O,ZodOptional:A,ZodNullable:L,ZodDefault:ue,ZodCatch:le,ZodNaN:xe,BRAND:ht,ZodBranded:Ze,ZodPipeline:fe,ZodReadonly:he,custom:ze,Schema:b,ZodSchema:b,late:pt,get ZodFirstPartyTypeKind(){return m},coerce:{string:r=>C.create({...r,coerce:!0}),number:r=>M.create({...r,coerce:!0}),boolean:r=>te.create({...r,coerce:!0}),bigint:r=>P.create({...r,coerce:!0}),date:r=>U.create({...r,coerce:!0})},any:kt,array:Zt,bigint:gt,boolean:Ve,date:_t,discriminatedUnion:jt,effect:Le,enum:Vt,function:zt,instanceof:mt,intersection:Rt,lazy:Mt,literal:Pt,map:Et,nan:yt,nativeEnum:Lt,never:Tt,null:xt,nullable:Ft,number:Pe,object:Ct,oboolean:()=>Ve().optional(),onumber:()=>Pe().optional(),optional:Ut,ostring:()=>Me().optional(),pipeline:qt,preprocess:Bt,promise:Dt,record:Nt,set:$t,strictObject:It,string:Me,symbol:vt,transformer:Le,tuple:At,undefined:bt,union:Ot,unknown:wt,void:St,NEVER:y,ZodIssueCode:c,quotelessJson:Fe,ZodError:T});const Wt=d.object({organizationId:d.string().nonempty()});d.enum(["step_impression","element_click","form_submit","form_error","step_action"]),d.object({});class Jt{constructor(e){q(this,"options");this.options=Wt.parse(e)}async analyzeRequest(e,t){const n=[];return"currentStepId"in e&&(e.actionId&&n.push({type:"element_click",data:{element_label:e.actionId,element_type:"button",step_id:e.currentStepId,organization_id:this.options.organizationId,tracker_client:"tracker@0.0.0"}}),t.fields&&n.push({type:"form_submit",data:{form_data:t.fields,step_id:e.currentStepId,organization_id:this.options.organizationId,tracker_client:"tracker@0.0.0"}})),n}async analyzeResponse(e,t){var s;const n=[];return"currentStepId"in e&&(n.push({type:"step_impression",data:{step_id:e.currentStepId,organization_id:this.options.organizationId,tracker_client:"tracker@0.0.0"}}),(s=t.step.result)!=null&&s.pipelines&&t.step.result.pipelines.forEach(a=>{n.push({type:"step_action",data:{action_name:a.name,action_data:a.data,step_id:e.currentStepId,organization_id:this.options.organizationId,tracker_client:"tracker@0.0.0"}})}),t.step.error&&n.push({type:"form_error",data:{error_message:t.step.error.message||(t.step.error.fields?"Invalid fields":"Unknown error"),step_id:e.currentStepId,organization_id:this.options.organizationId,tracker_client:"tracker@0.0.0"}})),n}}const Ht=d.string().nonempty(),Yt=d.object({baseUrl:d.string().url().nonempty(),flowId:d.string().length(24).nonempty(),organizationId:d.string().uuid().nonempty(),lang:d.string().length(2).nonempty()}),Ce=d.object({state:d.record(d.string(),d.any()).optional(),fields:d.record(d.string(),d.any()).optional()}),Gt=d.object({currentStepId:d.string().nonempty(),actionId:d.string().nonempty()}),De=d.enum(["text","boolean","number","email","phone","mobile_phone","date","time","datetime","password","url","void","location","availability"]),Xt=d.object({name:d.string().nonempty(),label:d.string().nonempty(),value:d.any().optional(),type:De,component:d.enum(["input","textarea","select","radio","checkbox","switch","carousel","button","label","map","calendar"]).optional(),selectionMode:d.enum(["single","multiple"]).optional(),placeholder:d.string().optional(),options:d.array(d.object({label:d.string().nonempty(),value:d.any().optional(),image:d.string().url().optional(),description:d.string().optional(),disabled:d.boolean().optional()})).optional(),required:d.boolean().optional(),configuration:d.object({input:d.object({min:d.number().optional(),max:d.number().optional(),step:d.number().optional(),regex:d.string().refine(r=>{try{return new RegExp(r),!0}catch{return!1}},"Invalid regex pattern").optional(),prefix:d.string().optional(),suffix:d.string().optional()}).optional(),map:d.object({apiKey:d.string().optional(),region:d.string().length(2).optional(),maxZoom:d.number().optional(),minZoom:d.number().optional(),minLocations:d.number().optional(),maxLocations:d.number().optional(),distanceUnit:d.enum(["km","mi"]).optional(),search:d.object({placeholder:d.string().optional(),noResultsText:d.string().optional(),autocomplete:d.boolean().optional(),mode:d.enum(["address","postcode"]).optional()}).optional(),distanceRange:d.object({initial:d.number().optional(),min:d.number().optional(),max:d.number().optional(),step:d.number().optional()}).optional(),mapRegion:d.object({}).optional(),mapPin:d.object({}).optional()}).optional(),calendar:d.object({time:d.object({format:d.enum(["12h","24h"]).optional()}).optional()}).optional()}).optional(),dependsOn:d.array(d.object({fieldName:d.string().nonempty(),value:d.any().optional()})).optional(),dependentBehavior:d.enum(["hidden","disabled"]).optional()}),Kt=d.object({id:d.string().nonempty(),type:d.enum(["submit","forward","link","iCall"]),label:d.string().nonempty(),variant:d.enum(["primary","secondary","success","danger","warning","info"]),url:d.string().url().optional()}),Qt=d.object({id:d.string().nonempty(),title:d.string().optional(),description:d.string().optional(),stageId:d.string().optional(),state:d.record(d.string(),d.any()).optional(),fields:d.array(Xt).optional(),actions:d.array(Kt).optional(),result:d.object({pipelines:d.array(d.object({name:d.string(),data:d.object({})})).optional()}).optional(),error:d.object({message:d.string().optional(),fields:d.array(d.object({name:d.string(),type:De,value:d.any(),error:d.string()})).optional()}).optional(),isFinal:d.boolean().optional()}),en=d.object({id:d.string().length(24).nonempty(),organizationId:d.string().uuid().nonempty(),updatedAt:d.string().datetime().nonempty(),stages:d.array(d.object({id:d.string().nonempty(),name:d.string().nonempty()}))});d.object({status:d.enum(["ok","error"]),step:Qt,flow:en}),d.enum(["track"]);class tn{constructor(e){q(this,"baseURL");q(this,"headers");q(this,"flowId");q(this,"eventListeners",new Map);q(this,"trackingService");const t=Yt.parse(e);this.flowId=t.flowId,this.baseURL=t.baseUrl,this.headers=new Headers({"Content-Type":"application/json","X-Organization-Id":t.organizationId,"X-Lang":t.lang}),this.trackingService=new Jt({organizationId:t.organizationId})}async request(e,t={}){const n=await fetch(`${this.baseURL}/${e}`,{...t,headers:this.headers});if(!(n!=null&&n.ok))throw new Error(`HTTP error! status: ${(n==null?void 0:n.status)||"unknown"}`);return n.json()}async firstStep(e={}){this.trackingService.analyzeRequest({},e).then(n=>n.map(s=>this.emit("track",s)));const t=await this.request(`flow/${this.flowId}/first-step`,{method:"POST",body:JSON.stringify(Ce.parse(e))});return this.trackingService.analyzeResponse({},t).then(n=>n.map(s=>this.emit("track",s))),t}async getStep(e,t={}){this.trackingService.analyzeRequest({stepId:e},t).then(s=>s.map(a=>this.emit("track",a)));const n=await this.request(`flow/${this.flowId}/steps/${Ht.parse(e)}`,{method:"POST",body:JSON.stringify(Ce.parse(t))});return this.trackingService.analyzeResponse({stepId:e},n).then(s=>s.map(a=>this.emit("track",a))),n}async nextStep(e,t={}){this.trackingService.analyzeRequest(e,t).then(i=>i.map(o=>this.emit("track",o)));const{currentStepId:n,actionId:s}=Gt.parse(e),a=await this.request(`flow/${this.flowId}/steps/${n}/action/${s}`,{method:"POST",body:JSON.stringify(Ce.parse(t))});return this.trackingService.analyzeResponse(e,a).then(i=>i.map(o=>this.emit("track",o))),a}on(e,t){var n;this.eventListeners.has(e)||this.eventListeners.set(e,[]),(n=this.eventListeners.get(e))==null||n.push(t)}emit(e,t){var n;(n=this.eventListeners.get(e))==null||n.forEach(s=>s(t.type,t.data))}}S.FlowClient=tn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@onlive.ai/flow-client",
3
+ "version": "0.0.3",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "devDependencies": {
11
+ "@types/node": "^22.10.5",
12
+ "typescript": "~5.6.3",
13
+ "vite": "^6.0.7"
14
+ },
15
+ "dependencies": {
16
+ "@vitest/coverage-v8": "^2.1.8",
17
+ "axios": "^1.7.9",
18
+ "dotenv": "^16.4.7",
19
+ "jsdom": "^25.0.1",
20
+ "vite-plugin-dts": "^4.5.0",
21
+ "vitest": "^2.1.8",
22
+ "zod": "^3.24.1"
23
+ },
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "build": "tsc && vite build",
27
+ "test": "vitest",
28
+ "test:coverage": "vitest --coverage",
29
+ "preview": "vite preview"
30
+ }
31
+ }