@halliday-sdk/payments 2.1.0 → 2.3.0
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/paymentsApiClient/index.cjs.min.js +1 -1
- package/dist/paymentsApiClient/index.cjs.min.js.map +1 -1
- package/dist/paymentsApiClient/index.d.ts +52 -1
- package/dist/paymentsApiClient/index.esm.min.js +1 -1
- package/dist/paymentsApiClient/index.esm.min.js.map +1 -1
- package/dist/paymentsWidget/index.cjs.min.js +1 -1
- package/dist/paymentsWidget/index.cjs.min.js.map +1 -1
- package/dist/paymentsWidget/index.d.ts +172 -2
- package/dist/paymentsWidget/index.esm.min.js +1 -1
- package/dist/paymentsWidget/index.esm.min.js.map +1 -1
- package/dist/paymentsWidget/index.umd.min.js +1 -1
- package/dist/paymentsWidget/index.umd.min.js.map +1 -1
- package/package.json +5 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).hallidayPayments={})}(this,(function(e){"use strict";const t="https://app.halliday.xyz",n=/^[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}$/;function o(e,t,n){function o(n,o){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in s.prototype)Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=o}const i=n?.Parent??Object;class r extends i{}function s(e){var t;const i=n?.Parent?new r:this;o(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),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}class i extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const r={};function s(e){return r}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)}function l(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function f(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let o=0;o<e;o++)n+=t[Math.floor(26*Math.random())];return n}function h(e){return JSON.stringify(e)}function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const _=u((()=>{try{return new Function(""),!0}catch(e){return!1}}));function g(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}const y=new Set(["string","number","symbol"]);function v(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function z(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}const b={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 k(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==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 I(e){return"string"==typeof e?e:e?.message}function $(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const i=I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??"Invalid input";o.message=i}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function T(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function A(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const P=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,a,2),enumerable:!0})},x=o("$ZodError",P),O=o("$ZodError",P,{Parent:Error});const N=e=>(t,n,o,r)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new i;if(u.issues.length){const t=new(r?.Err??e)(u.issues.map((e=>$(e,a,s()))));throw Error.captureStackTrace(t,r?.callee),t}return u.value},Z=e=>async(t,n,o,i)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(i?.Err??e)(a.issues.map((e=>$(e,r,s()))));throw Error.captureStackTrace(t,i?.callee),t}return a.value},S=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new i;return a.issues.length?{success:!1,error:new(e??x)(a.issues.map((e=>$(e,r,s()))))}:{success:!0,data:a.value}},D=S(O),R=e=>async(t,n,o)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>$(e,i,s()))))}:{success:!0,data:r.value}},C=R(O),M=/^[cC][^\s-]{8,}$/,U=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,j=/^[0-9a-vA-V]{20}$/,L=/^[A-Za-z0-9]{27}$/,V=/^[a-zA-Z0-9_-]{21}$/,W=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,B=/^([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})$/,G=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)$/,H=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const q=/^(?:(?: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])$/,Y=/^(([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})$/,K=/^((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])$/,J=/^(([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])$/,X=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Q=/^[A-Za-z0-9_-]*$/,ee=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,te=/^\+(?:[0-9]){6,14}[0-9]$/,ne="((\\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])))",oe=new RegExp(`^${ne}$`);function ie(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}const re=/^\d+n?$/,se=/^\d+$/,ae=/^-?\d+(?:\.\d+)?/i,ue=/true|false/i,ce=/^[^A-Z]*$/,de=/^[^a-z]*$/,le=o("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),pe={number:"number",bigint:"bigint",object:"date"},fe=o("$ZodCheckLessThan",((e,t)=>{le.init(e,t);const n=pe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),he=o("$ZodCheckGreaterThan",((e,t)=>{le.init(e,t);const n=pe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),me=o("$ZodCheckMultipleOf",((e,t)=>{le.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.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(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})}})),_e=o("$ZodCheckNumberFormat",((e,t)=>{le.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[i,r]=b[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=r,n&&(o.pattern=se)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",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:o,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:o,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>r&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}})),ge=o("$ZodCheckMaxLength",((e,t)=>{le.init(e,t),e._zod.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 o=n.value;if(o.length<=t.maximum)return;const i=T(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}})),ye=o("$ZodCheckMinLength",((e,t)=>{le.init(e,t),e._zod.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 o=n.value;if(o.length>=t.minimum)return;const i=T(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}})),ve=o("$ZodCheckLengthEquals",((e,t)=>{le.init(e,t),e._zod.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 o=n.value,i=o.length;if(i===t.length)return;const r=T(o),s=i>t.length;n.issues.push({origin:r,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:n.value,inst:e,continue:!t.abort})}})),we=o("$ZodCheckStringFormat",((e,t)=>{var n;le.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))})),(n=e._zod).check??(n.check=n=>{if(!t.pattern)throw new Error("Not implemented.");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})})})),ze=o("$ZodCheckRegex",((e,t)=>{we.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})}})),be=o("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=ce),we.init(e,t)})),ke=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=de),we.init(e,t)})),Ee=o("$ZodCheckIncludes",((e,t)=>{le.init(e,t);const n=v(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)})),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})}})),Ie=o("$ZodCheckStartsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`^${v(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})}})),$e=o("$ZodCheckEndsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`.*${v(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})}})),Te=o("$ZodCheckOverwrite",((e,t)=>{le.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class Ae{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))),o=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const Pe={major:4,minor:0,patch:0},xe=o("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.id=t.type+"_"+f(10),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pe;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let o,r=k(e);for(const s of t){if(s._zod.when){if(!s._zod.when(e))continue}else if(r)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new i;if(o||a instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(r||(r=k(e,t)))}));else{if(e.issues.length===t)continue;r||(r=k(e,t))}}return o?o.then((()=>e)):e};e._zod.run=(n,r)=>{const s=e._zod.parse(n,r);if(s instanceof Promise){if(!1===r.async)throw new i;return s.then((e=>t(e,o,r)))}return t(s,o,r)}}e["~standard"]={validate:t=>{try{const n=D(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return C(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Oe=o("$ZodString",((e,t)=>{var n;xe.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,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Ne=o("$ZodStringFormat",((e,t)=>{we.init(e,t),Oe.init(e,t)})),Ze=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=B),Ne.init(e,t)})),Se=o("$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=G(e))}else t.pattern??(t.pattern=G());Ne.init(e,t)})),De=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=H),Ne.init(e,t)})),Re=o("$ZodURL",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{try{const o=new URL(n.value);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ee.source,input:n.value,inst:e})),void(t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e})))}catch(t){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e})}}})),Ce=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ne.init(e,t)})),Me=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=V),Ne.init(e,t)})),Ue=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=M),Ne.init(e,t)})),Fe=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=U),Ne.init(e,t)})),je=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=F),Ne.init(e,t)})),Le=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=j),Ne.init(e,t)})),Ve=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=L),Ne.init(e,t)})),We=o("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){let t=`${ne}T${ie(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}(t)),Ne.init(e,t)})),Be=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=oe),Ne.init(e,t)})),Ge=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ie(t)}$`)),Ne.init(e,t)})),He=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=W),Ne.init(e,t)})),qe=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=q),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),Ye=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=Y),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e})}}})),Ke=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=K),Ne.init(e,t)})),Je=o("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=J),Ne.init(e,t),e._zod.check=t=>{const[n,o]=t.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e})}}}));function Xe(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Qe=o("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=X),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=t=>{Xe(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e})}}));const et=o("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=Q),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=t=>{(function(e){if(!Q.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Xe(t.padEnd(4*Math.ceil(t.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e})}})),tt=o("$ZodE164",((e,t)=>{t.pattern??(t.pattern=te),Ne.init(e,t)}));const nt=o("$ZodJWT",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n,i=JSON.parse(atob(o));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})}})),ot=o("$ZodNumber",((e,t)=>{xe.init(e,t),e._zod.pattern=e._zod.bag.pattern??ae,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const r="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,...r?{received:r}:{}}),n}})),it=o("$ZodNumber",((e,t)=>{_e.init(e,t),ot.init(e,t)})),rt=o("$ZodBoolean",((e,t)=>{xe.init(e,t),e._zod.pattern=ue,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}})),st=o("$ZodBigInt",((e,t)=>{xe.init(e,t),e._zod.pattern=re,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}const{value:i}=n;return"bigint"==typeof i||n.issues.push({expected:"bigint",code:"invalid_type",input:i,inst:e}),n}})),at=o("$ZodAny",((e,t)=>{xe.init(e,t),e._zod.parse=e=>e})),ut=o("$ZodUnknown",((e,t)=>{xe.init(e,t),e._zod.parse=e=>e})),ct=o("$ZodNever",((e,t)=>{xe.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function dt(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}const lt=o("$ZodArray",((e,t)=>{xe.init(e,t),e._zod.parse=(n,o)=>{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 r=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?r.push(a.then((t=>dt(t,n,e)))):dt(a,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function pt(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}function ft(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...E(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const ht=o("$ZodObject",((e,t)=>{xe.init(e,t);const n=u((()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof xe))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}));l(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n}));let o;const i=m,s=!r.jitless,a=s&&_.value,{catchall:c}=t;let d;e._zod.parse=(r,u)=>{d??(d=n.value);const l=r.value;if(!i(l))return r.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),r;const p=[];if(s&&a&&!1===u?.async&&!0!==u.jitless)o||(o=(e=>{const t=new Ae(["shape","payload","ctx"]),{keys:o,optionalKeys:i}=n.value,r=e=>{const t=h(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);for(const e of o)s[e]=f(15);t.write("const newResult = {}");for(const e of o)if(i.has(e)){const n=s[e];t.write(`const ${n} = ${r(e)};`);const o=h(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=s[e];t.write(`const ${n} = ${r(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${h(e)}, ...iss.path] : [${h(e)}]\n })));`),t.write(`newResult[${h(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),r=o(r,u);else{r.value={};const e=d.shape;for(const t of d.keys){const n=e[t],o=n._zod.run({value:l[t],issues:[]},u),i="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?p.push(o.then((e=>i?ft(e,r,t,l):pt(e,r,t)))):i?ft(o,r,t,l):pt(o,r,t)}}if(!c)return p.length?Promise.all(p).then((()=>r)):r;const m=[],_=d.keySet,g=c._zod,y=g.def.type;for(const e of Object.keys(l)){if(_.has(e))continue;if("never"===y){m.push(e);continue}const t=g.run({value:l[e],issues:[]},u);t instanceof Promise?p.push(t.then((t=>pt(t,r,e)))):pt(t,r,e)}return m.length&&r.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),p.length?Promise.all(p).then((()=>r)):r}}));function mt(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>$(e,o,s())))))}),t}const _t=o("$ZodUnion",((e,t)=>{xe.init(e,t),l(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),l(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("|")})$`)}})),e._zod.parse=(n,o)=>{let i=!1;const r=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)r.push(t),i=!0;else{if(0===t.issues.length)return t;r.push(t)}}return i?Promise.all(r).then((t=>mt(t,n,e,o))):mt(r,n,e,o)}})),gt=o("$ZodDiscriminatedUnion",((e,t)=>{_t.init(e,t);const n=e._zod.parse;l(e._zod,"propValues",(()=>{const e={};for(const n of t.options){const o=n._zod.propValues;if(!o||0===Object.keys(o).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(o)){e[t]||(e[t]=new Set);for(const o of n)e[t].add(o)}}return e}));const o=u((()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n}));e._zod.parse=(i,r)=>{const s=i.value;if(!m(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(i,r):t.unionFallback?n(i,r):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),i)}})),yt=o("$ZodIntersection",((e,t)=>{xe.init(e,t),e._zod.parse=(e,n)=>{const{value:o}=e,i=t.left._zod.run({value:o,issues:[]},n),r=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||r instanceof Promise?Promise.all([i,r]).then((([t,n])=>wt(e,t,n))):wt(e,i,r)}}));function vt(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),o=Object.keys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of o){const o=vt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i[n]=o.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 o=0;o<e.length;o++){const i=vt(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function wt(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),k(e))return e;const o=vt(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const zt=o("$ZodRecord",((e,t)=>{xe.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!g(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const r=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const s=t.valueType._zod.run({value:i[e],issues:[]},o);s instanceof Promise?r.push(s.then((t=>{t.issues.length&&n.issues.push(...E(e,t.issues)),n.value[e]=t.value}))):(s.issues.length&&n.issues.push(...E(e,s.issues)),n.value[e]=s.value)}let a;for(const e in i)s.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map((e=>$(e,o,s()))),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:i[a],issues:[]},o);c instanceof Promise?r.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 r.length?Promise.all(r).then((()=>n)):n}})),bt=o("$ZodEnum",((e,t)=>{xe.init(e,t);const n=function(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))}(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter((e=>y.has(typeof e))).map((e=>"string"==typeof e?v(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return e._zod.values.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),kt=o("$ZodLiteral",((e,t)=>{xe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?v(e):e?e.toString():String(e))).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}})),Et=o("$ZodTransform",((e,t)=>{xe.init(e,t),e._zod.parse=(e,n)=>{const o=t.transform(e.value,e);if(n.async){return(o instanceof Promise?o:Promise.resolve(o)).then((t=>(e.value=t,e)))}if(o instanceof Promise)throw new i;return e.value=o,e}})),It=o("$ZodOptional",((e,t)=>{xe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),l(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)})),$t=o("$ZodNullable",((e,t)=>{xe.init(e,t),l(e._zod,"optin",(()=>t.innerType._zod.optin)),l(e._zod,"optout",(()=>t.innerType._zod.optout)),l(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0})),l(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)})),Tt=o("$ZodDefault",((e,t)=>{xe.init(e,t),e._zod.optin="optional",l(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>At(e,t))):At(o,t)}}));function At(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Pt=o("$ZodPrefault",((e,t)=>{xe.init(e,t),e._zod.optin="optional",l(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),xt=o("$ZodNonOptional",((e,t)=>{xe.init(e,t),l(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,o)=>{const i=t.innerType._zod.run(n,o);return i instanceof Promise?i.then((t=>Ot(t,e))):Ot(i,e)}}));function Ot(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nt=o("$ZodCatch",((e,t)=>{xe.init(e,t),l(e._zod,"optin",(()=>t.innerType._zod.optin)),l(e._zod,"optout",(()=>t.innerType._zod.optout)),l(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>$(e,n,s())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>$(e,n,s())))},input:e.value}),e.issues=[]),e)}})),Zt=o("$ZodPipe",((e,t)=>{xe.init(e,t),l(e._zod,"values",(()=>t.in._zod.values)),l(e._zod,"optin",(()=>t.in._zod.optin)),l(e._zod,"optout",(()=>t.out._zod.optout)),e._zod.parse=(e,n)=>{const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>St(e,t,n))):St(o,t,n)}}));function St(e,t,n){return k(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const Dt=o("$ZodReadonly",((e,t)=>{xe.init(e,t),l(e._zod,"propValues",(()=>t.innerType._zod.propValues)),l(e._zod,"optin",(()=>t.innerType._zod.optin)),l(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(Rt):Rt(o)}}));function Rt(e){return e.value=Object.freeze(e.value),e}const Ct=o("$ZodCustom",((e,t)=>{le.init(e,t),xe.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,i=t.fn(o);if(i instanceof Promise)return i.then((t=>Mt(t,n,o,e)));Mt(i,n,o,e)}}));function Mt(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push(A(e))}}class Ut{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ft(){return new Ut}const jt=Ft();function Lt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function Vt(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Wt(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function Bt(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Gt(e,t){return new fe({check:"less_than",...z(t),value:e,inclusive:!1})}function Ht(e,t){return new fe({check:"less_than",...z(t),value:e,inclusive:!0})}function qt(e,t){return new he({check:"greater_than",...z(t),value:e,inclusive:!1})}function Yt(e,t){return new he({check:"greater_than",...z(t),value:e,inclusive:!0})}function Kt(e,t){return new me({check:"multiple_of",...z(t),value:e})}function Jt(e,t){return new ge({check:"max_length",...z(t),maximum:e})}function Xt(e,t){return new ye({check:"min_length",...z(t),minimum:e})}function Qt(e,t){return new ve({check:"length_equals",...z(t),length:e})}function en(e){return new Te({check:"overwrite",tx:e})}const tn=o("ZodISODateTime",((e,t)=>{We.init(e,t),zn.init(e,t)}));function nn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}(tn,e)}const on=o("ZodISODate",((e,t)=>{Be.init(e,t),zn.init(e,t)}));function rn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}(on,e)}const sn=o("ZodISOTime",((e,t)=>{Ge.init(e,t),zn.init(e,t)}));function an(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}(sn,e)}const un=o("ZodISODuration",((e,t)=>{He.init(e,t),zn.init(e,t)}));function cn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}(un,e)}const dn=(e,t)=>{x.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},o={_errors:[]},i=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>i({issues:e})));else if("invalid_key"===t.code)i({issues:t.issues});else if("invalid_element"===t.code)i({issues:t.issues});else if(0===t.path.length)o._errors.push(n(t));else{let e=o,i=0;for(;i<t.path.length;){const o=t.path[i];i===t.path.length-1?(e[o]=e[o]||{_errors:[]},e[o]._errors.push(n(t))):e[o]=e[o]||{_errors:[]},e=e[o],i++}}};return i(e),o}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];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))):o.push(t(i));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},ln=o("ZodError",dn),pn=o("ZodError",dn,{Parent:Error}),fn=N(pn),hn=Z(pn),mn=S(pn),_n=R(pn),gn=o("ZodType",((e,t)=>(xe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>w(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>fn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>mn(e,t,n),e.parseAsync=async(t,n)=>hn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>_n(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...z(n)})}(Oo,e,t)}(t,n)),e.superRefine=t=>e.check(function(e,t){const n=function(e,t){const n=new le({check:"custom",...z(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(A(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(A(o))}},e(t.value,t))),t);return n}(t)),e.overwrite=t=>e.check(en(t)),e.optional=()=>zo(e),e.nullable=()=>ko(e),e.nullish=()=>zo(ko(e)),e.nonoptional=t=>function(e,t){return new $o({type:"nonoptional",innerType:e,...z(t)})}(e,t),e.array=()=>oo(e),e.or=t=>ao([e,t]),e.and=t=>new lo({type:"intersection",left:e,right:t}),e.transform=t=>Po(e,vo(t)),e.default=t=>{return n=t,new Eo({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.prefault=t=>{return n=t,new Io({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.catch=t=>{return new To({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Po(e,t),e.readonly=()=>new xo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return jt.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>jt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return jt.get(e);const n=e.clone();return jt.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),yn=o("_ZodString",((e,t)=>{Oe.init(e,t),gn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ze({check:"string_format",format:"regex",...z(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Ee({check:"string_format",format:"includes",...z(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ie({check:"string_format",format:"starts_with",...z(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new $e({check:"string_format",format:"ends_with",...z(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Xt(...t)),e.max=(...t)=>e.check(Jt(...t)),e.length=(...t)=>e.check(Qt(...t)),e.nonempty=(...t)=>e.check(Xt(1,...t)),e.lowercase=t=>e.check(function(e){return new be({check:"string_format",format:"lowercase",...z(e)})}(t)),e.uppercase=t=>e.check(function(e){return new ke({check:"string_format",format:"uppercase",...z(e)})}(t)),e.trim=()=>e.check(en((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return en((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(en((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(en((e=>e.toUpperCase())))})),vn=o("ZodString",((e,t)=>{Oe.init(e,t),yn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}(bn,t)),e.url=t=>e.check(Vt(In,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}(jn,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}(Tn,t)),e.guid=t=>e.check(Lt(kn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}(En,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}(En,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}(En,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}(En,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}(An,t)),e.guid=t=>e.check(Lt(kn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}(Pn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}(xn,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}(On,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}(Mn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}(Un,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}(Nn,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}(Zn,t)),e.ipv4=t=>e.check(Wt(Sn,t)),e.ipv6=t=>e.check(Bt(Dn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}(Rn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}(Cn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}(Fn,t)),e.datetime=t=>e.check(nn(t)),e.date=t=>e.check(rn(t)),e.time=t=>e.check(an(t)),e.duration=t=>e.check(cn(t))}));function wn(e){return function(e,t){return new e({type:"string",...z(t)})}(vn,e)}const zn=o("ZodStringFormat",((e,t)=>{Ne.init(e,t),yn.init(e,t)})),bn=o("ZodEmail",((e,t)=>{De.init(e,t),zn.init(e,t)})),kn=o("ZodGUID",((e,t)=>{Ze.init(e,t),zn.init(e,t)})),En=o("ZodUUID",((e,t)=>{Se.init(e,t),zn.init(e,t)})),In=o("ZodURL",((e,t)=>{Re.init(e,t),zn.init(e,t)}));function $n(e){return Vt(In,e)}const Tn=o("ZodEmoji",((e,t)=>{Ce.init(e,t),zn.init(e,t)})),An=o("ZodNanoID",((e,t)=>{Me.init(e,t),zn.init(e,t)})),Pn=o("ZodCUID",((e,t)=>{Ue.init(e,t),zn.init(e,t)})),xn=o("ZodCUID2",((e,t)=>{Fe.init(e,t),zn.init(e,t)})),On=o("ZodULID",((e,t)=>{je.init(e,t),zn.init(e,t)})),Nn=o("ZodXID",((e,t)=>{Le.init(e,t),zn.init(e,t)})),Zn=o("ZodKSUID",((e,t)=>{Ve.init(e,t),zn.init(e,t)})),Sn=o("ZodIPv4",((e,t)=>{qe.init(e,t),zn.init(e,t)}));const Dn=o("ZodIPv6",((e,t)=>{Ye.init(e,t),zn.init(e,t)}));const Rn=o("ZodCIDRv4",((e,t)=>{Ke.init(e,t),zn.init(e,t)})),Cn=o("ZodCIDRv6",((e,t)=>{Je.init(e,t),zn.init(e,t)})),Mn=o("ZodBase64",((e,t)=>{Qe.init(e,t),zn.init(e,t)})),Un=o("ZodBase64URL",((e,t)=>{et.init(e,t),zn.init(e,t)})),Fn=o("ZodE164",((e,t)=>{tt.init(e,t),zn.init(e,t)})),jn=o("ZodJWT",((e,t)=>{nt.init(e,t),zn.init(e,t)})),Ln=o("ZodNumber",((e,t)=>{ot.init(e,t),gn.init(e,t),e.gt=(t,n)=>e.check(qt(t,n)),e.gte=(t,n)=>e.check(Yt(t,n)),e.min=(t,n)=>e.check(Yt(t,n)),e.lt=(t,n)=>e.check(Gt(t,n)),e.lte=(t,n)=>e.check(Ht(t,n)),e.max=(t,n)=>e.check(Ht(t,n)),e.int=t=>e.check(Bn(t)),e.safe=t=>e.check(Bn(t)),e.positive=t=>e.check(qt(0,t)),e.nonnegative=t=>e.check(Yt(0,t)),e.negative=t=>e.check(Gt(0,t)),e.nonpositive=t=>e.check(Ht(0,t)),e.multipleOf=(t,n)=>e.check(Kt(t,n)),e.step=(t,n)=>e.check(Kt(t,n)),e.finite=()=>e;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 Vn(e){return function(e,t){return new e({type:"number",checks:[],...z(t)})}(Ln,e)}const Wn=o("ZodNumberFormat",((e,t)=>{it.init(e,t),Ln.init(e,t)}));function Bn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}(Wn,e)}const Gn=o("ZodBoolean",((e,t)=>{rt.init(e,t),gn.init(e,t)}));function Hn(e){return function(e,t){return new e({type:"boolean",...z(t)})}(Gn,e)}const qn=o("ZodBigInt",((e,t)=>{st.init(e,t),gn.init(e,t),e.gte=(t,n)=>e.check(Yt(t,n)),e.min=(t,n)=>e.check(Yt(t,n)),e.gt=(t,n)=>e.check(qt(t,n)),e.gte=(t,n)=>e.check(Yt(t,n)),e.min=(t,n)=>e.check(Yt(t,n)),e.lt=(t,n)=>e.check(Gt(t,n)),e.lte=(t,n)=>e.check(Ht(t,n)),e.max=(t,n)=>e.check(Ht(t,n)),e.positive=t=>e.check(qt(BigInt(0),t)),e.negative=t=>e.check(Gt(BigInt(0),t)),e.nonpositive=t=>e.check(Ht(BigInt(0),t)),e.nonnegative=t=>e.check(Yt(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Kt(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function Yn(e){return function(e,t){return new e({type:"bigint",...z(t)})}(qn,e)}const Kn=o("ZodAny",((e,t)=>{at.init(e,t),gn.init(e,t)}));function Jn(){return new Kn({type:"any"})}const Xn=o("ZodUnknown",((e,t)=>{ut.init(e,t),gn.init(e,t)}));function Qn(){return new Xn({type:"unknown"})}const eo=o("ZodNever",((e,t)=>{ct.init(e,t),gn.init(e,t)}));function to(e){return function(e,t){return new e({type:"never",...z(t)})}(eo,e)}const no=o("ZodArray",((e,t)=>{lt.init(e,t),gn.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Xt(t,n)),e.nonempty=t=>e.check(Xt(1,t)),e.max=(t,n)=>e.check(Jt(t,n)),e.length=(t,n)=>e.check(Qt(t,n)),e.unwrap=()=>e.element}));function oo(e,t){return function(e,t,n){return new e({type:"array",element:t,...z(n)})}(no,e,t)}const io=o("ZodObject",((e,t)=>{ht.init(e,t),gn.init(e,t),l(e,"shape",(()=>Object.fromEntries(Object.entries(e._zod.def.shape)))),e.keyof=()=>mo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Qn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Qn()}),e.strict=()=>e.clone({...e._zod.def,catchall:to()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return p(this,"shape",n),n},checks:[]};return w(e,n)}(e,t),e.merge=t=>{return o=t,w(n=e,{...n._zod.def,get shape(){const e={...n._zod.def.shape,...o._zod.def.shape};return p(this,"shape",e),e},catchall:o._zod.def.catchall,checks:[]});var n,o},e.pick=t=>function(e,t){const n={},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=o.shape[e])}return w(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.omit=t=>function(e,t){const n={...e._zod.def.shape},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return w(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)i[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return w(t,{...t._zod.def,shape:i,checks:[]})}(wo,e,t[0]),e.required=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)i[t]=new e({type:"nonoptional",innerType:o[t]});return w(t,{...t._zod.def,shape:i,checks:[]})}($o,e,t[0])}));function ro(e,t){const n={type:"object",get shape(){return p(this,"shape",{...e}),this.shape},...z(t)};return new io(n)}const so=o("ZodUnion",((e,t)=>{_t.init(e,t),gn.init(e,t),e.options=t.options}));function ao(e,t){return new so({type:"union",options:e,...z(t)})}const uo=o("ZodDiscriminatedUnion",((e,t)=>{so.init(e,t),gt.init(e,t)}));function co(e,t,n){return new uo({type:"union",options:t,discriminator:e,...z(n)})}const lo=o("ZodIntersection",((e,t)=>{yt.init(e,t),gn.init(e,t)}));const po=o("ZodRecord",((e,t)=>{zt.init(e,t),gn.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}));function fo(e,t,n){return new po({type:"record",keyType:e,valueType:t,...z(n)})}const ho=o("ZodEnum",((e,t)=>{bt.init(e,t),gn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{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 ho({...t,checks:[],...z(o),entries:i})},e.exclude=(e,o)=>{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 ho({...t,checks:[],...z(o),entries:i})}}));function mo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new ho({type:"enum",entries:n,...z(t)})}const _o=o("ZodLiteral",((e,t)=>{kt.init(e,t),gn.init(e,t),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]}})}));function go(e,t){return new _o({type:"literal",values:Array.isArray(e)?e:[e],...z(t)})}const yo=o("ZodTransform",((e,t)=>{Et.init(e,t),gn.init(e,t),e._zod.parse=(n,o)=>{n.addIssue=o=>{if("string"==typeof o)n.issues.push(A(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),n.issues.push(A(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n))):(n.value=i,n)}}));function vo(e){return new yo({type:"transform",transform:e})}const wo=o("ZodOptional",((e,t)=>{It.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function zo(e){return new wo({type:"optional",innerType:e})}const bo=o("ZodNullable",((e,t)=>{$t.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function ko(e){return new bo({type:"nullable",innerType:e})}const Eo=o("ZodDefault",((e,t)=>{Tt.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const Io=o("ZodPrefault",((e,t)=>{Pt.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const $o=o("ZodNonOptional",((e,t)=>{xt.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const To=o("ZodCatch",((e,t)=>{Nt.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Ao=o("ZodPipe",((e,t)=>{Zt.init(e,t),gn.init(e,t),e.in=t.in,e.out=t.out}));function Po(e,t){return new Ao({type:"pipe",in:e,out:t})}const xo=o("ZodReadonly",((e,t)=>{Dt.init(e,t),gn.init(e,t)}));const Oo=o("ZodCustom",((e,t)=>{Ct.init(e,t),gn.init(e,t)}));const No=wn().refine((e=>/^(0|[1-9]\d*)(\.\d+)?$/.test(e)),{message:"Invalid amount"}),Zo=/^(0x|0x[a-fA-F0-9]{40})$/,So=wn().refine((e=>Zo.test(e)),{message:"Invalid EVM token address"}),Do=So.refine((e=>"0x"!==e),{message:"Invalid EVM address"}),Ro=/^[1-9A-HJ-NP-Za-km-z]{32,44}$/,Co=/^So[1-2]{41}$/,Mo=wn().refine((e=>Ro.test(e)||Co.test(e)),{message:"Invalid Solana token address"}),Uo=ao([Do,wn().refine((e=>Ro.test(e)),{message:"Invalid Solana address"})]),Fo=wn().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),jo=ro({issuer:wn(),name:wn(),alias:wn().optional(),symbol:wn(),decimals:Vn()}),Lo=wn(),Vo=wn().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),Wo=Vn().min(0).max(18),Bo=wn().url(),Go=wn(),Ho=ro({chain:wn(),address:So}),qo=ro({chain:go("solana"),address:Mo}),Yo=ro({chain:wn(),address:wn()}),Ko=ao([Ho,qo,Yo]),Jo=wn().refine((e=>{const[t,n]=e.split(":");return Ko.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),Xo=ro({name:Lo,symbol:Vo,decimals:Wo,alias:Vo.optional(),image_url:Bo.optional(),coingecko_id:Go.optional(),wrapper:Vo.optional(),is_native:Hn().optional()}),Qo=ao([Ho.extend(Xo.shape),qo.extend(Xo.shape),Yo.extend(Xo.shape)]),ei=ao([Jo,Fo]);ao([Qo,jo]),co("type",[ro({type:go("chain"),chain:wn()}),ro({type:go("issuer"),issuer:wn()})]);const ti=wn().transform((e=>e.toLowerCase()));var ni,oi;ni=e=>"string"==typeof e?e.toUpperCase():e,oi=mo(["ONRAMP","OFFRAMP"]),Po(vo(ni),oi),ro({to:Do,from:Do.optional(),nonce:Vn().optional(),gasLimit:Yn().optional(),gasPrice:Yn().optional(),maxPriorityFeePerGas:Yn().optional(),maxFeePerGas:Yn().optional(),data:wn().optional(),value:Yn().optional(),chainId:Vn()}),ro({transactionHash:wn().optional(),blockHash:wn().optional(),blockNumber:Vn().optional(),from:Do.optional(),to:Do.optional(),rawReceipt:Jn()});ao([ro({chain_id:Yn(),network:wn(),native_currency:ro({name:wn(),symbol:wn(),decimals:Vn()}),rpc:wn(),image:wn(),is_testnet:Hn(),explorer:wn()}),ro({chain_id:Yn(),network:wn()})]);const ii=mo(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),ri=wn().refine((e=>n.test(e)),{message:"Invalid payment ID"}),si=ro({onramps:oo(ti).optional(),offramps:oo(ti).optional(),sandbox:Hn().optional().default(!1)}),ai=si.extend({inputs:oo(ei).optional(),outputs:oo(ei)});ao([ai,si.extend({inputs:oo(ei),outputs:oo(ei).optional()})]);const ui=ro({asset:ei,amount:No}),ci=ro({token:Jo,amount:No}),di=wn(),li=ao([Wt(Sn,pi),function(e){return Bt(Dn,e)}()]);var pi;const fi=ro({price_currency:Fo,onramps:oo(ti).optional(),onramp_methods:oo(ii).optional(),customer_ip_address:wn().optional(),customer_id:wn().optional(),parent_payment_id:ri.optional()}),hi=co("kind",[ro({kind:go("FIXED_INPUT"),fixed_input_amount:ui,output_asset:ei})]),mi=fi.extend({request:hi}),_i=mo(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),gi=ro({asset:ei,property:mo(["APPROVAL","BALANCE"])}),yi=ro({account:_i,resource:gi}),vi=ao([go("COMPLETE"),go("UNREACHABLE"),go("FAILED")]),wi=ao([vi,go("PENDING")]),zi=mo(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),bi=ro({consume:oo(yi),produce:oo(yi)}),ki=yi.extend({amount:No}),Ei=bi.extend({consume:oo(ki),produce:oo(ki)}),Ii=fo(ei,wn()),$i=co("kind",[ro({kind:ao([go("amount"),go("amount-downstream")]),given:wn(),limits:ro({min:wn().optional(),max:wn().optional()}),source:wn(),message:wn()}),ro({kind:go("geolocation"),message:wn()}),ro({kind:go("provider"),message:wn()}),ro({kind:go("other"),message:wn()}),ro({kind:go("unknown"),message:wn()})]),Ti=ro({service_ids:oo(wn()),latency_seconds:Vn(),issues:oo($i).optional()}),Ai=ro({type:ao([go("USER_FUND"),go("ONCHAIN_STEP"),go("ONRAMP")]),net_effect:Ei,pieces_info:oo(ro({type:ao([go("onramp"),go("poll"),go("bridge"),go("rev_share"),go("transfer_out"),go("convert")])})),step_index:Vn().optional()}),Pi=ro({payment_id:wn(),output_amount:ro({asset:ei,amount:wn()}),onramp:ti.optional(),onramp_method:ii.optional(),fees:ro({total_fees:wn(),conversion_fees:wn(),network_fees:wn(),business_fees:wn(),currency_symbol:Fo}),route:oo(Ai)}),xi=Ai.extend({status:wi,transaction_hash:wn().optional()}),Oi=Pi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:oo(xi)});ro({quote_request:mi,quotes:oo(Pi),current_prices:Ii,price_currency:Fo,state_token:wn(),quoted_at:wn(),accept_by:wn(),failures:oo(Ti)}),ro({payment_id:ri,state_token:wn(),owner_address:Uo,destination_address:Uo,client_redirect_url:wn().optional()});const Ni=ro({deposit_token:Jo,deposit_chain:wn(),deposit_amount:No,deposit_address:Uo}),Zi=ro({type:mo(["ONRAMP","TRANSFER_IN"]),payment_id:ri,funding_page_url:$n(),deposit_info:oo(Ni)}),Si=ro({payment_id:ri,status:zi,funded:Hn(),created_at:wn(),updated_at:wn(),initiate_fund_by:wn(),completed_at:wn().optional(),quote_request:mi,quoted:Pi.omit({payment_id:!0}),fulfilled:Oi,current_prices:Ii,price_currency:Fo,customer_id:wn().optional(),processing_addresses:oo(ro({address:Uo,chain:wn()})),owner_address:Uo,destination_address:Uo,next_instruction:Zi.optional(),parent_payment_id:ri.optional()});ro({payment_id:ri,redirect_url:wn().optional()}),ro({funding_page_onramp_url:wn(),client_redirect_url:wn().optional(),client_secret:wn().optional()}),ro({id_query:wn().optional(),pagination_key:wn().optional(),dest_address:Uo.optional(),owner_address:Uo.optional(),limit:Vn().int().positive().optional(),category:mo(["ALL","NEW_OR_FUNDED"]).optional()}),ro({payment_statuses:oo(Si),next_pagination_key:wn().nullable()}),ro({payment_id:ri.optional(),custom_queries:oo(ro({address:Uo,token:ao([Jo,Ko])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),ro({balance_results:oo(ro({address:Uo,token:Jo,value:co("kind",[ro({kind:go("amount"),amount:No}),ro({kind:go("error")})])}))}),ro({fiat:Fo,tokens:oo(Jo)});const Di=wn(),Ri=ro({payment_id:ri,token_amounts:oo(ci),recipient_address:Uo});ro({payment_id:ri,withdraw_authorization:Di}),Ri.extend({owner_signature:di}),ro({payment_id:ri,transaction_hash:wn()});const Ci=mo(["EMBED","POPUP","MODAL"]),Mi=wn().refine((e=>/^(#[0-9A-Fa-f]{3,8}|rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\)|rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3}(\s*,\s*(0(\.\d+)?|1(\.0+)?))\))$/.test(e)),{message:"Invalid CSS color value"}),Ui=ro({src:$n(),alt:wn(),width:Vn().positive(),height:Vn().positive()}),Fi=ro({primaryColor:Mi.optional(),backgroundColor:Mi.optional(),borderColor:Mi.optional(),textColor:Mi.optional(),textSecondaryColor:Mi.optional(),logo:Ui.optional()}),ji=Jn(),Li=ro({address:Uo,signMessage:Jn().refine((e=>"function"==typeof e)).optional(),sendTransaction:Jn().refine((e=>"function"==typeof e)).optional(),signTypedData:Jn().refine((e=>"function"==typeof e)).optional()}),Vi=ro({redirectUrl:$n(),ctaText:wn(),secondaryRedirectUrl:$n().optional(),secondaryCtaText:wn().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),Wi=ro({apiKey:wn().nonempty(),destinationAddress:Uo.optional(),widgetVersion:mo(["1","2"]).default("2").optional(),...ai.shape,customStyles:Fi.optional(),targetElementId:wn().optional(),windowType:Ci.default(Ci.enum.POPUP).optional(),redirects:Vi.optional(),statusCallback:Jn().refine((e=>"function"==typeof e)).optional(),owner:Li.optional(),funder:Li.optional()}).refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),Bi=Wi.omit({owner:!0,funder:!0,statusCallback:!0}),Gi=wn().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),Hi=fo(wn(),Hn()),qi=ro({dangerouslyOverrideHallidayDomainName:$n().optional(),dangerouslyOverrideApiBaseUrl:Gi.optional(),dangerouslyOverrideIPAddress:li.optional(),dangerouslyOverrideFeatureFlags:Hi.optional()}),Yi=mo(["FULL","MODAL","OVERLAY"]),Ki=ro({appMode:Yi.optional(),apiBaseUrl:Gi.optional(),hasOwner:Hn(),hasTxHandler:Hn(),hostOrigin:$n().nullable(),ipAddress:li.optional(),featureFlags:Hi.optional()}),Ji=ro({...Bi.shape,...Ki.shape,ownerAddress:Uo.optional(),funderAddress:Uo.optional()});var Xi;e.MessageType=void 0,(Xi=e.MessageType||(e.MessageType={})).ACTION_TRANSACTION="ACTION_TRANSACTION",Xi.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",Xi.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",Xi.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",Xi.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",Xi.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA";const Qi=e=>{const t=Ji.parse(e);return btoa(JSON.stringify(t))},er=e=>{const{windowOrigin:n=t,...o}=e,i=Qi(o),r=o.widgetVersion;if(r)try{return`${n}/v${parseInt(r)}/payments/quote?data=${i}`}catch(e){console.error("Error parsing widget version",e)}return`${n}/payments/quote?data=${i}`},tr=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let i=1;i<=3;i++)try{const o=await fetch(`${t}/quotes/status?workflow_id=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){if(o=e instanceof Error?e:new Error(String(e)),3===i)throw o;const t=1e3*Math.pow(2,i);await new Promise((e=>setTimeout(e,t)))}throw o},nr=e=>{e instanceof ln?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},or=(()=>{let n=null,o=null,i=[];const r=()=>{i.forEach((e=>{window.removeEventListener("message",e)})),i=[]};return{openWidget:async(s,...a)=>{const u=a[999]||{};let c,d;try{c=Wi.parse(s)}catch(e){throw nr(e),e}try{d=qi.parse(u)}catch(e){throw nr(e),e}const{dangerouslyOverrideHallidayDomainName:l,dangerouslyOverrideApiBaseUrl:p,dangerouslyOverrideIPAddress:f,dangerouslyOverrideFeatureFlags:h}=d,{owner:m,statusCallback:_,funder:g,windowType:y}=c,v=l||t,w=m?.signMessage,z=m?.signTypedData,b=g?.sendTransaction||m?.sendTransaction,k=m?.address,E=g?.address,I=Uo.safeParse(k).success&&"function"==typeof z,$=Uo.safeParse(E).success&&"function"==typeof b;let T=null,A="FULL";try{T=window.origin,"MODAL"===y&&(A=(()=>{if("undefined"==typeof navigator)return!1;const e=navigator;let t=!1;e.userAgentData&&"boolean"==typeof e.userAgentData.mobile&&(t=e.userAgentData.mobile);const n=navigator.userAgent||navigator.vendor||window.opera||"";return t||/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile|tablet/i.test(n)})()?"OVERLAY":"MODAL")}catch(e){}r();const P=[t=>{if(t.origin!==v||t.source!==n)return;const{type:o}=t.data||{};o===e.MessageType.EVENT_WINDOW_CLOSE&&r()}];if(I){const t=async t=>{if(t.origin!==v||t.source!==n)return;const{type:o,payload:i}=t.data||{};if(o===e.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:t,ownerAddress:r}=i;try{let i;if("function"!=typeof w)throw new Error("No signMessage function provided");i=await w({message:t,ownerAddress:r}),n?.postMessage({type:o,payload:{messageId:e,signature:i}},v)}catch(t){console.error("Error signing message",t),n?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},v)}}else if(o===e.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:t,ownerAddress:r}=i;try{let i;if("function"!=typeof z)throw new Error("No signTypedData function provided");i=await z({typedData:t,ownerAddress:r}),n?.postMessage({type:o,payload:{messageId:e,signature:i}},v)}catch(t){console.error("Error signing typed data",t),n?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},v)}}};P.push(t)}if($){const t=async t=>{if(t.origin!==v||t.source!==n)return;const{type:o,payload:i}=t.data||{};if(o===e.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:t,transaction:r}=i;try{let i;if("function"!=typeof b)throw new Error("No sendTransaction function provided");i=await b(r,t),n?.postMessage({type:o,payload:{messageId:e,txReceipt:i}},v)}catch(t){console.error("Error handling transaction",t),n?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},v)}}};P.push(t)}if(_){const t=t=>{if(t.origin!==v||t.source!==n)return;const{type:o,payload:i}=t.data||{};o===e.MessageType.EVENT_ORDER_STATUS&&_({type:o,payload:i})};P.push(t)}var x;P.push((async t=>{if(t.origin!==v||t.source!==n)return;const{type:i,payload:r}=t.data||{};if(i===e.MessageType.ACTION_PROVIDER_WIDGET&&n){const{url:e,redirectUrl:t,providerWidgetMode:i,workflowId:s}=r||{};if(!(e&&t&&i&&s))throw new Error("Invalid provider widget payload");let a=null;if("REDIRECT"===i)n.location=e,a=n;else{if("POPUP"!==i)throw new Error("Invalid provider widget mode");o=(e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)})(e),a=o}if(await(async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await tr({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const i=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),r=i?.status;if("COMPLETE"===r)break;await new Promise((e=>setTimeout(e,5e3)))}})({apiKey:c.apiKey,baseURL:p||"https://v2.prod.halliday.xyz",workflowId:s,window:a}),a?.closed)return;"REDIRECT"===i?n.location=t:"POPUP"===i&&(o?.close(),o=null)}})),n=(t=>{const n=window.innerWidth/2-240,{windowType:o="POPUP",targetElementId:i,windowOrigin:r}=t,s=er(t);let a;if("EMBED"===o){const t=document.getElementById(i);if(!t)throw new Error(`Element with id ${i} not found`);const n=document.createElement("iframe");n.id="halliday-payments-embed",n.src=s,n.style.width="480px",n.style.height="638px",n.style.maxWidth="100%",n.style.maxHeight="100%",t.innerHTML="",t.appendChild(n);const o=n=>{if(n.origin!==r||n.source!==a)return;const{type:i}=n.data||{};i===e.MessageType.EVENT_WINDOW_CLOSE&&(window.removeEventListener("message",o),t.innerHTML="")};window.addEventListener("message",o),a=n.contentWindow}else if("MODAL"===o){let t=document.getElementById("halliday-payments-modal");(t?t.src:null)===s?t.style.display="block":(t&&t.remove(),t=document.createElement("iframe"),t.id="halliday-payments-modal",t.src=s,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100dvw",t.style.height="100dvh",t.style.border="none",t.style.zIndex="1000",t.setAttribute("scrolling","no"),document.body.appendChild(t));const n=t=>{if(t.origin!==r||t.source!==a)return;const{type:o}=t.data||{};if(o===e.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",n);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",n),a=t.contentWindow}else a=window.open(s,"Halliday Payments",`popup left=${n} top=70 width=480 height=638`);return a})({...c,sandbox:c.sandbox||!1,hasOwner:I,hasTxHandler:$,windowOrigin:v,apiBaseUrl:p,hostOrigin:T,ownerAddress:k,funderAddress:E,ipAddress:f,featureFlags:h,appMode:A}),(x=P).forEach((e=>{window.addEventListener("message",e)})),i=x}}})();e.AppMode=Yi,e.CustomStyles=Fi,e.OrderStatus=ji,e.PaymentsWidgetQueryParams=Ji,e.PaymentsWidgetSDKParams=Wi,e.deserializeQueryParams=e=>Ji.parse(JSON.parse(atob(e))),e.getPaymentsWidgetUrl=er,e.openHallidayPayments=async function(e,...t){try{return or.openWidget(e,...t)}catch(e){throw nr(e),e}},e.serializeQueryParams=Qi}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).hallidayPayments={})}(this,(function(e){"use strict";const t="https://app.halliday.xyz",n=/^[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}$/;function o(e,t,n){function o(n,o){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in s.prototype)Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=o}const i=n?.Parent??Object;class r extends i{}function s(e){var t;const i=n?.Parent?new r:this;o(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),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}class i extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const r={};function s(e){return r}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)}function l(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function f(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let o=0;o<e;o++)n+=t[Math.floor(26*Math.random())];return n}function h(e){return JSON.stringify(e)}function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const _=u((()=>{try{return new Function(""),!0}catch(e){return!1}}));function y(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}const g=new Set(["string","number","symbol"]);function v(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function z(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}const b={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 E(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n].continue)return!0;return!1}function k(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function I(e){return"string"==typeof e?e:e?.message}function T(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const i=I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??"Invalid input";o.message=i}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function A(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function $(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const x=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,a,2),enumerable:!0})},O=o("$ZodError",x),P=o("$ZodError",x,{Parent:Error});const N=e=>(t,n,o,r)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new i;if(u.issues.length){const t=new(r?.Err??e)(u.issues.map((e=>T(e,a,s()))));throw Error.captureStackTrace(t,r?.callee),t}return u.value},Z=e=>async(t,n,o,i)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(i?.Err??e)(a.issues.map((e=>T(e,r,s()))));throw Error.captureStackTrace(t,i?.callee),t}return a.value},S=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new i;return a.issues.length?{success:!1,error:new(e??O)(a.issues.map((e=>T(e,r,s()))))}:{success:!0,data:a.value}},D=S(P),R=e=>async(t,n,o)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>T(e,i,s()))))}:{success:!0,data:r.value}},C=R(P),M=/^[cC][^\s-]{8,}$/,U=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L=/^[0-9a-vA-V]{20}$/,j=/^[A-Za-z0-9]{27}$/,V=/^[a-zA-Z0-9_-]{21}$/,B=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,W=/^([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})$/,G=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)$/,H=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const q=/^(?:(?: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])$/,Y=/^(([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})$/,K=/^((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])$/,J=/^(([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])$/,X=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Q=/^[A-Za-z0-9_-]*$/,ee=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,te=/^\+(?:[0-9]){6,14}[0-9]$/,ne="((\\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])))",oe=new RegExp(`^${ne}$`);function ie(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}const re=/^\d+n?$/,se=/^\d+$/,ae=/^-?\d+(?:\.\d+)?/i,ue=/true|false/i,ce=/^[^A-Z]*$/,de=/^[^a-z]*$/,le=o("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),pe={number:"number",bigint:"bigint",object:"date"},fe=o("$ZodCheckLessThan",((e,t)=>{le.init(e,t);const n=pe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),he=o("$ZodCheckGreaterThan",((e,t)=>{le.init(e,t);const n=pe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),me=o("$ZodCheckMultipleOf",((e,t)=>{le.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.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(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})}})),_e=o("$ZodCheckNumberFormat",((e,t)=>{le.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[i,r]=b[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=r,n&&(o.pattern=se)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",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:o,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:o,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>r&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}})),ye=o("$ZodCheckMaxLength",((e,t)=>{le.init(e,t),e._zod.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 o=n.value;if(o.length<=t.maximum)return;const i=A(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}})),ge=o("$ZodCheckMinLength",((e,t)=>{le.init(e,t),e._zod.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 o=n.value;if(o.length>=t.minimum)return;const i=A(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}})),ve=o("$ZodCheckLengthEquals",((e,t)=>{le.init(e,t),e._zod.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 o=n.value,i=o.length;if(i===t.length)return;const r=A(o),s=i>t.length;n.issues.push({origin:r,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:n.value,inst:e,continue:!t.abort})}})),we=o("$ZodCheckStringFormat",((e,t)=>{var n;le.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))})),(n=e._zod).check??(n.check=n=>{if(!t.pattern)throw new Error("Not implemented.");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})})})),ze=o("$ZodCheckRegex",((e,t)=>{we.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})}})),be=o("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=ce),we.init(e,t)})),Ee=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=de),we.init(e,t)})),ke=o("$ZodCheckIncludes",((e,t)=>{le.init(e,t);const n=v(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)})),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})}})),Ie=o("$ZodCheckStartsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`^${v(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})}})),Te=o("$ZodCheckEndsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`.*${v(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})}})),Ae=o("$ZodCheckOverwrite",((e,t)=>{le.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class $e{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))),o=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const xe={major:4,minor:0,patch:0},Oe=o("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.id=t.type+"_"+f(10),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xe;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let o,r=E(e);for(const s of t){if(s._zod.when){if(!s._zod.when(e))continue}else if(r)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new i;if(o||a instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(r||(r=E(e,t)))}));else{if(e.issues.length===t)continue;r||(r=E(e,t))}}return o?o.then((()=>e)):e};e._zod.run=(n,r)=>{const s=e._zod.parse(n,r);if(s instanceof Promise){if(!1===r.async)throw new i;return s.then((e=>t(e,o,r)))}return t(s,o,r)}}e["~standard"]={validate:t=>{try{const n=D(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return C(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Pe=o("$ZodString",((e,t)=>{var n;Oe.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,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Ne=o("$ZodStringFormat",((e,t)=>{we.init(e,t),Pe.init(e,t)})),Ze=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=W),Ne.init(e,t)})),Se=o("$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=G(e))}else t.pattern??(t.pattern=G());Ne.init(e,t)})),De=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=H),Ne.init(e,t)})),Re=o("$ZodURL",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{try{const o=new URL(n.value);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ee.source,input:n.value,inst:e})),void(t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e})))}catch(t){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e})}}})),Ce=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ne.init(e,t)})),Me=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=V),Ne.init(e,t)})),Ue=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=M),Ne.init(e,t)})),Fe=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=U),Ne.init(e,t)})),Le=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=F),Ne.init(e,t)})),je=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=L),Ne.init(e,t)})),Ve=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=j),Ne.init(e,t)})),Be=o("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){let t=`${ne}T${ie(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}(t)),Ne.init(e,t)})),We=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=oe),Ne.init(e,t)})),Ge=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ie(t)}$`)),Ne.init(e,t)})),He=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=B),Ne.init(e,t)})),qe=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=q),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),Ye=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=Y),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e})}}})),Ke=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=K),Ne.init(e,t)})),Je=o("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=J),Ne.init(e,t),e._zod.check=t=>{const[n,o]=t.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e})}}}));function Xe(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Qe=o("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=X),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=t=>{Xe(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e})}}));const et=o("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=Q),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=t=>{(function(e){if(!Q.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Xe(t.padEnd(4*Math.ceil(t.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e})}})),tt=o("$ZodE164",((e,t)=>{t.pattern??(t.pattern=te),Ne.init(e,t)}));const nt=o("$ZodJWT",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n,i=JSON.parse(atob(o));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})}})),ot=o("$ZodNumber",((e,t)=>{Oe.init(e,t),e._zod.pattern=e._zod.bag.pattern??ae,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const r="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,...r?{received:r}:{}}),n}})),it=o("$ZodNumber",((e,t)=>{_e.init(e,t),ot.init(e,t)})),rt=o("$ZodBoolean",((e,t)=>{Oe.init(e,t),e._zod.pattern=ue,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}})),st=o("$ZodBigInt",((e,t)=>{Oe.init(e,t),e._zod.pattern=re,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}const{value:i}=n;return"bigint"==typeof i||n.issues.push({expected:"bigint",code:"invalid_type",input:i,inst:e}),n}})),at=o("$ZodAny",((e,t)=>{Oe.init(e,t),e._zod.parse=e=>e})),ut=o("$ZodUnknown",((e,t)=>{Oe.init(e,t),e._zod.parse=e=>e})),ct=o("$ZodNever",((e,t)=>{Oe.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function dt(e,t,n){e.issues.length&&t.issues.push(...k(n,e.issues)),t.value[n]=e.value}const lt=o("$ZodArray",((e,t)=>{Oe.init(e,t),e._zod.parse=(n,o)=>{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 r=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?r.push(a.then((t=>dt(t,n,e)))):dt(a,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function pt(e,t,n){e.issues.length&&t.issues.push(...k(n,e.issues)),t.value[n]=e.value}function ft(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...k(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const ht=o("$ZodObject",((e,t)=>{Oe.init(e,t);const n=u((()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof Oe))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}));l(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n}));let o;const i=m,s=!r.jitless,a=s&&_.value,{catchall:c}=t;let d;e._zod.parse=(r,u)=>{d??(d=n.value);const l=r.value;if(!i(l))return r.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),r;const p=[];if(s&&a&&!1===u?.async&&!0!==u.jitless)o||(o=(e=>{const t=new $e(["shape","payload","ctx"]),{keys:o,optionalKeys:i}=n.value,r=e=>{const t=h(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);for(const e of o)s[e]=f(15);t.write("const newResult = {}");for(const e of o)if(i.has(e)){const n=s[e];t.write(`const ${n} = ${r(e)};`);const o=h(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=s[e];t.write(`const ${n} = ${r(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${h(e)}, ...iss.path] : [${h(e)}]\n })));`),t.write(`newResult[${h(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),r=o(r,u);else{r.value={};const e=d.shape;for(const t of d.keys){const n=e[t],o=n._zod.run({value:l[t],issues:[]},u),i="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?p.push(o.then((e=>i?ft(e,r,t,l):pt(e,r,t)))):i?ft(o,r,t,l):pt(o,r,t)}}if(!c)return p.length?Promise.all(p).then((()=>r)):r;const m=[],_=d.keySet,y=c._zod,g=y.def.type;for(const e of Object.keys(l)){if(_.has(e))continue;if("never"===g){m.push(e);continue}const t=y.run({value:l[e],issues:[]},u);t instanceof Promise?p.push(t.then((t=>pt(t,r,e)))):pt(t,r,e)}return m.length&&r.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),p.length?Promise.all(p).then((()=>r)):r}}));function mt(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>T(e,o,s())))))}),t}const _t=o("$ZodUnion",((e,t)=>{Oe.init(e,t),l(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),l(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("|")})$`)}})),e._zod.parse=(n,o)=>{let i=!1;const r=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)r.push(t),i=!0;else{if(0===t.issues.length)return t;r.push(t)}}return i?Promise.all(r).then((t=>mt(t,n,e,o))):mt(r,n,e,o)}})),yt=o("$ZodDiscriminatedUnion",((e,t)=>{_t.init(e,t);const n=e._zod.parse;l(e._zod,"propValues",(()=>{const e={};for(const n of t.options){const o=n._zod.propValues;if(!o||0===Object.keys(o).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(o)){e[t]||(e[t]=new Set);for(const o of n)e[t].add(o)}}return e}));const o=u((()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n}));e._zod.parse=(i,r)=>{const s=i.value;if(!m(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(i,r):t.unionFallback?n(i,r):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),i)}})),gt=o("$ZodIntersection",((e,t)=>{Oe.init(e,t),e._zod.parse=(e,n)=>{const{value:o}=e,i=t.left._zod.run({value:o,issues:[]},n),r=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||r instanceof Promise?Promise.all([i,r]).then((([t,n])=>wt(e,t,n))):wt(e,i,r)}}));function vt(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(y(e)&&y(t)){const n=Object.keys(t),o=Object.keys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of o){const o=vt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i[n]=o.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 o=0;o<e.length;o++){const i=vt(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function wt(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),E(e))return e;const o=vt(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const zt=o("$ZodRecord",((e,t)=>{Oe.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!y(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const r=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const s=t.valueType._zod.run({value:i[e],issues:[]},o);s instanceof Promise?r.push(s.then((t=>{t.issues.length&&n.issues.push(...k(e,t.issues)),n.value[e]=t.value}))):(s.issues.length&&n.issues.push(...k(e,s.issues)),n.value[e]=s.value)}let a;for(const e in i)s.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map((e=>T(e,o,s()))),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:i[a],issues:[]},o);c instanceof Promise?r.push(c.then((e=>{e.issues.length&&n.issues.push(...k(a,e.issues)),n.value[u.value]=e.value}))):(c.issues.length&&n.issues.push(...k(a,c.issues)),n.value[u.value]=c.value)}}return r.length?Promise.all(r).then((()=>n)):n}})),bt=o("$ZodEnum",((e,t)=>{Oe.init(e,t);const n=function(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))}(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter((e=>g.has(typeof e))).map((e=>"string"==typeof e?v(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return e._zod.values.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),Et=o("$ZodLiteral",((e,t)=>{Oe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?v(e):e?e.toString():String(e))).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}})),kt=o("$ZodTransform",((e,t)=>{Oe.init(e,t),e._zod.parse=(e,n)=>{const o=t.transform(e.value,e);if(n.async){return(o instanceof Promise?o:Promise.resolve(o)).then((t=>(e.value=t,e)))}if(o instanceof Promise)throw new i;return e.value=o,e}})),It=o("$ZodOptional",((e,t)=>{Oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),l(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)})),Tt=o("$ZodNullable",((e,t)=>{Oe.init(e,t),l(e._zod,"optin",(()=>t.innerType._zod.optin)),l(e._zod,"optout",(()=>t.innerType._zod.optout)),l(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0})),l(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)})),At=o("$ZodDefault",((e,t)=>{Oe.init(e,t),e._zod.optin="optional",l(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>$t(e,t))):$t(o,t)}}));function $t(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const xt=o("$ZodPrefault",((e,t)=>{Oe.init(e,t),e._zod.optin="optional",l(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Ot=o("$ZodNonOptional",((e,t)=>{Oe.init(e,t),l(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,o)=>{const i=t.innerType._zod.run(n,o);return i instanceof Promise?i.then((t=>Pt(t,e))):Pt(i,e)}}));function Pt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nt=o("$ZodCatch",((e,t)=>{Oe.init(e,t),l(e._zod,"optin",(()=>t.innerType._zod.optin)),l(e._zod,"optout",(()=>t.innerType._zod.optout)),l(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>T(e,n,s())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>T(e,n,s())))},input:e.value}),e.issues=[]),e)}})),Zt=o("$ZodPipe",((e,t)=>{Oe.init(e,t),l(e._zod,"values",(()=>t.in._zod.values)),l(e._zod,"optin",(()=>t.in._zod.optin)),l(e._zod,"optout",(()=>t.out._zod.optout)),e._zod.parse=(e,n)=>{const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>St(e,t,n))):St(o,t,n)}}));function St(e,t,n){return E(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const Dt=o("$ZodReadonly",((e,t)=>{Oe.init(e,t),l(e._zod,"propValues",(()=>t.innerType._zod.propValues)),l(e._zod,"optin",(()=>t.innerType._zod.optin)),l(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(Rt):Rt(o)}}));function Rt(e){return e.value=Object.freeze(e.value),e}const Ct=o("$ZodCustom",((e,t)=>{le.init(e,t),Oe.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,i=t.fn(o);if(i instanceof Promise)return i.then((t=>Mt(t,n,o,e)));Mt(i,n,o,e)}}));function Mt(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push($(e))}}class Ut{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ft(){return new Ut}const Lt=Ft();function jt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function Vt(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Bt(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function Wt(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Gt(e,t){return new fe({check:"less_than",...z(t),value:e,inclusive:!1})}function Ht(e,t){return new fe({check:"less_than",...z(t),value:e,inclusive:!0})}function qt(e,t){return new he({check:"greater_than",...z(t),value:e,inclusive:!1})}function Yt(e,t){return new he({check:"greater_than",...z(t),value:e,inclusive:!0})}function Kt(e,t){return new me({check:"multiple_of",...z(t),value:e})}function Jt(e,t){return new ye({check:"max_length",...z(t),maximum:e})}function Xt(e,t){return new ge({check:"min_length",...z(t),minimum:e})}function Qt(e,t){return new ve({check:"length_equals",...z(t),length:e})}function en(e){return new Ae({check:"overwrite",tx:e})}const tn=o("ZodISODateTime",((e,t)=>{Be.init(e,t),zn.init(e,t)}));function nn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}(tn,e)}const on=o("ZodISODate",((e,t)=>{We.init(e,t),zn.init(e,t)}));function rn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}(on,e)}const sn=o("ZodISOTime",((e,t)=>{Ge.init(e,t),zn.init(e,t)}));function an(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}(sn,e)}const un=o("ZodISODuration",((e,t)=>{He.init(e,t),zn.init(e,t)}));function cn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}(un,e)}const dn=(e,t)=>{O.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},o={_errors:[]},i=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>i({issues:e})));else if("invalid_key"===t.code)i({issues:t.issues});else if("invalid_element"===t.code)i({issues:t.issues});else if(0===t.path.length)o._errors.push(n(t));else{let e=o,i=0;for(;i<t.path.length;){const o=t.path[i];i===t.path.length-1?(e[o]=e[o]||{_errors:[]},e[o]._errors.push(n(t))):e[o]=e[o]||{_errors:[]},e=e[o],i++}}};return i(e),o}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];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))):o.push(t(i));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},ln=o("ZodError",dn),pn=o("ZodError",dn,{Parent:Error}),fn=N(pn),hn=Z(pn),mn=S(pn),_n=R(pn),yn=o("ZodType",((e,t)=>(Oe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>w(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>fn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>mn(e,t,n),e.parseAsync=async(t,n)=>hn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>_n(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...z(n)})}(Po,e,t)}(t,n)),e.superRefine=t=>e.check(function(e,t){const n=function(e,t){const n=new le({check:"custom",...z(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push($(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push($(o))}},e(t.value,t))),t);return n}(t)),e.overwrite=t=>e.check(en(t)),e.optional=()=>zo(e),e.nullable=()=>Eo(e),e.nullish=()=>zo(Eo(e)),e.nonoptional=t=>function(e,t){return new To({type:"nonoptional",innerType:e,...z(t)})}(e,t),e.array=()=>oo(e),e.or=t=>ao([e,t]),e.and=t=>new lo({type:"intersection",left:e,right:t}),e.transform=t=>xo(e,vo(t)),e.default=t=>{return n=t,new ko({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.prefault=t=>{return n=t,new Io({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.catch=t=>{return new Ao({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>xo(e,t),e.readonly=()=>new Oo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Lt.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Lt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Lt.get(e);const n=e.clone();return Lt.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),gn=o("_ZodString",((e,t)=>{Pe.init(e,t),yn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ze({check:"string_format",format:"regex",...z(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ke({check:"string_format",format:"includes",...z(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ie({check:"string_format",format:"starts_with",...z(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Te({check:"string_format",format:"ends_with",...z(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Xt(...t)),e.max=(...t)=>e.check(Jt(...t)),e.length=(...t)=>e.check(Qt(...t)),e.nonempty=(...t)=>e.check(Xt(1,...t)),e.lowercase=t=>e.check(function(e){return new be({check:"string_format",format:"lowercase",...z(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ee({check:"string_format",format:"uppercase",...z(e)})}(t)),e.trim=()=>e.check(en((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return en((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(en((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(en((e=>e.toUpperCase())))})),vn=o("ZodString",((e,t)=>{Pe.init(e,t),gn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}(bn,t)),e.url=t=>e.check(Vt(In,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}(Ln,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}(An,t)),e.guid=t=>e.check(jt(En,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}(kn,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}(kn,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}(kn,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}(kn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}($n,t)),e.guid=t=>e.check(jt(En,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}(xn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}(On,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}(Pn,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}(Mn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}(Un,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}(Nn,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}(Zn,t)),e.ipv4=t=>e.check(Bt(Sn,t)),e.ipv6=t=>e.check(Wt(Dn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}(Rn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}(Cn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}(Fn,t)),e.datetime=t=>e.check(nn(t)),e.date=t=>e.check(rn(t)),e.time=t=>e.check(an(t)),e.duration=t=>e.check(cn(t))}));function wn(e){return function(e,t){return new e({type:"string",...z(t)})}(vn,e)}const zn=o("ZodStringFormat",((e,t)=>{Ne.init(e,t),gn.init(e,t)})),bn=o("ZodEmail",((e,t)=>{De.init(e,t),zn.init(e,t)})),En=o("ZodGUID",((e,t)=>{Ze.init(e,t),zn.init(e,t)})),kn=o("ZodUUID",((e,t)=>{Se.init(e,t),zn.init(e,t)})),In=o("ZodURL",((e,t)=>{Re.init(e,t),zn.init(e,t)}));function Tn(e){return Vt(In,e)}const An=o("ZodEmoji",((e,t)=>{Ce.init(e,t),zn.init(e,t)})),$n=o("ZodNanoID",((e,t)=>{Me.init(e,t),zn.init(e,t)})),xn=o("ZodCUID",((e,t)=>{Ue.init(e,t),zn.init(e,t)})),On=o("ZodCUID2",((e,t)=>{Fe.init(e,t),zn.init(e,t)})),Pn=o("ZodULID",((e,t)=>{Le.init(e,t),zn.init(e,t)})),Nn=o("ZodXID",((e,t)=>{je.init(e,t),zn.init(e,t)})),Zn=o("ZodKSUID",((e,t)=>{Ve.init(e,t),zn.init(e,t)})),Sn=o("ZodIPv4",((e,t)=>{qe.init(e,t),zn.init(e,t)}));const Dn=o("ZodIPv6",((e,t)=>{Ye.init(e,t),zn.init(e,t)}));const Rn=o("ZodCIDRv4",((e,t)=>{Ke.init(e,t),zn.init(e,t)})),Cn=o("ZodCIDRv6",((e,t)=>{Je.init(e,t),zn.init(e,t)})),Mn=o("ZodBase64",((e,t)=>{Qe.init(e,t),zn.init(e,t)})),Un=o("ZodBase64URL",((e,t)=>{et.init(e,t),zn.init(e,t)})),Fn=o("ZodE164",((e,t)=>{tt.init(e,t),zn.init(e,t)})),Ln=o("ZodJWT",((e,t)=>{nt.init(e,t),zn.init(e,t)})),jn=o("ZodNumber",((e,t)=>{ot.init(e,t),yn.init(e,t),e.gt=(t,n)=>e.check(qt(t,n)),e.gte=(t,n)=>e.check(Yt(t,n)),e.min=(t,n)=>e.check(Yt(t,n)),e.lt=(t,n)=>e.check(Gt(t,n)),e.lte=(t,n)=>e.check(Ht(t,n)),e.max=(t,n)=>e.check(Ht(t,n)),e.int=t=>e.check(Wn(t)),e.safe=t=>e.check(Wn(t)),e.positive=t=>e.check(qt(0,t)),e.nonnegative=t=>e.check(Yt(0,t)),e.negative=t=>e.check(Gt(0,t)),e.nonpositive=t=>e.check(Ht(0,t)),e.multipleOf=(t,n)=>e.check(Kt(t,n)),e.step=(t,n)=>e.check(Kt(t,n)),e.finite=()=>e;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 Vn(e){return function(e,t){return new e({type:"number",checks:[],...z(t)})}(jn,e)}const Bn=o("ZodNumberFormat",((e,t)=>{it.init(e,t),jn.init(e,t)}));function Wn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}(Bn,e)}const Gn=o("ZodBoolean",((e,t)=>{rt.init(e,t),yn.init(e,t)}));function Hn(e){return function(e,t){return new e({type:"boolean",...z(t)})}(Gn,e)}const qn=o("ZodBigInt",((e,t)=>{st.init(e,t),yn.init(e,t),e.gte=(t,n)=>e.check(Yt(t,n)),e.min=(t,n)=>e.check(Yt(t,n)),e.gt=(t,n)=>e.check(qt(t,n)),e.gte=(t,n)=>e.check(Yt(t,n)),e.min=(t,n)=>e.check(Yt(t,n)),e.lt=(t,n)=>e.check(Gt(t,n)),e.lte=(t,n)=>e.check(Ht(t,n)),e.max=(t,n)=>e.check(Ht(t,n)),e.positive=t=>e.check(qt(BigInt(0),t)),e.negative=t=>e.check(Gt(BigInt(0),t)),e.nonpositive=t=>e.check(Ht(BigInt(0),t)),e.nonnegative=t=>e.check(Yt(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Kt(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function Yn(e){return function(e,t){return new e({type:"bigint",...z(t)})}(qn,e)}const Kn=o("ZodAny",((e,t)=>{at.init(e,t),yn.init(e,t)}));function Jn(){return new Kn({type:"any"})}const Xn=o("ZodUnknown",((e,t)=>{ut.init(e,t),yn.init(e,t)}));function Qn(){return new Xn({type:"unknown"})}const eo=o("ZodNever",((e,t)=>{ct.init(e,t),yn.init(e,t)}));function to(e){return function(e,t){return new e({type:"never",...z(t)})}(eo,e)}const no=o("ZodArray",((e,t)=>{lt.init(e,t),yn.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Xt(t,n)),e.nonempty=t=>e.check(Xt(1,t)),e.max=(t,n)=>e.check(Jt(t,n)),e.length=(t,n)=>e.check(Qt(t,n)),e.unwrap=()=>e.element}));function oo(e,t){return function(e,t,n){return new e({type:"array",element:t,...z(n)})}(no,e,t)}const io=o("ZodObject",((e,t)=>{ht.init(e,t),yn.init(e,t),l(e,"shape",(()=>Object.fromEntries(Object.entries(e._zod.def.shape)))),e.keyof=()=>mo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Qn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Qn()}),e.strict=()=>e.clone({...e._zod.def,catchall:to()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return p(this,"shape",n),n},checks:[]};return w(e,n)}(e,t),e.merge=t=>{return o=t,w(n=e,{...n._zod.def,get shape(){const e={...n._zod.def.shape,...o._zod.def.shape};return p(this,"shape",e),e},catchall:o._zod.def.catchall,checks:[]});var n,o},e.pick=t=>function(e,t){const n={},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=o.shape[e])}return w(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.omit=t=>function(e,t){const n={...e._zod.def.shape},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return w(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)i[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return w(t,{...t._zod.def,shape:i,checks:[]})}(wo,e,t[0]),e.required=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)i[t]=new e({type:"nonoptional",innerType:o[t]});return w(t,{...t._zod.def,shape:i,checks:[]})}(To,e,t[0])}));function ro(e,t){const n={type:"object",get shape(){return p(this,"shape",{...e}),this.shape},...z(t)};return new io(n)}const so=o("ZodUnion",((e,t)=>{_t.init(e,t),yn.init(e,t),e.options=t.options}));function ao(e,t){return new so({type:"union",options:e,...z(t)})}const uo=o("ZodDiscriminatedUnion",((e,t)=>{so.init(e,t),yt.init(e,t)}));function co(e,t,n){return new uo({type:"union",options:t,discriminator:e,...z(n)})}const lo=o("ZodIntersection",((e,t)=>{gt.init(e,t),yn.init(e,t)}));const po=o("ZodRecord",((e,t)=>{zt.init(e,t),yn.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}));function fo(e,t,n){return new po({type:"record",keyType:e,valueType:t,...z(n)})}const ho=o("ZodEnum",((e,t)=>{bt.init(e,t),yn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{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 ho({...t,checks:[],...z(o),entries:i})},e.exclude=(e,o)=>{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 ho({...t,checks:[],...z(o),entries:i})}}));function mo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new ho({type:"enum",entries:n,...z(t)})}const _o=o("ZodLiteral",((e,t)=>{Et.init(e,t),yn.init(e,t),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]}})}));function yo(e,t){return new _o({type:"literal",values:Array.isArray(e)?e:[e],...z(t)})}const go=o("ZodTransform",((e,t)=>{kt.init(e,t),yn.init(e,t),e._zod.parse=(n,o)=>{n.addIssue=o=>{if("string"==typeof o)n.issues.push($(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),n.issues.push($(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n))):(n.value=i,n)}}));function vo(e){return new go({type:"transform",transform:e})}const wo=o("ZodOptional",((e,t)=>{It.init(e,t),yn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function zo(e){return new wo({type:"optional",innerType:e})}const bo=o("ZodNullable",((e,t)=>{Tt.init(e,t),yn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function Eo(e){return new bo({type:"nullable",innerType:e})}const ko=o("ZodDefault",((e,t)=>{At.init(e,t),yn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const Io=o("ZodPrefault",((e,t)=>{xt.init(e,t),yn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const To=o("ZodNonOptional",((e,t)=>{Ot.init(e,t),yn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Ao=o("ZodCatch",((e,t)=>{Nt.init(e,t),yn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const $o=o("ZodPipe",((e,t)=>{Zt.init(e,t),yn.init(e,t),e.in=t.in,e.out=t.out}));function xo(e,t){return new $o({type:"pipe",in:e,out:t})}const Oo=o("ZodReadonly",((e,t)=>{Dt.init(e,t),yn.init(e,t)}));const Po=o("ZodCustom",((e,t)=>{Ct.init(e,t),yn.init(e,t)}));const No=wn().refine((e=>/^(0|[1-9]\d*)(\.\d+)?$/.test(e)),{message:"Invalid amount"}),Zo=/^(0x|0x[a-fA-F0-9]{40})$/,So=wn().refine((e=>Zo.test(e)),{message:"Invalid EVM token address"}),Do=So.refine((e=>"0x"!==e),{message:"Invalid EVM address"}),Ro=/^[1-9A-HJ-NP-Za-km-z]{32,44}$/,Co=/^So[1-2]{41}$/,Mo=wn().refine((e=>Ro.test(e)||Co.test(e)),{message:"Invalid Solana token address"}),Uo=ao([Do,wn().refine((e=>Ro.test(e)),{message:"Invalid Solana address"})]),Fo=wn().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),Lo=ro({issuer:wn(),name:wn(),alias:wn().optional(),symbol:wn(),decimals:Vn()}),jo=wn(),Vo=wn().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),Bo=Vn().min(0).max(18),Wo=wn().url(),Go=wn(),Ho=ro({chain:wn(),address:So}),qo=ro({chain:yo("solana"),address:Mo}),Yo=ro({chain:wn(),address:wn()}),Ko=ao([Ho,qo,Yo]),Jo=wn().refine((e=>{const[t,n]=e.split(":");return Ko.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),Xo=ro({name:jo,symbol:Vo,decimals:Bo,alias:Vo.optional(),image_url:Wo.optional(),coingecko_id:Go.optional(),wrapper:Vo.optional(),is_native:Hn().optional()}),Qo=ao([Ho.extend(Xo.shape),qo.extend(Xo.shape),Yo.extend(Xo.shape)]),ei=ao([Jo,Fo]);ao([Qo,Lo]),co("type",[ro({type:yo("chain"),chain:wn()}),ro({type:yo("issuer"),issuer:wn()})]);const ti=wn().transform((e=>e.toLowerCase()));var ni,oi;ni=e=>"string"==typeof e?e.toUpperCase():e,oi=mo(["ONRAMP","OFFRAMP"]),xo(vo(ni),oi),ro({to:Do,from:Do.optional(),nonce:Vn().optional(),gasLimit:Yn().optional(),gasPrice:Yn().optional(),maxPriorityFeePerGas:Yn().optional(),maxFeePerGas:Yn().optional(),data:wn().optional(),value:Yn().optional(),chainId:Vn()}),ro({transactionHash:wn().optional(),blockHash:wn().optional(),blockNumber:Vn().optional(),from:Do.optional(),to:Do.optional(),rawReceipt:Jn()});ao([ro({chain_id:Yn(),network:wn(),native_currency:ro({name:wn(),symbol:wn(),decimals:Vn()}),rpc:wn(),image:wn(),is_testnet:Hn(),explorer:wn()}),ro({chain_id:Yn(),network:wn()})]);const ii=mo(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),ri=wn().refine((e=>n.test(e)),{message:"Invalid payment ID"}),si=mo(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]),ai=ro({onramps:oo(ti).optional(),offramps:oo(ti).optional(),sandbox:Hn().optional().default(!1),features:oo(si).optional()}),ui=ai.extend({inputs:oo(ei).optional(),outputs:oo(ei)});ao([ui,ai.extend({inputs:oo(ei),outputs:oo(ei).optional()})]);const ci=ro({asset:ei,amount:No}),di=ro({token:Jo,amount:No}),li=wn(),pi=ao([Bt(Sn,fi),function(e){return Wt(Dn,e)}()]);var fi;const hi=ro({price_currency:Fo,onramps:oo(ti).optional(),onramp_methods:oo(ii).optional(),customer_ip_address:wn().optional(),customer_id:wn().optional(),parent_payment_id:ri.optional(),features:oo(si).optional()}),mi=co("kind",[ro({kind:yo("FIXED_INPUT"),fixed_input_amount:ci,output_asset:ei})]),_i=hi.extend({request:mi}),yi=mo(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),gi=ro({asset:ei,property:mo(["APPROVAL","BALANCE"])}),vi=ro({account:yi,resource:gi}),wi=ao([yo("COMPLETE"),yo("UNREACHABLE"),yo("FAILED")]),zi=ao([wi,yo("PENDING")]),bi=mo(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),Ei=ro({consume:oo(vi),produce:oo(vi)}),ki=vi.extend({amount:No}),Ii=Ei.extend({consume:oo(ki),produce:oo(ki)}),Ti=fo(ei,wn()),Ai=co("kind",[ro({kind:ao([yo("amount"),yo("amount-downstream")]),given:wn(),limits:ro({min:wn().optional(),max:wn().optional()}),source:wn(),message:wn()}),ro({kind:yo("geolocation"),message:wn()}),ro({kind:yo("provider"),message:wn()}),ro({kind:yo("other"),message:wn()}),ro({kind:yo("unknown"),message:wn()})]),$i=ro({service_ids:oo(wn()),latency_seconds:Vn(),issues:oo(Ai).optional()}),xi=ro({type:ao([yo("USER_FUND"),yo("ONCHAIN_STEP"),yo("ONRAMP")]),net_effect:Ii,pieces_info:oo(ro({type:ao([yo("onramp"),yo("poll"),yo("bridge"),yo("rev_share"),yo("transfer_out"),yo("convert")])})),step_index:Vn().optional()}),Oi=ro({payment_id:wn(),output_amount:ro({asset:ei,amount:wn()}),onramp:ti.optional(),onramp_method:ii.optional(),fees:ro({total_fees:wn(),conversion_fees:wn(),network_fees:wn(),business_fees:wn(),currency_symbol:Fo}),route:oo(xi)}),Pi=xi.extend({status:zi,transaction_hash:wn().optional()}),Ni=Oi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:oo(Pi)});ro({quote_request:_i,quotes:oo(Oi),current_prices:Ti,price_currency:Fo,state_token:wn(),quoted_at:wn(),accept_by:wn(),failures:oo($i)}),ro({payment_id:ri,state_token:wn(),owner_address:Uo,destination_address:Uo,client_redirect_url:wn().optional()});const Zi=ro({deposit_token:Jo,deposit_chain:wn(),deposit_amount:No,deposit_address:Uo}),Si=ro({type:mo(["ONRAMP","TRANSFER_IN"]),payment_id:ri,funding_page_url:Tn(),deposit_info:oo(Zi)}),Di=ro({payment_id:ri,status:bi,funded:Hn(),created_at:wn(),updated_at:wn(),initiate_fund_by:wn(),completed_at:wn().optional(),quote_request:_i,quoted:Oi.omit({payment_id:!0}),fulfilled:Ni,current_prices:Ti,price_currency:Fo,customer_id:wn().optional(),processing_addresses:oo(ro({address:Uo,chain:wn()})),owner_address:Uo,destination_address:Uo,next_instruction:Si.optional(),parent_payment_id:ri.optional()});ro({payment_id:ri,redirect_url:wn().optional()}),ro({funding_page_onramp_url:wn(),client_redirect_url:wn().optional(),client_secret:wn().optional()}),ro({id_query:wn().optional(),pagination_key:wn().optional(),dest_address:Uo.optional(),owner_address:Uo.optional(),limit:Vn().int().positive().optional(),category:mo(["ALL","NEW_OR_FUNDED"]).optional()}),ro({payment_statuses:oo(Di),next_pagination_key:wn().nullable()}),ro({payment_id:ri.optional(),custom_queries:oo(ro({address:Uo,token:ao([Jo,Ko])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),ro({balance_results:oo(ro({address:Uo,token:Jo,value:co("kind",[ro({kind:yo("amount"),amount:No}),ro({kind:yo("error")})])}))}),ro({fiat:Fo,tokens:oo(Jo)});const Ri=wn(),Ci=ro({payment_id:ri,token_amounts:oo(di),recipient_address:Uo});ro({payment_id:ri,withdraw_authorization:Ri}),Ci.extend({owner_signature:li}),ro({payment_id:ri,transaction_hash:wn()});const Mi=mo(["EMBED","POPUP","MODAL"]),Ui=mo(["DEFAULT","ALL_UPPERCASE"]),Fi=mo(["AUTO","MEDIUM"]),Li=mo(["ATTACHED","BUTTON"]),ji=mo(["SQUARE","DEFAULT"]),Vi=wn().refine((e=>/^(#[0-9A-Fa-f]{3,8}|rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\)|rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3}(\s*,\s*(0(\.\d+)?|1(\.0+)?))\))$/.test(e)),{message:"Invalid CSS color value"}),Bi=ro({src:Tn(),alt:wn(),width:Vn().positive(),height:Vn().positive()}),Wi=ro({primaryColor:Vi.optional(),backgroundColor:Vi.optional(),borderColor:Vi.optional(),textColor:Vi.optional(),textSecondaryColor:Vi.optional(),accentColor:Vi.optional(),borderStyle:ji.optional(),textMode:Ui.optional(),paymentCategoryGrouping:Li.optional(),fontWeight:Fi.optional(),logo:Bi.optional()}),Gi=Jn(),Hi=oo(mo(["wallet","open-wallet","exchange","open-exchange","cash","open-cash"])),qi=mo(["haffer","wudoo-mono"]),Yi=wn().optional().default("Buy"),Ki=ro({address:Uo,signMessage:Jn().refine((e=>"function"==typeof e)).optional(),sendTransaction:Jn().refine((e=>"function"==typeof e)).optional(),signTypedData:Jn().refine((e=>"function"==typeof e)).optional()}),Ji=ro({redirectUrl:Tn(),ctaText:wn(),secondaryRedirectUrl:Tn().optional(),secondaryCtaText:wn().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),Xi=ro({apiKey:wn().nonempty(),destinationAddress:Uo.optional(),widgetVersion:mo(["1","2"]).default("2").optional(),...ui.shape,customStyles:Wi.optional(),targetElementId:wn().optional(),windowType:Mi.default(Mi.enum.POPUP).optional(),redirects:Ji.optional(),statusCallback:Jn().refine((e=>"function"==typeof e)).optional(),owner:Ki.optional(),funder:Ki.optional(),features:oo(si).optional(),paymentCategoryOrder:Hi.optional(),fontName:qi.optional(),headerTitle:Yi.optional()}).refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),Qi=Xi.omit({owner:!0,funder:!0,statusCallback:!0}),er=wn().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),tr=fo(wn(),Hn()),nr=ro({dangerouslyOverrideHallidayDomainName:Tn().optional(),dangerouslyOverrideApiBaseUrl:er.optional(),dangerouslyOverrideIPAddress:pi.optional(),dangerouslyOverrideFeatureFlags:tr.optional()}),or=mo(["FULL","MODAL","OVERLAY","EMBED"]),ir=ro({appMode:or.optional(),apiBaseUrl:er.optional(),hasOwner:Hn(),hasTxHandler:Hn(),hostOrigin:Tn().nullable(),ipAddress:pi.optional(),featureFlags:tr.optional()}),rr=ro({...Qi.shape,...ir.shape,ownerAddress:Uo.optional(),funderAddress:Uo.optional()});var sr;e.MessageType=void 0,(sr=e.MessageType||(e.MessageType={})).ACTION_TRANSACTION="ACTION_TRANSACTION",sr.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",sr.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",sr.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",sr.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",sr.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA",sr.EVENT_RESIZE="EVENT_RESIZE";const ar=e=>{const t=rr.parse(e);return btoa(JSON.stringify(t))},ur=e=>{const{windowOrigin:n=t,...o}=e,i=ar(o),r=o.widgetVersion;if(r)try{return`${n}/v${parseInt(r)}/payments/quote?data=${i}`}catch(e){console.error("Error parsing widget version",e)}return`${n}/payments/quote?data=${i}`},cr=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let i=1;i<=3;i++)try{const o=await fetch(`${t}/quotes/status?workflow_id=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){if(o=e instanceof Error?e:new Error(String(e)),3===i)throw o;const t=1e3*Math.pow(2,i);await new Promise((e=>setTimeout(e,t)))}throw o},dr=e=>{e instanceof ln?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},lr=(()=>{let n=null,o=null,i=[];const r=()=>{i.forEach((e=>{window.removeEventListener("message",e)})),i=[]};return{openWidget:async(s,...a)=>{const u=a[999]||{};let c,d;try{c=Xi.parse(s)}catch(e){throw dr(e),e}try{d=nr.parse(u)}catch(e){throw dr(e),e}const{dangerouslyOverrideHallidayDomainName:l,dangerouslyOverrideApiBaseUrl:p,dangerouslyOverrideIPAddress:f,dangerouslyOverrideFeatureFlags:h}=d,{owner:m,statusCallback:_,funder:y,windowType:g}=c,v=l||t,w=m?.signMessage,z=m?.signTypedData,b=y?.sendTransaction||m?.sendTransaction,E=m?.address,k=y?.address,I=Uo.safeParse(E).success&&"function"==typeof z,T=Uo.safeParse(k).success&&"function"==typeof b;let A=null,$="FULL";try{A=window.origin,"MODAL"===g?$=(()=>{if("undefined"==typeof navigator)return!1;const e=navigator;let t=!1;e.userAgentData&&"boolean"==typeof e.userAgentData.mobile&&(t=e.userAgentData.mobile);const n=navigator.userAgent||navigator.vendor||window.opera||"";return t||/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile|tablet/i.test(n)})()?"OVERLAY":"MODAL":"EMBED"===g&&($="EMBED")}catch(e){}r();const x=[t=>{if(t.origin!==v||t.source!==n)return;const{type:o}=t.data||{};o===e.MessageType.EVENT_WINDOW_CLOSE&&r()}];if(I){const t=async t=>{if(t.origin!==v||t.source!==n)return;const{type:o,payload:i}=t.data||{};if(o===e.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:t,ownerAddress:r}=i;try{let i;if("function"!=typeof w)throw new Error("No signMessage function provided");i=await w({message:t,ownerAddress:r}),n?.postMessage({type:o,payload:{messageId:e,signature:i}},v)}catch(t){console.error("Error signing message",t),n?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},v)}}else if(o===e.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:t,ownerAddress:r}=i;try{let i;if("function"!=typeof z)throw new Error("No signTypedData function provided");i=await z({typedData:t,ownerAddress:r}),n?.postMessage({type:o,payload:{messageId:e,signature:i}},v)}catch(t){console.error("Error signing typed data",t),n?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},v)}}};x.push(t)}if(T){const t=async t=>{if(t.origin!==v||t.source!==n)return;const{type:o,payload:i}=t.data||{};if(o===e.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:t,transaction:r}=i;try{let i;if("function"!=typeof b)throw new Error("No sendTransaction function provided");i=await b(r,t),n?.postMessage({type:o,payload:{messageId:e,txReceipt:i}},v)}catch(t){console.error("Error handling transaction",t),n?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},v)}}};x.push(t)}if(_){const t=t=>{if(t.origin!==v||t.source!==n)return;const{type:o,payload:i}=t.data||{};o===e.MessageType.EVENT_ORDER_STATUS&&_({type:o,payload:i})};x.push(t)}var O;x.push((async t=>{if(t.origin!==v||t.source!==n)return;const{type:i,payload:r}=t.data||{};if(i===e.MessageType.ACTION_PROVIDER_WIDGET&&n){const{url:e,redirectUrl:t,providerWidgetMode:i,workflowId:s}=r||{};if(!(e&&t&&i&&s))throw new Error("Invalid provider widget payload");let a=null;if("REDIRECT"===i)n.location=e,a=n;else{if("POPUP"!==i)throw new Error("Invalid provider widget mode");o=(e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)})(e),a=o}if(await(async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await cr({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const i=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),r=i?.status;if("COMPLETE"===r)break;await new Promise((e=>setTimeout(e,5e3)))}})({apiKey:c.apiKey,baseURL:p||"https://v2.prod.halliday.xyz",workflowId:s,window:a}),a?.closed)return;"REDIRECT"===i?n.location=t:"POPUP"===i&&(o?.close(),o=null)}})),n=(t=>{const n=window.innerWidth/2-240,{windowType:o="POPUP",targetElementId:i,windowOrigin:r}=t,s=ur(t);let a;if("EMBED"===o){const t=document.getElementById(i);if(!t)throw new Error(`Element with id ${i} not found`);let n=document.getElementById("halliday-payments-embed");(n?n.src:null)===s?n.style.display="block":(t.innerHTML="",n=document.createElement("iframe"),n.id="halliday-payments-embed",n.src=s,n.style.width="480px",n.style.height="638px",n.style.border="none",n.style.display="block",n.style.maxWidth="100%",n.style.maxHeight="100%",n.setAttribute("scrolling","no"),t.appendChild(n)),a=n.contentWindow;const o=t=>{const{type:n,payload:i}=t.data||{};if(t.origin===r&&t.source===a)if(n===e.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",o);const e=document.getElementById("halliday-payments-embed");e&&(e.style.display="none")}else if(n===e.MessageType.EVENT_RESIZE){const e=document.getElementById("halliday-payments-embed");e&&i&&(void 0!==i.width&&(e.style.width=i.width+"px"),void 0!==i.height&&(e.style.height=i.height+"px"))}};window.addEventListener("message",o)}else if("MODAL"===o){let t=document.getElementById("halliday-payments-modal");(t?t.src:null)===s?t.style.display="block":(t&&t.remove(),t=document.createElement("iframe"),t.id="halliday-payments-modal",t.src=s,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100dvw",t.style.height="100dvh",t.style.border="none",t.style.zIndex="1000",t.setAttribute("scrolling","no"),document.body.appendChild(t));const n=t=>{if(t.origin!==r||t.source!==a)return;const{type:o}=t.data||{};if(o===e.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",n);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",n),a=t.contentWindow}else a=window.open(s,"Halliday Payments",`popup left=${n} top=70 width=480 height=638`);return a})({...c,sandbox:c.sandbox||!1,hasOwner:I,hasTxHandler:T,windowOrigin:v,apiBaseUrl:p,hostOrigin:A,ownerAddress:E,funderAddress:k,ipAddress:f,featureFlags:h,appMode:$,fontName:c.fontName,paymentCategoryOrder:c.paymentCategoryOrder,headerTitle:c.headerTitle}),(O=x).forEach((e=>{window.addEventListener("message",e)})),i=O}}})();e.AppMode=or,e.BorderStyle=ji,e.CustomStyles=Wi,e.FontName=qi,e.HeaderTitle=Yi,e.OrderStatus=Gi,e.PaymentCategoryOrder=Hi,e.PaymentsWidgetQueryParams=rr,e.PaymentsWidgetSDKParams=Xi,e.deserializeQueryParams=e=>rr.parse(JSON.parse(atob(e))),e.getPaymentsWidgetUrl=ur,e.openHallidayPayments=async function(e,...t){try{return lr.openWidget(e,...t)}catch(e){throw dr(e),e}},e.serializeQueryParams=ar}));
|
|
2
2
|
//# sourceMappingURL=index.umd.min.js.map
|