@jsdev_ninja/core 0.14.8 → 0.14.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var _t=Object.defineProperty;var bt=(n,e,t)=>e in n?_t(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Be=(n,e,t)=>bt(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b;(function(n){n.assertEqual=s=>s;function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const c of s)i[c]=c;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),c={};for(const o of i)c[o]=s[o];return n.objectValues(c)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const c in s)Object.prototype.hasOwnProperty.call(s,c)&&i.push(c);return i},n.find=(s,i)=>{for(const c of s)if(i(c))return c},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(b||(b={}));var je;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(je||(je={}));const p=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),R=n=>{switch(typeof n){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(n)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(n)?p.array:n===null?p.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?p.promise:typeof Map<"u"&&n instanceof Map?p.map:typeof Set<"u"&&n instanceof Set?p.set:typeof Date<"u"&&n instanceof Date?p.date:p.object;default:return p.unknown}},u=b.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"]),xt=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class N extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(i){return i.message},r={_errors:[]},s=i=>{for(const c of i.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)r._errors.push(t(c));else{let o=r,l=0;for(;l<c.path.length;){const d=c.path[l];l===c.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(c))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return s(this),r}static assert(e){if(!(e instanceof N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];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))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=n=>new N(n);const X=(n,e)=>{let t;switch(n.code){case u.invalid_type:n.received===p.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,b.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(n.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(n.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:b.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case u.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case u.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(n)}return{message:t}};let Ge=X;function kt(n){Ge=n}function _e(){return Ge}const be=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],c={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)o=d(c,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},St=[];function m(n,e){const t=_e(),r=be({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===X?void 0:X].filter(s=>!!s)});n.common.issues.push(r)}class T{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,c=await s.value;r.push({key:i,value:c})}return T.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:c}=s;if(i.status==="aborted"||c.status==="aborted")return y;i.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof c.value<"u"||s.alwaysSet)&&(r[i.value]=c.value)}return{status:e.value,value:r}}}const y=Object.freeze({status:"aborted"}),Q=n=>({status:"dirty",value:n}),I=n=>({status:"valid",value:n}),De=n=>n.status==="aborted",Ze=n=>n.status==="dirty",U=n=>n.status==="valid",re=n=>typeof Promise<"u"&&n instanceof Promise;function xe(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Xe(n,e,t,r,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var h;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(h||(h={}));var te,ne;class O{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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 We=(n,e)=>{if(U(e))return{success:!0,data:e.value};if(!n.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 N(n.common.issues);return this._error=t,this._error}}};function v(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))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:(c,o)=>{var l,d;const{message:f}=n;return c.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(l=f??r)!==null&&l!==void 0?l:o.defaultError}:c.code!=="invalid_type"?{message:o.defaultError}:{message:(d=f??t)!==null&&d!==void 0?d:o.defaultError}},description:s}}class _{get description(){return this._def.description}_getType(e){return R(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new T,ctx:{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)},i=this._parseSync({data:e,path:s.path,parent:s});return We(s,i)}"~validate"(e){var t,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return U(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>U(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:R(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(re(s)?s:Promise.resolve(s));return We(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const c=e(s),o=()=>i.addIssue({code:u.custom,...r(s)});return typeof Promise<"u"&&c instanceof Promise?c.then(l=>l?!0:(o(),!1)):c?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new j({schema:this,typeName:g.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 Z.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return H.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new j({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new pe({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new Re({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new fe({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wt=/^c[^\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,It=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nt=/^[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,At=/^[a-z0-9_-]{21}$/i,Ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jt=/^[-+]?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)?)??$/,Dt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ce;const Ot=/^(?:(?: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])$/,Pt=/^(?:(?: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])$/,Et=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Je="((\\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])))",Vt=new RegExp(`^${Je}$`);function He(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function zt(n){return new RegExp(`^${He(n)}$`)}function Ke(n){let e=`${Je}T${He(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ft(n,e){return!!((e==="v4"||!e)&&Ot.test(n)||(e==="v6"||!e)&&Et.test(n))}function Lt(n,e){if(!Ct.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ut(n,e){return!!((e==="v4"||!e)&&Pt.test(n)||(e==="v6"||!e)&&Rt.test(n))}class A extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_type,expected:p.string,received:i.parsedType}),y}const r=new T;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const c=e.data.length>i.value,o=e.data.length<i.value;(c||o)&&(s=this._getOrReturnCtx(e,s),c?m(s,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(s,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Dt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ce||(Ce=new RegExp(Zt,"u")),Ce.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Nt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")At.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")It.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:u.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:u.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ke(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Vt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?zt(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?jt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Ft(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Lt(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ut(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Mt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?$t.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:u.invalid_string,message:i.message}),r.dirty()):b.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:u.invalid_string,...h.errToObj(r)})}_addCheck(e){return new A({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){var t,r;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:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...h.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,...h.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...h.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new A({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new A({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new A({...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}}A.create=n=>{var e;return new A({checks:[],typeName:g.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...v(n)})};function qt(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=parseInt(n.toFixed(s).replace(".","")),c=parseInt(e.toFixed(s).replace(".",""));return i%c/Math.pow(10,s)}class $ extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_type,expected:p.number,received:i.parsedType}),y}let r;const s=new T;for(const i of this._def.checks)i.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?qt(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_finite,message:i.message}),s.dirty()):b.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,s){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(s)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.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"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}$.create=n=>new $({checks:[],typeName:g.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...v(n)});class V extends _{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)!==p.bigint)return this._getInvalidInput(e);let r;const s=new T;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):b.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:p.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,s){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(s)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.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}}V.create=n=>{var e;return new V({checks:[],typeName:g.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...v(n)})};class ae extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.boolean,received:r.parsedType}),y}return I(e.data)}}ae.create=n=>new ae({typeName:g.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...v(n)});class q extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_type,expected:p.date,received:i.parsedType}),y}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_date}),y}const r=new T;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):b.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.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}}q.create=n=>new q({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:g.ZodDate,...v(n)});class ke extends _{_parse(e){if(this._getType(e)!==p.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.symbol,received:r.parsedType}),y}return I(e.data)}}ke.create=n=>new ke({typeName:g.ZodSymbol,...v(n)});class se extends _{_parse(e){if(this._getType(e)!==p.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.undefined,received:r.parsedType}),y}return I(e.data)}}se.create=n=>new se({typeName:g.ZodUndefined,...v(n)});class ie extends _{_parse(e){if(this._getType(e)!==p.null){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.null,received:r.parsedType}),y}return I(e.data)}}ie.create=n=>new ie({typeName:g.ZodNull,...v(n)});class J extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}J.create=n=>new J({typeName:g.ZodAny,...v(n)});class L extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}L.create=n=>new L({typeName:g.ZodUnknown,...v(n)});class M extends _{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:p.never,received:t.parsedType}),y}}M.create=n=>new M({typeName:g.ZodNever,...v(n)});class Se extends _{_parse(e){if(this._getType(e)!==p.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.void,received:r.parsedType}),y}return I(e.data)}}Se.create=n=>new Se({typeName:g.ZodVoid,...v(n)});class C extends _{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return m(t,{code:u.invalid_type,expected:p.array,received:t.parsedType}),y;if(s.exactLength!==null){const c=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(c||o)&&(m(t,{code:c?u.too_big:u.too_small,minimum:o?s.exactLength.value:void 0,maximum:c?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:u.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:u.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((c,o)=>s.type._parseAsync(new O(t,c,t.path,o)))).then(c=>T.mergeArray(r,c));const i=[...t.data].map((c,o)=>s.type._parseSync(new O(t,c,t.path,o)));return T.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(n,e)=>new C({type:n,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function W(n){if(n instanceof k){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=Z.create(W(r))}return new k({...n._def,shape:()=>e})}else return n instanceof C?new C({...n._def,type:W(n.element)}):n instanceof Z?Z.create(W(n.unwrap())):n instanceof F?F.create(W(n.unwrap())):n instanceof P?P.create(n.items.map(e=>W(e))):n}class k extends _{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=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){const d=this._getOrReturnCtx(e);return m(d,{code:u.invalid_type,expected:p.object,received:d.parsedType}),y}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:c}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const d in s.data)c.includes(d)||o.push(d);const l=[];for(const d of c){const f=i[d],x=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new O(s,x,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof M){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of o)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")o.length>0&&(m(s,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of o){const x=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new O(s,x,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const x=await f.key,w=await f.value;d.push({key:x,value:w,alwaysSet:f.alwaysSet})}return d}).then(d=>T.mergeObjectSync(r,d)):T.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var s,i,c,o;const l=(c=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,t,r).message)!==null&&c!==void 0?c:r.defaultError;return t.code==="unrecognized_keys"?{message:(o=h.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({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 k({...this._def,catchall:e})}pick(e){const t={};return b.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return b.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new k({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){const t={};return b.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return b.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Z;)i=i._def.innerType;t[r]=i}}),new k({...this._def,shape:()=>t})}keyof(){return et(b.objectKeys(this.shape))}}k.create=(n,e)=>new k({shape:()=>n,unknownKeys:"strip",catchall:M.create(),typeName:g.ZodObject,...v(e)});k.strictCreate=(n,e)=>new k({shape:()=>n,unknownKeys:"strict",catchall:M.create(),typeName:g.ZodObject,...v(e)});k.lazycreate=(n,e)=>new k({shape:n,unknownKeys:"strip",catchall:M.create(),typeName:g.ZodObject,...v(e)});class oe extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const c=i.map(o=>new N(o.ctx.common.issues));return m(t,{code:u.invalid_union,unionErrors:c}),y}if(t.common.async)return Promise.all(r.map(async i=>{const c={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(s);{let i;const c=[];for(const l of r){const d={...t,common:{...t.common,issues:[]},parent:null},f=l._parseSync({data:t.data,path:t.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&c.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=c.map(l=>new N(l));return m(t,{code:u.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}oe.create=(n,e)=>new oe({options:n,typeName:g.ZodUnion,...v(e)});const E=n=>n instanceof de?E(n.schema):n instanceof j?E(n.innerType()):n instanceof le?[n.value]:n instanceof z?n.options:n instanceof me?b.objectValues(n.enum):n instanceof pe?E(n._def.innerType):n instanceof se?[void 0]:n instanceof ie?[null]:n instanceof Z?[void 0,...E(n.unwrap())]:n instanceof F?[null,...E(n.unwrap())]:n instanceof Re||n instanceof he?E(n.unwrap()):n instanceof fe?E(n._def.innerType):[];class Ie extends _{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return m(t,{code:u.invalid_type,expected:p.object,received:t.parsedType}),y;const r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const i of t){const c=E(i.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of c){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new Ie({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(r)})}}function Oe(n,e){const t=R(n),r=R(e);if(n===e)return{valid:!0,data:n};if(t===p.object&&r===p.object){const s=b.objectKeys(e),i=b.objectKeys(n).filter(o=>s.indexOf(o)!==-1),c={...n,...e};for(const o of i){const l=Oe(n[o],e[o]);if(!l.valid)return{valid:!1};c[o]=l.data}return{valid:!0,data:c}}else if(t===p.array&&r===p.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const c=n[i],o=e[i],l=Oe(c,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===p.date&&r===p.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class ce extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,c)=>{if(De(i)||De(c))return y;const o=Oe(i.value,c.value);return o.valid?((Ze(i)||Ze(c))&&t.dirty(),{status:t.value,value:o.data}):(m(r,{code:u.invalid_intersection_types}),y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,c])=>s(i,c)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ce.create=(n,e,t)=>new ce({left:n,right:e,typeName:g.ZodIntersection,...v(t)});class P extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return m(r,{code:u.invalid_type,expected:p.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return m(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((c,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new O(r,c,r.path,o)):null}).filter(c=>!!c);return r.common.async?Promise.all(i).then(c=>T.mergeArray(t,c)):T.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new P({...this._def,rest:e})}}P.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:n,typeName:g.ZodTuple,rest:null,...v(e)})};class ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return m(r,{code:u.invalid_type,expected:p.object,received:r.parsedType}),y;const s=[],i=this._def.keyType,c=this._def.valueType;for(const o in r.data)s.push({key:i._parse(new O(r,o,r.path,o)),value:c._parse(new O(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?T.mergeObjectAsync(t,s):T.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof _?new ue({keyType:e,valueType:t,typeName:g.ZodRecord,...v(r)}):new ue({keyType:A.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}}class we extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return m(r,{code:u.invalid_type,expected:p.map,received:r.parsedType}),y;const s=this._def.keyType,i=this._def.valueType,c=[...r.data.entries()].map(([o,l],d)=>({key:s._parse(new O(r,o,r.path,[d,"key"])),value:i._parse(new O(r,l,r.path,[d,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of c){const d=await l.key,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return y;(d.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(d.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of c){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return y;(d.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(d.value,f.value)}return{status:t.value,value:o}}}}we.create=(n,e,t)=>new we({valueType:e,keyType:n,typeName:g.ZodMap,...v(t)});class B extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return m(r,{code:u.invalid_type,expected:p.set,received:r.parsedType}),y;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(m(r,{code:u.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(m(r,{code:u.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function c(l){const d=new Set;for(const f of l){if(f.status==="aborted")return y;f.status==="dirty"&&t.dirty(),d.add(f.value)}return{status:t.value,value:d}}const o=[...r.data.values()].map((l,d)=>i._parse(new O(r,l,r.path,d)));return r.common.async?Promise.all(o).then(l=>c(l)):c(o)}min(e,t){return new B({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new B({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}B.create=(n,e)=>new B({valueType:n,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});class Y extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return m(t,{code:u.invalid_type,expected:p.function,received:t.parsedType}),y;function r(o,l){return be({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),X].filter(d=>!!d),issueData:{code:u.invalid_arguments,argumentsError:l}})}function s(o,l){return be({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),X].filter(d=>!!d),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const i={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof H){const o=this;return I(async function(...l){const d=new N([]),f=await o._def.args.parseAsync(l,i).catch(S=>{throw d.addIssue(r(l,S)),d}),x=await Reflect.apply(c,this,f);return await o._def.returns._def.type.parseAsync(x,i).catch(S=>{throw d.addIssue(s(x,S)),d})})}else{const o=this;return I(function(...l){const d=o._def.args.safeParse(l,i);if(!d.success)throw new N([r(l,d.error)]);const f=Reflect.apply(c,this,d.data),x=o._def.returns.safeParse(f,i);if(!x.success)throw new N([s(f,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Y({...this._def,args:P.create(e).rest(L.create())})}returns(e){return new Y({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Y({args:e||P.create([]).rest(L.create()),returns:t||L.create(),typeName:g.ZodFunction,...v(r)})}}class de extends _{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})}}de.create=(n,e)=>new de({getter:n,typeName:g.ZodLazy,...v(e)});class le extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(n,e)=>new le({value:n,typeName:g.ZodLiteral,...v(e)});function et(n,e){return new z({values:n,typeName:g.ZodEnum,...v(e)})}class z extends _{constructor(){super(...arguments),te.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{expected:b.joinValues(r),received:t.parsedType,code:u.invalid_type}),y}if(xe(this,te)||Xe(this,te,new Set(this._def.values)),!xe(this,te).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{received:t.data,code:u.invalid_enum_value,options:r}),y}return I(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 z.create(e,{...this._def,...t})}exclude(e,t=this._def){return z.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}te=new WeakMap;z.create=et;class me extends _{constructor(){super(...arguments),ne.set(this,void 0)}_parse(e){const t=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){const s=b.objectValues(t);return m(r,{expected:b.joinValues(s),received:r.parsedType,code:u.invalid_type}),y}if(xe(this,ne)||Xe(this,ne,new Set(b.getValidEnumValues(this._def.values))),!xe(this,ne).has(e.data)){const s=b.objectValues(t);return m(r,{received:r.data,code:u.invalid_enum_value,options:s}),y}return I(e.data)}get enum(){return this._def.values}}ne=new WeakMap;me.create=(n,e)=>new me({values:n,typeName:g.ZodNativeEnum,...v(e)});class H extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return m(t,{code:u.invalid_type,expected:p.promise,received:t.parsedType}),y;const r=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return I(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}H.create=(n,e)=>new H({type:n,typeName:g.ZodPromise,...v(e)});class j extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:c=>{m(r,c),c.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const c=s.transform(r.data,i);if(r.common.async)return Promise.resolve(c).then(async o=>{if(t.value==="aborted")return y;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?Q(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:c,path:r.path,parent:r});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?Q(o.value):o}}if(s.type==="refinement"){const c=o=>{const l=s.refinement(o,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),c(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),c(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!U(c))return c;const o=s.transform(c.value,i);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:r.data,path:r.path,parent:r}).then(c=>U(c)?Promise.resolve(s.transform(c.value,i)).then(o=>({status:t.value,value:o})):c);b.assertNever(s)}}j.create=(n,e,t)=>new j({schema:n,typeName:g.ZodEffects,effect:e,...v(t)});j.createWithPreprocess=(n,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:n},typeName:g.ZodEffects,...v(t)});class Z extends _{_parse(e){return this._getType(e)===p.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Z.create=(n,e)=>new Z({innerType:n,typeName:g.ZodOptional,...v(e)});class F extends _{_parse(e){return this._getType(e)===p.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(n,e)=>new F({innerType:n,typeName:g.ZodNullable,...v(e)});class pe extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pe.create=(n,e)=>new pe({innerType:n,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class fe extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return re(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new N(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new N(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}fe.create=(n,e)=>new fe({innerType:n,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Te extends _{_parse(e){if(this._getType(e)!==p.nan){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.nan,received:r.parsedType}),y}return{status:"valid",value:e.data}}}Te.create=n=>new Te({typeName:g.ZodNaN,...v(n)});const Bt=Symbol("zod_brand");class Re extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ge extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?y:i.status==="dirty"?(t.dirty(),Q(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new ge({in:e,out:t,typeName:g.ZodPipeline})}}class he extends _{_parse(e){const t=this._def.innerType._parse(e),r=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return re(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}he.create=(n,e)=>new he({innerType:n,typeName:g.ZodReadonly,...v(e)});function Qe(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function tt(n,e={},t){return n?J.create().superRefine((r,s)=>{var i,c;const o=n(r);if(o instanceof Promise)return o.then(l=>{var d,f;if(!l){const x=Qe(e,r),w=(f=(d=x.fatal)!==null&&d!==void 0?d:t)!==null&&f!==void 0?f:!0;s.addIssue({code:"custom",...x,fatal:w})}});if(!o){const l=Qe(e,r),d=(c=(i=l.fatal)!==null&&i!==void 0?i:t)!==null&&c!==void 0?c:!0;s.addIssue({code:"custom",...l,fatal:d})}}):J.create()}const Wt={object:k.lazycreate};var g;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(g||(g={}));const Qt=(n,e={message:`Input not instance of ${n.name}`})=>tt(t=>t instanceof n,e),nt=A.create,rt=$.create,Yt=Te.create,Gt=V.create,at=ae.create,Xt=q.create,Jt=ke.create,Ht=se.create,Kt=ie.create,en=J.create,tn=L.create,nn=M.create,rn=Se.create,an=C.create,sn=k.create,on=k.strictCreate,cn=oe.create,un=Ie.create,dn=ce.create,ln=P.create,mn=ue.create,pn=we.create,fn=B.create,hn=Y.create,gn=de.create,yn=le.create,vn=z.create,_n=me.create,bn=H.create,Ye=j.create,xn=Z.create,kn=F.create,Sn=j.createWithPreprocess,wn=ge.create,Tn=()=>nt().optional(),In=()=>rt().optional(),Nn=()=>at().optional(),An={string:n=>A.create({...n,coerce:!0}),number:n=>$.create({...n,coerce:!0}),boolean:n=>ae.create({...n,coerce:!0}),bigint:n=>V.create({...n,coerce:!0}),date:n=>q.create({...n,coerce:!0})},Cn=y;var a=Object.freeze({__proto__:null,defaultErrorMap:X,setErrorMap:kt,getErrorMap:_e,makeIssue:be,EMPTY_PATH:St,addIssueToContext:m,ParseStatus:T,INVALID:y,DIRTY:Q,OK:I,isAborted:De,isDirty:Ze,isValid:U,isAsync:re,get util(){return b},get objectUtil(){return je},ZodParsedType:p,getParsedType:R,ZodType:_,datetimeRegex:Ke,ZodString:A,ZodNumber:$,ZodBigInt:V,ZodBoolean:ae,ZodDate:q,ZodSymbol:ke,ZodUndefined:se,ZodNull:ie,ZodAny:J,ZodUnknown:L,ZodNever:M,ZodVoid:Se,ZodArray:C,ZodObject:k,ZodUnion:oe,ZodDiscriminatedUnion:Ie,ZodIntersection:ce,ZodTuple:P,ZodRecord:ue,ZodMap:we,ZodSet:B,ZodFunction:Y,ZodLazy:de,ZodLiteral:le,ZodEnum:z,ZodNativeEnum:me,ZodPromise:H,ZodEffects:j,ZodTransformer:j,ZodOptional:Z,ZodNullable:F,ZodDefault:pe,ZodCatch:fe,ZodNaN:Te,BRAND:Bt,ZodBranded:Re,ZodPipeline:ge,ZodReadonly:he,custom:tt,Schema:_,ZodSchema:_,late:Wt,get ZodFirstPartyTypeKind(){return g},coerce:An,any:en,array:an,bigint:Gt,boolean:at,date:Xt,discriminatedUnion:un,effect:Ye,enum:vn,function:hn,instanceof:Qt,intersection:dn,lazy:gn,literal:yn,map:pn,nan:Yt,nativeEnum:_n,never:nn,null:Kt,nullable:kn,number:rt,object:sn,oboolean:Nn,onumber:In,optional:xn,ostring:Tn,pipeline:wn,preprocess:Sn,promise:bn,record:mn,set:fn,strictObject:on,string:nt,symbol:Jt,transformer:Ye,tuple:ln,undefined:Ht,union:cn,unknown:tn,void:rn,NEVER:Cn,ZodIssueCode:u,quotelessJson:xt,ZodError:N});const ye=a.object({country:a.string().optional(),city:a.string().optional(),street:a.string().optional(),streetNumber:a.string().optional(),floor:a.string().optional(),apartmentEnterNumber:a.string().optional(),apartmentNumber:a.string().optional()}),D=a.string().min(1,{message:"שדה חובה"}),jn=a.string().regex(/^\d+$/,"Must be a numeric string"),Dn=a.object({url:a.string().url(),id:a.string()});function Zn(n){return!!(n!=null&&n.url)}const G=a.object({lang:a.enum(["he"]),value:a.string()}),On=a.array(G),Me=a.object({id:a.string().min(1),companyId:a.string().min(1),storeId:a.string().min(1),parentId:a.string().nullish(),tag:a.string().optional(),locales:a.array(G),depth:a.number()}),Ne=Me.extend({children:a.lazy(()=>Ne.array())}),Pn=Me.extend({index:a.number(),depth:a.number(),collapsed:a.boolean().optional(),children:a.array(Ne)}),ee=a.string().min(1),$e=a.object({type:a.literal("Product"),storeId:ee,companyId:ee,id:ee,objectID:ee,sku:ee,name:a.array(G),description:a.array(G),isPublished:a.boolean(),vat:a.boolean(),priceType:a.object({type:a.enum(["unit","kg","gram","liter","ml"]),value:a.number()}),price:a.number().positive(),purchasePrice:a.number().optional(),profitPercentage:a.number().optional(),currency:a.literal("ILS"),discount:a.object({type:a.enum(["number","percent","none"]),value:a.number()}),isDiscountable:a.boolean({description:"included in store discounts"}).optional(),weight:a.object({value:a.number(),unit:a.enum(["kg","gram","none"])}),volume:a.object({value:a.number(),unit:a.enum(["liter","ml","none"])}),images:a.array(a.object({url:a.string().url(),id:a.string()})),manufacturer:a.string(),brand:a.string(),importer:a.string(),supplier:a.string(),ingredients:a.array(G),created_at:a.number(),updated_at:a.number(),categoryIds:a.array(a.string().nonempty()),stock:a.object({quantity:a.number().min(0),unit:a.enum(["piece","kg","gram","liter","ml"])}).optional(),categoryList:a.array(Ne).optional(),categories:a.object({lvl0:a.array(a.string()),lvl1:a.array(a.string()),lvl2:a.array(a.string()),lvl3:a.array(a.string()),lvl4:a.array(a.string())}).optional(),categoryNames:a.array(a.string()).optional()}),En=$e.extend({image:a.instanceof(File).optional()}),Ve=a.object({product:$e,originalPrice:a.number().optional(),finalPrice:a.number().optional(),finalDiscount:a.number().optional(),amount:a.number().positive({message:"Quantity must be a positive number."})}),Rn=a.object({type:a.literal("Cart"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),status:a.enum(["active","draft","completed"]),items:a.array(Ve)}),Mn=a.object({id:a.string(),name:a.string(),websiteDomains:a.array(a.string())}),$n=a.object({type:a.literal("FavoriteProduct"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),productId:a.string().uuid()}),ve=a.enum(["external","j5","none"]),st=a.object({type:a.literal("Profile"),id:D,companyId:D,storeId:D,tenantId:D,clientType:a.enum(["user","company"]),companyName:a.string().optional(),displayName:D,email:a.string().email(),phoneNumber:a.string().optional(),address:ye.optional(),isAnonymous:a.boolean(),createdDate:a.number(),lastActivityDate:a.number(),paymentType:ve.optional(),organizationId:a.string().optional().nullable()}),ze=a.object({_COMMENT:a.string().optional(),transaction_id:a.string(),date:a.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),currency:a.string().length(3,"Currency must be 3 characters"),rate:a.number().positive(),vat:a.string().regex(/^\d+\.\d{2}$/,"VAT must be in format XX.XX"),vat_price:a.number().positive(),price_discount:a.number(),price_discount_in_currency:a.number(),price_total:a.string().regex(/^\d+\.\d{2}$/,"Price total must be in format XX.XX"),price_total_in_currency:a.number().positive()}),it=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:ze,warning:a.string().optional(),date:a.number().optional()}),ot=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.number().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),Fe=a.object({number:a.string(),name:a.string(),id:a.string()}),ct=a.object({id:a.string(),name:a.string(),discountPercentage:a.number().positive().min(0).max(100).optional(),nameOnInvoice:a.string().optional(),billingAccounts:a.array(Fe),paymentType:ve,companyNumber:a.string().optional(),address:ye.optional(),groupId:a.string().optional()}),Vn=ct.omit({id:!0}),zn=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:ze,warning:a.string().optional(),date:a.number().optional()}),Fn=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.string().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),Ln=a.object({type:a.literal("Order"),createdBy:a.enum(["user","admin"]).optional(),id:D,companyId:D,storeId:D,userId:D,status:a.enum(["draft","pending","processing","in_delivery","delivered","cancelled","completed","refunded"]),paymentType:ve.optional(),paymentStatus:a.enum(["pending","pending_j5","external","completed","failed","refunded"]),cart:a.object({id:a.string(),items:a.array(Ve),cartDiscount:a.number(),cartTotal:a.number(),cartVat:a.number(),deliveryPrice:a.number().optional()}),storeOptions:a.object({deliveryPrice:a.number().optional(),freeDeliveryPrice:a.number().optional(),isVatIncludedInPrice:a.boolean().optional()}).optional(),originalAmount:a.number().positive().optional(),actualAmount:a.number().positive().optional(),date:a.number(),deliveryDate:a.coerce.number(),client:st.optional(),address:ye.optional(),nameOnInvoice:a.string().optional(),emailOnInvoice:a.string().email().optional(),phoneNumberOnInvoice:a.string().optional(),clientComment:a.string().optional(),organizationId:a.string().optional(),billingAccount:Fe.optional(),deliveryNote:ot.optional(),invoice:Fn.optional(),ezInvoice:zn.optional(),ezDeliveryNote:it.optional()}),ut=a.enum(["individual","company"]),Un=a.object({id:a.string(),companyId:a.string(),name:a.string(),urls:a.array(a.string()),logoUrl:a.string(),tenantId:a.string(),paymentType:ve,allowAnonymousClients:a.boolean(),isVatIncludedInPrice:a.boolean(),clientTypes:a.array(ut),minimumOrder:a.number().optional(),freeDeliveryPrice:a.number().optional(),deliveryPrice:a.number().optional(),address:ye.optional(),companyNumber:a.string().optional()}),dt=a.object({minSpend:a.number().positive().optional(),stackable:a.boolean().default(!1)}).optional(),lt=a.discriminatedUnion("variantType",[a.object({variantType:a.literal("bundle"),productsId:a.array(a.string().nonempty()).min(1),requiredQuantity:a.number().positive(),bundlePrice:a.number().positive()})]),qn=a.object({type:a.literal("Discount"),storeId:a.string().min(1),companyId:a.string().min(1),id:a.string().min(1),name:a.array(a.object({lang:a.enum(["he"]),value:a.string().nonempty()})),active:a.boolean(),startDate:a.number(),endDate:a.number(),variant:lt,conditions:dt});class mt{canApply(e,t){if(e.variant.variantType!=="bundle"||!this.isDiscountActive(e))return!1;const{productsId:r,requiredQuantity:s}=e.variant;return this.getTotalQuantity(t.cart,r)>=s}calculate(e,t){if(e.variant.variantType!=="bundle")return{applicable:!1,discountAmount:0,affectedItems:[]};const{productsId:r,requiredQuantity:s,bundlePrice:i}=e.variant,c=t.cart.filter(K=>r.includes(K.product.id)),o=this.getTotalQuantity(t.cart,r),l=Math.floor(o/s);if(l===0)return{applicable:!1,discountAmount:0,affectedItems:[]};const d=this.calculateOriginalPrice(c),f=this.getTotalQuantity(t.cart,r),x=this.calculateDiscountedPrice(d,i,l,s,f),w=d-x,S=this.distributeDiscount(c,w,d);return{applicable:!0,discountAmount:Number(w.toFixed(2)),affectedItems:S}}isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}getTotalQuantity(e,t){return e.filter(r=>t.includes(r.product.id)).reduce((r,s)=>r+s.amount,0)}calculateOriginalPrice(e){return e.reduce((t,r)=>t+r.product.price*r.amount,0)}calculateDiscountedPrice(e,t,r,s,i){const c=t*r,o=r*s,d=Math.max(0,i-o)/i*e;return c+d}distributeDiscount(e,t,r){const s=t/r;return e.map(i=>{const c=i.product.price*i.amount*s;return{productId:i.product.id,quantity:i.amount,originalPrice:Number(i.product.price.toFixed(2)),discountedPrice:Number((i.product.price-c/i.amount).toFixed(2)),discountAmount:Number(c.toFixed(2))}})}}class Le{static getStrategy(e){return this.strategies.get(e.variant.variantType)||null}static registerStrategy(e,t){this.strategies.set(e,t)}static getRegisteredTypes(){return Array.from(this.strategies.keys())}static clearStrategies(){this.strategies.clear()}}Be(Le,"strategies",new Map([["bundle",new mt]]));class Bn{static calculateDiscounts(e,t,r){var d,f;const s={cart:e,user:r,appliedDiscounts:[]},i=this.filterActiveDiscounts(t),c=[];for(const x of i){const w=Le.getStrategy(x);if(!w||!w.canApply(x,s)||!((d=x.conditions)!=null&&d.stackable)&&c.length>0)continue;const S=w.calculate(x,s);S.applicable&&(c.push({discountId:x.id,discountName:((f=x.name[0])==null?void 0:f.value)||"Discount",discountAmount:Number(S.discountAmount.toFixed(2)),affectedItems:S.affectedItems}),s.appliedDiscounts=c)}const o=this.calculateFinalPrices(e,c),l=c.reduce((x,w)=>x+w.discountAmount,0);return{items:o,totalDiscount:Number(l.toFixed(2)),appliedDiscounts:c}}static filterActiveDiscounts(e){const t=Date.now();return e.filter(r=>r.active&&r.startDate<=t&&r.endDate>=t)}static calculateFinalPrices(e,t){return e.map(r=>{const s=t.filter(l=>l.affectedItems.some(d=>d.productId===r.product.id)),i=s.reduce((l,d)=>{const f=d.affectedItems.find(x=>x.productId===r.product.id);return l+((f==null?void 0:f.discountAmount)||0)},0),c=i/r.amount,o=r.product.price-c;return{amount:r.amount,product:r.product,originalPrice:Number(r.product.price.toFixed(2)),finalPrice:Number(Math.max(0,o).toFixed(2)),finalDiscount:Number(i.toFixed(2)),appliedDiscounts:s.map(l=>l.discountId)}})}static isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}static getActiveDiscounts(e){return this.filterActiveDiscounts(e)}}function Ue(n){return Number(n.toFixed(2))}function Wn(n){return n.toFixed(2)}function Qn(n){return Math.max(0,Ue(n))}function Yn(n,e){if(n<=0)return 0;const t=n-e;return Ue(t/n*100)}const pt=a.object({id:a.string(),name:a.string()}),Gn=pt.omit({id:!0}),qe=a.object({type:a.literal("Supplier"),id:a.string(),name:a.string(),code:a.string()}),Xn=qe.omit({id:!0}),ft=a.object({type:a.literal("SupplierInvoice"),id:a.string(),supplier:qe,invoiceNumber:a.string(),date:a.number(),rows:a.array(a.object({id:a.string(),rowNumber:a.number(),sku:a.string(),itemName:a.string(),quantity:a.number(),purchasePrice:a.number(),lineDiscount:a.number(),profitPercentage:a.number(),price:a.number(),totalPurchasePrice:a.number(),vat:a.boolean(),originalProduct:a.object({purchasePrice:a.number(),price:a.number(),profitPercentage:a.number()}).optional()})),productsToUpdate:a.array(a.object({sku:a.string(),itemName:a.string(),oldPurchasePrice:a.number(),newPurchasePrice:a.number(),oldPrice:a.number(),newPrice:a.number(),oldProfitPercentage:a.number(),newProfitPercentage:a.number()})),total:a.number().optional(),totalBeforeVat:a.number().optional(),vat:a.number().optional()}),Jn=ft.omit({id:!0}),Hn=a.object({type:a.literal("ChatSession"),id:a.string(),storeId:a.string(),companyId:a.string(),tenantId:a.string(),userId:a.string().nullable(),userType:a.enum(["anonymous","client","admin","superAdmin"]),createdAt:a.number(),updatedAt:a.number(),messageCount:a.number(),status:a.enum(["active","archived"])}),Kn=a.discriminatedUnion("type",[a.object({type:a.literal("message"),id:a.string(),role:a.enum(["user","assistant","system"]),content:a.string(),timestamp:a.number()}),a.object({type:a.literal("function_call"),id:a.string(),name:a.string(),arguments:a.record(a.string(),a.any()),timestamp:a.number()}),a.object({type:a.literal("tool_result"),id:a.string(),name:a.string(),result:a.any(),timestamp:a.number()})]),ht=a.enum(["order_created","payment_received","order_cancelled","order_refunded","credit_note","debit_note"]),gt=a.enum(["check","bank_transfer","cash","credit_card","other"]),er=a.object({id:a.string(),type:ht,debt:a.number(),runningBalance:a.number(),orderId:a.string().nullable(),orderTotal:a.number().nullable(),billingAccountId:a.string().nullable(),billingAccountName:a.string().nullable(),billingAccountNumber:a.string().nullable(),paymentReference:a.string().nullable(),paymentDate:a.number().nullable(),paymentMethod:gt.nullable(),note:a.string().nullable(),createdAt:a.number(),createdBy:a.string()}),tr=a.object({id:a.string(),organizationId:a.string(),organizationName:a.string(),companyId:a.string(),storeId:a.string(),totalDebits:a.number(),totalCredits:a.number(),balance:a.number(),currency:a.literal("ILS"),updatedAt:a.number()}),Pe={VAT:18};function nr(n,e){var t,r;return((t=n.discount)==null?void 0:t.type)==="percent"?n.price*(n.discount.value??100)/100:((r=n.discount)==null?void 0:r.type)==="number"?n.discount.value??0:0}function rr(n,e){var r,s;const t=e&&n.vat?n.price+n.price*Pe.VAT/100:n.price;if(((r=n.discount)==null?void 0:r.type)==="percent"){const i=t*n.discount.value/100;return n.price-i}return((s=n.discount)==null?void 0:s.type)==="number"?t-n.discount.value:t}function ar({cart:n,discounts:e,deliveryPrice:t=0,freeDeliveryPrice:r=0,isVatIncludedInPrice:s=!1}){const i=n.map((o,l)=>({amount:o.amount,product:{...o.product},originalPrice:o.product.price,finalPrice:rr(o.product,s),finalDiscount:nr(o.product)})),c=i.reduce((o,l)=>{const{product:d,amount:f,finalPrice:x,finalDiscount:w}=l;let S=0;if(d.vat){let Ae=0;if(s){const yt=Number((x/(1+Pe.VAT/100)).toFixed(2)),vt=x-yt;S=Number(vt.toFixed(2)),S=S*f,Ae=Number(S.toFixed(2))}else S=x*Pe.VAT/100,S=S*f,Ae=Number(S.toFixed(2));o.vat=Number((o.vat+Ae).toFixed(2))}const K=Number(x.toFixed(2));return o.cost+=f*K,o.discount+=w&&f*w,o.finalCost+=f*K+(s?0:S),o.productsCost+=f*K+(s?0:S),o.cost=Number(o.cost.toFixed(2)),o.discount=Number(o.discount.toFixed(2)),o.finalCost=Number(o.finalCost.toFixed(2)),o.productsCost=Number(o.productsCost.toFixed(2)),o},{discount:0,cost:0,finalCost:0,vat:0,productsCost:0,deliveryPrice:t});return c.deliveryPrice&&c.productsCost>=r?c.deliveryPrice=0:c.finalCost+=c.deliveryPrice,{items:i,...c}}const sr={stores:"STORES",companies:"COMPANIES"},ir={products:"products","favorite-products":"favorite-products",profiles:"profiles",cart:"cart",clients:"clients",orders:"orders",categories:"categories",payments:"payments",settings:"settings",discounts:"discounts",organizations:"organizations",organizationGroups:"organizationGroups",invoices:"invoices",suppliers:"suppliers",supplierInvoices:"supplierInvoices",chatSessions:"chatSessions",chatSessionMessages:"chatSessionMessages",contactSubmissions:"contactSubmissions",budgetAccounts:"budgetAccounts",budgetTransactions:"budgetTransactions"},or={systemCollections:sr,storeCollections:ir,getPath:({companyId:n,storeId:e,collectionName:t,id:r})=>`${n}/${e}/${t}${r?`/${r}`:""}`,getSubPath:({companyId:n,storeId:e,collectionName:t,subCollectionName:r,id:s,subId:i})=>`${n}/${e}/${t}/${s}/${r}${i?`/${i}`:""}`,getDocPath:n=>`{companyId}/{storeId}/${n}/{id}`,getSubDocPath:(n,e,t)=>`{companyId}/{storeId}/${n}/${e}/${t}/{id}`},cr={firestore:or},Ee={round:(n,e=2)=>{const t=10**e;return Math.round((n+Number.EPSILON)*t)/t}},ur={calcSalePriceFromMargin:(n,e)=>n<=0||e<=0||n>=100?e:Ee.round(e/(1-n/100)),calcMarginFromSalePrice:(n,e)=>n<=0||e<=0?0:Ee.round((n-e)/n*100)};exports.AddressSchema=ye;exports.BaseCategorySchema=Me;exports.BillingAccountSchema=Fe;exports.BudgetAccountSchema=tr;exports.BudgetTransactionSchema=er;exports.BudgetTransactionTypeSchema=ht;exports.BundleDiscountStrategy=mt;exports.CalculatedDataSchema=ze;exports.CartItemProductSchema=Ve;exports.CartSchema=Rn;exports.CategorySchema=Ne;exports.ChatSessionMessageSchema=Kn;exports.ChatSessionSchema=Hn;exports.CompanySchema=Mn;exports.DeliveryNoteSchema=ot;exports.DiscountConditionsSchema=dt;exports.DiscountEngine=Bn;exports.DiscountSchema=qn;exports.DiscountStrategyFactory=Le;exports.DiscountVariantSchema=lt;exports.EzDeliveryNoteSchema=it;exports.FavoriteProductSchema=$n;exports.FileSchema=Dn;exports.FirebaseAPI=cr;exports.LocaleSchema=G;exports.LocaleValueSchema=On;exports.NewOrganizationGroupSchema=Gn;exports.NewOrganizationSchema=Vn;exports.NewProductSchema=En;exports.NewSupplierInvoiceSchema=Jn;exports.NewSupplierSchema=Xn;exports.OrderSchema=Ln;exports.OrganizationGroupSchema=pt;exports.OrganizationSchema=ct;exports.PaymentMethodSchema=gt;exports.PaymentTypeSchema=ve;exports.ProductSchema=$e;exports.ProfileSchema=st;exports.StoreSchema=Un;exports.SupplierInvoiceSchema=ft;exports.SupplierSchema=qe;exports.TFlattenCategorySchema=Pn;exports.calculatePercentageDiscount=Yn;exports.clientTypesSchema=ut;exports.ensureNonNegative=Qn;exports.formatCurrency=Ue;exports.formatCurrencyString=Wn;exports.getCartCost=ar;exports.isFile=Zn;exports.math=Ee;exports.notEmptyTextSchema=D;exports.numericTextSchema=jn;exports.storeCalculator=ur;
1
+ "use strict";var _t=Object.defineProperty;var bt=(n,e,t)=>e in n?_t(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Be=(n,e,t)=>bt(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b;(function(n){n.assertEqual=s=>s;function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const c of s)i[c]=c;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),c={};for(const o of i)c[o]=s[o];return n.objectValues(c)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const c in s)Object.prototype.hasOwnProperty.call(s,c)&&i.push(c);return i},n.find=(s,i)=>{for(const c of s)if(i(c))return c},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(b||(b={}));var je;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(je||(je={}));const p=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),R=n=>{switch(typeof n){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(n)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(n)?p.array:n===null?p.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?p.promise:typeof Map<"u"&&n instanceof Map?p.map:typeof Set<"u"&&n instanceof Set?p.set:typeof Date<"u"&&n instanceof Date?p.date:p.object;default:return p.unknown}},u=b.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"]),xt=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class N extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(i){return i.message},r={_errors:[]},s=i=>{for(const c of i.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)r._errors.push(t(c));else{let o=r,l=0;for(;l<c.path.length;){const d=c.path[l];l===c.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(c))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return s(this),r}static assert(e){if(!(e instanceof N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];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))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=n=>new N(n);const X=(n,e)=>{let t;switch(n.code){case u.invalid_type:n.received===p.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,b.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(n.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(n.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:b.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case u.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case u.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(n)}return{message:t}};let Ge=X;function kt(n){Ge=n}function _e(){return Ge}const be=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],c={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)o=d(c,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},St=[];function m(n,e){const t=_e(),r=be({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===X?void 0:X].filter(s=>!!s)});n.common.issues.push(r)}class T{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,c=await s.value;r.push({key:i,value:c})}return T.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:c}=s;if(i.status==="aborted"||c.status==="aborted")return y;i.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof c.value<"u"||s.alwaysSet)&&(r[i.value]=c.value)}return{status:e.value,value:r}}}const y=Object.freeze({status:"aborted"}),Q=n=>({status:"dirty",value:n}),I=n=>({status:"valid",value:n}),De=n=>n.status==="aborted",Ze=n=>n.status==="dirty",U=n=>n.status==="valid",re=n=>typeof Promise<"u"&&n instanceof Promise;function xe(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Xe(n,e,t,r,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var h;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(h||(h={}));var te,ne;class O{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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 We=(n,e)=>{if(U(e))return{success:!0,data:e.value};if(!n.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 N(n.common.issues);return this._error=t,this._error}}};function v(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))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:(c,o)=>{var l,d;const{message:f}=n;return c.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(l=f??r)!==null&&l!==void 0?l:o.defaultError}:c.code!=="invalid_type"?{message:o.defaultError}:{message:(d=f??t)!==null&&d!==void 0?d:o.defaultError}},description:s}}class _{get description(){return this._def.description}_getType(e){return R(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new T,ctx:{common:e.parent.common,data:e.data,parsedType:R(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)},i=this._parseSync({data:e,path:s.path,parent:s});return We(s,i)}"~validate"(e){var t,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:R(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return U(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>U(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:R(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(re(s)?s:Promise.resolve(s));return We(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const c=e(s),o=()=>i.addIssue({code:u.custom,...r(s)});return typeof Promise<"u"&&c instanceof Promise?c.then(l=>l?!0:(o(),!1)):c?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new j({schema:this,typeName:g.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 Z.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return H.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new j({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new pe({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new Re({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new fe({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wt=/^c[^\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,It=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nt=/^[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,At=/^[a-z0-9_-]{21}$/i,Ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jt=/^[-+]?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)?)??$/,Dt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ce;const Ot=/^(?:(?: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])$/,Pt=/^(?:(?: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])$/,Et=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Je="((\\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])))",Vt=new RegExp(`^${Je}$`);function He(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function zt(n){return new RegExp(`^${He(n)}$`)}function Ke(n){let e=`${Je}T${He(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ft(n,e){return!!((e==="v4"||!e)&&Ot.test(n)||(e==="v6"||!e)&&Et.test(n))}function Lt(n,e){if(!Ct.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ut(n,e){return!!((e==="v4"||!e)&&Pt.test(n)||(e==="v6"||!e)&&Rt.test(n))}class A extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_type,expected:p.string,received:i.parsedType}),y}const r=new T;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const c=e.data.length>i.value,o=e.data.length<i.value;(c||o)&&(s=this._getOrReturnCtx(e,s),c?m(s,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(s,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Dt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ce||(Ce=new RegExp(Zt,"u")),Ce.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Nt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")At.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")It.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:u.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:u.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ke(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Vt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?zt(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:u.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?jt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Ft(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Lt(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ut(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Mt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?$t.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:u.invalid_string,message:i.message}),r.dirty()):b.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:u.invalid_string,...h.errToObj(r)})}_addCheck(e){return new A({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){var t,r;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:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...h.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,...h.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...h.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new A({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new A({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new A({...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}}A.create=n=>{var e;return new A({checks:[],typeName:g.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...v(n)})};function qt(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=parseInt(n.toFixed(s).replace(".","")),c=parseInt(e.toFixed(s).replace(".",""));return i%c/Math.pow(10,s)}class $ extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_type,expected:p.number,received:i.parsedType}),y}let r;const s=new T;for(const i of this._def.checks)i.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?qt(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_finite,message:i.message}),s.dirty()):b.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,s){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(s)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.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"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}$.create=n=>new $({checks:[],typeName:g.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...v(n)});class V extends _{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)!==p.bigint)return this._getInvalidInput(e);let r;const s=new T;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):b.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:p.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,s){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(s)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.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}}V.create=n=>{var e;return new V({checks:[],typeName:g.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...v(n)})};class ae extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.boolean,received:r.parsedType}),y}return I(e.data)}}ae.create=n=>new ae({typeName:g.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...v(n)});class q extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_type,expected:p.date,received:i.parsedType}),y}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:u.invalid_date}),y}const r=new T;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):b.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.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}}q.create=n=>new q({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:g.ZodDate,...v(n)});class ke extends _{_parse(e){if(this._getType(e)!==p.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.symbol,received:r.parsedType}),y}return I(e.data)}}ke.create=n=>new ke({typeName:g.ZodSymbol,...v(n)});class se extends _{_parse(e){if(this._getType(e)!==p.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.undefined,received:r.parsedType}),y}return I(e.data)}}se.create=n=>new se({typeName:g.ZodUndefined,...v(n)});class ie extends _{_parse(e){if(this._getType(e)!==p.null){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.null,received:r.parsedType}),y}return I(e.data)}}ie.create=n=>new ie({typeName:g.ZodNull,...v(n)});class J extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}J.create=n=>new J({typeName:g.ZodAny,...v(n)});class L extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}L.create=n=>new L({typeName:g.ZodUnknown,...v(n)});class M extends _{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:u.invalid_type,expected:p.never,received:t.parsedType}),y}}M.create=n=>new M({typeName:g.ZodNever,...v(n)});class Se extends _{_parse(e){if(this._getType(e)!==p.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.void,received:r.parsedType}),y}return I(e.data)}}Se.create=n=>new Se({typeName:g.ZodVoid,...v(n)});class C extends _{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return m(t,{code:u.invalid_type,expected:p.array,received:t.parsedType}),y;if(s.exactLength!==null){const c=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(c||o)&&(m(t,{code:c?u.too_big:u.too_small,minimum:o?s.exactLength.value:void 0,maximum:c?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:u.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:u.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((c,o)=>s.type._parseAsync(new O(t,c,t.path,o)))).then(c=>T.mergeArray(r,c));const i=[...t.data].map((c,o)=>s.type._parseSync(new O(t,c,t.path,o)));return T.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(n,e)=>new C({type:n,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function W(n){if(n instanceof k){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=Z.create(W(r))}return new k({...n._def,shape:()=>e})}else return n instanceof C?new C({...n._def,type:W(n.element)}):n instanceof Z?Z.create(W(n.unwrap())):n instanceof F?F.create(W(n.unwrap())):n instanceof P?P.create(n.items.map(e=>W(e))):n}class k extends _{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=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){const d=this._getOrReturnCtx(e);return m(d,{code:u.invalid_type,expected:p.object,received:d.parsedType}),y}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:c}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const d in s.data)c.includes(d)||o.push(d);const l=[];for(const d of c){const f=i[d],x=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new O(s,x,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof M){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of o)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")o.length>0&&(m(s,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of o){const x=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new O(s,x,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const x=await f.key,w=await f.value;d.push({key:x,value:w,alwaysSet:f.alwaysSet})}return d}).then(d=>T.mergeObjectSync(r,d)):T.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var s,i,c,o;const l=(c=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,t,r).message)!==null&&c!==void 0?c:r.defaultError;return t.code==="unrecognized_keys"?{message:(o=h.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({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 k({...this._def,catchall:e})}pick(e){const t={};return b.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return b.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new k({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){const t={};return b.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return b.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Z;)i=i._def.innerType;t[r]=i}}),new k({...this._def,shape:()=>t})}keyof(){return et(b.objectKeys(this.shape))}}k.create=(n,e)=>new k({shape:()=>n,unknownKeys:"strip",catchall:M.create(),typeName:g.ZodObject,...v(e)});k.strictCreate=(n,e)=>new k({shape:()=>n,unknownKeys:"strict",catchall:M.create(),typeName:g.ZodObject,...v(e)});k.lazycreate=(n,e)=>new k({shape:n,unknownKeys:"strip",catchall:M.create(),typeName:g.ZodObject,...v(e)});class oe extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const c=i.map(o=>new N(o.ctx.common.issues));return m(t,{code:u.invalid_union,unionErrors:c}),y}if(t.common.async)return Promise.all(r.map(async i=>{const c={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(s);{let i;const c=[];for(const l of r){const d={...t,common:{...t.common,issues:[]},parent:null},f=l._parseSync({data:t.data,path:t.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&c.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=c.map(l=>new N(l));return m(t,{code:u.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}oe.create=(n,e)=>new oe({options:n,typeName:g.ZodUnion,...v(e)});const E=n=>n instanceof de?E(n.schema):n instanceof j?E(n.innerType()):n instanceof le?[n.value]:n instanceof z?n.options:n instanceof me?b.objectValues(n.enum):n instanceof pe?E(n._def.innerType):n instanceof se?[void 0]:n instanceof ie?[null]:n instanceof Z?[void 0,...E(n.unwrap())]:n instanceof F?[null,...E(n.unwrap())]:n instanceof Re||n instanceof he?E(n.unwrap()):n instanceof fe?E(n._def.innerType):[];class Ie extends _{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return m(t,{code:u.invalid_type,expected:p.object,received:t.parsedType}),y;const r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const i of t){const c=E(i.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of c){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new Ie({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(r)})}}function Oe(n,e){const t=R(n),r=R(e);if(n===e)return{valid:!0,data:n};if(t===p.object&&r===p.object){const s=b.objectKeys(e),i=b.objectKeys(n).filter(o=>s.indexOf(o)!==-1),c={...n,...e};for(const o of i){const l=Oe(n[o],e[o]);if(!l.valid)return{valid:!1};c[o]=l.data}return{valid:!0,data:c}}else if(t===p.array&&r===p.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const c=n[i],o=e[i],l=Oe(c,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===p.date&&r===p.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class ce extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,c)=>{if(De(i)||De(c))return y;const o=Oe(i.value,c.value);return o.valid?((Ze(i)||Ze(c))&&t.dirty(),{status:t.value,value:o.data}):(m(r,{code:u.invalid_intersection_types}),y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,c])=>s(i,c)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ce.create=(n,e,t)=>new ce({left:n,right:e,typeName:g.ZodIntersection,...v(t)});class P extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return m(r,{code:u.invalid_type,expected:p.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return m(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((c,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new O(r,c,r.path,o)):null}).filter(c=>!!c);return r.common.async?Promise.all(i).then(c=>T.mergeArray(t,c)):T.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new P({...this._def,rest:e})}}P.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:n,typeName:g.ZodTuple,rest:null,...v(e)})};class ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return m(r,{code:u.invalid_type,expected:p.object,received:r.parsedType}),y;const s=[],i=this._def.keyType,c=this._def.valueType;for(const o in r.data)s.push({key:i._parse(new O(r,o,r.path,o)),value:c._parse(new O(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?T.mergeObjectAsync(t,s):T.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof _?new ue({keyType:e,valueType:t,typeName:g.ZodRecord,...v(r)}):new ue({keyType:A.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}}class we extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return m(r,{code:u.invalid_type,expected:p.map,received:r.parsedType}),y;const s=this._def.keyType,i=this._def.valueType,c=[...r.data.entries()].map(([o,l],d)=>({key:s._parse(new O(r,o,r.path,[d,"key"])),value:i._parse(new O(r,l,r.path,[d,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of c){const d=await l.key,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return y;(d.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(d.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of c){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return y;(d.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(d.value,f.value)}return{status:t.value,value:o}}}}we.create=(n,e,t)=>new we({valueType:e,keyType:n,typeName:g.ZodMap,...v(t)});class B extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return m(r,{code:u.invalid_type,expected:p.set,received:r.parsedType}),y;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(m(r,{code:u.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(m(r,{code:u.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function c(l){const d=new Set;for(const f of l){if(f.status==="aborted")return y;f.status==="dirty"&&t.dirty(),d.add(f.value)}return{status:t.value,value:d}}const o=[...r.data.values()].map((l,d)=>i._parse(new O(r,l,r.path,d)));return r.common.async?Promise.all(o).then(l=>c(l)):c(o)}min(e,t){return new B({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new B({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}B.create=(n,e)=>new B({valueType:n,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});class Y extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return m(t,{code:u.invalid_type,expected:p.function,received:t.parsedType}),y;function r(o,l){return be({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),X].filter(d=>!!d),issueData:{code:u.invalid_arguments,argumentsError:l}})}function s(o,l){return be({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),X].filter(d=>!!d),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const i={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof H){const o=this;return I(async function(...l){const d=new N([]),f=await o._def.args.parseAsync(l,i).catch(S=>{throw d.addIssue(r(l,S)),d}),x=await Reflect.apply(c,this,f);return await o._def.returns._def.type.parseAsync(x,i).catch(S=>{throw d.addIssue(s(x,S)),d})})}else{const o=this;return I(function(...l){const d=o._def.args.safeParse(l,i);if(!d.success)throw new N([r(l,d.error)]);const f=Reflect.apply(c,this,d.data),x=o._def.returns.safeParse(f,i);if(!x.success)throw new N([s(f,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Y({...this._def,args:P.create(e).rest(L.create())})}returns(e){return new Y({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Y({args:e||P.create([]).rest(L.create()),returns:t||L.create(),typeName:g.ZodFunction,...v(r)})}}class de extends _{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})}}de.create=(n,e)=>new de({getter:n,typeName:g.ZodLazy,...v(e)});class le extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(n,e)=>new le({value:n,typeName:g.ZodLiteral,...v(e)});function et(n,e){return new z({values:n,typeName:g.ZodEnum,...v(e)})}class z extends _{constructor(){super(...arguments),te.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{expected:b.joinValues(r),received:t.parsedType,code:u.invalid_type}),y}if(xe(this,te)||Xe(this,te,new Set(this._def.values)),!xe(this,te).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{received:t.data,code:u.invalid_enum_value,options:r}),y}return I(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 z.create(e,{...this._def,...t})}exclude(e,t=this._def){return z.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}te=new WeakMap;z.create=et;class me extends _{constructor(){super(...arguments),ne.set(this,void 0)}_parse(e){const t=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){const s=b.objectValues(t);return m(r,{expected:b.joinValues(s),received:r.parsedType,code:u.invalid_type}),y}if(xe(this,ne)||Xe(this,ne,new Set(b.getValidEnumValues(this._def.values))),!xe(this,ne).has(e.data)){const s=b.objectValues(t);return m(r,{received:r.data,code:u.invalid_enum_value,options:s}),y}return I(e.data)}get enum(){return this._def.values}}ne=new WeakMap;me.create=(n,e)=>new me({values:n,typeName:g.ZodNativeEnum,...v(e)});class H extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return m(t,{code:u.invalid_type,expected:p.promise,received:t.parsedType}),y;const r=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return I(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}H.create=(n,e)=>new H({type:n,typeName:g.ZodPromise,...v(e)});class j extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:c=>{m(r,c),c.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const c=s.transform(r.data,i);if(r.common.async)return Promise.resolve(c).then(async o=>{if(t.value==="aborted")return y;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?Q(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:c,path:r.path,parent:r});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?Q(o.value):o}}if(s.type==="refinement"){const c=o=>{const l=s.refinement(o,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),c(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),c(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!U(c))return c;const o=s.transform(c.value,i);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:r.data,path:r.path,parent:r}).then(c=>U(c)?Promise.resolve(s.transform(c.value,i)).then(o=>({status:t.value,value:o})):c);b.assertNever(s)}}j.create=(n,e,t)=>new j({schema:n,typeName:g.ZodEffects,effect:e,...v(t)});j.createWithPreprocess=(n,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:n},typeName:g.ZodEffects,...v(t)});class Z extends _{_parse(e){return this._getType(e)===p.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Z.create=(n,e)=>new Z({innerType:n,typeName:g.ZodOptional,...v(e)});class F extends _{_parse(e){return this._getType(e)===p.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(n,e)=>new F({innerType:n,typeName:g.ZodNullable,...v(e)});class pe extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pe.create=(n,e)=>new pe({innerType:n,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class fe extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return re(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new N(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new N(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}fe.create=(n,e)=>new fe({innerType:n,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Te extends _{_parse(e){if(this._getType(e)!==p.nan){const r=this._getOrReturnCtx(e);return m(r,{code:u.invalid_type,expected:p.nan,received:r.parsedType}),y}return{status:"valid",value:e.data}}}Te.create=n=>new Te({typeName:g.ZodNaN,...v(n)});const Bt=Symbol("zod_brand");class Re extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ge extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?y:i.status==="dirty"?(t.dirty(),Q(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new ge({in:e,out:t,typeName:g.ZodPipeline})}}class he extends _{_parse(e){const t=this._def.innerType._parse(e),r=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return re(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}he.create=(n,e)=>new he({innerType:n,typeName:g.ZodReadonly,...v(e)});function Qe(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function tt(n,e={},t){return n?J.create().superRefine((r,s)=>{var i,c;const o=n(r);if(o instanceof Promise)return o.then(l=>{var d,f;if(!l){const x=Qe(e,r),w=(f=(d=x.fatal)!==null&&d!==void 0?d:t)!==null&&f!==void 0?f:!0;s.addIssue({code:"custom",...x,fatal:w})}});if(!o){const l=Qe(e,r),d=(c=(i=l.fatal)!==null&&i!==void 0?i:t)!==null&&c!==void 0?c:!0;s.addIssue({code:"custom",...l,fatal:d})}}):J.create()}const Wt={object:k.lazycreate};var g;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(g||(g={}));const Qt=(n,e={message:`Input not instance of ${n.name}`})=>tt(t=>t instanceof n,e),nt=A.create,rt=$.create,Yt=Te.create,Gt=V.create,at=ae.create,Xt=q.create,Jt=ke.create,Ht=se.create,Kt=ie.create,en=J.create,tn=L.create,nn=M.create,rn=Se.create,an=C.create,sn=k.create,on=k.strictCreate,cn=oe.create,un=Ie.create,dn=ce.create,ln=P.create,mn=ue.create,pn=we.create,fn=B.create,hn=Y.create,gn=de.create,yn=le.create,vn=z.create,_n=me.create,bn=H.create,Ye=j.create,xn=Z.create,kn=F.create,Sn=j.createWithPreprocess,wn=ge.create,Tn=()=>nt().optional(),In=()=>rt().optional(),Nn=()=>at().optional(),An={string:n=>A.create({...n,coerce:!0}),number:n=>$.create({...n,coerce:!0}),boolean:n=>ae.create({...n,coerce:!0}),bigint:n=>V.create({...n,coerce:!0}),date:n=>q.create({...n,coerce:!0})},Cn=y;var a=Object.freeze({__proto__:null,defaultErrorMap:X,setErrorMap:kt,getErrorMap:_e,makeIssue:be,EMPTY_PATH:St,addIssueToContext:m,ParseStatus:T,INVALID:y,DIRTY:Q,OK:I,isAborted:De,isDirty:Ze,isValid:U,isAsync:re,get util(){return b},get objectUtil(){return je},ZodParsedType:p,getParsedType:R,ZodType:_,datetimeRegex:Ke,ZodString:A,ZodNumber:$,ZodBigInt:V,ZodBoolean:ae,ZodDate:q,ZodSymbol:ke,ZodUndefined:se,ZodNull:ie,ZodAny:J,ZodUnknown:L,ZodNever:M,ZodVoid:Se,ZodArray:C,ZodObject:k,ZodUnion:oe,ZodDiscriminatedUnion:Ie,ZodIntersection:ce,ZodTuple:P,ZodRecord:ue,ZodMap:we,ZodSet:B,ZodFunction:Y,ZodLazy:de,ZodLiteral:le,ZodEnum:z,ZodNativeEnum:me,ZodPromise:H,ZodEffects:j,ZodTransformer:j,ZodOptional:Z,ZodNullable:F,ZodDefault:pe,ZodCatch:fe,ZodNaN:Te,BRAND:Bt,ZodBranded:Re,ZodPipeline:ge,ZodReadonly:he,custom:tt,Schema:_,ZodSchema:_,late:Wt,get ZodFirstPartyTypeKind(){return g},coerce:An,any:en,array:an,bigint:Gt,boolean:at,date:Xt,discriminatedUnion:un,effect:Ye,enum:vn,function:hn,instanceof:Qt,intersection:dn,lazy:gn,literal:yn,map:pn,nan:Yt,nativeEnum:_n,never:nn,null:Kt,nullable:kn,number:rt,object:sn,oboolean:Nn,onumber:In,optional:xn,ostring:Tn,pipeline:wn,preprocess:Sn,promise:bn,record:mn,set:fn,strictObject:on,string:nt,symbol:Jt,transformer:Ye,tuple:ln,undefined:Ht,union:cn,unknown:tn,void:rn,NEVER:Cn,ZodIssueCode:u,quotelessJson:xt,ZodError:N});const ye=a.object({country:a.string().optional(),city:a.string().optional(),street:a.string().optional(),streetNumber:a.string().optional(),floor:a.string().optional(),apartmentEnterNumber:a.string().optional(),apartmentNumber:a.string().optional()}),D=a.string().min(1,{message:"שדה חובה"}),jn=a.string().regex(/^\d+$/,"Must be a numeric string"),Dn=a.object({url:a.string().url(),id:a.string()});function Zn(n){return!!(n!=null&&n.url)}const G=a.object({lang:a.enum(["he"]),value:a.string()}),On=a.array(G),Me=a.object({id:a.string().min(1),companyId:a.string().min(1),storeId:a.string().min(1),parentId:a.string().nullish(),tag:a.string().optional(),locales:a.array(G),depth:a.number()}),Ne=Me.extend({children:a.lazy(()=>Ne.array())}),Pn=Me.extend({index:a.number(),depth:a.number(),collapsed:a.boolean().optional(),children:a.array(Ne)}),ee=a.string().min(1),$e=a.object({type:a.literal("Product"),storeId:ee,companyId:ee,id:ee,objectID:ee,sku:ee,name:a.array(G),description:a.array(G),isPublished:a.boolean(),vat:a.boolean(),priceType:a.object({type:a.enum(["unit","kg","gram","liter","ml"]),value:a.number()}),price:a.number().positive(),purchasePrice:a.number().optional(),profitPercentage:a.number().optional(),currency:a.literal("ILS"),discount:a.object({type:a.enum(["number","percent","none"]),value:a.number()}),isDiscountable:a.boolean({description:"included in store discounts"}).optional(),weight:a.object({value:a.number(),unit:a.enum(["kg","gram","none"])}),volume:a.object({value:a.number(),unit:a.enum(["liter","ml","none"])}),images:a.array(a.object({url:a.string().url(),id:a.string()})),manufacturer:a.string(),brand:a.string(),importer:a.string(),supplier:a.string(),ingredients:a.array(G),created_at:a.number(),updated_at:a.number(),categoryIds:a.array(a.string().nonempty()),stock:a.object({quantity:a.number().min(0),unit:a.enum(["piece","kg","gram","liter","ml"])}).optional(),categoryList:a.array(Ne).optional(),categories:a.object({lvl0:a.array(a.string()),lvl1:a.array(a.string()),lvl2:a.array(a.string()),lvl3:a.array(a.string()),lvl4:a.array(a.string())}).optional(),categoryNames:a.array(a.string()).optional()}),En=$e.extend({image:a.instanceof(File).optional()}),Ve=a.object({product:$e,originalPrice:a.number().optional(),finalPrice:a.number().optional(),finalDiscount:a.number().optional(),amount:a.number().positive({message:"Quantity must be a positive number."})}),Rn=a.object({type:a.literal("Cart"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),status:a.enum(["active","draft","completed"]),items:a.array(Ve)}),Mn=a.object({id:a.string(),name:a.string(),websiteDomains:a.array(a.string())}),$n=a.object({type:a.literal("FavoriteProduct"),id:a.string().uuid(),companyId:a.string().uuid(),storeId:a.string().uuid(),userId:a.string().uuid(),productId:a.string().uuid()}),ve=a.enum(["external","j5","none"]),st=a.object({type:a.literal("Profile"),id:D,companyId:D,storeId:D,tenantId:D,clientType:a.enum(["user","company"]),companyName:a.string().optional(),displayName:D,email:a.string().email(),phoneNumber:a.string().optional(),address:ye.optional(),isAnonymous:a.boolean(),createdDate:a.number(),lastActivityDate:a.number(),paymentType:ve.optional(),organizationId:a.string().optional().nullable()}),ze=a.object({_COMMENT:a.string().optional(),transaction_id:a.string(),date:a.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),currency:a.string().length(3,"Currency must be 3 characters"),rate:a.number().positive(),vat:a.string().regex(/^\d+\.\d{2}$/,"VAT must be in format XX.XX"),vat_price:a.number().positive(),price_discount:a.number(),price_discount_in_currency:a.number(),price_total:a.string().regex(/^\d+\.\d{2}$/,"Price total must be in format XX.XX"),price_total_in_currency:a.number().positive()}),it=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:ze,warning:a.string().optional(),date:a.number().optional()}),ot=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.number().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),Fe=a.object({number:a.string(),name:a.string(),id:a.string()}),ct=a.object({id:a.string(),name:a.string(),discountPercentage:a.number().positive().min(0).max(100).optional(),nameOnInvoice:a.string().optional(),billingAccounts:a.array(Fe),paymentType:ve,companyNumber:a.string().optional(),address:ye.optional(),groupId:a.string().optional()}),Vn=ct.omit({id:!0}),zn=a.object({doc_uuid:a.string().uuid("Document UUID must be a valid UUID"),pdf_link:a.string().url("PDF link must be a valid URL"),pdf_link_copy:a.string().url("PDF copy link must be a valid URL"),doc_number:a.string().min(1,"Document number is required"),sent_mails:a.array(a.string().email("Each email must be valid")),success:a.boolean(),ua_uuid:a.string().uuid("UA UUID must be a valid UUID"),calculatedData:ze,warning:a.string().optional(),date:a.number().optional()}),Fn=a.object({id:a.string().min(1,"ID is required"),number:a.string().min(1,"Number is required"),date:a.string().min(1,"Date is required"),createdAt:a.number().min(1,"Created at is required"),status:a.enum(["pending","paid","cancelled"]),companyDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),clientDetails:a.object({name:a.string().min(1,"Name is required").optional(),address:a.string().min(1,"Address is required").optional(),phone:a.string().min(1,"Phone is required").optional(),email:a.string().email("Email must be valid").optional()}).optional(),items:a.array(a.object({name:a.string().min(1,"Name is required").optional(),price:a.number().min(1,"Price is required").optional(),quantity:a.number().min(1,"Quantity is required").optional(),total:a.number().min(1,"Total is required").optional()})).optional(),total:a.number().min(1,"Total is required").optional(),vat:a.number().min(1,"VAT is required").optional(),link:a.string().url("Link must be a valid URL").optional()}),Ln=a.object({type:a.literal("Order"),createdBy:a.enum(["user","admin"]).optional(),id:D,companyId:D,storeId:D,userId:D,status:a.enum(["draft","pending","processing","in_delivery","delivered","cancelled","completed","refunded"]),paymentType:ve.optional(),paymentStatus:a.enum(["pending","pending_j5","external","completed","failed","refunded"]),cart:a.object({id:a.string(),items:a.array(Ve),cartDiscount:a.number(),cartTotal:a.number(),cartVat:a.number(),deliveryPrice:a.number().optional()}),storeOptions:a.object({deliveryPrice:a.number().optional(),freeDeliveryPrice:a.number().optional(),isVatIncludedInPrice:a.boolean().optional()}).optional(),originalAmount:a.number().positive().optional(),actualAmount:a.number().positive().optional(),date:a.number(),deliveryDate:a.coerce.number(),client:st.optional(),address:ye.optional(),nameOnInvoice:a.string().optional(),emailOnInvoice:a.string().email().optional(),phoneNumberOnInvoice:a.string().optional(),clientComment:a.string().optional(),organizationId:a.string().optional(),billingAccount:Fe.optional(),deliveryNote:ot.optional(),invoice:Fn.optional(),ezInvoice:zn.optional(),ezDeliveryNote:it.optional()}),ut=a.enum(["individual","company"]),Un=a.object({id:a.string(),companyId:a.string(),name:a.string(),urls:a.array(a.string()),logoUrl:a.string(),tenantId:a.string(),paymentType:ve,allowAnonymousClients:a.boolean(),isVatIncludedInPrice:a.boolean(),clientTypes:a.array(ut),minimumOrder:a.number().optional(),freeDeliveryPrice:a.number().optional(),deliveryPrice:a.number().optional(),address:ye.optional(),companyNumber:a.string().optional()}),dt=a.object({minSpend:a.number().positive().optional(),stackable:a.boolean().default(!1)}).optional(),lt=a.discriminatedUnion("variantType",[a.object({variantType:a.literal("bundle"),productsId:a.array(a.string().nonempty()).min(1),requiredQuantity:a.number().positive(),bundlePrice:a.number().positive()})]),qn=a.object({type:a.literal("Discount"),storeId:a.string().min(1),companyId:a.string().min(1),id:a.string().min(1),name:a.array(a.object({lang:a.enum(["he"]),value:a.string().nonempty()})),active:a.boolean(),startDate:a.number(),endDate:a.number(),variant:lt,conditions:dt});class mt{canApply(e,t){if(e.variant.variantType!=="bundle"||!this.isDiscountActive(e))return!1;const{productsId:r,requiredQuantity:s}=e.variant;return this.getTotalQuantity(t.cart,r)>=s}calculate(e,t){if(e.variant.variantType!=="bundle")return{applicable:!1,discountAmount:0,affectedItems:[]};const{productsId:r,requiredQuantity:s,bundlePrice:i}=e.variant,c=t.cart.filter(K=>r.includes(K.product.id)),o=this.getTotalQuantity(t.cart,r),l=Math.floor(o/s);if(l===0)return{applicable:!1,discountAmount:0,affectedItems:[]};const d=this.calculateOriginalPrice(c),f=this.getTotalQuantity(t.cart,r),x=this.calculateDiscountedPrice(d,i,l,s,f),w=d-x,S=this.distributeDiscount(c,w,d);return{applicable:!0,discountAmount:Number(w.toFixed(2)),affectedItems:S}}isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}getTotalQuantity(e,t){return e.filter(r=>t.includes(r.product.id)).reduce((r,s)=>r+s.amount,0)}calculateOriginalPrice(e){return e.reduce((t,r)=>t+r.product.price*r.amount,0)}calculateDiscountedPrice(e,t,r,s,i){const c=t*r,o=r*s,d=Math.max(0,i-o)/i*e;return c+d}distributeDiscount(e,t,r){const s=t/r;return e.map(i=>{const c=i.product.price*i.amount*s;return{productId:i.product.id,quantity:i.amount,originalPrice:Number(i.product.price.toFixed(2)),discountedPrice:Number((i.product.price-c/i.amount).toFixed(2)),discountAmount:Number(c.toFixed(2))}})}}class Le{static getStrategy(e){return this.strategies.get(e.variant.variantType)||null}static registerStrategy(e,t){this.strategies.set(e,t)}static getRegisteredTypes(){return Array.from(this.strategies.keys())}static clearStrategies(){this.strategies.clear()}}Be(Le,"strategies",new Map([["bundle",new mt]]));class Bn{static calculateDiscounts(e,t,r){var d,f;const s={cart:e,user:r,appliedDiscounts:[]},i=this.filterActiveDiscounts(t),c=[];for(const x of i){const w=Le.getStrategy(x);if(!w||!w.canApply(x,s)||!((d=x.conditions)!=null&&d.stackable)&&c.length>0)continue;const S=w.calculate(x,s);S.applicable&&(c.push({discountId:x.id,discountName:((f=x.name[0])==null?void 0:f.value)||"Discount",discountAmount:Number(S.discountAmount.toFixed(2)),affectedItems:S.affectedItems}),s.appliedDiscounts=c)}const o=this.calculateFinalPrices(e,c),l=c.reduce((x,w)=>x+w.discountAmount,0);return{items:o,totalDiscount:Number(l.toFixed(2)),appliedDiscounts:c}}static filterActiveDiscounts(e){const t=Date.now();return e.filter(r=>r.active&&r.startDate<=t&&r.endDate>=t)}static calculateFinalPrices(e,t){return e.map(r=>{const s=t.filter(l=>l.affectedItems.some(d=>d.productId===r.product.id)),i=s.reduce((l,d)=>{const f=d.affectedItems.find(x=>x.productId===r.product.id);return l+((f==null?void 0:f.discountAmount)||0)},0),c=i/r.amount,o=r.product.price-c;return{amount:r.amount,product:r.product,originalPrice:Number(r.product.price.toFixed(2)),finalPrice:Number(Math.max(0,o).toFixed(2)),finalDiscount:Number(i.toFixed(2)),appliedDiscounts:s.map(l=>l.discountId)}})}static isDiscountActive(e){const t=Date.now();return e.active&&e.startDate<=t&&e.endDate>=t}static getActiveDiscounts(e){return this.filterActiveDiscounts(e)}}function Ue(n){return Number(n.toFixed(2))}function Wn(n){return n.toFixed(2)}function Qn(n){return Math.max(0,Ue(n))}function Yn(n,e){if(n<=0)return 0;const t=n-e;return Ue(t/n*100)}const pt=a.object({id:a.string(),name:a.string()}),Gn=pt.omit({id:!0}),qe=a.object({type:a.literal("Supplier"),id:a.string(),name:a.string(),code:a.string()}),Xn=qe.omit({id:!0}),ft=a.object({type:a.literal("SupplierInvoice"),id:a.string(),supplier:qe,invoiceNumber:a.string(),date:a.number(),rows:a.array(a.object({id:a.string(),rowNumber:a.number(),sku:a.string(),itemName:a.string(),quantity:a.number(),purchasePrice:a.number(),lineDiscount:a.number(),profitPercentage:a.number(),price:a.number(),totalPurchasePrice:a.number(),vat:a.boolean(),originalProduct:a.object({purchasePrice:a.number(),price:a.number(),profitPercentage:a.number()}).optional()})),productsToUpdate:a.array(a.object({sku:a.string(),itemName:a.string(),oldPurchasePrice:a.number(),newPurchasePrice:a.number(),oldPrice:a.number(),newPrice:a.number(),oldProfitPercentage:a.number(),newProfitPercentage:a.number()})),total:a.number().optional(),totalBeforeVat:a.number().optional(),vat:a.number().optional()}),Jn=ft.omit({id:!0}),Hn=a.object({type:a.literal("ChatSession"),id:a.string(),storeId:a.string(),companyId:a.string(),tenantId:a.string(),userId:a.string().nullable(),userType:a.enum(["anonymous","client","admin","superAdmin"]),createdAt:a.number(),updatedAt:a.number(),messageCount:a.number(),status:a.enum(["active","archived"])}),Kn=a.discriminatedUnion("type",[a.object({type:a.literal("message"),id:a.string(),role:a.enum(["user","assistant","system"]),content:a.string(),timestamp:a.number()}),a.object({type:a.literal("function_call"),id:a.string(),name:a.string(),arguments:a.record(a.string(),a.any()),timestamp:a.number()}),a.object({type:a.literal("tool_result"),id:a.string(),name:a.string(),result:a.any(),timestamp:a.number()})]),ht=a.enum(["delivery_note","payment_received","credit_note","debit_note","order_created","order_cancelled","order_refunded"]),gt=a.enum(["check","bank_transfer","cash","credit_card","other"]),er=a.object({id:a.string(),type:ht,debt:a.number(),runningBalance:a.number(),orderId:a.string().nullable(),orderTotal:a.number().nullable(),deliveryNoteId:a.string().nullable(),deliveryNoteNumber:a.string().nullable(),billingAccountId:a.string().nullable(),billingAccountName:a.string().nullable(),billingAccountNumber:a.string().nullable(),paymentReference:a.string().nullable(),paymentDate:a.number().nullable(),paymentMethod:gt.nullable(),note:a.string().nullable(),createdAt:a.number(),createdBy:a.string()}),tr=a.object({id:a.string(),organizationId:a.string(),organizationName:a.string(),companyId:a.string(),storeId:a.string(),totalDebits:a.number(),totalCredits:a.number(),balance:a.number(),currency:a.literal("ILS"),updatedAt:a.number()}),Pe={VAT:18};function nr(n,e){var t,r;return((t=n.discount)==null?void 0:t.type)==="percent"?n.price*(n.discount.value??100)/100:((r=n.discount)==null?void 0:r.type)==="number"?n.discount.value??0:0}function rr(n,e){var r,s;const t=e&&n.vat?n.price+n.price*Pe.VAT/100:n.price;if(((r=n.discount)==null?void 0:r.type)==="percent"){const i=t*n.discount.value/100;return n.price-i}return((s=n.discount)==null?void 0:s.type)==="number"?t-n.discount.value:t}function ar({cart:n,discounts:e,deliveryPrice:t=0,freeDeliveryPrice:r=0,isVatIncludedInPrice:s=!1}){const i=n.map((o,l)=>({amount:o.amount,product:{...o.product},originalPrice:o.product.price,finalPrice:rr(o.product,s),finalDiscount:nr(o.product)})),c=i.reduce((o,l)=>{const{product:d,amount:f,finalPrice:x,finalDiscount:w}=l;let S=0;if(d.vat){let Ae=0;if(s){const yt=Number((x/(1+Pe.VAT/100)).toFixed(2)),vt=x-yt;S=Number(vt.toFixed(2)),S=S*f,Ae=Number(S.toFixed(2))}else S=x*Pe.VAT/100,S=S*f,Ae=Number(S.toFixed(2));o.vat=Number((o.vat+Ae).toFixed(2))}const K=Number(x.toFixed(2));return o.cost+=f*K,o.discount+=w&&f*w,o.finalCost+=f*K+(s?0:S),o.productsCost+=f*K+(s?0:S),o.cost=Number(o.cost.toFixed(2)),o.discount=Number(o.discount.toFixed(2)),o.finalCost=Number(o.finalCost.toFixed(2)),o.productsCost=Number(o.productsCost.toFixed(2)),o},{discount:0,cost:0,finalCost:0,vat:0,productsCost:0,deliveryPrice:t});return c.deliveryPrice&&c.productsCost>=r?c.deliveryPrice=0:c.finalCost+=c.deliveryPrice,{items:i,...c}}const sr={stores:"STORES",companies:"COMPANIES"},ir={products:"products","favorite-products":"favorite-products",profiles:"profiles",cart:"cart",clients:"clients",orders:"orders",categories:"categories",payments:"payments",settings:"settings",discounts:"discounts",organizations:"organizations",organizationGroups:"organizationGroups",invoices:"invoices",suppliers:"suppliers",supplierInvoices:"supplierInvoices",chatSessions:"chatSessions",chatSessionMessages:"chatSessionMessages",contactSubmissions:"contactSubmissions",budgetAccounts:"budgetAccounts",budgetTransactions:"budgetTransactions"},or={systemCollections:sr,storeCollections:ir,getPath:({companyId:n,storeId:e,collectionName:t,id:r})=>`${n}/${e}/${t}${r?`/${r}`:""}`,getSubPath:({companyId:n,storeId:e,collectionName:t,subCollectionName:r,id:s,subId:i})=>`${n}/${e}/${t}/${s}/${r}${i?`/${i}`:""}`,getDocPath:n=>`{companyId}/{storeId}/${n}/{id}`,getSubDocPath:(n,e,t)=>`{companyId}/{storeId}/${n}/${e}/${t}/{id}`},cr={firestore:or},Ee={round:(n,e=2)=>{const t=10**e;return Math.round((n+Number.EPSILON)*t)/t}},ur={calcSalePriceFromMargin:(n,e)=>n<=0||e<=0||n>=100?e:Ee.round(e/(1-n/100)),calcMarginFromSalePrice:(n,e)=>n<=0||e<=0?0:Ee.round((n-e)/n*100)};exports.AddressSchema=ye;exports.BaseCategorySchema=Me;exports.BillingAccountSchema=Fe;exports.BudgetAccountSchema=tr;exports.BudgetTransactionSchema=er;exports.BudgetTransactionTypeSchema=ht;exports.BundleDiscountStrategy=mt;exports.CalculatedDataSchema=ze;exports.CartItemProductSchema=Ve;exports.CartSchema=Rn;exports.CategorySchema=Ne;exports.ChatSessionMessageSchema=Kn;exports.ChatSessionSchema=Hn;exports.CompanySchema=Mn;exports.DeliveryNoteSchema=ot;exports.DiscountConditionsSchema=dt;exports.DiscountEngine=Bn;exports.DiscountSchema=qn;exports.DiscountStrategyFactory=Le;exports.DiscountVariantSchema=lt;exports.EzDeliveryNoteSchema=it;exports.FavoriteProductSchema=$n;exports.FileSchema=Dn;exports.FirebaseAPI=cr;exports.LocaleSchema=G;exports.LocaleValueSchema=On;exports.NewOrganizationGroupSchema=Gn;exports.NewOrganizationSchema=Vn;exports.NewProductSchema=En;exports.NewSupplierInvoiceSchema=Jn;exports.NewSupplierSchema=Xn;exports.OrderSchema=Ln;exports.OrganizationGroupSchema=pt;exports.OrganizationSchema=ct;exports.PaymentMethodSchema=gt;exports.PaymentTypeSchema=ve;exports.ProductSchema=$e;exports.ProfileSchema=st;exports.StoreSchema=Un;exports.SupplierInvoiceSchema=ft;exports.SupplierSchema=qe;exports.TFlattenCategorySchema=Pn;exports.calculatePercentageDiscount=Yn;exports.clientTypesSchema=ut;exports.ensureNonNegative=Qn;exports.formatCurrency=Ue;exports.formatCurrencyString=Wn;exports.getCartCost=ar;exports.isFile=Zn;exports.math=Ee;exports.notEmptyTextSchema=D;exports.numericTextSchema=jn;exports.storeCalculator=ur;
2
2
  //# sourceMappingURL=core.cjs.map