@halliday-sdk/payments 2.8.0 → 3.0.1

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.
@@ -42,9 +42,7 @@ declare const EVMChainConfig: z.ZodObject<{
42
42
  }, z.core.$strip>;
43
43
  type EVMChainConfig = z.infer<typeof EVMChainConfig>;
44
44
 
45
- declare const TypedData: z.ZodString;
46
- type TypedData = z.infer<typeof TypedData>;
47
-
45
+ type TypedData = string;
48
46
  type SignMessage = (input: {
49
47
  message: string;
50
48
  ownerAddress?: Address;
@@ -1,2 +1,2 @@
1
- "use strict";const e="https://app.halliday.xyz",t="https://v2.prod.halliday.xyz",n=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;function o(e,t,n){function o(n,o){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:o,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,o);const r=s.prototype,i=Object.keys(r);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=r[t].bind(n))}}const r=n?.Parent??Object;class i extends r{}function s(e){var t;const r=n?.Parent?new i:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class i extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const s={};function a(e){return s}function c(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function d(e,t){return"bigint"==typeof t?t.toString():t}function u(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function l(e){return null==e}function p(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const f=Symbol("evaluating");function m(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==f)return void 0===o&&(o=f,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function y(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function g(e){return JSON.stringify(e)}const _="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const w=u((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function b(e){if(!1===v(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==v(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function E(e){return b(e)?{...e}:Array.isArray(e)?[...e]:e}const z=new Set(["string","number","symbol"]);function k(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function O(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const x={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function A(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function I(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function S(e){return"string"==typeof e?e:e?.message}function N(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=S(e.inst?._zod.def?.error?.(e))??S(t?.error?.(e))??S(n.customError?.(e))??S(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function $(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function P(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const D=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,d,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Z=o("$ZodError",D),C=o("$ZodError",D,{Parent:Error});const M=e=>(t,n,o,i)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){const t=new(i?.Err??e)(c.issues.map((e=>N(e,s,a()))));throw _(t,i?.callee),t}return c.value},R=e=>async(t,n,o,r)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(r?.Err??e)(s.issues.map((e=>N(e,i,a()))));throw _(t,r?.callee),t}return s.value},L=e=>(t,n,o)=>{const i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??Z)(s.issues.map((e=>N(e,i,a()))))}:{success:!0,data:s.value}},j=L(C),F=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map((e=>N(e,r,a()))))}:{success:!0,data:i.value}},U=F(C),B=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return M(e)(t,n,r)},V=e=>(t,n,o)=>M(e)(t,n,o),W=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return R(e)(t,n,r)},J=e=>async(t,n,o)=>R(e)(t,n,o),H=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return L(e)(t,n,r)},G=e=>(t,n,o)=>L(e)(t,n,o),Y=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return F(e)(t,n,r)},K=e=>async(t,n,o)=>F(e)(t,n,o),q=/^[cC][^\s-]{8,}$/,X=/^[0-9a-z]+$/,Q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ee=/^[0-9a-vA-V]{20}$/,te=/^[A-Za-z0-9]{27}$/,ne=/^[a-zA-Z0-9_-]{21}$/,oe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,re=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const ae=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,de=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ue=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,le=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pe=/^[A-Za-z0-9_-]*$/,fe=/^\+[1-9]\d{6,14}$/,me="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",he=new RegExp(`^${me}$`);function ye(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ge=/^-?\d+n?$/,_e=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,we=/^(?:true|false)$/i,be=/^undefined$/i,Ee=/^[^A-Z]*$/,ze=/^[^a-z]*$/,ke=o("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),Te={number:"number",bigint:"bigint",object:"date"},Oe=o("$ZodCheckLessThan",((e,t)=>{ke.init(e,t);const n=Te[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),xe=o("$ZodCheckGreaterThan",((e,t)=>{ke.init(e,t);const n=Te[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Ae=o("$ZodCheckMultipleOf",((e,t)=>{ke.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);e?.[1]&&(r=Number.parseInt(e[1]))}const i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),Ie=o("$ZodCheckNumberFormat",((e,t)=>{ke.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[r,i]=x[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i,n&&(o.pattern=_e)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}))}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}})),Se=o("$ZodCheckMaxLength",((e,t)=>{var n;ke.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const r=$(o);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}})),Ne=o("$ZodCheckMinLength",((e,t)=>{var n;ke.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const r=$(o);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}})),$e=o("$ZodCheckLengthEquals",((e,t)=>{var n;ke.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const o=n.value,r=o.length;if(r===t.length)return;const i=$(o),s=r>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),Pe=o("$ZodCheckStringFormat",((e,t)=>{var n,o;ke.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})})),De=o("$ZodCheckRegex",((e,t)=>{Pe.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),Ze=o("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=Ee),Pe.init(e,t)})),Ce=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=ze),Pe.init(e,t)})),Me=o("$ZodCheckIncludes",((e,t)=>{ke.init(e,t);const n=k(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),Re=o("$ZodCheckStartsWith",((e,t)=>{ke.init(e,t);const n=new RegExp(`^${k(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),Le=o("$ZodCheckEndsWith",((e,t)=>{ke.init(e,t);const n=new RegExp(`.*${k(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),je=o("$ZodCheckOverwrite",((e,t)=>{ke.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class Fe{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 Ue={major:4,minor:3,patch:6},Be=o("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ue;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let o,i=A(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new r;if(o||a instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(i||(i=A(e,t)))}));else{if(e.issues.length===t)continue;i||(i=A(e,t))}}return o?o.then((()=>e)):e},n=(n,i,s)=>{if(A(n))return n.aborted=!0,n;const a=t(i,o,s);if(a instanceof Promise){if(!1===s.async)throw new r;return a.then((t=>e._zod.parse(t,s)))}return e._zod.parse(a,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,i,s))):n(t,i,s)}const a=e._zod.parse(i,s);if(a instanceof Promise){if(!1===s.async)throw new r;return a.then((e=>t(e,o,s)))}return t(a,o,s)}}m(e,"~standard",(()=>({validate:t=>{try{const n=j(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return U(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1})))})),Ve=o("$ZodString",((e,t)=>{var n;Be.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),We=o("$ZodStringFormat",((e,t)=>{Pe.init(e,t),Ve.init(e,t)})),Je=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=re),We.init(e,t)})),He=o("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(e))}else t.pattern??(t.pattern=ie());We.init(e,t)})),Ge=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=se),We.init(e,t)})),Ye=o("$ZodURL",((e,t)=>{We.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=r.href:n.value=o)}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),Ke=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),We.init(e,t)})),qe=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=ne),We.init(e,t)})),Xe=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=q),We.init(e,t)})),Qe=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=X),We.init(e,t)})),et=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=Q),We.init(e,t)})),tt=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=ee),We.init(e,t)})),nt=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=te),We.init(e,t)})),ot=o("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=ye({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${me}T(?:${o})$`)}(t)),We.init(e,t)})),rt=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=he),We.init(e,t)})),it=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ye(t)}$`)),We.init(e,t)})),st=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=oe),We.init(e,t)})),at=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=ae),We.init(e,t),e._zod.bag.format="ipv4"})),ct=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=ce),We.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),dt=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=de),We.init(e,t)})),ut=o("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=ue),We.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(2!==o.length)throw new Error;const[e,t]=o;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function lt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const pt=o("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=le),We.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}));const ft=o("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=pe),We.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!pe.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return lt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),mt=o("$ZodE164",((e,t)=>{t.pattern??(t.pattern=fe),We.init(e,t)}));const ht=o("$ZodJWT",((e,t)=>{We.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),yt=o("$ZodNumber",((e,t)=>{Be.init(e,t),e._zod.pattern=e._zod.bag.pattern??ve,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const i="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}})),gt=o("$ZodNumberFormat",((e,t)=>{Ie.init(e,t),yt.init(e,t)})),_t=o("$ZodBoolean",((e,t)=>{Be.init(e,t),e._zod.pattern=we,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}})),vt=o("$ZodBigInt",((e,t)=>{Be.init(e,t),e._zod.pattern=ge,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}})),wt=o("$ZodUndefined",((e,t)=>{Be.init(e,t),e._zod.pattern=be,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const o=t.value;return void 0===o||t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}})),bt=o("$ZodAny",((e,t)=>{Be.init(e,t),e._zod.parse=e=>e})),Et=o("$ZodUnknown",((e,t)=>{Be.init(e,t),e._zod.parse=e=>e})),zt=o("$ZodNever",((e,t)=>{Be.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function kt(e,t,n){e.issues.length&&t.issues.push(...I(n,e.issues)),t.value[n]=e.value}const Tt=o("$ZodArray",((e,t)=>{Be.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const i=[];for(let e=0;e<r.length;e++){const s=r[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?i.push(a.then((t=>kt(t,n,e)))):kt(a,n,e)}return i.length?Promise.all(i).then((()=>n)):n}}));function Ot(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...I(n,e.issues))}void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function xt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=e.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function At(e,t,n,o,r,i){const s=[],a=r.keySet,c=r.catchall._zod,d=c.def.type,u="optional"===c.optout;for(const r in t){if(a.has(r))continue;if("never"===d){s.push(r);continue}const i=c.run({value:t[r],issues:[]},o);i instanceof Promise?e.push(i.then((e=>Ot(e,n,r,t,u)))):Ot(i,n,r,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then((()=>n)):n}const It=o("$ZodObject",((e,t)=>{Be.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const o=u((()=>xt(t)));m(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n}));const r=v,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=o.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],d=s.shape;for(const e of s.keys){const o=d[e],r="optional"===o._zod.optout,i=o._zod.run({value:a[e],issues:[]},n);i instanceof Promise?c.push(i.then((n=>Ot(n,t,e,a,r)))):Ot(i,t,e,a,r)}return i?At(c,a,t,n,o.value,e):c.length?Promise.all(c).then((()=>t)):t}})),St=o("$ZodObjectJIT",((e,t)=>{It.init(e,t);const n=e._zod.parse,o=u((()=>xt(t)));let r;const i=v,a=!s.jitless,c=a&&w.value,d=t.catchall;let l;e._zod.parse=(s,u)=>{l??(l=o.value);const p=s.value;return i(p)?a&&c&&!1===u?.async&&!0!==u.jitless?(r||(r=(e=>{const t=new Fe(["shape","payload","ctx"]),n=o.value,r=e=>{const t=g(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const e of n.keys)i[e]="key_"+s++;t.write("const newResult = {};");for(const o of n.keys){const n=i[o],s=g(o),a=e[o],c="optional"===a?._zod?.optout;t.write(`const ${n} = ${r(o)};`),c?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),s=r(s,u),d?At([],p,s,u,l,e):s):n(s,u):(s.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),s)}}));function Nt(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter((e=>!A(e)));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>N(e,o,a())))))}),t)}const $t=o("$ZodUnion",((e,t)=>{Be.init(e,t),m(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),m(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),m(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),m(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>p(e.source))).join("|")})$`)}}));const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then((t=>Nt(t,r,e,i))):Nt(a,r,e,i)}})),Pt=o("$ZodDiscriminatedUnion",((e,t)=>{t.inclusive=!1,$t.init(e,t);const n=e._zod.parse;m(e._zod,"propValues",(()=>{const e={};for(const n of t.options){const o=n._zod.propValues;if(!o||0===Object.keys(o).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(o)){e[t]||(e[t]=new Set);for(const o of n)e[t].add(o)}}return e}));const o=u((()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n}));e._zod.parse=(r,i)=>{const s=r.value;if(!v(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(r,i):t.unionFallback?n(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r)}})),Dt=o("$ZodIntersection",((e,t)=>{Be.init(e,t),e._zod.parse=(e,n)=>{const o=e.value,r=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then((([t,n])=>Ct(e,t,n))):Ct(e,r,i)}}));function Zt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(b(e)&&b(t)){const n=Object.keys(t),o=Object.keys(e).filter((e=>-1!==n.indexOf(e))),r={...e,...t};for(const n of o){const o=Zt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r[n]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const r=Zt(e[o],t[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ct(e,t,n){const o=new Map;let r;for(const n of t.issues)if("unrecognized_keys"===n.code){r??(r=n);for(const e of n.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(t);const i=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(i.length&&r&&e.issues.push({...r,keys:i}),A(e))return e;const s=Zt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Mt=o("$ZodRecord",((e,t)=>{Be.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!b(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const s=t.valueType._zod.run({value:r[e],issues:[]},o);s instanceof Promise?i.push(s.then((t=>{t.issues.length&&n.issues.push(...I(e,t.issues)),n.value[e]=t.value}))):(s.issues.length&&n.issues.push(...I(e,s.issues)),n.value[e]=s.value)}let c;for(const e in r)a.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(r)){if("__proto__"===s)continue;let c=t.keyType._zod.run({value:s,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&ve.test(s)&&c.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},o);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(c=e)}if(c.issues.length){"loose"===t.mode?n.value[s]=r[s]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((e=>N(e,o,a()))),input:s,path:[s],inst:e});continue}const d=t.valueType._zod.run({value:r[s],issues:[]},o);d instanceof Promise?i.push(d.then((e=>{e.issues.length&&n.issues.push(...I(s,e.issues)),n.value[c.value]=e.value}))):(d.issues.length&&n.issues.push(...I(s,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then((()=>n)):n}})),Rt=o("$ZodEnum",((e,t)=>{Be.init(e,t);const n=c(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter((e=>z.has(typeof e))).map((e=>"string"==typeof e?k(e):e.toString())).join("|")})$`),e._zod.parse=(t,r)=>{const i=t.value;return o.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),Lt=o("$ZodLiteral",((e,t)=>{if(Be.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?k(e):e?k(e.toString()):String(e))).join("|")})$`),e._zod.parse=(o,r)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}})),jt=o("$ZodTransform",((e,t)=>{Be.init(e,t),e._zod.parse=(n,o)=>{if("backward"===o.direction)throw new i(e.constructor.name);const s=t.transform(n.value,n);if(o.async){return(s instanceof Promise?s:Promise.resolve(s)).then((e=>(n.value=e,n)))}if(s instanceof Promise)throw new r;return n.value=s,n}}));function Ft(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ut=o("$ZodOptional",((e,t)=>{Be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",m(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),m(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${p(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((t=>Ft(t,e.value))):Ft(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),Bt=o("$ZodExactOptional",((e,t)=>{Ut.init(e,t),m(e._zod,"values",(()=>t.innerType._zod.values)),m(e._zod,"pattern",(()=>t.innerType._zod.pattern)),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)})),Vt=o("$ZodNullable",((e,t)=>{Be.init(e,t),m(e._zod,"optin",(()=>t.innerType._zod.optin)),m(e._zod,"optout",(()=>t.innerType._zod.optout)),m(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${p(e.source)}|null)$`):void 0})),m(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),Wt=o("$ZodDefault",((e,t)=>{Be.init(e,t),e._zod.optin="optional",m(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>Jt(e,t))):Jt(o,t)}}));function Jt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Ht=o("$ZodPrefault",((e,t)=>{Be.init(e,t),e._zod.optin="optional",m(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Gt=o("$ZodNonOptional",((e,t)=>{Be.init(e,t),m(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then((t=>Yt(t,e))):Yt(r,e)}}));function Yt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Kt=o("$ZodCatch",((e,t)=>{Be.init(e,t),m(e._zod,"optin",(()=>t.innerType._zod.optin)),m(e._zod,"optout",(()=>t.innerType._zod.optout)),m(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>N(e,n,a())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>N(e,n,a())))},input:e.value}),e.issues=[]),e)}})),qt=o("$ZodPipe",((e,t)=>{Be.init(e,t),m(e._zod,"values",(()=>t.in._zod.values)),m(e._zod,"optin",(()=>t.in._zod.optin)),m(e._zod,"optout",(()=>t.out._zod.optout)),m(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const o=t.out._zod.run(e,n);return o instanceof Promise?o.then((e=>Xt(e,t.in,n))):Xt(o,t.in,n)}const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>Xt(e,t.out,n))):Xt(o,t.out,n)}}));function Xt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Qt=o("$ZodReadonly",((e,t)=>{Be.init(e,t),m(e._zod,"propValues",(()=>t.innerType._zod.propValues)),m(e._zod,"values",(()=>t.innerType._zod.values)),m(e._zod,"optin",(()=>t.innerType?._zod?.optin)),m(e._zod,"optout",(()=>t.innerType?._zod?.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(en):en(o)}}));function en(e){return e.value=Object.freeze(e.value),e}const tn=o("$ZodCustom",((e,t)=>{ke.init(e,t),Be.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((t=>nn(t,n,o,e)));nn(r,n,o,e)}}));function nn(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push(P(e))}}var on;class rn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(on=globalThis).__zod_globalRegistry??(on.__zod_globalRegistry=new rn);const sn=globalThis.__zod_globalRegistry;function an(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function cn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function dn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function un(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function ln(e,t){return new Oe({check:"less_than",...O(t),value:e,inclusive:!1})}function pn(e,t){return new Oe({check:"less_than",...O(t),value:e,inclusive:!0})}function fn(e,t){return new xe({check:"greater_than",...O(t),value:e,inclusive:!1})}function mn(e,t){return new xe({check:"greater_than",...O(t),value:e,inclusive:!0})}function hn(e,t){return new Ae({check:"multiple_of",...O(t),value:e})}function yn(e,t){return new Se({check:"max_length",...O(t),maximum:e})}function gn(e,t){return new Ne({check:"min_length",...O(t),minimum:e})}function _n(e,t){return new $e({check:"length_equals",...O(t),length:e})}function vn(e){return new je({check:"overwrite",tx:e})}function wn(e){const t=function(e,t){const n=new ke({check:"custom",...O(t)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(P(e,n.value,t._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(P(o))}},e(n.value,n))));return t}function bn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??sn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function En(e,t,n={path:[],schemaPath:[]}){var o;const r=e._zod.def,i=t.seen.get(e);if(i){i.count++;return n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema}const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const o={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,o);else{const n=s.schema,i=t.processors[r.type];if(!i)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);i(e,t,n,o)}const i=e._zod.parent;i&&(s.ref||(s.ref=i),En(i,t,o),t.seen.get(i).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&Tn(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function zn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=o.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(n,t[0])}}const r=t=>{if(t[1].schema.$ref)return;const o=t[1],{ref:r,defId:i}=(t=>{const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,r=e.external.uri??(e=>e);if(n)return{ref:r(n)};const i=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=i,{defId:i,ref:`${r("__shared")}#/${o}/${i}`}}if(t[1]===n)return{ref:"#"};const r=`#/${o}/`,i=t[1].schema.id??"__schema"+e.counter++;return{defId:i,ref:r+i}})(t);o.def={...o.schema},i&&(o.defId=i);const s=o.schema;for(const e in s)delete s[e];s.$ref=r};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const o=n[1];if(t===n[0]){r(n);continue}if(e.external){const o=e.external.registry.get(n[0])?.id;if(t!==n[0]&&o){r(n);continue}}const i=e.metadataRegistry.get(n[0])?.id;i?r(n):(o.cycle||o.count>1&&"ref"===e.reused)&&r(n)}}function kn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=t=>{const n=e.seen.get(t);if(null===n.ref)return;const r=n.def??n.schema,i={...r},s=n.ref;if(n.ref=null,s){o(s);const n=e.seen.get(s),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(r,a):(r.allOf=r.allOf??[],r.allOf.push(a)),Object.assign(r,i);if(t._zod.parent===s)for(const e in r)"$ref"!==e&&"allOf"!==e&&(e in i||delete r[e]);if(a.$ref&&n.def)for(const e in r)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(r[e])===JSON.stringify(n.def[e])&&delete r[e]}const a=t._zod.parent;if(a&&a!==s){o(a);const t=e.seen.get(a);if(t?.schema.$ref&&(r.$ref=t.schema.$ref,t.def))for(const e in r)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(r[e])===JSON.stringify(t.def[e])&&delete r[e]}e.override({zodSchema:t,jsonSchema:r,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())o(t[0]);const r={};if("draft-2020-12"===e.target?r.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?r.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(n)}Object.assign(r,n.def??n.schema);const i=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?r.$defs=i:r.definitions=i);try{const n=JSON.parse(JSON.stringify(r));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:On(t,"input",e.processors),output:On(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Tn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return Tn(o.element,n);if("set"===o.type)return Tn(o.valueType,n);if("lazy"===o.type)return Tn(o.getter(),n);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return Tn(o.innerType,n);if("intersection"===o.type)return Tn(o.left,n)||Tn(o.right,n);if("record"===o.type||"map"===o.type)return Tn(o.keyType,n)||Tn(o.valueType,n);if("pipe"===o.type)return Tn(o.in,n)||Tn(o.out,n);if("object"===o.type){for(const e in o.shape)if(Tn(o.shape[e],n))return!0;return!1}if("union"===o.type){for(const e of o.options)if(Tn(e,n))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(Tn(e,n))return!0;return!(!o.rest||!Tn(o.rest,n))}return!1}const On=(e,t,n={})=>o=>{const{libraryOptions:r,target:i}=o??{},s=bn({...r??{},target:i,io:t,processors:n});return En(e,s),zn(s,e),kn(s,e)},xn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},An=(e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o);t.seen.get(e).ref=r.innerType},In=o("ZodISODateTime",((e,t)=>{ot.init(e,t),no.init(e,t)}));function Sn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}(In,e)}const Nn=o("ZodISODate",((e,t)=>{rt.init(e,t),no.init(e,t)}));function $n(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}(Nn,e)}const Pn=o("ZodISOTime",((e,t)=>{it.init(e,t),no.init(e,t)}));function Dn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}(Pn,e)}const Zn=o("ZodISODuration",((e,t)=>{st.init(e,t),no.init(e,t)}));function Cn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}(Zn,e)}const Mn=(e,t)=>{Z.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)n._errors.push(t(r));else{let e=n,o=0;for(;o<r.path.length;){const n=r.path[o];o===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],o++}}};return o(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,d,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,d,2)}},isEmpty:{get:()=>0===e.issues.length}})},Rn=o("ZodError",Mn),Ln=o("ZodError",Mn,{Parent:Error}),jn=M(Ln),Fn=R(Ln),Un=L(Ln),Bn=F(Ln),Vn=B(Ln),Wn=V(Ln),Jn=W(Ln),Hn=J(Ln),Gn=H(Ln),Yn=G(Ln),Kn=Y(Ln),qn=K(Ln),Xn=o("ZodType",((e,t)=>(Be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:On(e,"input"),output:On(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const o=bn({...n,processors:t});return En(e,o),zn(o,e),kn(o,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(y(t,{checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>T(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>jn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Un(e,t,n),e.parseAsync=async(t,n)=>Fn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Bn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Vn(e,t,n),e.decode=(t,n)=>Wn(e,t,n),e.encodeAsync=async(t,n)=>Jn(e,t,n),e.decodeAsync=async(t,n)=>Hn(e,t,n),e.safeEncode=(t,n)=>Gn(e,t,n),e.safeDecode=(t,n)=>Yn(e,t,n),e.safeEncodeAsync=async(t,n)=>Kn(e,t,n),e.safeDecodeAsync=async(t,n)=>qn(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}(mr,e,t)}(t,n)),e.superRefine=t=>e.check(wn(t)),e.overwrite=t=>e.check(vn(t)),e.optional=()=>or(e),e.exactOptional=()=>new rr({type:"optional",innerType:e}),e.nullable=()=>sr(e),e.nullish=()=>or(sr(e)),e.nonoptional=t=>function(e,t){return new dr({type:"nonoptional",innerType:e,...O(t)})}(e,t),e.array=()=>jo(e),e.or=t=>Vo([e,t]),e.and=t=>new Ho({type:"intersection",left:e,right:t}),e.transform=t=>pr(e,tr(t)),e.default=t=>{return n=t,new ar({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():E(n)}});var n},e.prefault=t=>{return n=t,new cr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():E(n)}});var n},e.catch=t=>{return new ur({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>pr(e,t),e.readonly=()=>new fr({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return sn.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>sn.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return sn.get(e);const n=e.clone();return sn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e))),Qn=o("_ZodString",((e,t)=>{Ve.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=n;o.type="string";const{minimum:r,maximum:i,format:s,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof i&&(o.maxLength=i),s&&(o.format=xn[s]??s,""===o.format&&delete o.format,"time"===s&&delete o.format),c&&(o.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?o.pattern=e[0].source:e.length>1&&(o.allOf=[...e.map((e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source})))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new De({check:"string_format",format:"regex",...O(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Me({check:"string_format",format:"includes",...O(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Re({check:"string_format",format:"starts_with",...O(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Le({check:"string_format",format:"ends_with",...O(t),suffix:e})}(...t)),e.min=(...t)=>e.check(gn(...t)),e.max=(...t)=>e.check(yn(...t)),e.length=(...t)=>e.check(_n(...t)),e.nonempty=(...t)=>e.check(gn(1,...t)),e.lowercase=t=>e.check(function(e){return new Ze({check:"string_format",format:"lowercase",...O(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ce({check:"string_format",format:"uppercase",...O(e)})}(t)),e.trim=()=>e.check(vn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return vn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(vn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(vn((e=>e.toUpperCase()))),e.slugify=()=>e.check(vn((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))))})),eo=o("ZodString",((e,t)=>{Ve.init(e,t),Qn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}(oo,t)),e.url=t=>e.check(cn(so,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}(zo,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}(co,t)),e.guid=t=>e.check(an(ro,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}(io,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}(io,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}(io,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}(io,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}(uo,t)),e.guid=t=>e.check(an(ro,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}(lo,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}(po,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}(fo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}(wo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}(bo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}(mo,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}(ho,t)),e.ipv4=t=>e.check(dn(yo,t)),e.ipv6=t=>e.check(un(go,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}(_o,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}(vo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}(Eo,t)),e.datetime=t=>e.check(Sn(t)),e.date=t=>e.check($n(t)),e.time=t=>e.check(Dn(t)),e.duration=t=>e.check(Cn(t))}));function to(e){return function(e,t){return new e({type:"string",...O(t)})}(eo,e)}const no=o("ZodStringFormat",((e,t)=>{We.init(e,t),Qn.init(e,t)})),oo=o("ZodEmail",((e,t)=>{Ge.init(e,t),no.init(e,t)})),ro=o("ZodGUID",((e,t)=>{Je.init(e,t),no.init(e,t)})),io=o("ZodUUID",((e,t)=>{He.init(e,t),no.init(e,t)})),so=o("ZodURL",((e,t)=>{Ye.init(e,t),no.init(e,t)}));function ao(e){return cn(so,e)}const co=o("ZodEmoji",((e,t)=>{Ke.init(e,t),no.init(e,t)})),uo=o("ZodNanoID",((e,t)=>{qe.init(e,t),no.init(e,t)})),lo=o("ZodCUID",((e,t)=>{Xe.init(e,t),no.init(e,t)})),po=o("ZodCUID2",((e,t)=>{Qe.init(e,t),no.init(e,t)})),fo=o("ZodULID",((e,t)=>{et.init(e,t),no.init(e,t)})),mo=o("ZodXID",((e,t)=>{tt.init(e,t),no.init(e,t)})),ho=o("ZodKSUID",((e,t)=>{nt.init(e,t),no.init(e,t)})),yo=o("ZodIPv4",((e,t)=>{at.init(e,t),no.init(e,t)}));const go=o("ZodIPv6",((e,t)=>{ct.init(e,t),no.init(e,t)}));const _o=o("ZodCIDRv4",((e,t)=>{dt.init(e,t),no.init(e,t)})),vo=o("ZodCIDRv6",((e,t)=>{ut.init(e,t),no.init(e,t)})),wo=o("ZodBase64",((e,t)=>{pt.init(e,t),no.init(e,t)})),bo=o("ZodBase64URL",((e,t)=>{ft.init(e,t),no.init(e,t)})),Eo=o("ZodE164",((e,t)=>{mt.init(e,t),no.init(e,t)})),zo=o("ZodJWT",((e,t)=>{ht.init(e,t),no.init(e,t)})),ko=o("ZodNumber",((e,t)=>{yt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=n,{minimum:r,maximum:i,format:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof s&&s.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==t.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof i&&(o.maximum=i,"number"==typeof c&&"draft-04"!==t.target&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof a&&(o.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(fn(t,n)),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.lt=(t,n)=>e.check(ln(t,n)),e.lte=(t,n)=>e.check(pn(t,n)),e.max=(t,n)=>e.check(pn(t,n)),e.int=t=>e.check(xo(t)),e.safe=t=>e.check(xo(t)),e.positive=t=>e.check(fn(0,t)),e.nonnegative=t=>e.check(mn(0,t)),e.negative=t=>e.check(ln(0,t)),e.nonpositive=t=>e.check(pn(0,t)),e.multipleOf=(t,n)=>e.check(hn(t,n)),e.step=(t,n)=>e.check(hn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function To(e){return function(e,t){return new e({type:"number",checks:[],...O(t)})}(ko,e)}const Oo=o("ZodNumberFormat",((e,t)=>{gt.init(e,t),ko.init(e,t)}));function xo(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}(Oo,e)}const Ao=o("ZodBoolean",((e,t)=>{_t.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)}));function Io(e){return function(e,t){return new e({type:"boolean",...O(t)})}(Ao,e)}const So=o("ZodBigInt",((e,t)=>{vt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")})(0,e),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.gt=(t,n)=>e.check(fn(t,n)),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.lt=(t,n)=>e.check(ln(t,n)),e.lte=(t,n)=>e.check(pn(t,n)),e.max=(t,n)=>e.check(pn(t,n)),e.positive=t=>e.check(fn(BigInt(0),t)),e.negative=t=>e.check(ln(BigInt(0),t)),e.nonpositive=t=>e.check(pn(BigInt(0),t)),e.nonnegative=t=>e.check(mn(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(hn(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function No(e){return function(e,t){return new e({type:"bigint",...O(t)})}(So,e)}const $o=o("ZodUndefined",((e,t)=>{wt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema")})(0,e)}));const Po=o("ZodAny",((e,t)=>{bt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Do(){return new Po({type:"any"})}const Zo=o("ZodUnknown",((e,t)=>{Et.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Co(){return new Zo({type:"unknown"})}const Mo=o("ZodNever",((e,t)=>{zt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)}));function Ro(e){return function(e,t){return new e({type:"never",...O(t)})}(Mo,e)}const Lo=o("ZodArray",((e,t)=>{Tt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(r.minItems=s),"number"==typeof a&&(r.maxItems=a),r.type="array",r.items=En(i.element,t,{...o,path:[...o.path,"items"]})})(e,t,n,o),e.element=t.element,e.min=(t,n)=>e.check(gn(t,n)),e.nonempty=t=>e.check(gn(1,t)),e.max=(t,n)=>e.check(yn(t,n)),e.length=(t,n)=>e.check(_n(t,n)),e.unwrap=()=>e.element}));function jo(e,t){return function(e,t,n){return new e({type:"array",element:t,...O(n)})}(Lo,e,t)}const Fo=o("ZodObject",((e,t)=>{St.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const e in s)r.properties[e]=En(s[e],t,{...o,path:[...o.path,"properties",e]});const a=new Set(Object.keys(s)),c=new Set([...a].filter((e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout})));c.size>0&&(r.required=Array.from(c)),"never"===i.catchall?._zod.def.type?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=En(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,n,o),m(e,"shape",(()=>t.shape)),e.keyof=()=>qo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Co()}),e.loose=()=>e.clone({...e._zod.def,catchall:Co()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ro()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!b(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=y(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return h(this,"shape",n),n}});return T(e,o)}(e,t),e.safeExtend=t=>function(e,t){if(!b(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=y(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return h(this,"shape",n),n}});return T(e,n)}(e,t),e.merge=t=>function(e,t){const n=y(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return h(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return T(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return T(e,y(e._zod.def,{get shape(){const e={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=n.shape[o])}return h(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=y(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return h(this,"shape",o),o},checks:[]});return T(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=y(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)r[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return h(this,"shape",r),r},checks:[]});return T(t,r)}(nr,e,t[0]),e.required=(...t)=>function(e,t,n){const o=y(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)r[t]=new e({type:"nonoptional",innerType:o[t]});return h(this,"shape",r),r}});return T(t,o)}(dr,e,t[0])}));function Uo(e,t){const n={type:"object",shape:e??{},...O(t)};return new Fo(n)}const Bo=o("ZodUnion",((e,t)=>{$t.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=!1===r.inclusive,s=r.options.map(((e,n)=>En(e,t,{...o,path:[...o.path,i?"oneOf":"anyOf",n]})));i?n.oneOf=s:n.anyOf=s})(e,t,n,o),e.options=t.options}));function Vo(e,t){return new Bo({type:"union",options:e,...O(t)})}const Wo=o("ZodDiscriminatedUnion",((e,t)=>{Bo.init(e,t),Pt.init(e,t)}));function Jo(e,t,n){return new Wo({type:"union",options:t,discriminator:e,...O(n)})}const Ho=o("ZodIntersection",((e,t)=>{Dt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=En(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=En(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c})(e,t,n,o)}));const Go=o("ZodRecord",((e,t)=>{Mt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def;r.type="object";const s=i.keyType,a=s._zod.bag,c=a?.patterns;if("loose"===i.mode&&c&&c.size>0){const e=En(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(const t of c)r.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(r.propertyNames=En(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=En(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=s._zod.values;if(d){const e=[...d].filter((e=>"string"==typeof e||"number"==typeof e));e.length>0&&(r.required=e)}})(e,t,n,o),e.keyType=t.keyType,e.valueType=t.valueType}));function Yo(e,t,n){return new Go({type:"record",keyType:e,valueType:t,...O(n)})}const Ko=o("ZodEnum",((e,t)=>{Rt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=c(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(n.type="number"),o.every((e=>"string"==typeof e))&&(n.type="string"),n.enum=o})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const r={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);r[o]=t.entries[o]}return new Ko({...t,checks:[],...O(o),entries:r})},e.exclude=(e,o)=>{const r={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new Ko({...t,checks:[],...O(o),entries:r})}}));function qo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Ko({type:"enum",entries:n,...O(t)})}const Xo=o("ZodLiteral",((e,t)=>{Lt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=e._zod.def,r=[];for(const e of o.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");r.push(Number(e))}else r.push(e);if(0===r.length);else if(1===r.length){const e=r[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else r.every((e=>"number"==typeof e))&&(n.type="number"),r.every((e=>"string"==typeof e))&&(n.type="string"),r.every((e=>"boolean"==typeof e))&&(n.type="boolean"),r.every((e=>null===e))&&(n.type="null"),n.enum=r})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));function Qo(e,t){return new Xo({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const er=o("ZodTransform",((e,t)=>{jt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,o)=>{if("backward"===o.direction)throw new i(e.constructor.name);n.addIssue=o=>{if("string"==typeof o)n.issues.push(P(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(P(t))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then((e=>(n.value=e,n))):(n.value=r,n)}}));function tr(e){return new er({type:"transform",transform:e})}const nr=o("ZodOptional",((e,t)=>{Ut.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>An(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));function or(e){return new nr({type:"optional",innerType:e})}const rr=o("ZodExactOptional",((e,t)=>{Bt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>An(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));const ir=o("ZodNullable",((e,t)=>{Vt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=En(r.innerType,t,o),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));function sr(e){return new ir({type:"nullable",innerType:e})}const ar=o("ZodDefault",((e,t)=>{Wt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const cr=o("ZodPrefault",((e,t)=>{Ht.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));const dr=o("ZodNonOptional",((e,t)=>{Gt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType})(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));const ur=o("ZodCatch",((e,t)=>{Kt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;let i;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const lr=o("ZodPipe",((e,t)=>{qt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i="input"===t.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;En(i,t,o),t.seen.get(e).ref=i})(e,t,0,o),e.in=t.in,e.out=t.out}));function pr(e,t){return new lr({type:"pipe",in:e,out:t})}const fr=o("ZodReadonly",((e,t)=>{Qt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,n.readOnly=!0})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));const mr=o("ZodCustom",((e,t)=>{tn.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));const hr=to().regex(/^0x[a-fA-F0-9]*$/,{message:"Must be a hex string beginning with 0x"}).transform((e=>e)),yr=to().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a 40-character hex string beginning with 0x"}).transform((e=>e.toLowerCase())),gr=to(),_r=to();Uo({EVM:yr,SOL:gr}).keyof();const vr=to().regex(/^(\d+|\d*\.\d+)$/);No().min(0n),No().min(0n);const wr=to().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),br=Uo({issuer:to(),name:to(),alias:to().optional(),symbol:to(),decimals:To()}),Er=to(),zr=to().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),kr=To().min(0).max(18),Tr=to().url(),Or=to(),xr=Uo({chain:to(),address:hr}),Ar=Uo({chain:Qo("solana"),address:gr}),Ir=Uo({chain:to(),address:to()}),Sr=Vo([xr,Ar,Ir]),Nr=to().refine((e=>{const[t,n]=e.split(":");return Sr.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),$r=Uo({name:Er,symbol:zr,decimals:kr,alias:zr.optional(),image_url:Tr.optional(),coingecko_id:Or.optional(),wrapper:zr.optional(),is_native:Io().optional()}),Pr=Vo([xr.extend($r.shape),Ar.extend($r.shape),Ir.extend($r.shape)]),Dr=Vo([Nr,wr]);Vo([Pr,br]),Jo("type",[Uo({type:Qo("chain"),chain:to()}),Uo({type:Qo("issuer"),issuer:to()})]);const Zr=to().transform((e=>e.toLowerCase()));var Cr,Mr;Cr=e=>"string"==typeof e?e.toUpperCase():e,Mr=qo(["ONRAMP","OFFRAMP"]),pr(tr(Cr),Mr),Uo({to:yr,from:yr.optional(),nonce:To().optional(),gasLimit:No().optional(),gasPrice:No().optional(),maxPriorityFeePerGas:No().optional(),maxFeePerGas:No().optional(),data:to().optional(),value:No().optional(),chainId:To()}),Uo({transactionHash:to().optional(),blockHash:to().optional(),blockNumber:To().optional(),from:yr.optional(),to:yr.optional(),rawReceipt:Do()});const Rr=Uo({chain_id:No(),network:to(),address_family:function(e,t){return new e({type:"undefined",...O(t)})}($o,Lr),explorer:ao().optional(),image:ao().optional(),is_testnet:Io()});var Lr;Jo("address_family",[Rr.extend({address_family:Qo("EVM"),native_currency:Uo({name:to(),symbol:to(),decimals:To()}),rpc:to().optional()}),Rr.extend({address_family:Qo("SOL")}),Rr]);const jr=qo(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),Fr=()=>{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)},Ur=to().refine((e=>n.test(e)),{message:"Invalid payment ID"}),Br=qo(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]),Vr=Uo({onramps:jo(Zr).optional(),offramps:jo(Zr).optional(),sandbox:Io().optional().default(!1),features:jo(Br).optional()}),Wr=Vr.extend({inputs:jo(Dr).optional(),outputs:jo(Dr)});Vo([Wr,Vr.extend({inputs:jo(Dr),outputs:jo(Dr).optional()})]);const Jr=Uo({asset:Dr,amount:vr}),Hr=Uo({token:Nr,amount:vr}),Gr=to(),Yr=Vo([function(e){return dn(yo,e)}(),function(e){return un(go,e)}()]),Kr=Uo({price_currency:wr,onramps:jo(Zr).optional(),onramp_methods:jo(jr).optional(),customer_ip_address:to().optional(),customer_id:to().optional(),label:to().optional(),parent_payment_id:Ur.optional(),features:jo(Br).optional(),rev_share_name:to().optional(),allow_unsafe_transfer_out:Io().optional(),show_all_issues:Io().optional(),allow_exceed_max_input_limit:Io().optional(),allow_unsafe_slippage:Io().optional()}),qr=Uo({"#":to()}),Xr=Uo({type:Qo("CallImmediateAction"),target:to(),value:qr,calldata:to()}),Qr=Uo({actions:jo(Xr),user_estimated_gas:qr}),ei=Jo("kind",[Uo({kind:Qo("FIXED_INPUT"),fixed_input_amount:Jr,output_asset:Dr,custom_actions:Qr.optional(),dest_address:to().optional()})]),ti=Kr.extend({request:ei}),ni=qo(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),oi=Uo({asset:Dr,property:qo(["APPROVAL","BALANCE"])}),ri=Uo({account:ni,resource:oi}),ii=Vo([Qo("COMPLETE"),Qo("UNREACHABLE"),Qo("FAILED")]),si=Vo([ii,Qo("PENDING")]),ai=qo(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),ci=Uo({consume:jo(ri),produce:jo(ri)}),di=ri.extend({amount:vr}),ui=ci.extend({consume:jo(di),produce:jo(di)}),li=Yo(Dr,to()),pi=Jo("kind",[Uo({kind:Vo([Qo("amount"),Qo("amount-downstream")]),given:to(),limits:Uo({min:to().optional(),max:to().optional()}),source:to(),message:to()}),Uo({kind:Qo("geolocation"),message:to()}),Uo({kind:Qo("provider"),message:to()}),Uo({kind:Qo("other"),message:to()}),Uo({kind:Qo("unknown"),message:to()})]),fi=Uo({service_ids:jo(to()),latency_seconds:To(),issues:jo(pi).optional()}),mi=Uo({type:Vo([Qo("USER_FUND"),Qo("ONCHAIN_STEP"),Qo("ONRAMP")]),net_effect:ui,pieces_info:jo(Uo({type:Vo([Qo("onramp"),Qo("poll"),Qo("bridge"),Qo("rev_share"),Qo("transfer_out"),Qo("convert")])})),step_index:To().optional()}),hi=Uo({payment_id:to(),output_amount:Uo({asset:Dr,amount:to()}),onramp:Zr.optional(),onramp_method:jr.optional(),fees:Uo({total_fees:to(),conversion_fees:to(),network_fees:to(),business_fees:to(),currency_symbol:wr}),route:jo(mi)}),yi=mi.extend({status:si,transaction_hash:to().optional()}),gi=hi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:jo(yi)});Uo({quote_request:ti,quotes:jo(hi),current_prices:li,price_currency:wr,state_token:to(),quoted_at:to(),accept_by:to(),failures:jo(fi)}),Uo({payment_id:Ur,state_token:to(),owner_chain:to().optional(),owner_address:_r,destination_address:_r,client_redirect_url:to().optional(),allow_unsafe_owner:Io().optional()});const _i=Uo({deposit_token:Nr,deposit_chain:to(),deposit_amount:vr,deposit_address:_r}),vi=Uo({type:qo(["ONRAMP","TRANSFER_IN"]),payment_id:Ur,funding_page_url:ao(),deposit_info:jo(_i)}),wi=Uo({payment_id:Ur,org_id:to(),status:ai,funded:Io(),created_at:to(),updated_at:to(),initiate_fund_by:to(),completed_at:to().optional(),quote_request:ti,quoted:hi.omit({payment_id:!0}),fulfilled:gi,current_prices:li,price_currency:wr,customer_id:to().optional(),label:to().optional(),processing_addresses:jo(Uo({address:_r,chain:to()})),owner_chain:to(),owner_address:_r,destination_address:_r,next_instruction:vi.optional(),parent_payment_id:Ur.optional(),client_redirect_url:to().nullable()});Uo({payment_id:Ur,redirect_url:to(),referrer_domain:to().optional()}),Uo({funding_page_onramp_url:to(),client_redirect_url:to().optional(),client_secret:to().optional()}),Uo({id_query:to().optional(),pagination_key:to().optional(),dest_address:_r.optional(),owner_address:_r.optional(),limit:To().int().positive().optional(),category:qo(["ALL","NEW_OR_FUNDED"]).optional(),label:to().optional()}),Uo({payment_statuses:jo(wi),next_pagination_key:to().nullable()}),Uo({payment_id:Ur.optional(),custom_queries:jo(Uo({address:_r,token:Vo([Nr,Sr])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),Uo({balance_results:jo(Uo({address:_r,token:Nr,value:Jo("kind",[Uo({kind:Qo("amount"),amount:vr}),Uo({kind:Qo("error")})])}))}),Uo({fiat:wr,tokens:jo(Nr)});const bi=to(),Ei=Uo({payment_id:Ur,token_amounts:jo(Hr),recipient_address:_r});Uo({payment_id:Ur,withdraw_authorization:bi}),Ei.extend({owner_signature:Gr}),Uo({payment_id:Ur,transaction_hash:to()});const zi=qo(["EMBED","POPUP","MODAL"]),ki=qo(["DEFAULT","ALL_UPPERCASE"]),Ti=qo(["AUTO","MEDIUM"]),Oi=qo(["ATTACHED","BUTTON"]),xi=qo(["SQUARE","DEFAULT"]),Ai=qo(["BLUR","OFF"]),Ii=to().refine((e=>/^(#[0-9A-Fa-f]{3,8}|rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\)|rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3}(\s*,\s*(0(\.\d+)?|1(\.0+)?))\))$/.test(e)),{message:"Invalid CSS color value"}),Si=to().refine((e=>/^\d*\.?\d+px$/.test(e)),{message:"Invalid CSS font size value. Expected a number followed by px (e.g. '16px')."}),Ni=to().refine((e=>/^\d*\.?\d+(px|rem)$/.test(e)),{message:"Invalid CSS border radius value. Expected a number followed by px or rem (e.g. '8px', '0.5rem')."}),$i=Uo({src:ao(),alt:to(),width:To().positive(),height:To().positive()}),Pi=Uo({primaryColor:Ii.optional(),backgroundColor:Ii.optional(),borderColor:Ii.optional(),textColor:Ii.optional(),textSecondaryColor:Ii.optional(),accentColor:Ii.optional(),componentShadow:to().optional(),borderStyle:xi.optional(),textMode:ki.optional(),paymentCategoryGrouping:Oi.optional(),fontWeight:Ti.optional(),baseFontSize:Si.optional(),baseBorderRadius:Ni.optional(),backgroundStyle:Ai.optional(),logo:$i.optional()}),Di=Do(),Zi=jo(qo(["wallet","open-wallet","exchange","open-exchange","cash","open-cash","deposit"])),Ci=qo(["haffer","wudoo-mono","inter"]),Mi=to().optional(),Ri=Uo({address:_r,signMessage:Do().refine((e=>"function"==typeof e)).optional(),sendTransaction:Do().refine((e=>"function"==typeof e)).optional(),signTypedData:Do().refine((e=>"function"==typeof e)).optional()}),Li=Uo({redirectUrl:ao(),ctaText:to(),secondaryRedirectUrl:ao().optional(),secondaryCtaText:to().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),ji=Uo({apiKey:to().nonempty(),destinationAddress:_r.optional(),widgetVersion:qo(["1","2"]).optional(),...Wr.shape,customStyles:Pi.optional(),targetElementId:to().optional(),windowType:zi.optional(),redirects:Li.optional(),statusCallback:Do().refine((e=>"function"==typeof e)).optional(),owner:Ri.optional(),funder:Ri.optional(),features:jo(Br).optional(),paymentCategoryOrder:Zi.optional(),fontName:Ci.optional(),headerTitle:Mi.optional(),onramps:jo(to()).optional(),showSkeleton:Io().optional(),skeletonBackgroundColor:to().optional()}),Fi=ji.refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),Ui=ji.omit({owner:!0,funder:!0,statusCallback:!0}),Bi=to().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),Vi=Yo(to(),Io()),Wi=Uo({dangerouslyOverrideHallidayDomainName:ao().optional(),dangerouslyOverrideApiBaseUrl:Bi.optional(),dangerouslyOverrideIPAddress:Yr.optional(),dangerouslyOverrideFeatureFlags:Vi.optional()}),Ji=qo(["FULL","MODAL","OVERLAY","EMBED"]),Hi=Uo({appMode:Ji.optional(),apiBaseUrl:Bi.optional(),hasOwner:Io(),hasTxHandler:Io(),hostOrigin:ao().nullable(),ipAddress:Yr.optional(),featureFlags:Vi.optional()}),Gi=Uo({...Ui.shape,...Hi.shape,ownerAddress:_r.optional(),funderAddress:_r.optional()});var Yi;exports.MessageType=void 0,(Yi=exports.MessageType||(exports.MessageType={})).ACTION_TRANSACTION="ACTION_TRANSACTION",Yi.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",Yi.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",Yi.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",Yi.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",Yi.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA",Yi.EVENT_RESIZE="EVENT_RESIZE";const Ki=Uo({apiKey:to().nonempty(),sandbox:Io().optional(),onReady:Do().refine((e=>"function"==typeof e||void 0===e)).optional(),onError:Do().refine((e=>"function"==typeof e||void 0===e)).optional()}),qi=e=>{if(e)return e.includes("deposit")?e:["deposit",...e]},Xi=()=>{const e=document.getElementById("halliday-payments-skeleton");e&&(e.style.opacity="0",setTimeout((()=>e.remove()),300))},Qi=e=>{const t=Gi.parse(e);return btoa(JSON.stringify(t))},es=t=>{const{windowOrigin:n=e,...o}=t,r=Qi(o),i=o.widgetVersion;if(i)try{return`${n}/v${parseInt(i)}/payments/quote?data=${r}`}catch(e){console.error("Error parsing widget version",e)}return`${n}/payments/quote?data=${r}`},ts=e=>{const t=window.innerWidth/2-240,{windowType:n="POPUP",targetElementId:o,windowOrigin:r}=e,i=es(e);let s;if("EMBED"===n){const e=document.getElementById(o);if(!e)throw new Error(`Element with id ${o} not found`);let t=document.getElementById("halliday-payments-embed");if((t?t.src:null)===i)t.style.display="block";else{let n=document.getElementById("halliday-payments-wrapper");n||(e.innerHTML="",e.style&&(e.style.position="relative"),n=document.createElement("div"),n.id="halliday-payments-wrapper",n.style.cssText="\n position: relative;\n width: 480px;\n max-width: 100%;\n display: block;\n ",e.appendChild(n)),t=document.createElement("iframe"),t.id="halliday-payments-embed",t.src=i,t.style.cssText="\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: none;\n display: block;\n ",t.setAttribute("scrolling","no"),n.appendChild(t)}s=t.contentWindow;const n=e=>{const{type:t,payload:o}=e.data||{},i=e.source===s,a=e.origin===r;if(i&&(a||t===exports.MessageType.EVENT_RESIZE))if(t===exports.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",n);const e=document.getElementById("halliday-payments-embed");e&&(e.style.display="none")}else if(t===exports.MessageType.EVENT_RESIZE){const e=document.getElementById("halliday-payments-skeleton"),t=document.getElementById("halliday-payments-wrapper");void 0!==o?.height&&(e&&(e.style.height=o.height+"px"),t&&(t.style.minHeight=o.height+"px"))}else"WIDGET_READY"!==t&&"HALLIDAY_READY"!==t||Xi()};window.addEventListener("message",n)}else if("MODAL"===n){let e=document.getElementById("halliday-payments-modal");(e?e.src:null)===i?e.style.display="block":(e&&e.remove(),e=document.createElement("iframe"),e.id="halliday-payments-modal",e.src=i,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100dvw",e.style.height="100dvh",e.style.border="none",e.style.zIndex="1000",e.setAttribute("scrolling","no"),document.body.appendChild(e));const t=e=>{if(e.origin!==r||e.source!==s)return;const{type:n}=e.data||{};if(n===exports.MessageType.EVENT_WINDOW_CLOSE){window.removeEventListener("message",t);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",t),s=e.contentWindow}else s=window.open(i,"Halliday Payments",`popup left=${t} top=70 width=480 height=638`);return s},ns=e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)},os=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let r=1;r<=3;r++)try{const o=await fetch(`${t}/quotes/status?workflow_id=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){if(o=e instanceof Error?e:new Error(String(e)),3===r)throw o;const t=1e3*Math.pow(2,r);await new Promise((e=>setTimeout(e,t)))}throw o},rs=async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await os({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const r=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),i=r?.status;if("COMPLETE"===i)break;await new Promise((e=>setTimeout(e,5e3)))}},is=e=>{e instanceof Rn?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},ss="halliday-payments-preload";let as={isPreloaded:!1,isLoading:!1,iframe:null,error:null,startTime:null,readyTime:null},cs=null,ds=null,us=null,ls=null,ps=null,fs=null,ms=null,hs=null,ys=0;const gs=()=>as.isPreloaded&&!as.error,_s=()=>{const e=as.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"))},vs=e=>{const{windowOrigin:t,widgetWindow:n,providerWindowRef:o,cleanMessageHandlers:r,hasOwner:i,hasTxHandler:s,signMessage:a,signTypedData:c,sendTransaction:d,statusCallback:u,apiKey:l,apiBaseUrl:p}=e,f=[];return f.push((e=>{if(e.origin!==t||e.source!==n)return;const{type:o}=e.data||{};o===exports.MessageType.EVENT_WINDOW_CLOSE&&r()})),i&&f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:r}=e.data||{};if(o===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:i,ownerAddress:s}=r;try{const r="function"==typeof a?await a({message:i,...void 0!==s&&{ownerAddress:s}}):(()=>{throw new Error("No signMessage function provided")})();n.postMessage({type:o,payload:{messageId:e,signature:r}},t)}catch(r){n.postMessage({type:o,payload:{messageId:e,error:r instanceof Error?r.message:r}},t)}}else if(o===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:i,ownerAddress:s}=r;try{const r="function"==typeof c?await c({typedData:i,...void 0!==s&&{ownerAddress:s}}):(()=>{throw new Error("No signTypedData function provided")})();n.postMessage({type:o,payload:{messageId:e,signature:r}},t)}catch(r){n.postMessage({type:o,payload:{messageId:e,error:r instanceof Error?r.message:r}},t)}}})),s&&f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:r}=e.data||{};if(o===exports.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:i,transaction:s}=r;try{const r="function"==typeof d?await d(s,i):(()=>{throw new Error("No sendTransaction function provided")})();n.postMessage({type:o,payload:{messageId:e,txReceipt:r}},t)}catch(r){n.postMessage({type:o,payload:{messageId:e,error:r instanceof Error?r.message:r}},t)}}})),u&&f.push((e=>{if(e.origin!==t||e.source!==n)return;const{type:o,payload:r}=e.data||{};o===exports.MessageType.EVENT_ORDER_STATUS&&u({type:o,payload:r})})),f.push((async e=>{if(e.origin!==t||e.source!==n)return;const{type:r,payload:i}=e.data||{};if(r===exports.MessageType.ACTION_PROVIDER_WIDGET){const{url:e,redirectUrl:t,providerWidgetMode:r,workflowId:s}=i||{};if(!(e&&t&&r&&s))return;let a=null;"REDIRECT"===r?(n.location=e,a=n):"POPUP"===r&&(o.current=ns(e),a=o.current),a&&(await rs({apiKey:l,baseURL:p,workflowId:s,window:a}),a.closed||("REDIRECT"===r?n.location=t:"POPUP"===r&&(o.current?.close(),o.current=null)))}})),f},ws=(()=>{let n=null,o=null;const r={get current(){return o},set current(e){o=e}};let i=[];const s=()=>{i.forEach((e=>{window.removeEventListener("message",e)})),i=[]},a=e=>{e.forEach((e=>{window.addEventListener("message",e)})),i=e},c=async(i,...d)=>{const u=d[999]||d[0]||{},l=async()=>{let r,c;try{r=Fi.parse(i)}catch(e){throw is(e),e}try{c=Wi.parse(u)}catch(e){throw is(e),e}const{dangerouslyOverrideHallidayDomainName:d,dangerouslyOverrideApiBaseUrl:l,dangerouslyOverrideIPAddress:p,dangerouslyOverrideFeatureFlags:f}=c,{owner:m,statusCallback:h,funder:y,windowType:g}=r,_=(d||e).replace(/\/$/,""),v=m?.signMessage,w=m?.signTypedData,b=y?.sendTransaction||m?.sendTransaction,E=m?.address,z=y?.address,k=_r.safeParse(E).success&&"function"==typeof w,T=_r.safeParse(z).success&&"function"==typeof b;let O=null,x="FULL";try{O=window.origin,"MODAL"===g?x=Fr()?"OVERLAY":"MODAL":"EMBED"===g&&(x="EMBED")}catch(e){}s();const A=[e=>{if(e.origin!==_||e.source!==n)return;const{type:t}=e.data||{};t===exports.MessageType.EVENT_WINDOW_CLOSE&&s()}];if(k){const e=async e=>{if(e.origin!==_||e.source!==n)return;const{type:t,payload:o}=e.data||{};if(t===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:r,ownerAddress:i}=o;try{let o;if("function"!=typeof v)throw new Error("No signMessage function provided");o=await v({message:r,...void 0!==i&&{ownerAddress:i}}),n?.postMessage({type:t,payload:{messageId:e,signature:o}},_)}catch(o){console.error("Error signing message",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},_)}}else if(t===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:r,ownerAddress:i}=o;try{let o;if("function"!=typeof w)throw new Error("No signTypedData function provided");o=await w({typedData:r,...void 0!==i&&{ownerAddress:i}}),n?.postMessage({type:t,payload:{messageId:e,signature:o}},_)}catch(o){console.error("Error signing typed data",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},_)}}};A.push(e)}if(T){const e=async e=>{if(e.origin!==_||e.source!==n)return;const{type:t,payload:o}=e.data||{};if(t===exports.MessageType.ACTION_TRANSACTION){const{messageId:e,chainConfig:r,transaction:i}=o;try{let o;if("function"!=typeof b)throw new Error("No sendTransaction function provided");o=await b(i,r),n?.postMessage({type:t,payload:{messageId:e,txReceipt:o}},_)}catch(o){console.error("Error handling transaction",o),n?.postMessage({type:t,payload:{messageId:e,error:o instanceof Error?o.message:o}},_)}}};A.push(e)}if(h){const e=e=>{if(e.origin!==_||e.source!==n)return;const{type:t,payload:o}=e.data||{};t===exports.MessageType.EVENT_ORDER_STATUS&&h({type:t,payload:o})};A.push(e)}A.push((async e=>{if(e.origin!==_||e.source!==n)return;const{type:i,payload:s}=e.data||{};if(i===exports.MessageType.ACTION_PROVIDER_WIDGET&&n){const{url:e,redirectUrl:i,providerWidgetMode:a,workflowId:c}=s||{};if(!(e&&i&&a&&c))throw new Error("Invalid provider widget payload");let d=null;if("REDIRECT"===a)n.location=e,d=n;else{if("POPUP"!==a)throw new Error("Invalid provider widget mode");o=ns(e),d=o}if(await rs({apiKey:r.apiKey,baseURL:l||t,workflowId:c,window:d}),d?.closed)return;"REDIRECT"===a?n.location=i:"POPUP"===a&&(o?.close(),o=null)}}));const I={...r,sandbox:r.sandbox||!1,hasOwner:k,hasTxHandler:T,windowOrigin:_,apiBaseUrl:l,hostOrigin:O,ownerAddress:E,funderAddress:z,ipAddress:p,featureFlags:f,appMode:x,fontName:r.fontName,paymentCategoryOrder:qi(r.paymentCategoryOrder),headerTitle:r.headerTitle,onramps:r.onramps};n=ts(I),a(A)},p=i.windowType,f=i.targetElementId,m=i.showSkeleton??!0,h=i.skeletonBackgroundColor??i.customStyles?.backgroundColor;if("EMBED"===p&&f&&m){const e=document.getElementById(f);e&&(gs()||((e,t)=>{const n=document.getElementById("halliday-payments-skeleton");n&&n.remove(),e.style&&(e.style.position="relative");let o=document.getElementById("halliday-payments-wrapper");o||(o=document.createElement("div"),o.id="halliday-payments-wrapper",o.style.cssText="\n position: relative;\n width: 480px;\n max-width: 100%;\n display: block;\n ",e.appendChild(o));const r=t||"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",i=document.createElement("div");if(i.id="halliday-payments-skeleton",i.style.cssText=`\n width: 100%;\n height: 400px;\n background: ${r};\n background-size: 200% 100%;\n animation: halliday-skeleton-pulse 1.5s ease-in-out infinite;\n border-radius: 12px;\n position: relative;\n z-index: 1;\n transition: opacity 0.3s ease-out;\n `,!document.getElementById("halliday-skeleton-styles")&&document.head)try{const e=document.createElement("style");e.id="halliday-skeleton-styles",e.textContent="\n @keyframes halliday-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n ",document.head.appendChild(e)}catch{}o.appendChild(i)})(e,h))}if(gs()){const o=cs,c=ls,d=(c?.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,""),{owner:l,funder:p,statusCallback:f}=i,m=l?.signMessage,h=l?.signTypedData,y=p?.sendTransaction||l?.sendTransaction,g=l?.address,_=p?.address,v=_r.safeParse(g).success&&"function"==typeof h,w=_r.safeParse(_).success&&"function"==typeof y,b=i.windowType||"MODAL",E=i.targetElementId;let z=null,k="FULL";try{z=window.origin,"MODAL"===b?k=Fr()?"OVERLAY":"MODAL":"EMBED"===b&&(k="EMBED")}catch{}const T={apiKey:i.apiKey||o?.apiKey||"",sandbox:i.sandbox??o?.sandbox??!1,widgetVersion:i.widgetVersion,destinationAddress:i.destinationAddress,onramps:i.onramps,outputs:i.outputs??[],inputs:i.inputs,customStyles:i.customStyles,redirects:i.redirects,features:i.features,paymentCategoryOrder:qi(i.paymentCategoryOrder),fontName:i.fontName,headerTitle:i.headerTitle,windowType:b,targetElementId:E,hasOwner:v,hasTxHandler:w,ownerAddress:g,funderAddress:_,hostOrigin:z,appMode:k,windowOrigin:d,apiBaseUrl:u?.dangerouslyOverrideApiBaseUrl??c?.dangerouslyOverrideApiBaseUrl,ipAddress:u?.dangerouslyOverrideIPAddress??c?.dangerouslyOverrideIPAddress,featureFlags:u?.dangerouslyOverrideFeatureFlags??c?.dangerouslyOverrideFeatureFlags};if(n=(t=>{const n=as.iframe;if(!n||!as.isPreloaded||!cs)return null;const o=(ls?.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,""),r=t?.windowType||"MODAL",i=t?.targetElementId;if("POPUP"===r)return null;let s="MODAL";try{"MODAL"===r?s=Fr()?"OVERLAY":"MODAL":"EMBED"===r&&(s="EMBED")}catch{}if(t){const{windowType:e,...r}=t;n.contentWindow?.postMessage({type:"HALLIDAY_UPDATE_PARAMS",payload:{...r,appMode:s}},o)}if("EMBED"===r){if(!i)return console.error("[HallidayPayments] EMBED mode requires targetElementId in openHallidayPayments"),null;const e=document.getElementById(i);if(!e)return console.error(`[HallidayPayments] Target element '${i}' not found`),null;let t=document.getElementById("halliday-payments-wrapper")||document.getElementById("halliday-payments-placeholder");t||(t=document.createElement("div"),t.id="halliday-payments-placeholder",t.style.cssText=`\n width: 480px;\n max-width: 100%;\n height: ${fs||400}px;\n `,e.appendChild(t));const r=()=>{const e=t.getBoundingClientRect();n.style.position="fixed",n.style.top=e.top+"px",n.style.left=e.left+"px",n.style.width=e.width+"px",n.style.height=e.height+"px",n.style.border="none",n.style.zIndex="1"};t.offsetHeight,requestAnimationFrame((()=>{requestAnimationFrame((()=>{r(),n.style.visibility="visible",n.style.opacity="1",n.style.pointerEvents="auto"}))}));const s=new ResizeObserver((()=>{r()}));s.observe(t);const a=()=>r();window.addEventListener("scroll",a,!0);const c=()=>r();window.addEventListener("resize",c),n._embedCleanup=()=>{s.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",c),t?.remove()};const d=e=>{if(e.origin!==o)return;if(e.source!==n.contentWindow)return;const{type:i,payload:s}=e.data||{};i===exports.MessageType.EVENT_RESIZE&&s&&void 0!==s.height&&t&&(fs=s.height,t.style.height=s.height+"px",r())};if(window.addEventListener("message",d),n.removeAttribute("aria-hidden"),n.removeAttribute("tabindex"),as.isPreloaded)Xi();else{const e=t=>{if(t.origin!==o)return;if(t.source!==n.contentWindow)return;const{type:r}=t.data||{};"WIDGET_READY"!==r&&"HALLIDAY_READY"!==r||(window.removeEventListener("message",e),Xi())};window.addEventListener("message",e)}}else n.id="halliday-payments-modal",n.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: 10000;\n ",n.removeAttribute("aria-hidden"),n.removeAttribute("tabindex"),n.setAttribute("scrolling","no"),n.parentElement!==document.body&&document.body.appendChild(n);setTimeout((()=>{n.contentWindow?.postMessage({type:"HALLIDAY_SHOW"},o)}),10);const a=e=>{if(e.origin!==o)return;if(e.source!==n.contentWindow)return;const{type:t}=e.data||{};t===exports.MessageType.EVENT_WINDOW_CLOSE&&(window.removeEventListener("message",a),_s())};return window.addEventListener("message",a),n.contentWindow})(T),n){s();const e=vs({windowOrigin:d,widgetWindow:n,providerWindowRef:r,cleanMessageHandlers:s,hasOwner:v,hasTxHandler:w,...void 0!==m&&{signMessage:m},...void 0!==h&&{signTypedData:h},...void 0!==y&&{sendTransaction:y},...void 0!==f&&{statusCallback:f},apiKey:o?.apiKey||i.apiKey,apiBaseUrl:c?.dangerouslyOverrideApiBaseUrl||t});return void a(e)}if("POPUP"===b&&(n=ts({...T,windowOrigin:d}),n)){s();const e=vs({windowOrigin:d,widgetWindow:n,providerWindowRef:r,cleanMessageHandlers:s,hasOwner:v,hasTxHandler:w,...void 0!==m&&{signMessage:m},...void 0!==h&&{signTypedData:h},...void 0!==y&&{sendTransaction:y},...void 0!==f&&{statusCallback:f},apiKey:o?.apiKey||i.apiKey,apiBaseUrl:c?.dangerouslyOverrideApiBaseUrl||t});return void a(e)}}return null===cs||gs()?l():new Promise((e=>{const t=Date.now(),n=()=>{gs()?c(i,...d).then(e):Date.now()-t>=3e4?l().then(e):setTimeout(n,100)};n()}))};return{openWidget:c}})();exports.AppMode=Ji,exports.BackgroundStyle=Ai,exports.BorderStyle=xi,exports.CssFontSize=Si,exports.CustomStyles=Pi,exports.FontName=Ci,exports.HeaderTitle=Mi,exports.InitConfig=Ki,exports.OrderStatus=Di,exports.PaymentCategoryOrder=Zi,exports.PaymentsWidgetQueryParams=Gi,exports.PaymentsWidgetSDKParams=Fi,exports.deserializeQueryParams=e=>Gi.parse(JSON.parse(atob(e))),exports.destroyClient=()=>{ps&&(window.removeEventListener("message",ps),ps=null);const e=as.iframe;e&&e._embedCleanup&&e._embedCleanup();const t=document.getElementById(ss);t&&t.remove();const n=document.getElementById("halliday-payments-placeholder");n&&n.remove();const o=document.getElementById("halliday-payments-modal");o&&o.remove();const r=document.getElementById("halliday-payments-skeleton");r&&r.remove(),as={isPreloaded:!1,isLoading:!1,iframe:null,error:null,startTime:null,readyTime:null},cs=null,ls=null,ds=null,us=null,fs=null,ms=null,hs=null},exports.getPaymentsWidgetUrl=es,exports.initializeClient=async(t,...n)=>{if(as.isPreloaded)return void console.warn("[HallidayPayments] Already initialized");const o=++ys;if(as.isLoading&&ms){const e=new Error("Initialization superseded by a newer call");hs?.(e)}const r=n[999]||n[0]||{};let i,s;try{i=Ki.parse(t)}catch(e){throw is(e),e}try{s=Wi.parse(r)}catch(e){throw is(e),e}cs=i,ls=s,ds=i.onReady||null,us=i.onError||null;const a=(s.dangerouslyOverrideHallidayDomainName||e).replace(/\/$/,"");as={...as,isLoading:!0,startTime:Date.now(),error:null};const c=new Promise(((e,t)=>{let n=!0,r=null;const c=e=>{n&&(n=!1,r&&(clearTimeout(r),r=null),p(),as.iframe&&as.iframe.remove(),as={...as,isLoading:!1,error:null,iframe:null},d(),t(e||new Error("Initialization cancelled")))},d=()=>{ms=null,hs===c&&(hs=null)};r=setTimeout((()=>{if(!n||o!==ys)return;const e=new Error("Widget load timeout exceeded");as={...as,isLoading:!1,error:e},p(),us?.(e),d(),t(e)}),3e4),!n&&r&&(clearTimeout(r),r=null);const u=t=>{if(!n||o!==ys)return;if(t.origin!==a)return;if(t.source!==as.iframe?.contentWindow)return;const{type:i}=t.data||{};"WIDGET_READY"!==i&&"HALLIDAY_READY"!==i||(r&&(clearTimeout(r),r=null),p(),as={...as,isPreloaded:!0,isLoading:!1,readyTime:Date.now()},ds?.(),d(),e())},l=e=>{if(!n||o!==ys)return;if(e.origin!==a)return;if(e.source!==as.iframe?.contentWindow)return;const{type:t,payload:r}=e.data||{};t===exports.MessageType.EVENT_RESIZE&&r&&as.iframe&&(void 0!==r.width&&(as.iframe.style.width=r.width+"px"),void 0!==r.height&&(as.iframe.style.height=r.height+"px"))},p=()=>{window.removeEventListener("message",u),window.removeEventListener("message",l),ps===l&&(ps=null)};window.addEventListener("message",u),window.addEventListener("message",l),ps=l;const f=document.getElementById(ss);f&&f.remove();const m=document.createElement("iframe");m.id=ss;let h="MODAL";try{h=Fr()?"OVERLAY":"MODAL"}catch{}const y=es({apiKey:i.apiKey,sandbox:i.sandbox||!1,widgetVersion:"2",outputs:[],hasOwner:!1,hasTxHandler:!1,hostOrigin:"undefined"!=typeof window?window.origin:null,windowOrigin:a,appMode:h,apiBaseUrl:s.dangerouslyOverrideApiBaseUrl,ipAddress:s.dangerouslyOverrideIPAddress,featureFlags:s.dangerouslyOverrideFeatureFlags});m.src=y,m.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: -1;\n visibility: hidden;\n pointer-events: none;\n opacity: 0;\n ",m.setAttribute("aria-hidden","true"),m.setAttribute("tabindex","-1"),m.onload=()=>{n&&o===ys&&setTimeout((()=>{n&&o===ys&&as.isLoading&&!as.isPreloaded&&(r&&(clearTimeout(r),r=null),p(),as={...as,isPreloaded:!0,isLoading:!1,readyTime:Date.now()},ds?.(),d(),e())}),3e3)},m.onerror=()=>{if(!n||o!==ys)return;r&&(clearTimeout(r),r=null),p();const e=new Error("Failed to load widget");as={...as,isLoading:!1,error:e},us?.(e),d(),t(e)},document.body.appendChild(m),as.iframe=m,hs=c}));return ms=c,c},exports.openHallidayPayments=async function(e,...t){try{return ws.openWidget(e,...t)}catch(e){throw is(e),e}},exports.serializeQueryParams=Qi;
1
+ "use strict";const e=Object.freeze({status:"aborted"});function t(e,t,n){function o(n,o){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:o,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,o);const r=s.prototype,i=Object.keys(r);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=r[t].bind(n))}}const r=n?.Parent??Object;class i extends r{}function s(e){var t;const r=n?.Parent?new i:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class o extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const r={};function i(e){return r}function s(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function a(e,t){return"bigint"==typeof t?t.toString():t}function c(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function d(e){return null==e}function u(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const l=Symbol("evaluating");function p(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==l)return void 0===o&&(o=l,o=n()),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){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function h(e){return JSON.stringify(e)}const g="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function y(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const _=c((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function v(e){if(!1===y(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==y(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function w(e){return v(e)?{...e}:Array.isArray(e)?[...e]:e}const b=new Set(["string","number","symbol"]);function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function z(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function k(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 O={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function x(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function 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 r=I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function S(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function N(...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}),e.message=JSON.stringify(t,a,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},P=t("$ZodError",$),R=t("$ZodError",$,{Parent:Error});const D=e=>(t,o,r,s)=>{const a=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:o,issues:[]},a);if(c instanceof Promise)throw new n;if(c.issues.length){const t=new(s?.Err??e)(c.issues.map((e=>A(e,a,i()))));throw g(t,s?.callee),t}return c.value},C=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(r?.Err??e)(a.issues.map((e=>A(e,s,i()))));throw g(t,r?.callee),t}return a.value},M=e=>(t,o,r)=>{const s=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new n;return a.issues.length?{success:!1,error:new(e??P)(a.issues.map((e=>A(e,s,i()))))}:{success:!0,data:a.value}},Z=M(R),L=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map((e=>A(e,r,i()))))}:{success:!0,data:s.value}},F=L(R),U=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return D(e)(t,n,r)},W=e=>(t,n,o)=>D(e)(t,n,o),j=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return C(e)(t,n,r)},B=e=>async(t,n,o)=>C(e)(t,n,o),H=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return M(e)(t,n,r)},V=e=>(t,n,o)=>M(e)(t,n,o),J=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return L(e)(t,n,r)},G=e=>async(t,n,o)=>L(e)(t,n,o),K=/^[cC][^\s-]{8,}$/,Y=/^[0-9a-z]+$/,q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,X=/^[0-9a-vA-V]{20}$/,Q=/^[A-Za-z0-9]{27}$/,ee=/^[a-zA-Z0-9_-]{21}$/,te=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ne=/^([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})$/,oe=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,re=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const ie=/^(?:(?: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])$/,se=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ae=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,de=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ue=/^[A-Za-z0-9_-]*$/,le=/^\+[1-9]\d{6,14}$/,pe="(?:(?:\\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])))",fe=new RegExp(`^${pe}$`);function me(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const he=/^-?\d+n?$/,ge=/^-?\d+$/,ye=/^-?\d+(?:\.\d+)?$/,_e=/^(?:true|false)$/i,ve=/^undefined$/i,we=/^[^A-Z]*$/,be=/^[^a-z]*$/,Ee=t("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),ze={number:"number",bigint:"bigint",object:"date"},ke=t("$ZodCheckLessThan",((e,t)=>{Ee.init(e,t);const n=ze[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Oe=t("$ZodCheckGreaterThan",((e,t)=>{Ee.init(e,t);const n=ze[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),xe=t("$ZodCheckMultipleOf",((e,t)=>{Ee.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);e?.[1]&&(r=Number.parseInt(e[1]))}const i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),Te=t("$ZodCheckNumberFormat",((e,t)=>{Ee.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[r,i]=O[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i,n&&(o.pattern=ge)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}))}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}})),Ie=t("$ZodCheckMaxLength",((e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!d(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const r=S(o);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}})),Ae=t("$ZodCheckMinLength",((e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!d(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const r=S(o);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}})),Se=t("$ZodCheckLengthEquals",((e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!d(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const o=n.value,r=o.length;if(r===t.length)return;const i=S(o),s=r>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),Ne=t("$ZodCheckStringFormat",((e,t)=>{var n,o;Ee.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})})),$e=t("$ZodCheckRegex",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),Pe=t("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=we),Ne.init(e,t)})),Re=t("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=be),Ne.init(e,t)})),De=t("$ZodCheckIncludes",((e,t)=>{Ee.init(e,t);const n=E(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})}})),Ce=t("$ZodCheckStartsWith",((e,t)=>{Ee.init(e,t);const n=new RegExp(`^${E(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})}})),Me=t("$ZodCheckEndsWith",((e,t)=>{Ee.init(e,t);const n=new RegExp(`.*${E(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})}})),Ze=t("$ZodCheckOverwrite",((e,t)=>{Ee.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class Le{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),o=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const Fe={major:4,minor:3,patch:6},Ue=t("$ZodType",((e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fe;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,o)=>{let r,i=x(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===o?.async)throw new n;if(r||a instanceof Promise)r=(r??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(i||(i=x(e,t)))}));else{if(e.issues.length===t)continue;i||(i=x(e,t))}}return r?r.then((()=>e)):e},o=(o,i,s)=>{if(x(o))return o.aborted=!0,o;const a=t(i,r,s);if(a instanceof Promise){if(!1===s.async)throw new n;return a.then((t=>e._zod.parse(t,s)))}return e._zod.parse(a,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then((e=>o(e,i,s))):o(t,i,s)}const a=e._zod.parse(i,s);if(a instanceof Promise){if(!1===s.async)throw new n;return a.then((e=>t(e,r,s)))}return t(a,r,s)}}p(e,"~standard",(()=>({validate:t=>{try{const n=Z(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return F(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1})))})),We=t("$ZodString",((e,t)=>{var n;Ue.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}})),je=t("$ZodStringFormat",((e,t)=>{Ne.init(e,t),We.init(e,t)})),Be=t("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=ne),je.init(e,t)})),He=t("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=oe(e))}else t.pattern??(t.pattern=oe());je.init(e,t)})),Ve=t("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=re),je.init(e,t)})),Je=t("$ZodURL",((e,t)=>{je.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=r.href:n.value=o)}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),Ge=t("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),je.init(e,t)})),Ke=t("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=ee),je.init(e,t)})),Ye=t("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=K),je.init(e,t)})),qe=t("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=Y),je.init(e,t)})),Xe=t("$ZodULID",((e,t)=>{t.pattern??(t.pattern=q),je.init(e,t)})),Qe=t("$ZodXID",((e,t)=>{t.pattern??(t.pattern=X),je.init(e,t)})),et=t("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=Q),je.init(e,t)})),tt=t("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=me({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${pe}T(?:${o})$`)}(t)),je.init(e,t)})),nt=t("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=fe),je.init(e,t)})),ot=t("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${me(t)}$`)),je.init(e,t)})),rt=t("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=te),je.init(e,t)})),it=t("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=ie),je.init(e,t),e._zod.bag.format="ipv4"})),st=t("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=se),je.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),at=t("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=ae),je.init(e,t)})),ct=t("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=ce),je.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(2!==o.length)throw new Error;const[e,t]=o;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function dt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ut=t("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=de),je.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{dt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}));const lt=t("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=ue),je.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!ue.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return dt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),pt=t("$ZodE164",((e,t)=>{t.pattern??(t.pattern=le),je.init(e,t)}));const ft=t("$ZodJWT",((e,t)=>{je.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),mt=t("$ZodNumber",((e,t)=>{Ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??ye,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const i="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}})),ht=t("$ZodNumberFormat",((e,t)=>{Te.init(e,t),mt.init(e,t)})),gt=t("$ZodBoolean",((e,t)=>{Ue.init(e,t),e._zod.pattern=_e,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}})),yt=t("$ZodBigInt",((e,t)=>{Ue.init(e,t),e._zod.pattern=he,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}})),_t=t("$ZodUndefined",((e,t)=>{Ue.init(e,t),e._zod.pattern=ve,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const o=t.value;return void 0===o||t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}})),vt=t("$ZodAny",((e,t)=>{Ue.init(e,t),e._zod.parse=e=>e})),wt=t("$ZodUnknown",((e,t)=>{Ue.init(e,t),e._zod.parse=e=>e})),bt=t("$ZodNever",((e,t)=>{Ue.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)})),Et=t("$ZodDate",((e,t)=>{Ue.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}}));function zt(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}const kt=t("$ZodArray",((e,t)=>{Ue.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const i=[];for(let e=0;e<r.length;e++){const s=r[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?i.push(a.then((t=>zt(t,n,e)))):zt(a,n,e)}return i.length?Promise.all(i).then((()=>n)):n}}));function Ot(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...T(n,e.issues))}void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function xt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=e.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Tt(e,t,n,o,r,i){const s=[],a=r.keySet,c=r.catchall._zod,d=c.def.type,u="optional"===c.optout;for(const r in t){if(a.has(r))continue;if("never"===d){s.push(r);continue}const i=c.run({value:t[r],issues:[]},o);i instanceof Promise?e.push(i.then((e=>Ot(e,n,r,t,u)))):Ot(i,n,r,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then((()=>n)):n}const It=t("$ZodObject",((e,t)=>{Ue.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const o=c((()=>xt(t)));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}));const r=y,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=o.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],d=s.shape;for(const e of s.keys){const o=d[e],r="optional"===o._zod.optout,i=o._zod.run({value:a[e],issues:[]},n);i instanceof Promise?c.push(i.then((n=>Ot(n,t,e,a,r)))):Ot(i,t,e,a,r)}return i?Tt(c,a,t,n,o.value,e):c.length?Promise.all(c).then((()=>t)):t}})),At=t("$ZodObjectJIT",((e,t)=>{It.init(e,t);const n=e._zod.parse,o=c((()=>xt(t)));let i;const s=y,a=!r.jitless,d=a&&_.value,u=t.catchall;let l;e._zod.parse=(r,c)=>{l??(l=o.value);const p=r.value;return s(p)?a&&d&&!1===c?.async&&!0!==c.jitless?(i||(i=(e=>{const t=new Le(["shape","payload","ctx"]),n=o.value,r=e=>{const t=h(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const e of n.keys)i[e]="key_"+s++;t.write("const newResult = {};");for(const o of n.keys){const n=i[o],s=h(o),a=e[o],c="optional"===a?._zod?.optout;t.write(`const ${n} = ${r(o)};`),c?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),r=i(r,c),u?Tt([],p,r,c,l,e):r):n(r,c):(r.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),r)}}));function St(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter((e=>!x(e)));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>A(e,o,i())))))}),t)}const Nt=t("$ZodUnion",((e,t)=>{Ue.init(e,t),p(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),p(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),p(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),p(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>u(e.source))).join("|")})$`)}}));const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then((t=>St(t,r,e,i))):St(a,r,e,i)}})),$t=t("$ZodDiscriminatedUnion",((e,t)=>{t.inclusive=!1,Nt.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=c((()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n}));e._zod.parse=(r,i)=>{const s=r.value;if(!y(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(r,i):t.unionFallback?n(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r)}})),Pt=t("$ZodIntersection",((e,t)=>{Ue.init(e,t),e._zod.parse=(e,n)=>{const o=e.value,r=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then((([t,n])=>Dt(e,t,n))):Dt(e,r,i)}}));function Rt(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))),r={...e,...t};for(const n of o){const o=Rt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r[n]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const r=Rt(e[o],t[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Dt(e,t,n){const o=new Map;let r;for(const n of t.issues)if("unrecognized_keys"===n.code){r??(r=n);for(const e of n.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(t);const i=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(i.length&&r&&e.issues.push({...r,keys:i}),x(e))return e;const s=Rt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Ct=t("$ZodRecord",((e,t)=>{Ue.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!v(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a){n.value={};const i=new Set;for(const e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){i.add("number"==typeof e?e.toString():e);const a=t.valueType._zod.run({value:r[e],issues:[]},o);a instanceof Promise?s.push(a.then((t=>{t.issues.length&&n.issues.push(...T(e,t.issues)),n.value[e]=t.value}))):(a.issues.length&&n.issues.push(...T(e,a.issues)),n.value[e]=a.value)}let c;for(const e in r)i.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(r)){if("__proto__"===a)continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof a&&ye.test(a)&&c.issues.length){const e=t.keyType._zod.run({value:Number(a),issues:[]},o);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(c=e)}if(c.issues.length){"loose"===t.mode?n.value[a]=r[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((e=>A(e,o,i()))),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:r[a],issues:[]},o);d instanceof Promise?s.push(d.then((e=>{e.issues.length&&n.issues.push(...T(a,e.issues)),n.value[c.value]=e.value}))):(d.issues.length&&n.issues.push(...T(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then((()=>n)):n}})),Mt=t("$ZodEnum",((e,t)=>{Ue.init(e,t);const n=s(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter((e=>b.has(typeof e))).map((e=>"string"==typeof e?E(e):e.toString())).join("|")})$`),e._zod.parse=(t,r)=>{const i=t.value;return o.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),Zt=t("$ZodLiteral",((e,t)=>{if(Ue.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?E(e):e?E(e.toString()):String(e))).join("|")})$`),e._zod.parse=(o,r)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}})),Lt=t("$ZodTransform",((e,t)=>{Ue.init(e,t),e._zod.parse=(r,i)=>{if("backward"===i.direction)throw new o(e.constructor.name);const s=t.transform(r.value,r);if(i.async){return(s instanceof Promise?s:Promise.resolve(s)).then((e=>(r.value=e,r)))}if(s instanceof Promise)throw new n;return r.value=s,r}}));function Ft(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ut=t("$ZodOptional",((e,t)=>{Ue.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(`^(${u(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((t=>Ft(t,e.value))):Ft(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),Wt=t("$ZodExactOptional",((e,t)=>{Ut.init(e,t),p(e._zod,"values",(()=>t.innerType._zod.values)),p(e._zod,"pattern",(()=>t.innerType._zod.pattern)),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)})),jt=t("$ZodNullable",((e,t)=>{Ue.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(`^(${u(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)})),Bt=t("$ZodDefault",((e,t)=>{Ue.init(e,t),e._zod.optin="optional",p(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>Ht(e,t))):Ht(o,t)}}));function Ht(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Vt=t("$ZodPrefault",((e,t)=>{Ue.init(e,t),e._zod.optin="optional",p(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Jt=t("$ZodNonOptional",((e,t)=>{Ue.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 r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then((t=>Gt(t,e))):Gt(r,e)}}));function Gt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Kt=t("$ZodCatch",((e,t)=>{Ue.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)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>A(e,n,i())))},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,i())))},input:e.value}),e.issues=[]),e)}})),Yt=t("$ZodPipe",((e,t)=>{Ue.init(e,t),p(e._zod,"values",(()=>t.in._zod.values)),p(e._zod,"optin",(()=>t.in._zod.optin)),p(e._zod,"optout",(()=>t.out._zod.optout)),p(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const o=t.out._zod.run(e,n);return o instanceof Promise?o.then((e=>qt(e,t.in,n))):qt(o,t.in,n)}const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>qt(e,t.out,n))):qt(o,t.out,n)}}));function qt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Xt=t("$ZodReadonly",((e,t)=>{Ue.init(e,t),p(e._zod,"propValues",(()=>t.innerType._zod.propValues)),p(e._zod,"values",(()=>t.innerType._zod.values)),p(e._zod,"optin",(()=>t.innerType?._zod?.optin)),p(e._zod,"optout",(()=>t.innerType?._zod?.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(Qt):Qt(o)}}));function Qt(e){return e.value=Object.freeze(e.value),e}const en=t("$ZodCustom",((e,t)=>{Ee.init(e,t),Ue.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((t=>tn(t,n,o,e)));tn(r,n,o,e)}}));function tn(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(N(e))}}var nn;class on{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(nn=globalThis).__zod_globalRegistry??(nn.__zod_globalRegistry=new on);const rn=globalThis.__zod_globalRegistry;function sn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...k(t)})}function an(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...k(t)})}function cn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...k(t)})}function dn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(t)})}function un(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(t)})}function ln(e,t){return new ke({check:"less_than",...k(t),value:e,inclusive:!1})}function pn(e,t){return new ke({check:"less_than",...k(t),value:e,inclusive:!0})}function fn(e,t){return new Oe({check:"greater_than",...k(t),value:e,inclusive:!1})}function mn(e,t){return new Oe({check:"greater_than",...k(t),value:e,inclusive:!0})}function hn(e,t){return new xe({check:"multiple_of",...k(t),value:e})}function gn(e,t){return new Ie({check:"max_length",...k(t),maximum:e})}function yn(e,t){return new Ae({check:"min_length",...k(t),minimum:e})}function _n(e,t){return new Se({check:"length_equals",...k(t),length:e})}function vn(e){return new Ze({check:"overwrite",tx:e})}function wn(e){const t=function(e,t){const n=new Ee({check:"custom",...k(t)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(N(e,n.value,t._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(N(o))}},e(n.value,n))));return t}function bn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??rn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function En(e,t,n={path:[],schemaPath:[]}){var o;const r=e._zod.def,i=t.seen.get(e);if(i){i.count++;return n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema}const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const o={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,o);else{const n=s.schema,i=t.processors[r.type];if(!i)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);i(e,t,n,o)}const i=e._zod.parent;i&&(s.ref||(s.ref=i),En(i,t,o),t.seen.get(i).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&On(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function zn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=o.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(n,t[0])}}const r=t=>{if(t[1].schema.$ref)return;const o=t[1],{ref:r,defId:i}=(t=>{const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,r=e.external.uri??(e=>e);if(n)return{ref:r(n)};const i=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=i,{defId:i,ref:`${r("__shared")}#/${o}/${i}`}}if(t[1]===n)return{ref:"#"};const r=`#/${o}/`,i=t[1].schema.id??"__schema"+e.counter++;return{defId:i,ref:r+i}})(t);o.def={...o.schema},i&&(o.defId=i);const s=o.schema;for(const e in s)delete s[e];s.$ref=r};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const o=n[1];if(t===n[0]){r(n);continue}if(e.external){const o=e.external.registry.get(n[0])?.id;if(t!==n[0]&&o){r(n);continue}}const i=e.metadataRegistry.get(n[0])?.id;i?r(n):(o.cycle||o.count>1&&"ref"===e.reused)&&r(n)}}function kn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=t=>{const n=e.seen.get(t);if(null===n.ref)return;const r=n.def??n.schema,i={...r},s=n.ref;if(n.ref=null,s){o(s);const n=e.seen.get(s),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(r,a):(r.allOf=r.allOf??[],r.allOf.push(a)),Object.assign(r,i);if(t._zod.parent===s)for(const e in r)"$ref"!==e&&"allOf"!==e&&(e in i||delete r[e]);if(a.$ref&&n.def)for(const e in r)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(r[e])===JSON.stringify(n.def[e])&&delete r[e]}const a=t._zod.parent;if(a&&a!==s){o(a);const t=e.seen.get(a);if(t?.schema.$ref&&(r.$ref=t.schema.$ref,t.def))for(const e in r)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(r[e])===JSON.stringify(t.def[e])&&delete r[e]}e.override({zodSchema:t,jsonSchema:r,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())o(t[0]);const r={};if("draft-2020-12"===e.target?r.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?r.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(n)}Object.assign(r,n.def??n.schema);const i=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?r.$defs=i:r.definitions=i);try{const n=JSON.parse(JSON.stringify(r));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:xn(t,"input",e.processors),output:xn(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function On(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return On(o.element,n);if("set"===o.type)return On(o.valueType,n);if("lazy"===o.type)return On(o.getter(),n);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return On(o.innerType,n);if("intersection"===o.type)return On(o.left,n)||On(o.right,n);if("record"===o.type||"map"===o.type)return On(o.keyType,n)||On(o.valueType,n);if("pipe"===o.type)return On(o.in,n)||On(o.out,n);if("object"===o.type){for(const e in o.shape)if(On(o.shape[e],n))return!0;return!1}if("union"===o.type){for(const e of o.options)if(On(e,n))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(On(e,n))return!0;return!(!o.rest||!On(o.rest,n))}return!1}const xn=(e,t,n={})=>o=>{const{libraryOptions:r,target:i}=o??{},s=bn({...r??{},target:i,io:t,processors:n});return En(e,s),zn(s,e),kn(s,e)},Tn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},In=(e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o);t.seen.get(e).ref=r.innerType},An=t("ZodISODateTime",((e,t)=>{tt.init(e,t),no.init(e,t)}));function Sn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(t)})}(An,e)}const Nn=t("ZodISODate",((e,t)=>{nt.init(e,t),no.init(e,t)}));function $n(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...k(t)})}(Nn,e)}const Pn=t("ZodISOTime",((e,t)=>{ot.init(e,t),no.init(e,t)}));function Rn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...k(t)})}(Pn,e)}const Dn=t("ZodISODuration",((e,t)=>{rt.init(e,t),no.init(e,t)}));function Cn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...k(t)})}(Dn,e)}const Mn=(e,t)=>{P.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)n._errors.push(t(r));else{let e=n,o=0;for(;o<r.path.length;){const n=r.path[o];o===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],o++}}};return o(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,a,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,a,2)}},isEmpty:{get:()=>0===e.issues.length}})},Zn=t("ZodError",Mn),Ln=t("ZodError",Mn,{Parent:Error}),Fn=D(Ln),Un=C(Ln),Wn=M(Ln),jn=L(Ln),Bn=U(Ln),Hn=W(Ln),Vn=j(Ln),Jn=B(Ln),Gn=H(Ln),Kn=V(Ln),Yn=J(Ln),qn=G(Ln),Xn=t("ZodType",((e,t)=>(Ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:xn(e,"input"),output:xn(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const o=bn({...n,processors:t});return En(e,o),zn(o,e),kn(o,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(m(t,{checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>z(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>Fn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Wn(e,t,n),e.parseAsync=async(t,n)=>Un(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>jn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Bn(e,t,n),e.decode=(t,n)=>Hn(e,t,n),e.encodeAsync=async(t,n)=>Vn(e,t,n),e.decodeAsync=async(t,n)=>Jn(e,t,n),e.safeEncode=(t,n)=>Gn(e,t,n),e.safeDecode=(t,n)=>Kn(e,t,n),e.safeEncodeAsync=async(t,n)=>Yn(e,t,n),e.safeDecodeAsync=async(t,n)=>qn(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...k(n)})}(gr,e,t)}(t,n)),e.superRefine=t=>e.check(wn(t)),e.overwrite=t=>e.check(vn(t)),e.optional=()=>ir(e),e.exactOptional=()=>new sr({type:"optional",innerType:e}),e.nullable=()=>cr(e),e.nullish=()=>ir(cr(e)),e.nonoptional=t=>function(e,t){return new lr({type:"nonoptional",innerType:e,...k(t)})}(e,t),e.array=()=>Wo(e),e.or=t=>Vo([e,t]),e.and=t=>new Ko({type:"intersection",left:e,right:t}),e.transform=t=>mr(e,or(t)),e.default=t=>{return n=t,new dr({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():w(n)}});var n},e.prefault=t=>{return n=t,new ur({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():w(n)}});var n},e.catch=t=>{return new pr({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>mr(e,t),e.readonly=()=>new hr({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return rn.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>rn.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return rn.get(e);const n=e.clone();return rn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e))),Qn=t("_ZodString",((e,t)=>{We.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=n;o.type="string";const{minimum:r,maximum:i,format:s,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof i&&(o.maxLength=i),s&&(o.format=Tn[s]??s,""===o.format&&delete o.format,"time"===s&&delete o.format),c&&(o.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?o.pattern=e[0].source:e.length>1&&(o.allOf=[...e.map((e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source})))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new $e({check:"string_format",format:"regex",...k(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new De({check:"string_format",format:"includes",...k(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ce({check:"string_format",format:"starts_with",...k(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Me({check:"string_format",format:"ends_with",...k(t),suffix:e})}(...t)),e.min=(...t)=>e.check(yn(...t)),e.max=(...t)=>e.check(gn(...t)),e.length=(...t)=>e.check(_n(...t)),e.nonempty=(...t)=>e.check(yn(1,...t)),e.lowercase=t=>e.check(function(e){return new Pe({check:"string_format",format:"lowercase",...k(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Re({check:"string_format",format:"uppercase",...k(e)})}(t)),e.trim=()=>e.check(vn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return vn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(vn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(vn((e=>e.toUpperCase()))),e.slugify=()=>e.check(vn((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))))})),eo=t("ZodString",((e,t)=>{We.init(e,t),Qn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...k(t)})}(oo,t)),e.url=t=>e.check(cn(ao,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...k(t)})}(ko,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...k(t)})}(uo,t)),e.guid=t=>e.check(sn(ro,t)),e.uuid=t=>e.check(an(io,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(t)})}(io,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(t)})}(io,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(t)})}(io,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(t)})}(lo,t)),e.guid=t=>e.check(sn(ro,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...k(t)})}(po,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(t)})}(fo,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...k(t)})}(mo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...k(t)})}(bo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...k(t)})}(Eo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...k(t)})}(ho,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(t)})}(go,t)),e.ipv4=t=>e.check(dn(yo,t)),e.ipv6=t=>e.check(un(_o,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(t)})}(vo,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(t)})}(wo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...k(t)})}(zo,t)),e.datetime=t=>e.check(Sn(t)),e.date=t=>e.check($n(t)),e.time=t=>e.check(Rn(t)),e.duration=t=>e.check(Cn(t))}));function to(e){return function(e,t){return new e({type:"string",...k(t)})}(eo,e)}const no=t("ZodStringFormat",((e,t)=>{je.init(e,t),Qn.init(e,t)})),oo=t("ZodEmail",((e,t)=>{Ve.init(e,t),no.init(e,t)})),ro=t("ZodGUID",((e,t)=>{Be.init(e,t),no.init(e,t)})),io=t("ZodUUID",((e,t)=>{He.init(e,t),no.init(e,t)}));function so(e){return an(io,e)}const ao=t("ZodURL",((e,t)=>{Je.init(e,t),no.init(e,t)}));function co(e){return cn(ao,e)}const uo=t("ZodEmoji",((e,t)=>{Ge.init(e,t),no.init(e,t)})),lo=t("ZodNanoID",((e,t)=>{Ke.init(e,t),no.init(e,t)})),po=t("ZodCUID",((e,t)=>{Ye.init(e,t),no.init(e,t)})),fo=t("ZodCUID2",((e,t)=>{qe.init(e,t),no.init(e,t)})),mo=t("ZodULID",((e,t)=>{Xe.init(e,t),no.init(e,t)})),ho=t("ZodXID",((e,t)=>{Qe.init(e,t),no.init(e,t)})),go=t("ZodKSUID",((e,t)=>{et.init(e,t),no.init(e,t)})),yo=t("ZodIPv4",((e,t)=>{it.init(e,t),no.init(e,t)}));const _o=t("ZodIPv6",((e,t)=>{st.init(e,t),no.init(e,t)}));const vo=t("ZodCIDRv4",((e,t)=>{at.init(e,t),no.init(e,t)})),wo=t("ZodCIDRv6",((e,t)=>{ct.init(e,t),no.init(e,t)})),bo=t("ZodBase64",((e,t)=>{ut.init(e,t),no.init(e,t)})),Eo=t("ZodBase64URL",((e,t)=>{lt.init(e,t),no.init(e,t)})),zo=t("ZodE164",((e,t)=>{pt.init(e,t),no.init(e,t)})),ko=t("ZodJWT",((e,t)=>{ft.init(e,t),no.init(e,t)})),Oo=t("ZodNumber",((e,t)=>{mt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=n,{minimum:r,maximum:i,format:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof s&&s.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==t.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof i&&(o.maximum=i,"number"==typeof c&&"draft-04"!==t.target&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof a&&(o.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(fn(t,n)),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.lt=(t,n)=>e.check(ln(t,n)),e.lte=(t,n)=>e.check(pn(t,n)),e.max=(t,n)=>e.check(pn(t,n)),e.int=t=>e.check(Io(t)),e.safe=t=>e.check(Io(t)),e.positive=t=>e.check(fn(0,t)),e.nonnegative=t=>e.check(mn(0,t)),e.negative=t=>e.check(ln(0,t)),e.nonpositive=t=>e.check(pn(0,t)),e.multipleOf=(t,n)=>e.check(hn(t,n)),e.step=(t,n)=>e.check(hn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function xo(e){return function(e,t){return new e({type:"number",checks:[],...k(t)})}(Oo,e)}const To=t("ZodNumberFormat",((e,t)=>{ht.init(e,t),Oo.init(e,t)}));function Io(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...k(t)})}(To,e)}const Ao=t("ZodBoolean",((e,t)=>{gt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)}));function So(e){return function(e,t){return new e({type:"boolean",...k(t)})}(Ao,e)}const No=t("ZodBigInt",((e,t)=>{yt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")})(0,e),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.gt=(t,n)=>e.check(fn(t,n)),e.gte=(t,n)=>e.check(mn(t,n)),e.min=(t,n)=>e.check(mn(t,n)),e.lt=(t,n)=>e.check(ln(t,n)),e.lte=(t,n)=>e.check(pn(t,n)),e.max=(t,n)=>e.check(pn(t,n)),e.positive=t=>e.check(fn(BigInt(0),t)),e.negative=t=>e.check(ln(BigInt(0),t)),e.nonpositive=t=>e.check(pn(BigInt(0),t)),e.nonnegative=t=>e.check(mn(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(hn(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function $o(e){return function(e,t){return new e({type:"bigint",...k(t)})}(No,e)}const Po=t("ZodUndefined",((e,t)=>{_t.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema")})(0,e)}));const Ro=t("ZodAny",((e,t)=>{vt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Do(){return new Ro({type:"any"})}const Co=t("ZodUnknown",((e,t)=>{wt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Mo(){return new Co({type:"unknown"})}const Zo=t("ZodNever",((e,t)=>{bt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)}));function Lo(e){return function(e,t){return new e({type:"never",...k(t)})}(Zo,e)}const Fo=t("ZodDate",((e,t)=>{Et.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")})(0,e),e.min=(t,n)=>e.check(mn(t,n)),e.max=(t,n)=>e.check(pn(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}));const Uo=t("ZodArray",((e,t)=>{kt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(r.minItems=s),"number"==typeof a&&(r.maxItems=a),r.type="array",r.items=En(i.element,t,{...o,path:[...o.path,"items"]})})(e,t,n,o),e.element=t.element,e.min=(t,n)=>e.check(yn(t,n)),e.nonempty=t=>e.check(yn(1,t)),e.max=(t,n)=>e.check(gn(t,n)),e.length=(t,n)=>e.check(_n(t,n)),e.unwrap=()=>e.element}));function Wo(e,t){return function(e,t,n){return new e({type:"array",element:t,...k(n)})}(Uo,e,t)}const jo=t("ZodObject",((e,t)=>{At.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const e in s)r.properties[e]=En(s[e],t,{...o,path:[...o.path,"properties",e]});const a=new Set(Object.keys(s)),c=new Set([...a].filter((e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout})));c.size>0&&(r.required=Array.from(c)),"never"===i.catchall?._zod.def.type?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=En(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,n,o),p(e,"shape",(()=>t.shape)),e.keyof=()=>Qo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Mo()}),e.loose=()=>e.clone({...e._zod.def,catchall:Mo()}),e.strict=()=>e.clone({...e._zod.def,catchall:Lo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!v(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=m(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return f(this,"shape",n),n}});return z(e,o)}(e,t),e.safeExtend=t=>function(e,t){if(!v(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=m(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return f(this,"shape",n),n}});return z(e,n)}(e,t),e.merge=t=>function(e,t){const n=m(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return f(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return z(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return z(e,m(e._zod.def,{get shape(){const e={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=n.shape[o])}return f(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=m(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return f(this,"shape",o),o},checks:[]});return z(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=m(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)r[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return f(this,"shape",r),r},checks:[]});return z(t,r)}(rr,e,t[0]),e.required=(...t)=>function(e,t,n){const o=m(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)r[t]=new e({type:"nonoptional",innerType:o[t]});return f(this,"shape",r),r}});return z(t,o)}(lr,e,t[0])}));function Bo(e,t){const n={type:"object",shape:e??{},...k(t)};return new jo(n)}const Ho=t("ZodUnion",((e,t)=>{Nt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=!1===r.inclusive,s=r.options.map(((e,n)=>En(e,t,{...o,path:[...o.path,i?"oneOf":"anyOf",n]})));i?n.oneOf=s:n.anyOf=s})(e,t,n,o),e.options=t.options}));function Vo(e,t){return new Ho({type:"union",options:e,...k(t)})}const Jo=t("ZodDiscriminatedUnion",((e,t)=>{Ho.init(e,t),$t.init(e,t)}));function Go(e,t,n){return new Jo({type:"union",options:t,discriminator:e,...k(n)})}const Ko=t("ZodIntersection",((e,t)=>{Pt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=En(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=En(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c})(e,t,n,o)}));const Yo=t("ZodRecord",((e,t)=>{Ct.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=n,i=e._zod.def;r.type="object";const s=i.keyType,a=s._zod.bag,c=a?.patterns;if("loose"===i.mode&&c&&c.size>0){const e=En(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(const t of c)r.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(r.propertyNames=En(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=En(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=s._zod.values;if(d){const e=[...d].filter((e=>"string"==typeof e||"number"==typeof e));e.length>0&&(r.required=e)}})(e,t,n,o),e.keyType=t.keyType,e.valueType=t.valueType}));function qo(e,t,n){return new Yo({type:"record",keyType:e,valueType:t,...k(n)})}const Xo=t("ZodEnum",((e,t)=>{Mt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=s(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(n.type="number"),o.every((e=>"string"==typeof e))&&(n.type="string"),n.enum=o})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const r={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);r[o]=t.entries[o]}return new Xo({...t,checks:[],...k(o),entries:r})},e.exclude=(e,o)=>{const r={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new Xo({...t,checks:[],...k(o),entries:r})}}));function Qo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Xo({type:"enum",entries:n,...k(t)})}const er=t("ZodLiteral",((e,t)=>{Zt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n)=>{const o=e._zod.def,r=[];for(const e of o.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");r.push(Number(e))}else r.push(e);if(0===r.length);else if(1===r.length){const e=r[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else r.every((e=>"number"==typeof e))&&(n.type="number"),r.every((e=>"string"==typeof e))&&(n.type="string"),r.every((e=>"boolean"==typeof e))&&(n.type="boolean"),r.every((e=>null===e))&&(n.type="null"),n.enum=r})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));function tr(e,t){return new er({type:"literal",values:Array.isArray(e)?e:[e],...k(t)})}const nr=t("ZodTransform",((e,t)=>{Lt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new o(e.constructor.name);n.addIssue=o=>{if("string"==typeof o)n.issues.push(N(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(N(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n))):(n.value=i,n)}}));function or(e){return new nr({type:"transform",transform:e})}const rr=t("ZodOptional",((e,t)=>{Ut.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>In(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));function ir(e){return new rr({type:"optional",innerType:e})}const sr=t("ZodExactOptional",((e,t)=>{Wt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>In(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));const ar=t("ZodNullable",((e,t)=>{jt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i=En(r.innerType,t,o),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));function cr(e){return new ar({type:"nullable",innerType:e})}const dr=t("ZodDefault",((e,t)=>{Bt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const ur=t("ZodPrefault",((e,t)=>{Vt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));const lr=t("ZodNonOptional",((e,t)=>{Jt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType})(e,t,0,o),e.unwrap=()=>e._zod.def.innerType}));const pr=t("ZodCatch",((e,t)=>{Kt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;let i;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const fr=t("ZodPipe",((e,t)=>{Yt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def,i="input"===t.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;En(i,t,o),t.seen.get(e).ref=i})(e,t,0,o),e.in=t.in,e.out=t.out}));function mr(e,t){return new fr({type:"pipe",in:e,out:t})}const hr=t("ZodReadonly",((e,t)=>{Xt.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(t,n,o)=>((e,t,n,o)=>{const r=e._zod.def;En(r.innerType,t,o),t.seen.get(e).ref=r.innerType,n.readOnly=!0})(e,t,n,o),e.unwrap=()=>e._zod.def.innerType}));const gr=t("ZodCustom",((e,t)=>{en.init(e,t),Xn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));function yr(e,t){return mr(or(e),t)}const _r="custom";const vr="https://app.halliday.xyz";const wr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Uint8Array.from(wr,(e=>e.charCodeAt(0)));const br=[...wr].reduce(((e,t,n)=>(e[wr.charCodeAt(n)]=n,e)),new Uint8Array(128));new TextDecoder;const Er=/^[1-9A-HJ-NP-Za-km-z]+$/;function zr(e){let t=0;for(;t<e.length&&"1"===e[t];)t++;return t+function(e){let t=0;for(let n=e;n>0n;n>>=8n)t++;return t}(function(e){let t=0n;for(let n=0;n<e.length;n++)t=58n*t+BigInt(br[e.charCodeAt(n)]);return t}(e))}const kr=to().regex(/^0x[a-fA-F0-9]*$/,{message:"Must be a hex string beginning with 0x"}).transform((e=>e.toLowerCase())),Or=to().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a 40-character hex string beginning with 0x"}).transform((e=>e.toLowerCase())),xr=to().superRefine(((e,t)=>{if(!Er.test(e))return t.addIssue({code:_r,message:"Must be a base58-encoded Solana address"});32!==zr(e)&&t.addIssue({code:_r,message:"Solana address must decode to exactly 32 bytes"})})),Tr=to().regex(/^(1[1-9A-HJ-NP-Za-km-z]{25,34}|3[1-9A-HJ-NP-Za-km-z]{25,34}|[bB][cC]1[a-z0-9]{25,87}|[bB][cC]1[A-Z0-9]{25,87})$/,{message:"Must be a valid Bitcoin address (P2PKH, P2SH, or Bech32/Bech32m)"}).transform((e=>/^[bB][cC]1/.test(e)?e.toLowerCase():e)),Ir=to().regex(/^[a-zA-Z0-9_-]{48}$/,{message:"Must be a valid TON user-friendly address (48-character base64url)"}),Ar=to().superRefine(((e,t)=>{if(!/^T[1-9A-HJ-NP-Za-km-z]{33}$/.test(e))return t.addIssue({code:_r,message:"Must be a base58check Tron address starting with T (34 characters)"});25!==zr(e)&&t.addIssue({code:_r,message:"Tron address must decode to exactly 25 bytes"})})),Sr=to().regex(/^aleo1[a-z0-9]{58}$/,{message:"Must be a valid Aleo address starting with aleo1 and 58 characters"}),Nr=to().superRefine(((e,t)=>{if(!/^[DA9][1-9A-HJ-NP-Za-km-z]{25,33}$/.test(e))return t.addIssue({code:_r,message:"Must be a valid Dogecoin address (P2PKH starting with D, or P2SH starting with A or 9)"});25!==zr(e)&&t.addIssue({code:_r,message:"Dogecoin address must decode to exactly 25 bytes"})})),$r=to().regex(/^([LM3][1-9A-HJ-NP-Za-km-z]{25,33}|ltc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39,59})$/,{message:"Must be a valid Litecoin address (P2PKH starting with L, P2SH starting with M or 3, or Bech32 starting with ltc1)"}),Pr=to().regex(/^(r[1-9A-HJ-NP-Za-km-z]{24,34}|X[1-9A-HJ-NP-Za-km-z]{46})$/,{message:"Must be a valid XRPL address (classic r-address or X-address)"}),Rr=to(),Dr=Bo({EVM:Or,SOL:xr,BTC:Tr,TON:Ir,TRON:Ar,ALEO:Sr,DOGE:Nr,LTC:$r,XRPL:Pr}),Cr=Dr.keyof(),Mr=to().regex(/^(\d+|\d*\.\d+)$/),Zr=Mr.regex(/^\d+(\.\d{1,2})?$/,"Percentage must be a number with at most 2 decimal places").refine((e=>{const t=Number(e);return Number.isFinite(t)&&t>=0&&t<=100}),{message:"Percentage must be between 0 and 100"}),Lr=Vo([So(),tr(0),tr(1),tr("0"),tr("1"),tr("false"),tr("true")]).transform((e=>!0===e||1===e||"1"===e||"true"===e)),Fr=$o().min(0n);$o().min(0n),Bo({});const Ur=to(),Wr=yr((e=>"string"==typeof e||"number"==typeof e?Number(e):e),xo().refine((e=>Number.isFinite(e)&&e>0))),jr=Vo([function(e,t){return new e({type:"date",...k(t)})}(Fo,Br),to().transform((e=>new Date(e)))]);var Br;const Hr=to(),Vr=to().regex(/^https:\/\/.+$/),Jr=to().min(1).refine((e=>!/^(javascript|data|blob|vbscript):/i.test(e)),{message:"Blocked URL scheme"}).refine((e=>/^[a-zA-Z][a-zA-Z0-9+\-.]*:\/?\/?/.test(e)),{message:"Must be a valid URL with a scheme (e.g. https://, myapp://)"}),Gr=to().length(2),Kr=to().length(2),Yr=to().length(3),qr=Vo([function(e){return dn(yo,e)}(),function(e){return un(_o,e)}()]);Bo({ip_address:qr,alpha3_country_code:Yr,state_code:Vo([Gr,tr("")])});const Xr=Vo([to(),Bo({network:to()})]).transform((e=>"string"==typeof e?e:e.network)),Qr=to(),ei=to(),ti=Vo([ei,Qr]),ni=to(),oi=to(),ri=qo(ni,Mr),ii=Bo({asset:ti,amount:Mr}),si=Bo({token:Qr,amount:Mr}),ai=Bo({min:Mr.optional(),max:Mr.optional()}),ci=Qo(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),di=Bo({kind:Vo([tr("amount"),tr("amount-downstream")]),asset:ti,given:Mr,limits:ai,downstream_limits:ai.optional(),source:to(),message:to(),reason:Qo(["TOO_LOW","TOO_HIGH","UNEXPECTEDLY_LOW","UNEXPECTEDLY_HIGH","NO_VALID_AMOUNT","UNKNOWN"])}),ui=Bo({kind:tr("funding"),token:Qr,balance:Fr}),li=Bo({kind:tr("owner"),message:to(),mitigation:Vo([tr("change"),tr("verify")])}),pi=Vo([di,ui,li,Bo({kind:tr("geolocation"),message:to()}),Bo({kind:tr("other"),message:to()}),Bo({kind:tr("payin_method"),message:to()}),Bo({kind:tr("provider"),message:to()}),Bo({kind:tr("unknown"),message:to()})]),fi=Vo([Bo({issuer:to(),name:to(),symbol:to(),decimals:xo(),alias:to().optional(),image_url:to().optional()}),Bo({chain:Xr,address:Rr,name:to(),symbol:to(),decimals:xo(),alias:to().optional(),image_url:to().optional(),is_native:So().optional(),is_oft:So().optional(),coingecko_id:to().optional(),wrapper:to().optional()})]),mi=Vo([Bo({chain_id:$o(),network:to(),address_family:Cr,explorer:co().optional(),image:co().optional(),is_testnet:So()}),Bo({chain_id:$o(),network:to(),address_family:Cr,explorer:co().optional(),image:co().optional(),is_testnet:So(),native_currency:Bo({name:to(),symbol:to(),decimals:xo()}),rpc:co().optional()})]),hi=Qo(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),gi=Bo({asset:ti,property:Qo(["APPROVAL","BALANCE","SIDE_EFFECT"])}),yi=Bo({account:hi,resource:gi}),_i=Bo({consume:Wo(yi),produce:Wo(yi)}),vi=yi.extend({sau:Fr});Bo({consume:Wo(vi),produce:Wo(vi)}),Bo({type:to()});const wi=Bo({type:to(),custom_actions:Do().optional()}),bi=Vo([tr("QUOTE_SIGNER"),tr("AUCTION_AUTHORITY"),tr("TEST_FUNDER"),tr("SOLVER")]);Dr.partial(),Bo({purpose:to().toUpperCase().pipe(bi)}),Bo({evm:Wo(Or)});const Ei=to().overwrite((e=>e.toLowerCase()));Bo({name:to(),alpha2:Kr,alpha3:Yr}),Qo(["INITIALIZED","PAYMENT_SUBMITTED","COMPLETED","FAILED","NOT_FOUND"]),Bo({alpha3_country_code:Yr,state_code:Gr});const zi=Qo(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]);Bo({sandbox:Lr.optional(),assets:Wo(ti).optional()}),qo(ni,fi),Bo({sandbox:Lr.optional()}),qo(oi,mi);const ki=Bo({sandbox:Lr.optional(),inputs:Wo(ti).optional(),outputs:Wo(ti),onramps:Wo(Ei).optional(),offramps:Wo(Ei).optional(),features:Wo(zi).optional()});Bo({sandbox:Lr.optional(),inputs:Wo(ti),outputs:Wo(ti).optional(),onramps:Wo(Ei).optional(),offramps:Wo(Ei).optional(),features:Wo(zi).optional()});qo(ni,Bo({fiats:Wo(ei),tokens:Wo(Qr)})),Bo({providers:qo(to(),Wo(ci))});const Oi=to().superRefine(((e,t)=>{e.startsWith("mailto:")?0===e.slice(7).trim().length&&t.addIssue({code:_r,message:"mailto address must not be empty"}):e.startsWith("tel:")?0===e.slice(4).trim().length&&t.addIssue({code:_r,message:"tel address must not be empty"}):t.addIssue({code:_r,message:"AddressUrl must use either mailto: or tel: scheme"})})),xi=Bo({includes:Wo(to()).optional(),excludes:Wo(to()).optional()}),Ti=Qo(["pending","accepted","declined","cancelled"]),Ii=to();class Ai{}Ai.MAX_REV_SHARE_PCT="2.5";const Si=Zr.refine((e=>Number(e)>0&&Number(e)<=Number(Ai.MAX_REV_SHARE_PCT)),{message:`Percentage must be between 0 and ${Ai.MAX_REV_SHARE_PCT}`}),Ni=Bo({gas_fee_subsidization:Zr.optional()}),$i=so(),Pi=so(),Ri=so();Bo({name:to().trim().min(1)}),Bo({id:$i,name:to()}),Bo({label:to(),perms:xi}),Bo({label:to(),public_key:to(),secret_key:to()}),Bo({public_key:to(),label:to().optional(),perms:xi.optional()}),Bo({public_key:to()}),Wo(Bo({label:to().nullable(),public_key:to(),perms:xi,created_at:jr})),Bo({user_id:Ri.optional()}),Wo(Bo({org_id:$i,user_id:Ri,created_at:jr,updated_at:jr,perms:xi,user_address:Oi})),Bo({user_id:Ri,perms:xi}),Bo({user_id:Ri}),Wo(Bo({id:$i,name:to(),created_at:jr}));const Di=to().transform(((t,n)=>{const[o,r]=t.split("_");if(!r||!o)return n.addIssue({code:"custom",message:"Pagination key must contain org_id and iso_timestamp separated by '_'"}),e;const i=$i.safeParse(o);if(!i.success)return n.addIssue({code:"custom",message:"Invalid org_id in pagination key"}),e;const s=new Date(r);return isNaN(s.getTime())?(n.addIssue({code:"custom",message:"Invalid ISO timestamp in pagination key"}),e):{timestamp:s,org_id:i.data}}));Bo({limit:function(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...k(t)})}(Oo,e)}().int().positive().default(25),pagination_key:Di.optional()}),Bo({orgs:Wo(Bo({id:$i,name:to(),membership:Bo({user_id:Ri,user_address:Oi,member_since:jr,updated_at:jr,effective_permissions:Wo(Bo({key:to(),description:to()}))})})),next_pagination_key:to().nullable()}),Bo({invitee_address:to(),perms:xi}),Bo({statuses:Ti.array().optional()}),Bo({statuses:Ti.array().optional()}),Wo(Bo({id:Pi,org_id:$i,org_name:to(),inviter:to(),invitee_address:Oi,status:Ti,created_at:jr,updated_at:jr})),Bo({id:Pi,status:Ti}),Bo({id:Pi}),Bo({user_id:Ri}),Bo({id:$i}),Bo({name:to().trim().min(1).optional()}).refine((e=>Object.keys(e).length>0),{message:"At least one field must be provided"}),Bo({name:to(),percentage:Si,preferred_tokens:Wo(Qr),addresses:Dr.partial(),allow_arbitrary:So()}),Bo({name:to(),percentage:Si.optional(),preferred_tokens:Wo(Qr).optional(),addresses:Dr.partial().optional(),allow_arbitrary:So().optional()}),Bo({id:so(),org_id:$i,name:to(),percentage:Mr,preferred_tokens:Wo(Qr),addresses:Dr.partial(),allow_arbitrary:So(),created_by:to(),created_at:jr,updated_at:jr}),Bo({name:to().optional()}),Bo({name:to()}),Bo({name:to(),percentage:Mr,preferred_tokens:Wo(Qr),addresses:Dr.partial(),allow_arbitrary:So()}),Bo({org_id:$i,credit:Fr,sandbox:So()}),Bo({org_id:$i,features:Wo(Ii)}),Bo({org_id:$i,config:Ni}),Bo({id:$i,name:to(),created_at:jr,features:Wo(Ii),config:Ni.optional()}),Bo({fiat:ei,tokens:Wo(Qr)}),Bo({spw_address:to(),chains:Wo(Xr).optional()});const Ci=Bo({chain:Xr,counterfactual_exists:So()});Bo({workflow_id:to(),chain_infos:Wo(Ci)}).nullable(),Bo({workflow_ids:Wo(so()).optional(),verification_code:to()});const Mi=yi.extend({amount:Mr}),Zi=_i.extend({consume:Wo(Mi),produce:Wo(Mi)}),Li=Mi.extend({tx_id:to().optional()}),Fi=Bo({consume:Wo(Li),produce:Wo(Li)}),Ui=Vo([tr("COMPLETE"),tr("UNREACHABLE"),tr("FAILED")]),Wi=Vo([tr("PENDING"),tr("ATTEMPT_FAILED")]),ji=Vo([Ui,Wi]),Bi=Bo({service_ids:Wo(to()),latency_seconds:xo(),issues:ir(Wo(pi))}),Hi=Vo([tr("PENDING"),tr("COMPLETE"),tr("FAILED"),tr("EXPIRED")]),Vi=Vo([...Hi.options,tr("WITHDRAWN"),tr("TAINTED"),tr("UNCONFIRMED"),tr("WITHDRAW_PENDING")]),Ji=Bo({total_fees:to(),conversion_fees:to(),network_fees:to(),business_fees:to(),currency_symbol:ei}),Gi=Bo({kind:tr("FIXED_INPUT"),fixed_input_amount:ii,output_asset:ti,custom_actions:Do().optional(),dest_address:Rr.optional()}),Ki=Bo({type:Qo(["ONRAMP","ONCHAIN_STEP","USER_FUND"]),net_effect:Zi,pieces_info:Wo(wi),step_index:xo().optional(),custom_actions_input_amount:Mr.optional()}),Yi=Ki,qi=Vo([ji]),Xi=Ki.extend({status:qi,net_effect:Fi,transaction_hash:to().optional()}),Qi=Bo({request:Go("kind",[Gi]),price_currency:ei,onramps:Wo(Ei).optional(),onramp_methods:Wo(ci).optional(),customer_ip_address:qr.optional(),customer_id:to().optional(),label:to().max(255).optional(),parent_payment_id:so().optional(),features:Wo(zi).optional(),rev_share_name:to().optional(),allow_unsafe_transfer_out:So().optional(),show_all_issues:So().optional(),allow_exceed_max_input_limit:So().optional(),allow_unsafe_slippage:So().optional(),use_intent_refund:So().optional(),hops:Wo(to()).optional()});Bo({input:ei,output:ti,customer_ip_address:qr.optional(),features:Wo(zi).optional()}),Bo({customer_ip_address:qr.optional()}),Bo({alpha3_country_code:Yr,state_code:Vo([Gr,tr("")]),default_currency:to().optional()});const es=Bo({fees:Ji.optional(),output_amount:ii.optional(),onramp:Ei.optional(),onramp_method:ci.optional()}),ts=es.extend({route:Wo(Xi)}),ns=es.extend({fees:Ji,output_amount:ii,route:Wo(Yi),latency_seconds:xo().optional()});Bo({quote_request:Qi,quotes:Wo(ns.extend({payment_id:to()})),current_prices:ri,price_currency:ei,state_token:to(),quoted_at:jr,accept_by:jr,fault:pi.nullable(),failures:Wo(Bi),limits:Wo(ai)});const os=to().transform(((t,n)=>{const[o,r]=t.split("_");if(!r||!o)return n.addIssue({code:_r,message:"Pagination key must contain workflow_id and iso_timestamp separated by '_'"}),e;const i=new Date(r);return isNaN(i.getTime())?(n.addIssue({code:_r,message:"Invalid ISO timestamp in pagination key"}),e):36!==o.length?(n.addIssue({code:_r,message:"Invalid workflow_id in pagination key"}),e):{timestamp:i,workflow_id:o}})),rs=Qo(["ALL","NEW_OR_FUNDED"]);Bo({id_query:to().optional(),pagination_key:os.optional(),dest_address:Rr.optional(),owner_address:Rr.optional(),limit:Wr.default(25),category:rs.default("NEW_OR_FUNDED"),label:to().optional()}).extend({owner_address:Rr});const is=Qo(["intent","spw"]),ss=Qo(["INTENT","SPW"]),as=Qo(["EIP712","EIP191"]);Bo({workflow_id:so(),token_amounts:Wo(si),recipient_address:Rr,accept_blame:Lr.optional().default(!0),account_type:is.optional(),withdraw_account:ss.optional()}),Go("type",[Bo({type:tr("eip712"),signature_type:as,workflow_id:to(),payload:to(),state_token:to()}),Bo({type:tr("erc191"),signature_type:as,workflow_id:to(),payload:to(),state_token:to()})]),Bo({workflow_id:so(),token_amounts:Wo(si),recipient_address:Rr,accept_blame:Lr.optional().default(!0),signature:Hr,payload:to().optional(),account_type:is.optional(),withdraw_account:ss.optional(),polling_timeout:xo().int().nonnegative().max(3e5).optional().default(3e5)}),Bo({signature:Hr,state_token:to(),polling_timeout:xo().int().nonnegative().max(3e5).optional().default(3e5)}),Bo({workflow_id:to(),tx_id:Ur}),Bo({payment_id:so(),state_token:to(),owner_chain:Xr.optional(),owner_address:Rr,destination_address:Rr}),Qo(["OWNER_VERIFY","SIMULATE_WITHDRAWAL"]);const cs=Qo(["EVM_OWNER","EVM_WITHDRAWAL"]),ds=Go("type",[Bo({type:tr("ONRAMP"),payment_id:to(),funding_page_url:Vr,deposit_info:Wo(Bo({deposit_token:Qr,deposit_amount:Mr,deposit_address:Rr,deposit_chain:Xr}))}),Bo({type:tr("TRANSFER_IN"),payment_id:to(),funding_page_url:Vr,deposit_info:Wo(Bo({deposit_token:Qr,deposit_amount:Mr,deposit_address:Rr,deposit_chain:Xr}))}),Bo({type:tr("USER_VERIFY"),verification_token:to(),verifications:Wo(Bo({reason:cs,signature_type:as,payload:to()}))})]),us=Bo({status:Vo([tr("PENDING"),tr("SUCCESS"),tr("FAILED"),tr("EXPIRED")]),token_amounts:Wo(si),recipient_address:to(),transaction_hash:to().nullable(),issues:Wo(pi).nullable()}),ls=Bo({payment_id:to(),org_id:$i,status:Vi,funded:So(),created_at:jr,updated_at:jr,initiate_fund_by:jr,completed_at:jr.optional(),quote_request:Qi.optional(),quoted:ns,fulfilled:ts,current_prices:ri,price_currency:ei,customer_id:to().optional(),label:to().optional(),processing_addresses:Wo(Bo({chain:to(),address:Rr})),owner_chain:Xr,owner_address:Rr,destination_address:Rr,next_instruction:ds.optional(),issues:Wo(pi).optional(),withdrawals:Wo(us).nullable(),parent_payment_id:so().optional(),client_redirect_url:Jr.nullable()});Bo({payment_statuses:Wo(ls),next_pagination_key:to().nullable()});const ps=Qo(["COMPLETED","FUNDED"]);Vo([Bo({payment_id:so(),state_token:to(),owner_chain:Xr.optional(),owner_address:Rr,destination_address:Rr,client_redirect_url:Jr.optional(),client_redirect_after:ps.optional().default("COMPLETED"),allow_unsafe_owner:So().optional(),simulate_withdrawal:So().optional(),payment_expiration_minutes:xo().int().positive().max(60).optional()}),Bo({verification_token:to(),signatures:Wo(Bo({reason:cs,signature:to()}))})]),Vo([ls,Bo({next_instruction:ds})]),Bo({payment_id:so(),enable_withdraw_pending:So().optional()}),Bo({payment_id:so(),redirect_url:Vr,referrer_domain:Vr.optional()}),Bo({funding_page_onramp_url:Vr,client_secret:to().optional(),client_redirect_url:Jr.nullable(),onramp_redirect_url:Jr}),Bo({payment_id:so(),token_amounts:Wo(si),recipient_address:Rr,account_type:is.optional(),withdraw_account:ss.optional()}),Go("type",[Bo({type:tr("eip712"),signature_type:as,payment_id:to(),withdraw_authorization:to(),state_token:to()}),Bo({type:tr("erc191"),signature_type:as,payment_id:to(),withdraw_authorization:to(),state_token:to()})]),Bo({payment_id:so(),token_amounts:Wo(si),recipient_address:Rr,owner_signature:Hr,payload:to().optional(),account_type:is.optional(),withdraw_account:ss.optional(),polling_timeout:xo().int().nonnegative().max(3e5).optional().default(3e5)}),Bo({signature:Hr,state_token:to(),polling_timeout:xo().int().nonnegative().max(3e5).optional().default(3e5)}),Bo({payment_id:to(),status:Vo([tr("SUCCESS"),tr("PENDING")]),transaction_hash:Ur.nullable()}),Bo({payment_id:so().optional(),custom_queries:Wo(Bo({address:Rr,token:Qr})).optional(),near_queries:Wo(Bo({address:Rr,token:Qr})).optional()});const fs=Bo({address:Rr,token:Qr,account:is,withdraw_account:ss.default("SPW"),value:Vo([Bo({kind:tr("amount"),amount:Mr,withdrawal_fee:Mr.nullable()}),Bo({kind:tr("error")})])});Bo({balance_results:Wo(fs)});const ms=qo(to(),Do()).nullable(),hs=Bo({domain:qo(to(),Do()),types:qo(to(),Wo(Bo({name:to(),type:to()}))),primaryType:to(),message:qo(to(),Do())});Bo({owner_address:Rr,typed_data:hs,signature:Hr,login:ms.optional()}),Bo({}),Bo({address:Rr}),Bo({verified:So(),login:Wo(to()).nullable()}).nullable();const gs=to().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),ys=Bo({issuer:to(),name:to(),alias:to().optional(),symbol:to(),decimals:xo(),sign:to().optional()}),_s=to(),vs=to().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),ws=xo().min(0).max(18),bs=to().url(),Es=to(),zs=Bo({chain:to(),address:kr}),ks=Bo({chain:tr("solana"),address:xr}),Os=Bo({chain:to(),address:to()}),xs=Vo([zs,ks,Os]),Ts=to().refine((e=>{const[t,n]=e.split(":");return xs.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),Is=Bo({name:_s,symbol:vs,decimals:ws,alias:vs.optional(),image_url:bs.optional(),coingecko_id:Es.optional(),wrapper:vs.optional(),is_native:So().optional()}),As=Vo([zs.extend(Is.shape),ks.extend(Is.shape),Os.extend(Is.shape)]);Vo([Ts,gs]),Vo([As,ys]),Go("type",[Bo({type:tr("chain"),chain:to()}),Bo({type:tr("issuer"),issuer:to()})]),yr((e=>"string"==typeof e?e.toUpperCase():e),Qo(["ONRAMP","OFFRAMP"])),Bo({to:Or,from:Or.optional(),nonce:xo().optional(),gasLimit:$o().optional(),gasPrice:$o().optional(),maxPriorityFeePerGas:$o().optional(),maxFeePerGas:$o().optional(),data:to().optional(),value:$o().optional(),chainId:xo()}),Bo({transactionHash:to().optional(),blockHash:to().optional(),blockNumber:xo().optional(),from:Or.optional(),to:Or.optional(),rawReceipt:Do()});const Ss=Bo({chain_id:$o(),network:to(),address_family:function(e){return function(e,t){return new e({type:"undefined",...k(t)})}(Po,e)}(),explorer:co().optional(),image:co().optional(),is_testnet:So()});Go("address_family",[Ss.extend({address_family:tr("EVM"),native_currency:Bo({name:to(),symbol:to(),decimals:xo()}),rpc:to().optional()}),Ss.extend({address_family:tr("SOL")}),Ss]),Qo(["EMBED","MODAL"]);const Ns=Qo(["SQUARE","DEFAULT"]),$s=Qo(["BLUR","OFF"]),Ps=to().refine((e=>/^(#[0-9A-Fa-f]{3,8}|rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\)|rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3}(\s*,\s*(0(\.\d+)?|1(\.0+)?))\))$/.test(e)),{message:"Invalid CSS color value"}),Rs=to().refine((e=>/^\d*\.?\d+px$/.test(e)),{message:"Invalid CSS font size value. Expected a number followed by px (e.g. '16px')."});to().refine((e=>/^\d*\.?\d+(px|rem)$/.test(e)),{message:"Invalid CSS border radius value. Expected a number followed by px or rem (e.g. '8px', '0.5rem')."});const Ds=Bo({primaryColor:Ps.optional(),backgroundColor:Ps.optional(),borderColor:Ps.optional(),textColor:Ps.optional(),textSecondaryColor:Ps.optional(),accentColor:Ps.optional(),borderStyle:Ns.optional(),successColor:Ps.optional(),alertColor:Ps.optional(),zIndex:xo().int().optional(),componentShadow:to().optional(),backgroundStyle:$s.optional()}),Cs=Do(),Ms=Qo(["haffer","wudoo-mono","inter"]),Zs=to().optional(),Ls=Bo({address:Rr,signMessage:Do().refine((e=>"function"==typeof e)).optional(),sendTransaction:Do().refine((e=>"function"==typeof e)).optional(),signTypedData:Do().refine((e=>"function"==typeof e)).optional()}),Fs=Bo({apiKey:to().nonempty(),outputs:ki.shape.outputs,sandbox:So().optional().default(!1),customStyles:Ds.optional(),targetElementId:to().optional(),fontName:Ms.optional(),headerTitle:Zs.optional(),userWalletFunderDisplay:Qo(["SHOW","HIDE"]).optional(),statusCallback:Do().refine((e=>"function"==typeof e)).optional(),owner:Ls.optional(),funder:Ls.optional(),userWallet:Ls.extend({connect:Do().refine((e=>"function"==typeof e)).optional()}).optional(),destinationAddress:Rr.optional(),onReady:Do().refine((e=>"function"==typeof e||void 0===e)).optional(),onError:Do().refine((e=>"function"==typeof e||void 0===e)).optional()}),Us=Fs,Ws=Fs.omit({owner:!0,funder:!0,userWallet:!0,statusCallback:!0}),js=to().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),Bs=qo(to(),So()),Hs=Bo({dangerouslyOverrideHallidayDomainName:co().optional(),dangerouslyOverrideApiBaseUrl:js.optional(),dangerouslyOverrideIPAddress:qr.optional(),dangerouslyOverrideFeatureFlags:Bs.optional(),dangerouslyOverrideOnramps:ki.shape.onramps,dangerouslyOverrideOfframps:ki.shape.offramps,dangerouslyOverrideInputs:ki.shape.inputs,dangerouslyOverrideFeatures:ki.shape.features,dangerouslyOverrideHops:Wo(to()).optional()}),Vs=Qo(["FULL","MODAL","OVERLAY","EMBED"]),Js=Bo({appMode:Vs.optional(),apiBaseUrl:js.optional(),hasOwner:So(),hasTxHandler:So(),hasConnect:So().optional().default(!1),hostOrigin:co().nullable(),ipAddress:qr.optional(),featureFlags:Bs.optional(),ownerAddress:Rr.optional(),funderAddress:Rr.optional(),onramps:ki.shape.onramps,offramps:ki.shape.offramps,inputs:ki.shape.inputs,features:ki.shape.features,hops:Wo(to()).optional()}),Gs=Bo({...Ws.shape,...Js.shape});var Ks,Ys;exports.MessageType=void 0,(Ks=exports.MessageType||(exports.MessageType={})).ACTION_TRANSACTION="ACTION_TRANSACTION",Ks.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",Ks.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",Ks.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",Ks.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",Ks.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA",Ks.ACTION_TRIGGER_CONNECT="ACTION_TRIGGER_CONNECT",Ks.EVENT_RESIZE="EVENT_RESIZE",exports.WidgetLoadFailureReason=void 0,(Ys=exports.WidgetLoadFailureReason||(exports.WidgetLoadFailureReason={})).CSP_BLOCKED="CSP_BLOCKED",Ys.NETWORK_FAILURE="NETWORK_FAILURE",Ys.IFRAME_REMOVED="IFRAME_REMOVED",Ys.RESOURCE_BLOCKED="RESOURCE_BLOCKED",Ys.UNKNOWN="UNKNOWN";class qs extends Error{constructor(e,t,n){super(e),this.name="WidgetLoadError",this.reason=t,this.diagnostics=n,Object.setPrototypeOf(this,qs.prototype)}static isWidgetLoadError(e){return e instanceof qs}}const Xs=e=>{const t=Gs.parse(e);return btoa(JSON.stringify(t))},Qs=e=>{const{windowOrigin:t=vr,...n}=e;return`${t}/payments/quote?data=${Xs(n)}`},ea=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let r=1;r<=3;r++)try{const o=await fetch(`${t}/quotes/status?workflow_id=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){if(o=e instanceof Error?e:new Error(String(e)),3===r)throw o;const t=1e3*Math.pow(2,r);await new Promise((e=>setTimeout(e,t)))}throw o},ta=e=>{e instanceof Zn?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},na={isPreloaded:!1,iframe:null,iframeLoadMonitor:null,resizeHandler:null,lastKnownHeight:null,lastParamHash:null,lastMergedConfig:null,windowOrigin:null,pendingUpdateParams:null,widgetWindow:null,providerWindow:null,messageHandlers:[]};let oa={...na};const ra=()=>oa,ia=()=>oa.isPreloaded,sa=()=>oa.lastMergedConfig,aa=()=>oa.windowOrigin,ca=e=>{oa={...oa,...e}},da=e=>Object.fromEntries(Object.entries(e).filter((([,e])=>"function"!=typeof e)).map((([e,t])=>[e,null===t||"object"!=typeof t||Array.isArray(t)?t:da(t)]))),ua=(e,t,n)=>{const{owner:o,funder:r,userWallet:i}=e,s=o?.signTypedData,a=r?.sendTransaction||o?.sendTransaction,c=o?.address,d=r?.address,u=Rr.safeParse(c).success&&"function"==typeof s,l=Rr.safeParse(d).success&&"function"==typeof a,p="function"==typeof i?.connect;let f=null,m="FULL";try{"MODAL"===t?m=(()=>{if("undefined"==typeof navigator)return!1;const e=navigator;let t=!1;e.userAgentData&&"boolean"==typeof e.userAgentData.mobile&&(t=e.userAgentData.mobile);const n=navigator.userAgent||navigator.vendor||window.opera||"";return t||/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile|tablet/i.test(n)})()?"OVERLAY":"MODAL":"EMBED"===t&&(m="EMBED"),f=window.origin}catch{}return{hasOwner:u,hasTxHandler:l,hasConnect:p,appMode:m,ownerAddress:c,funderAddress:d,hostOrigin:f}},la="halliday-payments-widget",pa=e=>{const{iframe:t,expectedOrigin:n,onError:o}=e;let r=!1,i=!1,s=!1,a=!1,c=null;const d=Date.now(),u=()=>{const e=document.contains(t);let n=!1;try{const e=t.src.split("?")[0]??"";if(e&&"undefined"!=typeof performance&&"function"==typeof performance.getEntriesByType){n=performance.getEntriesByType("resource").some((t=>t.name.startsWith(e)))}}catch{}return{onloadFired:s,cspViolationDetected:a,cspBlockedURI:c,iframeInDOM:e,resourceTimingEntryExists:n,elapsedMs:Date.now()-d}},l=e=>{const t=u(),o=((e,t,n)=>{switch(e){case exports.WidgetLoadFailureReason.CSP_BLOCKED:return`Widget load failed: Content Security Policy blocked the widget URL. Add '${t}' to your frame-src or child-src CSP directive. Blocked URI: ${n.cspBlockedURI}`;case exports.WidgetLoadFailureReason.NETWORK_FAILURE:return`Widget load failed: the request to '${t}' was made but did not complete. This may indicate DNS resolution failure, server unavailability, or a network connectivity issue.`;case exports.WidgetLoadFailureReason.IFRAME_REMOVED:return"Widget load failed: iframe was removed from the DOM. This commonly happens with SPA routers, HMR, or cleanup code that removes the iframe before the widget finishes loading.";case exports.WidgetLoadFailureReason.RESOURCE_BLOCKED:return`Widget load failed: the iframe request was blocked before reaching the network. This is commonly caused by ad blockers, privacy extensions, or corporate proxy/firewall rules that block requests to '${t}'.`;case exports.WidgetLoadFailureReason.UNKNOWN:return`Widget load failed: unable to determine the specific reason. Diagnostics: onload=${n.onloadFired}, inDOM=${n.iframeInDOM}, resourceEntry=${n.resourceTimingEntryExists}, csp=${n.cspViolationDetected}`}})(e,n,t);return new qs(o,e,t)},p=e=>{if(i||r)return;i=!0;const t=l(e);g(),o(t)},f=e=>{e.blockedURI&&e.blockedURI.startsWith(n)&&(a=!0,c=e.blockedURI,p(exports.WidgetLoadFailureReason.CSP_BLOCKED))};document.addEventListener("securitypolicyviolation",f);let m=null;try{"undefined"!=typeof MutationObserver&&t.parentElement&&(m=new MutationObserver((e=>{try{for(const n of e)for(let e=0;e<n.removedNodes.length;e++)if(n.removedNodes[e]===t)return void p(exports.WidgetLoadFailureReason.IFRAME_REMOVED)}catch{}})),m.observe(t.parentElement,{childList:!0}))}catch{}const h=()=>{s=!0};t.addEventListener("load",h);const g=()=>{r||(r=!0,document.removeEventListener("securitypolicyviolation",f),t.removeEventListener("load",h),m?.disconnect())};return{destroy:g,diagnose:()=>{if(i)return null;const e=u();return e.iframeInDOM?e.cspViolationDetected?l(exports.WidgetLoadFailureReason.CSP_BLOCKED):e.onloadFired||e.resourceTimingEntryExists?!e.onloadFired&&e.resourceTimingEntryExists?l(exports.WidgetLoadFailureReason.NETWORK_FAILURE):null:l(exports.WidgetLoadFailureReason.RESOURCE_BLOCKED):l(exports.WidgetLoadFailureReason.IFRAME_REMOVED)}}},fa=()=>{const e=document.getElementById("halliday-payments-skeleton");e&&(e.style.opacity="0",setTimeout((()=>e.remove()),300))},ma=()=>{ra().messageHandlers.forEach((e=>{window.removeEventListener("message",e)})),ca({messageHandlers:[]})},ha=e=>{const{getContentWindow:t,windowOrigin:n,providerWindowRef:o,hasOwner:r,hasTxHandler:i,signMessage:s,signTypedData:a,sendTransaction:c,connect:d,statusCallback:u,apiKey:l,apiBaseUrl:p,onReady:f}=e;ma();const m=[],h=e=>{const n=t();return null!==n&&e.source===n};var g;f&&m.push((e=>{if(e.origin!==n)return;if(!h(e))return;const{type:t}=e.data||{};"WIDGET_READY"!==t&&"HALLIDAY_READY"!==t||f()})),m.push((t=>{if(t.origin!==n||!h(t))return;const{type:o}=t.data||{};o===exports.MessageType.EVENT_WINDOW_CLOSE&&e.onClose?.()})),r&&m.push((async e=>{if(e.origin!==n||!h(e))return;const{type:o,payload:r}=e.data||{},i=t();if(o===exports.MessageType.ACTION_SIGN_MESSAGE){const{messageId:e,message:t,ownerAddress:a}=r;try{const r="function"==typeof s?await s({message:t,...void 0!==a&&{ownerAddress:a}}):(()=>{throw new Error("No signMessage function provided")})();i?.postMessage({type:o,payload:{messageId:e,signature:r}},n)}catch(t){console.error("Error signing message",t),i?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},n)}}else if(o===exports.MessageType.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:t,ownerAddress:s}=r;try{const r="function"==typeof a?await a({typedData:t,...void 0!==s&&{ownerAddress:s}}):(()=>{throw new Error("No signTypedData function provided")})();i?.postMessage({type:o,payload:{messageId:e,signature:r}},n)}catch(t){console.error("Error signing typed data",t),i?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},n)}}})),i&&m.push((async e=>{if(e.origin!==n||!h(e))return;const{type:o,payload:r}=e.data||{},i=t();if(o===exports.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")})();i?.postMessage({type:o,payload:{messageId:e,txReceipt:r}},n)}catch(t){console.error("Error handling transaction",t),i?.postMessage({type:o,payload:{messageId:e,error:t instanceof Error?t.message:t}},n)}}})),d&&m.push((e=>{if(e.origin!==n||!h(e))return;const{type:t}=e.data||{};t===exports.MessageType.ACTION_TRIGGER_CONNECT&&d()})),u&&m.push((e=>{if(e.origin!==n||!h(e))return;const{type:t,payload:o}=e.data||{};t===exports.MessageType.EVENT_ORDER_STATUS&&u({type:t,payload:o})})),m.push((async e=>{if(e.origin!==n||!h(e))return;const{type:r,payload:i}=e.data||{},s=t();if(r===exports.MessageType.ACTION_PROVIDER_WIDGET&&s){const{url:e,redirectUrl:t,providerWidgetMode:n,workflowId:r}=i||{};if(!(e&&t&&n&&r))return;let a=null;"REDIRECT"===n?(s.location=e,a=s):"POPUP"===n&&(o.current=(e=>{const t=window.innerWidth/2-210;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=420 height=638`)})(e),a=o.current),a&&(await(async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await ea({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const r=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),i=r?.status;if("COMPLETE"===i)break;await new Promise((e=>setTimeout(e,5e3)))}})({apiKey:l,baseURL:p,workflowId:r,window:a}),a.closed||("REDIRECT"===n?s.location=t:"POPUP"===n&&(o.current?.close(),o.current=null)))}})),(g=m).forEach((e=>{window.addEventListener("message",e)})),ca({messageHandlers:g})},ga=(e,t,n)=>{const o=da(t);e?.postMessage({type:"HALLIDAY_UPDATE_PARAMS",payload:o},n)},ya=(e,t)=>{setTimeout((()=>{const n=ra().widgetWindow??e?.contentWindow;n?.postMessage({type:"HALLIDAY_SHOW"},t)}),10)},_a=new WeakMap,va=(e,t)=>{const n=e.windowType||"MODAL",o=e.windowOrigin||"",r=e.customStyles?.zIndex,i=ra().iframe;return"POPUP"===n?(e=>{const t=ra().widgetWindow;return!t||t.closed?null:(t.focus(),ya(null,e),t)})(o):i?"EMBED"===n?((e,t)=>{const{targetElementId:n,windowOrigin:o,zIndex:r}=t;if(_a.has(e))return e.style.visibility="visible",e.style.opacity="1",e.style.pointerEvents="auto",e.style.zIndex=String(r??1),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),window.dispatchEvent(new Event("resize")),ya(e,o),e.contentWindow;if(!n)return console.error("[HallidayPayments] EMBED mode requires targetElementId in openHallidayPayments"),null;const i=document.getElementById(n);if(!i)return console.error(`[HallidayPayments] Target element '${n}' not found`),null;const s=ra();let a=document.getElementById("halliday-payments-wrapper")||document.getElementById("halliday-payments-placeholder");a||(a=document.createElement("div"),a.id="halliday-payments-placeholder",a.style.cssText=`\n width: 420px;\n max-width: 100%;\n height: ${s.lastKnownHeight||400}px;\n `,i.appendChild(a));const c=()=>{const t=a.getBoundingClientRect();e.style.position="fixed",e.style.top=t.top+"px",e.style.left=t.left+"px",e.style.width=t.width+"px",e.style.height=t.height+"px",e.style.border="none",e.style.zIndex=String(r??1)};a.offsetHeight,requestAnimationFrame((()=>{requestAnimationFrame((()=>{c(),e.style.visibility="visible",e.style.opacity="1",e.style.pointerEvents="auto"}))}));const d=new ResizeObserver((()=>{c()}));d.observe(a);const u=()=>c();window.addEventListener("scroll",u,!0);const l=()=>c();window.addEventListener("resize",l),_a.set(e,(()=>{d.disconnect(),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",l),a?.remove()}));const p=t=>{if(t.origin!==o)return;if(t.source!==e.contentWindow)return;const{type:n,payload:r}=t.data||{};n===exports.MessageType.EVENT_RESIZE&&r&&void 0!==r.height&&a&&(ca({lastKnownHeight:r.height}),a.style.height=r.height+"px",c())};return window.addEventListener("message",p),ca({resizeHandler:p}),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),ia()&&fa(),ya(e,o),e.contentWindow})(i,{targetElementId:e.targetElementId,windowOrigin:o,...void 0!==r&&{zIndex:r}}):(((e,t,n)=>{e.style.cssText=`\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n border: none;\n z-index: ${n??1e4};\n `,e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),e.setAttribute("scrolling","no"),e.parentElement!==document.body&&document.body.appendChild(e),ya(e,t)})(i,o,r),i.contentWindow):null},wa=()=>{if((()=>{const{iframe:e,widgetWindow:t}=ra();return t&&t!==e?.contentWindow?!t.closed:!!e&&"true"!==e.getAttribute("aria-hidden")})())return;const e=sa()??{};va({windowType:e.windowType,targetElementId:e.targetElementId,windowOrigin:aa()??"",customStyles:e.customStyles})},ba=()=>{const e=ra(),t=e.widgetWindow;if(t&&t!==e.iframe?.contentWindow)return t.closed||t.close(),void ca({widgetWindow:null});const n=e.iframe;n&&(n.style.visibility="hidden",n.style.opacity="0",n.style.pointerEvents="none",n.style.zIndex="-1",n.setAttribute("aria-hidden","true"),n.setAttribute("tabindex","-1"))},Ea=()=>{const e=ra(),t=e.widgetWindow;t&&t!==e.iframe?.contentWindow&&(t.closed||t.close(),ca({widgetWindow:null})),e.resizeHandler&&(window.removeEventListener("message",e.resizeHandler),ca({resizeHandler:null}));const n=e.iframe;n&&(_a.get(n)?.(),_a.delete(n)),(()=>{const e=[la,"halliday-payments-placeholder","halliday-payments-skeleton","halliday-payments-preload","halliday-payments-modal","halliday-payments-embed"];for(const t of e){const e=document.getElementById(t);e&&e.remove()}})();const o=document.getElementById("halliday-payments-wrapper");o&&o.remove()},za="halliday-payments-config-error",ka=(e,t,n)=>{const o=document.getElementById(t);if(!o)return;let r=document.getElementById("halliday-payments-wrapper");r||(r=document.createElement("div"),r.id="halliday-payments-wrapper",r.style.cssText="\n position: relative;\n width: 420px;\n max-width: 100%;\n display: block;\n ",o.appendChild(r));const i=document.createElement("div");i.id=za,i.style.cssText=`\n width: 100%;\n background: #fff;\n border: 1px solid #fca5a5;\n border-radius: 12px;\n padding: 16px;\n box-sizing: border-box;\n z-index: ${n?.zIndex??1};\n `,i.innerHTML=e,r.appendChild(i)},Oa=(e,t)=>{const n=document.createElement("div");n.id=za,n.style.cssText=`\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: ${t?.zIndex??1e4};\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.5);\n `;const o=document.createElement("div");o.style.cssText="\n width: 420px;\n max-width: 90%;\n background: #fff;\n border: 1px solid #fca5a5;\n border-radius: 12px;\n padding: 16px;\n box-sizing: border-box;\n ",o.innerHTML=e,n.appendChild(o),document.body.appendChild(n)},xa=()=>{const e=document.getElementById(za);e&&e.remove()},Ta=(e,t,{show:n=!1}={})=>{const o="function"==typeof e?.onError?e.onError:void 0;let r,i;try{const n=(e=>{try{return Us.parse(e)}catch(e){throw ta(e),e}})(e);r=(e=>{const{userWallet:t}=e,n={...e};return t?(n.destinationAddress||(n.destinationAddress=t.address),n.owner||!t.signMessage&&!t.signTypedData||(n.owner={address:t.address,...t.signMessage?{signMessage:t.signMessage}:{},...t.signTypedData?{signTypedData:t.signTypedData}:{}}),!n.funder&&t.sendTransaction&&(n.funder={address:t.address,sendTransaction:t.sendTransaction}),n):n})(n),i=(e=>{try{return Hs.parse(e)}catch(e){throw ta(e),e}})((e=>e[999]||e[0]||{})(t))}catch(t){const n=t instanceof Error?t.message:String(t);throw((e,t)=>{xa();const{targetElementId:n,windowType:o,customStyles:r}=t,i="EMBED"===o&&n;if("POPUP"===o)return;const s=`\n <pre style="\n font-size: 13px;\n color: #dc2626;\n line-height: 1.5;\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n ">${a=e,a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}</pre>\n `;var a;i?ka(s,n,r):Oa(s,r)})(n,{targetElementId:e?.targetElementId,customStyles:e?.customStyles}),o&&o(t instanceof Error?t:new Error(n)),t}try{const e=r.targetElementId?"EMBED":"MODAL",t=(i.dangerouslyOverrideHallidayDomainName||vr).replace(/\/$/,"");ca({windowOrigin:t});const{hasOwner:o,hasTxHandler:c,hasConnect:d,appMode:u,ownerAddress:l,funderAddress:p,hostOrigin:f}=ua(r,e),m={...r,sandbox:r.sandbox||!1,hasOwner:o,hasTxHandler:c,hasConnect:d,windowOrigin:t,appMode:u,ownerAddress:l,funderAddress:p,hostOrigin:f,apiBaseUrl:i.dangerouslyOverrideApiBaseUrl,ipAddress:i.dangerouslyOverrideIPAddress,featureFlags:i.dangerouslyOverrideFeatureFlags,onramps:i.dangerouslyOverrideOnramps,offramps:i.dangerouslyOverrideOfframps,inputs:i.dangerouslyOverrideInputs,features:i.dangerouslyOverrideFeatures,hops:i.dangerouslyOverrideHops},h=Qs(m),{iframe:g,reused:y}=(e=>{const t=new URL(e).origin,n=ra(),o=document.getElementById(la);if(o&&n.iframe){try{if(new URL(o.src).origin===t)return{iframe:o,reused:!0}}catch{}o.remove()}const r=document.createElement("iframe");return r.id=la,r.src=e,r.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 ",r.setAttribute("aria-hidden","true"),r.setAttribute("tabindex","-1"),document.body.appendChild(r),{iframe:r,reused:!1}})(h),_=()=>g?.contentWindow??null,v=(e=>{const t={...oa.lastMergedConfig??{},...e};return oa.lastMergedConfig=t,t})({...r,...i,hasOwner:o,hasTxHandler:c,hasConnect:d,appMode:u,ownerAddress:l,funderAddress:p,hostOrigin:f}),w=(e=>{const t=Object.entries(e).filter((([,e])=>"function"!=typeof e)).sort((([e],[t])=>e.localeCompare(t)));return JSON.stringify(t)})(v),b=(a=w,oa.lastParamHash!==a);if(y&&!b&&!n)return void(ia()&&r.onReady&&r.onReady());if(s=w,oa.lastParamHash=s,y&&b&&(ia()?ga(_(),v,t):ca({pendingUpdateParams:{config:v,windowOrigin:t}})),!y&&g){ca({iframe:g,isPreloaded:!1});const e=pa({iframe:g,expectedOrigin:t,onError:e=>{const t=sa()?.onError;t?.(e)}});ca({iframeLoadMonitor:e}),g.onerror=()=>{const t=e.diagnose()??new qs("Widget load failed",exports.WidgetLoadFailureReason.UNKNOWN,{onloadFired:!1,cspViolationDetected:!1,cspBlockedURI:null,iframeInDOM:!0,resourceTimingEntryExists:!1,elapsedMs:0}),n=sa()?.onError;n?.(t)}}if(ha({getContentWindow:_,windowOrigin:t,providerWindowRef:{get current(){return oa.providerWindow},set current(e){oa.providerWindow=e}},hasOwner:o,hasTxHandler:c,signMessage:r.owner?.signMessage,signTypedData:r.owner?.signTypedData,sendTransaction:r.funder?.sendTransaction||r.owner?.sendTransaction,connect:r.userWallet?.connect,statusCallback:r.statusCallback,apiKey:r.apiKey,apiBaseUrl:i.dangerouslyOverrideApiBaseUrl||"https://v2.prod.halliday.xyz",onReady:()=>{ca({isPreloaded:!0}),ra().iframeLoadMonitor?.destroy(),ca({iframeLoadMonitor:null}),fa();const e=ra().pendingUpdateParams;e&&(ga(_(),e.config,e.windowOrigin),ca({pendingUpdateParams:null})),r.onReady?.()},onError:r.onError,onClose:ba}),n){const n=va({windowType:e,targetElementId:r.targetElementId,windowOrigin:t,customStyles:r.customStyles});n&&ca({widgetWindow:n})}y&&ia()&&r.onReady&&r.onReady()}catch(e){throw o&&o(e instanceof Error?e:new Error(String(e))),e}var s,a};function Ia(e,t){try{if(!ia())throw new Error(`Client not preloaded. Call initializeClient() and wait for onReady before opening "${e}".`);const n=aa()??"",o=oa.widgetWindow??oa.iframe?.contentWindow??null;ga(o,{targetView:e,...t},n),setTimeout(wa,500)}catch(e){throw ta(e),e}}exports.AppMode=Vs,exports.BackgroundStyle=$s,exports.BorderStyle=Ns,exports.CssFontSize=Rs,exports.CustomStyles=Ds,exports.FontName=Ms,exports.HeaderTitle=Zs,exports.OrderStatus=Cs,exports.PaymentsWidgetQueryParams=Gs,exports.PaymentsWidgetSDKParams=Us,exports.WidgetLoadError=qs,exports.deserializeQueryParams=e=>Gs.parse(JSON.parse(atob(e))),exports.destroyClient=()=>{ma(),Ea(),oa.iframeLoadMonitor?.destroy(),oa={...na,messageHandlers:[]}},exports.getPaymentsWidgetUrl=Qs,exports.initializeClient=(e,...t)=>{try{Ta(e,t)}catch(e){throw ta(e),e}},exports.openActivity=function(){Ia("history")},exports.openHallidayPayments=function(e,...t){try{const n=e.targetElementId,o=n?"EMBED":"MODAL",r=e.customStyles?.backgroundColor;if("EMBED"===o&&n){const t=document.getElementById(n);t&&!ia()&&((e,t,n)=>{const o=document.getElementById("halliday-payments-skeleton");o&&o.remove(),e.style&&(e.style.position="relative");let r=document.getElementById("halliday-payments-wrapper");r||(r=document.createElement("div"),r.id="halliday-payments-wrapper",r.style.cssText="\n position: relative;\n width: 420px;\n max-width: 100%;\n display: block;\n ",e.appendChild(r));const i=t||"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",s=document.createElement("div");if(s.id="halliday-payments-skeleton",s.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: ${n?.zIndex??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{}r.appendChild(s)})(t,r,e.customStyles)}Ta(e,t,{show:!0})}catch(e){throw fa(),ta(e),e}},exports.serializeQueryParams=Xs;
2
2
  //# sourceMappingURL=index.cjs.min.js.map