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