@halliday-sdk/payments 2.7.0 → 2.7.4
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 +188 -59
- package/dist/paymentsApiClient/index.esm.min.js +1 -1
- package/dist/paymentsApiClient/index.esm.min.js.map +1 -1
- package/dist/paymentsWidget/ethers/index.cjs.min.js +1 -1
- package/dist/paymentsWidget/ethers/index.cjs.min.js.map +1 -1
- package/dist/paymentsWidget/ethers/index.d.ts +12 -10
- package/dist/paymentsWidget/ethers/index.esm.min.js +1 -1
- package/dist/paymentsWidget/ethers/index.esm.min.js.map +1 -1
- package/dist/paymentsWidget/ethers/index.umd.min.js +1 -1
- package/dist/paymentsWidget/ethers/index.umd.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 +43 -37
- 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/dist/paymentsWidget/viem/index.cjs.min.js +1 -1
- package/dist/paymentsWidget/viem/index.cjs.min.js.map +1 -1
- package/dist/paymentsWidget/viem/index.d.ts +12 -10
- package/dist/paymentsWidget/viem/index.esm.min.js +1 -1
- package/dist/paymentsWidget/viem/index.esm.min.js.map +1 -1
- package/dist/paymentsWidget/viem/index.umd.min.js +1 -1
- package/dist/paymentsWidget/viem/index.umd.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e="https://app.halliday.xyz",t="https://v2.prod.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 d(e){return null==e}function c(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 m(e){return JSON.stringify(e)}function h(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const y=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 v=new Set(["string","number","symbol"]);function _(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 E(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 z(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 T(e){return"string"==typeof e?e:e?.message}function I(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const i=T(e.inst?._zod.def?.error?.(e))??T(t?.error?.(e))??T(n.customError?.(e))??T(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 x(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const O=(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("$ZodError",O),P=o("$ZodError",O,{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=>I(e,a,s()))));throw Error.captureStackTrace(t,r?.callee),t}return u.value},D=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=>I(e,r,s()))));throw Error.captureStackTrace(t,i?.callee),t}return a.value},Z=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??$)(a.issues.map((e=>I(e,r,s()))))}:{success:!0,data:a.value}},S=Z(P),C=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=>I(e,i,s()))))}:{success:!0,data:r.value}},M=C(P),R=/^[cC][^\s-]{8,}$/,L=/^[0-9a-z]+$/,U=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,F=/^[0-9a-vA-V]{20}$/,B=/^[A-Za-z0-9]{27}$/,j=/^[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)?)?)$/,V=/^([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})$/,H=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)$/,G=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Y=/^(?:(?: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])$/,K=/^(([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})$/,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])\/([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,de=/^[^A-Z]*$/,ce=/^[^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})}})),me=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})}})),he=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})}})),ye=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!d(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})}})),ve=o("$ZodCheckMinLength",((e,t)=>{le.init(e,t),e._zod.when=e=>{const t=e.value;return!d(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})}})),_e=o("$ZodCheckLengthEquals",((e,t)=>{le.init(e,t),e._zod.when=e=>{const t=e.value;return!d(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})})})),Ee=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=de),we.init(e,t)})),ze=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=ce),we.init(e,t)})),ke=o("$ZodCheckIncludes",((e,t)=>{le.init(e,t);const n=_(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})}})),Te=o("$ZodCheckStartsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`^${_(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})}})),Ie=o("$ZodCheckEndsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`.*${_(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 xe{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 Oe={major:4,minor:0,patch:0},$e=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=Oe;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=z(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=z(e,t)))}));else{if(e.issues.length===t)continue;r||(r=z(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=S(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return M(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Pe=o("$ZodString",((e,t)=>{var n;$e.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)})),De=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=V),Ne.init(e,t)})),Ze=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=H(e))}else t.pattern??(t.pattern=H());Ne.init(e,t)})),Se=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=G),Ne.init(e,t)})),Ce=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})}}})),Me=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ne.init(e,t)})),Re=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=j),Ne.init(e,t)})),Le=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=R),Ne.init(e,t)})),Ue=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=L),Ne.init(e,t)})),Fe=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=U),Ne.init(e,t)})),Be=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=F),Ne.init(e,t)})),je=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=B),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)})),Ve=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=oe),Ne.init(e,t)})),He=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ie(t)}$`)),Ne.init(e,t)})),Ge=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=W),Ne.init(e,t)})),Ye=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=Y),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),Ke=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=K),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})}}})),qe=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=q),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)=>{$e.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)=>{ye.init(e,t),ot.init(e,t)})),rt=o("$ZodBoolean",((e,t)=>{$e.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)=>{$e.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)=>{$e.init(e,t),e._zod.parse=e=>e})),ut=o("$ZodUnknown",((e,t)=>{$e.init(e,t),e._zod.parse=e=>e})),dt=o("$ZodNever",((e,t)=>{$e.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function ct(e,t,n){e.issues.length&&t.issues.push(...k(n,e.issues)),t.value[n]=e.value}const lt=o("$ZodArray",((e,t)=>{$e.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=>ct(t,n,e)))):ct(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 mt=o("$ZodObject",((e,t)=>{$e.init(e,t);const n=u((()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof $e))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=h,s=!r.jitless,a=s&&y.value,{catchall:d}=t;let c;e._zod.parse=(r,u)=>{c??(c=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 xe(["shape","payload","ctx"]),{keys:o,optionalKeys:i}=n.value,r=e=>{const t=m(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=m(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 ? [${m(e)}, ...iss.path] : [${m(e)}]\n })));`),t.write(`newResult[${m(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=c.shape;for(const t of c.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(!d)return p.length?Promise.all(p).then((()=>r)):r;const h=[],y=c.keySet,g=d._zod,v=g.def.type;for(const e of Object.keys(l)){if(y.has(e))continue;if("never"===v){h.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 h.length&&r.issues.push({code:"unrecognized_keys",keys:h,input:l,inst:e}),p.length?Promise.all(p).then((()=>r)):r}}));function ht(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=>I(e,o,s())))))}),t}const yt=o("$ZodUnion",((e,t)=>{$e.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=>c(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=>ht(t,n,e,o))):ht(r,n,e,o)}})),gt=o("$ZodDiscriminatedUnion",((e,t)=>{yt.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(!h(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)}})),vt=o("$ZodIntersection",((e,t)=>{$e.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 _t(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=_t(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=_t(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),z(e))return e;const o=_t(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 Et=o("$ZodRecord",((e,t)=>{$e.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(...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=>I(e,o,s()))),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const d=t.valueType._zod.run({value:i[a],issues:[]},o);d instanceof Promise?r.push(d.then((e=>{e.issues.length&&n.issues.push(...k(a,e.issues)),n.value[u.value]=e.value}))):(d.issues.length&&n.issues.push(...k(a,d.issues)),n.value[u.value]=d.value)}}return r.length?Promise.all(r).then((()=>n)):n}})),bt=o("$ZodEnum",((e,t)=>{$e.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=>v.has(typeof e))).map((e=>"string"==typeof e?_(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}})),zt=o("$ZodLiteral",((e,t)=>{$e.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?_(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)=>{$e.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}})),Tt=o("$ZodOptional",((e,t)=>{$e.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(`^(${c(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)})),It=o("$ZodNullable",((e,t)=>{$e.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(`^(${c(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)=>{$e.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=>xt(e,t))):xt(o,t)}}));function xt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Ot=o("$ZodPrefault",((e,t)=>{$e.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))})),$t=o("$ZodNonOptional",((e,t)=>{$e.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)=>{$e.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=>I(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=>I(e,n,s())))},input:e.value}),e.issues=[]),e)}})),Dt=o("$ZodPipe",((e,t)=>{$e.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=>Zt(e,t,n))):Zt(o,t,n)}}));function Zt(e,t,n){return z(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const St=o("$ZodReadonly",((e,t)=>{$e.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(Ct):Ct(o)}}));function Ct(e){return e.value=Object.freeze(e.value),e}const Mt=o("$ZodCustom",((e,t)=>{le.init(e,t),$e.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=>Rt(t,n,o,e)));Rt(i,n,o,e)}}));function Rt(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(x(e))}}class Lt{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 Ut(){return new Lt}const Ft=Ut();function Bt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function jt(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function Wt(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function Vt(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Ht(e,t){return new fe({check:"less_than",...E(t),value:e,inclusive:!1})}function Gt(e,t){return new fe({check:"less_than",...E(t),value:e,inclusive:!0})}function Yt(e,t){return new me({check:"greater_than",...E(t),value:e,inclusive:!1})}function Kt(e,t){return new me({check:"greater_than",...E(t),value:e,inclusive:!0})}function qt(e,t){return new he({check:"multiple_of",...E(t),value:e})}function Jt(e,t){return new ge({check:"max_length",...E(t),maximum:e})}function Xt(e,t){return new ve({check:"min_length",...E(t),minimum:e})}function Qt(e,t){return new _e({check:"length_equals",...E(t),length:e})}function en(e){return new Ae({check:"overwrite",tx:e})}const tn=o("ZodISODateTime",((e,t)=>{We.init(e,t),En.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,...E(t)})}(tn,e)}const on=o("ZodISODate",((e,t)=>{Ve.init(e,t),En.init(e,t)}));function rn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}(on,e)}const sn=o("ZodISOTime",((e,t)=>{He.init(e,t),En.init(e,t)}));function an(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}(sn,e)}const un=o("ZodISODuration",((e,t)=>{Ge.init(e,t),En.init(e,t)}));function dn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}(un,e)}const cn=(e,t)=>{$.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",cn),pn=o("ZodError",cn,{Parent:Error}),fn=N(pn),mn=D(pn),hn=Z(pn),yn=C(pn),gn=o("ZodType",((e,t)=>($e.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)=>hn(e,t,n),e.parseAsync=async(t,n)=>mn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>yn(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,...E(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",...E(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(x(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(x(o))}},e(t.value,t))),t);return n}(t)),e.overwrite=t=>e.check(en(t)),e.optional=()=>Eo(e),e.nullable=()=>zo(e),e.nullish=()=>Eo(zo(e)),e.nonoptional=t=>function(e,t){return new Io({type:"nonoptional",innerType:e,...E(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=>Oo(e,_o(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 To({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=>Oo(e,t),e.readonly=()=>new $o({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Ft.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Ft.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Ft.get(e);const n=e.clone();return Ft.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),vn=o("_ZodString",((e,t)=>{Pe.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 Ee({check:"string_format",format:"regex",...E(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ke({check:"string_format",format:"includes",...E(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Te({check:"string_format",format:"starts_with",...E(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Ie({check:"string_format",format:"ends_with",...E(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",...E(e)})}(t)),e.uppercase=t=>e.check(function(e){return new ze({check:"string_format",format:"uppercase",...E(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())))})),_n=o("ZodString",((e,t)=>{Pe.init(e,t),vn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}(bn,t)),e.url=t=>e.check(jt(Tn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}(Fn,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}(An,t)),e.guid=t=>e.check(Bt(zn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(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",...E(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",...E(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",...E(t)})}(kn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}(xn,t)),e.guid=t=>e.check(Bt(zn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}(On,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}($n,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}(Pn,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}(Rn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}(Ln,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}(Nn,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}(Dn,t)),e.ipv4=t=>e.check(Wt(Zn,t)),e.ipv6=t=>e.check(Vt(Sn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}(Cn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}(Mn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}(Un,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(dn(t))}));function wn(e){return function(e,t){return new e({type:"string",...E(t)})}(_n,e)}const En=o("ZodStringFormat",((e,t)=>{Ne.init(e,t),vn.init(e,t)})),bn=o("ZodEmail",((e,t)=>{Se.init(e,t),En.init(e,t)})),zn=o("ZodGUID",((e,t)=>{De.init(e,t),En.init(e,t)})),kn=o("ZodUUID",((e,t)=>{Ze.init(e,t),En.init(e,t)})),Tn=o("ZodURL",((e,t)=>{Ce.init(e,t),En.init(e,t)}));function In(e){return jt(Tn,e)}const An=o("ZodEmoji",((e,t)=>{Me.init(e,t),En.init(e,t)})),xn=o("ZodNanoID",((e,t)=>{Re.init(e,t),En.init(e,t)})),On=o("ZodCUID",((e,t)=>{Le.init(e,t),En.init(e,t)})),$n=o("ZodCUID2",((e,t)=>{Ue.init(e,t),En.init(e,t)})),Pn=o("ZodULID",((e,t)=>{Fe.init(e,t),En.init(e,t)})),Nn=o("ZodXID",((e,t)=>{Be.init(e,t),En.init(e,t)})),Dn=o("ZodKSUID",((e,t)=>{je.init(e,t),En.init(e,t)})),Zn=o("ZodIPv4",((e,t)=>{Ye.init(e,t),En.init(e,t)}));const Sn=o("ZodIPv6",((e,t)=>{Ke.init(e,t),En.init(e,t)}));const Cn=o("ZodCIDRv4",((e,t)=>{qe.init(e,t),En.init(e,t)})),Mn=o("ZodCIDRv6",((e,t)=>{Je.init(e,t),En.init(e,t)})),Rn=o("ZodBase64",((e,t)=>{Qe.init(e,t),En.init(e,t)})),Ln=o("ZodBase64URL",((e,t)=>{et.init(e,t),En.init(e,t)})),Un=o("ZodE164",((e,t)=>{tt.init(e,t),En.init(e,t)})),Fn=o("ZodJWT",((e,t)=>{nt.init(e,t),En.init(e,t)})),Bn=o("ZodNumber",((e,t)=>{ot.init(e,t),gn.init(e,t),e.gt=(t,n)=>e.check(Yt(t,n)),e.gte=(t,n)=>e.check(Kt(t,n)),e.min=(t,n)=>e.check(Kt(t,n)),e.lt=(t,n)=>e.check(Ht(t,n)),e.lte=(t,n)=>e.check(Gt(t,n)),e.max=(t,n)=>e.check(Gt(t,n)),e.int=t=>e.check(Vn(t)),e.safe=t=>e.check(Vn(t)),e.positive=t=>e.check(Yt(0,t)),e.nonnegative=t=>e.check(Kt(0,t)),e.negative=t=>e.check(Ht(0,t)),e.nonpositive=t=>e.check(Gt(0,t)),e.multipleOf=(t,n)=>e.check(qt(t,n)),e.step=(t,n)=>e.check(qt(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 jn(e){return function(e,t){return new e({type:"number",checks:[],...E(t)})}(Bn,e)}const Wn=o("ZodNumberFormat",((e,t)=>{it.init(e,t),Bn.init(e,t)}));function Vn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}(Wn,e)}const Hn=o("ZodBoolean",((e,t)=>{rt.init(e,t),gn.init(e,t)}));function Gn(e){return function(e,t){return new e({type:"boolean",...E(t)})}(Hn,e)}const Yn=o("ZodBigInt",((e,t)=>{st.init(e,t),gn.init(e,t),e.gte=(t,n)=>e.check(Kt(t,n)),e.min=(t,n)=>e.check(Kt(t,n)),e.gt=(t,n)=>e.check(Yt(t,n)),e.gte=(t,n)=>e.check(Kt(t,n)),e.min=(t,n)=>e.check(Kt(t,n)),e.lt=(t,n)=>e.check(Ht(t,n)),e.lte=(t,n)=>e.check(Gt(t,n)),e.max=(t,n)=>e.check(Gt(t,n)),e.positive=t=>e.check(Yt(BigInt(0),t)),e.negative=t=>e.check(Ht(BigInt(0),t)),e.nonpositive=t=>e.check(Gt(BigInt(0),t)),e.nonnegative=t=>e.check(Kt(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(qt(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function Kn(e){return function(e,t){return new e({type:"bigint",...E(t)})}(Yn,e)}const qn=o("ZodAny",((e,t)=>{at.init(e,t),gn.init(e,t)}));function Jn(){return new qn({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)=>{dt.init(e,t),gn.init(e,t)}));function to(e){return function(e,t){return new e({type:"never",...E(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,...E(n)})}(no,e,t)}const io=o("ZodObject",((e,t)=>{mt.init(e,t),gn.init(e,t),l(e,"shape",(()=>Object.fromEntries(Object.entries(e._zod.def.shape)))),e.keyof=()=>ho(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:[]})}(Io,e,t[0])}));function ro(e,t){const n={type:"object",get shape(){return p(this,"shape",{...e}),this.shape},...E(t)};return new io(n)}const so=o("ZodUnion",((e,t)=>{yt.init(e,t),gn.init(e,t),e.options=t.options}));function ao(e,t){return new so({type:"union",options:e,...E(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,...E(n)})}const lo=o("ZodIntersection",((e,t)=>{vt.init(e,t),gn.init(e,t)}));const po=o("ZodRecord",((e,t)=>{Et.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,...E(n)})}const mo=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 mo({...t,checks:[],...E(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 mo({...t,checks:[],...E(o),entries:i})}}));function ho(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new mo({type:"enum",entries:n,...E(t)})}const yo=o("ZodLiteral",((e,t)=>{zt.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 yo({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}const vo=o("ZodTransform",((e,t)=>{kt.init(e,t),gn.init(e,t),e._zod.parse=(n,o)=>{n.addIssue=o=>{if("string"==typeof o)n.issues.push(x(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(x(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n))):(n.value=i,n)}}));function _o(e){return new vo({type:"transform",transform:e})}const wo=o("ZodOptional",((e,t)=>{Tt.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function Eo(e){return new wo({type:"optional",innerType:e})}const bo=o("ZodNullable",((e,t)=>{It.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function zo(e){return new bo({type:"nullable",innerType:e})}const ko=o("ZodDefault",((e,t)=>{At.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const To=o("ZodPrefault",((e,t)=>{Ot.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Io=o("ZodNonOptional",((e,t)=>{$t.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Ao=o("ZodCatch",((e,t)=>{Nt.init(e,t),gn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const xo=o("ZodPipe",((e,t)=>{Dt.init(e,t),gn.init(e,t),e.in=t.in,e.out=t.out}));function Oo(e,t){return new xo({type:"pipe",in:e,out:t})}const $o=o("ZodReadonly",((e,t)=>{St.init(e,t),gn.init(e,t)}));const Po=o("ZodCustom",((e,t)=>{Mt.init(e,t),gn.init(e,t)}));const No=wn().refine((e=>/^(0|[1-9]\d*)(\.\d+)?$/.test(e)),{message:"Invalid amount"}),Do=/^(0x|0x[a-fA-F0-9]{40})$/,Zo=wn().refine((e=>Do.test(e)),{message:"Invalid EVM token address"}),So=Zo.refine((e=>"0x"!==e),{message:"Invalid EVM address"}),Co=/^[1-9A-HJ-NP-Za-km-z]{32,44}$/,Mo=/^So[1-2]{41}$/,Ro=wn().refine((e=>Co.test(e)||Mo.test(e)),{message:"Invalid Solana token address"}),Lo=ao([So,wn().refine((e=>Co.test(e)),{message:"Invalid Solana address"})]),Uo=wn().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),Fo=ro({issuer:wn(),name:wn(),alias:wn().optional(),symbol:wn(),decimals:jn()}),Bo=wn(),jo=wn().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),Wo=jn().min(0).max(18),Vo=wn().url(),Ho=wn(),Go=ro({chain:wn(),address:Zo}),Yo=ro({chain:go("solana"),address:Ro}),Ko=ro({chain:wn(),address:wn()}),qo=ao([Go,Yo,Ko]),Jo=wn().refine((e=>{const[t,n]=e.split(":");return qo.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),Xo=ro({name:Bo,symbol:jo,decimals:Wo,alias:jo.optional(),image_url:Vo.optional(),coingecko_id:Ho.optional(),wrapper:jo.optional(),is_native:Gn().optional()}),Qo=ao([Go.extend(Xo.shape),Yo.extend(Xo.shape),Ko.extend(Xo.shape)]),ei=ao([Jo,Uo]);ao([Qo,Fo]),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=ho(["ONRAMP","OFFRAMP"]),Oo(_o(ni),oi),ro({to:So,from:So.optional(),nonce:jn().optional(),gasLimit:Kn().optional(),gasPrice:Kn().optional(),maxPriorityFeePerGas:Kn().optional(),maxFeePerGas:Kn().optional(),data:wn().optional(),value:Kn().optional(),chainId:jn()}),ro({transactionHash:wn().optional(),blockHash:wn().optional(),blockNumber:jn().optional(),from:So.optional(),to:So.optional(),rawReceipt:Jn()});ao([ro({chain_id:Kn(),network:wn(),native_currency:ro({name:wn(),symbol:wn(),decimals:jn()}),rpc:wn(),image:wn(),is_testnet:Gn(),explorer:wn()}),ro({chain_id:Kn(),network:wn()})]);const ii=ho(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),ri=()=>{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)},si=wn().refine((e=>n.test(e)),{message:"Invalid payment ID"}),ai=ho(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]),ui=ro({onramps:oo(ti).optional(),offramps:oo(ti).optional(),sandbox:Gn().optional().default(!1),features:oo(ai).optional()}),di=ui.extend({inputs:oo(ei).optional(),outputs:oo(ei)});ao([di,ui.extend({inputs:oo(ei),outputs:oo(ei).optional()})]);const ci=ro({asset:ei,amount:No}),li=ro({token:Jo,amount:No}),pi=wn(),fi=ao([Wt(Zn,mi),function(e){return Vt(Sn,e)}()]);var mi;const hi=ro({price_currency:Uo,onramps:oo(ti).optional(),onramp_methods:oo(ii).optional(),customer_ip_address:wn().optional(),customer_id:wn().optional(),parent_payment_id:si.optional(),features:oo(ai).optional()}),yi=co("kind",[ro({kind:go("FIXED_INPUT"),fixed_input_amount:ci,output_asset:ei})]),gi=hi.extend({request:yi}),vi=ho(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),_i=ro({asset:ei,property:ho(["APPROVAL","BALANCE"])}),wi=ro({account:vi,resource:_i}),Ei=ao([go("COMPLETE"),go("UNREACHABLE"),go("FAILED")]),bi=ao([Ei,go("PENDING")]),zi=ho(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),ki=ro({consume:oo(wi),produce:oo(wi)}),Ti=wi.extend({amount:No}),Ii=ki.extend({consume:oo(Ti),produce:oo(Ti)}),Ai=fo(ei,wn()),xi=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()})]),Oi=ro({service_ids:oo(wn()),latency_seconds:jn(),issues:oo(xi).optional()}),$i=ro({type:ao([go("USER_FUND"),go("ONCHAIN_STEP"),go("ONRAMP")]),net_effect:Ii,pieces_info:oo(ro({type:ao([go("onramp"),go("poll"),go("bridge"),go("rev_share"),go("transfer_out"),go("convert")])})),step_index:jn().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:Uo}),route:oo($i)}),Ni=$i.extend({status:bi,transaction_hash:wn().optional()}),Di=Pi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:oo(Ni)});ro({quote_request:gi,quotes:oo(Pi),current_prices:Ai,price_currency:Uo,state_token:wn(),quoted_at:wn(),accept_by:wn(),failures:oo(Oi)}),ro({payment_id:si,state_token:wn(),owner_address:Lo,destination_address:Lo,client_redirect_url:wn().optional()});const Zi=ro({deposit_token:Jo,deposit_chain:wn(),deposit_amount:No,deposit_address:Lo}),Si=ro({type:ho(["ONRAMP","TRANSFER_IN"]),payment_id:si,funding_page_url:In(),deposit_info:oo(Zi)}),Ci=ro({payment_id:si,status:zi,funded:Gn(),created_at:wn(),updated_at:wn(),initiate_fund_by:wn(),completed_at:wn().optional(),quote_request:gi,quoted:Pi.omit({payment_id:!0}),fulfilled:Di,current_prices:Ai,price_currency:Uo,customer_id:wn().optional(),processing_addresses:oo(ro({address:Lo,chain:wn()})),owner_address:Lo,destination_address:Lo,next_instruction:Si.optional(),parent_payment_id:si.optional()});ro({payment_id:si,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:Lo.optional(),owner_address:Lo.optional(),limit:jn().int().positive().optional(),category:ho(["ALL","NEW_OR_FUNDED"]).optional()}),ro({payment_statuses:oo(Ci),next_pagination_key:wn().nullable()}),ro({payment_id:si.optional(),custom_queries:oo(ro({address:Lo,token:ao([Jo,qo])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),ro({balance_results:oo(ro({address:Lo,token:Jo,value:co("kind",[ro({kind:go("amount"),amount:No}),ro({kind:go("error")})])}))}),ro({fiat:Uo,tokens:oo(Jo)});const Mi=wn(),Ri=ro({payment_id:si,token_amounts:oo(li),recipient_address:Lo});ro({payment_id:si,withdraw_authorization:Mi}),Ri.extend({owner_signature:pi}),ro({payment_id:si,transaction_hash:wn()});const Li=ho(["EMBED","POPUP","MODAL"]),Ui=ho(["DEFAULT","ALL_UPPERCASE"]),Fi=ho(["AUTO","MEDIUM"]),Bi=ho(["ATTACHED","BUTTON"]),ji=ho(["SQUARE","DEFAULT"]),Wi=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"}),Vi=ro({src:In(),alt:wn(),width:jn().positive(),height:jn().positive()}),Hi=ro({primaryColor:Wi.optional(),backgroundColor:Wi.optional(),borderColor:Wi.optional(),textColor:Wi.optional(),textSecondaryColor:Wi.optional(),accentColor:Wi.optional(),componentShadow:wn().optional(),borderStyle:ji.optional(),textMode:Ui.optional(),paymentCategoryGrouping:Bi.optional(),fontWeight:Fi.optional(),logo:Vi.optional()}),Gi=Jn(),Yi=oo(ho(["wallet","open-wallet","exchange","open-exchange","cash","open-cash"])),Ki=ho(["haffer","wudoo-mono"]),qi=wn().optional().default("Buy"),Ji=ro({address:Lo,signMessage:Jn().refine((e=>"function"==typeof e)).optional(),sendTransaction:Jn().refine((e=>"function"==typeof e)).optional(),signTypedData:Jn().refine((e=>"function"==typeof e)).optional()}),Xi=ro({redirectUrl:In(),ctaText:wn(),secondaryRedirectUrl:In().optional(),secondaryCtaText:wn().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),Qi=ro({apiKey:wn().nonempty(),destinationAddress:Lo.optional(),widgetVersion:ho(["1","2"]).default("2").optional(),...di.shape,customStyles:Hi.optional(),targetElementId:wn().optional(),windowType:Li.default(Li.enum.POPUP).optional(),redirects:Xi.optional(),statusCallback:Jn().refine((e=>"function"==typeof e)).optional(),owner:Ji.optional(),funder:Ji.optional(),features:oo(ai).optional(),paymentCategoryOrder:Yi.optional(),fontName:Ki.optional(),headerTitle:qi.optional(),showSkeleton:Gn().default(!0).optional(),skeletonBackgroundColor:wn().optional()}).refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),er=Qi.omit({owner:!0,funder:!0,statusCallback:!0}),tr=wn().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),nr=fo(wn(),Gn()),or=ro({dangerouslyOverrideHallidayDomainName:In().optional(),dangerouslyOverrideApiBaseUrl:tr.optional(),dangerouslyOverrideIPAddress:fi.optional(),dangerouslyOverrideFeatureFlags:nr.optional()}),ir=ho(["FULL","MODAL","OVERLAY","EMBED"]),rr=ro({appMode:ir.optional(),apiBaseUrl:tr.optional(),hasOwner:Gn(),hasTxHandler:Gn(),hostOrigin:In().nullable(),ipAddress:fi.optional(),featureFlags:nr.optional()}),sr=ro({...er.shape,...rr.shape,ownerAddress:Lo.optional(),funderAddress:Lo.optional()});var ar;exports.MessageType=void 0,(ar=exports.MessageType||(exports.MessageType={})).ACTION_TRANSACTION="ACTION_TRANSACTION",ar.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",ar.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",ar.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",ar.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",ar.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA",ar.EVENT_RESIZE="EVENT_RESIZE";const ur=ro({apiKey:wn().nonempty(),sandbox:Gn().optional(),onReady:Jn().refine((e=>"function"==typeof e||void 0===e)).optional(),onError:Jn().refine((e=>"function"==typeof e||void 0===e)).optional()}),dr=()=>{const e=document.getElementById("halliday-payments-skeleton");e&&(e.style.opacity="0",setTimeout((()=>e.remove()),300))},cr=e=>{const t=sr.parse(e);return btoa(JSON.stringify(t))},lr=t=>{const{windowOrigin:n=e,...o}=t,i=cr(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}`},pr=e=>{const t=window.innerWidth/2-240,{windowType:n="POPUP",targetElementId:o,windowOrigin:i}=e,r=lr(e);let s;if("EMBED"===n){const e=document.getElementById(o);if(!e)throw new Error(`Element with id ${o} not found`);let t=document.getElementById("halliday-payments-embed");if((t?t.src:null)===r)t.style.display="block";else{let n=document.getElementById("halliday-payments-wrapper");n||(e.innerHTML="",e.style&&(e.style.position="relative"),n=document.createElement("div"),n.id="halliday-payments-wrapper",n.style.cssText="\n position: relative;\n width: 480px;\n max-width: 100%;\n display: block;\n ",e.appendChild(n)),t=document.createElement("iframe"),t.id="halliday-payments-embed",t.src=r,t.style.cssText="\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: none;\n display: block;\n ",t.setAttribute("scrolling","no"),n.appendChild(t)}s=t.contentWindow;const n=e=>{const{type:t,payload:o}=e.data||{},r=e.source===s,a=e.origin===i;if(r&&(a||t===exports.MessageType.EVENT_RESIZE))if(t===exports.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",n);const e=document.getElementById("halliday-payments-embed");e&&(e.style.display="none")}else if(t===exports.MessageType.EVENT_RESIZE){const e=document.getElementById("halliday-payments-skeleton"),t=document.getElementById("halliday-payments-wrapper");void 0!==o?.height&&(e&&(e.style.height=o.height+"px"),t&&(t.style.minHeight=o.height+"px"))}else"WIDGET_READY"!==t&&"HALLIDAY_READY"!==t||dr()};window.addEventListener("message",n)}else if("MODAL"===n){let e=document.getElementById("halliday-payments-modal");(e?e.src:null)===r?e.style.display="block":(e&&e.remove(),e=document.createElement("iframe"),e.id="halliday-payments-modal",e.src=r,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100dvw",e.style.height="100dvh",e.style.border="none",e.style.zIndex="1000",e.setAttribute("scrolling","no"),document.body.appendChild(e));const t=e=>{if(e.origin!==i||e.source!==s)return;const{type:n}=e.data||{};if(n===exports.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",t);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",t),s=e.contentWindow}else s=window.open(r,"Halliday Payments",`popup left=${t} top=70 width=480 height=638`);return s},fr=e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)},mr=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},hr=async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await mr({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)))}},yr=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})},gr="halliday-payments-preload";let vr={isPreloaded:!1,isLoading:!1,iframe:null,error:null,startTime:null,readyTime:null},_r=null,wr=null,Er=null,br=null,zr=null;const kr=()=>vr.isPreloaded&&!vr.error,Tr=()=>{const e=vr.iframe;e&&(e.style.visibility="hidden",e.style.opacity="0",e.style.pointerEvents="none",e.style.zIndex="-1",e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1"))},Ir=e=>{const{windowOrigin:t,widgetWindow:n,providerWindowRef:o,cleanMessageHandlers:i,hasOwner:r,hasTxHandler:s,signMessage:a,signTypedData:u,sendTransaction:d,statusCallback:c,apiKey:l,apiBaseUrl:p}=e,f=[];return f.push((e=>{if(e.origin!==t||e.source!==n)return;const{type:o}=e.data||{};o===exports.MessageType.EVENT_WINDOW_CLOSE&&i()})),r&&f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:i}=e.data||{};if(o===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:r,ownerAddress:s}=i;try{const i="function"==typeof a?await a({message:r,ownerAddress:s}):(()=>{throw new Error("No signMessage function provided")})();n.postMessage({type:o,payload:{messageId:e,signature:i}},t)}catch(i){n.postMessage({type:o,payload:{messageId:e,error:i instanceof Error?i.message:i}},t)}}else if(o===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:r,ownerAddress:s}=i;try{const i="function"==typeof u?await u({typedData:r,ownerAddress:s}):(()=>{throw new Error("No signTypedData function provided")})();n.postMessage({type:o,payload:{messageId:e,signature:i}},t)}catch(i){n.postMessage({type:o,payload:{messageId:e,error:i instanceof Error?i.message:i}},t)}}})),s&&f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:i}=e.data||{};if(o===exports.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:r,transaction:s}=i;try{const i="function"==typeof d?await d(s,r):(()=>{throw new Error("No sendTransaction function provided")})();n.postMessage({type:o,payload:{messageId:e,txReceipt:i}},t)}catch(i){n.postMessage({type:o,payload:{messageId:e,error:i instanceof Error?i.message:i}},t)}}})),c&&f.push((e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:i}=e.data||{};o===exports.MessageType.EVENT_ORDER_STATUS&&c({type:o,payload:i})})),f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:i,payload:r}=e.data||{};if(i===exports.MessageType.ACTION_PROVIDER_WIDGET){const{url:e,redirectUrl:t,providerWidgetMode:i,workflowId:s}=r||{};if(!(e&&t&&i&&s))return;let a=null;"REDIRECT"===i?(n.location=e,a=n):"POPUP"===i&&(o.current=fr(e),a=o.current),a&&(await hr({apiKey:l,baseURL:p,workflowId:s,window:a}),a.closed||("REDIRECT"===i?n.location=t:"POPUP"===i&&(o.current?.close(),o.current=null)))}})),f},Ar=(()=>{let n=null,o=null;const i={get current(){return o},set current(e){o=e}};let r=[];const s=()=>{r.forEach((e=>{window.removeEventListener("message",e)})),r=[]},a=e=>{e.forEach((e=>{window.addEventListener("message",e)})),r=e},u=async(r,...d)=>{const c=d[999]||d[0]||{},l=r.windowType,p=r.targetElementId,f=r.showSkeleton??!0,m=r.skeletonBackgroundColor??r.customStyles?.backgroundColor;if("EMBED"===l&&p&&f){const e=document.getElementById(p);e&&(kr()||((e,t)=>{const n=document.getElementById("halliday-payments-skeleton");n&&n.remove(),e.style&&(e.style.position="relative");let o=document.getElementById("halliday-payments-wrapper");o||(o=document.createElement("div"),o.id="halliday-payments-wrapper",o.style.cssText="\n position: relative;\n width: 480px;\n max-width: 100%;\n display: block;\n ",e.appendChild(o));const i=t||"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",r=document.createElement("div");if(r.id="halliday-payments-skeleton",r.style.cssText=`\n width: 100%;\n height: 400px;\n background: ${i};\n background-size: 200% 100%;\n animation: halliday-skeleton-pulse 1.5s ease-in-out infinite;\n border-radius: 12px;\n position: relative;\n z-index: 1;\n transition: opacity 0.3s ease-out;\n `,!document.getElementById("halliday-skeleton-styles")&&document.head)try{const e=document.createElement("style");e.id="halliday-skeleton-styles",e.textContent="\n @keyframes halliday-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n ",document.head.appendChild(e)}catch{}o.appendChild(r)})(e,m))}if(kr()){const o=_r,u=br,d=(u?.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,""),{owner:c,funder:l,statusCallback:p}=r,f=c?.signMessage,m=c?.signTypedData,h=l?.sendTransaction||c?.sendTransaction,y=c?.address,g=l?.address,v=Lo.safeParse(y).success&&"function"==typeof m,_=Lo.safeParse(g).success&&"function"==typeof h,w=r.windowType||"MODAL",E=r.targetElementId;let b=null,z="FULL";try{b=window.origin,"MODAL"===w?z=ri()?"OVERLAY":"MODAL":"EMBED"===w&&(z="EMBED")}catch{}const k={apiKey:r.apiKey||o?.apiKey||"",sandbox:r.sandbox??o?.sandbox??!1,widgetVersion:r.widgetVersion,destinationAddress:r.destinationAddress,outputs:r.outputs??[],inputs:r.inputs,customStyles:r.customStyles,redirects:r.redirects,features:r.features,paymentCategoryOrder:r.paymentCategoryOrder,fontName:r.fontName,headerTitle:r.headerTitle,windowType:w,targetElementId:E,hasOwner:v,hasTxHandler:_,ownerAddress:y,funderAddress:g,hostOrigin:b,appMode:z,windowOrigin:d,apiBaseUrl:u?.dangerouslyOverrideApiBaseUrl,ipAddress:u?.dangerouslyOverrideIPAddress,featureFlags:u?.dangerouslyOverrideFeatureFlags};if(n=(t=>{const n=vr.iframe;if(!n||!vr.isPreloaded||!_r)return null;const o=(br?.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,""),i=t?.windowType||"MODAL",r=t?.targetElementId;if("POPUP"===i)return null;let s="MODAL";try{"MODAL"===i?s=ri()?"OVERLAY":"MODAL":"EMBED"===i&&(s="EMBED")}catch{}if(t){const{windowType:e,...i}=t;n.contentWindow?.postMessage({type:"HALLIDAY_UPDATE_PARAMS",payload:{...i,appMode:s}},o)}if("EMBED"===i){if(!r)return console.error("[HallidayPayments] EMBED mode requires targetElementId in openHallidayPayments"),null;const e=document.getElementById(r);if(!e)return console.error(`[HallidayPayments] Target element '${r}' not found`),null;let t=document.getElementById("halliday-payments-wrapper")||document.getElementById("halliday-payments-placeholder");t||(t=document.createElement("div"),t.id="halliday-payments-placeholder",t.style.cssText="\n width: 480px;\n max-width: 100%;\n height: 400px;\n ",e.appendChild(t));const i=()=>{const e=t.getBoundingClientRect();n.style.position="fixed",n.style.top=e.top+"px",n.style.left=e.left+"px",n.style.width=e.width+"px",n.style.height=e.height+"px",n.style.border="none",n.style.zIndex="1"};t.offsetHeight,requestAnimationFrame((()=>{requestAnimationFrame((()=>{i(),n.style.visibility="visible",n.style.opacity="1",n.style.pointerEvents="auto"}))}));const s=new ResizeObserver((()=>{i()}));s.observe(t);const a=()=>i();window.addEventListener("scroll",a,!0);const u=()=>i();window.addEventListener("resize",u),n._embedCleanup=()=>{s.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",u),t?.remove()};const d=e=>{if(e.origin!==o)return;if(e.source!==n.contentWindow)return;const{type:r,payload:s}=e.data||{};r===exports.MessageType.EVENT_RESIZE&&s&&void 0!==s.height&&t&&(t.style.height=s.height+"px",i())};if(window.addEventListener("message",d),n.removeAttribute("aria-hidden"),n.removeAttribute("tabindex"),vr.isPreloaded)dr();else{const e=t=>{if(t.origin!==o)return;if(t.source!==n.contentWindow)return;const{type:i}=t.data||{};"WIDGET_READY"!==i&&"HALLIDAY_READY"!==i||(window.removeEventListener("message",e),dr())};window.addEventListener("message",e)}}else n.id="halliday-payments-modal",n.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: 10000;\n ",n.removeAttribute("aria-hidden"),n.removeAttribute("tabindex"),n.setAttribute("scrolling","no"),n.parentElement!==document.body&&document.body.appendChild(n);setTimeout((()=>{n.contentWindow?.postMessage({type:"HALLIDAY_SHOW"},o)}),10);const a=e=>{if(e.origin!==o)return;if(e.source!==n.contentWindow)return;const{type:t}=e.data||{};t===exports.MessageType.EVENT_WINDOW_CLOSE&&(window.removeEventListener("message",a),Tr())};return window.addEventListener("message",a),n.contentWindow})(k),n){s();const e=Ir({windowOrigin:d,widgetWindow:n,providerWindowRef:i,cleanMessageHandlers:s,hasOwner:v,hasTxHandler:_,signMessage:f,signTypedData:m,sendTransaction:h,statusCallback:p,apiKey:o?.apiKey||r.apiKey,apiBaseUrl:u?.dangerouslyOverrideApiBaseUrl||t});return void a(e)}if("POPUP"===w&&(n=pr({...k,windowOrigin:d}),n)){s();const e=Ir({windowOrigin:d,widgetWindow:n,providerWindowRef:i,cleanMessageHandlers:s,hasOwner:v,hasTxHandler:_,signMessage:f,signTypedData:m,sendTransaction:h,statusCallback:p,apiKey:o?.apiKey||r.apiKey,apiBaseUrl:u?.dangerouslyOverrideApiBaseUrl||t});return void a(e)}}if(null!==_r&&!kr())return new Promise((e=>{const t=()=>{kr()?u(r,...d).then(e):setTimeout(t,100)};t()}));let h,y;try{h=Qi.parse(r)}catch(e){throw yr(e),e}try{y=or.parse(c)}catch(e){throw yr(e),e}const{dangerouslyOverrideHallidayDomainName:g,dangerouslyOverrideApiBaseUrl:v,dangerouslyOverrideIPAddress:_,dangerouslyOverrideFeatureFlags:w}=y,{owner:E,statusCallback:b,funder:z,windowType:k}=h,T=(g||e).replace(/\/$/,""),I=E?.signMessage,A=E?.signTypedData,x=z?.sendTransaction||E?.sendTransaction,O=E?.address,$=z?.address,P=Lo.safeParse(O).success&&"function"==typeof A,N=Lo.safeParse($).success&&"function"==typeof x;let D=null,Z="FULL";try{D=window.origin,"MODAL"===k?Z=ri()?"OVERLAY":"MODAL":"EMBED"===k&&(Z="EMBED")}catch(e){}s();const S=[e=>{if(e.origin!==T||e.source!==n)return;const{type:t}=e.data||{};t===exports.MessageType.EVENT_WINDOW_CLOSE&&s()}];if(P){const e=async e=>{if(e.origin!==T||e.source!==n)return;const{type:t,payload:o}=e.data||{};if(t===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:i,ownerAddress:r}=o;try{let o;if("function"!=typeof I)throw new Error("No signMessage function provided");o=await I({message:i,ownerAddress:r}),n?.postMessage({type:t,payload:{messageId:e,signature:o}},T)}catch(o){console.error("Error signing message",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},T)}}else if(t===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:i,ownerAddress:r}=o;try{let o;if("function"!=typeof A)throw new Error("No signTypedData function provided");o=await A({typedData:i,ownerAddress:r}),n?.postMessage({type:t,payload:{messageId:e,signature:o}},T)}catch(o){console.error("Error signing typed data",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},T)}}};S.push(e)}if(N){const e=async e=>{if(e.origin!==T||e.source!==n)return;const{type:t,payload:o}=e.data||{};if(t===exports.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:i,transaction:r}=o;try{let o;if("function"!=typeof x)throw new Error("No sendTransaction function provided");o=await x(r,i),n?.postMessage({type:t,payload:{messageId:e,txReceipt:o}},T)}catch(o){console.error("Error handling transaction",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},T)}}};S.push(e)}if(b){const e=e=>{if(e.origin!==T||e.source!==n)return;const{type:t,payload:o}=e.data||{};t===exports.MessageType.EVENT_ORDER_STATUS&&b({type:t,payload:o})};S.push(e)}S.push((async e=>{if(e.origin!==T||e.source!==n)return;const{type:i,payload:r}=e.data||{};if(i===exports.MessageType.ACTION_PROVIDER_WIDGET&&n){const{url:e,redirectUrl:i,providerWidgetMode:s,workflowId:a}=r||{};if(!(e&&i&&s&&a))throw new Error("Invalid provider widget payload");let u=null;if("REDIRECT"===s)n.location=e,u=n;else{if("POPUP"!==s)throw new Error("Invalid provider widget mode");o=fr(e),u=o}if(await hr({apiKey:h.apiKey,baseURL:v||t,workflowId:a,window:u}),u?.closed)return;"REDIRECT"===s?n.location=i:"POPUP"===s&&(o?.close(),o=null)}}));const C={...h,sandbox:h.sandbox||!1,hasOwner:P,hasTxHandler:N,windowOrigin:T,apiBaseUrl:v,hostOrigin:D,ownerAddress:O,funderAddress:$,ipAddress:_,featureFlags:w,appMode:Z,fontName:h.fontName,paymentCategoryOrder:h.paymentCategoryOrder,headerTitle:h.headerTitle};n=pr(C),a(S)};return{openWidget:u}})();exports.AppMode=ir,exports.BorderStyle=ji,exports.CustomStyles=Hi,exports.FontName=Ki,exports.HeaderTitle=qi,exports.InitConfig=ur,exports.OrderStatus=Gi,exports.PaymentCategoryOrder=Yi,exports.PaymentsWidgetQueryParams=sr,exports.PaymentsWidgetSDKParams=Qi,exports.deserializeQueryParams=e=>sr.parse(JSON.parse(atob(e))),exports.destroyClient=()=>{zr&&(window.removeEventListener("message",zr),zr=null);const e=vr.iframe;e&&e._embedCleanup&&e._embedCleanup();const t=document.getElementById(gr);t&&t.remove();const n=document.getElementById("halliday-payments-placeholder");n&&n.remove();const o=document.getElementById("halliday-payments-modal");o&&o.remove();const i=document.getElementById("halliday-payments-skeleton");i&&i.remove(),vr={isPreloaded:!1,isLoading:!1,iframe:null,error:null,startTime:null,readyTime:null},_r=null,br=null,wr=null,Er=null},exports.getPaymentsWidgetUrl=lr,exports.initializeClient=async(t,...n)=>{if(vr.isPreloaded||vr.isLoading)return void console.warn("[HallidayPayments] Already initialized");const o=n[999]||n[0]||{};let i,r;try{i=ur.parse(t)}catch(e){throw yr(e),e}try{r=or.parse(o)}catch(e){throw yr(e),e}_r=i,br=r,wr=i.onReady||null,Er=i.onError||null;const s=(r.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,"");return vr={...vr,isLoading:!0,startTime:Date.now(),error:null},new Promise(((e,t)=>{const n=setTimeout((()=>{const e=new Error("Widget load timeout exceeded");vr={...vr,isLoading:!1,error:e},u(),Er?.(e),t(e)}),3e4),o=t=>{if(t.origin!==s)return;if(t.source!==vr.iframe?.contentWindow)return;const{type:o}=t.data||{};"WIDGET_READY"!==o&&"HALLIDAY_READY"!==o||(clearTimeout(n),u(),vr={...vr,isPreloaded:!0,isLoading:!1,readyTime:Date.now()},wr?.(),e())},a=e=>{if(e.origin!==s)return;if(e.source!==vr.iframe?.contentWindow)return;const{type:t,payload:n}=e.data||{};t===exports.MessageType.EVENT_RESIZE&&n&&vr.iframe&&(void 0!==n.width&&(vr.iframe.style.width=n.width+"px"),void 0!==n.height&&(vr.iframe.style.height=n.height+"px"))},u=()=>{window.removeEventListener("message",o)};window.addEventListener("message",o),window.addEventListener("message",a),zr=a;const d=document.getElementById(gr);d&&d.remove();const c=document.createElement("iframe");c.id=gr;let l="MODAL";try{l=ri()?"OVERLAY":"MODAL"}catch{}const p=lr({apiKey:i.apiKey,sandbox:i.sandbox||!1,widgetVersion:"2",outputs:[],hasOwner:!1,hasTxHandler:!1,hostOrigin:"undefined"!=typeof window?window.origin:null,windowOrigin:s,appMode:l,apiBaseUrl:r.dangerouslyOverrideApiBaseUrl,ipAddress:r.dangerouslyOverrideIPAddress,featureFlags:r.dangerouslyOverrideFeatureFlags});c.src=p,c.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: -1;\n visibility: hidden;\n pointer-events: none;\n opacity: 0;\n ",c.setAttribute("aria-hidden","true"),c.setAttribute("tabindex","-1"),c.onload=()=>{setTimeout((()=>{vr.isLoading&&!vr.isPreloaded&&(clearTimeout(n),u(),vr={...vr,isPreloaded:!0,isLoading:!1,readyTime:Date.now()},wr?.(),e())}),3e3)},c.onerror=()=>{clearTimeout(n),u();const e=new Error("Failed to load widget");vr={...vr,isLoading:!1,error:e},Er?.(e),t(e)},document.body.appendChild(c),vr.iframe=c}))},exports.openHallidayPayments=async function(e,...t){try{return Ar.openWidget(e,...t)}catch(e){throw yr(e),e}},exports.serializeQueryParams=cr;
|
|
1
|
+
"use strict";const e="https://app.halliday.xyz",t="https://v2.prod.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){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:o,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,o);const r=s.prototype,i=Object.keys(r);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=r[t].bind(n))}}const r=n?.Parent??Object;class i extends r{}function s(e){var t;const r=n?.Parent?new i:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(i,"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 r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class i extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const s={};function a(e){return s}function c(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function d(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 l(e){return null==e}function p(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const f=Symbol("evaluating");function m(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==f)return void 0===o&&(o=f,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function y(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function g(e){return JSON.stringify(e)}const _="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const w=u((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function b(e){if(!1===v(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==v(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function E(e){return b(e)?{...e}:Array.isArray(e)?[...e]:e}const z=new Set(["string","number","symbol"]);function k(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function O(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 x={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 A(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function I(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function S(e){return"string"==typeof e?e:e?.message}function N(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=S(e.inst?._zod.def?.error?.(e))??S(t?.error?.(e))??S(n.customError?.(e))??S(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function $(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function P(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const D=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,d,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Z=o("$ZodError",D),M=o("$ZodError",D,{Parent:Error});const C=e=>(t,n,o,i)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){const t=new(i?.Err??e)(c.issues.map((e=>N(e,s,a()))));throw _(t,i?.callee),t}return c.value},R=e=>async(t,n,o,r)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(r?.Err??e)(s.issues.map((e=>N(e,i,a()))));throw _(t,r?.callee),t}return s.value},L=e=>(t,n,o)=>{const i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??Z)(s.issues.map((e=>N(e,i,a()))))}:{success:!0,data:s.value}},j=L(M),U=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map((e=>N(e,r,a()))))}:{success:!0,data:i.value}},F=U(M),B=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return C(e)(t,n,r)},V=e=>(t,n,o)=>C(e)(t,n,o),W=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return R(e)(t,n,r)},J=e=>async(t,n,o)=>R(e)(t,n,o),H=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return L(e)(t,n,r)},G=e=>(t,n,o)=>L(e)(t,n,o),Y=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return U(e)(t,n,r)},K=e=>async(t,n,o)=>U(e)(t,n,o),q=/^[cC][^\s-]{8,}$/,X=/^[0-9a-z]+$/,Q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ee=/^[0-9a-vA-V]{20}$/,te=/^[A-Za-z0-9]{27}$/,ne=/^[a-zA-Z0-9_-]{21}$/,oe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,re=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const ae=/^(?:(?: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])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,de=/^((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])$/,ue=/^(([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])$/,le=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pe=/^[A-Za-z0-9_-]*$/,fe=/^\+[1-9]\d{6,14}$/,me="(?:(?:\\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])))",he=new RegExp(`^${me}$`);function ye(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ge=/^-?\d+n?$/,_e=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,we=/^(?:true|false)$/i,be=/^undefined$/i,Ee=/^[^A-Z]*$/,ze=/^[^a-z]*$/,ke=o("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),Te={number:"number",bigint:"bigint",object:"date"},Oe=o("$ZodCheckLessThan",((e,t)=>{ke.init(e,t);const n=Te[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:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),xe=o("$ZodCheckGreaterThan",((e,t)=>{ke.init(e,t);const n=Te[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:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Ae=o("$ZodCheckMultipleOf",((e,t)=>{ke.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();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);e?.[1]&&(r=Number.parseInt(e[1]))}const i=n>r?n:r;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})}})),Ie=o("$ZodCheckNumberFormat",((e,t)=>{ke.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[r,i]=x[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i,n&&(o.pattern=_e)})),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",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}))}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}})),Se=o("$ZodCheckMaxLength",((e,t)=>{var n;ke.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(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 r=$(o);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}})),Ne=o("$ZodCheckMinLength",((e,t)=>{var n;ke.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(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 r=$(o);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}})),$e=o("$ZodCheckLengthEquals",((e,t)=>{var n;ke.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(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,r=o.length;if(r===t.length)return;const i=$(o),s=r>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),Pe=o("$ZodCheckStringFormat",((e,t)=>{var n,o;ke.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})})),De=o("$ZodCheckRegex",((e,t)=>{Pe.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})}})),Ze=o("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=Ee),Pe.init(e,t)})),Me=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=ze),Pe.init(e,t)})),Ce=o("$ZodCheckIncludes",((e,t)=>{ke.init(e,t);const n=k(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})}})),Re=o("$ZodCheckStartsWith",((e,t)=>{ke.init(e,t);const n=new RegExp(`^${k(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})}})),Le=o("$ZodCheckEndsWith",((e,t)=>{ke.init(e,t);const n=new RegExp(`.*${k(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})}})),je=o("$ZodCheckOverwrite",((e,t)=>{ke.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class Ue{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 Fe={major:4,minor:3,patch:6},Be=o("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fe;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,i=A(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new r;if(o||a instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(i||(i=A(e,t)))}));else{if(e.issues.length===t)continue;i||(i=A(e,t))}}return o?o.then((()=>e)):e},n=(n,i,s)=>{if(A(n))return n.aborted=!0,n;const a=t(i,o,s);if(a instanceof Promise){if(!1===s.async)throw new r;return a.then((t=>e._zod.parse(t,s)))}return e._zod.parse(a,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,i,s))):n(t,i,s)}const a=e._zod.parse(i,s);if(a instanceof Promise){if(!1===s.async)throw new r;return a.then((e=>t(e,o,s)))}return t(a,o,s)}}m(e,"~standard",(()=>({validate:t=>{try{const n=j(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return F(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1})))})),Ve=o("$ZodString",((e,t)=>{var n;Be.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}})),We=o("$ZodStringFormat",((e,t)=>{Pe.init(e,t),Ve.init(e,t)})),Je=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=re),We.init(e,t)})),He=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=ie(e))}else t.pattern??(t.pattern=ie());We.init(e,t)})),Ge=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=se),We.init(e,t)})),Ye=o("$ZodURL",((e,t)=>{We.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=r.href:n.value=o)}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),Ke=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),We.init(e,t)})),qe=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=ne),We.init(e,t)})),Xe=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=q),We.init(e,t)})),Qe=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=X),We.init(e,t)})),et=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=Q),We.init(e,t)})),tt=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=ee),We.init(e,t)})),nt=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=te),We.init(e,t)})),ot=o("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=ye({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${me}T(?:${o})$`)}(t)),We.init(e,t)})),rt=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=he),We.init(e,t)})),it=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ye(t)}$`)),We.init(e,t)})),st=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=oe),We.init(e,t)})),at=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=ae),We.init(e,t),e._zod.bag.format="ipv4"})),ct=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=ce),We.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),dt=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=de),We.init(e,t)})),ut=o("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=ue),We.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(2!==o.length)throw new Error;const[e,t]=o;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function lt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const pt=o("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=le),We.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}));const ft=o("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=pe),We.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!pe.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return lt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),mt=o("$ZodE164",((e,t)=>{t.pattern??(t.pattern=fe),We.init(e,t)}));const ht=o("$ZodJWT",((e,t)=>{We.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;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),yt=o("$ZodNumber",((e,t)=>{Be.init(e,t),e._zod.pattern=e._zod.bag.pattern??ve,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const i="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}})),gt=o("$ZodNumberFormat",((e,t)=>{Ie.init(e,t),yt.init(e,t)})),_t=o("$ZodBoolean",((e,t)=>{Be.init(e,t),e._zod.pattern=we,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}})),vt=o("$ZodBigInt",((e,t)=>{Be.init(e,t),e._zod.pattern=ge,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}})),wt=o("$ZodUndefined",((e,t)=>{Be.init(e,t),e._zod.pattern=be,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const o=t.value;return void 0===o||t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}})),bt=o("$ZodAny",((e,t)=>{Be.init(e,t),e._zod.parse=e=>e})),Et=o("$ZodUnknown",((e,t)=>{Be.init(e,t),e._zod.parse=e=>e})),zt=o("$ZodNever",((e,t)=>{Be.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function kt(e,t,n){e.issues.length&&t.issues.push(...I(n,e.issues)),t.value[n]=e.value}const Tt=o("$ZodArray",((e,t)=>{Be.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const i=[];for(let e=0;e<r.length;e++){const s=r[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?i.push(a.then((t=>kt(t,n,e)))):kt(a,n,e)}return i.length?Promise.all(i).then((()=>n)):n}}));function Ot(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...I(n,e.issues))}void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function xt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=e.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function At(e,t,n,o,r,i){const s=[],a=r.keySet,c=r.catchall._zod,d=c.def.type,u="optional"===c.optout;for(const r in t){if(a.has(r))continue;if("never"===d){s.push(r);continue}const i=c.run({value:t[r],issues:[]},o);i instanceof Promise?e.push(i.then((e=>Ot(e,n,r,t,u)))):Ot(i,n,r,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then((()=>n)):n}const It=o("$ZodObject",((e,t)=>{Be.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const o=u((()=>xt(t)));m(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}));const r=v,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=o.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],d=s.shape;for(const e of s.keys){const o=d[e],r="optional"===o._zod.optout,i=o._zod.run({value:a[e],issues:[]},n);i instanceof Promise?c.push(i.then((n=>Ot(n,t,e,a,r)))):Ot(i,t,e,a,r)}return i?At(c,a,t,n,o.value,e):c.length?Promise.all(c).then((()=>t)):t}})),St=o("$ZodObjectJIT",((e,t)=>{It.init(e,t);const n=e._zod.parse,o=u((()=>xt(t)));let r;const i=v,a=!s.jitless,c=a&&w.value,d=t.catchall;let l;e._zod.parse=(s,u)=>{l??(l=o.value);const p=s.value;return i(p)?a&&c&&!1===u?.async&&!0!==u.jitless?(r||(r=(e=>{const t=new Ue(["shape","payload","ctx"]),n=o.value,r=e=>{const t=g(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const e of n.keys)i[e]="key_"+s++;t.write("const newResult = {};");for(const o of n.keys){const n=i[o],s=g(o),a=e[o],c="optional"===a?._zod?.optout;t.write(`const ${n} = ${r(o)};`),c?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),s=r(s,u),d?At([],p,s,u,l,e):s):n(s,u):(s.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),s)}}));function Nt(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter((e=>!A(e)));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>N(e,o,a())))))}),t)}const $t=o("$ZodUnion",((e,t)=>{Be.init(e,t),m(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),m(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),m(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),m(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=>p(e.source))).join("|")})$`)}}));const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then((t=>Nt(t,r,e,i))):Nt(a,r,e,i)}})),Pt=o("$ZodDiscriminatedUnion",((e,t)=>{t.inclusive=!1,$t.init(e,t);const n=e._zod.parse;m(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=(r,i)=>{const s=r.value;if(!v(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(r,i):t.unionFallback?n(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r)}})),Dt=o("$ZodIntersection",((e,t)=>{Be.init(e,t),e._zod.parse=(e,n)=>{const o=e.value,r=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then((([t,n])=>Mt(e,t,n))):Mt(e,r,i)}}));function Zt(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(b(e)&&b(t)){const n=Object.keys(t),o=Object.keys(e).filter((e=>-1!==n.indexOf(e))),r={...e,...t};for(const n of o){const o=Zt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r[n]=o.data}return{valid:!0,data:r}}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 r=Zt(e[o],t[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mt(e,t,n){const o=new Map;let r;for(const n of t.issues)if("unrecognized_keys"===n.code){r??(r=n);for(const e of n.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(t);const i=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(i.length&&r&&e.issues.push({...r,keys:i}),A(e))return e;const s=Zt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Ct=o("$ZodRecord",((e,t)=>{Be.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!b(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const s=t.valueType._zod.run({value:r[e],issues:[]},o);s instanceof Promise?i.push(s.then((t=>{t.issues.length&&n.issues.push(...I(e,t.issues)),n.value[e]=t.value}))):(s.issues.length&&n.issues.push(...I(e,s.issues)),n.value[e]=s.value)}let c;for(const e in r)a.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(r)){if("__proto__"===s)continue;let c=t.keyType._zod.run({value:s,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&ve.test(s)&&c.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},o);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(c=e)}if(c.issues.length){"loose"===t.mode?n.value[s]=r[s]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((e=>N(e,o,a()))),input:s,path:[s],inst:e});continue}const d=t.valueType._zod.run({value:r[s],issues:[]},o);d instanceof Promise?i.push(d.then((e=>{e.issues.length&&n.issues.push(...I(s,e.issues)),n.value[c.value]=e.value}))):(d.issues.length&&n.issues.push(...I(s,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then((()=>n)):n}})),Rt=o("$ZodEnum",((e,t)=>{Be.init(e,t);const n=c(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter((e=>z.has(typeof e))).map((e=>"string"==typeof e?k(e):e.toString())).join("|")})$`),e._zod.parse=(t,r)=>{const i=t.value;return o.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),Lt=o("$ZodLiteral",((e,t)=>{if(Be.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?k(e):e?k(e.toString()):String(e))).join("|")})$`),e._zod.parse=(o,r)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}})),jt=o("$ZodTransform",((e,t)=>{Be.init(e,t),e._zod.parse=(n,o)=>{if("backward"===o.direction)throw new i(e.constructor.name);const s=t.transform(n.value,n);if(o.async){return(s instanceof Promise?s:Promise.resolve(s)).then((e=>(n.value=e,n)))}if(s instanceof Promise)throw new r;return n.value=s,n}}));function Ut(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ft=o("$ZodOptional",((e,t)=>{Be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",m(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),m(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${p(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((t=>Ut(t,e.value))):Ut(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),Bt=o("$ZodExactOptional",((e,t)=>{Ft.init(e,t),m(e._zod,"values",(()=>t.innerType._zod.values)),m(e._zod,"pattern",(()=>t.innerType._zod.pattern)),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)})),Vt=o("$ZodNullable",((e,t)=>{Be.init(e,t),m(e._zod,"optin",(()=>t.innerType._zod.optin)),m(e._zod,"optout",(()=>t.innerType._zod.optout)),m(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${p(e.source)}|null)$`):void 0})),m(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)})),Wt=o("$ZodDefault",((e,t)=>{Be.init(e,t),e._zod.optin="optional",m(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>Jt(e,t))):Jt(o,t)}}));function Jt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Ht=o("$ZodPrefault",((e,t)=>{Be.init(e,t),e._zod.optin="optional",m(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Gt=o("$ZodNonOptional",((e,t)=>{Be.init(e,t),m(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 r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then((t=>Yt(t,e))):Yt(r,e)}}));function Yt(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 Kt=o("$ZodCatch",((e,t)=>{Be.init(e,t),m(e._zod,"optin",(()=>t.innerType._zod.optin)),m(e._zod,"optout",(()=>t.innerType._zod.optout)),m(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(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=>N(e,n,a())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>N(e,n,a())))},input:e.value}),e.issues=[]),e)}})),qt=o("$ZodPipe",((e,t)=>{Be.init(e,t),m(e._zod,"values",(()=>t.in._zod.values)),m(e._zod,"optin",(()=>t.in._zod.optin)),m(e._zod,"optout",(()=>t.out._zod.optout)),m(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const o=t.out._zod.run(e,n);return o instanceof Promise?o.then((e=>Xt(e,t.in,n))):Xt(o,t.in,n)}const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>Xt(e,t.out,n))):Xt(o,t.out,n)}}));function Xt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Qt=o("$ZodReadonly",((e,t)=>{Be.init(e,t),m(e._zod,"propValues",(()=>t.innerType._zod.propValues)),m(e._zod,"values",(()=>t.innerType._zod.values)),m(e._zod,"optin",(()=>t.innerType?._zod?.optin)),m(e._zod,"optout",(()=>t.innerType?._zod?.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(en):en(o)}}));function en(e){return e.value=Object.freeze(e.value),e}const tn=o("$ZodCustom",((e,t)=>{ke.init(e,t),Be.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((t=>nn(t,n,o,e)));nn(r,n,o,e)}}));function nn(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(P(e))}}var on;class rn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(on=globalThis).__zod_globalRegistry??(on.__zod_globalRegistry=new rn);const sn=globalThis.__zod_globalRegistry;function an(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function cn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function dn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function un(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function ln(e,t){return new Oe({check:"less_than",...O(t),value:e,inclusive:!1})}function pn(e,t){return new Oe({check:"less_than",...O(t),value:e,inclusive:!0})}function fn(e,t){return new xe({check:"greater_than",...O(t),value:e,inclusive:!1})}function mn(e,t){return new xe({check:"greater_than",...O(t),value:e,inclusive:!0})}function hn(e,t){return new Ae({check:"multiple_of",...O(t),value:e})}function yn(e,t){return new Se({check:"max_length",...O(t),maximum:e})}function gn(e,t){return new Ne({check:"min_length",...O(t),minimum:e})}function _n(e,t){return new $e({check:"length_equals",...O(t),length:e})}function vn(e){return new je({check:"overwrite",tx:e})}function wn(e){const t=function(e,t){const n=new ke({check:"custom",...O(t)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(P(e,n.value,t._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(P(o))}},e(n.value,n))));return t}function bn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??sn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function En(e,t,n={path:[],schemaPath:[]}){var o;const r=e._zod.def,i=t.seen.get(e);if(i){i.count++;return n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema}const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const o={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,o);else{const n=s.schema,i=t.processors[r.type];if(!i)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);i(e,t,n,o)}const i=e._zod.parent;i&&(s.ref||(s.ref=i),En(i,t,o),t.seen.get(i).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&Tn(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function zn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=o.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(n,t[0])}}const r=t=>{if(t[1].schema.$ref)return;const o=t[1],{ref:r,defId:i}=(t=>{const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,r=e.external.uri??(e=>e);if(n)return{ref:r(n)};const i=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=i,{defId:i,ref:`${r("__shared")}#/${o}/${i}`}}if(t[1]===n)return{ref:"#"};const r=`#/${o}/`,i=t[1].schema.id??"__schema"+e.counter++;return{defId:i,ref:r+i}})(t);o.def={...o.schema},i&&(o.defId=i);const s=o.schema;for(const e in s)delete s[e];s.$ref=r};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const o=n[1];if(t===n[0]){r(n);continue}if(e.external){const o=e.external.registry.get(n[0])?.id;if(t!==n[0]&&o){r(n);continue}}const i=e.metadataRegistry.get(n[0])?.id;i?r(n):(o.cycle||o.count>1&&"ref"===e.reused)&&r(n)}}function kn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=t=>{const n=e.seen.get(t);if(null===n.ref)return;const r=n.def??n.schema,i={...r},s=n.ref;if(n.ref=null,s){o(s);const n=e.seen.get(s),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(r,a):(r.allOf=r.allOf??[],r.allOf.push(a)),Object.assign(r,i);if(t._zod.parent===s)for(const e in r)"$ref"!==e&&"allOf"!==e&&(e in i||delete r[e]);if(a.$ref&&n.def)for(const e in r)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(r[e])===JSON.stringify(n.def[e])&&delete r[e]}const a=t._zod.parent;if(a&&a!==s){o(a);const t=e.seen.get(a);if(t?.schema.$ref&&(r.$ref=t.schema.$ref,t.def))for(const e in r)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(r[e])===JSON.stringify(t.def[e])&&delete r[e]}e.override({zodSchema:t,jsonSchema:r,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())o(t[0]);const r={};if("draft-2020-12"===e.target?r.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?r.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(n)}Object.assign(r,n.def??n.schema);const i=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?r.$defs=i:r.definitions=i);try{const n=JSON.parse(JSON.stringify(r));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:On(t,"input",e.processors),output:On(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Tn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return Tn(o.element,n);if("set"===o.type)return Tn(o.valueType,n);if("lazy"===o.type)return Tn(o.getter(),n);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return Tn(o.innerType,n);if("intersection"===o.type)return Tn(o.left,n)||Tn(o.right,n);if("record"===o.type||"map"===o.type)return Tn(o.keyType,n)||Tn(o.valueType,n);if("pipe"===o.type)return Tn(o.in,n)||Tn(o.out,n);if("object"===o.type){for(const e in o.shape)if(Tn(o.shape[e],n))return!0;return!1}if("union"===o.type){for(const e of o.options)if(Tn(e,n))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(Tn(e,n))return!0;return!(!o.rest||!Tn(o.rest,n))}return!1}const On=(e,t,n={})=>o=>{const{libraryOptions:r,target:i}=o??{},s=bn({...r??{},target:i,io:t,processors:n});return En(e,s),zn(s,e),kn(s,e)},xn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},An=(e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o);t.seen.get(e).ref=r.innerType},In=o("ZodISODateTime",((e,t)=>{ot.init(e,t),no.init(e,t)}));function Sn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}(In,e)}const Nn=o("ZodISODate",((e,t)=>{rt.init(e,t),no.init(e,t)}));function $n(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}(Nn,e)}const Pn=o("ZodISOTime",((e,t)=>{it.init(e,t),no.init(e,t)}));function Dn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}(Pn,e)}const Zn=o("ZodISODuration",((e,t)=>{st.init(e,t),no.init(e,t)}));function Mn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}(Zn,e)}const Cn=(e,t)=>{Z.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)n._errors.push(t(r));else{let e=n,o=0;for(;o<r.path.length;){const n=r.path[o];o===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],o++}}};return o(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,d,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,d,2)}},isEmpty:{get:()=>0===e.issues.length}})},Rn=o("ZodError",Cn),Ln=o("ZodError",Cn,{Parent:Error}),jn=C(Ln),Un=R(Ln),Fn=L(Ln),Bn=U(Ln),Vn=B(Ln),Wn=V(Ln),Jn=W(Ln),Hn=J(Ln),Gn=H(Ln),Yn=G(Ln),Kn=Y(Ln),qn=K(Ln),Xn=o("ZodType",((e,t)=>(Be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:On(e,"input"),output:On(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const o=bn({...n,processors:t});return En(e,o),zn(o,e),kn(o,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(y(t,{checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>T(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>jn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Fn(e,t,n),e.parseAsync=async(t,n)=>Un(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Bn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Vn(e,t,n),e.decode=(t,n)=>Wn(e,t,n),e.encodeAsync=async(t,n)=>Jn(e,t,n),e.decodeAsync=async(t,n)=>Hn(e,t,n),e.safeEncode=(t,n)=>Gn(e,t,n),e.safeDecode=(t,n)=>Yn(e,t,n),e.safeEncodeAsync=async(t,n)=>Kn(e,t,n),e.safeDecodeAsync=async(t,n)=>qn(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}(mr,e,t)}(t,n)),e.superRefine=t=>e.check(wn(t)),e.overwrite=t=>e.check(vn(t)),e.optional=()=>or(e),e.exactOptional=()=>new rr({type:"optional",innerType:e}),e.nullable=()=>sr(e),e.nullish=()=>or(sr(e)),e.nonoptional=t=>function(e,t){return new dr({type:"nonoptional",innerType:e,...O(t)})}(e,t),e.array=()=>jo(e),e.or=t=>Vo([e,t]),e.and=t=>new Ho({type:"intersection",left:e,right:t}),e.transform=t=>pr(e,tr(t)),e.default=t=>{return n=t,new ar({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():E(n)}});var n},e.prefault=t=>{return n=t,new cr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():E(n)}});var n},e.catch=t=>{return new ur({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>pr(e,t),e.readonly=()=>new fr({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return sn.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>sn.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return sn.get(e);const n=e.clone();return sn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e))),Qn=o("_ZodString",((e,t)=>{Ve.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=n;o.type="string";const{minimum:r,maximum:i,format:s,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof i&&(o.maxLength=i),s&&(o.format=xn[s]??s,""===o.format&&delete o.format,"time"===s&&delete o.format),c&&(o.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?o.pattern=e[0].source:e.length>1&&(o.allOf=[...e.map((e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source})))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new De({check:"string_format",format:"regex",...O(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Ce({check:"string_format",format:"includes",...O(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Re({check:"string_format",format:"starts_with",...O(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Le({check:"string_format",format:"ends_with",...O(t),suffix:e})}(...t)),e.min=(...t)=>e.check(gn(...t)),e.max=(...t)=>e.check(yn(...t)),e.length=(...t)=>e.check(_n(...t)),e.nonempty=(...t)=>e.check(gn(1,...t)),e.lowercase=t=>e.check(function(e){return new Ze({check:"string_format",format:"lowercase",...O(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Me({check:"string_format",format:"uppercase",...O(e)})}(t)),e.trim=()=>e.check(vn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return vn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(vn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(vn((e=>e.toUpperCase()))),e.slugify=()=>e.check(vn((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))))})),eo=o("ZodString",((e,t)=>{Ve.init(e,t),Qn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}(oo,t)),e.url=t=>e.check(cn(so,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}(zo,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}(co,t)),e.guid=t=>e.check(an(ro,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}(io,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}(io,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}(io,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}(io,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}(uo,t)),e.guid=t=>e.check(an(ro,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}(lo,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}(po,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}(fo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}(wo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}(bo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}(mo,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}(ho,t)),e.ipv4=t=>e.check(dn(yo,t)),e.ipv6=t=>e.check(un(go,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}(_o,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}(vo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}(Eo,t)),e.datetime=t=>e.check(Sn(t)),e.date=t=>e.check($n(t)),e.time=t=>e.check(Dn(t)),e.duration=t=>e.check(Mn(t))}));function to(e){return function(e,t){return new e({type:"string",...O(t)})}(eo,e)}const no=o("ZodStringFormat",((e,t)=>{We.init(e,t),Qn.init(e,t)})),oo=o("ZodEmail",((e,t)=>{Ge.init(e,t),no.init(e,t)})),ro=o("ZodGUID",((e,t)=>{Je.init(e,t),no.init(e,t)})),io=o("ZodUUID",((e,t)=>{He.init(e,t),no.init(e,t)})),so=o("ZodURL",((e,t)=>{Ye.init(e,t),no.init(e,t)}));function ao(e){return cn(so,e)}const co=o("ZodEmoji",((e,t)=>{Ke.init(e,t),no.init(e,t)})),uo=o("ZodNanoID",((e,t)=>{qe.init(e,t),no.init(e,t)})),lo=o("ZodCUID",((e,t)=>{Xe.init(e,t),no.init(e,t)})),po=o("ZodCUID2",((e,t)=>{Qe.init(e,t),no.init(e,t)})),fo=o("ZodULID",((e,t)=>{et.init(e,t),no.init(e,t)})),mo=o("ZodXID",((e,t)=>{tt.init(e,t),no.init(e,t)})),ho=o("ZodKSUID",((e,t)=>{nt.init(e,t),no.init(e,t)})),yo=o("ZodIPv4",((e,t)=>{at.init(e,t),no.init(e,t)}));const go=o("ZodIPv6",((e,t)=>{ct.init(e,t),no.init(e,t)}));const _o=o("ZodCIDRv4",((e,t)=>{dt.init(e,t),no.init(e,t)})),vo=o("ZodCIDRv6",((e,t)=>{ut.init(e,t),no.init(e,t)})),wo=o("ZodBase64",((e,t)=>{pt.init(e,t),no.init(e,t)})),bo=o("ZodBase64URL",((e,t)=>{ft.init(e,t),no.init(e,t)})),Eo=o("ZodE164",((e,t)=>{mt.init(e,t),no.init(e,t)})),zo=o("ZodJWT",((e,t)=>{ht.init(e,t),no.init(e,t)})),ko=o("ZodNumber",((e,t)=>{yt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=n,{minimum:r,maximum:i,format:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof s&&s.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==t.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof i&&(o.maximum=i,"number"==typeof c&&"draft-04"!==t.target&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof a&&(o.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(fn(t,n)),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.lt=(t,n)=>e.check(ln(t,n)),e.lte=(t,n)=>e.check(pn(t,n)),e.max=(t,n)=>e.check(pn(t,n)),e.int=t=>e.check(xo(t)),e.safe=t=>e.check(xo(t)),e.positive=t=>e.check(fn(0,t)),e.nonnegative=t=>e.check(mn(0,t)),e.negative=t=>e.check(ln(0,t)),e.nonpositive=t=>e.check(pn(0,t)),e.multipleOf=(t,n)=>e.check(hn(t,n)),e.step=(t,n)=>e.check(hn(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 To(e){return function(e,t){return new e({type:"number",checks:[],...O(t)})}(ko,e)}const Oo=o("ZodNumberFormat",((e,t)=>{gt.init(e,t),ko.init(e,t)}));function xo(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}(Oo,e)}const Ao=o("ZodBoolean",((e,t)=>{_t.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)}));function Io(e){return function(e,t){return new e({type:"boolean",...O(t)})}(Ao,e)}const So=o("ZodBigInt",((e,t)=>{vt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")})(0,e),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.gt=(t,n)=>e.check(fn(t,n)),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.lt=(t,n)=>e.check(ln(t,n)),e.lte=(t,n)=>e.check(pn(t,n)),e.max=(t,n)=>e.check(pn(t,n)),e.positive=t=>e.check(fn(BigInt(0),t)),e.negative=t=>e.check(ln(BigInt(0),t)),e.nonpositive=t=>e.check(pn(BigInt(0),t)),e.nonnegative=t=>e.check(mn(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(hn(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function No(e){return function(e,t){return new e({type:"bigint",...O(t)})}(So,e)}const $o=o("ZodUndefined",((e,t)=>{wt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema")})(0,e)}));const Po=o("ZodAny",((e,t)=>{bt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Do(){return new Po({type:"any"})}const Zo=o("ZodUnknown",((e,t)=>{Et.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Mo(){return new Zo({type:"unknown"})}const Co=o("ZodNever",((e,t)=>{zt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)}));function Ro(e){return function(e,t){return new e({type:"never",...O(t)})}(Co,e)}const Lo=o("ZodArray",((e,t)=>{Tt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(r.minItems=s),"number"==typeof a&&(r.maxItems=a),r.type="array",r.items=En(i.element,t,{...o,path:[...o.path,"items"]})})(e,t,n,o),e.element=t.element,e.min=(t,n)=>e.check(gn(t,n)),e.nonempty=t=>e.check(gn(1,t)),e.max=(t,n)=>e.check(yn(t,n)),e.length=(t,n)=>e.check(_n(t,n)),e.unwrap=()=>e.element}));function jo(e,t){return function(e,t,n){return new e({type:"array",element:t,...O(n)})}(Lo,e,t)}const Uo=o("ZodObject",((e,t)=>{St.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const e in s)r.properties[e]=En(s[e],t,{...o,path:[...o.path,"properties",e]});const a=new Set(Object.keys(s)),c=new Set([...a].filter((e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout})));c.size>0&&(r.required=Array.from(c)),"never"===i.catchall?._zod.def.type?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=En(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,n,o),m(e,"shape",(()=>t.shape)),e.keyof=()=>qo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Mo()}),e.loose=()=>e.clone({...e._zod.def,catchall:Mo()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ro()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!b(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=y(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return h(this,"shape",n),n}});return T(e,o)}(e,t),e.safeExtend=t=>function(e,t){if(!b(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=y(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return h(this,"shape",n),n}});return T(e,n)}(e,t),e.merge=t=>function(e,t){const n=y(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return h(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return T(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return T(e,y(e._zod.def,{get shape(){const e={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=n.shape[o])}return h(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=y(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return h(this,"shape",o),o},checks:[]});return T(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=y(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)r[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return h(this,"shape",r),r},checks:[]});return T(t,r)}(nr,e,t[0]),e.required=(...t)=>function(e,t,n){const o=y(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)r[t]=new e({type:"nonoptional",innerType:o[t]});return h(this,"shape",r),r}});return T(t,o)}(dr,e,t[0])}));function Fo(e,t){const n={type:"object",shape:e??{},...O(t)};return new Uo(n)}const Bo=o("ZodUnion",((e,t)=>{$t.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=!1===r.inclusive,s=r.options.map(((e,n)=>En(e,t,{...o,path:[...o.path,i?"oneOf":"anyOf",n]})));i?n.oneOf=s:n.anyOf=s})(e,t,n,o),e.options=t.options}));function Vo(e,t){return new Bo({type:"union",options:e,...O(t)})}const Wo=o("ZodDiscriminatedUnion",((e,t)=>{Bo.init(e,t),Pt.init(e,t)}));function Jo(e,t,n){return new Wo({type:"union",options:t,discriminator:e,...O(n)})}const Ho=o("ZodIntersection",((e,t)=>{Dt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=En(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=En(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c})(e,t,n,o)}));const Go=o("ZodRecord",((e,t)=>{Ct.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def;r.type="object";const s=i.keyType,a=s._zod.bag,c=a?.patterns;if("loose"===i.mode&&c&&c.size>0){const e=En(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(const t of c)r.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(r.propertyNames=En(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=En(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=s._zod.values;if(d){const e=[...d].filter((e=>"string"==typeof e||"number"==typeof e));e.length>0&&(r.required=e)}})(e,t,n,o),e.keyType=t.keyType,e.valueType=t.valueType}));function Yo(e,t,n){return new Go({type:"record",keyType:e,valueType:t,...O(n)})}const Ko=o("ZodEnum",((e,t)=>{Rt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=c(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(n.type="number"),o.every((e=>"string"==typeof e))&&(n.type="string"),n.enum=o})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const r={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);r[o]=t.entries[o]}return new Ko({...t,checks:[],...O(o),entries:r})},e.exclude=(e,o)=>{const r={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new Ko({...t,checks:[],...O(o),entries:r})}}));function qo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Ko({type:"enum",entries:n,...O(t)})}const Xo=o("ZodLiteral",((e,t)=>{Lt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=e._zod.def,r=[];for(const e of o.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");r.push(Number(e))}else r.push(e);if(0===r.length);else if(1===r.length){const e=r[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else r.every((e=>"number"==typeof e))&&(n.type="number"),r.every((e=>"string"==typeof e))&&(n.type="string"),r.every((e=>"boolean"==typeof e))&&(n.type="boolean"),r.every((e=>null===e))&&(n.type="null"),n.enum=r})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));function Qo(e,t){return new Xo({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const er=o("ZodTransform",((e,t)=>{jt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,o)=>{if("backward"===o.direction)throw new i(e.constructor.name);n.addIssue=o=>{if("string"==typeof o)n.issues.push(P(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),n.issues.push(P(t))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then((e=>(n.value=e,n))):(n.value=r,n)}}));function tr(e){return new er({type:"transform",transform:e})}const nr=o("ZodOptional",((e,t)=>{Ft.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>An(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));function or(e){return new nr({type:"optional",innerType:e})}const rr=o("ZodExactOptional",((e,t)=>{Bt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>An(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));const ir=o("ZodNullable",((e,t)=>{Vt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=En(r.innerType,t,o),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));function sr(e){return new ir({type:"nullable",innerType:e})}const ar=o("ZodDefault",((e,t)=>{Wt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const cr=o("ZodPrefault",((e,t)=>{Ht.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));const dr=o("ZodNonOptional",((e,t)=>{Gt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType})(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));const ur=o("ZodCatch",((e,t)=>{Kt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;let i;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const lr=o("ZodPipe",((e,t)=>{qt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i="input"===t.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;En(i,t,o),t.seen.get(e).ref=i})(e,t,0,o),e.in=t.in,e.out=t.out}));function pr(e,t){return new lr({type:"pipe",in:e,out:t})}const fr=o("ZodReadonly",((e,t)=>{Qt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,n.readOnly=!0})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));const mr=o("ZodCustom",((e,t)=>{tn.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));const hr=to().regex(/^0x[a-fA-F0-9]*$/,{message:"Must be a hex string beginning with 0x"}).transform((e=>e)),yr=to().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a 40-character hex string beginning with 0x"}).transform((e=>e.toLowerCase())),gr=to(),_r=to();Fo({EVM:yr,SOL:gr}).keyof();const vr=to().regex(/^(\d+|\d*\.\d+)$/);No().min(0n),No().min(0n);const wr=to().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),br=Fo({issuer:to(),name:to(),alias:to().optional(),symbol:to(),decimals:To()}),Er=to(),zr=to().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),kr=To().min(0).max(18),Tr=to().url(),Or=to(),xr=Fo({chain:to(),address:hr}),Ar=Fo({chain:Qo("solana"),address:gr}),Ir=Fo({chain:to(),address:to()}),Sr=Vo([xr,Ar,Ir]),Nr=to().refine((e=>{const[t,n]=e.split(":");return Sr.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),$r=Fo({name:Er,symbol:zr,decimals:kr,alias:zr.optional(),image_url:Tr.optional(),coingecko_id:Or.optional(),wrapper:zr.optional(),is_native:Io().optional()}),Pr=Vo([xr.extend($r.shape),Ar.extend($r.shape),Ir.extend($r.shape)]),Dr=Vo([Nr,wr]);Vo([Pr,br]),Jo("type",[Fo({type:Qo("chain"),chain:to()}),Fo({type:Qo("issuer"),issuer:to()})]);const Zr=to().transform((e=>e.toLowerCase()));var Mr,Cr;Mr=e=>"string"==typeof e?e.toUpperCase():e,Cr=qo(["ONRAMP","OFFRAMP"]),pr(tr(Mr),Cr),Fo({to:yr,from:yr.optional(),nonce:To().optional(),gasLimit:No().optional(),gasPrice:No().optional(),maxPriorityFeePerGas:No().optional(),maxFeePerGas:No().optional(),data:to().optional(),value:No().optional(),chainId:To()}),Fo({transactionHash:to().optional(),blockHash:to().optional(),blockNumber:To().optional(),from:yr.optional(),to:yr.optional(),rawReceipt:Do()});const Rr=Fo({chain_id:No(),network:to(),address_family:function(e,t){return new e({type:"undefined",...O(t)})}($o,Lr),explorer:ao().optional(),image:ao().optional(),is_testnet:Io()});var Lr;Jo("address_family",[Rr.extend({address_family:Qo("EVM"),native_currency:Fo({name:to(),symbol:to(),decimals:To()}),rpc:to().optional()}),Rr.extend({address_family:Qo("SOL")}),Rr]);const jr=qo(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),Ur=()=>{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)},Fr=to().refine((e=>n.test(e)),{message:"Invalid payment ID"}),Br=qo(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]),Vr=Fo({onramps:jo(Zr).optional(),offramps:jo(Zr).optional(),sandbox:Io().optional().default(!1),features:jo(Br).optional()}),Wr=Vr.extend({inputs:jo(Dr).optional(),outputs:jo(Dr)});Vo([Wr,Vr.extend({inputs:jo(Dr),outputs:jo(Dr).optional()})]);const Jr=Fo({asset:Dr,amount:vr}),Hr=Fo({token:Nr,amount:vr}),Gr=to(),Yr=Vo([function(e){return dn(yo,e)}(),function(e){return un(go,e)}()]),Kr=Fo({price_currency:wr,onramps:jo(Zr).optional(),onramp_methods:jo(jr).optional(),customer_ip_address:to().optional(),customer_id:to().optional(),label:to().optional(),parent_payment_id:Fr.optional(),features:jo(Br).optional(),rev_share_name:to().optional(),allow_unsafe_transfer_out:Io().optional(),show_all_issues:Io().optional(),allow_exceed_max_input_limit:Io().optional(),allow_unsafe_slippage:Io().optional()}),qr=Fo({"#":to()}),Xr=Fo({type:Qo("CallImmediateAction"),target:to(),value:qr,calldata:to()}),Qr=Fo({actions:jo(Xr),user_estimated_gas:qr}),ei=Jo("kind",[Fo({kind:Qo("FIXED_INPUT"),fixed_input_amount:Jr,output_asset:Dr,custom_actions:Qr.optional(),dest_address:to().optional()})]),ti=Kr.extend({request:ei}),ni=qo(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),oi=Fo({asset:Dr,property:qo(["APPROVAL","BALANCE"])}),ri=Fo({account:ni,resource:oi}),ii=Vo([Qo("COMPLETE"),Qo("UNREACHABLE"),Qo("FAILED")]),si=Vo([ii,Qo("PENDING")]),ai=qo(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),ci=Fo({consume:jo(ri),produce:jo(ri)}),di=ri.extend({amount:vr}),ui=ci.extend({consume:jo(di),produce:jo(di)}),li=Yo(Dr,to()),pi=Jo("kind",[Fo({kind:Vo([Qo("amount"),Qo("amount-downstream")]),given:to(),limits:Fo({min:to().optional(),max:to().optional()}),source:to(),message:to()}),Fo({kind:Qo("geolocation"),message:to()}),Fo({kind:Qo("provider"),message:to()}),Fo({kind:Qo("other"),message:to()}),Fo({kind:Qo("unknown"),message:to()})]),fi=Fo({service_ids:jo(to()),latency_seconds:To(),issues:jo(pi).optional()}),mi=Fo({type:Vo([Qo("USER_FUND"),Qo("ONCHAIN_STEP"),Qo("ONRAMP")]),net_effect:ui,pieces_info:jo(Fo({type:Vo([Qo("onramp"),Qo("poll"),Qo("bridge"),Qo("rev_share"),Qo("transfer_out"),Qo("convert")])})),step_index:To().optional()}),hi=Fo({payment_id:to(),output_amount:Fo({asset:Dr,amount:to()}),onramp:Zr.optional(),onramp_method:jr.optional(),fees:Fo({total_fees:to(),conversion_fees:to(),network_fees:to(),business_fees:to(),currency_symbol:wr}),route:jo(mi)}),yi=mi.extend({status:si,transaction_hash:to().optional()}),gi=hi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:jo(yi)});Fo({quote_request:ti,quotes:jo(hi),current_prices:li,price_currency:wr,state_token:to(),quoted_at:to(),accept_by:to(),failures:jo(fi)}),Fo({payment_id:Fr,state_token:to(),owner_chain:to().optional(),owner_address:_r,destination_address:_r,client_redirect_url:to().optional(),allow_unsafe_owner:Io().optional()});const _i=Fo({deposit_token:Nr,deposit_chain:to(),deposit_amount:vr,deposit_address:_r}),vi=Fo({type:qo(["ONRAMP","TRANSFER_IN"]),payment_id:Fr,funding_page_url:ao(),deposit_info:jo(_i)}),wi=Fo({payment_id:Fr,org_id:to(),status:ai,funded:Io(),created_at:to(),updated_at:to(),initiate_fund_by:to(),completed_at:to().optional(),quote_request:ti,quoted:hi.omit({payment_id:!0}),fulfilled:gi,current_prices:li,price_currency:wr,customer_id:to().optional(),label:to().optional(),processing_addresses:jo(Fo({address:_r,chain:to()})),owner_chain:to(),owner_address:_r,destination_address:_r,next_instruction:vi.optional(),parent_payment_id:Fr.optional()});Fo({payment_id:Fr,redirect_url:to(),referrer_domain:to().optional()}),Fo({funding_page_onramp_url:to(),client_redirect_url:to().optional(),client_secret:to().optional()}),Fo({id_query:to().optional(),pagination_key:to().optional(),dest_address:_r.optional(),owner_address:_r.optional(),limit:To().int().positive().optional(),category:qo(["ALL","NEW_OR_FUNDED"]).optional(),label:to().optional()}),Fo({payment_statuses:jo(wi),next_pagination_key:to().nullable()}),Fo({payment_id:Fr.optional(),custom_queries:jo(Fo({address:_r,token:Vo([Nr,Sr])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),Fo({balance_results:jo(Fo({address:_r,token:Nr,value:Jo("kind",[Fo({kind:Qo("amount"),amount:vr}),Fo({kind:Qo("error")})])}))}),Fo({fiat:wr,tokens:jo(Nr)});const bi=to(),Ei=Fo({payment_id:Fr,token_amounts:jo(Hr),recipient_address:_r});Fo({payment_id:Fr,withdraw_authorization:bi}),Ei.extend({owner_signature:Gr}),Fo({payment_id:Fr,transaction_hash:to()});const zi=qo(["EMBED","POPUP","MODAL"]),ki=qo(["DEFAULT","ALL_UPPERCASE"]),Ti=qo(["AUTO","MEDIUM"]),Oi=qo(["ATTACHED","BUTTON"]),xi=qo(["SQUARE","DEFAULT"]),Ai=to().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"}),Ii=Fo({src:ao(),alt:to(),width:To().positive(),height:To().positive()}),Si=Fo({primaryColor:Ai.optional(),backgroundColor:Ai.optional(),borderColor:Ai.optional(),textColor:Ai.optional(),textSecondaryColor:Ai.optional(),accentColor:Ai.optional(),componentShadow:to().optional(),borderStyle:xi.optional(),textMode:ki.optional(),paymentCategoryGrouping:Oi.optional(),fontWeight:Ti.optional(),logo:Ii.optional()}),Ni=Do(),$i=jo(qo(["wallet","open-wallet","exchange","open-exchange","cash","open-cash","deposit"])),Pi=qo(["haffer","wudoo-mono"]),Di=to().optional(),Zi=Fo({address:_r,signMessage:Do().refine((e=>"function"==typeof e)).optional(),sendTransaction:Do().refine((e=>"function"==typeof e)).optional(),signTypedData:Do().refine((e=>"function"==typeof e)).optional()}),Mi=Fo({redirectUrl:ao(),ctaText:to(),secondaryRedirectUrl:ao().optional(),secondaryCtaText:to().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),Ci=Fo({apiKey:to().nonempty(),destinationAddress:_r.optional(),widgetVersion:qo(["1","2"]).optional(),...Wr.shape,customStyles:Si.optional(),targetElementId:to().optional(),windowType:zi.optional(),redirects:Mi.optional(),statusCallback:Do().refine((e=>"function"==typeof e)).optional(),owner:Zi.optional(),funder:Zi.optional(),features:jo(Br).optional(),paymentCategoryOrder:$i.optional(),fontName:Pi.optional(),headerTitle:Di.optional(),showSkeleton:Io().optional(),skeletonBackgroundColor:to().optional()}),Ri=Ci.refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),Li=Ci.omit({owner:!0,funder:!0,statusCallback:!0}),ji=to().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),Ui=Yo(to(),Io()),Fi=Fo({dangerouslyOverrideHallidayDomainName:ao().optional(),dangerouslyOverrideApiBaseUrl:ji.optional(),dangerouslyOverrideIPAddress:Yr.optional(),dangerouslyOverrideFeatureFlags:Ui.optional()}),Bi=qo(["FULL","MODAL","OVERLAY","EMBED"]),Vi=Fo({appMode:Bi.optional(),apiBaseUrl:ji.optional(),hasOwner:Io(),hasTxHandler:Io(),hostOrigin:ao().nullable(),ipAddress:Yr.optional(),featureFlags:Ui.optional()}),Wi=Fo({...Li.shape,...Vi.shape,ownerAddress:_r.optional(),funderAddress:_r.optional()});var Ji;exports.MessageType=void 0,(Ji=exports.MessageType||(exports.MessageType={})).ACTION_TRANSACTION="ACTION_TRANSACTION",Ji.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",Ji.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",Ji.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",Ji.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",Ji.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA",Ji.EVENT_RESIZE="EVENT_RESIZE";const Hi=Fo({apiKey:to().nonempty(),sandbox:Io().optional(),onReady:Do().refine((e=>"function"==typeof e||void 0===e)).optional(),onError:Do().refine((e=>"function"==typeof e||void 0===e)).optional()}),Gi=e=>{if(e)return e.includes("deposit")?e:["deposit",...e]},Yi=()=>{const e=document.getElementById("halliday-payments-skeleton");e&&(e.style.opacity="0",setTimeout((()=>e.remove()),300))},Ki=e=>{const t=Wi.parse(e);return btoa(JSON.stringify(t))},qi=t=>{const{windowOrigin:n=e,...o}=t,r=Ki(o),i=o.widgetVersion;if(i)try{return`${n}/v${parseInt(i)}/payments/quote?data=${r}`}catch(e){console.error("Error parsing widget version",e)}return`${n}/payments/quote?data=${r}`},Xi=e=>{const t=window.innerWidth/2-240,{windowType:n="POPUP",targetElementId:o,windowOrigin:r}=e,i=qi(e);let s;if("EMBED"===n){const e=document.getElementById(o);if(!e)throw new Error(`Element with id ${o} not found`);let t=document.getElementById("halliday-payments-embed");if((t?t.src:null)===i)t.style.display="block";else{let n=document.getElementById("halliday-payments-wrapper");n||(e.innerHTML="",e.style&&(e.style.position="relative"),n=document.createElement("div"),n.id="halliday-payments-wrapper",n.style.cssText="\n position: relative;\n width: 480px;\n max-width: 100%;\n display: block;\n ",e.appendChild(n)),t=document.createElement("iframe"),t.id="halliday-payments-embed",t.src=i,t.style.cssText="\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: none;\n display: block;\n ",t.setAttribute("scrolling","no"),n.appendChild(t)}s=t.contentWindow;const n=e=>{const{type:t,payload:o}=e.data||{},i=e.source===s,a=e.origin===r;if(i&&(a||t===exports.MessageType.EVENT_RESIZE))if(t===exports.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",n);const e=document.getElementById("halliday-payments-embed");e&&(e.style.display="none")}else if(t===exports.MessageType.EVENT_RESIZE){const e=document.getElementById("halliday-payments-skeleton"),t=document.getElementById("halliday-payments-wrapper");void 0!==o?.height&&(e&&(e.style.height=o.height+"px"),t&&(t.style.minHeight=o.height+"px"))}else"WIDGET_READY"!==t&&"HALLIDAY_READY"!==t||Yi()};window.addEventListener("message",n)}else if("MODAL"===n){let e=document.getElementById("halliday-payments-modal");(e?e.src:null)===i?e.style.display="block":(e&&e.remove(),e=document.createElement("iframe"),e.id="halliday-payments-modal",e.src=i,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100dvw",e.style.height="100dvh",e.style.border="none",e.style.zIndex="1000",e.setAttribute("scrolling","no"),document.body.appendChild(e));const t=e=>{if(e.origin!==r||e.source!==s)return;const{type:n}=e.data||{};if(n===exports.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",t);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",t),s=e.contentWindow}else s=window.open(i,"Halliday Payments",`popup left=${t} top=70 width=480 height=638`);return s},Qi=e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)},es=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let r=1;r<=3;r++)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===r)throw o;const t=1e3*Math.pow(2,r);await new Promise((e=>setTimeout(e,t)))}throw o},ts=async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await es({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const r=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),i=r?.status;if("COMPLETE"===i)break;await new Promise((e=>setTimeout(e,5e3)))}},ns=e=>{e instanceof Rn?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},os="halliday-payments-preload";let rs={isPreloaded:!1,isLoading:!1,iframe:null,error:null,startTime:null,readyTime:null},is=null,ss=null,as=null,cs=null,ds=null,us=null,ls=null,ps=null,fs=0;const ms=()=>rs.isPreloaded&&!rs.error,hs=()=>{const e=rs.iframe;e&&(e.style.visibility="hidden",e.style.opacity="0",e.style.pointerEvents="none",e.style.zIndex="-1",e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1"))},ys=e=>{const{windowOrigin:t,widgetWindow:n,providerWindowRef:o,cleanMessageHandlers:r,hasOwner:i,hasTxHandler:s,signMessage:a,signTypedData:c,sendTransaction:d,statusCallback:u,apiKey:l,apiBaseUrl:p}=e,f=[];return f.push((e=>{if(e.origin!==t||e.source!==n)return;const{type:o}=e.data||{};o===exports.MessageType.EVENT_WINDOW_CLOSE&&r()})),i&&f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:r}=e.data||{};if(o===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:i,ownerAddress:s}=r;try{const r="function"==typeof a?await a({message:i,ownerAddress:s}):(()=>{throw new Error("No signMessage function provided")})();n.postMessage({type:o,payload:{messageId:e,signature:r}},t)}catch(r){n.postMessage({type:o,payload:{messageId:e,error:r instanceof Error?r.message:r}},t)}}else if(o===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:i,ownerAddress:s}=r;try{const r="function"==typeof c?await c({typedData:i,ownerAddress:s}):(()=>{throw new Error("No signTypedData function provided")})();n.postMessage({type:o,payload:{messageId:e,signature:r}},t)}catch(r){n.postMessage({type:o,payload:{messageId:e,error:r instanceof Error?r.message:r}},t)}}})),s&&f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:r}=e.data||{};if(o===exports.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:i,transaction:s}=r;try{const r="function"==typeof d?await d(s,i):(()=>{throw new Error("No sendTransaction function provided")})();n.postMessage({type:o,payload:{messageId:e,txReceipt:r}},t)}catch(r){n.postMessage({type:o,payload:{messageId:e,error:r instanceof Error?r.message:r}},t)}}})),u&&f.push((e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:r}=e.data||{};o===exports.MessageType.EVENT_ORDER_STATUS&&u({type:o,payload:r})})),f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:r,payload:i}=e.data||{};if(r===exports.MessageType.ACTION_PROVIDER_WIDGET){const{url:e,redirectUrl:t,providerWidgetMode:r,workflowId:s}=i||{};if(!(e&&t&&r&&s))return;let a=null;"REDIRECT"===r?(n.location=e,a=n):"POPUP"===r&&(o.current=Qi(e),a=o.current),a&&(await ts({apiKey:l,baseURL:p,workflowId:s,window:a}),a.closed||("REDIRECT"===r?n.location=t:"POPUP"===r&&(o.current?.close(),o.current=null)))}})),f},gs=(()=>{let n=null,o=null;const r={get current(){return o},set current(e){o=e}};let i=[];const s=()=>{i.forEach((e=>{window.removeEventListener("message",e)})),i=[]},a=e=>{e.forEach((e=>{window.addEventListener("message",e)})),i=e},c=async(i,...d)=>{const u=d[999]||d[0]||{},l=async()=>{let r,c;try{r=Ri.parse(i)}catch(e){throw ns(e),e}try{c=Fi.parse(u)}catch(e){throw ns(e),e}const{dangerouslyOverrideHallidayDomainName:d,dangerouslyOverrideApiBaseUrl:l,dangerouslyOverrideIPAddress:p,dangerouslyOverrideFeatureFlags:f}=c,{owner:m,statusCallback:h,funder:y,windowType:g}=r,_=(d||e).replace(/\/$/,""),v=m?.signMessage,w=m?.signTypedData,b=y?.sendTransaction||m?.sendTransaction,E=m?.address,z=y?.address,k=_r.safeParse(E).success&&"function"==typeof w,T=_r.safeParse(z).success&&"function"==typeof b;let O=null,x="FULL";try{O=window.origin,"MODAL"===g?x=Ur()?"OVERLAY":"MODAL":"EMBED"===g&&(x="EMBED")}catch(e){}s();const A=[e=>{if(e.origin!==_||e.source!==n)return;const{type:t}=e.data||{};t===exports.MessageType.EVENT_WINDOW_CLOSE&&s()}];if(k){const e=async e=>{if(e.origin!==_||e.source!==n)return;const{type:t,payload:o}=e.data||{};if(t===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:r,ownerAddress:i}=o;try{let o;if("function"!=typeof v)throw new Error("No signMessage function provided");o=await v({message:r,ownerAddress:i}),n?.postMessage({type:t,payload:{messageId:e,signature:o}},_)}catch(o){console.error("Error signing message",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},_)}}else if(t===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:r,ownerAddress:i}=o;try{let o;if("function"!=typeof w)throw new Error("No signTypedData function provided");o=await w({typedData:r,ownerAddress:i}),n?.postMessage({type:t,payload:{messageId:e,signature:o}},_)}catch(o){console.error("Error signing typed data",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},_)}}};A.push(e)}if(T){const e=async e=>{if(e.origin!==_||e.source!==n)return;const{type:t,payload:o}=e.data||{};if(t===exports.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:r,transaction:i}=o;try{let o;if("function"!=typeof b)throw new Error("No sendTransaction function provided");o=await b(i,r),n?.postMessage({type:t,payload:{messageId:e,txReceipt:o}},_)}catch(o){console.error("Error handling transaction",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},_)}}};A.push(e)}if(h){const e=e=>{if(e.origin!==_||e.source!==n)return;const{type:t,payload:o}=e.data||{};t===exports.MessageType.EVENT_ORDER_STATUS&&h({type:t,payload:o})};A.push(e)}A.push((async e=>{if(e.origin!==_||e.source!==n)return;const{type:i,payload:s}=e.data||{};if(i===exports.MessageType.ACTION_PROVIDER_WIDGET&&n){const{url:e,redirectUrl:i,providerWidgetMode:a,workflowId:c}=s||{};if(!(e&&i&&a&&c))throw new Error("Invalid provider widget payload");let d=null;if("REDIRECT"===a)n.location=e,d=n;else{if("POPUP"!==a)throw new Error("Invalid provider widget mode");o=Qi(e),d=o}if(await ts({apiKey:r.apiKey,baseURL:l||t,workflowId:c,window:d}),d?.closed)return;"REDIRECT"===a?n.location=i:"POPUP"===a&&(o?.close(),o=null)}}));const I={...r,sandbox:r.sandbox||!1,hasOwner:k,hasTxHandler:T,windowOrigin:_,apiBaseUrl:l,hostOrigin:O,ownerAddress:E,funderAddress:z,ipAddress:p,featureFlags:f,appMode:x,fontName:r.fontName,paymentCategoryOrder:Gi(r.paymentCategoryOrder),headerTitle:r.headerTitle};n=Xi(I),a(A)},p=i.windowType,f=i.targetElementId,m=i.showSkeleton??!0,h=i.skeletonBackgroundColor??i.customStyles?.backgroundColor;if("EMBED"===p&&f&&m){const e=document.getElementById(f);e&&(ms()||((e,t)=>{const n=document.getElementById("halliday-payments-skeleton");n&&n.remove(),e.style&&(e.style.position="relative");let o=document.getElementById("halliday-payments-wrapper");o||(o=document.createElement("div"),o.id="halliday-payments-wrapper",o.style.cssText="\n position: relative;\n width: 480px;\n max-width: 100%;\n display: block;\n ",e.appendChild(o));const r=t||"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",i=document.createElement("div");if(i.id="halliday-payments-skeleton",i.style.cssText=`\n width: 100%;\n height: 400px;\n background: ${r};\n background-size: 200% 100%;\n animation: halliday-skeleton-pulse 1.5s ease-in-out infinite;\n border-radius: 12px;\n position: relative;\n z-index: 1;\n transition: opacity 0.3s ease-out;\n `,!document.getElementById("halliday-skeleton-styles")&&document.head)try{const e=document.createElement("style");e.id="halliday-skeleton-styles",e.textContent="\n @keyframes halliday-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n ",document.head.appendChild(e)}catch{}o.appendChild(i)})(e,h))}if(ms()){const o=is,c=cs,d=(c?.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,""),{owner:l,funder:p,statusCallback:f}=i,m=l?.signMessage,h=l?.signTypedData,y=p?.sendTransaction||l?.sendTransaction,g=l?.address,_=p?.address,v=_r.safeParse(g).success&&"function"==typeof h,w=_r.safeParse(_).success&&"function"==typeof y,b=i.windowType||"MODAL",E=i.targetElementId;let z=null,k="FULL";try{z=window.origin,"MODAL"===b?k=Ur()?"OVERLAY":"MODAL":"EMBED"===b&&(k="EMBED")}catch{}const T={apiKey:i.apiKey||o?.apiKey||"",sandbox:i.sandbox??o?.sandbox??!1,widgetVersion:i.widgetVersion,destinationAddress:i.destinationAddress,outputs:i.outputs??[],inputs:i.inputs,customStyles:i.customStyles,redirects:i.redirects,features:i.features,paymentCategoryOrder:Gi(i.paymentCategoryOrder),fontName:i.fontName,headerTitle:i.headerTitle,windowType:b,targetElementId:E,hasOwner:v,hasTxHandler:w,ownerAddress:g,funderAddress:_,hostOrigin:z,appMode:k,windowOrigin:d,apiBaseUrl:u?.dangerouslyOverrideApiBaseUrl??c?.dangerouslyOverrideApiBaseUrl,ipAddress:u?.dangerouslyOverrideIPAddress??c?.dangerouslyOverrideIPAddress,featureFlags:u?.dangerouslyOverrideFeatureFlags??c?.dangerouslyOverrideFeatureFlags};if(n=(t=>{const n=rs.iframe;if(!n||!rs.isPreloaded||!is)return null;const o=(cs?.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,""),r=t?.windowType||"MODAL",i=t?.targetElementId;if("POPUP"===r)return null;let s="MODAL";try{"MODAL"===r?s=Ur()?"OVERLAY":"MODAL":"EMBED"===r&&(s="EMBED")}catch{}if(t){const{windowType:e,...r}=t;n.contentWindow?.postMessage({type:"HALLIDAY_UPDATE_PARAMS",payload:{...r,appMode:s}},o)}if("EMBED"===r){if(!i)return console.error("[HallidayPayments] EMBED mode requires targetElementId in openHallidayPayments"),null;const e=document.getElementById(i);if(!e)return console.error(`[HallidayPayments] Target element '${i}' not found`),null;let t=document.getElementById("halliday-payments-wrapper")||document.getElementById("halliday-payments-placeholder");t||(t=document.createElement("div"),t.id="halliday-payments-placeholder",t.style.cssText=`\n width: 480px;\n max-width: 100%;\n height: ${us||400}px;\n `,e.appendChild(t));const r=()=>{const e=t.getBoundingClientRect();n.style.position="fixed",n.style.top=e.top+"px",n.style.left=e.left+"px",n.style.width=e.width+"px",n.style.height=e.height+"px",n.style.border="none",n.style.zIndex="1"};t.offsetHeight,requestAnimationFrame((()=>{requestAnimationFrame((()=>{r(),n.style.visibility="visible",n.style.opacity="1",n.style.pointerEvents="auto"}))}));const s=new ResizeObserver((()=>{r()}));s.observe(t);const a=()=>r();window.addEventListener("scroll",a,!0);const c=()=>r();window.addEventListener("resize",c),n._embedCleanup=()=>{s.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",c),t?.remove()};const d=e=>{if(e.origin!==o)return;if(e.source!==n.contentWindow)return;const{type:i,payload:s}=e.data||{};i===exports.MessageType.EVENT_RESIZE&&s&&void 0!==s.height&&t&&(us=s.height,t.style.height=s.height+"px",r())};if(window.addEventListener("message",d),n.removeAttribute("aria-hidden"),n.removeAttribute("tabindex"),rs.isPreloaded)Yi();else{const e=t=>{if(t.origin!==o)return;if(t.source!==n.contentWindow)return;const{type:r}=t.data||{};"WIDGET_READY"!==r&&"HALLIDAY_READY"!==r||(window.removeEventListener("message",e),Yi())};window.addEventListener("message",e)}}else n.id="halliday-payments-modal",n.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: 10000;\n ",n.removeAttribute("aria-hidden"),n.removeAttribute("tabindex"),n.setAttribute("scrolling","no"),n.parentElement!==document.body&&document.body.appendChild(n);setTimeout((()=>{n.contentWindow?.postMessage({type:"HALLIDAY_SHOW"},o)}),10);const a=e=>{if(e.origin!==o)return;if(e.source!==n.contentWindow)return;const{type:t}=e.data||{};t===exports.MessageType.EVENT_WINDOW_CLOSE&&(window.removeEventListener("message",a),hs())};return window.addEventListener("message",a),n.contentWindow})(T),n){s();const e=ys({windowOrigin:d,widgetWindow:n,providerWindowRef:r,cleanMessageHandlers:s,hasOwner:v,hasTxHandler:w,signMessage:m,signTypedData:h,sendTransaction:y,statusCallback:f,apiKey:o?.apiKey||i.apiKey,apiBaseUrl:c?.dangerouslyOverrideApiBaseUrl||t});return void a(e)}if("POPUP"===b&&(n=Xi({...T,windowOrigin:d}),n)){s();const e=ys({windowOrigin:d,widgetWindow:n,providerWindowRef:r,cleanMessageHandlers:s,hasOwner:v,hasTxHandler:w,signMessage:m,signTypedData:h,sendTransaction:y,statusCallback:f,apiKey:o?.apiKey||i.apiKey,apiBaseUrl:c?.dangerouslyOverrideApiBaseUrl||t});return void a(e)}}return null===is||ms()?l():new Promise((e=>{const t=Date.now(),n=()=>{ms()?c(i,...d).then(e):Date.now()-t>=3e4?l().then(e):setTimeout(n,100)};n()}))};return{openWidget:c}})();exports.AppMode=Bi,exports.BorderStyle=xi,exports.CustomStyles=Si,exports.FontName=Pi,exports.HeaderTitle=Di,exports.InitConfig=Hi,exports.OrderStatus=Ni,exports.PaymentCategoryOrder=$i,exports.PaymentsWidgetQueryParams=Wi,exports.PaymentsWidgetSDKParams=Ri,exports.deserializeQueryParams=e=>Wi.parse(JSON.parse(atob(e))),exports.destroyClient=()=>{ds&&(window.removeEventListener("message",ds),ds=null);const e=rs.iframe;e&&e._embedCleanup&&e._embedCleanup();const t=document.getElementById(os);t&&t.remove();const n=document.getElementById("halliday-payments-placeholder");n&&n.remove();const o=document.getElementById("halliday-payments-modal");o&&o.remove();const r=document.getElementById("halliday-payments-skeleton");r&&r.remove(),rs={isPreloaded:!1,isLoading:!1,iframe:null,error:null,startTime:null,readyTime:null},is=null,cs=null,ss=null,as=null,us=null,ls=null,ps=null},exports.getPaymentsWidgetUrl=qi,exports.initializeClient=async(t,...n)=>{if(rs.isPreloaded)return void console.warn("[HallidayPayments] Already initialized");const o=++fs;if(rs.isLoading&&ls){const e=new Error("Initialization superseded by a newer call");ps?.(e)}const r=n[999]||n[0]||{};let i,s;try{i=Hi.parse(t)}catch(e){throw ns(e),e}try{s=Fi.parse(r)}catch(e){throw ns(e),e}is=i,cs=s,ss=i.onReady||null,as=i.onError||null;const a=(s.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,"");rs={...rs,isLoading:!0,startTime:Date.now(),error:null};const c=new Promise(((e,t)=>{let n=!0,r=null;const c=e=>{n&&(n=!1,r&&(clearTimeout(r),r=null),p(),rs.iframe&&rs.iframe.remove(),rs={...rs,isLoading:!1,error:null,iframe:null},d(),t(e||new Error("Initialization cancelled")))},d=()=>{ls=null,ps===c&&(ps=null)};r=setTimeout((()=>{if(!n||o!==fs)return;const e=new Error("Widget load timeout exceeded");rs={...rs,isLoading:!1,error:e},p(),as?.(e),d(),t(e)}),3e4),!n&&r&&(clearTimeout(r),r=null);const u=t=>{if(!n||o!==fs)return;if(t.origin!==a)return;if(t.source!==rs.iframe?.contentWindow)return;const{type:i}=t.data||{};"WIDGET_READY"!==i&&"HALLIDAY_READY"!==i||(r&&(clearTimeout(r),r=null),p(),rs={...rs,isPreloaded:!0,isLoading:!1,readyTime:Date.now()},ss?.(),d(),e())},l=e=>{if(!n||o!==fs)return;if(e.origin!==a)return;if(e.source!==rs.iframe?.contentWindow)return;const{type:t,payload:r}=e.data||{};t===exports.MessageType.EVENT_RESIZE&&r&&rs.iframe&&(void 0!==r.width&&(rs.iframe.style.width=r.width+"px"),void 0!==r.height&&(rs.iframe.style.height=r.height+"px"))},p=()=>{window.removeEventListener("message",u),window.removeEventListener("message",l),ds===l&&(ds=null)};window.addEventListener("message",u),window.addEventListener("message",l),ds=l;const f=document.getElementById(os);f&&f.remove();const m=document.createElement("iframe");m.id=os;let h="MODAL";try{h=Ur()?"OVERLAY":"MODAL"}catch{}const y=qi({apiKey:i.apiKey,sandbox:i.sandbox||!1,widgetVersion:"2",outputs:[],hasOwner:!1,hasTxHandler:!1,hostOrigin:"undefined"!=typeof window?window.origin:null,windowOrigin:a,appMode:h,apiBaseUrl:s.dangerouslyOverrideApiBaseUrl,ipAddress:s.dangerouslyOverrideIPAddress,featureFlags:s.dangerouslyOverrideFeatureFlags});m.src=y,m.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: -1;\n visibility: hidden;\n pointer-events: none;\n opacity: 0;\n ",m.setAttribute("aria-hidden","true"),m.setAttribute("tabindex","-1"),m.onload=()=>{n&&o===fs&&setTimeout((()=>{n&&o===fs&&rs.isLoading&&!rs.isPreloaded&&(r&&(clearTimeout(r),r=null),p(),rs={...rs,isPreloaded:!0,isLoading:!1,readyTime:Date.now()},ss?.(),d(),e())}),3e3)},m.onerror=()=>{if(!n||o!==fs)return;r&&(clearTimeout(r),r=null),p();const e=new Error("Failed to load widget");rs={...rs,isLoading:!1,error:e},as?.(e),d(),t(e)},document.body.appendChild(m),rs.iframe=m,ps=c}));return ls=c,c},exports.openHallidayPayments=async function(e,...t){try{return gs.openWidget(e,...t)}catch(e){throw ns(e),e}},exports.serializeQueryParams=Ki;
|
|
2
2
|
//# sourceMappingURL=index.cjs.min.js.map
|