@odus/checkout 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,79 +1,79 @@
1
- const P = ({ name: r }) => {
2
- const [e, ...t] = r?.split(" ") || [], [a] = t.reverse();
3
- return { firstName: e, lastName: a };
1
+ const L = (n) => n === "test" ? "https://sandbox-api.odus.com" : n === "live" ? "https://api.odus.com" : "http://localhost:3000", D = ({ name: n }) => {
2
+ const [e, ...t] = n?.split(" ") || [], [i] = t.reverse();
3
+ return { firstName: e, lastName: i };
4
4
  };
5
- class D {
5
+ class V {
6
6
  apiKey;
7
7
  baseUrl;
8
8
  browserInfo;
9
- constructor(e, t = "http://localhost:3000", a) {
10
- this.apiKey = e, this.baseUrl = t, this.browserInfo = a || { userAgent: navigator.userAgent };
9
+ constructor(e, t, i) {
10
+ this.apiKey = e, this.baseUrl = L(t), this.browserInfo = i || { userAgent: navigator.userAgent };
11
11
  }
12
12
  async fetchApi({
13
13
  endpoint: e,
14
14
  method: t = "POST",
15
- body: a,
16
- customHeaders: i = {}
15
+ body: i,
16
+ customHeaders: a = {}
17
17
  }) {
18
18
  const s = {
19
19
  Authorization: `Bearer ${this.apiKey}`,
20
20
  "Content-Type": "application/json",
21
- ...i
21
+ ...a
22
22
  };
23
23
  try {
24
- const n = await fetch(`${this.baseUrl}${e}`, {
24
+ const r = await fetch(`${this.baseUrl}${e}`, {
25
25
  method: t,
26
26
  headers: s,
27
- body: a ? JSON.stringify(a) : void 0
27
+ body: i ? JSON.stringify(i) : void 0
28
28
  });
29
- if (!n.ok) {
29
+ if (!r.ok) {
30
30
  let o;
31
31
  try {
32
- o = await n.json();
33
- } catch (d) {
34
- console.log("error", d);
32
+ o = await r.json();
33
+ } catch (c) {
34
+ console.log("error", c);
35
35
  }
36
36
  throw {
37
- message: o?.message[0] || `API request failed: ${n.status} ${n.statusText}`,
38
- status: n.status,
39
- statusText: n.statusText,
37
+ message: o?.message[0] || `API request failed: ${r.status} ${r.statusText}`,
38
+ status: r.status,
39
+ statusText: r.statusText,
40
40
  details: o
41
41
  };
42
42
  }
43
- return n.json();
44
- } catch (n) {
45
- throw n instanceof Error ? {
46
- message: n.message,
43
+ return r.json();
44
+ } catch (r) {
45
+ throw r instanceof Error ? {
46
+ message: r.message,
47
47
  status: 0,
48
48
  // Use 0 for network/client errors
49
49
  statusText: "Network Error",
50
- details: { message: n.message }
51
- } : n;
50
+ details: { message: r.message }
51
+ } : r;
52
52
  }
53
53
  }
54
54
  async authorizePayment({
55
55
  paymentId: e,
56
56
  checkoutKey: t,
57
- formData: a,
58
- token: i,
57
+ formData: i,
58
+ token: a,
59
59
  returnUrl: s
60
60
  }) {
61
- let n = {};
62
- if (i && a) {
63
- const o = a.cardExpiry.replace(/\s+/g, "").split("/"), l = o[0], d = o[1], { firstName: c, lastName: m } = P({ name: a.name });
64
- n = {
61
+ let r = {};
62
+ if (a && i) {
63
+ const o = i.cardExpiry.replace(/\s+/g, "").split("/"), l = o[0], c = o[1], { firstName: h, lastName: m } = D({ name: i.name });
64
+ r = {
65
65
  paymentMethodData: {
66
66
  type: "card",
67
67
  card: {
68
- token: i,
68
+ token: a,
69
69
  expMonth: l,
70
- expYear: `20${d}`,
71
- cardholderName: a.name
70
+ expYear: `20${c}`,
71
+ cardholderName: i.name
72
72
  }
73
73
  },
74
74
  customerData: {
75
- email: a.email,
76
- firstName: c,
75
+ email: i.email,
76
+ firstName: h,
77
77
  lastName: m
78
78
  },
79
79
  context: {
@@ -82,7 +82,7 @@ class D {
82
82
  }
83
83
  };
84
84
  } else
85
- n = {
85
+ r = {
86
86
  paymentMethodData: {
87
87
  type: "paypal"
88
88
  },
@@ -96,23 +96,27 @@ class D {
96
96
  customHeaders: {
97
97
  Authorization: `Bearer ${t}`
98
98
  },
99
- body: n
99
+ body: r
100
100
  });
101
101
  }
102
102
  }
103
- const A = "http://localhost:3000", $ = async ({ id: r, apiKey: e }) => {
104
- const t = await fetch(`${A}/checkout-profiles/${r}`, {
103
+ const A = async ({
104
+ id: n,
105
+ apiKey: e,
106
+ environment: t
107
+ }) => {
108
+ const i = L(t), a = await fetch(`${i}/checkout-profiles/${n}`, {
105
109
  method: "GET",
106
110
  headers: {
107
111
  "Content-Type": "application/json",
108
112
  Authorization: `Bearer ${e}`
109
113
  }
110
114
  });
111
- if (!t.ok)
112
- throw new Error(`HTTP error! Status: ${t.status}`);
113
- return await t.json();
115
+ if (!a.ok)
116
+ throw new Error(`HTTP error! Status: ${a.status}`);
117
+ return await a.json();
114
118
  };
115
- class V {
119
+ class $ {
116
120
  events = /* @__PURE__ */ new Map();
117
121
  /**
118
122
  * Subscribe to an event
@@ -122,8 +126,8 @@ class V {
122
126
  */
123
127
  subscribe(e, t) {
124
128
  return this.events.has(e) || this.events.set(e, /* @__PURE__ */ new Set()), this.events.get(e)?.add(t), () => {
125
- const a = this.events.get(e);
126
- a && (a.delete(t), a.size === 0 && this.events.delete(e));
129
+ const i = this.events.get(e);
130
+ i && (i.delete(t), i.size === 0 && this.events.delete(e));
127
131
  };
128
132
  }
129
133
  /**
@@ -132,8 +136,8 @@ class V {
132
136
  * @param data - The data to pass to subscribers
133
137
  */
134
138
  publish(e, t) {
135
- const a = this.events.get(e);
136
- a && a.forEach((i) => i(t));
139
+ const i = this.events.get(e);
140
+ i && i.forEach((a) => a(t));
137
141
  }
138
142
  /**
139
143
  * Clear all event subscriptions
@@ -150,7 +154,7 @@ class V {
150
154
  return this.events.get(e)?.size || 0;
151
155
  }
152
156
  }
153
- const R = new V();
157
+ const R = new $();
154
158
  class B {
155
159
  state;
156
160
  initialState;
@@ -196,46 +200,51 @@ class B {
196
200
  return this.state[e];
197
201
  }
198
202
  }
199
- function x(r) {
200
- return new B(r);
203
+ function x(n) {
204
+ return new B(n);
201
205
  }
202
206
  function O({
203
- apiKey: r,
204
- profileId: e
207
+ apiKey: n,
208
+ profileId: e,
209
+ environment: t
205
210
  }) {
206
- const t = x({
211
+ const i = x({
207
212
  checkoutProfile: void 0,
208
213
  isLoading: !0,
209
214
  error: null
210
215
  }), a = async () => {
211
216
  try {
212
- t.setState({ isLoading: !0 });
213
- const i = await $({ apiKey: r, id: e });
214
- i && t.setState({
215
- checkoutProfile: i,
217
+ i.setState({ isLoading: !0 });
218
+ const s = await A({
219
+ apiKey: n,
220
+ id: e,
221
+ environment: t
222
+ });
223
+ s && i.setState({
224
+ checkoutProfile: s,
216
225
  isLoading: !1,
217
226
  error: null
218
227
  });
219
- } catch (i) {
220
- t.setState({
228
+ } catch (s) {
229
+ i.setState({
221
230
  error: "Failed to load checkout profile",
222
231
  isLoading: !1
223
- }), console.error(i);
232
+ }), console.error(s);
224
233
  }
225
234
  };
226
235
  return a(), {
227
- getState: t.getState.bind(t),
228
- subscribe: t.subscribe.bind(t),
236
+ getState: i.getState.bind(i),
237
+ subscribe: i.subscribe.bind(i),
229
238
  reload: a
230
239
  };
231
240
  }
232
- const k = {
233
- cardNumber: (r) => (r.replace(/\s/g, "").match(/.{1,4}/g) || []).join(" "),
234
- cardExpiry: (r) => {
235
- const t = r.replace(/\D/g, "").slice(0, 4);
241
+ const T = {
242
+ cardNumber: (n) => (n.replace(/\s/g, "").match(/.{1,4}/g) || []).join(" "),
243
+ cardExpiry: (n) => {
244
+ const t = n.replace(/\D/g, "").slice(0, 4);
236
245
  return t.length > 2 ? `${t.slice(0, 2)} / ${t.slice(2)}` : t;
237
246
  }
238
- }, z = {
247
+ }, N = {
239
248
  "gmail.com": [
240
249
  "gmal.com",
241
250
  "gmil.com",
@@ -307,98 +316,98 @@ const k = {
307
316
  "comcast.net": ["comcast.com", "comcat.net", "comcst.net", "comcastnet", "comcast.nt", "comcas.net"],
308
317
  "verizon.net": ["verizon.com", "verizon.nt", "verizonnet", "verizn.net", "verizon.ne", "verzon.net"],
309
318
  "att.net": ["att.com", "at.net", "att.nt", "attnet", "att.ne", "attt.net"]
310
- }, H = (r) => {
311
- if (!r || r.includes("."))
319
+ }, H = (n) => {
320
+ if (!n || n.includes("."))
312
321
  return null;
313
322
  const e = ["com", "net", "org", "edu", "gov", "io", "co"];
314
323
  for (const t of e) {
315
- if (r === "companycok" && t === "co")
324
+ if (n === "companycok" && t === "co")
316
325
  return "company.co";
317
- if (r.endsWith(t) && !r.includes(".")) {
318
- const a = r.length - t.length;
319
- return `${r.substring(0, a)}.${t}`;
326
+ if (n.endsWith(t) && !n.includes(".")) {
327
+ const i = n.length - t.length;
328
+ return `${n.substring(0, i)}.${t}`;
320
329
  }
321
330
  }
322
331
  return null;
323
- }, j = (r, e) => {
324
- if (r.length === 0) return e.length;
325
- if (e.length === 0) return r.length;
326
- const t = e.length + 1, a = r.length + 1, i = Array.from(
332
+ }, j = (n, e) => {
333
+ if (n.length === 0) return e.length;
334
+ if (e.length === 0) return n.length;
335
+ const t = e.length + 1, i = n.length + 1, a = Array.from(
327
336
  { length: t },
328
- (s, n) => Array.from({ length: a }, (o, l) => n === 0 ? l : l === 0 ? n : 0)
337
+ (s, r) => Array.from({ length: i }, (o, l) => r === 0 ? l : l === 0 ? r : 0)
329
338
  );
330
339
  for (let s = 1; s < t; s++)
331
- for (let n = 1; n < a; n++) {
332
- const o = r[n - 1] === e[s - 1] ? 0 : 1;
333
- i[s][n] = Math.min(
334
- i[s - 1][n] + 1,
340
+ for (let r = 1; r < i; r++) {
341
+ const o = n[r - 1] === e[s - 1] ? 0 : 1;
342
+ a[s][r] = Math.min(
343
+ a[s - 1][r] + 1,
335
344
  // deletion
336
- i[s][n - 1] + 1,
345
+ a[s][r - 1] + 1,
337
346
  // insertion
338
- i[s - 1][n - 1] + o
347
+ a[s - 1][r - 1] + o
339
348
  // substitution
340
349
  );
341
350
  }
342
- return i[e.length][r.length];
343
- }, K = (r) => {
344
- let t = null, a = 3;
345
- const i = r.toLowerCase();
346
- for (const s of Object.keys(z)) {
347
- const n = j(i, s);
348
- n <= 2 && n < a && (a = n, t = s);
351
+ return a[e.length][n.length];
352
+ }, K = (n) => {
353
+ let t = null, i = 3;
354
+ const a = n.toLowerCase();
355
+ for (const s of Object.keys(N)) {
356
+ const r = j(a, s);
357
+ r <= 2 && r < i && (i = r, t = s);
349
358
  }
350
359
  return t;
351
360
  }, U = () => {
352
- const { t: r } = L();
361
+ const { t: n } = M();
353
362
  return {
354
363
  validateEmail: (t) => {
355
- const a = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
364
+ const i = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
356
365
  if (!t)
357
366
  return {
358
367
  isValid: !1,
359
- message: r("validation.emailInvalid"),
368
+ message: n("validation.emailInvalid"),
360
369
  suggestion: null
361
370
  };
362
- const i = t.indexOf("@");
363
- if (i === -1)
371
+ const a = t.indexOf("@");
372
+ if (a === -1)
364
373
  return {
365
374
  isValid: !1,
366
- message: r("validation.emailInvalid"),
375
+ message: n("validation.emailInvalid"),
367
376
  suggestion: null
368
377
  };
369
- const s = t.substring(0, i), n = t.substring(i + 1);
370
- if (!n.includes(".")) {
371
- const l = H(n);
378
+ const s = t.substring(0, a), r = t.substring(a + 1);
379
+ if (!r.includes(".")) {
380
+ const l = H(r);
372
381
  if (l)
373
382
  return {
374
383
  isValid: !1,
375
- message: r("validation.emailSuggestion", {
384
+ message: n("validation.emailSuggestion", {
376
385
  email: `${s}@${l}`
377
386
  }),
378
387
  suggestion: `${s}@${l}`
379
388
  };
380
- for (const d of Object.keys(z))
381
- if (d.replace(/\./g, "") === n)
389
+ for (const c of Object.keys(N))
390
+ if (c.replace(/\./g, "") === r)
382
391
  return {
383
392
  isValid: !1,
384
- message: r("validation.emailSuggestion", {
385
- email: `${s}@${d}`
393
+ message: n("validation.emailSuggestion", {
394
+ email: `${s}@${c}`
386
395
  }),
387
- suggestion: `${s}@${d}`
396
+ suggestion: `${s}@${c}`
388
397
  };
389
398
  }
390
- if (!a.test(t))
399
+ if (!i.test(t))
391
400
  return {
392
401
  isValid: !1,
393
- message: r("validation.emailInvalid"),
402
+ message: n("validation.emailInvalid"),
394
403
  suggestion: null
395
404
  };
396
- const o = K(n);
397
- if (o && o !== n) {
405
+ const o = K(r);
406
+ if (o && o !== r) {
398
407
  const l = `${s}@${o}`;
399
408
  return {
400
409
  isValid: !1,
401
- message: r("validation.emailSuggestion", { email: l }),
410
+ message: n("validation.emailSuggestion", { email: l }),
402
411
  suggestion: l
403
412
  };
404
413
  }
@@ -410,29 +419,29 @@ const k = {
410
419
  }
411
420
  };
412
421
  }, q = () => {
413
- const { t: r } = L(), { validateEmail: e } = U();
422
+ const { t: n } = M(), { validateEmail: e } = U();
414
423
  return {
415
424
  email: (t) => {
416
- const a = e(t);
417
- return a.isValid ? void 0 : a.message;
425
+ const i = e(t);
426
+ return i.isValid ? void 0 : i.message;
418
427
  },
419
428
  name: (t) => {
420
429
  if (!t.trim())
421
- return r("validation.nameRequired");
430
+ return n("validation.nameRequired");
422
431
  },
423
432
  cardExpiry: (t) => {
424
- const a = t.replace(/\s/g, ""), [i, s] = a.split("/").map((m) => m.trim());
425
- if (!i || !s || i.length !== 2 || s.length !== 2)
426
- return r("validation.cardExpiryFormat");
427
- const n = /* @__PURE__ */ new Date(), o = n.getFullYear() % 100, l = n.getMonth() + 1, d = parseInt(i, 10), c = parseInt(s, 10);
428
- if (d < 1 || d > 12)
429
- return r("validation.cardExpiryFormat");
430
- if (c < o || c === o && d < l)
431
- return r("validation.cardExpiryInvalid");
433
+ const i = t.replace(/\s/g, ""), [a, s] = i.split("/").map((m) => m.trim());
434
+ if (!a || !s || a.length !== 2 || s.length !== 2)
435
+ return n("validation.cardExpiryFormat");
436
+ const r = /* @__PURE__ */ new Date(), o = r.getFullYear() % 100, l = r.getMonth() + 1, c = parseInt(a, 10), h = parseInt(s, 10);
437
+ if (c < 1 || c > 12)
438
+ return n("validation.cardExpiryFormat");
439
+ if (h < o || h === o && c < l)
440
+ return n("validation.cardExpiryInvalid");
432
441
  }
433
442
  };
434
- }, G = () => {
435
- const r = q(), e = x({
443
+ }, _ = () => {
444
+ const n = q(), e = x({
436
445
  formData: {
437
446
  name: "",
438
447
  email: "",
@@ -445,83 +454,91 @@ const k = {
445
454
  cardExpiry: !1
446
455
  },
447
456
  isValid: !1
448
- }), t = (l, d) => {
449
- const c = r[l];
450
- return c?.(d);
451
- }, a = (l) => {
452
- const d = {};
453
- return Object.keys(l).forEach((c) => {
454
- const m = t(c, l[c]);
455
- m && (d[c] = m);
456
- }), d;
457
+ }), t = (l, c) => {
458
+ const h = n[l];
459
+ return h?.(c);
457
460
  }, i = (l) => {
458
- const d = a(l);
459
- return Object.keys(d).length === 0;
460
- }, s = (l, d) => {
461
- const c = e.getState();
462
- let m = d;
463
- l in k && (m = k[l](d));
464
- const p = {
465
- ...c.formData,
461
+ const c = {};
462
+ return Object.keys(l).forEach((h) => {
463
+ const m = t(h, l[h]);
464
+ m && (c[h] = m);
465
+ }), c;
466
+ }, a = (l) => {
467
+ const c = i(l);
468
+ return Object.keys(c).length === 0;
469
+ }, s = (l, c) => {
470
+ const h = e.getState();
471
+ let m = c;
472
+ l in T && (m = T[l](c));
473
+ const u = {
474
+ ...h.formData,
466
475
  [l]: m
467
- }, u = { ...c.errors };
468
- if (c.touched[l]) {
476
+ }, p = { ...h.errors };
477
+ if (h.touched[l]) {
469
478
  const f = t(l, m);
470
- f ? u[l] = f : delete u[l];
479
+ f ? p[l] = f : delete p[l];
471
480
  }
472
481
  e.setState({
473
- formData: p,
474
- errors: u,
475
- isValid: i(p)
482
+ formData: u,
483
+ errors: p,
484
+ isValid: a(u)
476
485
  });
477
- }, n = (l, d) => {
478
- const c = e.getState(), m = {
479
- ...c.touched,
486
+ }, r = (l, c) => {
487
+ const h = e.getState(), m = {
488
+ ...h.touched,
480
489
  [l]: !0
481
- }, p = t(l, d), u = { ...c.errors };
482
- p ? u[l] = p : delete u[l], e.setState({
490
+ }, u = t(l, c), p = { ...h.errors };
491
+ u ? p[l] = u : delete p[l], e.setState({
483
492
  touched: m,
484
- errors: u
493
+ errors: p
485
494
  });
486
495
  }, o = (l) => {
487
- const c = {
496
+ const h = {
488
497
  ...e.getState().formData,
489
498
  ...l
490
499
  };
491
500
  e.setState({
492
- formData: c,
493
- isValid: i(c)
501
+ formData: h,
502
+ isValid: a(h)
494
503
  });
495
504
  };
496
505
  return {
497
506
  getFormState: e.getState.bind(e),
498
507
  subscribe: e.subscribe.bind(e),
499
508
  handleChange: s,
500
- handleBlur: n,
509
+ handleBlur: r,
501
510
  setFormData: o,
502
511
  reset: e.resetState.bind(e)
503
512
  };
504
- }, _ = "http://localhost:3000", Z = async ({ props: r, apiKey: e }) => {
505
- const t = await fetch(`${_}/tokenization/generate-iframe-configuration`, {
506
- method: "POST",
507
- headers: {
508
- "Content-Type": "application/json",
509
- Authorization: `Bearer ${e}`
510
- },
511
- body: JSON.stringify(r)
512
- });
513
- if (!t.ok)
514
- throw new Error(`HTTP error! Status: ${t.status}`);
515
- return await t.json();
513
+ }, G = async ({
514
+ props: n,
515
+ apiKey: e,
516
+ environment: t
517
+ }) => {
518
+ const i = L(t), a = await fetch(
519
+ `${i}/tokenization/generate-iframe-configuration`,
520
+ {
521
+ method: "POST",
522
+ headers: {
523
+ "Content-Type": "application/json",
524
+ Authorization: `Bearer ${e}`
525
+ },
526
+ body: JSON.stringify(n)
527
+ }
528
+ );
529
+ if (!a.ok)
530
+ throw new Error(`HTTP error! Status: ${a.status}`);
531
+ return await a.json();
516
532
  };
517
- function Y({
518
- apiKey: r,
533
+ function Z({
534
+ apiKey: n,
519
535
  // scriptLoaded,
520
536
  checkoutProfile: e,
521
537
  inputStyles: t,
522
- setFormData: a
538
+ setFormData: i,
539
+ environment: a
523
540
  }) {
524
- const i = x({
541
+ const s = x({
525
542
  iframeConfig: void 0,
526
543
  loadingIframe: !0,
527
544
  isCcValid: !1,
@@ -530,33 +547,34 @@ function Y({
530
547
  isCvvFocused: !1,
531
548
  possibleCardType: "unknown"
532
549
  });
533
- let s = null;
534
- const n = async () => {
550
+ let r = null;
551
+ const o = async () => {
535
552
  try {
536
- const c = await Z({
553
+ const m = await G({
537
554
  props: {
538
555
  allowedOrigins: [globalThis.location.origin]
539
556
  },
540
- apiKey: r
557
+ apiKey: n,
558
+ environment: a
541
559
  });
542
- c && (i.setState({
560
+ m && (s.setState({
543
561
  iframeConfig: {
544
- ...c,
562
+ ...m,
545
563
  origin: globalThis.location.origin
546
564
  }
547
- }), o());
548
- } catch (c) {
549
- console.error("Failed to generate iframe config:", c);
565
+ }), l());
566
+ } catch (m) {
567
+ console.error("Failed to generate iframe config:", m);
550
568
  }
551
- }, o = () => {
552
- const c = i.getState();
553
- if (c.iframeConfig && e) {
569
+ }, l = () => {
570
+ const m = s.getState();
571
+ if (m.iframeConfig && e) {
554
572
  if (!globalThis.TokenEx?.Iframe) {
555
573
  console.error("TokenEx script not loaded correctly");
556
574
  return;
557
575
  }
558
- s = new globalThis.TokenEx.Iframe("card-element", {
559
- ...c.iframeConfig,
576
+ r = new globalThis.TokenEx.Iframe("card-element", {
577
+ ...m.iframeConfig,
560
578
  placeholder: "1234 1234 1234 1234",
561
579
  cvvPlaceholder: "CVC",
562
580
  cvv: !0,
@@ -579,115 +597,115 @@ function Y({
579
597
  base: `${t.base}; border-radius: 0px 0px ${e.styles.borderRadius}px 0px`
580
598
  }
581
599
  }
582
- }), s.on("load", () => {
583
- i.setState({ loadingIframe: !1 });
584
- }), s.on("autoCompleteValues", function(m) {
585
- const { nameOnCard: p, cardExp: u } = m;
586
- a({
600
+ }), r.on("load", () => {
601
+ s.setState({ loadingIframe: !1 });
602
+ }), r.on("autoCompleteValues", function(u) {
603
+ const { nameOnCard: p, cardExp: f } = u;
604
+ i({
587
605
  name: p,
588
- cardExpiry: u
606
+ cardExpiry: f
589
607
  });
590
- }), s.on("validate", function(m) {
591
- const { isValid: p, isCvvValid: u } = m;
592
- i.setState({
608
+ }), r.on("validate", function(u) {
609
+ const { isValid: p, isCvvValid: f } = u;
610
+ s.setState({
593
611
  isCcValid: p,
594
- isCvvValid: u
612
+ isCvvValid: f
595
613
  });
596
- }), s.on("focus", function() {
597
- i.setState({ isFocused: !0 });
598
- }), s.on("blur", function() {
599
- i.setState({ isFocused: !1 });
600
- }), s.on("cvvFocus", function() {
601
- i.setState({ isCvvFocused: !0 });
602
- }), s.on("cvvBlur", function() {
603
- i.setState({ isCvvFocused: !1 });
604
- }), s.on(
614
+ }), r.on("focus", function() {
615
+ s.setState({ isFocused: !0 });
616
+ }), r.on("blur", function() {
617
+ s.setState({ isFocused: !1 });
618
+ }), r.on("cvvFocus", function() {
619
+ s.setState({ isCvvFocused: !0 });
620
+ }), r.on("cvvBlur", function() {
621
+ s.setState({ isCvvFocused: !1 });
622
+ }), r.on(
605
623
  "cardTypeChange",
606
- function({ possibleCardType: m }) {
607
- i.setState({ possibleCardType: m });
624
+ function({ possibleCardType: u }) {
625
+ s.setState({ possibleCardType: u });
608
626
  }
609
- ), s.load();
627
+ ), r.load();
610
628
  }
611
629
  };
612
- r && n();
613
- const l = () => {
614
- s && (s.remove(), s = null);
615
- }, d = async (c) => {
616
- s && (s.on("tokenize", async function(m) {
617
- await c(m);
618
- }), s.tokenize());
630
+ n && o();
631
+ const c = () => {
632
+ r && (r.remove(), r = null);
633
+ }, h = async (m) => {
634
+ r && (r.on("tokenize", async function(u) {
635
+ await m(u);
636
+ }), r.tokenize());
619
637
  };
620
638
  return {
621
- getState: i.getState.bind(i),
622
- subscribe: i.subscribe.bind(i),
623
- tokenize: d,
624
- cleanup: l
639
+ getState: s.getState.bind(s),
640
+ subscribe: s.subscribe.bind(s),
641
+ tokenize: h,
642
+ cleanup: c
625
643
  };
626
644
  }
627
- const J = "E-Mail", W = "Name des/der Karteninhaber/in", X = "Kartendaten", Q = "Vollständiger Name", ee = "MM / JJ", te = "Das Fenster nicht schließen", ae = { pay: "ZAHLEN", submit: "ABSENDEN", getPlan: "MEINEN PLAN ERHALTEN", donate: "spenden", book: "jetzt buchen", order: "jetzt bestellen" }, ie = { emailSuggestion: "Meinten Sie {{email}}?", emailInvalid: "Ihre E-Mail-Adresse ist nicht korrekt", cardExpiryInvalid: "Das Ablaufdatum Ihrer Karte liegt in der Vergangenheit", cardExpiryFormat: "Das Ablaufdatum Ihrer Karte ist unvollständig", cardSecurityFormat: "Der Sicherheitscode Ihrer Karte ist unvollständig", nameRequired: "Gib deinen Namen genau so ein, wie er auf deiner Karte steht", cardNumberInvalid: "Die Kartennummer ist unvollständig" }, se = {
628
- email: J,
629
- cardholderNameLabel: W,
630
- cardInformation: X,
631
- cardholderNamePlaceholder: Q,
632
- cardExpiry: ee,
633
- loading: te,
634
- buttonTexts: ae,
645
+ const Y = "E-Mail", J = "Name des/der Karteninhaber/in", W = "Kartendaten", X = "Vollständiger Name", Q = "MM / JJ", ee = "Das Fenster nicht schließen", te = { pay: "ZAHLEN", submit: "ABSENDEN", getPlan: "MEINEN PLAN ERHALTEN", donate: "spenden", book: "jetzt buchen", order: "jetzt bestellen" }, ie = { emailSuggestion: "Meinten Sie {{email}}?", emailInvalid: "Ihre E-Mail-Adresse ist nicht korrekt", cardExpiryInvalid: "Das Ablaufdatum Ihrer Karte liegt in der Vergangenheit", cardExpiryFormat: "Das Ablaufdatum Ihrer Karte ist unvollständig", cardSecurityFormat: "Der Sicherheitscode Ihrer Karte ist unvollständig", nameRequired: "Gib deinen Namen genau so ein, wie er auf deiner Karte steht", cardNumberInvalid: "Die Kartennummer ist unvollständig" }, ae = {
646
+ email: Y,
647
+ cardholderNameLabel: J,
648
+ cardInformation: W,
649
+ cardholderNamePlaceholder: X,
650
+ cardExpiry: Q,
651
+ loading: ee,
652
+ buttonTexts: te,
635
653
  validation: ie
636
- }, re = "Email", ne = "Cardholder name", oe = "Card information", le = "Full name on card", ce = "MM / YY", de = "Do not close the window", he = { pay: "PAY", submit: "SUBMIT", getPlan: "GET MY PLAN", donate: "DONATE", book: "BOOK NOW", order: "ORDER NOW" }, me = { emailSuggestion: "Did you mean {{email}}?", emailInvalid: "Your email is not correct", cardExpiryInvalid: "Your card's expiration date is in the past", cardExpiryFormat: "Your card’s expiration date is incomplete", cardSecurityFormat: "Your card’s security code is incomplete", nameRequired: "Please enter the name as it appears on your card", cardNumberInvalid: "Your card number is invalid" }, ue = {
637
- email: re,
638
- cardholderNameLabel: ne,
639
- cardInformation: oe,
640
- cardholderNamePlaceholder: le,
641
- cardExpiry: ce,
642
- loading: de,
643
- buttonTexts: he,
644
- validation: me
645
- }, pe = "Correo electrónico", fe = "Nombre del titular de la tarjeta", ge = "Información de la tarjeta", ye = "Nombre completo en la tarjeta", ve = "MM / AA", Ee = "Por favor, no cierre esta ventana", be = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTENER MI PLAN", donate: "DONAR", book: "RESERVAR AHORA", order: "ORDENAR AHORA" }, Ce = { emailSuggestion: "¿Quisiste decir {{email}}?", emailInvalid: "Su correo electrónico no es válido", cardExpiryInvalid: "La fecha de vencimiento de la tarjeta ya pasó", cardExpiryFormat: "La fecha de vencimiento de su tarjeta está incompleta", cardSecurityFormat: "El código de seguridad de su tarjeta está incompleto", nameRequired: "Por favor, ingrese el nombre tal como aparece en su tarjeta", cardNumberInvalid: "Su número de tarjeta no es válido" }, Se = {
646
- email: pe,
647
- cardholderNameLabel: fe,
648
- cardInformation: ge,
649
- cardholderNamePlaceholder: ye,
650
- cardExpiry: ve,
651
- loading: Ee,
652
- buttonTexts: be,
653
- validation: Ce
654
- }, xe = "E-mail", Fe = "Nom du titulaire de la carte", we = "Informations de la carte", Le = "Nom complet figurant sur la carte", Me = "MM / AA", ke = "Veuillez ne pas fermer cette fenêtre", Te = { pay: "PAYER", submit: "ENVOYER", getPlan: "OBTENIR MON PLAN", donate: "FAIRE UN DON", book: "RÉSERVER MAINTENANT", order: "COMMANDER MAINTENANT" }, Ie = { emailSuggestion: "Vouliez-vous dire {{email}}?", emailInvalid: "Votre adresse e-mail n’est pas valide", cardExpiryInvalid: "La date d'expiration de votre carte est dans le passé", cardExpiryFormat: "La date d’expiration de votre carte est incomplète", cardSecurityFormat: "Le code de sécurité de votre carte est incomplet", nameRequired: "Veuillez saisir le nom tel qu’il figure sur votre carte", cardNumberInvalid: "Votre numéro de carte est invalide" }, ze = {
655
- email: xe,
656
- cardholderNameLabel: Fe,
657
- cardInformation: we,
658
- cardholderNamePlaceholder: Le,
659
- cardExpiry: Me,
660
- loading: ke,
661
- buttonTexts: Te,
662
- validation: Ie
663
- }, Ne = "Adres e-mail", Pe = "Imię i nazwisko posiadacza karty", De = "Informacje o karcie", Ae = "Imię i nazwisko na karcie", $e = "MM / RR", Ve = "Proszę nie zamykać tego okna", Re = { pay: "ZAPŁAĆ", submit: "WYŚLIJ", getPlan: "POBIERZ MÓJ PLAN", donate: "PRZEKAŻ DAROWIZNĘ", book: "ZAREZERWUJ TERAZ", order: "ZAMÓW TERAZ" }, Be = { emailSuggestion: "Czy chodziło Ci o {{email}}?", emailInvalid: "Państwa adres e-mail jest nieprawidłowy", cardExpiryInvalid: "Data ważności Państwa karty jest w przeszłości", cardExpiryFormat: "Data ważności Państwa karty jest niekompletna", cardSecurityFormat: "Kod zabezpieczający Państwa karty jest niekompletny", nameRequired: "Proszę wpisać imię i nazwisko tak, jak widnieje na karcie", cardNumberInvalid: "Numer Państwa karty jest nieprawidłowy" }, Oe = {
664
- email: Ne,
665
- cardholderNameLabel: Pe,
666
- cardInformation: De,
667
- cardholderNamePlaceholder: Ae,
668
- cardExpiry: $e,
669
- loading: Ve,
670
- buttonTexts: Re,
671
- validation: Be
672
- }, He = "E-mail", je = "Nome do titular do cartão", Ke = "Informações do cartão", Ue = "Nome completo no cartão", qe = "MM / AA", Ge = "Por favor, não feche esta janela", _e = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTER MEU PLANO", donate: "DOAR", book: "RESERVAR AGORA", order: "FAZER PEDIDO" }, Ze = { emailSuggestion: "Você quis dizer {{email}}?", emailInvalid: "O seu endereço de e-mail não é válido", cardExpiryInvalid: "A data de validade do seu cartão está no passado", cardExpiryFormat: "A data de validade do seu cartão está incompleta", cardSecurityFormat: "O código de segurança do seu cartão está incompleto", nameRequired: "Por favor, insira o nome conforme aparece no cartão", cardNumberInvalid: "O número do seu cartão é inválido" }, Ye = {
673
- email: He,
674
- cardholderNameLabel: je,
675
- cardInformation: Ke,
676
- cardholderNamePlaceholder: Ue,
677
- cardExpiry: qe,
678
- loading: Ge,
654
+ }, se = "Email", re = "Cardholder name", ne = "Card information", oe = "Full name on card", le = "MM / YY", ce = "Do not close the window", de = { pay: "PAY", submit: "SUBMIT", getPlan: "GET MY PLAN", donate: "DONATE", book: "BOOK NOW", order: "ORDER NOW" }, he = { emailSuggestion: "Did you mean {{email}}?", emailInvalid: "Your email is not correct", cardExpiryInvalid: "Your card's expiration date is in the past", cardExpiryFormat: "Your card’s expiration date is incomplete", cardSecurityFormat: "Your card’s security code is incomplete", nameRequired: "Please enter the name as it appears on your card", cardNumberInvalid: "Your card number is invalid" }, me = {
655
+ email: se,
656
+ cardholderNameLabel: re,
657
+ cardInformation: ne,
658
+ cardholderNamePlaceholder: oe,
659
+ cardExpiry: le,
660
+ loading: ce,
661
+ buttonTexts: de,
662
+ validation: he
663
+ }, ue = "Correo electrónico", pe = "Nombre del titular de la tarjeta", fe = "Información de la tarjeta", ge = "Nombre completo en la tarjeta", ye = "MM / AA", ve = "Por favor, no cierre esta ventana", Ee = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTENER MI PLAN", donate: "DONAR", book: "RESERVAR AHORA", order: "ORDENAR AHORA" }, be = { emailSuggestion: "¿Quisiste decir {{email}}?", emailInvalid: "Su correo electrónico no es válido", cardExpiryInvalid: "La fecha de vencimiento de la tarjeta ya pasó", cardExpiryFormat: "La fecha de vencimiento de su tarjeta está incompleta", cardSecurityFormat: "El código de seguridad de su tarjeta está incompleto", nameRequired: "Por favor, ingrese el nombre tal como aparece en su tarjeta", cardNumberInvalid: "Su número de tarjeta no es válido" }, Ce = {
664
+ email: ue,
665
+ cardholderNameLabel: pe,
666
+ cardInformation: fe,
667
+ cardholderNamePlaceholder: ge,
668
+ cardExpiry: ye,
669
+ loading: ve,
670
+ buttonTexts: Ee,
671
+ validation: be
672
+ }, Se = "E-mail", xe = "Nom du titulaire de la carte", Fe = "Informations de la carte", we = "Nom complet figurant sur la carte", Le = "MM / AA", Me = "Veuillez ne pas fermer cette fenêtre", ke = { pay: "PAYER", submit: "ENVOYER", getPlan: "OBTENIR MON PLAN", donate: "FAIRE UN DON", book: "RÉSERVER MAINTENANT", order: "COMMANDER MAINTENANT" }, Te = { emailSuggestion: "Vouliez-vous dire {{email}}?", emailInvalid: "Votre adresse e-mail n’est pas valide", cardExpiryInvalid: "La date d'expiration de votre carte est dans le passé", cardExpiryFormat: "La date d’expiration de votre carte est incomplète", cardSecurityFormat: "Le code de sécurité de votre carte est incomplet", nameRequired: "Veuillez saisir le nom tel qu’il figure sur votre carte", cardNumberInvalid: "Votre numéro de carte est invalide" }, Ie = {
673
+ email: Se,
674
+ cardholderNameLabel: xe,
675
+ cardInformation: Fe,
676
+ cardholderNamePlaceholder: we,
677
+ cardExpiry: Le,
678
+ loading: Me,
679
+ buttonTexts: ke,
680
+ validation: Te
681
+ }, ze = "Adres e-mail", Ne = "Imię i nazwisko posiadacza karty", Pe = "Informacje o karcie", De = "Imię i nazwisko na karcie", Ve = "MM / RR", Ae = "Proszę nie zamykać tego okna", $e = { pay: "ZAPŁAĆ", submit: "WYŚLIJ", getPlan: "POBIERZ MÓJ PLAN", donate: "PRZEKAŻ DAROWIZNĘ", book: "ZAREZERWUJ TERAZ", order: "ZAMÓW TERAZ" }, Re = { emailSuggestion: "Czy chodziło Ci o {{email}}?", emailInvalid: "Państwa adres e-mail jest nieprawidłowy", cardExpiryInvalid: "Data ważności Państwa karty jest w przeszłości", cardExpiryFormat: "Data ważności Państwa karty jest niekompletna", cardSecurityFormat: "Kod zabezpieczający Państwa karty jest niekompletny", nameRequired: "Proszę wpisać imię i nazwisko tak, jak widnieje na karcie", cardNumberInvalid: "Numer Państwa karty jest nieprawidłowy" }, Be = {
682
+ email: ze,
683
+ cardholderNameLabel: Ne,
684
+ cardInformation: Pe,
685
+ cardholderNamePlaceholder: De,
686
+ cardExpiry: Ve,
687
+ loading: Ae,
688
+ buttonTexts: $e,
689
+ validation: Re
690
+ }, Oe = "E-mail", He = "Nome do titular do cartão", je = "Informações do cartão", Ke = "Nome completo no cartão", Ue = "MM / AA", qe = "Por favor, não feche esta janela", _e = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTER MEU PLANO", donate: "DOAR", book: "RESERVAR AGORA", order: "FAZER PEDIDO" }, Ge = { emailSuggestion: "Você quis dizer {{email}}?", emailInvalid: "O seu endereço de e-mail não é válido", cardExpiryInvalid: "A data de validade do seu cartão está no passado", cardExpiryFormat: "A data de validade do seu cartão está incompleta", cardSecurityFormat: "O código de segurança do seu cartão está incompleto", nameRequired: "Por favor, insira o nome conforme aparece no cartão", cardNumberInvalid: "O número do seu cartão é inválido" }, Ze = {
691
+ email: Oe,
692
+ cardholderNameLabel: He,
693
+ cardInformation: je,
694
+ cardholderNamePlaceholder: Ke,
695
+ cardExpiry: Ue,
696
+ loading: qe,
679
697
  buttonTexts: _e,
680
- validation: Ze
681
- }, T = {
682
- en: ue,
683
- de: se,
684
- es: Se,
685
- fr: ze,
686
- pl: Oe,
687
- pt: Ye
698
+ validation: Ge
699
+ }, I = {
700
+ en: me,
701
+ de: ae,
702
+ es: Ce,
703
+ fr: Ie,
704
+ pl: Be,
705
+ pt: Ze
688
706
  // Add other locales here
689
707
  };
690
- class Je {
708
+ class Ye {
691
709
  locale;
692
710
  loadedLocales = /* @__PURE__ */ new Set();
693
711
  constructor(e = "en") {
@@ -700,115 +718,121 @@ class Je {
700
718
  return this.locale;
701
719
  }
702
720
  translate(e, t) {
703
- const a = this.getNestedTranslation(e);
704
- return !t || a === e ? a : this.interpolate(a, t);
721
+ const i = this.getNestedTranslation(e);
722
+ return !t || i === e ? i : this.interpolate(i, t);
705
723
  }
706
724
  /* eslint-disable @typescript-eslint/no-explicit-any */
707
725
  getNestedTranslation(e) {
708
- const t = this.locale in T ? T[this.locale] : {}, a = this.findNestedValue(t, e);
709
- return a === void 0 ? e : a;
726
+ const t = this.locale in I ? I[this.locale] : {}, i = this.findNestedValue(t, e);
727
+ return i === void 0 ? e : i;
710
728
  }
711
729
  findNestedValue(e, t) {
712
- const a = t.split(".");
713
- let i = e;
714
- for (const s of a) {
715
- if (i == null || !Object.prototype.hasOwnProperty.call(i, s))
730
+ const i = t.split(".");
731
+ let a = e;
732
+ for (const s of i) {
733
+ if (a == null || !Object.prototype.hasOwnProperty.call(a, s))
716
734
  return;
717
- i = i[s];
735
+ a = a[s];
718
736
  }
719
- return typeof i == "string" ? i : void 0;
737
+ return typeof a == "string" ? a : void 0;
720
738
  }
721
739
  interpolate(e, t) {
722
- return e.replace(/{{(\w+)}}/g, (a, i) => {
723
- const s = t[i];
724
- return s === void 0 ? a : String(s);
740
+ return e.replace(/{{(\w+)}}/g, (i, a) => {
741
+ const s = t[a];
742
+ return s === void 0 ? i : String(s);
725
743
  });
726
744
  }
727
745
  }
728
- const I = ["en", "de", "es", "fr", "pl", "pt"], We = "en";
729
- function Xe(r) {
730
- const e = new Je(), a = (() => {
746
+ const z = ["en", "de", "es", "fr", "pl", "pt"], Je = "en";
747
+ function We(n) {
748
+ const e = new Ye(), i = (() => {
731
749
  const o = navigator?.language?.split("-")[0]?.toLowerCase();
732
- return I.includes(o) ? o : We;
750
+ return z.includes(o) ? o : Je;
733
751
  })();
734
- e.setLocale(a);
735
- const i = x({
736
- locale: a,
752
+ e.setLocale(i);
753
+ const a = x({
754
+ locale: i,
737
755
  translationService: e
738
756
  });
739
757
  return {
740
- store: i,
741
- translate: (o, l) => i.getState().translationService.translate(o, l),
758
+ store: a,
759
+ translate: (o, l) => a.getState().translationService.translate(o, l),
742
760
  setLocale: (o) => {
743
- I.includes(o) && (i.getState().translationService.setLocale(o), i.setState({ locale: o }));
761
+ z.includes(o) && (a.getState().translationService.setLocale(o), a.setState({ locale: o }));
744
762
  },
745
- getLocale: () => i.getValue("locale"),
746
- subscribe: i.subscribe.bind(i)
763
+ getLocale: () => a.getValue("locale"),
764
+ subscribe: a.subscribe.bind(a)
747
765
  };
748
766
  }
749
- const Qe = Xe(), L = () => {
750
- const { translate: r, getLocale: e, setLocale: t, subscribe: a } = Qe;
767
+ const Xe = We(), M = () => {
768
+ const { translate: n, getLocale: e, setLocale: t, subscribe: i } = Xe;
751
769
  return {
752
- t: r,
753
- translate: r,
770
+ t: n,
771
+ translate: n,
754
772
  locale: e(),
755
773
  setLocale: t,
756
- subscribe: a
774
+ subscribe: i
757
775
  };
758
- }, et = ({ fontFamily: r }) => {
759
- if (!r)
776
+ }, Qe = ({ fontFamily: n }) => {
777
+ if (!n)
760
778
  return { cleanup: () => {
761
779
  } };
762
- const e = r.replace(/\s+/g, "+"), t = `https://fonts.googleapis.com/css2?family=${e}:wght@400;700&display=swap`, a = [...document.head.querySelectorAll("link")].filter(
780
+ const e = n.replace(/\s+/g, "+"), t = `https://fonts.googleapis.com/css2?family=${e}:wght@400;700&display=swap`, i = [...document.head.querySelectorAll("link")].filter(
763
781
  (o) => o.href.includes("fonts.googleapis.com/css2") && o.rel === "stylesheet"
764
- ), i = document.createElement("link");
765
- i.rel = "stylesheet", i.href = t;
766
- const s = a.find(
782
+ ), a = document.createElement("link");
783
+ a.rel = "stylesheet", a.href = t;
784
+ const s = i.find(
767
785
  (o) => o.href.includes(`family=${e}`)
768
786
  );
769
787
  if (s)
770
788
  s.href = t;
771
- else if (a.length > 0) {
772
- const o = a.at(
789
+ else if (i.length > 0) {
790
+ const o = i.at(
773
791
  -1
774
792
  );
775
- o?.nextSibling ? document.head.insertBefore(i, o.nextSibling) : document.head.appendChild(i);
793
+ o?.nextSibling ? document.head.insertBefore(a, o.nextSibling) : document.head.appendChild(a);
776
794
  } else
777
- document.head.appendChild(i);
795
+ document.head.appendChild(a);
778
796
  return { cleanup: () => {
779
- document.head.contains(i) && document.head.removeChild(i);
797
+ document.head.contains(a) && document.head.removeChild(a);
780
798
  } };
781
- }, tt = ({
782
- scriptSrc: r,
799
+ }, et = ({
800
+ scriptSrc: n,
783
801
  async: e = !1
784
802
  }) => {
803
+ if (!n)
804
+ return {
805
+ cleanup: () => {
806
+ },
807
+ isLoaded: Promise.resolve(!1)
808
+ };
785
809
  if ([...document.head.querySelectorAll("script")].filter(
786
- (n) => n.src === r
810
+ (r) => r.src === n
787
811
  ).length > 0)
788
812
  return {
789
813
  cleanup: () => {
790
814
  },
791
815
  isLoaded: Promise.resolve(!0)
792
816
  };
793
- const a = document.createElement("script");
794
- a.src = r, a.async = e;
795
- const i = new Promise((n, o) => {
796
- a.onload = () => n(!0), a.onerror = () => {
797
- console.error(`Failed to load script: ${r}`), o(new Error(`Failed to load script: ${r}`));
817
+ const i = document.createElement("script");
818
+ i.src = n, i.async = e;
819
+ const a = new Promise((r, o) => {
820
+ i.onload = () => r(!0), i.onerror = () => {
821
+ console.error(`Failed to load script: ${n}`), o(new Error(`Failed to load script: ${n}`));
798
822
  };
799
823
  });
800
- return document.head.appendChild(a), {
824
+ return document.head.appendChild(i), {
801
825
  cleanup: () => {
802
- document.head.contains(a) && document.head.removeChild(a);
826
+ document.head.contains(i) && document.head.removeChild(i);
803
827
  },
804
- isLoaded: i
828
+ isLoaded: a
805
829
  };
806
- }, S = (r) => Object.entries(r).map(([e, t]) => {
807
- const a = e.replace(/([A-Z])/g, "-$1").toLowerCase(), i = typeof t == "number" ? `${t}px` : t;
808
- return `${a}: ${i}`;
830
+ }, S = (n) => Object.entries(n).map(([e, t]) => {
831
+ const i = e.replace(/([A-Z])/g, "-$1").toLowerCase(), a = typeof t == "number" ? `${t}px` : t;
832
+ return `${i}: ${a}`;
809
833
  }).join("; ");
810
- function at(r) {
811
- if (!r)
834
+ function tt(n) {
835
+ if (!n)
812
836
  return {
813
837
  formContainerStyle: {},
814
838
  baseStyles: {},
@@ -827,39 +851,39 @@ function at(r) {
827
851
  background: "#fff",
828
852
  border: "none",
829
853
  outline: "none",
830
- fontSize: `${r.styles.fontSize}px`,
854
+ fontSize: `${n.styles.fontSize}px`,
831
855
  lineHeight: 30,
832
856
  boxSizing: "border-box",
833
857
  padding: "0px 12px",
834
858
  height: 33,
835
859
  width: "100%",
836
- fontFamily: `${r.styles.fontFamily}, sans-serif`
860
+ fontFamily: `${n.styles.fontFamily}, sans-serif`
837
861
  }, t = {
838
862
  color: "#717173",
839
863
  opacity: "0.3",
840
- fontFamily: `${r.styles.fontFamily}, sans-serif`
841
- }, a = {
842
- color: "#dc2727"
864
+ fontFamily: `${n.styles.fontFamily}, sans-serif`
843
865
  }, i = {
866
+ color: "#dc2727"
867
+ }, a = {
844
868
  outline: 0
845
869
  }, s = {
846
- fontFamily: `${r.styles.fontFamily}, sans-serif`
847
- }, n = {
870
+ fontFamily: `${n.styles.fontFamily}, sans-serif`
871
+ }, r = {
848
872
  base: S(e),
849
- error: S(a),
850
- focus: S(i),
873
+ error: S(i),
874
+ focus: S(a),
851
875
  placeholder: S(t)
852
876
  };
853
877
  return {
854
878
  formContainerStyle: s,
855
879
  baseStyles: e,
856
880
  placeholderStyles: t,
857
- errorStyles: a,
858
- focusStyles: i,
859
- inputStyles: n
881
+ errorStyles: i,
882
+ focusStyles: a,
883
+ inputStyles: r
860
884
  };
861
885
  }
862
- class h {
886
+ class d {
863
887
  element;
864
888
  children = [];
865
889
  eventListeners = [];
@@ -869,9 +893,9 @@ class h {
869
893
  * @param classNames Optional CSS class names to add
870
894
  * @param attributes Optional attributes to set on the element
871
895
  */
872
- constructor(e, t = [], a = {}) {
873
- this.element = document.createElement(e), t.length > 0 && this.addClass(...t), Object.entries(a).forEach(([i, s]) => {
874
- this.setAttribute(i, s);
896
+ constructor(e, t = [], i = {}) {
897
+ this.element = document.createElement(e), t.length > 0 && this.addClass(...t), Object.entries(i).forEach(([a, s]) => {
898
+ this.setAttribute(a, s);
875
899
  });
876
900
  }
877
901
  /**
@@ -921,19 +945,19 @@ class h {
921
945
  * Append this component to a parent element
922
946
  */
923
947
  appendTo(e) {
924
- return e instanceof h ? e.appendChild(this) : e.appendChild(this.element), this;
948
+ return e instanceof d ? e.appendChild(this) : e.appendChild(this.element), this;
925
949
  }
926
950
  /**
927
951
  * Add an event listener to the element
928
952
  */
929
- addEventListener(e, t, a) {
930
- return this.element.addEventListener(e, t, a), this.eventListeners.push({ type: e, listener: t }), this;
953
+ addEventListener(e, t, i) {
954
+ return this.element.addEventListener(e, t, i), this.eventListeners.push({ type: e, listener: t }), this;
931
955
  }
932
956
  /**
933
957
  * Remove an event listener from the element
934
958
  */
935
- removeEventListener(e, t, a) {
936
- return this.element.removeEventListener(e, t, a), this;
959
+ removeEventListener(e, t, i) {
960
+ return this.element.removeEventListener(e, t, i), this;
937
961
  }
938
962
  /**
939
963
  * Hide this component
@@ -961,89 +985,89 @@ class y {
961
985
  * Create a div element
962
986
  */
963
987
  static createDiv(e = [], t = {}) {
964
- return new h("div", e, t);
988
+ return new d("div", e, t);
965
989
  }
966
990
  /**
967
991
  * Create a span element
968
992
  */
969
993
  static createSpan(e = [], t = {}) {
970
- return new h("span", e, t);
994
+ return new d("span", e, t);
971
995
  }
972
996
  /**
973
997
  * Create a button element
974
998
  */
975
- static createButton(e, t = [], a = {}) {
976
- const i = new h("button", t, a);
977
- return i.setText(e), i;
999
+ static createButton(e, t = [], i = {}) {
1000
+ const a = new d("button", t, i);
1001
+ return a.setText(e), a;
978
1002
  }
979
1003
  /**
980
1004
  * Create an input element
981
1005
  */
982
- static createInput(e, t = [], a = {}) {
983
- const i = { type: e, ...a };
984
- return new h("input", t, i);
1006
+ static createInput(e, t = [], i = {}) {
1007
+ const a = { type: e, ...i };
1008
+ return new d("input", t, a);
985
1009
  }
986
1010
  /**
987
1011
  * Create a text input
988
1012
  */
989
- static createTextInput(e = "", t = [], a = {}) {
990
- const i = {
1013
+ static createTextInput(e = "", t = [], i = {}) {
1014
+ const a = {
991
1015
  type: "text",
992
1016
  placeholder: e,
993
- ...a
1017
+ ...i
994
1018
  };
995
- return new h("input", t, i);
1019
+ return new d("input", t, a);
996
1020
  }
997
1021
  /**
998
1022
  * Create a form element
999
1023
  */
1000
1024
  static createForm(e = [], t = {}) {
1001
- return new h("form", e, t);
1025
+ return new d("form", e, t);
1002
1026
  }
1003
1027
  /**
1004
1028
  * Create a label element
1005
1029
  */
1006
- static createLabel(e, t = "", a = [], i = {}) {
1007
- const s = t ? { for: t, ...i } : i, n = new h("label", a, s);
1008
- return n.setText(e), n;
1030
+ static createLabel(e, t = "", i = [], a = {}) {
1031
+ const s = t ? { for: t, ...a } : a, r = new d("label", i, s);
1032
+ return r.setText(e), r;
1009
1033
  }
1010
1034
  /**
1011
1035
  * Create a select element
1012
1036
  */
1013
- static createSelect(e, t = [], a = {}) {
1014
- const i = new h("select", t, a);
1037
+ static createSelect(e, t = [], i = {}) {
1038
+ const a = new d("select", t, i);
1015
1039
  return e.forEach((s) => {
1016
- const n = document.createElement("option");
1017
- n.value = s.value, n.textContent = s.text, s.selected && (n.selected = !0), i.getElement().appendChild(n);
1018
- }), i;
1040
+ const r = document.createElement("option");
1041
+ r.value = s.value, r.textContent = s.text, s.selected && (r.selected = !0), a.getElement().appendChild(r);
1042
+ }), a;
1019
1043
  }
1020
1044
  /**
1021
1045
  * Create an image element
1022
1046
  */
1023
- static createImage(e, t = "", a = [], i = {}) {
1024
- const s = { src: e, alt: t, ...i };
1025
- return new h("img", a, s);
1047
+ static createImage(e, t = "", i = [], a = {}) {
1048
+ const s = { src: e, alt: t, ...a };
1049
+ return new d("img", i, s);
1026
1050
  }
1027
1051
  }
1028
- class it extends h {
1052
+ class it extends d {
1029
1053
  messageComponent;
1030
1054
  constructor(e) {
1031
1055
  super("div", []);
1032
1056
  const t = y.createDiv(["error-alert"], {
1033
1057
  role: "alert",
1034
1058
  "aria-live": "polite"
1035
- }), a = y.createDiv(["error-alert-content"]), i = y.createDiv([
1059
+ }), i = y.createDiv(["error-alert-content"]), a = y.createDiv([
1036
1060
  "error-alert-icon-container"
1037
1061
  ]);
1038
- i.getElement().innerHTML = this.createAlertCircleSVG();
1062
+ a.getElement().innerHTML = this.createAlertCircleSVG();
1039
1063
  const s = y.createDiv([
1040
1064
  "error-alert-text-container"
1041
- ]), n = new h("h4", [
1065
+ ]), r = new d("h4", [
1042
1066
  "error-alert-title"
1043
1067
  ]);
1044
- n.setText("Checkout Error"), this.messageComponent = new h("p", [
1068
+ r.setText("Checkout Error"), this.messageComponent = new d("p", [
1045
1069
  "error-alert-message"
1046
- ]), this.messageComponent.setText(e.message || "Bad request"), s.appendChild(n), s.appendChild(this.messageComponent), a.appendChild(i), a.appendChild(s), t.appendChild(a), this.appendChild(t);
1070
+ ]), this.messageComponent.setText(e.message || "Bad request"), s.appendChild(r), s.appendChild(this.messageComponent), i.appendChild(a), i.appendChild(s), t.appendChild(i), this.appendChild(t);
1047
1071
  }
1048
1072
  createAlertCircleSVG() {
1049
1073
  return `
@@ -1068,18 +1092,18 @@ class it extends h {
1068
1092
  return this.messageComponent.setText(e), this;
1069
1093
  }
1070
1094
  }
1071
- class st extends h {
1095
+ class at extends d {
1072
1096
  titleElement;
1073
1097
  constructor(e) {
1074
1098
  super("div", ["blur-bg"]);
1075
1099
  const t = y.createDiv(["loader"]);
1076
- this.titleElement = new h("h3", ["title"]), this.titleElement.setText(e.text), this.appendChild(t), this.appendChild(this.titleElement);
1100
+ this.titleElement = new d("h3", ["title"]), this.titleElement.setText(e.text), this.appendChild(t), this.appendChild(this.titleElement);
1077
1101
  }
1078
1102
  setText(e) {
1079
1103
  return this.titleElement.setText(e), this;
1080
1104
  }
1081
1105
  }
1082
- class v extends h {
1106
+ class v extends d {
1083
1107
  constructor(e) {
1084
1108
  super("div", []);
1085
1109
  const t = document.createElement("span");
@@ -1090,7 +1114,7 @@ class v extends h {
1090
1114
  return t && (t.textContent = e), this;
1091
1115
  }
1092
1116
  }
1093
- class rt extends h {
1117
+ class st extends d {
1094
1118
  constructor(e) {
1095
1119
  super("label", ["input-label"], {
1096
1120
  for: e.id
@@ -1099,12 +1123,12 @@ class rt extends h {
1099
1123
  t.style.fontFamily = "inherit", t.style.color = e.styles.color, t.style.fontSize = `${e.styles.fontSize}px`;
1100
1124
  }
1101
1125
  }
1102
- class M extends h {
1126
+ class k extends d {
1103
1127
  inputElement;
1104
1128
  helperText = null;
1105
1129
  constructor(e) {
1106
1130
  if (super("div", ["input-wrapper"]), e.label && e.styles) {
1107
- const a = new rt({
1131
+ const i = new st({
1108
1132
  styles: {
1109
1133
  color: e.styles.color,
1110
1134
  fontSize: e.styles.fontSize
@@ -1112,7 +1136,7 @@ class M extends h {
1112
1136
  label: e.label,
1113
1137
  id: e.name
1114
1138
  });
1115
- this.appendChild(a);
1139
+ this.appendChild(i);
1116
1140
  }
1117
1141
  const t = {
1118
1142
  id: e.name,
@@ -1124,8 +1148,8 @@ class M extends h {
1124
1148
  [],
1125
1149
  t
1126
1150
  ), e.styles) {
1127
- const a = this.inputElement.getElement();
1128
- a.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, a.style.color = e.styles.color, a.style.fontSize = `${e.styles.fontSize}px`, a.style.borderRadius = e.styles.borderRadius;
1151
+ const i = this.inputElement.getElement();
1152
+ i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, i.style.color = e.styles.color, i.style.fontSize = `${e.styles.fontSize}px`, i.style.borderRadius = e.styles.borderRadius;
1129
1153
  }
1130
1154
  e.onChange && this.inputElement.getElement().addEventListener("input", e.onChange), this.getElement().appendChild(this.inputElement.getElement()), e.error && (this.helperText = new v({ text: e.errorMsg }), this.appendChild(this.helperText));
1131
1155
  }
@@ -1136,30 +1160,30 @@ class M extends h {
1136
1160
  return this.inputElement.getElement().value = e, this;
1137
1161
  }
1138
1162
  setError(e, t) {
1139
- const a = this.inputElement.getElement();
1140
- return e ? (a.classList.add("form-input-error"), !this.helperText && t ? (this.helperText = new v({ text: t }), this.appendChild(this.helperText)) : this.helperText && t && this.helperText.setText(t)) : (a.classList.remove("form-input-error"), this.helperText && (this.helperText.getElement().remove(), this.helperText = null)), this;
1163
+ const i = this.inputElement.getElement();
1164
+ return e ? (i.classList.add("form-input-error"), !this.helperText && t ? (this.helperText = new v({ text: t }), this.appendChild(this.helperText)) : this.helperText && t && this.helperText.setText(t)) : (i.classList.remove("form-input-error"), this.helperText && (this.helperText.getElement().remove(), this.helperText = null)), this;
1141
1165
  }
1142
- addEventListener(e, t, a) {
1143
- return this.inputElement.getElement().addEventListener(e, t, a), this;
1166
+ addEventListener(e, t, i) {
1167
+ return this.inputElement.getElement().addEventListener(e, t, i), this;
1144
1168
  }
1145
1169
  }
1146
- class nt {
1170
+ class rt {
1147
1171
  input;
1148
1172
  constructor(e) {
1149
1173
  const {
1150
1174
  value: t,
1151
- onChange: a,
1152
- onBlur: i,
1175
+ onChange: i,
1176
+ onBlur: a,
1153
1177
  error: s,
1154
- errorMsg: n,
1178
+ errorMsg: r,
1155
1179
  checkoutProfile: o,
1156
1180
  translationFunc: l
1157
1181
  } = e;
1158
- this.input = new M({
1182
+ this.input = new k({
1159
1183
  name: "name",
1160
1184
  label: l("cardholderNameLabel"),
1161
1185
  error: s,
1162
- errorMsg: n,
1186
+ errorMsg: r,
1163
1187
  styles: {
1164
1188
  color: o.styles.textColor,
1165
1189
  borderRadius: `${o.styles.borderRadius}px`,
@@ -1168,8 +1192,12 @@ class nt {
1168
1192
  },
1169
1193
  placeholder: l("cardholderNamePlaceholder"),
1170
1194
  value: t,
1171
- onChange: a
1172
- }), this.input.addEventListener("blur", i);
1195
+ onChange: (c) => {
1196
+ this.trim(), i(c);
1197
+ }
1198
+ }), this.input.addEventListener("blur", (c) => {
1199
+ a(c);
1200
+ });
1173
1201
  }
1174
1202
  getValue() {
1175
1203
  return this.input.getValue();
@@ -1177,6 +1205,10 @@ class nt {
1177
1205
  setValue(e) {
1178
1206
  return this.input.setValue(e), this;
1179
1207
  }
1208
+ trim() {
1209
+ const e = this.getValue().trimStart();
1210
+ return this.setValue(e), this;
1211
+ }
1180
1212
  setError(e, t) {
1181
1213
  return this.input.setError(e, t), this;
1182
1214
  }
@@ -1187,13 +1219,13 @@ class nt {
1187
1219
  return this.input.appendTo(e), this;
1188
1220
  }
1189
1221
  }
1190
- class ot extends h {
1222
+ class nt extends d {
1191
1223
  constructor(e) {
1192
1224
  super("div", []);
1193
1225
  const t = document.createElement("div");
1194
1226
  t.className = e.isLoading ? "loading" : "", t.style.borderRadius = `0px 0px ${e.styles.borderRadius}px 0px`;
1195
- const a = document.createElement("div");
1196
- a.id = "card-cvv-element", a.className = `card-element ${e.isFocused ? "card-element-focus" : ""}`, a.style.zIndex = e.isFocused ? "2" : "0", t.appendChild(a), this.getElement().appendChild(t);
1227
+ const i = document.createElement("div");
1228
+ i.id = "card-cvv-element", i.className = `card-element ${e.isFocused ? "card-element-focus" : ""}`, i.style.zIndex = e.isFocused ? "2" : "0", t.appendChild(i), this.getElement().appendChild(t);
1197
1229
  }
1198
1230
  setFocused(e) {
1199
1231
  const t = this.getElement().querySelector("#card-cvv-element");
@@ -1204,50 +1236,50 @@ class ot extends h {
1204
1236
  return t && (e ? t.classList.add("loading") : t.classList.remove("loading")), this;
1205
1237
  }
1206
1238
  }
1207
- const lt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='30px'%20width='30px'%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23306FC5;'%20d='M512,402.281c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.997,0,402.281V109.717%20c0-16.715,13.55-30.266,30.265-30.266h451.47c16.716,0,30.265,13.551,30.265,30.266V402.281L512,402.281z'/%3e%3cpath%20style='opacity:0.15;fill:%23202121;enable-background:new%20;'%20d='M21.517,402.281V109.717%20c0-16.715,13.552-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.001,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52%20C35.07,432.549,21.517,418.997,21.517,402.281z'/%3e%3cg%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='74.59,220.748%2089.888,220.748%2082.241,201.278%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='155.946,286.107%20155.946,295.148%20181.675,295.148%20181.675,304.885%20155.946,304.885%20155.946,315.318%20184.455,315.318%20197.666,300.712%20185.151,286.107%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='356.898,201.278%20348.553,220.748%20364.548,220.748%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='230.348,320.875%20230.348,281.241%20212.268,300.712%20'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M264.42,292.368c-0.696-4.172-3.48-6.261-7.654-6.261h-14.599v12.516h15.299%20C261.637,298.624,264.42,296.539,264.42,292.368z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M313.09,297.236c1.391-0.697,2.089-2.785,2.089-4.867c0.696-2.779-0.698-4.172-2.089-4.868%20c-1.387-0.696-3.476-0.696-5.559-0.696h-13.91v11.127h13.909C309.613,297.932,311.702,297.932,313.09,297.236z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M413.217,183.198v8.344l-4.169-8.344H376.37v8.344l-4.174-8.344h-44.502%20c-7.648,0-13.909,1.392-19.469,4.173v-4.173h-31.289v0.696v3.477c-3.476-2.78-7.648-4.173-13.211-4.173h-111.95l-7.652,17.384%20l-7.647-17.384h-25.031h-10.431v8.344l-3.477-8.344h-0.696H66.942l-13.909,32.68L37.042,251.34l-0.294,0.697h0.294h35.463h0.444%20l0.252-0.697l4.174-10.428h9.039l4.172,11.125h40.326v-0.697v-7.647l3.479,8.343h20.163l3.475-8.343v7.647v0.697h15.993h79.965%20h0.696v-18.08h1.394c1.389,0,1.389,0,1.389,2.087v15.297h50.065v-4.172c4.172,2.089,10.426,4.172,18.771,4.172h20.863l4.172-11.123%20h9.732l4.172,11.123h40.328v-6.952v-3.476l6.261,10.428h1.387h0.698h30.595v-68.143h-31.291l0,0H413.217z%20M177.501,241.609h-6.955%20h-4.171v-4.169v-34.076l-0.696,1.595v-0.019l-16.176,36.669h-0.512h-3.719h-6.017l-16.687-38.245v38.245h-23.64l-4.867-10.43%20H70.417l-4.868,10.43H53.326l20.57-48.675h17.382l19.469,46.587v-46.587h4.171h14.251l0.328,0.697h0.024l8.773,19.094l6.3,14.306%20l0.223-0.721l13.906-33.375H177.5v48.674H177.501L177.501,241.609z%20M225.481,203.364h-27.119v9.039h26.423v9.734h-26.423v9.738%20h27.119v10.427h-38.939v-49.367h38.939V203.364L225.481,203.364z%20M275.076,221.294c0.018,0.016,0.041,0.027,0.063,0.042%20c0.263,0.278,0.488,0.557,0.68,0.824c1.332,1.746,2.409,4.343,2.463,8.151c0.004,0.066,0.007,0.131,0.011,0.197%20c0,0.038,0.007,0.071,0.007,0.11c0,0.022-0.002,0.039-0.002,0.06c0.016,0.383,0.026,0.774,0.026,1.197v9.735h-10.428v-5.565%20c0-2.781,0-6.954-2.089-9.735c-0.657-0.657-1.322-1.09-2.046-1.398c-1.042-0.675-3.017-0.686-6.295-0.686h-12.52v17.384h-11.818%20v-48.675h26.425c6.254,0,10.428,0,13.906,2.086c3.407,2.046,5.465,5.439,5.543,10.812c-0.161,7.4-4.911,11.46-8.326,12.829%20C270.676,218.662,272.996,219.129,275.076,221.294z%20M298.491,241.609h-11.822v-48.675h11.822V241.609z%20M434.083,241.609h-15.3%20l-22.25-36.855v30.595l-0.073-0.072v6.362h-11.747v-0.029h-11.822l-4.172-10.43H344.38l-4.172,11.123h-13.211%20c-5.559,0-12.517-1.389-16.687-5.561c-4.172-4.172-6.256-9.735-6.256-18.773c0-6.953,1.389-13.911,6.256-19.472%20c3.474-4.175,9.735-5.562,17.382-5.562h11.128v10.429h-11.128c-4.172,0-6.254,0.693-9.041,2.783%20c-2.082,2.085-3.474,6.256-3.474,11.123c0,5.564,0.696,9.04,3.474,11.821c2.091,2.089,4.87,2.785,8.346,2.785h4.867l15.991-38.243%20h6.957h10.428l19.472,46.587v-2.376v-15.705v-1.389v-27.116h17.382l20.161,34.07v-34.07h11.826v47.977h0.002L434.083,241.609%20L434.083,241.609z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M265.161,213.207c0.203-0.217,0.387-0.463,0.543-0.745c0.63-0.997,1.352-2.793,0.963-5.244%20c-0.016-0.225-0.057-0.433-0.105-0.634c-0.013-0.056-0.011-0.105-0.026-0.161l-0.007,0.001c-0.346-1.191-1.229-1.923-2.11-2.367%20c-1.394-0.693-3.48-0.693-5.565-0.693h-13.909v11.127h13.909c2.085,0,4.172,0,5.565-0.697c0.209-0.106,0.395-0.25,0.574-0.413%20l0.002,0.009C264.996,213.389,265.067,213.315,265.161,213.207z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M475.105,311.144c0-4.867-1.389-9.736-3.474-13.212v-31.289h-0.032v-2.089c0,0-29.145,0-33.483,0%20c-4.336,0-9.598,4.171-9.598,4.171v-4.171h-31.984c-4.87,0-11.124,1.392-13.909,4.171v-4.171h-57.016v2.089v2.081%20c-4.169-3.474-11.824-4.171-15.298-4.171h-37.549v2.089v2.081c-3.476-3.474-11.824-4.171-15.998-4.171H215.05l-9.737,10.431%20l-9.04-10.431h-2.911h-4.737h-54.93v2.089v5.493v62.651h61.19l10.054-10.057l8.715,10.057h0.698h35.258h1.598h0.696h0.692v-6.953%20v-9.039h3.479c4.863,0,11.124,0,15.991-2.089v17.382v1.394h31.291v-1.394V317.4h1.387c2.089,0,2.089,0,2.089,2.086v14.6v1.394%20h94.563c6.263,0,12.517-1.394,15.993-4.175v2.781v1.394h29.902c6.254,0,12.517-0.695,16.689-3.478%20c6.402-3.841,10.437-10.64,11.037-18.749c0.028-0.24,0.063-0.48,0.085-0.721l-0.041-0.039%20C475.087,312.043,475.105,311.598,475.105,311.144z%20M256.076,306.973h-13.91v2.081v4.174v4.173v7.649h-22.855l-13.302-15.299%20l-0.046,0.051l-0.65-0.748l-15.297,15.996h-44.501v-48.673h45.197l12.348,13.525l2.596,2.832l0.352-0.365l14.604-15.991h36.852%20c7.152,0,15.161,1.765,18.196,9.042c0.365,1.441,0.577,3.043,0.577,4.863C276.237,304.189,266.502,306.973,256.076,306.973z%20M325.609,306.276c1.389,2.081,2.085,4.867,2.085,9.041v9.732h-11.819v-6.256c0-2.786,0-7.65-2.089-9.739%20c-1.387-2.081-4.172-2.081-8.341-2.081H292.93v18.077h-11.82v-49.369h26.421c5.559,0,10.426,0,13.909,2.084%20c3.474,2.088,6.254,5.565,6.254,11.128c0,7.647-4.865,11.819-8.343,13.212C322.829,303.49,324.914,304.885,325.609,306.276z%20M373.589,286.107h-27.122v9.04h26.424v9.737h-26.424v9.736h27.122v10.429H334.65V275.68h38.939V286.107z%20M402.791,325.05h-22.252%20v-10.429h22.252c2.082,0,3.476,0,4.87-1.392c0.696-0.697,1.387-2.085,1.387-3.477c0-1.394-0.691-2.778-1.387-3.475%20c-0.698-0.695-2.091-1.391-4.176-1.391c-11.126-0.696-24.337,0-24.337-15.296c0-6.954,4.172-14.604,16.689-14.604h22.945v11.819%20h-21.554c-2.085,0-3.478,0-4.87,0.696c-1.387,0.697-1.387,2.089-1.387,3.478c0,2.087,1.387,2.783,2.778,3.473%20c1.394,0.697,2.783,0.697,4.172,0.697h6.259c6.259,0,10.43,1.391,13.211,4.173c2.087,2.087,3.478,5.564,3.478,10.43%20C420.869,320.179,414.611,325.05,402.791,325.05z%20M462.59,320.179c-2.778,2.785-7.648,4.871-14.604,4.871H425.74v-10.429h22.245%20c2.087,0,3.481,0,4.87-1.392c0.693-0.697,1.391-2.085,1.391-3.477c0-1.394-0.698-2.778-1.391-3.475%20c-0.696-0.695-2.085-1.391-4.172-1.391c-11.122-0.696-24.337,0-24.337-15.295c0-6.609,3.781-12.579,13.106-14.352%20c1.115-0.154,2.293-0.253,3.583-0.253h22.948v11.819h-15.3h-5.561h-0.696c-2.087,0-3.476,0-4.865,0.696%20c-0.7,0.697-1.396,2.089-1.396,3.478c0,2.087,0.696,2.783,2.785,3.473c1.389,0.697,2.78,0.697,4.172,0.697h0.691h5.565%20c3.039,0,5.337,0.375,7.44,1.114c1.926,0.697,8.302,3.549,9.728,10.994c0.124,0.78,0.215,1.594,0.215,2.495%20C466.761,313.925,465.37,317.401,462.59,320.179z'/%3e%3c/g%3e%3c/svg%3e", ct = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='30px'%20width='30px'%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%2334495E;'%20d='M512,402.282c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.996,0,402.282V109.717%20c0-16.716,13.55-30.266,30.265-30.266h451.469c16.716,0,30.265,13.551,30.265,30.266L512,402.282L512,402.282z'/%3e%3cpath%20style='opacity:0.15;fill:%23202121;enable-background:new%20;'%20d='M21.517,402.282V109.717%20c0-16.716,13.552-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.003,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52%20C35.07,432.549,21.517,418.996,21.517,402.282z'/%3e%3cpath%20style='fill:%23F26E21;'%20d='M309.389,255.801c0.041-9.636-3.572-19.286-10.843-26.558c-7.287-7.287-16.961-10.897-26.617-10.839%20c-0.046,0-0.091-0.003-0.139-0.003c-20.968,0-37.6,16.628-37.6,37.602c0,20.767,16.837,37.599,37.6,37.599%20c20.974,0,37.604-16.631,37.604-37.599C309.394,255.934,309.389,255.869,309.389,255.801z'/%3e%3cg%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M227.198,271.909c-5.62,5.626-10.807,7.824-16.394,7.943c-13.611-0.122-23.618-10.202-23.618-24.573%20c0-7.234,2.739-13.163,7.078-18.228l0,0c4.069-3.863,9.311-6.359,15.339-6.359c6.507,0,11.571,2.169,17.352,7.954v-16.631%20c-5.78-2.891-10.846-4.338-17.352-4.338c-9.192,0.657-17.859,4.371-24.507,10.203l0,0c-1.916,1.724-3.752,3.627-5.309,5.805%20c-4.856,6.294-7.791,14.001-7.791,22.32c0,20.967,16.637,36.875,37.606,36.875c0.102,0,0.203-0.009,0.302-0.01%20c0.141,0.002,0.28,0.01,0.42,0.01c5.784,0,10.85-1.443,17.357-4.336L227.198,271.909c-0.244,0.244,0.242,0.471,0,0.702V271.909z'/%3e%3cpolygon%20style='fill:%23E7E8E3;'%20points='356.863,228.033%20356.863,228.033%20340.487,268.295%20321.685,220.566%20306.502,220.566%20336.148,293.601%20344.102,293.601%20375.196,220.566%20360.013,220.566%20'/%3e%3cpolygon%20style='fill:%23E7E8E3;'%20points='380.983,252.384%20380.983,291.435%20420.033,291.435%20420.753,291.435%20420.753,279.861%20408.461,279.861%20395.445,279.861%20395.445,266.848%20395.445,260.342%20420.033,260.342%20420.033,248.045%20395.445,248.045%20395.445,232.861%20420.753,232.861%20420.753,220.566%20380.983,220.566%20'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M54.135,220.566H33.884v70.869h20.25c10.845,0,18.798-2.895,25.306-7.957%20c7.953-6.508,13.017-16.629,13.017-27.474C92.458,235.028,77.27,220.566,54.135,220.566z%20M70.765,274.08%20c-4.339,3.614-10.124,5.781-18.802,5.781h-4.339V232.86h3.615c8.678,0,14.463,1.446,18.803,5.783%20c5.061,4.336,7.955,10.848,7.955,17.358C78.72,262.509,75.828,269.737,70.765,274.08z'/%3e%3crect%20x='98.97'%20y='220.56'%20style='fill:%23E7E8E3;'%20width='13.739'%20height='70.867'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M147.415,248.045c-8.676-2.892-10.848-5.063-10.848-8.677c0-4.339,4.339-7.954,10.124-7.954%20c4.339,0,7.954,1.447,11.57,5.786l7.233-9.4c-5.787-5.064-13.015-7.953-20.97-7.953c-12.296,0-22.42,8.678-22.42,20.244%20c0,10.126,4.343,14.464,17.357,19.526c5.785,2.166,7.955,2.892,9.404,4.338c2.887,1.444,4.336,4.339,4.336,7.228%20c0,5.786-4.336,10.126-10.848,10.126c-6.514,0-12.294-3.615-15.187-9.401l-8.678,8.678c6.511,9.4,14.465,13.738,24.589,13.738%20c14.461,0,24.58-9.4,24.58-23.141C167.659,258.893,163.324,253.831,147.415,248.045z'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M459.804,261.783c10.843-2.166,16.63-9.4,16.63-20.244c0-13.014-9.402-20.973-25.308-20.973h-20.972%20v70.869h13.739V263.23h2.172l19.519,28.205h16.634L459.804,261.783z%20M448.23,253.105h-4.336v-21.691h4.336%20c8.678,0,13.742,3.614,13.742,10.85C461.972,249.492,456.909,253.105,448.23,253.105z'/%3e%3c/g%3e%3c/svg%3e", dt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20291.791%20291.791'%20xml:space='preserve'%3e%3cg%3e%3cpath%20style='fill:%23E2574C;'%20d='M182.298,145.895c0,50.366-40.801,91.176-91.149,91.176S0,196.252,0,145.895%20s40.811-91.176,91.149-91.176S182.298,95.538,182.298,145.895z'/%3e%3cpath%20style='fill:%23F4B459;'%20d='M200.616,54.719c-20.442,0-39.261,6.811-54.469,18.181l0.073,0.009%20c2.991,2.89,6.291,4.924,8.835,8.251l-18.965,0.301c-2.972,3-5.68,6.264-8.233,9.656H161.3c2.544,3.054,4.896,5.708,7.03,9.081%20h-46.536c-1.705,2.936-3.282,5.954-4.659,9.09h56.493c1.477,3.127,2.799,5.489,3.921,8.799h-63.76%20c-1.012,3.146-1.878,6.364-2.535,9.646h68.966c0.675,3.155,1.194,6.072,1.55,9.045h-71.884c-0.301,3-0.456,6.045-0.456,9.118%20h72.859c0,3.228-0.228,6.218-0.556,9.118h-71.847c0.31,3.091,0.766,6.127,1.368,9.118h68.856c-0.711,2.954-1.532,5.926-2.562,9.008%20h-63.969c0.966,3.118,2.143,6.145,3.428,9.099h56.621c-1.568,3.319-3.346,5.972-5.306,9.081h-46.691%20c1.842,3.191,3.875,6.236,6.081,9.154l33.589,0.501c-2.863,3.437-6.537,5.507-9.884,8.516c0.182,0.146-5.352-0.018-16.248-0.191%20c16.576,17.105,39.744,27.772,65.446,27.772c50.357,0,91.176-40.82,91.176-91.176S250.981,54.719,200.616,54.719z'/%3e%3c/g%3e%3c/svg%3e", ht = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%20-140%20780%20780'%20enable-background='new%200%200%20780%20500'%20version='1.1'%20xml:space='preserve'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40%20C0,17.909,17.909,0,40,0z'%20fill='%230E4595'/%3e%3cpath%20d='m293.2%20348.73l33.361-195.76h53.36l-33.385%20195.76h-53.336zm246.11-191.54c-10.57-3.966-27.137-8.222-47.822-8.222-52.725%200-89.865%2026.55-90.18%2064.603-0.299%2028.13%2026.514%2043.822%2046.752%2053.186%2020.771%209.595%2027.752%2015.714%2027.654%2024.283-0.131%2013.121-16.586%2019.116-31.922%2019.116-21.357%200-32.703-2.967-50.227-10.276l-6.876-3.11-7.489%2043.823c12.463%205.464%2035.51%2010.198%2059.438%2010.443%2056.09%200%2092.5-26.246%2092.916-66.882%200.199-22.269-14.016-39.216-44.801-53.188-18.65-9.055-30.072-15.099-29.951-24.268%200-8.137%209.668-16.839%2030.557-16.839%2017.449-0.27%2030.09%203.535%2039.938%207.5l4.781%202.26%207.232-42.429m137.31-4.223h-41.232c-12.773%200-22.332%203.487-27.941%2016.234l-79.244%20179.4h56.031s9.16-24.123%2011.232-29.418c6.125%200%2060.555%200.084%2068.338%200.084%201.596%206.853%206.49%2029.334%206.49%2029.334h49.514l-43.188-195.64zm-65.418%20126.41c4.412-11.279%2021.26-54.723%2021.26-54.723-0.316%200.522%204.379-11.334%207.074-18.684l3.605%2016.879s10.219%2046.729%2012.354%2056.528h-44.293zm-363.3-126.41l-52.24%20133.5-5.567-27.13c-9.725-31.273-40.025-65.155-73.898-82.118l47.766%20171.2%2056.456-0.064%2084.004-195.39h-56.521'%20fill='%23ffffff'/%3e%3cpath%20d='m146.92%20152.96h-86.041l-0.681%204.073c66.938%2016.204%20111.23%2055.363%20129.62%20102.41l-18.71-89.96c-3.23-12.395-12.597-16.094-24.186-16.527'%20fill='%23F2AE14'/%3e%3c/svg%3e", E = [
1239
+ const ot = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='30px'%20width='30px'%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23306FC5;'%20d='M512,402.281c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.997,0,402.281V109.717%20c0-16.715,13.55-30.266,30.265-30.266h451.47c16.716,0,30.265,13.551,30.265,30.266V402.281L512,402.281z'/%3e%3cpath%20style='opacity:0.15;fill:%23202121;enable-background:new%20;'%20d='M21.517,402.281V109.717%20c0-16.715,13.552-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.001,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52%20C35.07,432.549,21.517,418.997,21.517,402.281z'/%3e%3cg%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='74.59,220.748%2089.888,220.748%2082.241,201.278%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='155.946,286.107%20155.946,295.148%20181.675,295.148%20181.675,304.885%20155.946,304.885%20155.946,315.318%20184.455,315.318%20197.666,300.712%20185.151,286.107%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='356.898,201.278%20348.553,220.748%20364.548,220.748%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='230.348,320.875%20230.348,281.241%20212.268,300.712%20'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M264.42,292.368c-0.696-4.172-3.48-6.261-7.654-6.261h-14.599v12.516h15.299%20C261.637,298.624,264.42,296.539,264.42,292.368z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M313.09,297.236c1.391-0.697,2.089-2.785,2.089-4.867c0.696-2.779-0.698-4.172-2.089-4.868%20c-1.387-0.696-3.476-0.696-5.559-0.696h-13.91v11.127h13.909C309.613,297.932,311.702,297.932,313.09,297.236z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M413.217,183.198v8.344l-4.169-8.344H376.37v8.344l-4.174-8.344h-44.502%20c-7.648,0-13.909,1.392-19.469,4.173v-4.173h-31.289v0.696v3.477c-3.476-2.78-7.648-4.173-13.211-4.173h-111.95l-7.652,17.384%20l-7.647-17.384h-25.031h-10.431v8.344l-3.477-8.344h-0.696H66.942l-13.909,32.68L37.042,251.34l-0.294,0.697h0.294h35.463h0.444%20l0.252-0.697l4.174-10.428h9.039l4.172,11.125h40.326v-0.697v-7.647l3.479,8.343h20.163l3.475-8.343v7.647v0.697h15.993h79.965%20h0.696v-18.08h1.394c1.389,0,1.389,0,1.389,2.087v15.297h50.065v-4.172c4.172,2.089,10.426,4.172,18.771,4.172h20.863l4.172-11.123%20h9.732l4.172,11.123h40.328v-6.952v-3.476l6.261,10.428h1.387h0.698h30.595v-68.143h-31.291l0,0H413.217z%20M177.501,241.609h-6.955%20h-4.171v-4.169v-34.076l-0.696,1.595v-0.019l-16.176,36.669h-0.512h-3.719h-6.017l-16.687-38.245v38.245h-23.64l-4.867-10.43%20H70.417l-4.868,10.43H53.326l20.57-48.675h17.382l19.469,46.587v-46.587h4.171h14.251l0.328,0.697h0.024l8.773,19.094l6.3,14.306%20l0.223-0.721l13.906-33.375H177.5v48.674H177.501L177.501,241.609z%20M225.481,203.364h-27.119v9.039h26.423v9.734h-26.423v9.738%20h27.119v10.427h-38.939v-49.367h38.939V203.364L225.481,203.364z%20M275.076,221.294c0.018,0.016,0.041,0.027,0.063,0.042%20c0.263,0.278,0.488,0.557,0.68,0.824c1.332,1.746,2.409,4.343,2.463,8.151c0.004,0.066,0.007,0.131,0.011,0.197%20c0,0.038,0.007,0.071,0.007,0.11c0,0.022-0.002,0.039-0.002,0.06c0.016,0.383,0.026,0.774,0.026,1.197v9.735h-10.428v-5.565%20c0-2.781,0-6.954-2.089-9.735c-0.657-0.657-1.322-1.09-2.046-1.398c-1.042-0.675-3.017-0.686-6.295-0.686h-12.52v17.384h-11.818%20v-48.675h26.425c6.254,0,10.428,0,13.906,2.086c3.407,2.046,5.465,5.439,5.543,10.812c-0.161,7.4-4.911,11.46-8.326,12.829%20C270.676,218.662,272.996,219.129,275.076,221.294z%20M298.491,241.609h-11.822v-48.675h11.822V241.609z%20M434.083,241.609h-15.3%20l-22.25-36.855v30.595l-0.073-0.072v6.362h-11.747v-0.029h-11.822l-4.172-10.43H344.38l-4.172,11.123h-13.211%20c-5.559,0-12.517-1.389-16.687-5.561c-4.172-4.172-6.256-9.735-6.256-18.773c0-6.953,1.389-13.911,6.256-19.472%20c3.474-4.175,9.735-5.562,17.382-5.562h11.128v10.429h-11.128c-4.172,0-6.254,0.693-9.041,2.783%20c-2.082,2.085-3.474,6.256-3.474,11.123c0,5.564,0.696,9.04,3.474,11.821c2.091,2.089,4.87,2.785,8.346,2.785h4.867l15.991-38.243%20h6.957h10.428l19.472,46.587v-2.376v-15.705v-1.389v-27.116h17.382l20.161,34.07v-34.07h11.826v47.977h0.002L434.083,241.609%20L434.083,241.609z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M265.161,213.207c0.203-0.217,0.387-0.463,0.543-0.745c0.63-0.997,1.352-2.793,0.963-5.244%20c-0.016-0.225-0.057-0.433-0.105-0.634c-0.013-0.056-0.011-0.105-0.026-0.161l-0.007,0.001c-0.346-1.191-1.229-1.923-2.11-2.367%20c-1.394-0.693-3.48-0.693-5.565-0.693h-13.909v11.127h13.909c2.085,0,4.172,0,5.565-0.697c0.209-0.106,0.395-0.25,0.574-0.413%20l0.002,0.009C264.996,213.389,265.067,213.315,265.161,213.207z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M475.105,311.144c0-4.867-1.389-9.736-3.474-13.212v-31.289h-0.032v-2.089c0,0-29.145,0-33.483,0%20c-4.336,0-9.598,4.171-9.598,4.171v-4.171h-31.984c-4.87,0-11.124,1.392-13.909,4.171v-4.171h-57.016v2.089v2.081%20c-4.169-3.474-11.824-4.171-15.298-4.171h-37.549v2.089v2.081c-3.476-3.474-11.824-4.171-15.998-4.171H215.05l-9.737,10.431%20l-9.04-10.431h-2.911h-4.737h-54.93v2.089v5.493v62.651h61.19l10.054-10.057l8.715,10.057h0.698h35.258h1.598h0.696h0.692v-6.953%20v-9.039h3.479c4.863,0,11.124,0,15.991-2.089v17.382v1.394h31.291v-1.394V317.4h1.387c2.089,0,2.089,0,2.089,2.086v14.6v1.394%20h94.563c6.263,0,12.517-1.394,15.993-4.175v2.781v1.394h29.902c6.254,0,12.517-0.695,16.689-3.478%20c6.402-3.841,10.437-10.64,11.037-18.749c0.028-0.24,0.063-0.48,0.085-0.721l-0.041-0.039%20C475.087,312.043,475.105,311.598,475.105,311.144z%20M256.076,306.973h-13.91v2.081v4.174v4.173v7.649h-22.855l-13.302-15.299%20l-0.046,0.051l-0.65-0.748l-15.297,15.996h-44.501v-48.673h45.197l12.348,13.525l2.596,2.832l0.352-0.365l14.604-15.991h36.852%20c7.152,0,15.161,1.765,18.196,9.042c0.365,1.441,0.577,3.043,0.577,4.863C276.237,304.189,266.502,306.973,256.076,306.973z%20M325.609,306.276c1.389,2.081,2.085,4.867,2.085,9.041v9.732h-11.819v-6.256c0-2.786,0-7.65-2.089-9.739%20c-1.387-2.081-4.172-2.081-8.341-2.081H292.93v18.077h-11.82v-49.369h26.421c5.559,0,10.426,0,13.909,2.084%20c3.474,2.088,6.254,5.565,6.254,11.128c0,7.647-4.865,11.819-8.343,13.212C322.829,303.49,324.914,304.885,325.609,306.276z%20M373.589,286.107h-27.122v9.04h26.424v9.737h-26.424v9.736h27.122v10.429H334.65V275.68h38.939V286.107z%20M402.791,325.05h-22.252%20v-10.429h22.252c2.082,0,3.476,0,4.87-1.392c0.696-0.697,1.387-2.085,1.387-3.477c0-1.394-0.691-2.778-1.387-3.475%20c-0.698-0.695-2.091-1.391-4.176-1.391c-11.126-0.696-24.337,0-24.337-15.296c0-6.954,4.172-14.604,16.689-14.604h22.945v11.819%20h-21.554c-2.085,0-3.478,0-4.87,0.696c-1.387,0.697-1.387,2.089-1.387,3.478c0,2.087,1.387,2.783,2.778,3.473%20c1.394,0.697,2.783,0.697,4.172,0.697h6.259c6.259,0,10.43,1.391,13.211,4.173c2.087,2.087,3.478,5.564,3.478,10.43%20C420.869,320.179,414.611,325.05,402.791,325.05z%20M462.59,320.179c-2.778,2.785-7.648,4.871-14.604,4.871H425.74v-10.429h22.245%20c2.087,0,3.481,0,4.87-1.392c0.693-0.697,1.391-2.085,1.391-3.477c0-1.394-0.698-2.778-1.391-3.475%20c-0.696-0.695-2.085-1.391-4.172-1.391c-11.122-0.696-24.337,0-24.337-15.295c0-6.609,3.781-12.579,13.106-14.352%20c1.115-0.154,2.293-0.253,3.583-0.253h22.948v11.819h-15.3h-5.561h-0.696c-2.087,0-3.476,0-4.865,0.696%20c-0.7,0.697-1.396,2.089-1.396,3.478c0,2.087,0.696,2.783,2.785,3.473c1.389,0.697,2.78,0.697,4.172,0.697h0.691h5.565%20c3.039,0,5.337,0.375,7.44,1.114c1.926,0.697,8.302,3.549,9.728,10.994c0.124,0.78,0.215,1.594,0.215,2.495%20C466.761,313.925,465.37,317.401,462.59,320.179z'/%3e%3c/g%3e%3c/svg%3e", lt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='30px'%20width='30px'%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%2334495E;'%20d='M512,402.282c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.996,0,402.282V109.717%20c0-16.716,13.55-30.266,30.265-30.266h451.469c16.716,0,30.265,13.551,30.265,30.266L512,402.282L512,402.282z'/%3e%3cpath%20style='opacity:0.15;fill:%23202121;enable-background:new%20;'%20d='M21.517,402.282V109.717%20c0-16.716,13.552-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.003,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52%20C35.07,432.549,21.517,418.996,21.517,402.282z'/%3e%3cpath%20style='fill:%23F26E21;'%20d='M309.389,255.801c0.041-9.636-3.572-19.286-10.843-26.558c-7.287-7.287-16.961-10.897-26.617-10.839%20c-0.046,0-0.091-0.003-0.139-0.003c-20.968,0-37.6,16.628-37.6,37.602c0,20.767,16.837,37.599,37.6,37.599%20c20.974,0,37.604-16.631,37.604-37.599C309.394,255.934,309.389,255.869,309.389,255.801z'/%3e%3cg%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M227.198,271.909c-5.62,5.626-10.807,7.824-16.394,7.943c-13.611-0.122-23.618-10.202-23.618-24.573%20c0-7.234,2.739-13.163,7.078-18.228l0,0c4.069-3.863,9.311-6.359,15.339-6.359c6.507,0,11.571,2.169,17.352,7.954v-16.631%20c-5.78-2.891-10.846-4.338-17.352-4.338c-9.192,0.657-17.859,4.371-24.507,10.203l0,0c-1.916,1.724-3.752,3.627-5.309,5.805%20c-4.856,6.294-7.791,14.001-7.791,22.32c0,20.967,16.637,36.875,37.606,36.875c0.102,0,0.203-0.009,0.302-0.01%20c0.141,0.002,0.28,0.01,0.42,0.01c5.784,0,10.85-1.443,17.357-4.336L227.198,271.909c-0.244,0.244,0.242,0.471,0,0.702V271.909z'/%3e%3cpolygon%20style='fill:%23E7E8E3;'%20points='356.863,228.033%20356.863,228.033%20340.487,268.295%20321.685,220.566%20306.502,220.566%20336.148,293.601%20344.102,293.601%20375.196,220.566%20360.013,220.566%20'/%3e%3cpolygon%20style='fill:%23E7E8E3;'%20points='380.983,252.384%20380.983,291.435%20420.033,291.435%20420.753,291.435%20420.753,279.861%20408.461,279.861%20395.445,279.861%20395.445,266.848%20395.445,260.342%20420.033,260.342%20420.033,248.045%20395.445,248.045%20395.445,232.861%20420.753,232.861%20420.753,220.566%20380.983,220.566%20'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M54.135,220.566H33.884v70.869h20.25c10.845,0,18.798-2.895,25.306-7.957%20c7.953-6.508,13.017-16.629,13.017-27.474C92.458,235.028,77.27,220.566,54.135,220.566z%20M70.765,274.08%20c-4.339,3.614-10.124,5.781-18.802,5.781h-4.339V232.86h3.615c8.678,0,14.463,1.446,18.803,5.783%20c5.061,4.336,7.955,10.848,7.955,17.358C78.72,262.509,75.828,269.737,70.765,274.08z'/%3e%3crect%20x='98.97'%20y='220.56'%20style='fill:%23E7E8E3;'%20width='13.739'%20height='70.867'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M147.415,248.045c-8.676-2.892-10.848-5.063-10.848-8.677c0-4.339,4.339-7.954,10.124-7.954%20c4.339,0,7.954,1.447,11.57,5.786l7.233-9.4c-5.787-5.064-13.015-7.953-20.97-7.953c-12.296,0-22.42,8.678-22.42,20.244%20c0,10.126,4.343,14.464,17.357,19.526c5.785,2.166,7.955,2.892,9.404,4.338c2.887,1.444,4.336,4.339,4.336,7.228%20c0,5.786-4.336,10.126-10.848,10.126c-6.514,0-12.294-3.615-15.187-9.401l-8.678,8.678c6.511,9.4,14.465,13.738,24.589,13.738%20c14.461,0,24.58-9.4,24.58-23.141C167.659,258.893,163.324,253.831,147.415,248.045z'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M459.804,261.783c10.843-2.166,16.63-9.4,16.63-20.244c0-13.014-9.402-20.973-25.308-20.973h-20.972%20v70.869h13.739V263.23h2.172l19.519,28.205h16.634L459.804,261.783z%20M448.23,253.105h-4.336v-21.691h4.336%20c8.678,0,13.742,3.614,13.742,10.85C461.972,249.492,456.909,253.105,448.23,253.105z'/%3e%3c/g%3e%3c/svg%3e", ct = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20291.791%20291.791'%20xml:space='preserve'%3e%3cg%3e%3cpath%20style='fill:%23E2574C;'%20d='M182.298,145.895c0,50.366-40.801,91.176-91.149,91.176S0,196.252,0,145.895%20s40.811-91.176,91.149-91.176S182.298,95.538,182.298,145.895z'/%3e%3cpath%20style='fill:%23F4B459;'%20d='M200.616,54.719c-20.442,0-39.261,6.811-54.469,18.181l0.073,0.009%20c2.991,2.89,6.291,4.924,8.835,8.251l-18.965,0.301c-2.972,3-5.68,6.264-8.233,9.656H161.3c2.544,3.054,4.896,5.708,7.03,9.081%20h-46.536c-1.705,2.936-3.282,5.954-4.659,9.09h56.493c1.477,3.127,2.799,5.489,3.921,8.799h-63.76%20c-1.012,3.146-1.878,6.364-2.535,9.646h68.966c0.675,3.155,1.194,6.072,1.55,9.045h-71.884c-0.301,3-0.456,6.045-0.456,9.118%20h72.859c0,3.228-0.228,6.218-0.556,9.118h-71.847c0.31,3.091,0.766,6.127,1.368,9.118h68.856c-0.711,2.954-1.532,5.926-2.562,9.008%20h-63.969c0.966,3.118,2.143,6.145,3.428,9.099h56.621c-1.568,3.319-3.346,5.972-5.306,9.081h-46.691%20c1.842,3.191,3.875,6.236,6.081,9.154l33.589,0.501c-2.863,3.437-6.537,5.507-9.884,8.516c0.182,0.146-5.352-0.018-16.248-0.191%20c16.576,17.105,39.744,27.772,65.446,27.772c50.357,0,91.176-40.82,91.176-91.176S250.981,54.719,200.616,54.719z'/%3e%3c/g%3e%3c/svg%3e", dt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%20-140%20780%20780'%20enable-background='new%200%200%20780%20500'%20version='1.1'%20xml:space='preserve'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40%20C0,17.909,17.909,0,40,0z'%20fill='%230E4595'/%3e%3cpath%20d='m293.2%20348.73l33.361-195.76h53.36l-33.385%20195.76h-53.336zm246.11-191.54c-10.57-3.966-27.137-8.222-47.822-8.222-52.725%200-89.865%2026.55-90.18%2064.603-0.299%2028.13%2026.514%2043.822%2046.752%2053.186%2020.771%209.595%2027.752%2015.714%2027.654%2024.283-0.131%2013.121-16.586%2019.116-31.922%2019.116-21.357%200-32.703-2.967-50.227-10.276l-6.876-3.11-7.489%2043.823c12.463%205.464%2035.51%2010.198%2059.438%2010.443%2056.09%200%2092.5-26.246%2092.916-66.882%200.199-22.269-14.016-39.216-44.801-53.188-18.65-9.055-30.072-15.099-29.951-24.268%200-8.137%209.668-16.839%2030.557-16.839%2017.449-0.27%2030.09%203.535%2039.938%207.5l4.781%202.26%207.232-42.429m137.31-4.223h-41.232c-12.773%200-22.332%203.487-27.941%2016.234l-79.244%20179.4h56.031s9.16-24.123%2011.232-29.418c6.125%200%2060.555%200.084%2068.338%200.084%201.596%206.853%206.49%2029.334%206.49%2029.334h49.514l-43.188-195.64zm-65.418%20126.41c4.412-11.279%2021.26-54.723%2021.26-54.723-0.316%200.522%204.379-11.334%207.074-18.684l3.605%2016.879s10.219%2046.729%2012.354%2056.528h-44.293zm-363.3-126.41l-52.24%20133.5-5.567-27.13c-9.725-31.273-40.025-65.155-73.898-82.118l47.766%20171.2%2056.456-0.064%2084.004-195.39h-56.521'%20fill='%23ffffff'/%3e%3cpath%20d='m146.92%20152.96h-86.041l-0.681%204.073c66.938%2016.204%20111.23%2055.363%20129.62%20102.41l-18.71-89.96c-3.23-12.395-12.597-16.094-24.186-16.527'%20fill='%23F2AE14'/%3e%3c/svg%3e", E = [
1208
1240
  {
1209
1241
  type: "visa",
1210
- imgSrc: ht
1242
+ imgSrc: dt
1211
1243
  },
1212
1244
  {
1213
1245
  type: "masterCard",
1214
- imgSrc: dt
1246
+ imgSrc: ct
1215
1247
  },
1216
1248
  {
1217
1249
  type: "americanExpress",
1218
- imgSrc: lt
1250
+ imgSrc: ot
1219
1251
  },
1220
1252
  {
1221
1253
  type: "discover",
1222
- imgSrc: ct
1254
+ imgSrc: lt
1223
1255
  }
1224
1256
  ];
1225
- class mt extends h {
1257
+ class ht extends d {
1226
1258
  cardType;
1227
1259
  constructor(e) {
1228
1260
  super("div", []), this.cardType = e.cardType;
1229
1261
  const t = document.createElement("label");
1230
1262
  t.setAttribute("for", "cardNumber"), t.textContent = e.label, t.style.color = e.styles.color, t.style.fontSize = `${e.styles.fontSize}px`, t.style.display = "block", t.style.marginBottom = "6px", this.getElement().appendChild(t);
1231
- const a = document.createElement("div");
1232
- a.className = e.isLoading ? "loading" : "", a.style.borderRadius = `${e.styles.borderRadius}px ${e.styles.borderRadius}px 0px 0px`;
1233
1263
  const i = document.createElement("div");
1234
- i.id = "card-element", i.className = `card-element ${e.isFocused ? "card-element-focus" : ""}`, i.style.zIndex = e.isFocused ? "2" : "0";
1264
+ i.className = e.isLoading ? "loading" : "", i.style.borderRadius = `${e.styles.borderRadius}px ${e.styles.borderRadius}px 0px 0px`;
1265
+ const a = document.createElement("div");
1266
+ a.id = "card-element", a.className = `card-element ${e.isFocused ? "card-element-focus" : ""}`, a.style.zIndex = e.isFocused ? "2" : "0";
1235
1267
  const s = document.createElement("div");
1236
1268
  if (s.className = "cards-position", e.cardType === "unknown")
1237
- E.forEach((n) => {
1238
- s.appendChild(this.createCardIcon(n));
1269
+ E.forEach((r) => {
1270
+ s.appendChild(this.createCardIcon(r));
1239
1271
  });
1240
1272
  else {
1241
- const n = E.find((o) => o.type === e.cardType);
1242
- n && s.appendChild(this.createCardIcon(n));
1273
+ const r = E.find((o) => o.type === e.cardType);
1274
+ r && s.appendChild(this.createCardIcon(r));
1243
1275
  }
1244
- i.appendChild(s), a.appendChild(i), this.getElement().appendChild(a);
1276
+ a.appendChild(s), i.appendChild(a), this.getElement().appendChild(i);
1245
1277
  }
1246
1278
  createCardIcon(e) {
1247
1279
  const t = document.createElement("div");
1248
1280
  t.className = "card-icon";
1249
- const a = document.createElement("img");
1250
- return a.src = e.imgSrc, t.appendChild(a), t;
1281
+ const i = document.createElement("img");
1282
+ return i.src = e.imgSrc, t.appendChild(i), t;
1251
1283
  }
1252
1284
  setFocused(e) {
1253
1285
  const t = this.getElement().querySelector(
@@ -1266,22 +1298,22 @@ class mt extends h {
1266
1298
  if (this.cardType === t)
1267
1299
  return this;
1268
1300
  this.cardType = t;
1269
- const a = this.getElement().querySelector(".cards-position");
1270
- if (a)
1271
- if (a.innerHTML = "", this.cardType === "unknown")
1272
- E.forEach((i) => {
1273
- a.appendChild(this.createCardIcon(i));
1301
+ const i = this.getElement().querySelector(".cards-position");
1302
+ if (i)
1303
+ if (i.innerHTML = "", this.cardType === "unknown")
1304
+ E.forEach((a) => {
1305
+ i.appendChild(this.createCardIcon(a));
1274
1306
  });
1275
1307
  else {
1276
- const i = E.find((s) => s.type === this.cardType);
1277
- i ? a.appendChild(this.createCardIcon(i)) : E.forEach((s) => {
1278
- a.appendChild(this.createCardIcon(s));
1308
+ const a = E.find((s) => s.type === this.cardType);
1309
+ a ? i.appendChild(this.createCardIcon(a)) : E.forEach((s) => {
1310
+ i.appendChild(this.createCardIcon(s));
1279
1311
  });
1280
1312
  }
1281
1313
  return this;
1282
1314
  }
1283
1315
  }
1284
- class ut extends h {
1316
+ class mt extends d {
1285
1317
  cardNumber;
1286
1318
  cardExpiry;
1287
1319
  cardCvv;
@@ -1290,45 +1322,47 @@ class ut extends h {
1290
1322
  super("div", []);
1291
1323
  const {
1292
1324
  checkoutProfile: t,
1293
- isLoading: a,
1294
- isFocused: i,
1325
+ isLoading: i,
1326
+ isFocused: a,
1295
1327
  isCvvFocused: s,
1296
- isCcValid: n,
1328
+ isCcValid: r,
1297
1329
  isCvvValid: o,
1298
1330
  cardType: l,
1299
- cardExpiry: d,
1300
- cardExpiryError: c,
1331
+ cardExpiry: c,
1332
+ cardExpiryError: h,
1301
1333
  cardExpiryTouched: m,
1302
- onChange: p,
1303
- onBlur: u,
1334
+ onChange: u,
1335
+ onBlur: p,
1304
1336
  translationFunc: f
1305
1337
  } = e, b = document.createElement("div");
1306
- b.className = "card-grid", this.cardNumber = new mt({
1338
+ b.className = "card-grid", this.cardNumber = new ht({
1307
1339
  styles: {
1308
1340
  color: t.styles.textColor,
1309
1341
  fontSize: t.styles.fontSize,
1310
1342
  borderRadius: t.styles.borderRadius
1311
1343
  },
1312
1344
  label: f("cardInformation"),
1313
- isLoading: a,
1314
- isFocused: i,
1345
+ isLoading: i,
1346
+ isFocused: a,
1315
1347
  cardType: l
1316
1348
  }), b.appendChild(this.cardNumber.getElement());
1317
1349
  const C = document.createElement("div");
1318
- C.className = "card-details", this.cardExpiry = new M({
1350
+ C.className = "card-details", this.cardExpiry = new k({
1319
1351
  name: "cardExpiry",
1320
1352
  placeholder: f("cardExpiry"),
1321
- error: !!(c && m),
1322
- errorMsg: c,
1323
- value: d,
1324
- onChange: p,
1353
+ error: !!(h && m),
1354
+ errorMsg: h,
1355
+ value: c,
1356
+ onChange: (g) => {
1357
+ this.trimCardExpiry(), u(g);
1358
+ },
1325
1359
  styles: {
1326
1360
  color: t.styles.textColor,
1327
1361
  borderRadius: `0px 0px 0px ${t.styles.borderRadius}px`,
1328
1362
  fontSize: t.styles.fontSize,
1329
1363
  fontFamily: t.styles.fontFamily
1330
1364
  }
1331
- }), this.cardExpiry.addEventListener("blur", u), this.cardExpiry.addEventListener("keydown", (g) => {
1365
+ }), this.cardExpiry.addEventListener("blur", p), this.cardExpiry.addEventListener("keydown", (g) => {
1332
1366
  const w = g;
1333
1367
  ![
1334
1368
  "Backspace",
@@ -1338,16 +1372,16 @@ class ut extends h {
1338
1372
  "Tab"
1339
1373
  ].includes(w.key) && !/^\d$/.test(w.key) && w.preventDefault();
1340
1374
  });
1341
- const N = this.cardExpiry.getElement();
1342
- N.style.height = "100%";
1375
+ const P = this.cardExpiry.getElement();
1376
+ P.style.height = "100%";
1343
1377
  const F = document.createElement("div");
1344
- if (F.className = "input-wrapper", this.cardCvv = new ot({
1378
+ if (F.className = "input-wrapper", this.cardCvv = new nt({
1345
1379
  styles: {
1346
1380
  borderRadius: typeof t.styles.borderRadius == "number" ? t.styles.borderRadius : 0
1347
1381
  },
1348
- isLoading: a,
1382
+ isLoading: i,
1349
1383
  isFocused: s
1350
- }), F.appendChild(this.cardCvv.getElement()), C.appendChild(this.cardExpiry.getElement()), C.appendChild(F), b.appendChild(C), this.getElement().appendChild(b), i && !n) {
1384
+ }), F.appendChild(this.cardCvv.getElement()), C.appendChild(this.cardExpiry.getElement()), C.appendChild(F), b.appendChild(C), this.getElement().appendChild(b), a && !r) {
1351
1385
  const g = new v({
1352
1386
  text: f("validation.cardNumberInvalid")
1353
1387
  });
@@ -1363,34 +1397,41 @@ class ut extends h {
1363
1397
  updateCardType(e) {
1364
1398
  return this.cardNumber.updateCardType(e), this;
1365
1399
  }
1366
- updateCardExpiry(e, t, a) {
1367
- return this.cardExpiry.setValue(e), t && a ? this.cardExpiry.setError(!0, t) : this.cardExpiry.setError(!1), this;
1400
+ updateCardExpiry(e, t, i) {
1401
+ return this.cardExpiry.setValue(e), t && i ? this.cardExpiry.setError(!0, t) : this.cardExpiry.setError(!1), this;
1368
1402
  }
1369
- updateCardNumberValidation(e, t, a) {
1403
+ getCardExpiryValue() {
1404
+ return this.cardExpiry.getValue();
1405
+ }
1406
+ trimCardExpiry() {
1407
+ const e = this.getCardExpiryValue().trim();
1408
+ return this.cardExpiry.setValue(e), this;
1409
+ }
1410
+ updateCardNumberValidation(e, t, i) {
1370
1411
  if (this.cardNumber.setFocused(e), e && !t) {
1371
1412
  if (!this.validationMessages.has("cardNumber")) {
1372
- const i = new v({
1373
- text: a("validation.cardNumberInvalid")
1413
+ const a = new v({
1414
+ text: i("validation.cardNumberInvalid")
1374
1415
  });
1375
- this.validationMessages.set("cardNumber", i), this.appendChild(i);
1416
+ this.validationMessages.set("cardNumber", a), this.appendChild(a);
1376
1417
  }
1377
1418
  } else {
1378
- const i = this.validationMessages.get("cardNumber");
1379
- i && (i.getElement().remove(), this.validationMessages.delete("cardNumber"));
1419
+ const a = this.validationMessages.get("cardNumber");
1420
+ a && (a.getElement().remove(), this.validationMessages.delete("cardNumber"));
1380
1421
  }
1381
1422
  return this;
1382
1423
  }
1383
- updateCardCvvValidation(e, t, a) {
1424
+ updateCardCvvValidation(e, t, i) {
1384
1425
  if (this.cardCvv.setFocused(e), e && !t) {
1385
1426
  if (!this.validationMessages.has("cardCvv")) {
1386
- const i = new v({
1387
- text: a("validation.cardSecurityFormat")
1427
+ const a = new v({
1428
+ text: i("validation.cardSecurityFormat")
1388
1429
  });
1389
- this.validationMessages.set("cardCvv", i), this.appendChild(i);
1430
+ this.validationMessages.set("cardCvv", a), this.appendChild(a);
1390
1431
  }
1391
1432
  } else {
1392
- const i = this.validationMessages.get("cardCvv");
1393
- i && (i.getElement().remove(), this.validationMessages.delete("cardCvv"));
1433
+ const a = this.validationMessages.get("cardCvv");
1434
+ a && (a.getElement().remove(), this.validationMessages.delete("cardCvv"));
1394
1435
  }
1395
1436
  return this;
1396
1437
  }
@@ -1398,23 +1439,23 @@ class ut extends h {
1398
1439
  return this.cardNumber.setLoading(e), this.cardCvv.setLoading(e), this;
1399
1440
  }
1400
1441
  }
1401
- class pt {
1442
+ class ut {
1402
1443
  input;
1403
1444
  constructor(e) {
1404
1445
  const {
1405
1446
  value: t,
1406
- onChange: a,
1407
- onBlur: i,
1447
+ onChange: i,
1448
+ onBlur: a,
1408
1449
  error: s,
1409
- errorMsg: n,
1450
+ errorMsg: r,
1410
1451
  checkoutProfile: o,
1411
1452
  translationFunc: l
1412
1453
  } = e;
1413
- this.input = new M({
1454
+ this.input = new k({
1414
1455
  name: "email",
1415
1456
  label: l("email"),
1416
1457
  error: s,
1417
- errorMsg: n,
1458
+ errorMsg: r,
1418
1459
  styles: {
1419
1460
  color: o.styles.textColor,
1420
1461
  borderRadius: `${o.styles.borderRadius}px`,
@@ -1424,8 +1465,11 @@ class pt {
1424
1465
  placeholder: l("email"),
1425
1466
  type: "email",
1426
1467
  value: t,
1427
- onChange: a
1428
- }), this.input.addEventListener("blur", i);
1468
+ // Wrap the original onChange to apply trim before calling it
1469
+ onChange: (c) => {
1470
+ this.trim(), i(c);
1471
+ }
1472
+ }), this.input.addEventListener("blur", a);
1429
1473
  }
1430
1474
  getValue() {
1431
1475
  return this.input.getValue();
@@ -1433,6 +1477,10 @@ class pt {
1433
1477
  setValue(e) {
1434
1478
  return this.input.setValue(e), this;
1435
1479
  }
1480
+ trim() {
1481
+ const e = this.getValue().trim();
1482
+ return this.setValue(e), this;
1483
+ }
1436
1484
  setError(e, t) {
1437
1485
  return this.input.setError(e, t), this;
1438
1486
  }
@@ -1443,19 +1491,19 @@ class pt {
1443
1491
  return this.input.appendTo(e), this;
1444
1492
  }
1445
1493
  }
1446
- const ft = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='101px'%20height='32'%20viewBox='0%200%20101%2032'%20preserveAspectRatio='xMinYMin%20meet'%3e%3cpath%20fill='%23003087'%20d='M%2012.237%202.8%20L%204.437%202.8%20C%203.937%202.8%203.437%203.2%203.337%203.7%20L%200.237%2023.7%20C%200.137%2024.1%200.437%2024.4%200.837%2024.4%20L%204.537%2024.4%20C%205.037%2024.4%205.537%2024%205.637%2023.5%20L%206.437%2018.1%20C%206.537%2017.6%206.937%2017.2%207.537%2017.2%20L%2010.037%2017.2%20C%2015.137%2017.2%2018.137%2014.7%2018.937%209.8%20C%2019.237%207.7%2018.937%206%2017.937%204.8%20C%2016.837%203.5%2014.837%202.8%2012.237%202.8%20Z%20M%2013.137%2010.1%20C%2012.737%2012.9%2010.537%2012.9%208.537%2012.9%20L%207.337%2012.9%20L%208.137%207.7%20C%208.137%207.4%208.437%207.2%208.737%207.2%20L%209.237%207.2%20C%2010.637%207.2%2011.937%207.2%2012.637%208%20C%2013.137%208.4%2013.337%209.1%2013.137%2010.1%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2035.437%2010%20L%2031.737%2010%20C%2031.437%2010%2031.137%2010.2%2031.137%2010.5%20L%2030.937%2011.5%20L%2030.637%2011.1%20C%2029.837%209.9%2028.037%209.5%2026.237%209.5%20C%2022.137%209.5%2018.637%2012.6%2017.937%2017%20C%2017.537%2019.2%2018.037%2021.3%2019.337%2022.7%20C%2020.437%2024%2022.137%2024.6%2024.037%2024.6%20C%2027.337%2024.6%2029.237%2022.5%2029.237%2022.5%20L%2029.037%2023.5%20C%2028.937%2023.9%2029.237%2024.3%2029.637%2024.3%20L%2033.037%2024.3%20C%2033.537%2024.3%2034.037%2023.9%2034.137%2023.4%20L%2036.137%2010.6%20C%2036.237%2010.4%2035.837%2010%2035.437%2010%20Z%20M%2030.337%2017.2%20C%2029.937%2019.3%2028.337%2020.8%2026.137%2020.8%20C%2025.037%2020.8%2024.237%2020.5%2023.637%2019.8%20C%2023.037%2019.1%2022.837%2018.2%2023.037%2017.2%20C%2023.337%2015.1%2025.137%2013.6%2027.237%2013.6%20C%2028.337%2013.6%2029.137%2014%2029.737%2014.6%20C%2030.237%2015.3%2030.437%2016.2%2030.337%2017.2%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2055.337%2010%20L%2051.637%2010%20C%2051.237%2010%2050.937%2010.2%2050.737%2010.5%20L%2045.537%2018.1%20L%2043.337%2010.8%20C%2043.237%2010.3%2042.737%2010%2042.337%2010%20L%2038.637%2010%20C%2038.237%2010%2037.837%2010.4%2038.037%2010.9%20L%2042.137%2023%20L%2038.237%2028.4%20C%2037.937%2028.8%2038.237%2029.4%2038.737%2029.4%20L%2042.437%2029.4%20C%2042.837%2029.4%2043.137%2029.2%2043.337%2028.9%20L%2055.837%2010.9%20C%2056.137%2010.6%2055.837%2010%2055.337%2010%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2067.737%202.8%20L%2059.937%202.8%20C%2059.437%202.8%2058.937%203.2%2058.837%203.7%20L%2055.737%2023.6%20C%2055.637%2024%2055.937%2024.3%2056.337%2024.3%20L%2060.337%2024.3%20C%2060.737%2024.3%2061.037%2024%2061.037%2023.7%20L%2061.937%2018%20C%2062.037%2017.5%2062.437%2017.1%2063.037%2017.1%20L%2065.537%2017.1%20C%2070.637%2017.1%2073.637%2014.6%2074.437%209.7%20C%2074.737%207.6%2074.437%205.9%2073.437%204.7%20C%2072.237%203.5%2070.337%202.8%2067.737%202.8%20Z%20M%2068.637%2010.1%20C%2068.237%2012.9%2066.037%2012.9%2064.037%2012.9%20L%2062.837%2012.9%20L%2063.637%207.7%20C%2063.637%207.4%2063.937%207.2%2064.237%207.2%20L%2064.737%207.2%20C%2066.137%207.2%2067.437%207.2%2068.137%208%20C%2068.637%208.4%2068.737%209.1%2068.637%2010.1%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2090.937%2010%20L%2087.237%2010%20C%2086.937%2010%2086.637%2010.2%2086.637%2010.5%20L%2086.437%2011.5%20L%2086.137%2011.1%20C%2085.337%209.9%2083.537%209.5%2081.737%209.5%20C%2077.637%209.5%2074.137%2012.6%2073.437%2017%20C%2073.037%2019.2%2073.537%2021.3%2074.837%2022.7%20C%2075.937%2024%2077.637%2024.6%2079.537%2024.6%20C%2082.837%2024.6%2084.737%2022.5%2084.737%2022.5%20L%2084.537%2023.5%20C%2084.437%2023.9%2084.737%2024.3%2085.137%2024.3%20L%2088.537%2024.3%20C%2089.037%2024.3%2089.537%2023.9%2089.637%2023.4%20L%2091.637%2010.6%20C%2091.637%2010.4%2091.337%2010%2090.937%2010%20Z%20M%2085.737%2017.2%20C%2085.337%2019.3%2083.737%2020.8%2081.537%2020.8%20C%2080.437%2020.8%2079.637%2020.5%2079.037%2019.8%20C%2078.437%2019.1%2078.237%2018.2%2078.437%2017.2%20C%2078.737%2015.1%2080.537%2013.6%2082.637%2013.6%20C%2083.737%2013.6%2084.537%2014%2085.137%2014.6%20C%2085.737%2015.3%2085.937%2016.2%2085.737%2017.2%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2095.337%203.3%20L%2092.137%2023.6%20C%2092.037%2024%2092.337%2024.3%2092.737%2024.3%20L%2095.937%2024.3%20C%2096.437%2024.3%2096.937%2023.9%2097.037%2023.4%20L%20100.237%203.5%20C%20100.337%203.1%20100.037%202.8%2099.637%202.8%20L%2096.037%202.8%20C%2095.637%202.8%2095.437%203%2095.337%203.3%20Z'/%3e%3c/svg%3e";
1447
- class gt extends h {
1494
+ const pt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='101px'%20height='32'%20viewBox='0%200%20101%2032'%20preserveAspectRatio='xMinYMin%20meet'%3e%3cpath%20fill='%23003087'%20d='M%2012.237%202.8%20L%204.437%202.8%20C%203.937%202.8%203.437%203.2%203.337%203.7%20L%200.237%2023.7%20C%200.137%2024.1%200.437%2024.4%200.837%2024.4%20L%204.537%2024.4%20C%205.037%2024.4%205.537%2024%205.637%2023.5%20L%206.437%2018.1%20C%206.537%2017.6%206.937%2017.2%207.537%2017.2%20L%2010.037%2017.2%20C%2015.137%2017.2%2018.137%2014.7%2018.937%209.8%20C%2019.237%207.7%2018.937%206%2017.937%204.8%20C%2016.837%203.5%2014.837%202.8%2012.237%202.8%20Z%20M%2013.137%2010.1%20C%2012.737%2012.9%2010.537%2012.9%208.537%2012.9%20L%207.337%2012.9%20L%208.137%207.7%20C%208.137%207.4%208.437%207.2%208.737%207.2%20L%209.237%207.2%20C%2010.637%207.2%2011.937%207.2%2012.637%208%20C%2013.137%208.4%2013.337%209.1%2013.137%2010.1%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2035.437%2010%20L%2031.737%2010%20C%2031.437%2010%2031.137%2010.2%2031.137%2010.5%20L%2030.937%2011.5%20L%2030.637%2011.1%20C%2029.837%209.9%2028.037%209.5%2026.237%209.5%20C%2022.137%209.5%2018.637%2012.6%2017.937%2017%20C%2017.537%2019.2%2018.037%2021.3%2019.337%2022.7%20C%2020.437%2024%2022.137%2024.6%2024.037%2024.6%20C%2027.337%2024.6%2029.237%2022.5%2029.237%2022.5%20L%2029.037%2023.5%20C%2028.937%2023.9%2029.237%2024.3%2029.637%2024.3%20L%2033.037%2024.3%20C%2033.537%2024.3%2034.037%2023.9%2034.137%2023.4%20L%2036.137%2010.6%20C%2036.237%2010.4%2035.837%2010%2035.437%2010%20Z%20M%2030.337%2017.2%20C%2029.937%2019.3%2028.337%2020.8%2026.137%2020.8%20C%2025.037%2020.8%2024.237%2020.5%2023.637%2019.8%20C%2023.037%2019.1%2022.837%2018.2%2023.037%2017.2%20C%2023.337%2015.1%2025.137%2013.6%2027.237%2013.6%20C%2028.337%2013.6%2029.137%2014%2029.737%2014.6%20C%2030.237%2015.3%2030.437%2016.2%2030.337%2017.2%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2055.337%2010%20L%2051.637%2010%20C%2051.237%2010%2050.937%2010.2%2050.737%2010.5%20L%2045.537%2018.1%20L%2043.337%2010.8%20C%2043.237%2010.3%2042.737%2010%2042.337%2010%20L%2038.637%2010%20C%2038.237%2010%2037.837%2010.4%2038.037%2010.9%20L%2042.137%2023%20L%2038.237%2028.4%20C%2037.937%2028.8%2038.237%2029.4%2038.737%2029.4%20L%2042.437%2029.4%20C%2042.837%2029.4%2043.137%2029.2%2043.337%2028.9%20L%2055.837%2010.9%20C%2056.137%2010.6%2055.837%2010%2055.337%2010%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2067.737%202.8%20L%2059.937%202.8%20C%2059.437%202.8%2058.937%203.2%2058.837%203.7%20L%2055.737%2023.6%20C%2055.637%2024%2055.937%2024.3%2056.337%2024.3%20L%2060.337%2024.3%20C%2060.737%2024.3%2061.037%2024%2061.037%2023.7%20L%2061.937%2018%20C%2062.037%2017.5%2062.437%2017.1%2063.037%2017.1%20L%2065.537%2017.1%20C%2070.637%2017.1%2073.637%2014.6%2074.437%209.7%20C%2074.737%207.6%2074.437%205.9%2073.437%204.7%20C%2072.237%203.5%2070.337%202.8%2067.737%202.8%20Z%20M%2068.637%2010.1%20C%2068.237%2012.9%2066.037%2012.9%2064.037%2012.9%20L%2062.837%2012.9%20L%2063.637%207.7%20C%2063.637%207.4%2063.937%207.2%2064.237%207.2%20L%2064.737%207.2%20C%2066.137%207.2%2067.437%207.2%2068.137%208%20C%2068.637%208.4%2068.737%209.1%2068.637%2010.1%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2090.937%2010%20L%2087.237%2010%20C%2086.937%2010%2086.637%2010.2%2086.637%2010.5%20L%2086.437%2011.5%20L%2086.137%2011.1%20C%2085.337%209.9%2083.537%209.5%2081.737%209.5%20C%2077.637%209.5%2074.137%2012.6%2073.437%2017%20C%2073.037%2019.2%2073.537%2021.3%2074.837%2022.7%20C%2075.937%2024%2077.637%2024.6%2079.537%2024.6%20C%2082.837%2024.6%2084.737%2022.5%2084.737%2022.5%20L%2084.537%2023.5%20C%2084.437%2023.9%2084.737%2024.3%2085.137%2024.3%20L%2088.537%2024.3%20C%2089.037%2024.3%2089.537%2023.9%2089.637%2023.4%20L%2091.637%2010.6%20C%2091.637%2010.4%2091.337%2010%2090.937%2010%20Z%20M%2085.737%2017.2%20C%2085.337%2019.3%2083.737%2020.8%2081.537%2020.8%20C%2080.437%2020.8%2079.637%2020.5%2079.037%2019.8%20C%2078.437%2019.1%2078.237%2018.2%2078.437%2017.2%20C%2078.737%2015.1%2080.537%2013.6%2082.637%2013.6%20C%2083.737%2013.6%2084.537%2014%2085.137%2014.6%20C%2085.737%2015.3%2085.937%2016.2%2085.737%2017.2%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2095.337%203.3%20L%2092.137%2023.6%20C%2092.037%2024%2092.337%2024.3%2092.737%2024.3%20L%2095.937%2024.3%20C%2096.437%2024.3%2096.937%2023.9%2097.037%2023.4%20L%20100.237%203.5%20C%20100.337%203.1%20100.037%202.8%2099.637%202.8%20L%2096.037%202.8%20C%2095.637%202.8%2095.437%203%2095.337%203.3%20Z'/%3e%3c/svg%3e";
1495
+ class ft extends d {
1448
1496
  formData;
1449
1497
  onSubmit;
1450
1498
  isSubmitting = !1;
1451
1499
  constructor(e) {
1452
1500
  super("div", ["paypal"]);
1453
- const { formData: t, onSubmit: a } = e;
1454
- this.formData = t, this.onSubmit = a, this.getElement().style.cursor = a ? "pointer" : "default", this.getElement().style.opacity = "1";
1455
- const i = document.createElement("div");
1456
- i.className = "paypal-icon-container";
1501
+ const { formData: t, onSubmit: i } = e;
1502
+ this.formData = t, this.onSubmit = i, this.getElement().style.cursor = i ? "pointer" : "default", this.getElement().style.opacity = "1";
1503
+ const a = document.createElement("div");
1504
+ a.className = "paypal-icon-container";
1457
1505
  const s = document.createElement("img");
1458
- s.src = ft, s.style.width = "69px", s.style.height = "22px", s.style.maxWidth = "100%", s.style.display = "block", s.style.height = "auto", i.appendChild(s), this.getElement().appendChild(i), a && this.getElement().addEventListener("click", () => this.handleSubmit());
1506
+ s.src = pt, s.style.width = "69px", s.style.height = "22px", s.style.maxWidth = "100%", s.style.display = "block", s.style.height = "auto", a.appendChild(s), this.getElement().appendChild(a), i && this.getElement().addEventListener("click", () => this.handleSubmit());
1459
1507
  }
1460
1508
  async handleSubmit() {
1461
1509
  if (!(!this.onSubmit || this.isSubmitting)) {
@@ -1476,30 +1524,30 @@ class gt extends h {
1476
1524
  return this.isSubmitting = e, this.getElement().style.opacity = e ? "0.7" : "1", this;
1477
1525
  }
1478
1526
  }
1479
- class yt extends h {
1527
+ class gt extends d {
1480
1528
  paymentMethods = /* @__PURE__ */ new Map();
1481
1529
  constructor(e) {
1482
- const { checkoutProfile: t, formData: a, onPaypalSubmit: i } = e;
1530
+ const { checkoutProfile: t, formData: i, onPaypalSubmit: a } = e;
1483
1531
  if (!t?.additionalPaymentMethods) {
1484
1532
  super("div", ["payment-methods"]), this.getElement().style.display = "none";
1485
1533
  return;
1486
1534
  }
1487
1535
  const s = Object.entries(
1488
1536
  t.additionalPaymentMethods
1489
- ).filter(([, n]) => n.enabled).sort((n, o) => n[1].order - o[1].order);
1537
+ ).filter(([, r]) => r.enabled).sort((r, o) => r[1].order - o[1].order);
1490
1538
  if (s.length === 0) {
1491
1539
  super("div", ["payment-methods"]), this.getElement().style.display = "none";
1492
1540
  return;
1493
1541
  }
1494
1542
  super("div", ["payment-methods"]);
1495
- for (const [n] of s)
1496
- switch (n) {
1543
+ for (const [r] of s)
1544
+ switch (r) {
1497
1545
  case "paypal": {
1498
- if (i) {
1499
- const o = new gt({
1546
+ if (a) {
1547
+ const o = new ft({
1500
1548
  checkoutProfile: t,
1501
- formData: a,
1502
- onSubmit: i
1549
+ formData: i,
1550
+ onSubmit: a
1503
1551
  });
1504
1552
  this.paymentMethods.set("paypal", o), o.appendTo(this.getElement());
1505
1553
  }
@@ -1515,8 +1563,8 @@ class yt extends h {
1515
1563
  return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
1516
1564
  }
1517
1565
  }
1518
- const vt = 17;
1519
- class Et extends h {
1566
+ const yt = 17;
1567
+ class vt extends d {
1520
1568
  styles;
1521
1569
  isHovered = !1;
1522
1570
  constructor(e) {
@@ -1527,7 +1575,7 @@ class Et extends h {
1527
1575
  }
1528
1576
  applyStyles() {
1529
1577
  const e = this.getElement();
1530
- e.style.backgroundColor = this.isHovered ? `color-mix(in srgb, ${this.styles.backgroundColor} 80%, transparent)` : this.styles.backgroundColor, e.disabled ? e.style.color = "#cccccc" : e.style.color = this.styles.color, e.style.borderRadius = this.styles.borderRadius === vt ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
1578
+ e.style.backgroundColor = this.isHovered ? `color-mix(in srgb, ${this.styles.backgroundColor} 80%, transparent)` : this.styles.backgroundColor, e.disabled ? e.style.color = "#cccccc" : e.style.color = this.styles.color, e.style.borderRadius = this.styles.borderRadius === yt ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
1531
1579
  }
1532
1580
  handleMouseEnter() {
1533
1581
  this.isHovered = !0, this.applyStyles();
@@ -1539,20 +1587,20 @@ class Et extends h {
1539
1587
  return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
1540
1588
  }
1541
1589
  }
1542
- class bt {
1590
+ class Et {
1543
1591
  button;
1544
1592
  constructor(e) {
1545
- const { disabled: t, checkoutProfile: a, translationFunc: i } = e;
1546
- this.button = new Et({
1547
- text: i(
1548
- `buttonTexts.${a?.layout.actionButton.translationKey}`
1593
+ const { disabled: t, checkoutProfile: i, translationFunc: a } = e;
1594
+ this.button = new vt({
1595
+ text: a(
1596
+ `buttonTexts.${i?.layout.actionButton.translationKey}`
1549
1597
  ),
1550
1598
  styles: {
1551
- backgroundColor: a.styles.buttonColor,
1552
- color: a.styles.buttonTextColor,
1553
- fontFamily: a.styles.fontFamily,
1554
- borderRadius: a.styles.borderRadius,
1555
- fontSize: a.styles.buttonFontSize
1599
+ backgroundColor: i.styles.buttonColor,
1600
+ color: i.styles.buttonTextColor,
1601
+ fontFamily: i.styles.fontFamily,
1602
+ borderRadius: i.styles.borderRadius,
1603
+ fontSize: i.styles.buttonFontSize
1556
1604
  },
1557
1605
  disabled: t
1558
1606
  });
@@ -1563,15 +1611,15 @@ class bt {
1563
1611
  setDisabled(e) {
1564
1612
  return this.button.setDisabled(e), this;
1565
1613
  }
1566
- addEventListener(e, t, a) {
1567
- return this.button.addEventListener(e, t, a), this;
1614
+ addEventListener(e, t, i) {
1615
+ return this.button.addEventListener(e, t, i), this;
1568
1616
  }
1569
1617
  appendTo(e) {
1570
1618
  return this.button.appendTo(e), this;
1571
1619
  }
1572
1620
  }
1573
- const Ct = "https://test-htp.tokenex.com/Iframe/Iframe-v3.min.js";
1574
- class St extends h {
1621
+ const bt = "https://test-htp.tokenex.com/Iframe/Iframe-v3.min.js", Ct = "https://htp.tokenex.com/iframe/iframe-v3.min.js";
1622
+ class St extends d {
1575
1623
  options;
1576
1624
  isSubmitting = !1;
1577
1625
  scriptCleanup;
@@ -1585,14 +1633,15 @@ class St extends h {
1585
1633
  spinner;
1586
1634
  alert;
1587
1635
  // factories
1588
- formManager = G();
1636
+ formManager = _();
1589
1637
  checkoutProfile;
1590
- translation = L();
1638
+ translation = M();
1591
1639
  iframeHook;
1592
1640
  constructor(e) {
1593
1641
  super("form", ["form-container"]), this.options = e, this.checkoutProfile = O({
1594
1642
  apiKey: e.apiKey,
1595
- profileId: e.profileId
1643
+ profileId: e.profileId,
1644
+ environment: e.environment
1596
1645
  }), e.locale && this.translation.setLocale(e.locale), this.getElement().style.opacity = "0", this.getElement().style.transition = "opacity 0.5s ease-in-out", this.getElement().addEventListener("submit", this.handleSubmit), this.getElement().addEventListener("keydown", this.handleKeyDown), this.formManager.subscribe(this.handleFormStateChange), this.checkoutProfile.subscribe(this.handleProfileStateChange), this.initializeForm(), this.appendTo(e.container);
1597
1646
  }
1598
1647
  _getFormStateData() {
@@ -1615,7 +1664,7 @@ class St extends h {
1615
1664
  if (this.hideSpinner(), e.checkoutProfile)
1616
1665
  try {
1617
1666
  if (e.checkoutProfile.styles?.fontFamily) {
1618
- const { cleanup: t } = et({
1667
+ const { cleanup: t } = Qe({
1619
1668
  fontFamily: e.checkoutProfile.styles.fontFamily
1620
1669
  });
1621
1670
  this.fontCleanup = t;
@@ -1638,16 +1687,17 @@ class St extends h {
1638
1687
  setTimeout(() => this.initializeTokenExIframe(), 500);
1639
1688
  return;
1640
1689
  }
1641
- const { inputStyles: t, formContainerStyle: a } = at(
1690
+ const { inputStyles: t, formContainerStyle: i } = tt(
1642
1691
  e.checkoutProfile
1643
1692
  );
1644
- this.applyFormContainerStyles(a), this.iframeHook = Y({
1693
+ this.applyFormContainerStyles(i), this.iframeHook = Z({
1645
1694
  apiKey: this.options.apiKey,
1646
1695
  checkoutProfile: e.checkoutProfile,
1647
1696
  inputStyles: t,
1648
- setFormData: (i) => {
1649
- this.formManager.setFormData(i);
1650
- }
1697
+ setFormData: (a) => {
1698
+ this.formManager.setFormData(a);
1699
+ },
1700
+ environment: this.options.environment
1651
1701
  }), this.iframeHook?.subscribe(this.handleIframeStateChange), this.renderFormComponents();
1652
1702
  } catch {
1653
1703
  this.setErrorMessage("Failed to initialize payment form");
@@ -1668,8 +1718,8 @@ class St extends h {
1668
1718
  createCardSection = (e) => {
1669
1719
  if (this.iframeHook && !this.cardSection)
1670
1720
  try {
1671
- const { formData: t, errors: a, touched: i } = this._getFormStateData(), s = this.iframeHook.getState();
1672
- this.cardSection = new ut({
1721
+ const { formData: t, errors: i, touched: a } = this._getFormStateData(), s = this.iframeHook.getState();
1722
+ this.cardSection = new mt({
1673
1723
  checkoutProfile: e,
1674
1724
  isLoading: s.loadingIframe,
1675
1725
  isFocused: s.isFocused,
@@ -1678,8 +1728,8 @@ class St extends h {
1678
1728
  isCvvValid: s.isCvvValid,
1679
1729
  cardType: s.possibleCardType,
1680
1730
  cardExpiry: t.cardExpiry,
1681
- cardExpiryError: a.cardExpiry,
1682
- cardExpiryTouched: !!i.cardExpiry,
1731
+ cardExpiryError: i.cardExpiry,
1732
+ cardExpiryTouched: !!a.cardExpiry,
1683
1733
  onChange: this.handleChange,
1684
1734
  onBlur: this.handleBlur,
1685
1735
  translationFunc: this.translation.t
@@ -1690,10 +1740,10 @@ class St extends h {
1690
1740
  };
1691
1741
  initializeForm() {
1692
1742
  this.showSpinner("Loading checkout form..."), this.options.errorMsg && this.setErrorMessage(this.options.errorMsg);
1693
- const { cleanup: e, isLoaded: t } = tt({
1694
- scriptSrc: Ct
1743
+ const e = this.options.environment === "test" ? bt : Ct, { cleanup: t, isLoaded: i } = et({
1744
+ scriptSrc: e
1695
1745
  });
1696
- this.scriptCleanup = e, t.then(() => {
1746
+ this.scriptCleanup = t, i.then(() => {
1697
1747
  }).catch(() => {
1698
1748
  this.setErrorMessage(
1699
1749
  "Failed to load payment system. Please try again later."
@@ -1724,55 +1774,55 @@ class St extends h {
1724
1774
  createPaymentMethods(e) {
1725
1775
  if (!e?.additionalPaymentMethods || Object.entries(
1726
1776
  e.additionalPaymentMethods
1727
- ).filter(([, i]) => i.enabled).length === 0)
1777
+ ).filter(([, a]) => a.enabled).length === 0)
1728
1778
  return;
1729
- const { formData: a } = this._getFormStateData();
1730
- this.paymentMethods = new yt({
1779
+ const { formData: i } = this._getFormStateData();
1780
+ this.paymentMethods = new gt({
1731
1781
  checkoutProfile: e,
1732
- formData: a,
1782
+ formData: i,
1733
1783
  onPaypalSubmit: async () => {
1734
1784
  await this.handlePaypalSubmit();
1735
1785
  }
1736
1786
  }), this.appendChild(this.paymentMethods);
1737
1787
  }
1738
1788
  createEmailField(e) {
1739
- const { formData: t, errors: a, touched: i } = this._getFormStateData();
1740
- this.emailField = new pt({
1789
+ const { formData: t, errors: i, touched: a } = this._getFormStateData();
1790
+ this.emailField = new ut({
1741
1791
  value: t.email,
1742
1792
  onChange: this.handleChange,
1743
1793
  onBlur: this.handleBlur,
1744
- error: !!(a.email && i.email),
1745
- errorMsg: a.email,
1794
+ error: !!(i.email && a.email),
1795
+ errorMsg: i.email,
1746
1796
  checkoutProfile: e,
1747
1797
  translationFunc: this.translation.t
1748
1798
  }), this.element.appendChild(this.emailField.getElement());
1749
1799
  }
1750
1800
  createCardholderSection(e) {
1751
- const { formData: t, errors: a, touched: i } = this._getFormStateData();
1752
- this.cardholderSection = new nt({
1801
+ const { formData: t, errors: i, touched: a } = this._getFormStateData();
1802
+ this.cardholderSection = new rt({
1753
1803
  value: t.name,
1754
1804
  onChange: this.handleChange,
1755
1805
  onBlur: this.handleBlur,
1756
- error: !!(a.name && i.name),
1757
- errorMsg: a.name,
1806
+ error: !!(i.name && a.name),
1807
+ errorMsg: i.name,
1758
1808
  checkoutProfile: e,
1759
1809
  translationFunc: this.translation.t
1760
1810
  }), this.element.appendChild(this.cardholderSection.getElement());
1761
1811
  }
1762
1812
  createSubmitButton(e) {
1763
- this.submitButton = new bt({
1813
+ this.submitButton = new Et({
1764
1814
  disabled: this.isFormDisabled(),
1765
1815
  checkoutProfile: e,
1766
1816
  translationFunc: this.translation.t
1767
1817
  }), this.element.appendChild(this.submitButton.getElement());
1768
1818
  }
1769
1819
  handleChange = (e) => {
1770
- const t = e.target, { name: a, value: i } = t;
1771
- this.formManager.handleChange(a, i);
1820
+ const t = e.target, { name: i, value: a } = t;
1821
+ this.formManager.handleChange(i, a);
1772
1822
  };
1773
1823
  handleBlur = (e) => {
1774
- const t = e.target, { name: a, value: i } = t;
1775
- this.formManager.handleBlur(a, i);
1824
+ const t = e.target, { name: i, value: a } = t;
1825
+ this.formManager.handleBlur(i, a);
1776
1826
  };
1777
1827
  updateFormUI() {
1778
1828
  const e = this.formManager.getFormState();
@@ -1795,15 +1845,15 @@ class St extends h {
1795
1845
  isCvvValid: !1
1796
1846
  };
1797
1847
  this.iframeHook && (t = this.iframeHook.getState());
1798
- const a = Object.keys(e.errors).length > 0, i = (
1848
+ const i = Object.keys(e.errors).length > 0, a = (
1799
1849
  // Only require card validation if CardSection exists
1800
1850
  (!this.cardSection || t.isCcValid && t.isCvvValid) && !!e.formData.email && !!e.formData.name && // Only require card expiry if CardSection exists
1801
1851
  (!this.cardSection || !!e.formData.cardExpiry)
1802
1852
  );
1803
- return a || !i || this.isSubmitting;
1853
+ return i || !a || this.isSubmitting;
1804
1854
  }
1805
1855
  showSpinner(e) {
1806
- this.hideSpinner(), this.spinner = new st({ text: e }), this.appendChild(this.spinner);
1856
+ this.hideSpinner(), this.spinner = new at({ text: e }), this.appendChild(this.spinner);
1807
1857
  }
1808
1858
  hideSpinner() {
1809
1859
  this.spinner && (this.spinner.getElement().remove(), this.spinner = void 0);
@@ -1884,7 +1934,8 @@ class xt {
1884
1934
  locale: this.options.locale,
1885
1935
  errorMsg: this.options.disableErrorMessages ? void 0 : e,
1886
1936
  profileId: this.options.profileId,
1887
- container: this.container
1937
+ container: this.container,
1938
+ environment: this.options.environment
1888
1939
  }));
1889
1940
  }
1890
1941
  unmount() {
@@ -1919,7 +1970,10 @@ class wt {
1919
1970
  formManager;
1920
1971
  stateManager;
1921
1972
  constructor(e) {
1922
- this.config = this.validateConfig(e), this.apiService = new D(this.config.apiKey), this.stateManager = new Ft({
1973
+ this.config = this.validateConfig(e), this.apiService = new V(
1974
+ this.config.apiKey,
1975
+ this.config.environment
1976
+ ), this.stateManager = new Ft({
1923
1977
  mounted: !1,
1924
1978
  form: null
1925
1979
  }), this.formManager = new xt(
@@ -1927,7 +1981,8 @@ class wt {
1927
1981
  locale: this.config.locale,
1928
1982
  apiKey: this.config.apiKey,
1929
1983
  profileId: this.config.profileId,
1930
- disableErrorMessages: this.config.disableErrorMessages
1984
+ disableErrorMessages: this.config.disableErrorMessages,
1985
+ environment: this.config.environment
1931
1986
  },
1932
1987
  this.handleSubmit.bind(this)
1933
1988
  );
@@ -1935,12 +1990,15 @@ class wt {
1935
1990
  validateConfig(e) {
1936
1991
  if (!e.apiKey)
1937
1992
  throw new Error("API key is required");
1993
+ if (!e.environment || !["test", "live"].includes(e.environment))
1994
+ throw new Error('Environment must be "test" or "live"');
1938
1995
  return {
1939
1996
  profileId: e.profileId,
1940
1997
  apiKey: e.apiKey,
1941
1998
  checkoutKey: e.checkoutKey,
1942
1999
  paymentId: e.paymentId,
1943
2000
  returnUrl: e.returnUrl,
2001
+ environment: e.environment,
1944
2002
  locale: e.locale || null,
1945
2003
  disableErrorMessages: e.disableErrorMessages ?? !1,
1946
2004
  manualActionHandling: e.manualActionHandling ?? !1,
@@ -1955,11 +2013,11 @@ class wt {
1955
2013
  const t = document.querySelector(e);
1956
2014
  if (!t)
1957
2015
  throw new Error(`Container ${e} not found`);
1958
- const a = document.createElement("div");
1959
- return t.appendChild(a), this.stateManager.updateState({
1960
- form: a,
2016
+ const i = document.createElement("div");
2017
+ return t.appendChild(i), this.stateManager.updateState({
2018
+ form: i,
1961
2019
  mounted: !0
1962
- }), this.formManager.mount(a), this;
2020
+ }), this.formManager.mount(i), this;
1963
2021
  }
1964
2022
  unmount() {
1965
2023
  const { mounted: e } = this.stateManager.getState();
@@ -1977,16 +2035,16 @@ class wt {
1977
2035
  formData: t
1978
2036
  }) {
1979
2037
  try {
1980
- const a = await this.apiService.authorizePayment({
2038
+ const i = await this.apiService.authorizePayment({
1981
2039
  checkoutKey: this.config.checkoutKey,
1982
2040
  formData: t || null,
1983
2041
  token: e?.token || null,
1984
2042
  paymentId: this.config.paymentId,
1985
2043
  returnUrl: this.config.returnUrl
1986
2044
  });
1987
- this.handlePaymentResponse(a);
1988
- } catch (a) {
1989
- this.handleAuthorizationError(a);
2045
+ this.handlePaymentResponse(i);
2046
+ } catch (i) {
2047
+ this.handleAuthorizationError(i);
1990
2048
  }
1991
2049
  }
1992
2050
  handlePaymentResponse(e) {
@@ -2006,11 +2064,11 @@ class wt {
2006
2064
  typeof globalThis < "u" && (globalThis.OdusCheckout = wt);
2007
2065
  export {
2008
2066
  wt as OdusCheckout,
2009
- se as deLocale,
2010
- ue as enLocale,
2011
- Se as esLocale,
2012
- ze as frLocale,
2013
- Oe as plLocale,
2014
- Ye as ptLocale
2067
+ ae as deLocale,
2068
+ me as enLocale,
2069
+ Ce as esLocale,
2070
+ Ie as frLocale,
2071
+ Be as plLocale,
2072
+ Ze as ptLocale
2015
2073
  };
2016
2074
  //# sourceMappingURL=index.mjs.map