@halliday-sdk/payments 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,11 @@ declare const TextMode: z.ZodEnum<{
53
53
  ALL_UPPERCASE: "ALL_UPPERCASE";
54
54
  }>;
55
55
  type TextMode = z.infer<typeof TextMode>;
56
+ declare const FontWeight: z.ZodEnum<{
57
+ AUTO: "AUTO";
58
+ MEDIUM: "MEDIUM";
59
+ }>;
60
+ type FontWeight = z.infer<typeof FontWeight>;
56
61
  declare const PaymentCategoryGrouping: z.ZodEnum<{
57
62
  ATTACHED: "ATTACHED";
58
63
  BUTTON: "BUTTON";
@@ -82,6 +87,10 @@ declare const CustomStyles: z.ZodObject<{
82
87
  ATTACHED: "ATTACHED";
83
88
  BUTTON: "BUTTON";
84
89
  }>>;
90
+ fontWeight: z.ZodOptional<z.ZodEnum<{
91
+ AUTO: "AUTO";
92
+ MEDIUM: "MEDIUM";
93
+ }>>;
85
94
  logo: z.ZodOptional<z.ZodObject<{
86
95
  src: z.ZodURL;
87
96
  alt: z.ZodString;
@@ -94,8 +103,11 @@ declare const OrderStatus: z.ZodAny;
94
103
  type OrderStatus = z.infer<typeof OrderStatus>;
95
104
  declare const PaymentCategoryOrder: z.ZodArray<z.ZodEnum<{
96
105
  wallet: "wallet";
106
+ "open-wallet": "open-wallet";
97
107
  exchange: "exchange";
108
+ "open-exchange": "open-exchange";
98
109
  cash: "cash";
110
+ "open-cash": "open-cash";
99
111
  }>>;
100
112
  type PaymentCategoryOrder = z.infer<typeof PaymentCategoryOrder>;
101
113
  declare const FontName: z.ZodEnum<{
@@ -103,6 +115,8 @@ declare const FontName: z.ZodEnum<{
103
115
  "wudoo-mono": "wudoo-mono";
104
116
  }>;
105
117
  type FontName = z.infer<typeof FontName>;
118
+ declare const HeaderTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
119
+ type HeaderTitle = z.infer<typeof HeaderTitle>;
106
120
  type SignMessage = (input: {
107
121
  message: string;
108
122
  ownerAddress?: Address;
@@ -126,13 +140,13 @@ declare const PaymentsWidgetSDKParamsWithoutRolesAndFunctions: z.ZodObject<{
126
140
  onramps: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
127
141
  offramps: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
128
142
  sandbox: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
129
- inputs: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
130
- outputs: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
131
143
  features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
132
144
  BETA_EDGES: "BETA_EDGES";
133
145
  ORG_BETA_EDGES: "ORG_BETA_EDGES";
134
146
  ORG_EDGES: "ORG_EDGES";
135
147
  }>>>;
148
+ inputs: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
149
+ outputs: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
136
150
  apiKey: z.ZodString;
137
151
  destinationAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
138
152
  widgetVersion: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
@@ -158,6 +172,10 @@ declare const PaymentsWidgetSDKParamsWithoutRolesAndFunctions: z.ZodObject<{
158
172
  ATTACHED: "ATTACHED";
159
173
  BUTTON: "BUTTON";
160
174
  }>>;
175
+ fontWeight: z.ZodOptional<z.ZodEnum<{
176
+ AUTO: "AUTO";
177
+ MEDIUM: "MEDIUM";
178
+ }>>;
161
179
  logo: z.ZodOptional<z.ZodObject<{
162
180
  src: z.ZodURL;
163
181
  alt: z.ZodString;
@@ -179,13 +197,17 @@ declare const PaymentsWidgetSDKParamsWithoutRolesAndFunctions: z.ZodObject<{
179
197
  }, z.core.$strip>>;
180
198
  paymentCategoryOrder: z.ZodOptional<z.ZodArray<z.ZodEnum<{
181
199
  wallet: "wallet";
200
+ "open-wallet": "open-wallet";
182
201
  exchange: "exchange";
202
+ "open-exchange": "open-exchange";
183
203
  cash: "cash";
204
+ "open-cash": "open-cash";
184
205
  }>>>;
185
206
  fontName: z.ZodOptional<z.ZodEnum<{
186
207
  haffer: "haffer";
187
208
  "wudoo-mono": "wudoo-mono";
188
209
  }>>;
210
+ headerTitle: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
189
211
  }, z.core.$strip>;
190
212
  declare const PaymentsWidgetSDKParams: z.ZodObject<{
191
213
  customStyles: z.ZodOptional<z.ZodObject<{
@@ -207,6 +229,10 @@ declare const PaymentsWidgetSDKParams: z.ZodObject<{
207
229
  ATTACHED: "ATTACHED";
208
230
  BUTTON: "BUTTON";
209
231
  }>>;
232
+ fontWeight: z.ZodOptional<z.ZodEnum<{
233
+ AUTO: "AUTO";
234
+ MEDIUM: "MEDIUM";
235
+ }>>;
210
236
  logo: z.ZodOptional<z.ZodObject<{
211
237
  src: z.ZodURL;
212
238
  alt: z.ZodString;
@@ -246,13 +272,17 @@ declare const PaymentsWidgetSDKParams: z.ZodObject<{
246
272
  }>>>;
247
273
  paymentCategoryOrder: z.ZodOptional<z.ZodArray<z.ZodEnum<{
248
274
  wallet: "wallet";
275
+ "open-wallet": "open-wallet";
249
276
  exchange: "exchange";
277
+ "open-exchange": "open-exchange";
250
278
  cash: "cash";
279
+ "open-cash": "open-cash";
251
280
  }>>>;
252
281
  fontName: z.ZodOptional<z.ZodEnum<{
253
282
  haffer: "haffer";
254
283
  "wudoo-mono": "wudoo-mono";
255
284
  }>>;
285
+ headerTitle: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
256
286
  onramps: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
257
287
  offramps: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
258
288
  sandbox: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -275,6 +305,7 @@ type PaymentsWidgetSDKParams = z.input<typeof PaymentsWidgetSDKParamsWithoutRole
275
305
  statusCallback?: StatusCallback;
276
306
  };
277
307
  declare const AppMode: z.ZodEnum<{
308
+ EMBED: "EMBED";
278
309
  MODAL: "MODAL";
279
310
  FULL: "FULL";
280
311
  OVERLAY: "OVERLAY";
@@ -284,6 +315,7 @@ declare const PaymentsWidgetQueryParams: z.ZodObject<{
284
315
  ownerAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
285
316
  funderAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
286
317
  appMode: z.ZodOptional<z.ZodEnum<{
318
+ EMBED: "EMBED";
287
319
  MODAL: "MODAL";
288
320
  FULL: "FULL";
289
321
  OVERLAY: "OVERLAY";
@@ -297,13 +329,13 @@ declare const PaymentsWidgetQueryParams: z.ZodObject<{
297
329
  onramps: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
298
330
  offramps: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
299
331
  sandbox: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
300
- inputs: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
301
- outputs: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
302
332
  features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
303
333
  BETA_EDGES: "BETA_EDGES";
304
334
  ORG_BETA_EDGES: "ORG_BETA_EDGES";
305
335
  ORG_EDGES: "ORG_EDGES";
306
336
  }>>>;
337
+ inputs: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
338
+ outputs: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
307
339
  apiKey: z.ZodString;
308
340
  destinationAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
309
341
  widgetVersion: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
@@ -329,6 +361,10 @@ declare const PaymentsWidgetQueryParams: z.ZodObject<{
329
361
  ATTACHED: "ATTACHED";
330
362
  BUTTON: "BUTTON";
331
363
  }>>;
364
+ fontWeight: z.ZodOptional<z.ZodEnum<{
365
+ AUTO: "AUTO";
366
+ MEDIUM: "MEDIUM";
367
+ }>>;
332
368
  logo: z.ZodOptional<z.ZodObject<{
333
369
  src: z.ZodURL;
334
370
  alt: z.ZodString;
@@ -350,13 +386,17 @@ declare const PaymentsWidgetQueryParams: z.ZodObject<{
350
386
  }, z.core.$strip>>;
351
387
  paymentCategoryOrder: z.ZodOptional<z.ZodArray<z.ZodEnum<{
352
388
  wallet: "wallet";
389
+ "open-wallet": "open-wallet";
353
390
  exchange: "exchange";
391
+ "open-exchange": "open-exchange";
354
392
  cash: "cash";
393
+ "open-cash": "open-cash";
355
394
  }>>>;
356
395
  fontName: z.ZodOptional<z.ZodEnum<{
357
396
  haffer: "haffer";
358
397
  "wudoo-mono": "wudoo-mono";
359
398
  }>>;
399
+ headerTitle: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
360
400
  }, z.core.$strip>;
361
401
  type PaymentsWidgetQueryParams = z.infer<typeof PaymentsWidgetQueryParams>;
362
402
  declare enum MessageType {
@@ -365,7 +405,8 @@ declare enum MessageType {
365
405
  EVENT_WINDOW_CLOSE = "EVENT_WINDOW_CLOSE",
366
406
  ACTION_SIGN_MESSAGE = "ACTION_SIGN_MESSAGE",
367
407
  ACTION_PROVIDER_WIDGET = "ACTION_PROVIDER_WIDGET",
368
- ACTION_SIGN_TYPED_DATA = "ACTION_SIGN_TYPED_DATA"
408
+ ACTION_SIGN_TYPED_DATA = "ACTION_SIGN_TYPED_DATA",
409
+ EVENT_RESIZE = "EVENT_RESIZE"
369
410
  }
370
411
  type Message = {
371
412
  type: MessageType.ACTION_TRANSACTION;
@@ -402,6 +443,12 @@ type Message = {
402
443
  messageId: string;
403
444
  ownerAddress?: Address;
404
445
  };
446
+ } | {
447
+ type: MessageType.EVENT_RESIZE;
448
+ payload: {
449
+ width?: number;
450
+ height?: number;
451
+ };
405
452
  };
406
453
  type MessageResponse = {
407
454
  type: MessageType.ACTION_TRANSACTION;
@@ -462,6 +509,7 @@ type MessageResponse = {
462
509
  * @param {Role=} params.funder {{@link Role}} (optional) The funder that initiates the funding.
463
510
  * @param {PaymentCategoryOrder=} params.paymentCategoryOrder {{@link PaymentCategoryOrder}} (optional) On the quote page, these are three displayed paymentcategories (empty or three elements).
464
511
  * @param {FontName=} params.fontName {{@link FontName}} (optional) The font name to use in the widget (haffer or wudoo-mono). Defaults to haffer.
512
+ * @param {HeaderTitle=} params.headerTitle {{@link HeaderTitle}} (optional) The header title to use in the widget (Buy or string). Defaults to Buy.
465
513
  *
466
514
  * @param {StatusCallback=} params.statusCallback {{@link StatusCallback}} (optional) Callback to receive status events.
467
515
  */
@@ -491,5 +539,5 @@ declare const getPaymentsWidgetUrl: (params: PaymentsWidgetQueryParams & {
491
539
  windowOrigin?: string;
492
540
  }) => string;
493
541
 
494
- export { AppMode, BorderStyle, CustomStyles, FontName, MessageType, OrderStatus, PaymentCategoryGrouping, PaymentCategoryOrder, PaymentsWidgetQueryParams, PaymentsWidgetSDKParams, TextMode, WindowType, deserializeQueryParams, getPaymentsWidgetUrl, openHallidayPayments, serializeQueryParams };
542
+ export { AppMode, BorderStyle, CustomStyles, FontName, FontWeight, HeaderTitle, MessageType, OrderStatus, PaymentCategoryGrouping, PaymentCategoryOrder, PaymentsWidgetQueryParams, PaymentsWidgetSDKParams, TextMode, WindowType, deserializeQueryParams, getPaymentsWidgetUrl, openHallidayPayments, serializeQueryParams };
495
543
  export type { Message, MessageResponse };
@@ -1,2 +1,2 @@
1
- const e="https://app.halliday.xyz",t=/^[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 n(e,t,n){function o(n,o){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in s.prototype)Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=o}const i=n?.Parent??Object;class r extends i{}function s(e){var t;const i=n?.Parent?new r:this;o(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class o extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const i={};function r(e){return i}function s(e,t){return"bigint"==typeof t?t.toString():t}function a(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function u(e){return null==e}function c(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function d(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function l(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let o=0;o<e;o++)n+=t[Math.floor(26*Math.random())];return n}function f(e){return JSON.stringify(e)}function h(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const m=a((()=>{try{return new Function(""),!0}catch(e){return!1}}));function _(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}const v=new Set(["string","number","symbol"]);function g(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function w(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const z={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function b(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n].continue)return!0;return!1}function k(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function E(e){return"string"==typeof e?e:e?.message}function I(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const i=E(e.inst?._zod.def?.error?.(e))??E(t?.error?.(e))??E(n.customError?.(e))??E(n.localeError?.(e))??"Invalid input";o.message=i}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function A(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function $(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const T=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,s,2),enumerable:!0})},O=n("$ZodError",T),x=n("$ZodError",T,{Parent:Error});const N=e=>(t,n,i,s)=>{const a=i?Object.assign(i,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new o;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map((e=>I(e,a,r()))));throw Error.captureStackTrace(t,s?.callee),t}return u.value},P=e=>async(t,n,o,i)=>{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(i?.Err??e)(a.issues.map((e=>I(e,s,r()))));throw Error.captureStackTrace(t,i?.callee),t}return a.value},Z=e=>(t,n,i)=>{const s=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new o;return a.issues.length?{success:!1,error:new(e??O)(a.issues.map((e=>I(e,s,r()))))}:{success:!0,data:a.value}},S=Z(x),D=e=>async(t,n,o)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map((e=>I(e,i,r()))))}:{success:!0,data:s.value}},R=D(x),C=/^[cC][^\s-]{8,}$/,U=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L=/^[0-9a-vA-V]{20}$/,j=/^[A-Za-z0-9]{27}$/,M=/^[a-zA-Z0-9_-]{21}$/,V=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,W=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,G=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const H=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,q=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Y=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,K=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,J=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,X=/^[A-Za-z0-9_-]*$/,Q=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,ee=/^\+(?:[0-9]){6,14}[0-9]$/,te="((\\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])))",ne=new RegExp(`^${te}$`);function oe(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}const ie=/^\d+n?$/,re=/^\d+$/,se=/^-?\d+(?:\.\d+)?/i,ae=/true|false/i,ue=/^[^A-Z]*$/,ce=/^[^a-z]*$/,de=n("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),le={number:"number",bigint:"bigint",object:"date"},pe=n("$ZodCheckLessThan",((e,t)=>{de.init(e,t);const n=le[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),fe=n("$ZodCheckGreaterThan",((e,t)=>{de.init(e,t);const n=le[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),he=n("$ZodCheckMultipleOf",((e,t)=>{de.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),me=n("$ZodCheckNumberFormat",((e,t)=>{de.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[i,r]=z[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=r,n&&(o.pattern=re)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>r&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}})),_e=n("$ZodCheckMaxLength",((e,t)=>{de.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=A(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}})),ve=n("$ZodCheckMinLength",((e,t)=>{de.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=A(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}})),ge=n("$ZodCheckLengthEquals",((e,t)=>{de.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const r=A(o),s=i>t.length;n.issues.push({origin:r,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:n.value,inst:e,continue:!t.abort})}})),ye=n("$ZodCheckStringFormat",((e,t)=>{var n;de.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),(n=e._zod).check??(n.check=n=>{if(!t.pattern)throw new Error("Not implemented.");t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})})})),we=n("$ZodCheckRegex",((e,t)=>{ye.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=n("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=ue),ye.init(e,t)})),be=n("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=ce),ye.init(e,t)})),ke=n("$ZodCheckIncludes",((e,t)=>{de.init(e,t);const n=g(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})}})),Ee=n("$ZodCheckStartsWith",((e,t)=>{de.init(e,t);const n=new RegExp(`^${g(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),Ie=n("$ZodCheckEndsWith",((e,t)=>{de.init(e,t);const n=new RegExp(`.*${g(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),Ae=n("$ZodCheckOverwrite",((e,t)=>{de.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class $e{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),o=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const Te={major:4,minor:0,patch:0},Oe=n("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.id=t.type+"_"+p(10),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Te;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let i,r=b(e);for(const s of t){if(s._zod.when){if(!s._zod.when(e))continue}else if(r)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new o;if(i||a instanceof Promise)i=(i??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(r||(r=b(e,t)))}));else{if(e.issues.length===t)continue;r||(r=b(e,t))}}return i?i.then((()=>e)):e};e._zod.run=(n,r)=>{const s=e._zod.parse(n,r);if(s instanceof Promise){if(!1===r.async)throw new o;return s.then((e=>t(e,i,r)))}return t(s,i,r)}}e["~standard"]={validate:t=>{try{const n=S(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return R(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),xe=n("$ZodString",((e,t)=>{var n;Oe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Ne=n("$ZodStringFormat",((e,t)=>{ye.init(e,t),xe.init(e,t)})),Pe=n("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=W),Ne.init(e,t)})),Ze=n("$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=B(e))}else t.pattern??(t.pattern=B());Ne.init(e,t)})),Se=n("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=G),Ne.init(e,t)})),De=n("$ZodURL",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{try{const o=new URL(n.value);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Q.source,input:n.value,inst:e})),void(t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e})))}catch(t){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e})}}})),Re=n("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ne.init(e,t)})),Ce=n("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=M),Ne.init(e,t)})),Ue=n("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=C),Ne.init(e,t)})),Fe=n("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=U),Ne.init(e,t)})),Le=n("$ZodULID",((e,t)=>{t.pattern??(t.pattern=F),Ne.init(e,t)})),je=n("$ZodXID",((e,t)=>{t.pattern??(t.pattern=L),Ne.init(e,t)})),Me=n("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=j),Ne.init(e,t)})),Ve=n("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){let t=`${te}T${oe(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}(t)),Ne.init(e,t)})),We=n("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=ne),Ne.init(e,t)})),Be=n("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${oe(t)}$`)),Ne.init(e,t)})),Ge=n("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=V),Ne.init(e,t)})),He=n("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=H),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),qe=n("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=q),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e})}}})),Ye=n("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=Y),Ne.init(e,t)})),Ke=n("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=K),Ne.init(e,t),e._zod.check=t=>{const[n,o]=t.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e})}}}));function Je(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xe=n("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=J),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=t=>{Je(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e})}}));const Qe=n("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=X),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=t=>{(function(e){if(!X.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Je(t.padEnd(4*Math.ceil(t.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e})}})),et=n("$ZodE164",((e,t)=>{t.pattern??(t.pattern=ee),Ne.init(e,t)}));const tt=n("$ZodJWT",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n,i=JSON.parse(atob(o));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e})}})),nt=n("$ZodNumber",((e,t)=>{Oe.init(e,t),e._zod.pattern=e._zod.bag.pattern??se,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const r="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...r?{received:r}:{}}),n}})),ot=n("$ZodNumber",((e,t)=>{me.init(e,t),nt.init(e,t)})),it=n("$ZodBoolean",((e,t)=>{Oe.init(e,t),e._zod.pattern=ae,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}})),rt=n("$ZodBigInt",((e,t)=>{Oe.init(e,t),e._zod.pattern=ie,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}const{value:i}=n;return"bigint"==typeof i||n.issues.push({expected:"bigint",code:"invalid_type",input:i,inst:e}),n}})),st=n("$ZodAny",((e,t)=>{Oe.init(e,t),e._zod.parse=e=>e})),at=n("$ZodUnknown",((e,t)=>{Oe.init(e,t),e._zod.parse=e=>e})),ut=n("$ZodNever",((e,t)=>{Oe.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function ct(e,t,n){e.issues.length&&t.issues.push(...k(n,e.issues)),t.value[n]=e.value}const dt=n("$ZodArray",((e,t)=>{Oe.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const r=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?r.push(a.then((t=>ct(t,n,e)))):ct(a,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function lt(e,t,n){e.issues.length&&t.issues.push(...k(n,e.issues)),t.value[n]=e.value}function pt(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...k(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const ft=n("$ZodObject",((e,t)=>{Oe.init(e,t);const n=a((()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof Oe))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}));d(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n}));let o;const r=h,s=!i.jitless,u=s&&m.value,{catchall:c}=t;let l;e._zod.parse=(i,a)=>{l??(l=n.value);const d=i.value;if(!r(d))return i.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),i;const h=[];if(s&&u&&!1===a?.async&&!0!==a.jitless)o||(o=(e=>{const t=new $e(["shape","payload","ctx"]),{keys:o,optionalKeys:i}=n.value,r=e=>{const t=f(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);for(const e of o)s[e]=p(15);t.write("const newResult = {}");for(const e of o)if(i.has(e)){const n=s[e];t.write(`const ${n} = ${r(e)};`);const o=f(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=s[e];t.write(`const ${n} = ${r(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${f(e)}, ...iss.path] : [${f(e)}]\n })));`),t.write(`newResult[${f(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),i=o(i,a);else{i.value={};const e=l.shape;for(const t of l.keys){const n=e[t],o=n._zod.run({value:d[t],issues:[]},a),r="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?h.push(o.then((e=>r?pt(e,i,t,d):lt(e,i,t)))):r?pt(o,i,t,d):lt(o,i,t)}}if(!c)return h.length?Promise.all(h).then((()=>i)):i;const m=[],_=l.keySet,v=c._zod,g=v.def.type;for(const e of Object.keys(d)){if(_.has(e))continue;if("never"===g){m.push(e);continue}const t=v.run({value:d[e],issues:[]},a);t instanceof Promise?h.push(t.then((t=>lt(t,i,e)))):lt(t,i,e)}return m.length&&i.issues.push({code:"unrecognized_keys",keys:m,input:d,inst:e}),h.length?Promise.all(h).then((()=>i)):i}}));function ht(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>I(e,o,r())))))}),t}const mt=n("$ZodUnion",((e,t)=>{Oe.init(e,t),d(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),d(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>c(e.source))).join("|")})$`)}})),e._zod.parse=(n,o)=>{let i=!1;const r=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)r.push(t),i=!0;else{if(0===t.issues.length)return t;r.push(t)}}return i?Promise.all(r).then((t=>ht(t,n,e,o))):ht(r,n,e,o)}})),_t=n("$ZodDiscriminatedUnion",((e,t)=>{mt.init(e,t);const n=e._zod.parse;d(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=a((()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n}));e._zod.parse=(i,r)=>{const s=i.value;if(!h(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(i,r):t.unionFallback?n(i,r):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),i)}})),vt=n("$ZodIntersection",((e,t)=>{Oe.init(e,t),e._zod.parse=(e,n)=>{const{value:o}=e,i=t.left._zod.run({value:o,issues:[]},n),r=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||r instanceof Promise?Promise.all([i,r]).then((([t,n])=>yt(e,t,n))):yt(e,i,r)}}));function gt(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(_(e)&&_(t)){const n=Object.keys(t),o=Object.keys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of o){const o=gt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i[n]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const i=gt(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yt(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),b(e))return e;const o=gt(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const wt=n("$ZodRecord",((e,t)=>{Oe.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!_(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const s=[];if(t.keyType._zod.values){const r=t.keyType._zod.values;n.value={};for(const e of r)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const r=t.valueType._zod.run({value:i[e],issues:[]},o);r instanceof Promise?s.push(r.then((t=>{t.issues.length&&n.issues.push(...k(e,t.issues)),n.value[e]=t.value}))):(r.issues.length&&n.issues.push(...k(e,r.issues)),n.value[e]=r.value)}let a;for(const e in i)r.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map((e=>I(e,o,r()))),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:i[a],issues:[]},o);c instanceof Promise?s.push(c.then((e=>{e.issues.length&&n.issues.push(...k(a,e.issues)),n.value[u.value]=e.value}))):(c.issues.length&&n.issues.push(...k(a,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then((()=>n)):n}})),zt=n("$ZodEnum",((e,t)=>{Oe.init(e,t);const n=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter((e=>v.has(typeof e))).map((e=>"string"==typeof e?g(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return e._zod.values.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),bt=n("$ZodLiteral",((e,t)=>{Oe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?g(e):e?e.toString():String(e))).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}})),kt=n("$ZodTransform",((e,t)=>{Oe.init(e,t),e._zod.parse=(e,n)=>{const i=t.transform(e.value,e);if(n.async){return(i instanceof Promise?i:Promise.resolve(i)).then((t=>(e.value=t,e)))}if(i instanceof Promise)throw new o;return e.value=i,e}})),Et=n("$ZodOptional",((e,t)=>{Oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",d(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),d(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${c(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)})),It=n("$ZodNullable",((e,t)=>{Oe.init(e,t),d(e._zod,"optin",(()=>t.innerType._zod.optin)),d(e._zod,"optout",(()=>t.innerType._zod.optout)),d(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${c(e.source)}|null)$`):void 0})),d(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),At=n("$ZodDefault",((e,t)=>{Oe.init(e,t),e._zod.optin="optional",d(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>$t(e,t))):$t(o,t)}}));function $t(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tt=n("$ZodPrefault",((e,t)=>{Oe.init(e,t),e._zod.optin="optional",d(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Ot=n("$ZodNonOptional",((e,t)=>{Oe.init(e,t),d(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,o)=>{const i=t.innerType._zod.run(n,o);return i instanceof Promise?i.then((t=>xt(t,e))):xt(i,e)}}));function xt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nt=n("$ZodCatch",((e,t)=>{Oe.init(e,t),d(e._zod,"optin",(()=>t.innerType._zod.optin)),d(e._zod,"optout",(()=>t.innerType._zod.optout)),d(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>I(e,n,r())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>I(e,n,r())))},input:e.value}),e.issues=[]),e)}})),Pt=n("$ZodPipe",((e,t)=>{Oe.init(e,t),d(e._zod,"values",(()=>t.in._zod.values)),d(e._zod,"optin",(()=>t.in._zod.optin)),d(e._zod,"optout",(()=>t.out._zod.optout)),e._zod.parse=(e,n)=>{const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>Zt(e,t,n))):Zt(o,t,n)}}));function Zt(e,t,n){return b(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const St=n("$ZodReadonly",((e,t)=>{Oe.init(e,t),d(e._zod,"propValues",(()=>t.innerType._zod.propValues)),d(e._zod,"optin",(()=>t.innerType._zod.optin)),d(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(Dt):Dt(o)}}));function Dt(e){return e.value=Object.freeze(e.value),e}const Rt=n("$ZodCustom",((e,t)=>{de.init(e,t),Oe.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,i=t.fn(o);if(i instanceof Promise)return i.then((t=>Ct(t,n,o,e)));Ct(i,n,o,e)}}));function Ct(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push($(e))}}class Ut{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ft(){return new Ut}const Lt=Ft();function jt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Mt(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Vt(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Wt(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Bt(e,t){return new pe({check:"less_than",...w(t),value:e,inclusive:!1})}function Gt(e,t){return new pe({check:"less_than",...w(t),value:e,inclusive:!0})}function Ht(e,t){return new fe({check:"greater_than",...w(t),value:e,inclusive:!1})}function qt(e,t){return new fe({check:"greater_than",...w(t),value:e,inclusive:!0})}function Yt(e,t){return new he({check:"multiple_of",...w(t),value:e})}function Kt(e,t){return new _e({check:"max_length",...w(t),maximum:e})}function Jt(e,t){return new ve({check:"min_length",...w(t),minimum:e})}function Xt(e,t){return new ge({check:"length_equals",...w(t),length:e})}function Qt(e){return new Ae({check:"overwrite",tx:e})}const en=n("ZodISODateTime",((e,t)=>{Ve.init(e,t),wn.init(e,t)}));function tn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}(en,e)}const nn=n("ZodISODate",((e,t)=>{We.init(e,t),wn.init(e,t)}));function on(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}(nn,e)}const rn=n("ZodISOTime",((e,t)=>{Be.init(e,t),wn.init(e,t)}));function sn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}(rn,e)}const an=n("ZodISODuration",((e,t)=>{Ge.init(e,t),wn.init(e,t)}));function un(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}(an,e)}const cn=(e,t)=>{O.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},o={_errors:[]},i=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>i({issues:e})));else if("invalid_key"===t.code)i({issues:t.issues});else if("invalid_element"===t.code)i({issues:t.issues});else if(0===t.path.length)o._errors.push(n(t));else{let e=o,i=0;for(;i<t.path.length;){const o=t.path[i];i===t.path.length-1?(e[o]=e[o]||{_errors:[]},e[o]._errors.push(n(t))):e[o]=e[o]||{_errors:[]},e=e[o],i++}}};return i(e),o}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):o.push(t(i));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},dn=n("ZodError",cn),ln=n("ZodError",cn,{Parent:Error}),pn=N(ln),fn=P(ln),hn=Z(ln),mn=D(ln),_n=n("ZodType",((e,t)=>(Oe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>y(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>pn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>hn(e,t,n),e.parseAsync=async(t,n)=>fn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>mn(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...w(n)})}(xo,e,t)}(t,n)),e.superRefine=t=>e.check(function(e,t){const n=function(e,t){const n=new de({check:"custom",...w(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push($(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push($(o))}},e(t.value,t))),t);return n}(t)),e.overwrite=t=>e.check(Qt(t)),e.optional=()=>wo(e),e.nullable=()=>bo(e),e.nullish=()=>wo(bo(e)),e.nonoptional=t=>function(e,t){return new Io({type:"nonoptional",innerType:e,...w(t)})}(e,t),e.array=()=>no(e),e.or=t=>so([e,t]),e.and=t=>new co({type:"intersection",left:e,right:t}),e.transform=t=>To(e,go(t)),e.default=t=>{return n=t,new ko({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.prefault=t=>{return n=t,new Eo({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.catch=t=>{return new Ao({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>To(e,t),e.readonly=()=>new Oo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Lt.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Lt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Lt.get(e);const n=e.clone();return Lt.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),vn=n("_ZodString",((e,t)=>{xe.init(e,t),_n.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new we({check:"string_format",format:"regex",...w(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ke({check:"string_format",format:"includes",...w(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ee({check:"string_format",format:"starts_with",...w(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Ie({check:"string_format",format:"ends_with",...w(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Jt(...t)),e.max=(...t)=>e.check(Kt(...t)),e.length=(...t)=>e.check(Xt(...t)),e.nonempty=(...t)=>e.check(Jt(1,...t)),e.lowercase=t=>e.check(function(e){return new ze({check:"string_format",format:"lowercase",...w(e)})}(t)),e.uppercase=t=>e.check(function(e){return new be({check:"string_format",format:"uppercase",...w(e)})}(t)),e.trim=()=>e.check(Qt((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return Qt((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(Qt((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(Qt((e=>e.toUpperCase())))})),gn=n("ZodString",((e,t)=>{xe.init(e,t),vn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}(zn,t)),e.url=t=>e.check(Mt(En,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}(Ln,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}(An,t)),e.guid=t=>e.check(jt(bn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}(kn,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}(kn,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}(kn,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}(kn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}($n,t)),e.guid=t=>e.check(jt(bn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}(Tn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}(On,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}(xn,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}(Cn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}(Un,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}(Nn,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}(Pn,t)),e.ipv4=t=>e.check(Vt(Zn,t)),e.ipv6=t=>e.check(Wt(Sn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}(Dn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}(Rn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}(Fn,t)),e.datetime=t=>e.check(tn(t)),e.date=t=>e.check(on(t)),e.time=t=>e.check(sn(t)),e.duration=t=>e.check(un(t))}));function yn(e){return function(e,t){return new e({type:"string",...w(t)})}(gn,e)}const wn=n("ZodStringFormat",((e,t)=>{Ne.init(e,t),vn.init(e,t)})),zn=n("ZodEmail",((e,t)=>{Se.init(e,t),wn.init(e,t)})),bn=n("ZodGUID",((e,t)=>{Pe.init(e,t),wn.init(e,t)})),kn=n("ZodUUID",((e,t)=>{Ze.init(e,t),wn.init(e,t)})),En=n("ZodURL",((e,t)=>{De.init(e,t),wn.init(e,t)}));function In(e){return Mt(En,e)}const An=n("ZodEmoji",((e,t)=>{Re.init(e,t),wn.init(e,t)})),$n=n("ZodNanoID",((e,t)=>{Ce.init(e,t),wn.init(e,t)})),Tn=n("ZodCUID",((e,t)=>{Ue.init(e,t),wn.init(e,t)})),On=n("ZodCUID2",((e,t)=>{Fe.init(e,t),wn.init(e,t)})),xn=n("ZodULID",((e,t)=>{Le.init(e,t),wn.init(e,t)})),Nn=n("ZodXID",((e,t)=>{je.init(e,t),wn.init(e,t)})),Pn=n("ZodKSUID",((e,t)=>{Me.init(e,t),wn.init(e,t)})),Zn=n("ZodIPv4",((e,t)=>{He.init(e,t),wn.init(e,t)}));const Sn=n("ZodIPv6",((e,t)=>{qe.init(e,t),wn.init(e,t)}));const Dn=n("ZodCIDRv4",((e,t)=>{Ye.init(e,t),wn.init(e,t)})),Rn=n("ZodCIDRv6",((e,t)=>{Ke.init(e,t),wn.init(e,t)})),Cn=n("ZodBase64",((e,t)=>{Xe.init(e,t),wn.init(e,t)})),Un=n("ZodBase64URL",((e,t)=>{Qe.init(e,t),wn.init(e,t)})),Fn=n("ZodE164",((e,t)=>{et.init(e,t),wn.init(e,t)})),Ln=n("ZodJWT",((e,t)=>{tt.init(e,t),wn.init(e,t)})),jn=n("ZodNumber",((e,t)=>{nt.init(e,t),_n.init(e,t),e.gt=(t,n)=>e.check(Ht(t,n)),e.gte=(t,n)=>e.check(qt(t,n)),e.min=(t,n)=>e.check(qt(t,n)),e.lt=(t,n)=>e.check(Bt(t,n)),e.lte=(t,n)=>e.check(Gt(t,n)),e.max=(t,n)=>e.check(Gt(t,n)),e.int=t=>e.check(Wn(t)),e.safe=t=>e.check(Wn(t)),e.positive=t=>e.check(Ht(0,t)),e.nonnegative=t=>e.check(qt(0,t)),e.negative=t=>e.check(Bt(0,t)),e.nonpositive=t=>e.check(Gt(0,t)),e.multipleOf=(t,n)=>e.check(Yt(t,n)),e.step=(t,n)=>e.check(Yt(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 Mn(e){return function(e,t){return new e({type:"number",checks:[],...w(t)})}(jn,e)}const Vn=n("ZodNumberFormat",((e,t)=>{ot.init(e,t),jn.init(e,t)}));function Wn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}(Vn,e)}const Bn=n("ZodBoolean",((e,t)=>{it.init(e,t),_n.init(e,t)}));function Gn(e){return function(e,t){return new e({type:"boolean",...w(t)})}(Bn,e)}const Hn=n("ZodBigInt",((e,t)=>{rt.init(e,t),_n.init(e,t),e.gte=(t,n)=>e.check(qt(t,n)),e.min=(t,n)=>e.check(qt(t,n)),e.gt=(t,n)=>e.check(Ht(t,n)),e.gte=(t,n)=>e.check(qt(t,n)),e.min=(t,n)=>e.check(qt(t,n)),e.lt=(t,n)=>e.check(Bt(t,n)),e.lte=(t,n)=>e.check(Gt(t,n)),e.max=(t,n)=>e.check(Gt(t,n)),e.positive=t=>e.check(Ht(BigInt(0),t)),e.negative=t=>e.check(Bt(BigInt(0),t)),e.nonpositive=t=>e.check(Gt(BigInt(0),t)),e.nonnegative=t=>e.check(qt(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Yt(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function qn(e){return function(e,t){return new e({type:"bigint",...w(t)})}(Hn,e)}const Yn=n("ZodAny",((e,t)=>{st.init(e,t),_n.init(e,t)}));function Kn(){return new Yn({type:"any"})}const Jn=n("ZodUnknown",((e,t)=>{at.init(e,t),_n.init(e,t)}));function Xn(){return new Jn({type:"unknown"})}const Qn=n("ZodNever",((e,t)=>{ut.init(e,t),_n.init(e,t)}));function eo(e){return function(e,t){return new e({type:"never",...w(t)})}(Qn,e)}const to=n("ZodArray",((e,t)=>{dt.init(e,t),_n.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Jt(t,n)),e.nonempty=t=>e.check(Jt(1,t)),e.max=(t,n)=>e.check(Kt(t,n)),e.length=(t,n)=>e.check(Xt(t,n)),e.unwrap=()=>e.element}));function no(e,t){return function(e,t,n){return new e({type:"array",element:t,...w(n)})}(to,e,t)}const oo=n("ZodObject",((e,t)=>{ft.init(e,t),_n.init(e,t),d(e,"shape",(()=>Object.fromEntries(Object.entries(e._zod.def.shape)))),e.keyof=()=>ho(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Xn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Xn()}),e.strict=()=>e.clone({...e._zod.def,catchall:eo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return l(this,"shape",n),n},checks:[]};return y(e,n)}(e,t),e.merge=t=>{return o=t,y(n=e,{...n._zod.def,get shape(){const e={...n._zod.def.shape,...o._zod.def.shape};return l(this,"shape",e),e},catchall:o._zod.def.catchall,checks:[]});var n,o},e.pick=t=>function(e,t){const n={},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=o.shape[e])}return y(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.omit=t=>function(e,t){const n={...e._zod.def.shape},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return y(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)i[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return y(t,{...t._zod.def,shape:i,checks:[]})}(yo,e,t[0]),e.required=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)i[t]=new e({type:"nonoptional",innerType:o[t]});return y(t,{...t._zod.def,shape:i,checks:[]})}(Io,e,t[0])}));function io(e,t){const n={type:"object",get shape(){return l(this,"shape",{...e}),this.shape},...w(t)};return new oo(n)}const ro=n("ZodUnion",((e,t)=>{mt.init(e,t),_n.init(e,t),e.options=t.options}));function so(e,t){return new ro({type:"union",options:e,...w(t)})}const ao=n("ZodDiscriminatedUnion",((e,t)=>{ro.init(e,t),_t.init(e,t)}));function uo(e,t,n){return new ao({type:"union",options:t,discriminator:e,...w(n)})}const co=n("ZodIntersection",((e,t)=>{vt.init(e,t),_n.init(e,t)}));const lo=n("ZodRecord",((e,t)=>{wt.init(e,t),_n.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}));function po(e,t,n){return new lo({type:"record",keyType:e,valueType:t,...w(n)})}const fo=n("ZodEnum",((e,t)=>{zt.init(e,t),_n.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new fo({...t,checks:[],...w(o),entries:i})},e.exclude=(e,o)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new fo({...t,checks:[],...w(o),entries:i})}}));function ho(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new fo({type:"enum",entries:n,...w(t)})}const mo=n("ZodLiteral",((e,t)=>{bt.init(e,t),_n.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));function _o(e,t){return new mo({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}const vo=n("ZodTransform",((e,t)=>{kt.init(e,t),_n.init(e,t),e._zod.parse=(n,o)=>{n.addIssue=o=>{if("string"==typeof o)n.issues.push($(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),n.issues.push($(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n))):(n.value=i,n)}}));function go(e){return new vo({type:"transform",transform:e})}const yo=n("ZodOptional",((e,t)=>{Et.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function wo(e){return new yo({type:"optional",innerType:e})}const zo=n("ZodNullable",((e,t)=>{It.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function bo(e){return new zo({type:"nullable",innerType:e})}const ko=n("ZodDefault",((e,t)=>{At.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const Eo=n("ZodPrefault",((e,t)=>{Tt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Io=n("ZodNonOptional",((e,t)=>{Ot.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Ao=n("ZodCatch",((e,t)=>{Nt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const $o=n("ZodPipe",((e,t)=>{Pt.init(e,t),_n.init(e,t),e.in=t.in,e.out=t.out}));function To(e,t){return new $o({type:"pipe",in:e,out:t})}const Oo=n("ZodReadonly",((e,t)=>{St.init(e,t),_n.init(e,t)}));const xo=n("ZodCustom",((e,t)=>{Rt.init(e,t),_n.init(e,t)}));const No=yn().refine((e=>/^(0|[1-9]\d*)(\.\d+)?$/.test(e)),{message:"Invalid amount"}),Po=/^(0x|0x[a-fA-F0-9]{40})$/,Zo=yn().refine((e=>Po.test(e)),{message:"Invalid EVM token address"}),So=Zo.refine((e=>"0x"!==e),{message:"Invalid EVM address"}),Do=/^[1-9A-HJ-NP-Za-km-z]{32,44}$/,Ro=/^So[1-2]{41}$/,Co=yn().refine((e=>Do.test(e)||Ro.test(e)),{message:"Invalid Solana token address"}),Uo=so([So,yn().refine((e=>Do.test(e)),{message:"Invalid Solana address"})]),Fo=yn().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),Lo=io({issuer:yn(),name:yn(),alias:yn().optional(),symbol:yn(),decimals:Mn()}),jo=yn(),Mo=yn().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),Vo=Mn().min(0).max(18),Wo=yn().url(),Bo=yn(),Go=io({chain:yn(),address:Zo}),Ho=io({chain:_o("solana"),address:Co}),qo=io({chain:yn(),address:yn()}),Yo=so([Go,Ho,qo]),Ko=yn().refine((e=>{const[t,n]=e.split(":");return Yo.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),Jo=io({name:jo,symbol:Mo,decimals:Vo,alias:Mo.optional(),image_url:Wo.optional(),coingecko_id:Bo.optional(),wrapper:Mo.optional(),is_native:Gn().optional()}),Xo=so([Go.extend(Jo.shape),Ho.extend(Jo.shape),qo.extend(Jo.shape)]),Qo=so([Ko,Fo]);so([Xo,Lo]),uo("type",[io({type:_o("chain"),chain:yn()}),io({type:_o("issuer"),issuer:yn()})]);const ei=yn().transform((e=>e.toLowerCase()));var ti,ni;ti=e=>"string"==typeof e?e.toUpperCase():e,ni=ho(["ONRAMP","OFFRAMP"]),To(go(ti),ni),io({to:So,from:So.optional(),nonce:Mn().optional(),gasLimit:qn().optional(),gasPrice:qn().optional(),maxPriorityFeePerGas:qn().optional(),maxFeePerGas:qn().optional(),data:yn().optional(),value:qn().optional(),chainId:Mn()}),io({transactionHash:yn().optional(),blockHash:yn().optional(),blockNumber:Mn().optional(),from:So.optional(),to:So.optional(),rawReceipt:Kn()});so([io({chain_id:qn(),network:yn(),native_currency:io({name:yn(),symbol:yn(),decimals:Mn()}),rpc:yn(),image:yn(),is_testnet:Gn(),explorer:yn()}),io({chain_id:qn(),network:yn()})]);const oi=ho(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),ii=yn().refine((e=>t.test(e)),{message:"Invalid payment ID"}),ri=io({onramps:no(ei).optional(),offramps:no(ei).optional(),sandbox:Gn().optional().default(!1)}),si=ri.extend({inputs:no(Qo).optional(),outputs:no(Qo)});so([si,ri.extend({inputs:no(Qo),outputs:no(Qo).optional()})]);const ai=io({asset:Qo,amount:No}),ui=io({token:Ko,amount:No}),ci=yn(),di=so([Vt(Zn,li),function(e){return Wt(Sn,e)}()]);var li;const pi=ho(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]),fi=io({price_currency:Fo,onramps:no(ei).optional(),onramp_methods:no(oi).optional(),customer_ip_address:yn().optional(),customer_id:yn().optional(),parent_payment_id:ii.optional(),features:no(pi).optional()}),hi=uo("kind",[io({kind:_o("FIXED_INPUT"),fixed_input_amount:ai,output_asset:Qo})]),mi=fi.extend({request:hi}),_i=ho(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),vi=io({asset:Qo,property:ho(["APPROVAL","BALANCE"])}),gi=io({account:_i,resource:vi}),yi=so([_o("COMPLETE"),_o("UNREACHABLE"),_o("FAILED")]),wi=so([yi,_o("PENDING")]),zi=ho(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),bi=io({consume:no(gi),produce:no(gi)}),ki=gi.extend({amount:No}),Ei=bi.extend({consume:no(ki),produce:no(ki)}),Ii=po(Qo,yn()),Ai=uo("kind",[io({kind:so([_o("amount"),_o("amount-downstream")]),given:yn(),limits:io({min:yn().optional(),max:yn().optional()}),source:yn(),message:yn()}),io({kind:_o("geolocation"),message:yn()}),io({kind:_o("provider"),message:yn()}),io({kind:_o("other"),message:yn()}),io({kind:_o("unknown"),message:yn()})]),$i=io({service_ids:no(yn()),latency_seconds:Mn(),issues:no(Ai).optional()}),Ti=io({type:so([_o("USER_FUND"),_o("ONCHAIN_STEP"),_o("ONRAMP")]),net_effect:Ei,pieces_info:no(io({type:so([_o("onramp"),_o("poll"),_o("bridge"),_o("rev_share"),_o("transfer_out"),_o("convert")])})),step_index:Mn().optional()}),Oi=io({payment_id:yn(),output_amount:io({asset:Qo,amount:yn()}),onramp:ei.optional(),onramp_method:oi.optional(),fees:io({total_fees:yn(),conversion_fees:yn(),network_fees:yn(),business_fees:yn(),currency_symbol:Fo}),route:no(Ti)}),xi=Ti.extend({status:wi,transaction_hash:yn().optional()}),Ni=Oi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:no(xi)});io({quote_request:mi,quotes:no(Oi),current_prices:Ii,price_currency:Fo,state_token:yn(),quoted_at:yn(),accept_by:yn(),failures:no($i)}),io({payment_id:ii,state_token:yn(),owner_address:Uo,destination_address:Uo,client_redirect_url:yn().optional()});const Pi=io({deposit_token:Ko,deposit_chain:yn(),deposit_amount:No,deposit_address:Uo}),Zi=io({type:ho(["ONRAMP","TRANSFER_IN"]),payment_id:ii,funding_page_url:In(),deposit_info:no(Pi)}),Si=io({payment_id:ii,status:zi,funded:Gn(),created_at:yn(),updated_at:yn(),initiate_fund_by:yn(),completed_at:yn().optional(),quote_request:mi,quoted:Oi.omit({payment_id:!0}),fulfilled:Ni,current_prices:Ii,price_currency:Fo,customer_id:yn().optional(),processing_addresses:no(io({address:Uo,chain:yn()})),owner_address:Uo,destination_address:Uo,next_instruction:Zi.optional(),parent_payment_id:ii.optional()});io({payment_id:ii,redirect_url:yn().optional()}),io({funding_page_onramp_url:yn(),client_redirect_url:yn().optional(),client_secret:yn().optional()}),io({id_query:yn().optional(),pagination_key:yn().optional(),dest_address:Uo.optional(),owner_address:Uo.optional(),limit:Mn().int().positive().optional(),category:ho(["ALL","NEW_OR_FUNDED"]).optional()}),io({payment_statuses:no(Si),next_pagination_key:yn().nullable()}),io({payment_id:ii.optional(),custom_queries:no(io({address:Uo,token:so([Ko,Yo])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),io({balance_results:no(io({address:Uo,token:Ko,value:uo("kind",[io({kind:_o("amount"),amount:No}),io({kind:_o("error")})])}))}),io({fiat:Fo,tokens:no(Ko)});const Di=yn(),Ri=io({payment_id:ii,token_amounts:no(ui),recipient_address:Uo});io({payment_id:ii,withdraw_authorization:Di}),Ri.extend({owner_signature:ci}),io({payment_id:ii,transaction_hash:yn()});const Ci=ho(["EMBED","POPUP","MODAL"]),Ui=ho(["DEFAULT","ALL_UPPERCASE"]),Fi=ho(["ATTACHED","BUTTON"]),Li=ho(["SQUARE","DEFAULT"]),ji=yn().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"}),Mi=io({src:In(),alt:yn(),width:Mn().positive(),height:Mn().positive()}),Vi=io({primaryColor:ji.optional(),backgroundColor:ji.optional(),borderColor:ji.optional(),textColor:ji.optional(),textSecondaryColor:ji.optional(),accentColor:ji.optional(),borderStyle:Li.optional(),textMode:Ui.optional(),paymentCategoryGrouping:Fi.optional(),logo:Mi.optional()}),Wi=Kn(),Bi=no(ho(["wallet","exchange","cash"])),Gi=ho(["haffer","wudoo-mono"]),Hi=io({address:Uo,signMessage:Kn().refine((e=>"function"==typeof e)).optional(),sendTransaction:Kn().refine((e=>"function"==typeof e)).optional(),signTypedData:Kn().refine((e=>"function"==typeof e)).optional()}),qi=io({redirectUrl:In(),ctaText:yn(),secondaryRedirectUrl:In().optional(),secondaryCtaText:yn().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),Yi=io({apiKey:yn().nonempty(),destinationAddress:Uo.optional(),widgetVersion:ho(["1","2"]).default("2").optional(),...si.shape,customStyles:Vi.optional(),targetElementId:yn().optional(),windowType:Ci.default(Ci.enum.POPUP).optional(),redirects:qi.optional(),statusCallback:Kn().refine((e=>"function"==typeof e)).optional(),owner:Hi.optional(),funder:Hi.optional(),features:no(pi).optional(),paymentCategoryOrder:Bi.optional(),fontName:Gi.optional()}).refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),Ki=Yi.omit({owner:!0,funder:!0,statusCallback:!0}),Ji=yn().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),Xi=po(yn(),Gn()),Qi=io({dangerouslyOverrideHallidayDomainName:In().optional(),dangerouslyOverrideApiBaseUrl:Ji.optional(),dangerouslyOverrideIPAddress:di.optional(),dangerouslyOverrideFeatureFlags:Xi.optional()}),er=ho(["FULL","MODAL","OVERLAY"]),tr=io({appMode:er.optional(),apiBaseUrl:Ji.optional(),hasOwner:Gn(),hasTxHandler:Gn(),hostOrigin:In().nullable(),ipAddress:di.optional(),featureFlags:Xi.optional()}),nr=io({...Ki.shape,...tr.shape,ownerAddress:Uo.optional(),funderAddress:Uo.optional()});var or;!function(e){e.ACTION_TRANSACTION="ACTION_TRANSACTION",e.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",e.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",e.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",e.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",e.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA"}(or||(or={}));const ir=e=>{const t=nr.parse(e);return btoa(JSON.stringify(t))},rr=e=>nr.parse(JSON.parse(atob(e))),sr=t=>{const{windowOrigin:n=e,...o}=t,i=ir(o),r=o.widgetVersion;if(r)try{return`${n}/v${parseInt(r)}/payments/quote?data=${i}`}catch(e){console.error("Error parsing widget version",e)}return`${n}/payments/quote?data=${i}`},ar=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let i=1;i<=3;i++)try{const o=await fetch(`${t}/quotes/status?workflow_id=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){if(o=e instanceof Error?e:new Error(String(e)),3===i)throw o;const t=1e3*Math.pow(2,i);await new Promise((e=>setTimeout(e,t)))}throw o},ur=e=>{e instanceof dn?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},cr=(()=>{let t=null,n=null,o=[];const i=()=>{o.forEach((e=>{window.removeEventListener("message",e)})),o=[]};return{openWidget:async(r,...s)=>{const a=s[999]||{};let u,c;try{u=Yi.parse(r)}catch(e){throw ur(e),e}try{c=Qi.parse(a)}catch(e){throw ur(e),e}const{dangerouslyOverrideHallidayDomainName:d,dangerouslyOverrideApiBaseUrl:l,dangerouslyOverrideIPAddress:p,dangerouslyOverrideFeatureFlags:f}=c,{owner:h,statusCallback:m,funder:_,windowType:v}=u,g=d||e,y=h?.signMessage,w=h?.signTypedData,z=_?.sendTransaction||h?.sendTransaction,b=h?.address,k=_?.address,E=Uo.safeParse(b).success&&"function"==typeof w,I=Uo.safeParse(k).success&&"function"==typeof z;let A=null,$="FULL";try{A=window.origin,"MODAL"===v&&($=(()=>{if("undefined"==typeof navigator)return!1;const e=navigator;let t=!1;e.userAgentData&&"boolean"==typeof e.userAgentData.mobile&&(t=e.userAgentData.mobile);const n=navigator.userAgent||navigator.vendor||window.opera||"";return t||/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile|tablet/i.test(n)})()?"OVERLAY":"MODAL")}catch(e){}i();const T=[e=>{if(e.origin!==g||e.source!==t)return;const{type:n}=e.data||{};n===or.EVENT_WINDOW_CLOSE&&i()}];if(E){const e=async e=>{if(e.origin!==g||e.source!==t)return;const{type:n,payload:o}=e.data||{};if(n===or.ACTION_SIGN_MESSAGE){const{messageId:e,message:i,ownerAddress:r}=o;try{let o;if("function"!=typeof y)throw new Error("No signMessage function provided");o=await y({message:i,ownerAddress:r}),t?.postMessage({type:n,payload:{messageId:e,signature:o}},g)}catch(o){console.error("Error signing message",o),t?.postMessage({type:n,payload:{messageId:e,error:o instanceof Error?o.message:o}},g)}}else if(n===or.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:i,ownerAddress:r}=o;try{let o;if("function"!=typeof w)throw new Error("No signTypedData function provided");o=await w({typedData:i,ownerAddress:r}),t?.postMessage({type:n,payload:{messageId:e,signature:o}},g)}catch(o){console.error("Error signing typed data",o),t?.postMessage({type:n,payload:{messageId:e,error:o instanceof Error?o.message:o}},g)}}};T.push(e)}if(I){const e=async e=>{if(e.origin!==g||e.source!==t)return;const{type:n,payload:o}=e.data||{};if(n===or.ACTION_TRANSACTION){const{messageId:e,chainConfig:i,transaction:r}=o;try{let o;if("function"!=typeof z)throw new Error("No sendTransaction function provided");o=await z(r,i),t?.postMessage({type:n,payload:{messageId:e,txReceipt:o}},g)}catch(o){console.error("Error handling transaction",o),t?.postMessage({type:n,payload:{messageId:e,error:o instanceof Error?o.message:o}},g)}}};T.push(e)}if(m){const e=e=>{if(e.origin!==g||e.source!==t)return;const{type:n,payload:o}=e.data||{};n===or.EVENT_ORDER_STATUS&&m({type:n,payload:o})};T.push(e)}var O;T.push((async e=>{if(e.origin!==g||e.source!==t)return;const{type:o,payload:i}=e.data||{};if(o===or.ACTION_PROVIDER_WIDGET&&t){const{url:e,redirectUrl:o,providerWidgetMode:r,workflowId:s}=i||{};if(!(e&&o&&r&&s))throw new Error("Invalid provider widget payload");let a=null;if("REDIRECT"===r)t.location=e,a=t;else{if("POPUP"!==r)throw new Error("Invalid provider widget mode");n=(e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)})(e),a=n}if(await(async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await ar({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const i=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),r=i?.status;if("COMPLETE"===r)break;await new Promise((e=>setTimeout(e,5e3)))}})({apiKey:u.apiKey,baseURL:l||"https://v2.prod.halliday.xyz",workflowId:s,window:a}),a?.closed)return;"REDIRECT"===r?t.location=o:"POPUP"===r&&(n?.close(),n=null)}})),t=(e=>{const t=window.innerWidth/2-240,{windowType:n="POPUP",targetElementId:o,windowOrigin:i}=e,r=sr(e);let s;if("EMBED"===n){const e=document.getElementById(o);if(!e)throw new Error(`Element with id ${o} not found`);const t=document.createElement("iframe");t.id="halliday-payments-embed",t.src=r,t.style.width="480px",t.style.height="638px",t.style.maxWidth="100%",t.style.maxHeight="100%",e.innerHTML="",e.appendChild(t);const n=t=>{if(t.origin!==i||t.source!==s)return;const{type:o}=t.data||{};o===or.EVENT_WINDOW_CLOSE&&(window.removeEventListener("message",n),e.innerHTML="")};window.addEventListener("message",n),s=t.contentWindow}else if("MODAL"===n){let e=document.getElementById("halliday-payments-modal");(e?e.src:null)===r?e.style.display="block":(e&&e.remove(),e=document.createElement("iframe"),e.id="halliday-payments-modal",e.src=r,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100dvw",e.style.height="100dvh",e.style.border="none",e.style.zIndex="1000",e.setAttribute("scrolling","no"),document.body.appendChild(e));const t=e=>{if(e.origin!==i||e.source!==s)return;const{type:n}=e.data||{};if(n===or.EVENT_WINDOW_CLOSE){window.removeEventListener("message",t);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",t),s=e.contentWindow}else s=window.open(r,"Halliday Payments",`popup left=${t} top=70 width=480 height=638`);return s})({...u,sandbox:u.sandbox||!1,hasOwner:E,hasTxHandler:I,windowOrigin:g,apiBaseUrl:l,hostOrigin:A,ownerAddress:b,funderAddress:k,ipAddress:p,featureFlags:f,appMode:$,fontName:u.fontName,paymentCategoryOrder:u.paymentCategoryOrder}),(O=T).forEach((e=>{window.addEventListener("message",e)})),o=O}}})();async function dr(e,...t){try{return cr.openWidget(e,...t)}catch(e){throw ur(e),e}}export{er as AppMode,Li as BorderStyle,Vi as CustomStyles,Gi as FontName,or as MessageType,Wi as OrderStatus,Bi as PaymentCategoryOrder,nr as PaymentsWidgetQueryParams,Yi as PaymentsWidgetSDKParams,rr as deserializeQueryParams,sr as getPaymentsWidgetUrl,dr as openHallidayPayments,ir as serializeQueryParams};
1
+ const e="https://app.halliday.xyz",t=/^[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 n(e,t,n){function o(n,o){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in s.prototype)Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=o}const i=n?.Parent??Object;class r extends i{}function s(e){var t;const i=n?.Parent?new r:this;o(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class o extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const i={};function r(e){return i}function s(e,t){return"bigint"==typeof t?t.toString():t}function a(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function u(e){return null==e}function c(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function d(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function l(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let o=0;o<e;o++)n+=t[Math.floor(26*Math.random())];return n}function f(e){return JSON.stringify(e)}function h(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const m=a((()=>{try{return new Function(""),!0}catch(e){return!1}}));function _(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}const y=new Set(["string","number","symbol"]);function g(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function w(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const z={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function b(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n].continue)return!0;return!1}function E(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function k(e){return"string"==typeof e?e:e?.message}function I(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const i=k(e.inst?._zod.def?.error?.(e))??k(t?.error?.(e))??k(n.customError?.(e))??k(n.localeError?.(e))??"Invalid input";o.message=i}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function A(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function $(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const T=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,s,2),enumerable:!0})},x=n("$ZodError",T),O=n("$ZodError",T,{Parent:Error});const N=e=>(t,n,i,s)=>{const a=i?Object.assign(i,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new o;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map((e=>I(e,a,r()))));throw Error.captureStackTrace(t,s?.callee),t}return u.value},P=e=>async(t,n,o,i)=>{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(i?.Err??e)(a.issues.map((e=>I(e,s,r()))));throw Error.captureStackTrace(t,i?.callee),t}return a.value},Z=e=>(t,n,i)=>{const s=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new o;return a.issues.length?{success:!1,error:new(e??x)(a.issues.map((e=>I(e,s,r()))))}:{success:!0,data:a.value}},S=Z(O),D=e=>async(t,n,o)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map((e=>I(e,i,r()))))}:{success:!0,data:s.value}},R=D(O),C=/^[cC][^\s-]{8,}$/,U=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L=/^[0-9a-vA-V]{20}$/,M=/^[A-Za-z0-9]{27}$/,j=/^[a-zA-Z0-9_-]{21}$/,V=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,B=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,W=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,G=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,H=/^(([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})$/,Y=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,K=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,J=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,X=/^[A-Za-z0-9_-]*$/,Q=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,ee=/^\+(?:[0-9]){6,14}[0-9]$/,te="((\\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])))",ne=new RegExp(`^${te}$`);function oe(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}const ie=/^\d+n?$/,re=/^\d+$/,se=/^-?\d+(?:\.\d+)?/i,ae=/true|false/i,ue=/^[^A-Z]*$/,ce=/^[^a-z]*$/,de=n("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),le={number:"number",bigint:"bigint",object:"date"},pe=n("$ZodCheckLessThan",((e,t)=>{de.init(e,t);const n=le[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),fe=n("$ZodCheckGreaterThan",((e,t)=>{de.init(e,t);const n=le[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),he=n("$ZodCheckMultipleOf",((e,t)=>{de.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),me=n("$ZodCheckNumberFormat",((e,t)=>{de.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[i,r]=z[t.format];e._zod.onattach.push((e=>{const o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=r,n&&(o.pattern=re)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>r&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}})),_e=n("$ZodCheckMaxLength",((e,t)=>{de.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=A(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}})),ye=n("$ZodCheckMinLength",((e,t)=>{de.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=A(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}})),ge=n("$ZodCheckLengthEquals",((e,t)=>{de.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const r=A(o),s=i>t.length;n.issues.push({origin:r,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:n.value,inst:e,continue:!t.abort})}})),ve=n("$ZodCheckStringFormat",((e,t)=>{var n;de.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),(n=e._zod).check??(n.check=n=>{if(!t.pattern)throw new Error("Not implemented.");t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})})})),we=n("$ZodCheckRegex",((e,t)=>{ve.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=n("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=ue),ve.init(e,t)})),be=n("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=ce),ve.init(e,t)})),Ee=n("$ZodCheckIncludes",((e,t)=>{de.init(e,t);const n=g(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})}})),ke=n("$ZodCheckStartsWith",((e,t)=>{de.init(e,t);const n=new RegExp(`^${g(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),Ie=n("$ZodCheckEndsWith",((e,t)=>{de.init(e,t);const n=new RegExp(`.*${g(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),Ae=n("$ZodCheckOverwrite",((e,t)=>{de.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class $e{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),o=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const Te={major:4,minor:0,patch:0},xe=n("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.id=t.type+"_"+p(10),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Te;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let i,r=b(e);for(const s of t){if(s._zod.when){if(!s._zod.when(e))continue}else if(r)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new o;if(i||a instanceof Promise)i=(i??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(r||(r=b(e,t)))}));else{if(e.issues.length===t)continue;r||(r=b(e,t))}}return i?i.then((()=>e)):e};e._zod.run=(n,r)=>{const s=e._zod.parse(n,r);if(s instanceof Promise){if(!1===r.async)throw new o;return s.then((e=>t(e,i,r)))}return t(s,i,r)}}e["~standard"]={validate:t=>{try{const n=S(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return R(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Oe=n("$ZodString",((e,t)=>{var n;xe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Ne=n("$ZodStringFormat",((e,t)=>{ve.init(e,t),Oe.init(e,t)})),Pe=n("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=B),Ne.init(e,t)})),Ze=n("$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=W(e))}else t.pattern??(t.pattern=W());Ne.init(e,t)})),Se=n("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=G),Ne.init(e,t)})),De=n("$ZodURL",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{try{const o=new URL(n.value);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Q.source,input:n.value,inst:e})),void(t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e})))}catch(t){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e})}}})),Re=n("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ne.init(e,t)})),Ce=n("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=j),Ne.init(e,t)})),Ue=n("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=C),Ne.init(e,t)})),Fe=n("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=U),Ne.init(e,t)})),Le=n("$ZodULID",((e,t)=>{t.pattern??(t.pattern=F),Ne.init(e,t)})),Me=n("$ZodXID",((e,t)=>{t.pattern??(t.pattern=L),Ne.init(e,t)})),je=n("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=M),Ne.init(e,t)})),Ve=n("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){let t=`${te}T${oe(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}(t)),Ne.init(e,t)})),Be=n("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=ne),Ne.init(e,t)})),We=n("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${oe(t)}$`)),Ne.init(e,t)})),Ge=n("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=V),Ne.init(e,t)})),qe=n("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=q),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),He=n("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=H),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e})}}})),Ye=n("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=Y),Ne.init(e,t)})),Ke=n("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=K),Ne.init(e,t),e._zod.check=t=>{const[n,o]=t.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e})}}}));function Je(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xe=n("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=J),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=t=>{Je(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e})}}));const Qe=n("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=X),Ne.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=t=>{(function(e){if(!X.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Je(t.padEnd(4*Math.ceil(t.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e})}})),et=n("$ZodE164",((e,t)=>{t.pattern??(t.pattern=ee),Ne.init(e,t)}));const tt=n("$ZodJWT",((e,t)=>{Ne.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n,i=JSON.parse(atob(o));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e})}})),nt=n("$ZodNumber",((e,t)=>{xe.init(e,t),e._zod.pattern=e._zod.bag.pattern??se,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const r="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...r?{received:r}:{}}),n}})),ot=n("$ZodNumber",((e,t)=>{me.init(e,t),nt.init(e,t)})),it=n("$ZodBoolean",((e,t)=>{xe.init(e,t),e._zod.pattern=ae,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}})),rt=n("$ZodBigInt",((e,t)=>{xe.init(e,t),e._zod.pattern=ie,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}const{value:i}=n;return"bigint"==typeof i||n.issues.push({expected:"bigint",code:"invalid_type",input:i,inst:e}),n}})),st=n("$ZodAny",((e,t)=>{xe.init(e,t),e._zod.parse=e=>e})),at=n("$ZodUnknown",((e,t)=>{xe.init(e,t),e._zod.parse=e=>e})),ut=n("$ZodNever",((e,t)=>{xe.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function ct(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}const dt=n("$ZodArray",((e,t)=>{xe.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const r=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?r.push(a.then((t=>ct(t,n,e)))):ct(a,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function lt(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}function pt(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...E(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const ft=n("$ZodObject",((e,t)=>{xe.init(e,t);const n=a((()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof xe))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter((e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout)));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}));d(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n}));let o;const r=h,s=!i.jitless,u=s&&m.value,{catchall:c}=t;let l;e._zod.parse=(i,a)=>{l??(l=n.value);const d=i.value;if(!r(d))return i.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),i;const h=[];if(s&&u&&!1===a?.async&&!0!==a.jitless)o||(o=(e=>{const t=new $e(["shape","payload","ctx"]),{keys:o,optionalKeys:i}=n.value,r=e=>{const t=f(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);for(const e of o)s[e]=p(15);t.write("const newResult = {}");for(const e of o)if(i.has(e)){const n=s[e];t.write(`const ${n} = ${r(e)};`);const o=f(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=s[e];t.write(`const ${n} = ${r(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${f(e)}, ...iss.path] : [${f(e)}]\n })));`),t.write(`newResult[${f(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),i=o(i,a);else{i.value={};const e=l.shape;for(const t of l.keys){const n=e[t],o=n._zod.run({value:d[t],issues:[]},a),r="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?h.push(o.then((e=>r?pt(e,i,t,d):lt(e,i,t)))):r?pt(o,i,t,d):lt(o,i,t)}}if(!c)return h.length?Promise.all(h).then((()=>i)):i;const m=[],_=l.keySet,y=c._zod,g=y.def.type;for(const e of Object.keys(d)){if(_.has(e))continue;if("never"===g){m.push(e);continue}const t=y.run({value:d[e],issues:[]},a);t instanceof Promise?h.push(t.then((t=>lt(t,i,e)))):lt(t,i,e)}return m.length&&i.issues.push({code:"unrecognized_keys",keys:m,input:d,inst:e}),h.length?Promise.all(h).then((()=>i)):i}}));function ht(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>I(e,o,r())))))}),t}const mt=n("$ZodUnion",((e,t)=>{xe.init(e,t),d(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),d(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>c(e.source))).join("|")})$`)}})),e._zod.parse=(n,o)=>{let i=!1;const r=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)r.push(t),i=!0;else{if(0===t.issues.length)return t;r.push(t)}}return i?Promise.all(r).then((t=>ht(t,n,e,o))):ht(r,n,e,o)}})),_t=n("$ZodDiscriminatedUnion",((e,t)=>{mt.init(e,t);const n=e._zod.parse;d(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=a((()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n}));e._zod.parse=(i,r)=>{const s=i.value;if(!h(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(i,r):t.unionFallback?n(i,r):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),i)}})),yt=n("$ZodIntersection",((e,t)=>{xe.init(e,t),e._zod.parse=(e,n)=>{const{value:o}=e,i=t.left._zod.run({value:o,issues:[]},n),r=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||r instanceof Promise?Promise.all([i,r]).then((([t,n])=>vt(e,t,n))):vt(e,i,r)}}));function gt(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(_(e)&&_(t)){const n=Object.keys(t),o=Object.keys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of o){const o=gt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i[n]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const i=gt(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function vt(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),b(e))return e;const o=gt(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const wt=n("$ZodRecord",((e,t)=>{xe.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!_(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const s=[];if(t.keyType._zod.values){const r=t.keyType._zod.values;n.value={};for(const e of r)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const r=t.valueType._zod.run({value:i[e],issues:[]},o);r instanceof Promise?s.push(r.then((t=>{t.issues.length&&n.issues.push(...E(e,t.issues)),n.value[e]=t.value}))):(r.issues.length&&n.issues.push(...E(e,r.issues)),n.value[e]=r.value)}let a;for(const e in i)r.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map((e=>I(e,o,r()))),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:i[a],issues:[]},o);c instanceof Promise?s.push(c.then((e=>{e.issues.length&&n.issues.push(...E(a,e.issues)),n.value[u.value]=e.value}))):(c.issues.length&&n.issues.push(...E(a,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then((()=>n)):n}})),zt=n("$ZodEnum",((e,t)=>{xe.init(e,t);const n=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter((e=>y.has(typeof e))).map((e=>"string"==typeof e?g(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return e._zod.values.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}})),bt=n("$ZodLiteral",((e,t)=>{xe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?g(e):e?e.toString():String(e))).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}})),Et=n("$ZodTransform",((e,t)=>{xe.init(e,t),e._zod.parse=(e,n)=>{const i=t.transform(e.value,e);if(n.async){return(i instanceof Promise?i:Promise.resolve(i)).then((t=>(e.value=t,e)))}if(i instanceof Promise)throw new o;return e.value=i,e}})),kt=n("$ZodOptional",((e,t)=>{xe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",d(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),d(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${c(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)})),It=n("$ZodNullable",((e,t)=>{xe.init(e,t),d(e._zod,"optin",(()=>t.innerType._zod.optin)),d(e._zod,"optout",(()=>t.innerType._zod.optout)),d(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${c(e.source)}|null)$`):void 0})),d(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),At=n("$ZodDefault",((e,t)=>{xe.init(e,t),e._zod.optin="optional",d(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((e=>$t(e,t))):$t(o,t)}}));function $t(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tt=n("$ZodPrefault",((e,t)=>{xe.init(e,t),e._zod.optin="optional",d(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),xt=n("$ZodNonOptional",((e,t)=>{xe.init(e,t),d(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,o)=>{const i=t.innerType._zod.run(n,o);return i instanceof Promise?i.then((t=>Ot(t,e))):Ot(i,e)}}));function Ot(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nt=n("$ZodCatch",((e,t)=>{xe.init(e,t),d(e._zod,"optin",(()=>t.innerType._zod.optin)),d(e._zod,"optout",(()=>t.innerType._zod.optout)),d(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>I(e,n,r())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map((e=>I(e,n,r())))},input:e.value}),e.issues=[]),e)}})),Pt=n("$ZodPipe",((e,t)=>{xe.init(e,t),d(e._zod,"values",(()=>t.in._zod.values)),d(e._zod,"optin",(()=>t.in._zod.optin)),d(e._zod,"optout",(()=>t.out._zod.optout)),e._zod.parse=(e,n)=>{const o=t.in._zod.run(e,n);return o instanceof Promise?o.then((e=>Zt(e,t,n))):Zt(o,t,n)}}));function Zt(e,t,n){return b(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const St=n("$ZodReadonly",((e,t)=>{xe.init(e,t),d(e._zod,"propValues",(()=>t.innerType._zod.propValues)),d(e._zod,"optin",(()=>t.innerType._zod.optin)),d(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(Dt):Dt(o)}}));function Dt(e){return e.value=Object.freeze(e.value),e}const Rt=n("$ZodCustom",((e,t)=>{de.init(e,t),xe.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,i=t.fn(o);if(i instanceof Promise)return i.then((t=>Ct(t,n,o,e)));Ct(i,n,o,e)}}));function Ct(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push($(e))}}class Ut{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ft(){return new Ut}const Lt=Ft();function Mt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function jt(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Vt(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Bt(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Wt(e,t){return new pe({check:"less_than",...w(t),value:e,inclusive:!1})}function Gt(e,t){return new pe({check:"less_than",...w(t),value:e,inclusive:!0})}function qt(e,t){return new fe({check:"greater_than",...w(t),value:e,inclusive:!1})}function Ht(e,t){return new fe({check:"greater_than",...w(t),value:e,inclusive:!0})}function Yt(e,t){return new he({check:"multiple_of",...w(t),value:e})}function Kt(e,t){return new _e({check:"max_length",...w(t),maximum:e})}function Jt(e,t){return new ye({check:"min_length",...w(t),minimum:e})}function Xt(e,t){return new ge({check:"length_equals",...w(t),length:e})}function Qt(e){return new Ae({check:"overwrite",tx:e})}const en=n("ZodISODateTime",((e,t)=>{Ve.init(e,t),wn.init(e,t)}));function tn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}(en,e)}const nn=n("ZodISODate",((e,t)=>{Be.init(e,t),wn.init(e,t)}));function on(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}(nn,e)}const rn=n("ZodISOTime",((e,t)=>{We.init(e,t),wn.init(e,t)}));function sn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}(rn,e)}const an=n("ZodISODuration",((e,t)=>{Ge.init(e,t),wn.init(e,t)}));function un(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}(an,e)}const cn=(e,t)=>{x.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},o={_errors:[]},i=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>i({issues:e})));else if("invalid_key"===t.code)i({issues:t.issues});else if("invalid_element"===t.code)i({issues:t.issues});else if(0===t.path.length)o._errors.push(n(t));else{let e=o,i=0;for(;i<t.path.length;){const o=t.path[i];i===t.path.length-1?(e[o]=e[o]||{_errors:[]},e[o]._errors.push(n(t))):e[o]=e[o]||{_errors:[]},e=e[o],i++}}};return i(e),o}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):o.push(t(i));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},dn=n("ZodError",cn),ln=n("ZodError",cn,{Parent:Error}),pn=N(ln),fn=P(ln),hn=Z(ln),mn=D(ln),_n=n("ZodType",((e,t)=>(xe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>v(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>pn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>hn(e,t,n),e.parseAsync=async(t,n)=>fn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>mn(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...w(n)})}(Oo,e,t)}(t,n)),e.superRefine=t=>e.check(function(e,t){const n=function(e,t){const n=new de({check:"custom",...w(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push($(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push($(o))}},e(t.value,t))),t);return n}(t)),e.overwrite=t=>e.check(Qt(t)),e.optional=()=>wo(e),e.nullable=()=>bo(e),e.nullish=()=>wo(bo(e)),e.nonoptional=t=>function(e,t){return new Io({type:"nonoptional",innerType:e,...w(t)})}(e,t),e.array=()=>no(e),e.or=t=>so([e,t]),e.and=t=>new co({type:"intersection",left:e,right:t}),e.transform=t=>To(e,go(t)),e.default=t=>{return n=t,new Eo({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.prefault=t=>{return n=t,new ko({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.catch=t=>{return new Ao({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>To(e,t),e.readonly=()=>new xo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Lt.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Lt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Lt.get(e);const n=e.clone();return Lt.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),yn=n("_ZodString",((e,t)=>{Oe.init(e,t),_n.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new we({check:"string_format",format:"regex",...w(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Ee({check:"string_format",format:"includes",...w(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new ke({check:"string_format",format:"starts_with",...w(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Ie({check:"string_format",format:"ends_with",...w(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Jt(...t)),e.max=(...t)=>e.check(Kt(...t)),e.length=(...t)=>e.check(Xt(...t)),e.nonempty=(...t)=>e.check(Jt(1,...t)),e.lowercase=t=>e.check(function(e){return new ze({check:"string_format",format:"lowercase",...w(e)})}(t)),e.uppercase=t=>e.check(function(e){return new be({check:"string_format",format:"uppercase",...w(e)})}(t)),e.trim=()=>e.check(Qt((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return Qt((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(Qt((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(Qt((e=>e.toUpperCase())))})),gn=n("ZodString",((e,t)=>{Oe.init(e,t),yn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}(zn,t)),e.url=t=>e.check(jt(kn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}(Ln,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}(An,t)),e.guid=t=>e.check(Mt(bn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}(En,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}(En,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}(En,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}(En,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}($n,t)),e.guid=t=>e.check(Mt(bn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}(Tn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}(xn,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}(On,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}(Cn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}(Un,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}(Nn,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}(Pn,t)),e.ipv4=t=>e.check(Vt(Zn,t)),e.ipv6=t=>e.check(Bt(Sn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}(Dn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}(Rn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}(Fn,t)),e.datetime=t=>e.check(tn(t)),e.date=t=>e.check(on(t)),e.time=t=>e.check(sn(t)),e.duration=t=>e.check(un(t))}));function vn(e){return function(e,t){return new e({type:"string",...w(t)})}(gn,e)}const wn=n("ZodStringFormat",((e,t)=>{Ne.init(e,t),yn.init(e,t)})),zn=n("ZodEmail",((e,t)=>{Se.init(e,t),wn.init(e,t)})),bn=n("ZodGUID",((e,t)=>{Pe.init(e,t),wn.init(e,t)})),En=n("ZodUUID",((e,t)=>{Ze.init(e,t),wn.init(e,t)})),kn=n("ZodURL",((e,t)=>{De.init(e,t),wn.init(e,t)}));function In(e){return jt(kn,e)}const An=n("ZodEmoji",((e,t)=>{Re.init(e,t),wn.init(e,t)})),$n=n("ZodNanoID",((e,t)=>{Ce.init(e,t),wn.init(e,t)})),Tn=n("ZodCUID",((e,t)=>{Ue.init(e,t),wn.init(e,t)})),xn=n("ZodCUID2",((e,t)=>{Fe.init(e,t),wn.init(e,t)})),On=n("ZodULID",((e,t)=>{Le.init(e,t),wn.init(e,t)})),Nn=n("ZodXID",((e,t)=>{Me.init(e,t),wn.init(e,t)})),Pn=n("ZodKSUID",((e,t)=>{je.init(e,t),wn.init(e,t)})),Zn=n("ZodIPv4",((e,t)=>{qe.init(e,t),wn.init(e,t)}));const Sn=n("ZodIPv6",((e,t)=>{He.init(e,t),wn.init(e,t)}));const Dn=n("ZodCIDRv4",((e,t)=>{Ye.init(e,t),wn.init(e,t)})),Rn=n("ZodCIDRv6",((e,t)=>{Ke.init(e,t),wn.init(e,t)})),Cn=n("ZodBase64",((e,t)=>{Xe.init(e,t),wn.init(e,t)})),Un=n("ZodBase64URL",((e,t)=>{Qe.init(e,t),wn.init(e,t)})),Fn=n("ZodE164",((e,t)=>{et.init(e,t),wn.init(e,t)})),Ln=n("ZodJWT",((e,t)=>{tt.init(e,t),wn.init(e,t)})),Mn=n("ZodNumber",((e,t)=>{nt.init(e,t),_n.init(e,t),e.gt=(t,n)=>e.check(qt(t,n)),e.gte=(t,n)=>e.check(Ht(t,n)),e.min=(t,n)=>e.check(Ht(t,n)),e.lt=(t,n)=>e.check(Wt(t,n)),e.lte=(t,n)=>e.check(Gt(t,n)),e.max=(t,n)=>e.check(Gt(t,n)),e.int=t=>e.check(Bn(t)),e.safe=t=>e.check(Bn(t)),e.positive=t=>e.check(qt(0,t)),e.nonnegative=t=>e.check(Ht(0,t)),e.negative=t=>e.check(Wt(0,t)),e.nonpositive=t=>e.check(Gt(0,t)),e.multipleOf=(t,n)=>e.check(Yt(t,n)),e.step=(t,n)=>e.check(Yt(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function jn(e){return function(e,t){return new e({type:"number",checks:[],...w(t)})}(Mn,e)}const Vn=n("ZodNumberFormat",((e,t)=>{ot.init(e,t),Mn.init(e,t)}));function Bn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}(Vn,e)}const Wn=n("ZodBoolean",((e,t)=>{it.init(e,t),_n.init(e,t)}));function Gn(e){return function(e,t){return new e({type:"boolean",...w(t)})}(Wn,e)}const qn=n("ZodBigInt",((e,t)=>{rt.init(e,t),_n.init(e,t),e.gte=(t,n)=>e.check(Ht(t,n)),e.min=(t,n)=>e.check(Ht(t,n)),e.gt=(t,n)=>e.check(qt(t,n)),e.gte=(t,n)=>e.check(Ht(t,n)),e.min=(t,n)=>e.check(Ht(t,n)),e.lt=(t,n)=>e.check(Wt(t,n)),e.lte=(t,n)=>e.check(Gt(t,n)),e.max=(t,n)=>e.check(Gt(t,n)),e.positive=t=>e.check(qt(BigInt(0),t)),e.negative=t=>e.check(Wt(BigInt(0),t)),e.nonpositive=t=>e.check(Gt(BigInt(0),t)),e.nonnegative=t=>e.check(Ht(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Yt(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function Hn(e){return function(e,t){return new e({type:"bigint",...w(t)})}(qn,e)}const Yn=n("ZodAny",((e,t)=>{st.init(e,t),_n.init(e,t)}));function Kn(){return new Yn({type:"any"})}const Jn=n("ZodUnknown",((e,t)=>{at.init(e,t),_n.init(e,t)}));function Xn(){return new Jn({type:"unknown"})}const Qn=n("ZodNever",((e,t)=>{ut.init(e,t),_n.init(e,t)}));function eo(e){return function(e,t){return new e({type:"never",...w(t)})}(Qn,e)}const to=n("ZodArray",((e,t)=>{dt.init(e,t),_n.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Jt(t,n)),e.nonempty=t=>e.check(Jt(1,t)),e.max=(t,n)=>e.check(Kt(t,n)),e.length=(t,n)=>e.check(Xt(t,n)),e.unwrap=()=>e.element}));function no(e,t){return function(e,t,n){return new e({type:"array",element:t,...w(n)})}(to,e,t)}const oo=n("ZodObject",((e,t)=>{ft.init(e,t),_n.init(e,t),d(e,"shape",(()=>Object.fromEntries(Object.entries(e._zod.def.shape)))),e.keyof=()=>ho(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Xn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Xn()}),e.strict=()=>e.clone({...e._zod.def,catchall:eo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return l(this,"shape",n),n},checks:[]};return v(e,n)}(e,t),e.merge=t=>{return o=t,v(n=e,{...n._zod.def,get shape(){const e={...n._zod.def.shape,...o._zod.def.shape};return l(this,"shape",e),e},catchall:o._zod.def.catchall,checks:[]});var n,o},e.pick=t=>function(e,t){const n={},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=o.shape[e])}return v(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.omit=t=>function(e,t){const n={...e._zod.def.shape},o=e._zod.def;for(const e in t){if(!(e in o.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return v(e,{...e._zod.def,shape:n,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)i[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return v(t,{...t._zod.def,shape:i,checks:[]})}(vo,e,t[0]),e.required=(...t)=>function(e,t,n){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)i[t]=new e({type:"nonoptional",innerType:o[t]});return v(t,{...t._zod.def,shape:i,checks:[]})}(Io,e,t[0])}));function io(e,t){const n={type:"object",get shape(){return l(this,"shape",{...e}),this.shape},...w(t)};return new oo(n)}const ro=n("ZodUnion",((e,t)=>{mt.init(e,t),_n.init(e,t),e.options=t.options}));function so(e,t){return new ro({type:"union",options:e,...w(t)})}const ao=n("ZodDiscriminatedUnion",((e,t)=>{ro.init(e,t),_t.init(e,t)}));function uo(e,t,n){return new ao({type:"union",options:t,discriminator:e,...w(n)})}const co=n("ZodIntersection",((e,t)=>{yt.init(e,t),_n.init(e,t)}));const lo=n("ZodRecord",((e,t)=>{wt.init(e,t),_n.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}));function po(e,t,n){return new lo({type:"record",keyType:e,valueType:t,...w(n)})}const fo=n("ZodEnum",((e,t)=>{zt.init(e,t),_n.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new fo({...t,checks:[],...w(o),entries:i})},e.exclude=(e,o)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new fo({...t,checks:[],...w(o),entries:i})}}));function ho(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new fo({type:"enum",entries:n,...w(t)})}const mo=n("ZodLiteral",((e,t)=>{bt.init(e,t),_n.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));function _o(e,t){return new mo({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}const yo=n("ZodTransform",((e,t)=>{Et.init(e,t),_n.init(e,t),e._zod.parse=(n,o)=>{n.addIssue=o=>{if("string"==typeof o)n.issues.push($(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),n.issues.push($(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n))):(n.value=i,n)}}));function go(e){return new yo({type:"transform",transform:e})}const vo=n("ZodOptional",((e,t)=>{kt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function wo(e){return new vo({type:"optional",innerType:e})}const zo=n("ZodNullable",((e,t)=>{It.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function bo(e){return new zo({type:"nullable",innerType:e})}const Eo=n("ZodDefault",((e,t)=>{At.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const ko=n("ZodPrefault",((e,t)=>{Tt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Io=n("ZodNonOptional",((e,t)=>{xt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType}));const Ao=n("ZodCatch",((e,t)=>{Nt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const $o=n("ZodPipe",((e,t)=>{Pt.init(e,t),_n.init(e,t),e.in=t.in,e.out=t.out}));function To(e,t){return new $o({type:"pipe",in:e,out:t})}const xo=n("ZodReadonly",((e,t)=>{St.init(e,t),_n.init(e,t)}));const Oo=n("ZodCustom",((e,t)=>{Rt.init(e,t),_n.init(e,t)}));const No=vn().refine((e=>/^(0|[1-9]\d*)(\.\d+)?$/.test(e)),{message:"Invalid amount"}),Po=/^(0x|0x[a-fA-F0-9]{40})$/,Zo=vn().refine((e=>Po.test(e)),{message:"Invalid EVM token address"}),So=Zo.refine((e=>"0x"!==e),{message:"Invalid EVM address"}),Do=/^[1-9A-HJ-NP-Za-km-z]{32,44}$/,Ro=/^So[1-2]{41}$/,Co=vn().refine((e=>Do.test(e)||Ro.test(e)),{message:"Invalid Solana token address"}),Uo=so([So,vn().refine((e=>Do.test(e)),{message:"Invalid Solana address"})]),Fo=vn().refine((e=>/^[a-zA-Z_]{3,}$/.test(e)),{message:"Invalid fiat"}),Lo=io({issuer:vn(),name:vn(),alias:vn().optional(),symbol:vn(),decimals:jn()}),Mo=vn(),jo=vn().regex(/^[a-zA-Z]\w{1,7}$/,{message:"Must be a short alpha-numeric symbol"}),Vo=jn().min(0).max(18),Bo=vn().url(),Wo=vn(),Go=io({chain:vn(),address:Zo}),qo=io({chain:_o("solana"),address:Co}),Ho=io({chain:vn(),address:vn()}),Yo=so([Go,qo,Ho]),Ko=vn().refine((e=>{const[t,n]=e.split(":");return Yo.safeParse({chain:t,address:n}).success}),{message:"Invalid token"}),Jo=io({name:Mo,symbol:jo,decimals:Vo,alias:jo.optional(),image_url:Bo.optional(),coingecko_id:Wo.optional(),wrapper:jo.optional(),is_native:Gn().optional()}),Xo=so([Go.extend(Jo.shape),qo.extend(Jo.shape),Ho.extend(Jo.shape)]),Qo=so([Ko,Fo]);so([Xo,Lo]),uo("type",[io({type:_o("chain"),chain:vn()}),io({type:_o("issuer"),issuer:vn()})]);const ei=vn().transform((e=>e.toLowerCase()));var ti,ni;ti=e=>"string"==typeof e?e.toUpperCase():e,ni=ho(["ONRAMP","OFFRAMP"]),To(go(ti),ni),io({to:So,from:So.optional(),nonce:jn().optional(),gasLimit:Hn().optional(),gasPrice:Hn().optional(),maxPriorityFeePerGas:Hn().optional(),maxFeePerGas:Hn().optional(),data:vn().optional(),value:Hn().optional(),chainId:jn()}),io({transactionHash:vn().optional(),blockHash:vn().optional(),blockNumber:jn().optional(),from:So.optional(),to:So.optional(),rawReceipt:Kn()});so([io({chain_id:Hn(),network:vn(),native_currency:io({name:vn(),symbol:vn(),decimals:jn()}),rpc:vn(),image:vn(),is_testnet:Gn(),explorer:vn()}),io({chain_id:Hn(),network:vn()})]);const oi=ho(["CREDIT_CARD","DEBIT_CARD","ACH","FIAT_BALANCE","TOKEN_BALANCE","APPLE_PAY","PAYPAL","VENMO","REVOLUT","GOOGLE_PAY","SEPA","FASTER_PAYMENTS","PIX","UPI","WIRE"]),ii=vn().refine((e=>t.test(e)),{message:"Invalid payment ID"}),ri=ho(["BETA_EDGES","ORG_BETA_EDGES","ORG_EDGES"]),si=io({onramps:no(ei).optional(),offramps:no(ei).optional(),sandbox:Gn().optional().default(!1),features:no(ri).optional()}),ai=si.extend({inputs:no(Qo).optional(),outputs:no(Qo)});so([ai,si.extend({inputs:no(Qo),outputs:no(Qo).optional()})]);const ui=io({asset:Qo,amount:No}),ci=io({token:Ko,amount:No}),di=vn(),li=so([Vt(Zn,pi),function(e){return Bt(Sn,e)}()]);var pi;const fi=io({price_currency:Fo,onramps:no(ei).optional(),onramp_methods:no(oi).optional(),customer_ip_address:vn().optional(),customer_id:vn().optional(),parent_payment_id:ii.optional(),features:no(ri).optional()}),hi=uo("kind",[io({kind:_o("FIXED_INPUT"),fixed_input_amount:ui,output_asset:Qo})]),mi=fi.extend({request:hi}),_i=ho(["USER","DEST","HALLIDAY","SPW","REV_SHARE","BRIDGE"]),yi=io({asset:Qo,property:ho(["APPROVAL","BALANCE"])}),gi=io({account:_i,resource:yi}),vi=so([_o("COMPLETE"),_o("UNREACHABLE"),_o("FAILED")]),wi=so([vi,_o("PENDING")]),zi=ho(["PENDING","COMPLETE","FAILED","EXPIRED","WITHDRAWN","TAINTED"]),bi=io({consume:no(gi),produce:no(gi)}),Ei=gi.extend({amount:No}),ki=bi.extend({consume:no(Ei),produce:no(Ei)}),Ii=po(Qo,vn()),Ai=uo("kind",[io({kind:so([_o("amount"),_o("amount-downstream")]),given:vn(),limits:io({min:vn().optional(),max:vn().optional()}),source:vn(),message:vn()}),io({kind:_o("geolocation"),message:vn()}),io({kind:_o("provider"),message:vn()}),io({kind:_o("other"),message:vn()}),io({kind:_o("unknown"),message:vn()})]),$i=io({service_ids:no(vn()),latency_seconds:jn(),issues:no(Ai).optional()}),Ti=io({type:so([_o("USER_FUND"),_o("ONCHAIN_STEP"),_o("ONRAMP")]),net_effect:ki,pieces_info:no(io({type:so([_o("onramp"),_o("poll"),_o("bridge"),_o("rev_share"),_o("transfer_out"),_o("convert")])})),step_index:jn().optional()}),xi=io({payment_id:vn(),output_amount:io({asset:Qo,amount:vn()}),onramp:ei.optional(),onramp_method:oi.optional(),fees:io({total_fees:vn(),conversion_fees:vn(),network_fees:vn(),business_fees:vn(),currency_symbol:Fo}),route:no(Ti)}),Oi=Ti.extend({status:wi,transaction_hash:vn().optional()}),Ni=xi.omit({payment_id:!0}).partial({output_amount:!0,onramp:!0,onramp_method:!0,fees:!0}).extend({route:no(Oi)});io({quote_request:mi,quotes:no(xi),current_prices:Ii,price_currency:Fo,state_token:vn(),quoted_at:vn(),accept_by:vn(),failures:no($i)}),io({payment_id:ii,state_token:vn(),owner_address:Uo,destination_address:Uo,client_redirect_url:vn().optional()});const Pi=io({deposit_token:Ko,deposit_chain:vn(),deposit_amount:No,deposit_address:Uo}),Zi=io({type:ho(["ONRAMP","TRANSFER_IN"]),payment_id:ii,funding_page_url:In(),deposit_info:no(Pi)}),Si=io({payment_id:ii,status:zi,funded:Gn(),created_at:vn(),updated_at:vn(),initiate_fund_by:vn(),completed_at:vn().optional(),quote_request:mi,quoted:xi.omit({payment_id:!0}),fulfilled:Ni,current_prices:Ii,price_currency:Fo,customer_id:vn().optional(),processing_addresses:no(io({address:Uo,chain:vn()})),owner_address:Uo,destination_address:Uo,next_instruction:Zi.optional(),parent_payment_id:ii.optional()});io({payment_id:ii,redirect_url:vn().optional()}),io({funding_page_onramp_url:vn(),client_redirect_url:vn().optional(),client_secret:vn().optional()}),io({id_query:vn().optional(),pagination_key:vn().optional(),dest_address:Uo.optional(),owner_address:Uo.optional(),limit:jn().int().positive().optional(),category:ho(["ALL","NEW_OR_FUNDED"]).optional()}),io({payment_statuses:no(Si),next_pagination_key:vn().nullable()}),io({payment_id:ii.optional(),custom_queries:no(io({address:Uo,token:so([Ko,Yo])})).optional()}).refine((e=>!(!e.payment_id&&!e.custom_queries?.length)),{message:"payment_id or custom_queries is required"}),io({balance_results:no(io({address:Uo,token:Ko,value:uo("kind",[io({kind:_o("amount"),amount:No}),io({kind:_o("error")})])}))}),io({fiat:Fo,tokens:no(Ko)});const Di=vn(),Ri=io({payment_id:ii,token_amounts:no(ci),recipient_address:Uo});io({payment_id:ii,withdraw_authorization:Di}),Ri.extend({owner_signature:di}),io({payment_id:ii,transaction_hash:vn()});const Ci=ho(["EMBED","POPUP","MODAL"]),Ui=ho(["DEFAULT","ALL_UPPERCASE"]),Fi=ho(["AUTO","MEDIUM"]),Li=ho(["ATTACHED","BUTTON"]),Mi=ho(["SQUARE","DEFAULT"]),ji=vn().refine((e=>/^(#[0-9A-Fa-f]{3,8}|rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\)|rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3}(\s*,\s*(0(\.\d+)?|1(\.0+)?))\))$/.test(e)),{message:"Invalid CSS color value"}),Vi=io({src:In(),alt:vn(),width:jn().positive(),height:jn().positive()}),Bi=io({primaryColor:ji.optional(),backgroundColor:ji.optional(),borderColor:ji.optional(),textColor:ji.optional(),textSecondaryColor:ji.optional(),accentColor:ji.optional(),borderStyle:Mi.optional(),textMode:Ui.optional(),paymentCategoryGrouping:Li.optional(),fontWeight:Fi.optional(),logo:Vi.optional()}),Wi=Kn(),Gi=no(ho(["wallet","open-wallet","exchange","open-exchange","cash","open-cash"])),qi=ho(["haffer","wudoo-mono"]),Hi=vn().optional().default("Buy"),Yi=io({address:Uo,signMessage:Kn().refine((e=>"function"==typeof e)).optional(),sendTransaction:Kn().refine((e=>"function"==typeof e)).optional(),signTypedData:Kn().refine((e=>"function"==typeof e)).optional()}),Ki=io({redirectUrl:In(),ctaText:vn(),secondaryRedirectUrl:In().optional(),secondaryCtaText:vn().optional()}).refine((e=>!(e.secondaryRedirectUrl&&!e.secondaryCtaText||!e.secondaryRedirectUrl&&e.secondaryCtaText)),{message:"secondaryCtaText and secondaryRedirectUrl must be provided together."}),Ji=io({apiKey:vn().nonempty(),destinationAddress:Uo.optional(),widgetVersion:ho(["1","2"]).default("2").optional(),...ai.shape,customStyles:Bi.optional(),targetElementId:vn().optional(),windowType:Ci.default(Ci.enum.POPUP).optional(),redirects:Ki.optional(),statusCallback:Kn().refine((e=>"function"==typeof e)).optional(),owner:Yi.optional(),funder:Yi.optional(),features:no(ri).optional(),paymentCategoryOrder:Gi.optional(),fontName:qi.optional(),headerTitle:Hi.optional()}).refine((e=>!("EMBED"===e.windowType&&!e.targetElementId)),{message:"targetElementId is required when windowType is EMBED"}),Xi=Ji.omit({owner:!0,funder:!0,statusCallback:!0}),Qi=vn().regex(/^(https:\/\/(?:[\w-]+\.)*halliday\.xyz(?:\/.*)?|http:\/\/localhost(?::\d+)?(?:\/.*)?|https:\/\/localhost(?::\d+)?(?:\/.*)?)$/,"Invalid API baseUrl"),er=po(vn(),Gn()),tr=io({dangerouslyOverrideHallidayDomainName:In().optional(),dangerouslyOverrideApiBaseUrl:Qi.optional(),dangerouslyOverrideIPAddress:li.optional(),dangerouslyOverrideFeatureFlags:er.optional()}),nr=ho(["FULL","MODAL","OVERLAY","EMBED"]),or=io({appMode:nr.optional(),apiBaseUrl:Qi.optional(),hasOwner:Gn(),hasTxHandler:Gn(),hostOrigin:In().nullable(),ipAddress:li.optional(),featureFlags:er.optional()}),ir=io({...Xi.shape,...or.shape,ownerAddress:Uo.optional(),funderAddress:Uo.optional()});var rr;!function(e){e.ACTION_TRANSACTION="ACTION_TRANSACTION",e.EVENT_ORDER_STATUS="EVENT_ORDER_STATUS",e.EVENT_WINDOW_CLOSE="EVENT_WINDOW_CLOSE",e.ACTION_SIGN_MESSAGE="ACTION_SIGN_MESSAGE",e.ACTION_PROVIDER_WIDGET="ACTION_PROVIDER_WIDGET",e.ACTION_SIGN_TYPED_DATA="ACTION_SIGN_TYPED_DATA",e.EVENT_RESIZE="EVENT_RESIZE"}(rr||(rr={}));const sr=e=>{const t=ir.parse(e);return btoa(JSON.stringify(t))},ar=e=>ir.parse(JSON.parse(atob(e))),ur=t=>{const{windowOrigin:n=e,...o}=t,i=sr(o),r=o.widgetVersion;if(r)try{return`${n}/v${parseInt(r)}/payments/quote?data=${i}`}catch(e){console.error("Error parsing widget version",e)}return`${n}/payments/quote?data=${i}`},cr=async({apiKey:e,baseURL:t,workflowId:n})=>{let o;for(let i=1;i<=3;i++)try{const o=await fetch(`${t}/quotes/status?workflow_id=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){if(o=e instanceof Error?e:new Error(String(e)),3===i)throw o;const t=1e3*Math.pow(2,i);await new Promise((e=>setTimeout(e,t)))}throw o},dr=e=>{e instanceof dn?e.issues.forEach((e=>{console.error("Validation Error",{path:e.path.join("."),message:e.message})})):console.error("openHallidayPayments Error",{error:e})},lr=(()=>{let t=null,n=null,o=[];const i=()=>{o.forEach((e=>{window.removeEventListener("message",e)})),o=[]};return{openWidget:async(r,...s)=>{const a=s[999]||{};let u,c;try{u=Ji.parse(r)}catch(e){throw dr(e),e}try{c=tr.parse(a)}catch(e){throw dr(e),e}const{dangerouslyOverrideHallidayDomainName:d,dangerouslyOverrideApiBaseUrl:l,dangerouslyOverrideIPAddress:p,dangerouslyOverrideFeatureFlags:f}=c,{owner:h,statusCallback:m,funder:_,windowType:y}=u,g=d||e,v=h?.signMessage,w=h?.signTypedData,z=_?.sendTransaction||h?.sendTransaction,b=h?.address,E=_?.address,k=Uo.safeParse(b).success&&"function"==typeof w,I=Uo.safeParse(E).success&&"function"==typeof z;let A=null,$="FULL";try{A=window.origin,"MODAL"===y?$=(()=>{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"===y&&($="EMBED")}catch(e){}i();const T=[e=>{if(e.origin!==g||e.source!==t)return;const{type:n}=e.data||{};n===rr.EVENT_WINDOW_CLOSE&&i()}];if(k){const e=async e=>{if(e.origin!==g||e.source!==t)return;const{type:n,payload:o}=e.data||{};if(n===rr.ACTION_SIGN_MESSAGE){const{messageId:e,message:i,ownerAddress:r}=o;try{let o;if("function"!=typeof v)throw new Error("No signMessage function provided");o=await v({message:i,ownerAddress:r}),t?.postMessage({type:n,payload:{messageId:e,signature:o}},g)}catch(o){console.error("Error signing message",o),t?.postMessage({type:n,payload:{messageId:e,error:o instanceof Error?o.message:o}},g)}}else if(n===rr.ACTION_SIGN_TYPED_DATA){const{messageId:e,typedData:i,ownerAddress:r}=o;try{let o;if("function"!=typeof w)throw new Error("No signTypedData function provided");o=await w({typedData:i,ownerAddress:r}),t?.postMessage({type:n,payload:{messageId:e,signature:o}},g)}catch(o){console.error("Error signing typed data",o),t?.postMessage({type:n,payload:{messageId:e,error:o instanceof Error?o.message:o}},g)}}};T.push(e)}if(I){const e=async e=>{if(e.origin!==g||e.source!==t)return;const{type:n,payload:o}=e.data||{};if(n===rr.ACTION_TRANSACTION){const{messageId:e,chainConfig:i,transaction:r}=o;try{let o;if("function"!=typeof z)throw new Error("No sendTransaction function provided");o=await z(r,i),t?.postMessage({type:n,payload:{messageId:e,txReceipt:o}},g)}catch(o){console.error("Error handling transaction",o),t?.postMessage({type:n,payload:{messageId:e,error:o instanceof Error?o.message:o}},g)}}};T.push(e)}if(m){const e=e=>{if(e.origin!==g||e.source!==t)return;const{type:n,payload:o}=e.data||{};n===rr.EVENT_ORDER_STATUS&&m({type:n,payload:o})};T.push(e)}var x;T.push((async e=>{if(e.origin!==g||e.source!==t)return;const{type:o,payload:i}=e.data||{};if(o===rr.ACTION_PROVIDER_WIDGET&&t){const{url:e,redirectUrl:o,providerWidgetMode:r,workflowId:s}=i||{};if(!(e&&o&&r&&s))throw new Error("Invalid provider widget payload");let a=null;if("REDIRECT"===r)t.location=e,a=t;else{if("POPUP"!==r)throw new Error("Invalid provider widget mode");n=(e=>{const t=window.innerWidth/2-240;return window.open(e,"Provider Widget",`popup left=${t} top=70 width=480 height=638`)})(e),a=n}if(await(async({apiKey:e,baseURL:t,window:n,workflowId:o})=>{for(;!n.closed;){let n;try{n=await cr({apiKey:e,baseURL:t,workflowId:o})}catch(e){console.error("Error fetching payment status",e);break}const i=n.fulfilled.route.find((e=>"ONRAMP"===e.type)),r=i?.status;if("COMPLETE"===r)break;await new Promise((e=>setTimeout(e,5e3)))}})({apiKey:u.apiKey,baseURL:l||"https://v2.prod.halliday.xyz",workflowId:s,window:a}),a?.closed)return;"REDIRECT"===r?t.location=o:"POPUP"===r&&(n?.close(),n=null)}})),t=(e=>{const t=window.innerWidth/2-240,{windowType:n="POPUP",targetElementId:o,windowOrigin:i}=e,r=ur(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");(t?t.src:null)===r?t.style.display="block":(e.innerHTML="",t=document.createElement("iframe"),t.id="halliday-payments-embed",t.src=r,t.style.width="480px",t.style.height="638px",t.style.border="none",t.style.display="block",t.style.maxWidth="100%",t.style.maxHeight="100%",t.setAttribute("scrolling","no"),e.appendChild(t)),s=t.contentWindow;const n=e=>{const{type:t,payload:o}=e.data||{};if(e.origin===i&&e.source===s)if(t===rr.EVENT_WINDOW_CLOSE){window.removeEventListener("message",n);const e=document.getElementById("halliday-payments-embed");e&&(e.style.display="none")}else if(t===rr.EVENT_RESIZE){const e=document.getElementById("halliday-payments-embed");e&&o&&(void 0!==o.width&&(e.style.width=o.width+"px"),void 0!==o.height&&(e.style.height=o.height+"px"))}};window.addEventListener("message",n)}else if("MODAL"===n){let e=document.getElementById("halliday-payments-modal");(e?e.src:null)===r?e.style.display="block":(e&&e.remove(),e=document.createElement("iframe"),e.id="halliday-payments-modal",e.src=r,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100dvw",e.style.height="100dvh",e.style.border="none",e.style.zIndex="1000",e.setAttribute("scrolling","no"),document.body.appendChild(e));const t=e=>{if(e.origin!==i||e.source!==s)return;const{type:n}=e.data||{};if(n===rr.EVENT_WINDOW_CLOSE){window.removeEventListener("message",t);const e=document.getElementById("halliday-payments-modal");e&&(e.style.display="none")}};window.addEventListener("message",t),s=e.contentWindow}else s=window.open(r,"Halliday Payments",`popup left=${t} top=70 width=480 height=638`);return s})({...u,sandbox:u.sandbox||!1,hasOwner:k,hasTxHandler:I,windowOrigin:g,apiBaseUrl:l,hostOrigin:A,ownerAddress:b,funderAddress:E,ipAddress:p,featureFlags:f,appMode:$,fontName:u.fontName,paymentCategoryOrder:u.paymentCategoryOrder,headerTitle:u.headerTitle}),(x=T).forEach((e=>{window.addEventListener("message",e)})),o=x}}})();async function pr(e,...t){try{return lr.openWidget(e,...t)}catch(e){throw dr(e),e}}export{nr as AppMode,Mi as BorderStyle,Bi as CustomStyles,qi as FontName,Hi as HeaderTitle,rr as MessageType,Wi as OrderStatus,Gi as PaymentCategoryOrder,ir as PaymentsWidgetQueryParams,Ji as PaymentsWidgetSDKParams,ar as deserializeQueryParams,ur as getPaymentsWidgetUrl,pr as openHallidayPayments,sr as serializeQueryParams};
2
2
  //# sourceMappingURL=index.esm.min.js.map