@shoppexio/storefront 1.0.43 → 1.0.44
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/customer.cjs +2 -0
- package/dist/customer.cjs.map +1 -0
- package/dist/customer.d.ts +13 -0
- package/dist/customer.d.ts.map +1 -0
- package/dist/customer.js +3 -0
- package/dist/customer.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e;function t(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function s(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var n=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},r=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});var i=globalThis.__zod_globalConfig;function o(e){return e&&Object.assign(i,e),i}function s(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function a(e,t){return"bigint"==typeof t?t.toString():t}function u(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function c(e){return null==e}function d(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var l=Symbol("evaluating");function p(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==l)return void 0===r&&(r=l,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function f(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function h(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function m(e){return JSON.stringify(e)}var _="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var y=u(()=>{if(i.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function g(e){if(!1===v(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==v(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function b(e){return g(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var w=new Set(["string","number","symbol"]);function z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function $(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}var S={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function x(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function O(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function E(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function T(e){return"string"==typeof e?e:e?.message}function I(e,t,n){const r=e.message?e.message:T(e.inst?._zod.def?.error?.(e))??T(t?.error?.(e))??T(n.customError?.(e))??T(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function N(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Z(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}var A=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,a,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},P=t("$ZodError",A),j=t("$ZodError",A,{Parent:Error});var R=e=>(t,r,i,s)=>{const a=i?{...i,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise)throw new n;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map(e=>I(e,a,o())));throw _(t,s?.callee),t}return u.value},C=e=>async(t,n,r,i)=>{const s=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(i?.Err??e)(a.issues.map(e=>I(e,s,o())));throw _(t,i?.callee),t}return a.value},D=e=>(t,r,i)=>{const s=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new n;return a.issues.length?{success:!1,error:new(e??P)(a.issues.map(e=>I(e,s,o())))}:{success:!0,data:a.value}},F=D(j),U=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>I(e,i,o())))}:{success:!0,data:s.value}},J=U(j),M=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return R(e)(t,n,i)},q=e=>(t,n,r)=>R(e)(t,n,r),L=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return C(e)(t,n,i)},V=e=>async(t,n,r)=>C(e)(t,n,r),W=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return D(e)(t,n,i)},K=e=>(t,n,r)=>D(e)(t,n,r),G=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return U(e)(t,n,i)},B=e=>async(t,n,r)=>U(e)(t,n,r),Y=/^[cC][0-9a-z]{6,}$/,H=/^[0-9a-z]+$/,X=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Q=/^[0-9a-vA-V]{20}$/,ee=/^[A-Za-z0-9]{27}$/,te=/^[a-zA-Z0-9_-]{21}$/,ne=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,re=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,oe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var se=/^(?:(?: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])$/,ae=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,ue=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,de=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,le=/^[A-Za-z0-9_-]*$/,pe=/^https?$/,fe=/^\+[1-9]\d{6,14}$/,he="(?:(?:\\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])))",me=new RegExp(`^${he}$`);function _e(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}var ve=/^-?\d+$/,ye=/^-?\d+(?:\.\d+)?$/,ge=/^(?:true|false)$/i,be=/^[^A-Z]*$/,we=/^[^a-z]*$/,ze=t("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ke={number:"number",bigint:"bigint",object:"date"},$e=t("$ZodCheckLessThan",(e,t)=>{ze.init(e,t);const n=ke[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Se=t("$ZodCheckGreaterThan",(e,t)=>{ze.init(e,t);const n=ke[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xe=t("$ZodCheckMultipleOf",(e,t)=>{ze.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value!==BigInt(0):0!==function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))&&n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Oe=t("$ZodCheckNumberFormat",(e,t)=>{ze.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=S[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=ve)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Ee=t("$ZodCheckMaxLength",(e,t)=>{var n;ze.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!c(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=N(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Te=t("$ZodCheckMinLength",(e,t)=>{var n;ze.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!c(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=N(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ie=t("$ZodCheckLengthEquals",(e,t)=>{var n;ze.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!c(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=N(r),s=i>t.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ne=t("$ZodCheckStringFormat",(e,t)=>{var n,r;ze.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ze=t("$ZodCheckRegex",(e,t)=>{Ne.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ae=t("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=be),Ne.init(e,t)}),Pe=t("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=we),Ne.init(e,t)}),je=t("$ZodCheckIncludes",(e,t)=>{ze.init(e,t);const n=z(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Re=t("$ZodCheckStartsWith",(e,t)=>{ze.init(e,t);const n=new RegExp(`^${z(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ce=t("$ZodCheckEndsWith",(e,t)=>{ze.init(e,t);const n=new RegExp(`.*${z(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),De=t("$ZodCheckOverwrite",(e,t)=>{ze.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Fe=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}},Ue={major:4,minor:4,patch:3},Je=t("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ue;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const n of i)for(const t of n._zod.onattach)t(e);if(0===i.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let i,o=x(e);for(const s of t){if(s._zod.def.when){if(O(e))continue;if(!s._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new n;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(o||(o=x(e,t)))});else{if(e.issues.length===t)continue;o||(o=x(e,t))}}return i?i.then(()=>e):e},r=(r,o,s)=>{if(x(r))return r.aborted=!0,r;const a=t(o,i,s);if(a instanceof Promise){if(!1===s.async)throw new n;return a.then(t=>e._zod.parse(t,s))}return e._zod.parse(a,s)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if("backward"===s.direction){const t=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,o,s)):r(t,o,s)}const a=e._zod.parse(o,s);if(a instanceof Promise){if(!1===s.async)throw new n;return a.then(e=>t(e,i,s))}return t(a,i,s)}}p(e,"~standard",()=>({validate:t=>{try{const n=F(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return J(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Me=t("$ZodString",(e,t)=>{var n;Je.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),qe=t("$ZodStringFormat",(e,t)=>{Ne.init(e,t),Me.init(e,t)}),Le=t("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=re),qe.init(e,t)}),Ve=t("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(e))}else t.pattern??(t.pattern=ie());qe.init(e,t)}),We=t("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=oe),qe.init(e,t)}),Ke=t("$ZodURL",(e,t)=>{qe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===pe.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ge=t("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qe.init(e,t)}),Be=t("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=te),qe.init(e,t)}),Ye=t("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Y),qe.init(e,t)}),He=t("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=H),qe.init(e,t)}),Xe=t("$ZodULID",(e,t)=>{t.pattern??(t.pattern=X),qe.init(e,t)}),Qe=t("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Q),qe.init(e,t)}),et=t("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ee),qe.init(e,t)}),tt=t("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=_e({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${he}T(?:${r})$`)}(t)),qe.init(e,t)}),nt=t("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=me),qe.init(e,t)}),rt=t("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${_e(t)}$`)),qe.init(e,t)}),it=t("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ne),qe.init(e,t)}),ot=t("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=se),qe.init(e,t),e._zod.bag.format="ipv4"}),st=t("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ae),qe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),at=t("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ue),qe.init(e,t)}),ut=t("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ce),qe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ct(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var dt=t("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=de),qe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ct(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});var lt=t("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=le),qe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!le.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ct(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),pt=t("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fe),qe.init(e,t)});var ft=t("$ZodJWT",(e,t)=>{qe.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ht=t("$ZodNumber",(e,t)=>{Je.init(e,t),e._zod.pattern=e._zod.bag.pattern??ye,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),mt=t("$ZodNumberFormat",(e,t)=>{Oe.init(e,t),ht.init(e,t)}),_t=t("$ZodBoolean",(e,t)=>{Je.init(e,t),e._zod.pattern=ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),vt=t("$ZodUnknown",(e,t)=>{Je.init(e,t),e._zod.parse=e=>e}),yt=t("$ZodNever",(e,t)=>{Je.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function gt(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}var bt=t("$ZodArray",(e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?o.push(a.then(t=>gt(t,n,e))):gt(a,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function wt(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...E(n,e.issues))}s||i?void 0===e.value?s&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function zt(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function kt(e,t,n,r,i,o){const s=[],a=i.keySet,u=i.catchall._zod,c=u.def.type,d="optional"===u.optin,l="optional"===u.optout;for(const p in t){if("__proto__"===p)continue;if(a.has(p))continue;if("never"===c){s.push(p);continue}const i=u.run({value:t[p],issues:[]},r);i instanceof Promise?e.push(i.then(e=>wt(e,n,p,t,d,l))):wt(i,n,p,t,d,l)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}var $t=t("$ZodObject",(e,t)=>{if(Je.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=u(()=>zt(t));p(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const r=v,i=t.catchall;let o;e._zod.parse=(t,s)=>{o??(o=n.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const u=[],c=o.shape;for(const e of o.keys){const n=c[e],r="optional"===n._zod.optin,i="optional"===n._zod.optout,o=n._zod.run({value:a[e],issues:[]},s);o instanceof Promise?u.push(o.then(n=>wt(n,t,e,a,r,i))):wt(o,t,e,a,r,i)}return i?kt(u,a,t,s,n.value,e):u.length?Promise.all(u).then(()=>t):t}}),St=t("$ZodObjectJIT",(e,t)=>{$t.init(e,t);const n=e._zod.parse,r=u(()=>zt(t));let o;const s=v,a=!i.jitless,c=a&&y.value,d=t.catchall;let l;e._zod.parse=(i,u)=>{l??(l=r.value);const p=i.value;return s(p)?a&&c&&!1===u?.async&&!0!==u.jitless?(o||(o=(e=>{const t=new Fe(["shape","payload","ctx"]),n=r.value,i=e=>{const t=m(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const r of n.keys)o[r]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],s=m(r),a=e[r],u="optional"===a?._zod?.optin,c="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),u&&c?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):u?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${s} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),i=o(i,u),d?kt([],p,i,u,l,e):i):n(i,u):(i.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),i)}});function xt(e,t,n,r){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const i=e.filter(e=>!x(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>I(e,r,o())))}),t)}var Ot=t("$ZodUnion",(e,t)=>{Je.init(e,t),p(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),p(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),p(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),p(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>d(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>xt(t,r,e,i)):xt(s,r,e,i)}}),Et=t("$ZodIntersection",(e,t)=>{Je.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>It(e,t,n)):It(e,i,o)}});function Tt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(g(e)&&g(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const o of r){const n=Tt(e[o],t[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};i[o]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=Tt(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function It(e,t,n){const r=new Map;let i;for(const a of t.issues)if("unrecognized_keys"===a.code){i??(i=a);for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(a);for(const a of n.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(a);const o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),x(e))return e;const s=Tt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var Nt=t("$ZodRecord",(e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!g(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const d of a)if("string"==typeof d||"number"==typeof d||"symbol"==typeof d){u.add("number"==typeof d?d.toString():d);const a=t.keyType._zod.run({value:d,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>I(e,r,o())),input:d,path:[d],inst:e});continue}const c=a.value,l=t.valueType._zod.run({value:i[d],issues:[]},r);l instanceof Promise?s.push(l.then(e=>{e.issues.length&&n.issues.push(...E(d,e.issues)),n.value[c]=e.value})):(l.issues.length&&n.issues.push(...E(d,l.issues)),n.value[c]=l.value)}let c;for(const e in i)u.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let u=t.keyType._zod.run({value:a,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof a&&ye.test(a)&&u.issues.length){const e=t.keyType._zod.run({value:Number(a),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(u=e)}if(u.issues.length){"loose"===t.mode?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(e=>I(e,r,o())),input:a,path:[a],inst:e});continue}const c=t.valueType._zod.run({value:i[a],issues:[]},r);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&n.issues.push(...E(a,e.issues)),n.value[u.value]=e.value})):(c.issues.length&&n.issues.push(...E(a,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Zt=t("$ZodEnum",(e,t)=>{Je.init(e,t);const n=s(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>w.has(typeof e)).map(e=>"string"==typeof e?z(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),At=t("$ZodLiteral",(e,t)=>{if(Je.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?z(e):e?z(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Pt=t("$ZodTransform",(e,t)=>{Je.init(e,t),e._zod.optin="optional",e._zod.parse=(i,o)=>{if("backward"===o.direction)throw new r(e.constructor.name);const s=t.transform(i.value,i);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then(e=>(i.value=e,i.fallback=!0,i));if(s instanceof Promise)throw new n;return i.value=s,i.fallback=!0,i}});function jt(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Rt=t("$ZodOptional",(e,t)=>{Je.init(e,t),e._zod.optin="optional",e._zod.optout="optional",p(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),p(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>jt(e,r)):jt(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Ct=t("$ZodExactOptional",(e,t)=>{Rt.init(e,t),p(e._zod,"values",()=>t.innerType._zod.values),p(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Dt=t("$ZodNullable",(e,t)=>{Je.init(e,t),p(e._zod,"optin",()=>t.innerType._zod.optin),p(e._zod,"optout",()=>t.innerType._zod.optout),p(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0}),p(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Ft=t("$ZodDefault",(e,t)=>{Je.init(e,t),e._zod.optin="optional",p(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ut(e,t)):Ut(r,t)}});function Ut(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var Jt=t("$ZodPrefault",(e,t)=>{Je.init(e,t),e._zod.optin="optional",p(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Mt=t("$ZodNonOptional",(e,t)=>{Je.init(e,t),p(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>qt(t,e)):qt(i,e)}});function qt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Lt=t("$ZodCatch",(e,t)=>{Je.init(e,t),e._zod.optin="optional",p(e._zod,"optout",()=>t.innerType._zod.optout),p(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,o()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,o()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Vt=t("$ZodPipe",(e,t)=>{Je.init(e,t),p(e._zod,"values",()=>t.in._zod.values),p(e._zod,"optin",()=>t.in._zod.optin),p(e._zod,"optout",()=>t.out._zod.optout),p(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Wt(e,t.in,n)):Wt(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Wt(e,t.out,n)):Wt(r,t.out,n)}});function Wt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Kt=t("$ZodReadonly",(e,t)=>{Je.init(e,t),p(e._zod,"propValues",()=>t.innerType._zod.propValues),p(e._zod,"values",()=>t.innerType._zod.values),p(e._zod,"optin",()=>t.innerType?._zod?.optin),p(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Gt):Gt(r)}});function Gt(e){return e.value=Object.freeze(e.value),e}var Bt,Yt=t("$ZodCustom",(e,t)=>{ze.init(e,t),Je.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ht(t,n,r,e));Ht(i,n,r,e)}});function Ht(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Z(e))}}var Xt=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(Bt=globalThis).__zod_globalRegistry??(Bt.__zod_globalRegistry=new Xt);var Qt=globalThis.__zod_globalRegistry;function en(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function tn(e,t){return new $e({check:"less_than",...$(t),value:e,inclusive:!1})}function nn(e,t){return new $e({check:"less_than",...$(t),value:e,inclusive:!0})}function rn(e,t){return new Se({check:"greater_than",...$(t),value:e,inclusive:!1})}function on(e,t){return new Se({check:"greater_than",...$(t),value:e,inclusive:!0})}function sn(e,t){return new xe({check:"multiple_of",...$(t),value:e})}function an(e,t){return new Ee({check:"max_length",...$(t),maximum:e})}function un(e,t){return new Te({check:"min_length",...$(t),minimum:e})}function cn(e,t){return new Ie({check:"length_equals",...$(t),length:e})}function dn(e){return new De({check:"overwrite",tx:e})}function ln(e,t){const n=new ze({check:"custom",...$(t)});return n._zod.check=e,n}function pn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fn(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),fn(o,t,r),t.seen.get(o).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),"input"===t.io&&_n(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function hn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const o of e.seen.entries()){const t=e.metadataRegistry.get(o[0])?.id;if(t){const e=r.get(t);if(e&&e!==o[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,o[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const o of e.seen.entries()){const e=o[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const n=o[1];if(t!==o[0]){if(e.external){const n=e.external.registry.get(o[0])?.id;if(t!==o[0]&&n){i(o);continue}}(e.metadataRegistry.get(o[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&i(o)}else i(o)}}function mn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const u of[...e.seen.entries()].reverse())r(u[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const u of e.seen.entries()){const e=u[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:vn(t,"input",e.processors),output:vn(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(a){throw new Error("Error converting schema to JSON.")}}function _n(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return _n(r.element,n);if("set"===r.type)return _n(r.valueType,n);if("lazy"===r.type)return _n(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return _n(r.innerType,n);if("intersection"===r.type)return _n(r.left,n)||_n(r.right,n);if("record"===r.type||"map"===r.type)return _n(r.keyType,n)||_n(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(_n(r.in,n)||_n(r.out,n));if("object"===r.type){for(const e in r.shape)if(_n(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(_n(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(_n(e,n))return!0;return!(!r.rest||!_n(r.rest,n))}return!1}var vn=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=pn({...i??{},target:o,io:t,processors:n});return fn(e,s),hn(s,e),mn(s,e)},yn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gn=(e,t,n,r)=>{const i=e._zod.def;fn(i.innerType,t,r);t.seen.get(e).ref=i.innerType},bn=t("ZodISODateTime",(e,t)=>{tt.init(e,t),Gn.init(e,t)});function wn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}(bn,e)}var zn=t("ZodISODate",(e,t)=>{nt.init(e,t),Gn.init(e,t)});function kn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}(zn,e)}var $n=t("ZodISOTime",(e,t)=>{rt.init(e,t),Gn.init(e,t)});function Sn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}($n,e)}var xn=t("ZodISODuration",(e,t)=>{it.init(e,t),Gn.init(e,t)});function On(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}(xn,e)}var En=(e,t)=>{P.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i];i!==e.length-1?r[n]=r[n]||{_errors:[]}:(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))),r=r[n],i++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,a,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,a,2)}},isEmpty:{get:()=>0===e.issues.length}})},Tn=t("ZodError",En,{Parent:Error}),In=R(Tn),Nn=C(Tn),Zn=D(Tn),An=U(Tn),Pn=M(Tn),jn=q(Tn),Rn=L(Tn),Cn=V(Tn),Dn=W(Tn),Fn=K(Tn),Un=G(Tn),Jn=B(Tn),Mn=new WeakMap;function qn(e,t,n){const r=Object.getPrototypeOf(e);let i=Mn.get(r);if(i||(i=new Set,Mn.set(r,i)),!i.has(t)){i.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ln=t("ZodType",(e,t)=>(Je.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:vn(e,"input"),output:vn(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=pn({...n,processors:t});return fn(e,r),hn(r,e),mn(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>In(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Zn(e,t,n),e.parseAsync=async(t,n)=>Nn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>An(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Pn(e,t,n),e.decode=(t,n)=>jn(e,t,n),e.encodeAsync=async(t,n)=>Rn(e,t,n),e.decodeAsync=async(t,n)=>Cn(e,t,n),e.safeEncode=(t,n)=>Dn(e,t,n),e.safeDecode=(t,n)=>Fn(e,t,n),e.safeEncodeAsync=async(t,n)=>Un(e,t,n),e.safeDecodeAsync=async(t,n)=>Jn(e,t,n),qn(e,"ZodType",{check(...e){const t=this.def;return this.clone(h(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return k(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$(n)})}(Kr,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=ln(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(Z(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(Z(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(dn(e))},optional(){return Rr(this)},exactOptional(){return new Cr({type:"optional",innerType:this})},nullable(){return Fr(this)},nullish(){return Rr(Fr(this))},nonoptional(e){return function(e,t){return new Mr({type:"nonoptional",innerType:e,...$(t)})}(this,e)},array(){return Sr(this)},or(e){return new Er({type:"union",options:[this,e],...$(t)});var t},and(e){return new Tr({type:"intersection",left:this,right:e})},transform(e){return Vr(this,new Pr({type:"transform",transform:e}))},default(e){return t=e,new Ur({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():b(t)}});var t},prefault(e){return t=e,new Jr({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():b(t)}});var t},catch(e){return new qr({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return Vr(this,e)},readonly(){return new Wr({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Qt.add(t,{description:e}),t},meta(...e){if(0===e.length)return Qt.get(this);const t=this.clone();return Qt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>Qt.get(e)?.description,configurable:!0}),e)),Vn=t("_ZodString",(e,t)=>{Me.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:u}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=yn[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),u&&(r.contentEncoding=u),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,qn(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new Ze({check:"string_format",format:"regex",...$(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new je({check:"string_format",format:"includes",...$(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new Re({check:"string_format",format:"starts_with",...$(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new Ce({check:"string_format",format:"ends_with",...$(t),suffix:e})}(...e))},min(...e){return this.check(un(...e))},max(...e){return this.check(an(...e))},length(...e){return this.check(cn(...e))},nonempty(...e){return this.check(un(1,...e))},lowercase(e){return this.check(function(e){return new Ae({check:"string_format",format:"lowercase",...$(e)})}(e))},uppercase(e){return this.check(function(e){return new Pe({check:"string_format",format:"uppercase",...$(e)})}(e))},trim(){return this.check(dn(e=>e.trim()))},normalize(...e){return this.check(function(e){return dn(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(dn(e=>e.toLowerCase()))},toUpperCase(){return this.check(dn(e=>e.toUpperCase()))},slugify(){return this.check(dn(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Wn=t("ZodString",(e,t)=>{Me.init(e,t),Vn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}(Bn,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}(Xn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}(fr,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}(Qn,t)),e.guid=t=>e.check(en(Yn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}(Hn,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}(Hn,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}(Hn,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}(Hn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}(er,t)),e.guid=t=>e.check(en(Yn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}(tr,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}(nr,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}(rr,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}(dr,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}(lr,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}(ir,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}(or,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}(sr,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}(ar,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}(ur,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}(cr,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}(pr,t)),e.datetime=t=>e.check(wn(t)),e.date=t=>e.check(kn(t)),e.time=t=>e.check(Sn(t)),e.duration=t=>e.check(On(t))});function Kn(e){return function(e,t){return new e({type:"string",...$(t)})}(Wn,e)}var Gn=t("ZodStringFormat",(e,t)=>{qe.init(e,t),Vn.init(e,t)}),Bn=t("ZodEmail",(e,t)=>{We.init(e,t),Gn.init(e,t)}),Yn=t("ZodGUID",(e,t)=>{Le.init(e,t),Gn.init(e,t)}),Hn=t("ZodUUID",(e,t)=>{Ve.init(e,t),Gn.init(e,t)}),Xn=t("ZodURL",(e,t)=>{Ke.init(e,t),Gn.init(e,t)}),Qn=t("ZodEmoji",(e,t)=>{Ge.init(e,t),Gn.init(e,t)}),er=t("ZodNanoID",(e,t)=>{Be.init(e,t),Gn.init(e,t)}),tr=t("ZodCUID",(e,t)=>{Ye.init(e,t),Gn.init(e,t)}),nr=t("ZodCUID2",(e,t)=>{He.init(e,t),Gn.init(e,t)}),rr=t("ZodULID",(e,t)=>{Xe.init(e,t),Gn.init(e,t)}),ir=t("ZodXID",(e,t)=>{Qe.init(e,t),Gn.init(e,t)}),or=t("ZodKSUID",(e,t)=>{et.init(e,t),Gn.init(e,t)}),sr=t("ZodIPv4",(e,t)=>{ot.init(e,t),Gn.init(e,t)}),ar=t("ZodIPv6",(e,t)=>{st.init(e,t),Gn.init(e,t)}),ur=t("ZodCIDRv4",(e,t)=>{at.init(e,t),Gn.init(e,t)}),cr=t("ZodCIDRv6",(e,t)=>{ut.init(e,t),Gn.init(e,t)}),dr=t("ZodBase64",(e,t)=>{dt.init(e,t),Gn.init(e,t)}),lr=t("ZodBase64URL",(e,t)=>{lt.init(e,t),Gn.init(e,t)}),pr=t("ZodE164",(e,t)=>{pt.init(e,t),Gn.init(e,t)}),fr=t("ZodJWT",(e,t)=>{ft.init(e,t),Gn.init(e,t)}),hr=t("ZodNumber",(e,t)=>{ht.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,format:s,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number";const d="number"==typeof c&&c>=(i??Number.NEGATIVE_INFINITY),l="number"==typeof u&&u<=(o??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof i&&(r.minimum=i),l?p?(r.maximum=u,r.exclusiveMaximum=!0):r.exclusiveMaximum=u:"number"==typeof o&&(r.maximum=o),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),qn(e,"ZodNumber",{gt(e,t){return this.check(rn(e,t))},gte(e,t){return this.check(on(e,t))},min(e,t){return this.check(on(e,t))},lt(e,t){return this.check(tn(e,t))},lte(e,t){return this.check(nn(e,t))},max(e,t){return this.check(nn(e,t))},int(e){return this.check(vr(e))},safe(e){return this.check(vr(e))},positive(e){return this.check(rn(0,e))},nonnegative(e){return this.check(on(0,e))},negative(e){return this.check(tn(0,e))},nonpositive(e){return this.check(nn(0,e))},multipleOf(e,t){return this.check(sn(e,t))},step(e,t){return this.check(sn(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function mr(e){return function(e,t){return new e({type:"number",checks:[],...$(t)})}(hr,e)}var _r=t("ZodNumberFormat",(e,t)=>{mt.init(e,t),hr.init(e,t)});function vr(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}(_r,e)}var yr=t("ZodBoolean",(e,t)=>{_t.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function gr(e){return function(e,t){return new e({type:"boolean",...$(t)})}(yr,e)}var br=t("ZodUnknown",(e,t)=>{vt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function wr(){return new br({type:"unknown"})}var zr=t("ZodNever",(e,t)=>{yt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function kr(e){return function(e,t){return new e({type:"never",...$(t)})}(zr,e)}var $r=t("ZodArray",(e,t)=>{bt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=fn(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,qn(e,"ZodArray",{min(e,t){return this.check(un(e,t))},nonempty(e){return this.check(un(1,e))},max(e,t){return this.check(an(e,t))},length(e,t){return this.check(cn(e,t))},unwrap(){return this.element}})});function Sr(e,t){return function(e,t,n){return new e({type:"array",element:t,...$(n)})}($r,e,t)}var xr=t("ZodObject",(e,t)=>{St.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const c in s)i.properties[c]=fn(s[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));u.size>0&&(i.required=Array.from(u)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=fn(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),p(e,"shape",()=>t.shape),qn(e,"ZodObject",{keyof(){return Zr(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:wr()})},loose(){return this.clone({...this._zod.def,catchall:wr()})},strict(){return this.clone({...this._zod.def,catchall:kr()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!g(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return k(e,h(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return f(this,"shape",n),n}}))}(this,e)},safeExtend(e){return function(e,t){if(!g(t))throw new Error("Invalid input to safeExtend: expected a plain object");return k(e,h(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return f(this,"shape",n),n}}))}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return k(e,h(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return f(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return k(e,h(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return f(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return k(e,h(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return f(this,"shape",r),r},checks:[]}))}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return k(t,h(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return f(this,"shape",i),i},checks:[]}))}(jr,this,e[0])},required(...e){return t=Mr,n=this,r=e[0],k(n,h(n._zod.def,{get shape(){const e=n._zod.def.shape,i={...e};if(r)for(const n in r){if(!(n in i))throw new Error(`Unrecognized key: "${n}"`);r[n]&&(i[n]=new t({type:"nonoptional",innerType:e[n]}))}else for(const n in e)i[n]=new t({type:"nonoptional",innerType:e[n]});return f(this,"shape",i),i}}));var t,n,r}})});function Or(e,t){const n={type:"object",shape:e??{},...$(t)};return new xr(n)}var Er=t("ZodUnion",(e,t)=>{Ot.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>fn(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});var Tr=t("ZodIntersection",(e,t)=>{Et.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=fn(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=fn(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]]})(e,t,n,r)});var Ir=t("ZodRecord",(e,t)=>{Nt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag?.patterns;if("loose"===o.mode&&a&&a.size>0){const e=fn(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of a)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=fn(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=fn(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=s._zod.values;if(u){const e=[...u].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});var Nr=t("ZodEnum",(e,t)=>{Zt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=s(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new Nr({...t,checks:[],...$(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Nr({...t,checks:[],...$(r),entries:i})}});function Zr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Nr({type:"enum",entries:n,...$(t)})}var Ar=t("ZodLiteral",(e,t)=>{At.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,i=[];for(const o of r.values)if(void 0===o){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof o){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});var Pr=t("ZodTransform",(e,t)=>{Pt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new r(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(Z(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Z(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});var jr=t("ZodOptional",(e,t)=>{Rt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Rr(e){return new jr({type:"optional",innerType:e})}var Cr=t("ZodExactOptional",(e,t)=>{Ct.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Dr=t("ZodNullable",(e,t)=>{Dt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=fn(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fr(e){return new Dr({type:"nullable",innerType:e})}var Ur=t("ZodDefault",(e,t)=>{Ft.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;fn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var Jr=t("ZodPrefault",(e,t)=>{Jt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;fn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Mr=t("ZodNonOptional",(e,t)=>{Mt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;fn(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var qr=t("ZodCatch",(e,t)=>{Lt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;fn(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Lr=t("ZodPipe",(e,t)=>{Vt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;fn(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function Vr(e,t){return new Lr({type:"pipe",in:e,out:t})}var Wr=t("ZodReadonly",(e,t)=>{Kt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;fn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Kr=t("ZodCustom",(e,t)=>{Yt.init(e,t),Ln.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});var Gr,Br,Yr,Hr=Kn().nullable(),Xr=(Gr=Kn(),(Br=wr())&&Br._zod?new Ir({type:"record",keyType:Gr,valueType:Br,...$(Yr)}):new Ir({type:"record",keyType:Kn(),valueType:Gr,...$(Br)})),Qr=Or({logo_url:Hr,primary_color:Kn(),secondary_color:Kn(),accent_color:Kn()}),ei=Or({customer:Or({id:Hr,email:Kn(),name:Kn(),avatar_url:Hr,joined_at:Hr}),shop:Or({id:Kn(),slug:Kn(),name:Kn(),currency:Kn(),branding:Qr}),token:Hr}),ti=Or({attachment_image_id:Or({cloudflare_image_id:Hr}).nullable()}),ni=Or({attachment_imageId:Or({cloudflareImageId:Hr}).nullable()}),ri=Or({uniqid:Kn(),status:Kn(),total:Kn(),total_display:Hr,currency:Kn(),created_at:Kn(),line_items:Sr(Or({product_title:Hr,quantity:mr(),product:ti.nullable()}))}),ii=Or({uniqid:Kn(),status:Kn(),total:Kn(),totalDisplay:Hr,currency:Kn(),createdAt:Kn(),lineItems:Sr(Or({productTitle:Hr,quantity:mr(),product:ni.nullable()}))}),oi=Or({invoices:Sr(ii),pagination:Or({page:mr(),limit:mr(),total:mr(),has_more:gr()})}),si=Or({gateway:Kn(),displayName:Hr,cryptoGateway:Hr.optional(),blockchain:Hr,cryptoAddress:Hr,apmMethod:Hr}),ai=Or({id:Kn(),uniqid:Kn(),status:Kn(),statusDetails:Hr,total:Kn(),totalDisplay:Hr,subtotal:Kn(),discount:Kn(),discountDisplay:Hr,tax:Kn(),taxPercentage:Kn(),currency:Kn(),createdAt:Kn(),updatedAt:Kn(),gatewayUpdatedAt:Hr,customFields:Xr.nullable(),balancePaidAmount:Kn(),currentPaymentAttemptId:Hr,lineItems:Sr(Or({id:Kn(),productTitle:Kn(),productType:Kn(),variantTitle:Hr,unitPrice:Kn(),quantity:mr(),total:Kn(),deliveryText:Hr,deliverySummary:Or({codes:Sr(Kn()),links:Sr(Or({label:Kn(),value:Kn(),href:Hr.optional()})),notes:Sr(Kn()),serials:Sr(Or({value:Kn(),is_replacement:gr(),is_replaced:gr()}))}).nullable(),deliveredAt:Hr,deliveryStatus:Zr(["PENDING","AWAITING_FULFILLMENT","DELIVERED","FAILED"]),customFields:Xr.nullable(),product:Or({uniqid:Kn(),slug:Hr,serviceText:Hr,attachment_imageId:Or({cloudflareImageId:Hr}).nullable()}).nullable()})),currentPayment:si.nullable(),payments:Sr(si)}),ui=(Or({quote:Or({enabled:gr(),currency:Kn(),min_amount:Kn(),max_amount:Hr,bonus_tiers:Sr(Or({min_amount:Kn(),bonus_percent:mr()}))})}),Or({invoice_id:Kn(),url:Kn()}),Or({id:Kn(),type:Kn(),status:Kn(),amount:Hr,currency:Hr,coupon_code:Hr,reason:Kn(),trigger_reference_type:Kn(),trigger_reference_id:Kn(),created_at:mr(),fulfilled_at:mr().nullable(),expires_at:mr().nullable()})),ci=Or({summary:Or({available:Kn(),pending:Kn(),lifetime_earned:Kn(),redeemed:Hr,currency:Kn()}),activity:Sr(ui),earned_after_invoice:Sr(ui),pending_after_invoice:Sr(ui)}),di=Or({id:Kn(),uniqid:Kn(),label:Hr,code:Kn(),url:Hr,status:Zr(["pending","active","inactive","rejected"]),is_primary:gr(),total_clicks:mr(),total_sales:mr(),total_revenue:Kn(),is_active:gr(),is_approved:gr(),requested_affiliate_revenue_percent:mr().nullable(),requested_affiliate_customer_discount_percent:mr().nullable(),affiliate_revenue_percent_override:mr().nullable(),affiliate_customer_discount_percent_override:mr().nullable(),effective_commission_percent:mr(),effective_customer_discount_percent:mr(),commission_shareback_percent:mr(),commission_shareback_enabled:gr(),max_commission_shareback_percent:mr(),created_at:Hr,updated_at:Hr}),li=Or({customer:Or({id:Kn(),email:Kn(),name:Hr}).nullable(),state:Kn(),can_create_custom_links:gr(),custom_link_request_disabled_reason:Hr,custom_links_require_approval:gr(),affiliate_codes_accepted_at_checkout:gr(),cash_payout_enabled:gr(),links:Sr(di),preferred_payout:Or({asset:Kn(),network:Kn(),address:Kn()}).nullable(),balance_currency:Kn(),balances:Or({pending:Kn(),available:Kn(),requested:Kn(),converted:Kn(),paid:Kn(),approved_total:Kn()}),commissions:Sr(Or({id:Kn(),invoice_id:Kn(),commission_amount:Kn(),base_amount:Kn(),discount_amount:Kn(),status:Kn(),created_at:Hr,paid_at:Hr,converted_at:Hr})),claims:Sr(Or({id:Kn(),type:Kn(),status:Kn(),amount:Kn(),currency:Kn(),allocations:Sr(Or({source_type:Kn(),commission_id:Hr,adjustment_id:Hr,amount:Kn()})),wallet_transaction_id:Hr,payout_asset:Hr,payout_network:Hr,payout_address:Hr,note:Hr,metadata:wr(),completed_at:Hr,rejected_at:Hr,cancelled_at:Hr,created_at:Hr,updated_at:Hr}))}),pi=Or({uniqid:Kn(),status:Kn(),gateway:Kn(),current_period_start:Kn(),current_period_end:Kn(),trial_end:Hr,cancel_at_period_end:gr(),canceled_at:Hr,created_at:Kn(),plan:Or({id:Kn(),uniqid:Kn(),name:Kn(),price:Kn(),currency:Kn(),interval:Kn(),interval_count:mr(),trial_days:mr()}).nullable(),payment_method:Or({id:Kn(),gateway:Kn(),type:Kn(),card_brand:Hr,card_last4:Hr,card_exp_month:mr().nullable(),card_exp_year:mr().nullable(),is_default:gr()}).nullable(),actions:Or({can_pause:gr(),can_resume:gr(),can_cancel:gr(),can_manage_payment_method:gr()})}),fi=(Or({enabled:gr(),account:Or({points_balance:mr(),lifetime_points:mr()}).nullable(),settings:Or({earn_rate_per_usd:mr(),redeem_value_per_point:mr(),min_redeem_points:mr()}).nullable(),transactions:Sr(Or({type:Zr(["EARN_ORDER","EARN_REVIEW","REDEEM","ADJUST"]),points:mr(),balance_after:mr(),description:Hr,created_at:Kn()}))}),Or({redeemed_points:mr(),wallet_amount:Kn(),currency:Kn(),points_balance:mr(),replayed:gr()}),Or({uniqid:Kn(),invoice_uniqid:Kn(),product_title:Kn(),period_days:mr(),starts_at:Kn(),expires_at:Kn(),status:Zr(["ACTIVE","EXPIRED","VOIDED"]),claim_status:Zr(["REQUESTED","APPROVED","DENIED"]).nullable(),created_at:Kn()})),hi=(Or({warranties:Sr(fi)}),Or({warranty:fi.extend({claim_status:function(e,t){return new Ar({type:"literal",values:Array.isArray(e)?e:[e],...$(t)})}("REQUESTED")})}),Or({shop:Or({id:Kn(),slug:Kn(),name:Kn(),currency:Kn(),branding:Qr}),customer:Or({email:Kn(),name:Kn()}),stats:Or({invoices_count:mr(),licenses_count:mr(),deliverables_count:mr(),tickets_count:mr()}),wallet:Or({available:Kn(),total:Kn(),hold:Kn(),currency:Kn(),enabled:gr()}).nullable(),rewards:ci,affiliate:li,invoices:Sr(ri),subscriptions:Sr(pi),licenses:Sr(Or({uniqid:Kn(),invoice_id:Kn(),status:Kn(),license_key:Kn(),hardware_id:Hr,expires_at:mr().nullable(),renewable:gr(),product:Or({title:Kn().optional()}).optional()})),deliverables:Sr(Or({id:Kn(),invoice_uniqid:Kn(),product_title:Kn(),kind:Zr(["file","serial","license"]),label:Kn(),value:Kn(),href:Hr,created_at:Kn()})),tickets:Sr(Or({uniqid:Kn(),title:Kn(),status:Kn(),updated_at:Kn(),created_at:Hr}))}),class extends Error{constructor(e,t,n){super(t),this.status=e,this.code=n,this.name="HeadlessCustomerError"}});function mi(e){if(!e)return null;try{const t=JSON.parse(e);if(!function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(t)||"string"!=typeof t.accessToken||!t.accessToken.startsWith("hcs_")||"string"!=typeof t.expiresAt||"number"!=typeof t.savedAt||!Number.isFinite(t.savedAt))return null;const n=Date.parse(t.expiresAt);return!Number.isFinite(n)||n<=Date.now()?null:{accessToken:t.accessToken,expiresAt:t.expiresAt,savedAt:t.savedAt}}catch{return null}}function _i(e){if(!e)return null;const t=e.match(/filename\*=UTF-8''([^;]+)/i);if(t?.[1])try{return decodeURIComponent(t[1])}catch{return t[1]}return e.match(/filename="([^"]+)"/i)?.[1]??null}function vi(e){try{return"undefined"==typeof window?null:window[e]}catch{return null}}var yi=class{constructor(e){if(this.memorySession=null,!e.shop.trim())throw new Error("HeadlessCustomerClient requires a shop.");if(!e.publishableKey.trim())throw new Error("HeadlessCustomerClient requires a publishableKey.");if(this.shop=e.shop.trim(),this.publishableKey=e.publishableKey.trim(),this.base=(e.apiBaseUrl??"https://api.shoppex.io").replace(/\/+$/,""),this.fetchImpl=e.fetchImpl??globalThis.fetch?.bind(globalThis),!this.fetchImpl)throw new Error("No fetch implementation available; pass fetchImpl.");this.storage=e.storage??vi("sessionStorage"),this.persistentStorage=e.persistentStorage??vi("localStorage"),this.storageKey=`shoppex_headless_customer_session:${this.shop}`}getSession(){const e=this.memorySession?[this.memorySession]:[];if(this.storage)try{const t=mi(this.storage.getItem(this.storageKey));t&&e.push(t)}catch{}if(this.persistentStorage)try{const t=mi(this.persistentStorage.getItem(this.storageKey));t&&e.push(t)}catch{}const t=e.sort((e,t)=>t.savedAt-e.savedAt)[0]??null;return t?(this.memorySession=t,{accessToken:t.accessToken,expiresAt:t.expiresAt}):(this.clearSession(),null)}clearSession(){this.memorySession=null;try{this.storage?.removeItem(this.storageKey)}catch{}try{this.persistentStorage?.removeItem(this.storageKey)}catch{}}saveSession(e,t){const n={...e,savedAt:Date.now()};this.memorySession=n;const r=t?this.persistentStorage:this.storage,i=t?this.storage:this.persistentStorage;try{r?.setItem(this.storageKey,JSON.stringify(n))}catch{}try{i?.removeItem(this.storageKey)}catch{}}url(e,t={}){const n=new URL(`${this.base}/v1/customer${e}`);n.searchParams.set("shop",this.shop);for(const[r,i]of Object.entries(t))void 0!==i&&""!==i&&n.searchParams.set(r,i);return n.toString()}async request(e,t={}){const n=t.authenticated?this.getSession():null;if(t.authenticated&&!n)throw new hi(401,"Customer session is missing or expired.","UNAUTHORIZED");const r={accept:"application/json","x-shoppex-publishable-key":this.publishableKey,...void 0===t.body?{}:{"content-type":"application/json"},...n?{authorization:`Bearer ${n.accessToken}`}:{}},i=await this.fetchImpl(this.url(e,t.query),{method:t.method??"GET",headers:r,...void 0===t.body?{}:{body:JSON.stringify(t.body)},cache:"no-store"});let o=null;try{o=await i.json()}catch{}if(!i.ok||!o||o.error)throw 401===i.status&&t.authenticated&&this.clearSession(),new hi(i.status,o?.error??`Request failed (${i.status})`,o?.error_code??null);if(!t.schema)return o.data;const s=t.schema.safeParse(o.data);if(!s.success)throw new hi(i.status,"Customer API response did not match the expected contract.");return s.data}requestOtp(e){return this.request("/auth/otp/request",{method:"POST",body:{shop:this.shop,email:e}})}async verifyOtp(e,t,n={}){const r=await this.request("/auth/otp/verify",{method:"POST",body:{shop:this.shop,email:e,otp:t,remember_me:n.rememberMe??!1}}),i="string"==typeof r?.expires_at?Date.parse(r.expires_at):NaN;if("string"!=typeof r?.access_token||!r.access_token.startsWith("hcs_")||"string"!=typeof r.expires_at||!Number.isFinite(i)||i<=Date.now())throw new hi(200,"Customer API response did not match the expected contract.");const o={accessToken:r.access_token,expiresAt:r.expires_at};return this.saveSession(o,n.rememberMe??!1),o}async me(){const e=await this.request("/me",{authenticated:!0,schema:ei});if(null!==e.token)throw new hi(200,"Customer API response did not match the expected contract.");return{customer:e.customer,shop:e.shop}}orders(e={}){return this.request("/invoices",{authenticated:!0,schema:oi,query:{page:void 0===e.page?void 0:String(e.page),limit:void 0===e.limit?void 0:String(e.limit),status:e.status,q:e.search}})}async order(e){const t=await this.request(`/invoice/${encodeURIComponent(e)}`,{authenticated:!0,schema:ai});return{...t,lineItems:t.lineItems.map(e=>({...e,deliverySummary:e.deliverySummary?{...e.deliverySummary,links:e.deliverySummary.links.map(e=>{const t=function(e){if(!e)return null;try{const t=new URL(e,"https://headless-customer.invalid");if(!/^\/api\/customer\/invoice\/[^/]+\/download$/.test(t.pathname))return null;const n=t.searchParams.get("file_index");if(null===n||!/^\d+$/.test(n))return null;const r=Number(n);return Number.isSafeInteger(r)?r:null}catch{return null}}(e.href);return null===t?e:{...e,href:null,downloadIndex:t}})}:null}))}}async download(e,t){if(!Number.isSafeInteger(t)||t<0)throw new hi(400,"download requires a non-negative integer fileIndex from order().deliverySummary.links.","INVALID_FILE_INDEX");const n=this.getSession();if(!n)throw new hi(401,"Customer session is missing or expired.","UNAUTHORIZED");const r=await this.fetchImpl(this.url(`/invoice/${encodeURIComponent(e)}/download`,{file_index:String(t)}),{method:"GET",headers:{"x-shoppex-publishable-key":this.publishableKey,authorization:`Bearer ${n.accessToken}`},cache:"no-store"});if(!r.ok){401===r.status&&this.clearSession();let e=`Download failed (${r.status})`;try{const t=await r.json();t.error&&(e=t.error)}catch{}throw new hi(r.status,e)}const i=r.headers.get("content-type");if(i?.toLowerCase().startsWith("text/html"))throw new hi(502,"Shoppex returned an unsafe aggregate download response.","UNSAFE_DOWNLOAD_RESPONSE");return{blob:await r.blob(),filename:_i(r.headers.get("content-disposition")),contentType:i}}async logout(){if(this.getSession()){try{await this.request("/auth/logout",{method:"POST",authenticated:!0})}catch(e){if(e instanceof hi&&401===e.status)return;throw e}this.clearSession()}}};exports.HeadlessCustomerClient=yi,exports.HeadlessCustomerError=hi,exports.createCustomerClient=function(e){return new yi(e)};
|
|
2
|
+
//# sourceMappingURL=customer.cjs.map
|