@nice2dev/ui-money 1.2.1 → 1.2.2

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,9 +1,9 @@
1
1
  var tt = Object.defineProperty;
2
2
  var rt = (t, e, r) => e in t ? tt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var Z = (t, e, r) => rt(t, typeof e != "symbol" ? e + "" : e, r);
4
- import nt, { useState as z, useRef as at, useEffect as ct, useMemo as K, useCallback as Y, forwardRef as se, useId as _e } from "react";
5
- import { jsxs as b, jsx as c, Fragment as it } from "react/jsx-runtime";
6
- import { useNiceTranslation as pe, NiceIcon as Me, useControllableState as Pe, NiceTutorialButton as st, resolveTutorial as ot } from "@nice2dev/ui-core";
3
+ var G = (t, e, r) => rt(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import nt, { useState as H, useRef as at, useEffect as ct, useMemo as K, useCallback as j, forwardRef as se, useId as _e } from "react";
5
+ import { jsxs as _, jsx as c, Fragment as it } from "react/jsx-runtime";
6
+ import { useNiceTranslation as oe, NiceIcon as Pe, useControllableState as Me, NiceTutorialButton as st, resolveTutorial as ot } from "@nice2dev/ui-core";
7
7
  const fe = [
8
8
  // ── Majors ─────────────────────────────────────
9
9
  { code: "USD", numeric: 840, symbol: "$", name: "US Dollar", decimals: 2, symbolFirst: !0 },
@@ -227,7 +227,7 @@ const fe = [
227
227
  { code: "USDC", numeric: 0, symbol: "USDC", name: "USD Coin", decimals: 6 },
228
228
  { code: "USDT", numeric: 0, symbol: "USDT", name: "Tether", decimals: 6 }
229
229
  ], Le = new Map(fe.map((t) => [t.code, t]));
230
- function ne(t) {
230
+ function re(t) {
231
231
  return Le.get(t.toUpperCase());
232
232
  }
233
233
  function er(t) {
@@ -235,12 +235,12 @@ function er(t) {
235
235
  const e = fe.findIndex((r) => r.code === t.code);
236
236
  e >= 0 ? fe[e] = t : fe.push(t);
237
237
  }
238
- function ae(t, e) {
239
- const r = ne(e), n = (r == null ? void 0 : r.decimals) ?? 2, a = Math.pow(10, n);
238
+ function ce(t, e) {
239
+ const r = re(e), n = (r == null ? void 0 : r.decimals) ?? 2, a = Math.pow(10, n);
240
240
  return { amount: (t < 0 ? -1 : 1) * Math.round(Math.abs(t) * a), currency: e.toUpperCase() };
241
241
  }
242
242
  function He(t) {
243
- const e = ne(t.currency), r = (e == null ? void 0 : e.decimals) ?? 2;
243
+ const e = re(t.currency), r = (e == null ? void 0 : e.decimals) ?? 2;
244
244
  return t.amount / Math.pow(10, r);
245
245
  }
246
246
  function lt(t, e) {
@@ -256,7 +256,7 @@ function ye(t, e) {
256
256
  function dt(t, e) {
257
257
  return $e(t, e, "subtract"), { amount: t.amount - e.amount, currency: t.currency };
258
258
  }
259
- function Ie(t, e) {
259
+ function Se(t, e) {
260
260
  return {
261
261
  amount: (t.amount * e < 0 ? -1 : 1) * Math.round(Math.abs(t.amount * e)),
262
262
  currency: t.currency
@@ -275,7 +275,7 @@ function ar(t) {
275
275
  return { amount: -t.amount, currency: t.currency };
276
276
  }
277
277
  function ie(t, e = {}) {
278
- const r = ne(t.currency), n = e.decimals ?? (r == null ? void 0 : r.decimals) ?? 2, a = t.amount / Math.pow(10, n);
278
+ const r = re(t.currency), n = e.decimals ?? (r == null ? void 0 : r.decimals) ?? 2, a = t.amount / Math.pow(10, n);
279
279
  try {
280
280
  return new Intl.NumberFormat(e.locale, {
281
281
  style: "currency",
@@ -301,7 +301,7 @@ function ut(t, e) {
301
301
  let s, o = "";
302
302
  d === -1 ? s = r : (s = r.slice(0, d).replace(/[.,]/g, ""), o = r.slice(d + 1).replace(/[.,]/g, ""));
303
303
  const l = `${s}.${o || "0"}`, y = parseFloat(l);
304
- return Number.isFinite(y) ? ae(n ? -y : y, e) : null;
304
+ return Number.isFinite(y) ? ce(n ? -y : y, e) : null;
305
305
  }
306
306
  function ke(t) {
307
307
  const e = (t || "").replace(/\D/g, "");
@@ -367,7 +367,7 @@ function qe(t, e = {}) {
367
367
  }
368
368
  class ir {
369
369
  constructor(e) {
370
- Z(this, "id", "static");
370
+ G(this, "id", "static");
371
371
  this.rates = e;
372
372
  }
373
373
  async getRate(e, r) {
@@ -395,9 +395,9 @@ class ir {
395
395
  }
396
396
  class Ce {
397
397
  constructor(e = {}) {
398
- Z(this, "cache", /* @__PURE__ */ new Map());
399
- Z(this, "fetchImpl");
400
- Z(this, "ttl");
398
+ G(this, "cache", /* @__PURE__ */ new Map());
399
+ G(this, "fetchImpl");
400
+ G(this, "ttl");
401
401
  this.fetchImpl = e.fetchImpl ?? fetch, this.ttl = e.cacheTtl ?? 6e4;
402
402
  }
403
403
  cacheKey(e, r) {
@@ -417,7 +417,7 @@ class Ce {
417
417
  class pt extends Ce {
418
418
  constructor(r = {}) {
419
419
  super(r);
420
- Z(this, "id", "frankfurter");
420
+ G(this, "id", "frankfurter");
421
421
  }
422
422
  async getRate(r, n) {
423
423
  const a = r.toUpperCase(), i = n.toUpperCase();
@@ -432,14 +432,14 @@ class pt extends Ce {
432
432
  const l = await o.json(), y = l.rates[i];
433
433
  if (y == null)
434
434
  throw new Error(`Frankfurter: no rate for ${a}/${i}`);
435
- const v = { base: a, quote: i, rate: y, asOf: l.date };
436
- return this.setCached(v), v;
435
+ const N = { base: a, quote: i, rate: y, asOf: l.date };
436
+ return this.setCached(N), N;
437
437
  }
438
438
  }
439
439
  class yt extends Ce {
440
440
  constructor(r, n = {}) {
441
441
  super(n);
442
- Z(this, "id", "openexchangerates");
442
+ G(this, "id", "openexchangerates");
443
443
  this.appId = r;
444
444
  }
445
445
  async getRate(r, n) {
@@ -452,25 +452,25 @@ class yt extends Ce {
452
452
  const s = `https://openexchangerates.org/api/latest.json?app_id=${this.appId}`, o = await this.fetchImpl(s);
453
453
  if (!o.ok)
454
454
  throw new Error(`OpenExchangeRates HTTP ${o.status}`);
455
- const l = await o.json(), y = l.rates[a], v = l.rates[i];
456
- if (y == null || v == null)
455
+ const l = await o.json(), y = l.rates[a], N = l.rates[i];
456
+ if (y == null || N == null)
457
457
  throw new Error(`OpenExchangeRates: missing rate for ${a} or ${i}`);
458
- const f = {
458
+ const b = {
459
459
  base: a,
460
460
  quote: i,
461
- rate: v / y,
461
+ rate: N / y,
462
462
  asOf: new Date(l.timestamp * 1e3).toISOString()
463
463
  };
464
- return this.setCached(f), f;
464
+ return this.setCached(b), b;
465
465
  }
466
466
  }
467
467
  class ht extends Ce {
468
468
  constructor(r = {}) {
469
469
  super(r);
470
- Z(this, "id", "exchangerate.host");
470
+ G(this, "id", "exchangerate.host");
471
471
  }
472
472
  async getRate(r, n) {
473
- var f;
473
+ var b;
474
474
  const a = r.toUpperCase(), i = n.toUpperCase();
475
475
  if (a === i)
476
476
  return { base: a, quote: i, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
@@ -480,15 +480,15 @@ class ht extends Ce {
480
480
  const s = `https://api.exchangerate.host/convert?from=${a}&to=${i}`, o = await this.fetchImpl(s);
481
481
  if (!o.ok)
482
482
  throw new Error(`exchangerate.host HTTP ${o.status}`);
483
- const l = await o.json(), y = ((f = l.info) == null ? void 0 : f.rate) ?? l.result, v = { base: a, quote: i, rate: y, asOf: l.date };
484
- return this.setCached(v), v;
483
+ const l = await o.json(), y = ((b = l.info) == null ? void 0 : b.rate) ?? l.result, N = { base: a, quote: i, rate: y, asOf: l.date };
484
+ return this.setCached(N), N;
485
485
  }
486
486
  }
487
487
  class bt extends Ce {
488
488
  constructor(r = {}) {
489
489
  super(r);
490
- Z(this, "id", "nbp");
491
- Z(this, "table");
490
+ G(this, "id", "nbp");
491
+ G(this, "table");
492
492
  this.table = r.table ?? "A";
493
493
  }
494
494
  async getRate(r, n) {
@@ -498,15 +498,15 @@ class bt extends Ce {
498
498
  const d = this.getCached(a, i);
499
499
  if (d)
500
500
  return d;
501
- const s = async (v) => {
502
- var N;
503
- if (v === "PLN")
501
+ const s = async (N) => {
502
+ var w;
503
+ if (N === "PLN")
504
504
  return { rate: 1, date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) };
505
- const f = `https://api.nbp.pl/api/exchangerates/rates/${this.table}/${v}/?format=json`, u = await this.fetchImpl(f);
505
+ const b = `https://api.nbp.pl/api/exchangerates/rates/${this.table}/${N}/?format=json`, u = await this.fetchImpl(b);
506
506
  if (!u.ok)
507
507
  return null;
508
- const g = (N = (await u.json()).rates) == null ? void 0 : N[0];
509
- return g ? { rate: g.mid ?? g.ask ?? 0, date: g.effectiveDate } : null;
508
+ const h = (w = (await u.json()).rates) == null ? void 0 : w[0];
509
+ return h ? { rate: h.mid ?? h.ask ?? 0, date: h.effectiveDate } : null;
510
510
  }, o = await s(a), l = await s(i);
511
511
  if (!o || !l || o.rate === 0)
512
512
  throw new Error(`NBP: missing rate for ${a} or ${i}`);
@@ -522,13 +522,13 @@ class bt extends Ce {
522
522
  class ft extends pt {
523
523
  constructor() {
524
524
  super(...arguments);
525
- Z(this, "id", "ecb");
525
+ G(this, "id", "ecb");
526
526
  }
527
527
  }
528
528
  class _t extends ht {
529
529
  constructor() {
530
530
  super(...arguments);
531
- Z(this, "id", "free-forex");
531
+ G(this, "id", "free-forex");
532
532
  }
533
533
  }
534
534
  const sr = (t = {}) => new bt(t), or = (t = {}) => new ft(t), lr = (t) => new yt(t.apiKey, t), dr = (t = {}) => new _t(t);
@@ -536,7 +536,7 @@ async function gt(t, e, r) {
536
536
  const n = e.toUpperCase();
537
537
  if (t.currency.toUpperCase() === n)
538
538
  return t;
539
- const a = ne(t.currency), i = ne(n), d = (a == null ? void 0 : a.decimals) ?? 2, s = (i == null ? void 0 : i.decimals) ?? 2, { rate: o } = await r.getRate(t.currency, n), y = t.amount / Math.pow(10, d) * o;
539
+ const a = re(t.currency), i = re(n), d = (a == null ? void 0 : a.decimals) ?? 2, s = (i == null ? void 0 : i.decimals) ?? 2, { rate: o } = await r.getRate(t.currency, n), y = t.amount / Math.pow(10, d) * o;
540
540
  return {
541
541
  currency: n,
542
542
  amount: Math.round(y * Math.pow(10, s))
@@ -544,11 +544,11 @@ async function gt(t, e, r) {
544
544
  }
545
545
  class vt {
546
546
  constructor(e = {}) {
547
- Z(this, "id");
548
- Z(this, "name");
549
- Z(this, "supportedCurrencies");
550
- Z(this, "minimums");
551
- Z(this, "counter", 0);
547
+ G(this, "id");
548
+ G(this, "name");
549
+ G(this, "supportedCurrencies");
550
+ G(this, "minimums");
551
+ G(this, "counter", 0);
552
552
  this.id = e.id ?? "mock", this.name = e.name ?? "Mock Processor", this.supportedCurrencies = e.supportedCurrencies ?? "*";
553
553
  }
554
554
  newId(e) {
@@ -658,13 +658,13 @@ function Ct(t) {
658
658
  function Dt(t) {
659
659
  return V("mollie", "Mollie", "*", t);
660
660
  }
661
- function Mt(t) {
661
+ function Pt(t) {
662
662
  return V("braintree", "Braintree", "*", t);
663
663
  }
664
- function Pt(t) {
664
+ function Mt(t) {
665
665
  return V("razorpay", "Razorpay", ["INR", "USD", "EUR", "GBP", "AED"], t);
666
666
  }
667
- function It(t) {
667
+ function St(t) {
668
668
  return V(
669
669
  "payu",
670
670
  "PayU",
@@ -672,7 +672,7 @@ function It(t) {
672
672
  t
673
673
  );
674
674
  }
675
- function St(t) {
675
+ function It(t) {
676
676
  return V("przelewy24", "Przelewy24", ["PLN", "EUR"], t);
677
677
  }
678
678
  function $t(t = {}) {
@@ -701,25 +701,25 @@ function At(t) {
701
701
  t
702
702
  );
703
703
  }
704
- const Et = {
704
+ const Tt = {
705
705
  mock: () => new vt(),
706
706
  stripe: () => Nt(),
707
707
  paypal: () => wt(),
708
708
  adyen: () => kt(),
709
709
  square: () => Ct(),
710
710
  mollie: () => Dt(),
711
- braintree: () => Mt(),
712
- razorpay: () => Pt(),
713
- payu: () => It(),
714
- przelewy24: () => St(),
711
+ braintree: () => Pt(),
712
+ razorpay: () => Mt(),
713
+ payu: () => St(),
714
+ przelewy24: () => It(),
715
715
  tpay: () => $t(),
716
716
  autopay: () => xt(),
717
717
  blik: () => Rt(),
718
718
  klarna: () => Ut(),
719
719
  "coinbase-commerce": () => At()
720
720
  };
721
- function Tt(t) {
722
- const e = Et[t];
721
+ function Et(t) {
722
+ const e = Tt[t];
723
723
  return e ? e().supportedCurrencies : "*";
724
724
  }
725
725
  function Ft(t) {
@@ -940,12 +940,12 @@ const qt = [
940
940
  qt.map((t) => {
941
941
  const { currencyKey: e, ...r } = t, n = {
942
942
  ...r,
943
- supportedCurrencies: Tt(e ?? t.id),
943
+ supportedCurrencies: Et(e ?? t.id),
944
944
  webhookPath: Ft(t.id)
945
945
  };
946
946
  return [t.id, n];
947
947
  })
948
- ), Kt = /* @__PURE__ */ Object.values(
948
+ ), Ot = /* @__PURE__ */ Object.values(
949
949
  we
950
950
  );
951
951
  function ur(t) {
@@ -953,95 +953,95 @@ function ur(t) {
953
953
  }
954
954
  function mr(t, e) {
955
955
  const r = K(
956
- () => "amount" in t ? t : ae(
956
+ () => "amount" in t ? t : ce(
957
957
  t.major,
958
958
  t.currency
959
959
  ),
960
960
  // eslint-disable-next-line react-hooks/exhaustive-deps
961
961
  []
962
- ), [n, a] = z(r), i = Y(
963
- (f) => a((u) => ae(f, u.currency)),
962
+ ), [n, a] = H(r), i = j(
963
+ (b) => a((u) => ce(b, u.currency)),
964
964
  []
965
- ), d = Y((f) => {
966
- a((u) => ({ ...u, currency: f.toUpperCase() }));
967
- }, []), s = Y((f) => a((u) => ye(u, f)), []), o = Y(
968
- (f) => a((u) => dt(u, f)),
965
+ ), d = j((b) => {
966
+ a((u) => ({ ...u, currency: b.toUpperCase() }));
967
+ }, []), s = j((b) => a((u) => ye(u, b)), []), o = j(
968
+ (b) => a((u) => dt(u, b)),
969
969
  []
970
- ), l = Y(
971
- (f) => a((u) => Ie(u, f)),
970
+ ), l = j(
971
+ (b) => a((u) => Se(u, b)),
972
972
  []
973
- ), y = K(() => ie(n, { locale: e }), [n, e]), v = K(() => He(n), [n]);
974
- return { money: n, setMoney: a, setMajor: i, setCurrency: d, add: s, subtract: o, scale: l, formatted: y, major: v };
973
+ ), y = K(() => ie(n, { locale: e }), [n, e]), N = K(() => He(n), [n]);
974
+ return { money: n, setMoney: a, setMajor: i, setCurrency: d, add: s, subtract: o, scale: l, formatted: y, major: N };
975
975
  }
976
- function Se(t, e, r) {
977
- const [n, a] = z(null), [i, d] = z(null), [s, o] = z(!1), l = at(0);
976
+ function Ie(t, e, r) {
977
+ const [n, a] = H(null), [i, d] = H(null), [s, o] = H(!1), l = at(0), y = t == null ? void 0 : t.amount, N = t == null ? void 0 : t.currency;
978
978
  return ct(() => {
979
- if (!t) {
979
+ if (y === void 0 || N === void 0) {
980
980
  a(null);
981
981
  return;
982
982
  }
983
- const y = ++l.current;
984
- o(!0), d(null), gt(t, e, r).then((v) => {
985
- l.current === y && a(v);
986
- }).catch((v) => {
987
- l.current === y && (d(v instanceof Error ? v : new Error(String(v))), a(null));
983
+ const b = ++l.current;
984
+ o(!0), d(null), gt({ amount: y, currency: N }, e, r).then((u) => {
985
+ l.current === b && a(u);
986
+ }).catch((u) => {
987
+ l.current === b && (d(u instanceof Error ? u : new Error(String(u))), a(null));
988
988
  }).finally(() => {
989
- l.current === y && o(!1);
989
+ l.current === b && o(!1);
990
990
  });
991
- }, [t == null ? void 0 : t.amount, t == null ? void 0 : t.currency, e, r]), { converted: n, loading: s, error: i };
991
+ }, [y, N, e, r]), { converted: n, loading: s, error: i };
992
992
  }
993
- function Ot(t) {
994
- const [e, r] = z("idle"), [n, a] = z(null), [i, d] = z(null), s = Y(() => {
993
+ function Kt(t) {
994
+ const [e, r] = H("idle"), [n, a] = H(null), [i, d] = H(null), s = j(() => {
995
995
  r("idle"), a(null), d(null);
996
- }, []), o = Y(
997
- async (f) => {
996
+ }, []), o = j(
997
+ async (b) => {
998
998
  r("authorizing"), d(null);
999
999
  try {
1000
- const u = await t.authorize(f);
1000
+ const u = await t.authorize(b);
1001
1001
  return a(u), r(u.status), u;
1002
1002
  } catch (u) {
1003
- const m = u instanceof Error ? u : new Error(String(u));
1004
- throw d(m), r("failed"), m;
1003
+ const f = u instanceof Error ? u : new Error(String(u));
1004
+ throw d(f), r("failed"), f;
1005
1005
  }
1006
1006
  },
1007
1007
  [t]
1008
- ), l = Y(
1009
- async (f, u) => {
1010
- const m = f ?? (n == null ? void 0 : n.id);
1011
- if (!m)
1008
+ ), l = j(
1009
+ async (b, u) => {
1010
+ const f = b ?? (n == null ? void 0 : n.id);
1011
+ if (!f)
1012
1012
  throw new Error("No authorization id to capture");
1013
1013
  r("capturing");
1014
1014
  try {
1015
- const g = await t.capture(m, u);
1016
- return a(g), r(g.status), g;
1017
- } catch (g) {
1018
- const N = g instanceof Error ? g : new Error(String(g));
1019
- throw d(N), r("failed"), N;
1015
+ const h = await t.capture(f, u);
1016
+ return a(h), r(h.status), h;
1017
+ } catch (h) {
1018
+ const w = h instanceof Error ? h : new Error(String(h));
1019
+ throw d(w), r("failed"), w;
1020
1020
  }
1021
1021
  },
1022
1022
  [t, n == null ? void 0 : n.id]
1023
- ), y = Y(
1024
- async (f) => {
1025
- const u = f ?? (n == null ? void 0 : n.id);
1023
+ ), y = j(
1024
+ async (b) => {
1025
+ const u = b ?? (n == null ? void 0 : n.id);
1026
1026
  if (!u)
1027
1027
  throw new Error("No payment id to cancel");
1028
- const m = await t.cancel(u);
1029
- return a(m), r(m.status), m;
1028
+ const f = await t.cancel(u);
1029
+ return a(f), r(f.status), f;
1030
1030
  },
1031
1031
  [t, n == null ? void 0 : n.id]
1032
- ), v = Y(
1033
- async (f, u) => {
1034
- const m = f ?? (n == null ? void 0 : n.id);
1035
- if (!m)
1032
+ ), N = j(
1033
+ async (b, u) => {
1034
+ const f = b ?? (n == null ? void 0 : n.id);
1035
+ if (!f)
1036
1036
  throw new Error("No payment id to refund");
1037
- const g = await t.refund(m, u);
1038
- return a(g), r(g.status), g;
1037
+ const h = await t.refund(f, u);
1038
+ return a(h), r(h.status), h;
1039
1039
  },
1040
1040
  [t, n == null ? void 0 : n.id]
1041
1041
  );
1042
- return { status: e, response: n, error: i, authorize: o, capture: l, cancel: y, refund: v, reset: s };
1042
+ return { status: e, response: n, error: i, authorize: o, capture: l, cancel: y, refund: N, reset: s };
1043
1043
  }
1044
- const Ke = /* @__PURE__ */ se(
1044
+ const Oe = /* @__PURE__ */ se(
1045
1045
  function({
1046
1046
  value: e,
1047
1047
  amount: r,
@@ -1053,34 +1053,44 @@ const Ke = /* @__PURE__ */ se(
1053
1053
  convertTo: o,
1054
1054
  exchangeProvider: l,
1055
1055
  className: y,
1056
- style: v,
1057
- "aria-label": f
1056
+ style: N,
1057
+ "aria-label": b
1058
1058
  }, u) {
1059
- const m = K(() => {
1059
+ const { t: f } = oe(), h = K(() => {
1060
1060
  if (e)
1061
1061
  return e;
1062
1062
  if (r != null && n) {
1063
- const _ = ne(n), w = (_ == null ? void 0 : _.decimals) ?? 2;
1063
+ const v = re(n), S = (v == null ? void 0 : v.decimals) ?? 2;
1064
1064
  return {
1065
- amount: Math.round(r * Math.pow(10, w)),
1065
+ amount: Math.round(r * Math.pow(10, S)),
1066
1066
  currency: n.toUpperCase()
1067
1067
  };
1068
1068
  }
1069
1069
  return null;
1070
- }, [e, r, n]), g = K(() => m ? m.amount === 0 && s != null ? s : ie(m, { locale: a, currencyDisplay: i }) : "", [m, a, i, s]), { converted: N } = Se(
1071
- o && l ? m : null,
1070
+ }, [e, r, n]), w = K(() => h ? h.amount === 0 && s != null ? s : ie(h, { locale: a, currencyDisplay: i }) : "", [h, a, i, s]), { converted: x } = Ie(
1071
+ o && l ? h : null,
1072
1072
  o ?? "",
1073
1073
  l
1074
1074
  );
1075
- if (!m)
1075
+ if (!h)
1076
1076
  return null;
1077
- const p = m.amount < 0, D = "nice-money" + (d && p ? " nice-money--negative" : "") + (y ? ` ${y}` : "");
1078
- return /* @__PURE__ */ b("span", { ref: u, className: D, style: v, "aria-label": f, children: [
1079
- /* @__PURE__ */ c("span", { className: "nice-money__value", children: g }),
1080
- N && /* @__PURE__ */ b("span", { className: "nice-money__converted", "aria-label": `Converted to ${N.currency}`, children: [
1081
- " ≈ ",
1082
- ie(N, { locale: a })
1083
- ] })
1077
+ const m = h.amount < 0, g = "nice-money" + (d && m ? " nice-money--negative" : "") + (y ? ` ${y}` : "");
1078
+ return /* @__PURE__ */ _("span", { ref: u, className: g, style: N, "aria-label": b, children: [
1079
+ /* @__PURE__ */ c("span", { className: "nice-money__value", children: w }),
1080
+ x && /* @__PURE__ */ _(
1081
+ "span",
1082
+ {
1083
+ className: "nice-money__converted",
1084
+ "aria-label": f("money.convertedTo", "Converted to {currency}").replace(
1085
+ "{currency}",
1086
+ String(x.currency)
1087
+ ),
1088
+ children: [
1089
+ " ≈ ",
1090
+ ie(x, { locale: a })
1091
+ ]
1092
+ }
1093
+ )
1084
1094
  ] });
1085
1095
  }
1086
1096
  ), pr = fe.map((t) => t.code).sort(), Ge = /* @__PURE__ */ se(function({
@@ -1094,93 +1104,93 @@ const Ke = /* @__PURE__ */ se(
1094
1104
  compact: o = !1,
1095
1105
  disabled: l,
1096
1106
  readOnly: y,
1097
- loading: v,
1098
- accessMode: f,
1107
+ loading: N,
1108
+ accessMode: b,
1099
1109
  label: u,
1100
- helperText: m,
1101
- error: g,
1102
- required: N,
1103
- size: p = "md",
1104
- labelPlacement: D = "top",
1105
- labelWidth: _,
1106
- controlWidth: w,
1107
- className: U,
1108
- style: G,
1109
- id: M,
1110
- name: S,
1111
- title: $,
1112
- "data-testid": A,
1110
+ helperText: f,
1111
+ error: h,
1112
+ required: w,
1113
+ size: x = "md",
1114
+ labelPlacement: m = "top",
1115
+ labelWidth: g,
1116
+ controlWidth: v,
1117
+ className: S,
1118
+ style: A,
1119
+ id: P,
1120
+ name: M,
1121
+ title: q,
1122
+ "data-testid": I,
1113
1123
  "aria-label": W,
1114
- placeholder: O
1115
- }, k) {
1116
- const { t: B } = pe(), F = f === "hidden", Q = l || f === "disabled" || v, ce = y || f === "readOnly", H = _e(), te = M ?? `nice-cs-${H}`, [J, T] = z(""), E = i ?? n.length > 8, P = K(() => {
1117
- if (!J.trim())
1124
+ placeholder: B
1125
+ }, D) {
1126
+ const { t: T } = oe(), O = b === "hidden", X = l || b === "disabled" || N, ne = y || b === "readOnly", Y = _e(), Z = P ?? `nice-cs-${Y}`, [Q, ae] = H(""), E = i ?? n.length > 8, k = K(() => {
1127
+ if (!Q.trim())
1118
1128
  return n;
1119
- const I = J.trim().toLowerCase();
1129
+ const $ = Q.trim().toLowerCase();
1120
1130
  return n.filter(
1121
- (x) => x.code.toLowerCase().includes(I) || x.name.toLowerCase().includes(I) || x.symbol.toLowerCase().includes(I)
1131
+ (R) => R.code.toLowerCase().includes($) || R.name.toLowerCase().includes($) || R.symbol.toLowerCase().includes($)
1122
1132
  );
1123
- }, [n, J]), h = K(() => {
1124
- const I = /* @__PURE__ */ new Set();
1125
- return a.map((x) => ne(x)).filter((x) => !!x && !I.has(x.code) && !!I.add(x.code));
1126
- }, [a]), q = Y(
1127
- (I) => {
1128
- const x = I.target.value, le = ne(x);
1129
- le && (r == null || r(x, le));
1133
+ }, [n, Q]), p = K(() => {
1134
+ const $ = /* @__PURE__ */ new Set();
1135
+ return a.map((R) => re(R)).filter((R) => !!R && !$.has(R.code) && !!$.add(R.code));
1136
+ }, [a]), F = j(
1137
+ ($) => {
1138
+ const R = $.target.value, de = re(R);
1139
+ de && (r == null || r(R, de));
1130
1140
  },
1131
1141
  [r]
1132
- ), j = (I) => {
1142
+ ), z = ($) => {
1133
1143
  if (o)
1134
- return `${s ? I.symbol + " " : ""}${I.code}`;
1135
- const x = [];
1136
- return s && x.push(I.symbol), d && x.push(I.code), x.push("—", I.name), x.join(" ");
1137
- }, C = `nice-currency-selector nice-currency-selector--${p} nice-currency-selector--label-${D}` + (o ? " nice-currency-selector--compact" : "") + (g ? " nice-currency-selector--error" : "") + (Q ? " nice-currency-selector--disabled" : "") + (U ? ` ${U}` : ""), L = D === "left" && _ != null ? { width: typeof _ == "number" ? `${_}px` : _, flex: "none" } : void 0, oe = w != null ? {
1138
- width: typeof w == "number" ? `${w}px` : w,
1144
+ return `${s ? $.symbol + " " : ""}${$.code}`;
1145
+ const R = [];
1146
+ return s && R.push($.symbol), d && R.push($.code), R.push("—", $.name), R.join(" ");
1147
+ }, C = `nice-currency-selector nice-currency-selector--${x} nice-currency-selector--label-${m}` + (o ? " nice-currency-selector--compact" : "") + (h ? " nice-currency-selector--error" : "") + (X ? " nice-currency-selector--disabled" : "") + (S ? ` ${S}` : ""), L = m === "left" && g != null ? { width: typeof g == "number" ? `${g}px` : g, flex: "none" } : void 0, le = v != null ? {
1148
+ width: typeof v == "number" ? `${v}px` : v,
1139
1149
  flex: "none"
1140
1150
  } : void 0;
1141
- return F ? null : /* @__PURE__ */ b("div", { ref: k, className: C, style: G, title: $, "data-testid": A, children: [
1142
- u && /* @__PURE__ */ b("label", { htmlFor: te, className: "nice-currency-selector__label", style: L, children: [
1151
+ return O ? null : /* @__PURE__ */ _("div", { ref: D, className: C, style: A, title: q, "data-testid": I, children: [
1152
+ u && /* @__PURE__ */ _("label", { htmlFor: Z, className: "nice-currency-selector__label", style: L, children: [
1143
1153
  u,
1144
- N && /* @__PURE__ */ c("span", { className: "nice-currency-selector__required", "aria-hidden": !0, children: "*" })
1154
+ w && /* @__PURE__ */ c("span", { className: "nice-currency-selector__required", "aria-hidden": !0, children: "*" })
1145
1155
  ] }),
1146
- /* @__PURE__ */ b("div", { className: "nice-currency-selector__inner", style: oe, children: [
1156
+ /* @__PURE__ */ _("div", { className: "nice-currency-selector__inner", style: le, children: [
1147
1157
  E && /* @__PURE__ */ c(
1148
1158
  "input",
1149
1159
  {
1150
1160
  type: "search",
1151
1161
  className: "nice-currency-selector__search",
1152
- placeholder: B("currencySelector.searchCurrency", "Search currency…"),
1153
- value: J,
1154
- onChange: (I) => T(I.target.value),
1155
- disabled: Q || ce,
1156
- "aria-label": B("currencySelector.searchCurrency2", "Search currency")
1162
+ placeholder: T("currencySelector.searchCurrency", "Search currency…"),
1163
+ value: Q,
1164
+ onChange: ($) => ae($.target.value),
1165
+ disabled: X || ne,
1166
+ "aria-label": T("currencySelector.searchCurrency2", "Search currency")
1157
1167
  }
1158
1168
  ),
1159
- /* @__PURE__ */ b(
1169
+ /* @__PURE__ */ _(
1160
1170
  "select",
1161
1171
  {
1162
- id: te,
1163
- name: S,
1172
+ id: Z,
1173
+ name: M,
1164
1174
  className: "nice-currency-selector__select",
1165
1175
  value: e ?? "",
1166
- onChange: q,
1167
- disabled: Q || ce,
1168
- required: N,
1169
- "aria-invalid": !!g,
1170
- "aria-label": W ?? (typeof u == "string" ? u : "Currency"),
1176
+ onChange: F,
1177
+ disabled: X || ne,
1178
+ required: w,
1179
+ "aria-invalid": !!h,
1180
+ "aria-label": W ?? (typeof u == "string" ? u : T("currencySelector.currency", "Currency")),
1171
1181
  children: [
1172
- !e && /* @__PURE__ */ c("option", { value: "", children: O ?? "Select currency…" }),
1173
- h.length > 0 && /* @__PURE__ */ c("optgroup", { label: B("currencySelector.recent", "Recent"), children: h.map((I) => /* @__PURE__ */ c("option", { value: I.code, children: j(I) }, `r-${I.code}`)) }),
1174
- /* @__PURE__ */ c("optgroup", { label: h.length > 0 ? "All" : "", children: P.map((I) => /* @__PURE__ */ c("option", { value: I.code, children: j(I) }, I.code)) })
1182
+ !e && /* @__PURE__ */ c("option", { value: "", children: B ?? T("currencySelector.selectCurrency", "Select currency…") }),
1183
+ p.length > 0 && /* @__PURE__ */ c("optgroup", { label: T("currencySelector.recent", "Recent"), children: p.map(($) => /* @__PURE__ */ c("option", { value: $.code, children: z($) }, `r-${$.code}`)) }),
1184
+ /* @__PURE__ */ c("optgroup", { label: p.length > 0 ? T("currencySelector.all", "All") : "", children: k.map(($) => /* @__PURE__ */ c("option", { value: $.code, children: z($) }, $.code)) })
1175
1185
  ]
1176
1186
  }
1177
1187
  )
1178
1188
  ] }),
1179
- (g || m) && /* @__PURE__ */ c(
1189
+ (h || f) && /* @__PURE__ */ c(
1180
1190
  "span",
1181
1191
  {
1182
- className: g ? "nice-currency-selector__error" : "nice-currency-selector__helper",
1183
- children: g ?? m
1192
+ className: h ? "nice-currency-selector__error" : "nice-currency-selector__helper",
1193
+ children: h ?? f
1184
1194
  }
1185
1195
  )
1186
1196
  ] });
@@ -1196,39 +1206,39 @@ const Ke = /* @__PURE__ */ se(
1196
1206
  max: o,
1197
1207
  step: l,
1198
1208
  locale: y,
1199
- placeholder: v,
1200
- label: f,
1209
+ placeholder: N,
1210
+ label: b,
1201
1211
  helperText: u,
1202
- error: m,
1203
- size: g = "md",
1204
- disabled: N,
1205
- readOnly: p,
1206
- required: D,
1207
- loading: _,
1208
- accessMode: w,
1209
- labelPlacement: U = "top",
1210
- errorPlacement: G = "bottom",
1211
- labelWidth: M,
1212
- controlWidth: S,
1213
- submitOnEnter: $,
1214
- onSubmit: A,
1212
+ error: f,
1213
+ size: h = "md",
1214
+ disabled: w,
1215
+ readOnly: x,
1216
+ required: m,
1217
+ loading: g,
1218
+ accessMode: v,
1219
+ labelPlacement: S = "top",
1220
+ errorPlacement: A = "bottom",
1221
+ labelWidth: P,
1222
+ controlWidth: M,
1223
+ submitOnEnter: q,
1224
+ onSubmit: I,
1215
1225
  showFormattedPreview: W = !0,
1216
- showSteppers: O = !1,
1217
- className: k,
1218
- style: B,
1219
- id: F,
1220
- name: Q,
1221
- title: ce,
1222
- "data-testid": H,
1223
- onBlur: te,
1224
- onFocus: J,
1225
- liveGrouping: T,
1226
+ showSteppers: B = !1,
1227
+ className: D,
1228
+ style: T,
1229
+ id: O,
1230
+ name: X,
1231
+ title: ne,
1232
+ "data-testid": Y,
1233
+ onBlur: Z,
1234
+ onFocus: Q,
1235
+ liveGrouping: ae,
1226
1236
  multiplierShortcuts: E = !0,
1227
- onValidationError: P
1228
- }, h) {
1229
- const { t: q } = pe(), j = N || w === "disabled" || _, C = p || w === "readOnly", L = w === "hidden", oe = _e(), I = F ?? `nice-money-${oe}`, x = ((e == null ? void 0 : e.currency) ?? n ?? "USD").toUpperCase(), le = ne(x), ee = (le == null ? void 0 : le.decimals) ?? 2, xe = l ?? 1 / Math.pow(10, ee), [De, ge] = z(
1237
+ onValidationError: k
1238
+ }, p) {
1239
+ const { t: F } = oe(), z = w || v === "disabled" || g, C = x || v === "readOnly", L = v === "hidden", le = _e(), $ = O ?? `nice-money-${le}`, R = ((e == null ? void 0 : e.currency) ?? n ?? "USD").toUpperCase(), de = re(R), ee = (de == null ? void 0 : de.decimals) ?? 2, xe = l ?? 1 / Math.pow(10, ee), [De, ge] = H(
1230
1240
  () => e ? (e.amount / Math.pow(10, ee)).toFixed(ee) : ""
1231
- ), [ve, Re] = z(!1);
1241
+ ), [ve, Re] = H(!1);
1232
1242
  nt.useEffect(() => {
1233
1243
  if (ve)
1234
1244
  return;
@@ -1236,108 +1246,108 @@ const Ke = /* @__PURE__ */ se(
1236
1246
  ge("");
1237
1247
  return;
1238
1248
  }
1239
- const R = ne(e.currency), X = (R == null ? void 0 : R.decimals) ?? 2;
1240
- ge((e.amount / Math.pow(10, X)).toFixed(X));
1249
+ const U = re(e.currency), J = (U == null ? void 0 : U.decimals) ?? 2;
1250
+ ge((e.amount / Math.pow(10, J)).toFixed(J));
1241
1251
  }, [e, ve]);
1242
- const Ue = Y(
1243
- (R) => {
1244
- let X = R;
1252
+ const Ue = j(
1253
+ (U) => {
1254
+ let J = U;
1245
1255
  if (E) {
1246
- const ue = R.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);
1247
- if (ue) {
1248
- const me = ue[2].toLowerCase() === "k" ? 1e3 : ue[2].toLowerCase() === "m" ? 1e6 : 1e9, Fe = Number(ue[1].replace(",", ".")) * me;
1256
+ const me = U.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);
1257
+ if (me) {
1258
+ const pe = me[2].toLowerCase() === "k" ? 1e3 : me[2].toLowerCase() === "m" ? 1e6 : 1e9, Fe = Number(me[1].replace(",", ".")) * pe;
1249
1259
  if (!Number.isFinite(Fe)) {
1250
- P == null || P(new Error("overflow"));
1260
+ k == null || k(new Error("overflow"));
1251
1261
  return;
1252
1262
  }
1253
- X = String(Fe);
1263
+ J = String(Fe);
1254
1264
  }
1255
1265
  }
1256
- const re = ut(X, x);
1257
- if (!re) {
1266
+ const te = ut(J, R);
1267
+ if (!te) {
1258
1268
  r == null || r(null);
1259
1269
  return;
1260
1270
  }
1261
- if (!Number.isSafeInteger(re.amount)) {
1262
- P == null || P(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));
1271
+ if (!Number.isSafeInteger(te.amount)) {
1272
+ k == null || k(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));
1263
1273
  return;
1264
1274
  }
1265
- const de = re.amount / Math.pow(10, ee);
1266
- if (s != null && de < s) {
1267
- P == null || P(new Error(`min: ${s}`)), r == null || r(ae(s, x));
1275
+ const ue = te.amount / Math.pow(10, ee);
1276
+ if (s != null && ue < s) {
1277
+ k == null || k(new Error(`min: ${s}`)), r == null || r(ce(s, R));
1268
1278
  return;
1269
1279
  }
1270
- if (o != null && de > o) {
1271
- P == null || P(new Error(`max: ${o}`)), r == null || r(ae(o, x));
1280
+ if (o != null && ue > o) {
1281
+ k == null || k(new Error(`max: ${o}`)), r == null || r(ce(o, R));
1272
1282
  return;
1273
1283
  }
1274
- r == null || r(re);
1284
+ r == null || r(te);
1275
1285
  },
1276
- [x, ee, s, o, r, E, P]
1277
- ), Je = Y(
1278
- (R) => {
1279
- const X = R.target.value;
1280
- ge(X), Ue(X);
1286
+ [R, ee, s, o, r, E, k]
1287
+ ), Je = j(
1288
+ (U) => {
1289
+ const J = U.target.value;
1290
+ ge(J), Ue(J);
1281
1291
  },
1282
1292
  [Ue]
1283
- ), Ae = Y(
1284
- (R) => {
1285
- const re = (e ? e.amount / Math.pow(10, ee) : 0) + R, de = Math.min(o ?? 1 / 0, Math.max(s ?? -1 / 0, re));
1286
- r == null || r(ae(de, x));
1293
+ ), Ae = j(
1294
+ (U) => {
1295
+ const te = (e ? e.amount / Math.pow(10, ee) : 0) + U, ue = Math.min(o ?? 1 / 0, Math.max(s ?? -1 / 0, te));
1296
+ r == null || r(ce(ue, R));
1287
1297
  },
1288
- [e, ee, s, o, x, r]
1298
+ [e, ee, s, o, R, r]
1289
1299
  ), Ne = K(() => {
1290
- var R, X;
1300
+ var U, J;
1291
1301
  try {
1292
- const re = new Intl.NumberFormat(y).formatToParts(12345.6), de = ((R = re.find((me) => me.type === "group")) == null ? void 0 : R.value) ?? ",", ue = ((X = re.find((me) => me.type === "decimal")) == null ? void 0 : X.value) ?? ".";
1293
- return { group: de, decimal: ue };
1302
+ const te = new Intl.NumberFormat(y).formatToParts(12345.6), ue = ((U = te.find((pe) => pe.type === "group")) == null ? void 0 : U.value) ?? ",", me = ((J = te.find((pe) => pe.type === "decimal")) == null ? void 0 : J.value) ?? ".";
1303
+ return { group: ue, decimal: me };
1294
1304
  } catch {
1295
1305
  return { group: ",", decimal: "." };
1296
1306
  }
1297
- }, [y]), Ee = T ?? !!Ne.group, Xe = K(() => {
1298
- if (!Ee || ve === !1)
1307
+ }, [y]), Te = ae ?? !!Ne.group, Xe = K(() => {
1308
+ if (!Te || ve === !1)
1299
1309
  return De;
1300
- const R = Ne.decimal, X = Ne.group, re = De.replace(
1301
- new RegExp(`[${X.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`, "g"),
1310
+ const U = Ne.decimal, J = Ne.group, te = De.replace(
1311
+ new RegExp(`[${J.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`, "g"),
1302
1312
  ""
1303
- ), [de, ue] = re.split(R);
1304
- if (!de)
1305
- return re;
1306
- const me = de.replace(/\B(?=(\d{3})+(?!\d))/g, X);
1307
- return ue != null ? `${me}${R}${ue}` : me;
1308
- }, [De, ve, Ee, Ne]), Te = K(() => e ? ie(e, { locale: y }) : "", [e, y]), he = typeof m == "string" ? m : void 0, Qe = `nice-money-input nice-money-input--${g} nice-money-input--label-${U} nice-money-input--error-${G}` + (he ? " nice-money-input--error" : "") + (j ? " nice-money-input--disabled" : "") + (_ ? " nice-money-input--loading" : "") + (k ? ` ${k}` : ""), Ve = (R) => {
1309
- $ && R.key === "Enter" && A && (R.preventDefault(), A());
1310
- }, We = U === "left" && M != null ? { width: typeof M == "number" ? `${M}px` : M, flex: "none" } : void 0, et = S != null ? {
1311
- width: typeof S == "number" ? `${S}px` : S,
1313
+ ), [ue, me] = te.split(U);
1314
+ if (!ue)
1315
+ return te;
1316
+ const pe = ue.replace(/\B(?=(\d{3})+(?!\d))/g, J);
1317
+ return me != null ? `${pe}${U}${me}` : pe;
1318
+ }, [De, ve, Te, Ne]), Ee = K(() => e ? ie(e, { locale: y }) : "", [e, y]), he = typeof f == "string" ? f : void 0, Qe = `nice-money-input nice-money-input--${h} nice-money-input--label-${S} nice-money-input--error-${A}` + (he ? " nice-money-input--error" : "") + (z ? " nice-money-input--disabled" : "") + (g ? " nice-money-input--loading" : "") + (D ? ` ${D}` : ""), Ve = (U) => {
1319
+ q && U.key === "Enter" && I && (U.preventDefault(), I());
1320
+ }, We = S === "left" && P != null ? { width: typeof P == "number" ? `${P}px` : P, flex: "none" } : void 0, et = M != null ? {
1321
+ width: typeof M == "number" ? `${M}px` : M,
1312
1322
  flex: "none"
1313
1323
  } : void 0;
1314
- return L ? null : /* @__PURE__ */ b("div", { ref: h, className: Qe, style: B, title: ce, "data-testid": H, children: [
1315
- f && /* @__PURE__ */ b("label", { htmlFor: I, className: "nice-money-input__label", style: We, children: [
1316
- f,
1317
- D && /* @__PURE__ */ c("span", { className: "nice-money-input__required", "aria-hidden": !0, children: "*" })
1324
+ return L ? null : /* @__PURE__ */ _("div", { ref: p, className: Qe, style: T, title: ne, "data-testid": Y, children: [
1325
+ b && /* @__PURE__ */ _("label", { htmlFor: $, className: "nice-money-input__label", style: We, children: [
1326
+ b,
1327
+ m && /* @__PURE__ */ c("span", { className: "nice-money-input__required", "aria-hidden": !0, children: "*" })
1318
1328
  ] }),
1319
- /* @__PURE__ */ b("div", { className: "nice-money-input__row", style: et, children: [
1329
+ /* @__PURE__ */ _("div", { className: "nice-money-input__row", style: et, children: [
1320
1330
  !d && /* @__PURE__ */ c(
1321
1331
  Ge,
1322
1332
  {
1323
- value: x,
1333
+ value: R,
1324
1334
  compact: !0,
1325
- options: i ? i.map(ne).filter((R) => !!R) : void 0,
1326
- onChange: (R) => a == null ? void 0 : a(R),
1327
- disabled: j || C,
1335
+ options: i ? i.map(re).filter((U) => !!U) : void 0,
1336
+ onChange: (U) => a == null ? void 0 : a(U),
1337
+ disabled: z || C,
1328
1338
  className: "nice-money-input__currency",
1329
- "aria-label": q("moneyInput.currency", "Currency")
1339
+ "aria-label": F("moneyInput.currency", "Currency")
1330
1340
  }
1331
1341
  ),
1332
- d && /* @__PURE__ */ c("span", { className: "nice-money-input__symbol", "aria-hidden": !0, children: (le == null ? void 0 : le.symbol) ?? x }),
1333
- O && /* @__PURE__ */ c(
1342
+ d && /* @__PURE__ */ c("span", { className: "nice-money-input__symbol", "aria-hidden": !0, children: (de == null ? void 0 : de.symbol) ?? R }),
1343
+ B && /* @__PURE__ */ c(
1334
1344
  "button",
1335
1345
  {
1336
1346
  type: "button",
1337
1347
  className: "nice-money-input__step nice-money-input__step--down",
1338
1348
  onClick: () => Ae(-xe),
1339
- disabled: j || C || s != null && e != null && e.amount / Math.pow(10, ee) <= s,
1340
- "aria-label": q("moneyInput.decreaseAmount", "Decrease amount"),
1349
+ disabled: z || C || s != null && e != null && e.amount / Math.pow(10, ee) <= s,
1350
+ "aria-label": F("moneyInput.decreaseAmount", "Decrease amount"),
1341
1351
  tabIndex: -1,
1342
1352
  children: "−"
1343
1353
  }
@@ -1345,8 +1355,8 @@ const Ke = /* @__PURE__ */ se(
1345
1355
  /* @__PURE__ */ c(
1346
1356
  "input",
1347
1357
  {
1348
- id: I,
1349
- name: Q,
1358
+ id: $,
1359
+ name: X,
1350
1360
  type: "text",
1351
1361
  inputMode: "decimal",
1352
1362
  autoComplete: "transaction-amount",
@@ -1354,39 +1364,39 @@ const Ke = /* @__PURE__ */ se(
1354
1364
  value: Xe,
1355
1365
  onChange: Je,
1356
1366
  onKeyDown: Ve,
1357
- onFocus: (R) => {
1358
- Re(!0), J == null || J(R);
1367
+ onFocus: (U) => {
1368
+ Re(!0), Q == null || Q(U);
1359
1369
  },
1360
- onBlur: (R) => {
1361
- Re(!1), e && ge((e.amount / Math.pow(10, ee)).toFixed(ee)), te == null || te(R);
1370
+ onBlur: (U) => {
1371
+ Re(!1), e && ge((e.amount / Math.pow(10, ee)).toFixed(ee)), Z == null || Z(U);
1362
1372
  },
1363
- placeholder: v ?? `0${ee > 0 ? "." + "0".repeat(ee) : ""}`,
1364
- disabled: j,
1373
+ placeholder: N ?? `0${ee > 0 ? "." + "0".repeat(ee) : ""}`,
1374
+ disabled: z,
1365
1375
  readOnly: C,
1366
- required: D,
1376
+ required: m,
1367
1377
  "aria-invalid": !!he,
1368
- "aria-describedby": he || u ? `${I}-help` : void 0
1378
+ "aria-describedby": he || u ? `${$}-help` : void 0
1369
1379
  }
1370
1380
  ),
1371
- O && /* @__PURE__ */ c(
1381
+ B && /* @__PURE__ */ c(
1372
1382
  "button",
1373
1383
  {
1374
1384
  type: "button",
1375
1385
  className: "nice-money-input__step nice-money-input__step--up",
1376
1386
  onClick: () => Ae(xe),
1377
- disabled: j || C || o != null && e != null && e.amount / Math.pow(10, ee) >= o,
1378
- "aria-label": q("moneyInput.increaseAmount", "Increase amount"),
1387
+ disabled: z || C || o != null && e != null && e.amount / Math.pow(10, ee) >= o,
1388
+ "aria-label": F("moneyInput.increaseAmount", "Increase amount"),
1379
1389
  tabIndex: -1,
1380
1390
  children: "+"
1381
1391
  }
1382
1392
  ),
1383
- _ && /* @__PURE__ */ c("span", { className: "nice-money-input__spinner", "aria-hidden": !0, children: /* @__PURE__ */ c(Me, { name: "refresh", size: 14 }) })
1393
+ g && /* @__PURE__ */ c("span", { className: "nice-money-input__spinner", "aria-hidden": !0, children: /* @__PURE__ */ c(Pe, { name: "refresh", size: 14 }) })
1384
1394
  ] }),
1385
- W && Te && /* @__PURE__ */ c("span", { className: "nice-money-input__preview", "aria-live": "polite", children: Te }),
1395
+ W && Ee && /* @__PURE__ */ c("span", { className: "nice-money-input__preview", "aria-live": "polite", children: Ee }),
1386
1396
  (he || u) && /* @__PURE__ */ c(
1387
1397
  "span",
1388
1398
  {
1389
- id: `${I}-help`,
1399
+ id: `${$}-help`,
1390
1400
  className: he ? "nice-money-input__error" : "nice-money-input__helper",
1391
1401
  children: he ?? u
1392
1402
  }
@@ -1404,183 +1414,183 @@ const Ke = /* @__PURE__ */ se(
1404
1414
  size: o = "md",
1405
1415
  disabled: l,
1406
1416
  readOnly: y,
1407
- loading: v,
1408
- accessMode: f,
1417
+ loading: N,
1418
+ accessMode: b,
1409
1419
  label: u,
1410
- helperText: m,
1411
- error: g,
1412
- required: N,
1413
- className: p,
1414
- style: D,
1415
- id: _,
1416
- title: w,
1417
- "data-testid": U
1418
- }, G) {
1419
- const { t: M } = pe(), S = f === "hidden", $ = l || f === "disabled" || v, A = y || f === "readOnly", W = _e(), O = _ ?? `nice-cc-${W}`, [k, B] = z({
1420
+ helperText: f,
1421
+ error: h,
1422
+ required: w,
1423
+ className: x,
1424
+ style: m,
1425
+ id: g,
1426
+ title: v,
1427
+ "data-testid": S
1428
+ }, A) {
1429
+ const { t: P } = oe(), M = b === "hidden", q = l || b === "disabled" || N, I = y || b === "readOnly", W = _e(), B = g ?? `nice-cc-${W}`, [D, T] = H({
1420
1430
  number: !1,
1421
1431
  expiry: !1,
1422
1432
  cvc: !1,
1423
1433
  holder: !1,
1424
1434
  postal: !1
1425
- }), F = K(() => ke(e.number), [e.number]), Q = K(
1435
+ }), O = K(() => ke(e.number), [e.number]), X = K(
1426
1436
  () => qe(e, { requireHolder: a ?? n }),
1427
1437
  [e, a, n]
1428
- ), ce = !d || d.includes(F) || F === "unknown", H = Y(
1438
+ ), ne = !d || d.includes(O) || O === "unknown", Y = j(
1429
1439
  (C) => {
1430
- const L = { ...e, ...C }, oe = qe(L, { requireHolder: a ?? n });
1431
- r == null || r(L, oe);
1440
+ const L = { ...e, ...C }, le = qe(L, { requireHolder: a ?? n });
1441
+ r == null || r(L, le);
1432
1442
  },
1433
1443
  [e, a, n, r]
1434
- ), te = Y(
1444
+ ), Z = j(
1435
1445
  (C) => {
1436
1446
  const L = C.target.value.replace(/\D/g, "").slice(0, 19);
1437
- H({ number: L });
1447
+ Y({ number: L });
1438
1448
  },
1439
- [H]
1440
- ), J = Y(
1449
+ [Y]
1450
+ ), Q = j(
1441
1451
  (C) => {
1442
1452
  const L = C.target.value.replace(/\D/g, "").slice(0, 4);
1443
- let oe = L;
1444
- L.length >= 3 ? oe = `${L.slice(0, 2)}/${L.slice(2)}` : L.length === 2 && (oe = `${L}/`), H({ expiry: oe });
1453
+ let le = L;
1454
+ L.length >= 3 ? le = `${L.slice(0, 2)}/${L.slice(2)}` : L.length === 2 && (le = `${L}/`), Y({ expiry: le });
1445
1455
  },
1446
- [H]
1447
- ), T = Y(
1456
+ [Y]
1457
+ ), ae = j(
1448
1458
  (C) => {
1449
- const L = C.target.value.replace(/\D/g, "").slice(0, be(F));
1450
- H({ cvc: L });
1459
+ const L = C.target.value.replace(/\D/g, "").slice(0, be(O));
1460
+ Y({ cvc: L });
1451
1461
  },
1452
- [F, H]
1453
- ), E = K(() => mt(e.number, F), [e.number, F]), P = k.number && e.number.length > 0 && (ze(e.number) ? ce ? void 0 : "Card brand not accepted" : Q.errors.number), h = k.expiry && e.expiry.length > 0 && !Ye(e.expiry) ? Q.errors.expiry : void 0, q = k.cvc && e.cvc.length > 0 && e.cvc.length !== be(F) ? Q.errors.cvc : void 0, j = `nice-credit-card nice-credit-card--${o}` + ($ ? " nice-credit-card--disabled" : "") + (v ? " nice-credit-card--loading" : "") + (g ? " nice-credit-card--error" : "") + (p ? ` ${p}` : "");
1454
- return S ? null : /* @__PURE__ */ b("div", { ref: G, className: j, style: D, title: w, "data-testid": U, children: [
1455
- u && /* @__PURE__ */ b("div", { className: "nice-credit-card__title", children: [
1462
+ [O, Y]
1463
+ ), E = K(() => mt(e.number, O), [e.number, O]), k = D.number && e.number.length > 0 && (ze(e.number) ? ne ? void 0 : "Card brand not accepted" : X.errors.number), p = D.expiry && e.expiry.length > 0 && !Ye(e.expiry) ? X.errors.expiry : void 0, F = D.cvc && e.cvc.length > 0 && e.cvc.length !== be(O) ? X.errors.cvc : void 0, z = `nice-credit-card nice-credit-card--${o}` + (q ? " nice-credit-card--disabled" : "") + (N ? " nice-credit-card--loading" : "") + (h ? " nice-credit-card--error" : "") + (x ? ` ${x}` : "");
1464
+ return M ? null : /* @__PURE__ */ _("div", { ref: A, className: z, style: m, title: v, "data-testid": S, children: [
1465
+ u && /* @__PURE__ */ _("div", { className: "nice-credit-card__title", children: [
1456
1466
  u,
1457
- N && /* @__PURE__ */ c("span", { className: "nice-credit-card__required", "aria-hidden": !0, children: "*" })
1467
+ w && /* @__PURE__ */ c("span", { className: "nice-credit-card__required", "aria-hidden": !0, children: "*" })
1458
1468
  ] }),
1459
- /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ b("label", { className: "nice-credit-card__field nice-credit-card__field--number", children: [
1460
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.cardNumber", "Card number") }),
1461
- /* @__PURE__ */ b("span", { className: "nice-credit-card__input-wrapper", children: [
1469
+ /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field nice-credit-card__field--number", children: [
1470
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: P("creditCardInput.cardNumber", "Card number") }),
1471
+ /* @__PURE__ */ _("span", { className: "nice-credit-card__input-wrapper", children: [
1462
1472
  /* @__PURE__ */ c(
1463
1473
  "input",
1464
1474
  {
1465
- id: `${O}-number`,
1475
+ id: `${B}-number`,
1466
1476
  type: "text",
1467
1477
  inputMode: "numeric",
1468
1478
  autoComplete: "cc-number",
1469
- placeholder: F === "amex" ? "3782 822463 10005" : "1234 1234 1234 1234",
1479
+ placeholder: O === "amex" ? "3782 822463 10005" : "1234 1234 1234 1234",
1470
1480
  value: E,
1471
- onChange: te,
1472
- onBlur: () => B((C) => ({ ...C, number: !0 })),
1473
- disabled: $,
1474
- readOnly: A,
1475
- "aria-invalid": !!P,
1476
- "aria-describedby": P ? `${O}-number-err` : void 0,
1481
+ onChange: Z,
1482
+ onBlur: () => T((C) => ({ ...C, number: !0 })),
1483
+ disabled: q,
1484
+ readOnly: I,
1485
+ "aria-invalid": !!k,
1486
+ "aria-describedby": k ? `${B}-number-err` : void 0,
1477
1487
  className: "nice-credit-card__input",
1478
- maxLength: F === "amex" ? 17 : 23
1488
+ maxLength: O === "amex" ? 17 : 23
1479
1489
  }
1480
1490
  ),
1481
- s && /* @__PURE__ */ c(Ht, { brand: F })
1491
+ s && /* @__PURE__ */ c(Ht, { brand: O })
1482
1492
  ] }),
1483
- P && /* @__PURE__ */ c("span", { id: `${O}-number-err`, className: "nice-credit-card__error", children: P })
1493
+ k && /* @__PURE__ */ c("span", { id: `${B}-number-err`, className: "nice-credit-card__error", children: k })
1484
1494
  ] }) }),
1485
- /* @__PURE__ */ b("div", { className: "nice-credit-card__row nice-credit-card__row--split", children: [
1486
- /* @__PURE__ */ b("label", { className: "nice-credit-card__field", children: [
1487
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.expiry", "Expiry") }),
1495
+ /* @__PURE__ */ _("div", { className: "nice-credit-card__row nice-credit-card__row--split", children: [
1496
+ /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1497
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: P("creditCardInput.expiry", "Expiry") }),
1488
1498
  /* @__PURE__ */ c(
1489
1499
  "input",
1490
1500
  {
1491
- id: `${O}-expiry`,
1501
+ id: `${B}-expiry`,
1492
1502
  type: "text",
1493
1503
  inputMode: "numeric",
1494
1504
  autoComplete: "cc-exp",
1495
- placeholder: M("creditCardInput.mmYy", "MM/YY"),
1505
+ placeholder: P("creditCardInput.mmYy", "MM/YY"),
1496
1506
  value: e.expiry,
1497
- onChange: J,
1507
+ onChange: Q,
1498
1508
  onBlur: () => {
1499
- B((L) => ({ ...L, expiry: !0 }));
1509
+ T((L) => ({ ...L, expiry: !0 }));
1500
1510
  const C = je(e.expiry);
1501
- C && C !== e.expiry && H({ expiry: C });
1511
+ C && C !== e.expiry && Y({ expiry: C });
1502
1512
  },
1503
- disabled: $,
1504
- readOnly: A,
1505
- "aria-invalid": !!h,
1506
- "aria-describedby": h ? `${O}-expiry-err` : void 0,
1513
+ disabled: q,
1514
+ readOnly: I,
1515
+ "aria-invalid": !!p,
1516
+ "aria-describedby": p ? `${B}-expiry-err` : void 0,
1507
1517
  className: "nice-credit-card__input",
1508
1518
  maxLength: 5
1509
1519
  }
1510
1520
  ),
1511
- h && /* @__PURE__ */ c("span", { id: `${O}-expiry-err`, className: "nice-credit-card__error", children: h })
1521
+ p && /* @__PURE__ */ c("span", { id: `${B}-expiry-err`, className: "nice-credit-card__error", children: p })
1512
1522
  ] }),
1513
- /* @__PURE__ */ b("label", { className: "nice-credit-card__field", children: [
1514
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: F === "amex" ? "CID" : "CVC" }),
1523
+ /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1524
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: O === "amex" ? P("creditCardInput.cid", "CID") : P("creditCardInput.cvc", "CVC") }),
1515
1525
  /* @__PURE__ */ c(
1516
1526
  "input",
1517
1527
  {
1518
- id: `${O}-cvc`,
1528
+ id: `${B}-cvc`,
1519
1529
  type: "text",
1520
1530
  inputMode: "numeric",
1521
1531
  autoComplete: "cc-csc",
1522
- placeholder: "•".repeat(be(F)),
1532
+ placeholder: "•".repeat(be(O)),
1523
1533
  value: e.cvc,
1524
- onChange: T,
1525
- onBlur: () => B((C) => ({ ...C, cvc: !0 })),
1526
- disabled: $,
1527
- readOnly: A,
1528
- "aria-invalid": !!q,
1529
- "aria-describedby": q ? `${O}-cvc-err` : void 0,
1534
+ onChange: ae,
1535
+ onBlur: () => T((C) => ({ ...C, cvc: !0 })),
1536
+ disabled: q,
1537
+ readOnly: I,
1538
+ "aria-invalid": !!F,
1539
+ "aria-describedby": F ? `${B}-cvc-err` : void 0,
1530
1540
  className: "nice-credit-card__input",
1531
- maxLength: be(F)
1541
+ maxLength: be(O)
1532
1542
  }
1533
1543
  ),
1534
- q && /* @__PURE__ */ c("span", { id: `${O}-cvc-err`, className: "nice-credit-card__error", children: q })
1544
+ F && /* @__PURE__ */ c("span", { id: `${B}-cvc-err`, className: "nice-credit-card__error", children: F })
1535
1545
  ] })
1536
1546
  ] }),
1537
- n && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ b("label", { className: "nice-credit-card__field", children: [
1538
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.cardholderName", "Cardholder name") }),
1547
+ n && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1548
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: P("creditCardInput.cardholderName", "Cardholder name") }),
1539
1549
  /* @__PURE__ */ c(
1540
1550
  "input",
1541
1551
  {
1542
- id: `${O}-holder`,
1552
+ id: `${B}-holder`,
1543
1553
  type: "text",
1544
1554
  autoComplete: "cc-name",
1545
- placeholder: M("creditCardInput.janeDoe", "Jane Doe"),
1555
+ placeholder: P("creditCardInput.janeDoe", "Jane Doe"),
1546
1556
  value: e.holderName ?? "",
1547
- onChange: (C) => H({ holderName: C.target.value }),
1548
- onBlur: () => B((C) => ({ ...C, holder: !0 })),
1549
- disabled: $,
1550
- readOnly: A,
1557
+ onChange: (C) => Y({ holderName: C.target.value }),
1558
+ onBlur: () => T((C) => ({ ...C, holder: !0 })),
1559
+ disabled: q,
1560
+ readOnly: I,
1551
1561
  className: "nice-credit-card__input",
1552
1562
  maxLength: 120
1553
1563
  }
1554
1564
  )
1555
1565
  ] }) }),
1556
- i && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ b("label", { className: "nice-credit-card__field", children: [
1557
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.postalCode", "Postal code") }),
1566
+ i && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1567
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: P("creditCardInput.postalCode", "Postal code") }),
1558
1568
  /* @__PURE__ */ c(
1559
1569
  "input",
1560
1570
  {
1561
- id: `${O}-postal`,
1571
+ id: `${B}-postal`,
1562
1572
  type: "text",
1563
1573
  autoComplete: "postal-code",
1564
1574
  value: e.postalCode ?? "",
1565
- onChange: (C) => H({ postalCode: C.target.value }),
1566
- onBlur: () => B((C) => ({ ...C, postal: !0 })),
1567
- disabled: $,
1568
- readOnly: A,
1575
+ onChange: (C) => Y({ postalCode: C.target.value }),
1576
+ onBlur: () => T((C) => ({ ...C, postal: !0 })),
1577
+ disabled: q,
1578
+ readOnly: I,
1569
1579
  className: "nice-credit-card__input",
1570
1580
  maxLength: 16
1571
1581
  }
1572
1582
  )
1573
1583
  ] }) }),
1574
- (g || m) && /* @__PURE__ */ c(
1584
+ (h || f) && /* @__PURE__ */ c(
1575
1585
  "div",
1576
1586
  {
1577
- className: g ? "nice-credit-card__form-error" : "nice-credit-card__helper",
1578
- role: g ? "alert" : void 0,
1579
- children: g ?? m
1587
+ className: h ? "nice-credit-card__form-error" : "nice-credit-card__helper",
1588
+ role: h ? "alert" : void 0,
1589
+ children: h ?? f
1580
1590
  }
1581
1591
  )
1582
1592
  ] });
1583
- }), Oe = {
1593
+ }), Ke = {
1584
1594
  visa: "VISA",
1585
1595
  mastercard: "MasterCard",
1586
1596
  amex: "AMEX",
@@ -1599,8 +1609,8 @@ function Ht({ brand: t }) {
1599
1609
  "span",
1600
1610
  {
1601
1611
  className: `nice-credit-card__brand nice-credit-card__brand--${t}`,
1602
- "aria-label": Oe[t],
1603
- children: Oe[t]
1612
+ "aria-label": Ke[t],
1613
+ children: Ke[t]
1604
1614
  }
1605
1615
  );
1606
1616
  }
@@ -1614,128 +1624,123 @@ const yr = /* @__PURE__ */ se(
1614
1624
  description: d,
1615
1625
  metadata: s,
1616
1626
  autoCapture: o = !0,
1617
- submitLabel: l = "Pay",
1627
+ submitLabel: l,
1618
1628
  onSuccess: y,
1619
- onError: v,
1620
- consents: f,
1629
+ onError: N,
1630
+ consents: b,
1621
1631
  className: u,
1622
- style: m
1623
- }, g) {
1624
- const { t: N } = pe(), [p, D] = z(r), [_, w] = z(r.currency), [U, G] = z({ number: "", expiry: "", cvc: "" }), [M, S] = z(null), [$, A] = z(!1), [W, O] = z(null), k = Ot(e), B = K(() => e.supportedCurrencies === "*" ? !0 : e.supportedCurrencies.includes(p.currency.toUpperCase()), [e, p.currency]), F = K(() => {
1625
- var E;
1626
- const T = (E = e.minimums) == null ? void 0 : E[p.currency.toUpperCase()];
1627
- return T == null || p.amount >= T;
1628
- }, [e, p]), Q = K(() => {
1629
- var E;
1630
- const T = (E = e.minimums) == null ? void 0 : E[p.currency.toUpperCase()];
1631
- return T == null ? null : { amount: T, currency: p.currency };
1632
- }, [e, p.currency]), ce = !!(M != null && M.isValid), H = !$ && B && F && ce, te = Y(
1633
- async (T) => {
1634
- if (T.preventDefault(), !!H) {
1635
- O(null), A(!0);
1632
+ style: f
1633
+ }, h) {
1634
+ const { t: w } = oe(), x = l ?? w("paymentForm.pay", "Pay"), [m, g] = H(r), [v, S] = H(r.currency), [A, P] = H({ number: "", expiry: "", cvc: "" }), [M, q] = H(null), [I, W] = H(!1), [B, D] = H(null), T = Kt(e), O = K(() => e.supportedCurrencies === "*" ? !0 : e.supportedCurrencies.includes(m.currency.toUpperCase()), [e, m.currency]), X = K(() => {
1635
+ var k;
1636
+ const E = (k = e.minimums) == null ? void 0 : k[m.currency.toUpperCase()];
1637
+ return E == null || m.amount >= E;
1638
+ }, [e, m]), ne = K(() => {
1639
+ var k;
1640
+ const E = (k = e.minimums) == null ? void 0 : k[m.currency.toUpperCase()];
1641
+ return E == null ? null : { amount: E, currency: m.currency };
1642
+ }, [e, m.currency]), Y = !!(M != null && M.isValid), Z = !I && O && X && Y, Q = j(
1643
+ async (E) => {
1644
+ if (E.preventDefault(), !!Z) {
1645
+ D(null), W(!0);
1636
1646
  try {
1637
- const E = {
1638
- amount: p,
1639
- card: U,
1647
+ const k = {
1648
+ amount: m,
1649
+ card: A,
1640
1650
  customer: a,
1641
1651
  description: d,
1642
1652
  metadata: s,
1643
1653
  idempotencyKey: zt()
1644
- }, P = await k.authorize(E);
1645
- if (o && P.status === "authorized") {
1646
- const h = await k.capture(P.id, p);
1647
- y == null || y(h);
1654
+ }, p = await T.authorize(k);
1655
+ if (o && p.status === "authorized") {
1656
+ const F = await T.capture(p.id, m);
1657
+ y == null || y(F);
1648
1658
  } else
1649
- y == null || y(P);
1650
- } catch (E) {
1651
- const P = E instanceof Error ? E : new Error(String(E));
1652
- O(P.message), v == null || v(P);
1659
+ y == null || y(p);
1660
+ } catch (k) {
1661
+ const p = k instanceof Error ? k : new Error(String(k));
1662
+ D(p.message), N == null || N(p);
1653
1663
  } finally {
1654
- A(!1);
1664
+ W(!1);
1655
1665
  }
1656
1666
  }
1657
1667
  },
1658
1668
  [
1659
- H,
1660
- p,
1661
- U,
1669
+ Z,
1670
+ m,
1671
+ A,
1662
1672
  a,
1663
1673
  d,
1664
1674
  s,
1665
1675
  o,
1666
- k,
1676
+ T,
1667
1677
  y,
1668
- v
1678
+ N
1669
1679
  ]
1670
- ), J = ne(p.currency);
1671
- return /* @__PURE__ */ b(
1680
+ ), ae = re(m.currency);
1681
+ return /* @__PURE__ */ _(
1672
1682
  "form",
1673
1683
  {
1674
- ref: g,
1684
+ ref: h,
1675
1685
  className: "nice-payment-form" + (u ? ` ${u}` : ""),
1676
- style: m,
1677
- onSubmit: te,
1678
- "aria-busy": $,
1686
+ style: f,
1687
+ onSubmit: Q,
1688
+ "aria-busy": I,
1679
1689
  children: [
1680
1690
  /* @__PURE__ */ c("div", { className: "nice-payment-form__amount", children: n ? /* @__PURE__ */ c(
1681
1691
  Ze,
1682
1692
  {
1683
- label: N("paymentForm.amount", "Amount"),
1684
- value: p,
1685
- currency: _,
1693
+ label: w("paymentForm.amount", "Amount"),
1694
+ value: m,
1695
+ currency: v,
1686
1696
  currencies: i,
1687
- onChange: (T) => T && D(T),
1688
- onCurrencyChange: (T) => {
1689
- w(T), D((E) => ({ ...E, currency: T }));
1697
+ onChange: (E) => E && g(E),
1698
+ onCurrencyChange: (E) => {
1699
+ S(E), g((k) => ({ ...k, currency: E }));
1690
1700
  },
1691
- disabled: $,
1701
+ disabled: I,
1692
1702
  required: !0,
1693
1703
  showFormattedPreview: !0
1694
1704
  }
1695
- ) : /* @__PURE__ */ b("div", { className: "nice-payment-form__total", children: [
1696
- /* @__PURE__ */ c("span", { className: "nice-payment-form__total-label", children: N("paymentForm.total", "Total") }),
1697
- /* @__PURE__ */ c(Ke, { value: p })
1705
+ ) : /* @__PURE__ */ _("div", { className: "nice-payment-form__total", children: [
1706
+ /* @__PURE__ */ c("span", { className: "nice-payment-form__total-label", children: w("paymentForm.total", "Total") }),
1707
+ /* @__PURE__ */ c(Oe, { value: m })
1698
1708
  ] }) }),
1699
1709
  d && /* @__PURE__ */ c("p", { className: "nice-payment-form__description", children: d }),
1700
1710
  /* @__PURE__ */ c("div", { className: "nice-payment-form__card", children: /* @__PURE__ */ c(
1701
1711
  Lt,
1702
1712
  {
1703
- value: U,
1704
- onChange: (T, E) => {
1705
- G(T), S(E);
1713
+ value: A,
1714
+ onChange: (E, k) => {
1715
+ P(E), q(k);
1706
1716
  },
1707
- disabled: $
1717
+ disabled: I
1708
1718
  }
1709
1719
  ) }),
1710
- !B && /* @__PURE__ */ b("div", { className: "nice-payment-form__warning", role: "alert", children: [
1711
- e.name,
1712
- " does not accept ",
1713
- (J == null ? void 0 : J.name) ?? p.currency,
1714
- "."
1715
- ] }),
1716
- !F && Q && /* @__PURE__ */ b("div", { className: "nice-payment-form__warning", role: "alert", children: [
1717
- N("paymentForm.minimumChargeForIs", "Minimum charge for {name} is").replace(
1720
+ !O && /* @__PURE__ */ c("div", { className: "nice-payment-form__warning", role: "alert", children: w("paymentForm.doesNotAccept", "{provider} does not accept {currency}.").replace("{provider}", String(e.name)).replace("{currency}", String((ae == null ? void 0 : ae.name) ?? m.currency)) }),
1721
+ !X && ne && /* @__PURE__ */ _("div", { className: "nice-payment-form__warning", role: "alert", children: [
1722
+ w("paymentForm.minimumChargeForIs", "Minimum charge for {name} is").replace(
1718
1723
  "{name}",
1719
1724
  String(e.name)
1720
1725
  ),
1721
1726
  " ",
1722
- /* @__PURE__ */ c(Ke, { value: Q }),
1727
+ /* @__PURE__ */ c(Oe, { value: ne }),
1723
1728
  "."
1724
1729
  ] }),
1725
- f && /* @__PURE__ */ c("div", { className: "nice-payment-form__consents", children: f }),
1726
- W && /* @__PURE__ */ c("div", { className: "nice-payment-form__error", role: "alert", children: W }),
1730
+ b && /* @__PURE__ */ c("div", { className: "nice-payment-form__consents", children: b }),
1731
+ B && /* @__PURE__ */ c("div", { className: "nice-payment-form__error", role: "alert", children: B }),
1727
1732
  /* @__PURE__ */ c(
1728
1733
  "button",
1729
1734
  {
1730
1735
  type: "submit",
1731
1736
  className: "nice-payment-form__submit",
1732
- disabled: !H,
1733
- "aria-disabled": !H,
1734
- children: $ ? "Processing…" : l
1737
+ disabled: !Z,
1738
+ "aria-disabled": !Z,
1739
+ children: I ? w("paymentForm.processing", "Processing…") : x
1735
1740
  }
1736
1741
  ),
1737
- /* @__PURE__ */ b("p", { className: "nice-payment-form__processor", children: [
1738
- N("paymentForm.securedBy", "Secured by"),
1742
+ /* @__PURE__ */ _("p", { className: "nice-payment-form__processor", children: [
1743
+ w("paymentForm.securedBy", "Secured by"),
1739
1744
  " ",
1740
1745
  /* @__PURE__ */ c("strong", { children: e.name })
1741
1746
  ] })
@@ -1759,11 +1764,11 @@ const hr = /* @__PURE__ */ se(
1759
1764
  locale: o,
1760
1765
  className: l,
1761
1766
  style: y
1762
- }, v) {
1763
- const { t: f } = pe(), u = r && r.currency === e.currency && r.amount > e.amount, m = K(() => !u || !r ? null : Math.round((r.amount - e.amount) / r.amount * 100), [u, r, e.amount]), g = `nice-price-tag nice-price-tag--${s}` + (l ? ` ${l}` : "");
1764
- return /* @__PURE__ */ b("div", { ref: v, className: g, style: y, children: [
1767
+ }, N) {
1768
+ const { t: b } = oe(), u = r && r.currency === e.currency && r.amount > e.amount, f = K(() => !u || !r ? null : Math.round((r.amount - e.amount) / r.amount * 100), [u, r, e.amount]), h = `nice-price-tag nice-price-tag--${s}` + (l ? ` ${l}` : "");
1769
+ return /* @__PURE__ */ _("div", { ref: N, className: h, style: y, children: [
1765
1770
  a && /* @__PURE__ */ c("span", { className: "nice-price-tag__prefix", children: a }),
1766
- /* @__PURE__ */ b("span", { className: "nice-price-tag__main", children: [
1771
+ /* @__PURE__ */ _("span", { className: "nice-price-tag__main", children: [
1767
1772
  /* @__PURE__ */ c("span", { className: "nice-price-tag__amount", children: ie(e, { locale: o }) }),
1768
1773
  n && /* @__PURE__ */ c("span", { className: "nice-price-tag__period", children: n })
1769
1774
  ] }),
@@ -1771,15 +1776,22 @@ const hr = /* @__PURE__ */ se(
1771
1776
  "span",
1772
1777
  {
1773
1778
  className: "nice-price-tag__original",
1774
- "aria-label": f("priceTag.originalPrice", "Original price"),
1779
+ "aria-label": b("priceTag.originalPrice", "Original price"),
1775
1780
  children: /* @__PURE__ */ c("s", { children: ie(r, { locale: o }) })
1776
1781
  }
1777
1782
  ),
1778
- u && d && m != null && m > 0 && /* @__PURE__ */ b("span", { className: "nice-price-tag__discount", "aria-label": `${m} percent off`, children: [
1779
- "−",
1780
- m,
1781
- "%"
1782
- ] }),
1783
+ u && d && f != null && f > 0 && /* @__PURE__ */ _(
1784
+ "span",
1785
+ {
1786
+ className: "nice-price-tag__discount",
1787
+ "aria-label": b("priceTag.percentOff", "{pct} percent off").replace("{pct}", String(f)),
1788
+ children: [
1789
+ "−",
1790
+ f,
1791
+ "%"
1792
+ ]
1793
+ }
1794
+ ),
1783
1795
  i && /* @__PURE__ */ c("span", { className: "nice-price-tag__suffix", children: i })
1784
1796
  ] });
1785
1797
  }
@@ -1794,75 +1806,75 @@ const hr = /* @__PURE__ */ se(
1794
1806
  locale: o,
1795
1807
  showRateLine: l = !0,
1796
1808
  className: y,
1797
- style: v
1798
- }, f) {
1799
- const { t: u } = pe(), [m, g] = Pe({
1809
+ style: N
1810
+ }, b) {
1811
+ const { t: u } = oe(), [f, h] = Me({
1800
1812
  value: e,
1801
1813
  defaultValue: r,
1802
1814
  fallbackValue: jt,
1803
1815
  onChange: n,
1804
1816
  componentName: "NiceCurrencyConverter"
1805
- }), [N, p] = Pe({
1817
+ }), [w, x] = Me({
1806
1818
  value: a,
1807
1819
  defaultValue: i,
1808
- fallbackValue: m.currency,
1820
+ fallbackValue: f.currency,
1809
1821
  onChange: d,
1810
1822
  componentName: "NiceCurrencyConverter"
1811
- }), { converted: D, loading: _, error: w } = Se(m, N, s), U = K(
1812
- () => ({ amount: Math.pow(10, 2), currency: m.currency }),
1813
- [m.currency]
1814
- ), { converted: G } = Se(
1815
- l ? U : null,
1816
- N,
1823
+ }), { converted: m, loading: g, error: v } = Ie(f, w, s), S = K(
1824
+ () => ({ amount: Math.pow(10, 2), currency: f.currency }),
1825
+ [f.currency]
1826
+ ), { converted: A } = Ie(
1827
+ l ? S : null,
1828
+ w,
1817
1829
  s
1818
1830
  );
1819
- return /* @__PURE__ */ b(
1831
+ return /* @__PURE__ */ _(
1820
1832
  "div",
1821
1833
  {
1822
- ref: f,
1834
+ ref: b,
1823
1835
  className: "nice-currency-converter" + (y ? ` ${y}` : ""),
1824
- style: v,
1836
+ style: N,
1825
1837
  children: [
1826
1838
  /* @__PURE__ */ c("div", { className: "nice-currency-converter__row", children: /* @__PURE__ */ c(
1827
1839
  Ze,
1828
1840
  {
1829
1841
  label: u("currencyConverter.from", "From"),
1830
- value: m,
1831
- onChange: (M) => M && g(M),
1832
- currency: m.currency,
1833
- onCurrencyChange: (M) => g({ ...m, currency: M }),
1842
+ value: f,
1843
+ onChange: (P) => P && h(P),
1844
+ currency: f.currency,
1845
+ onCurrencyChange: (P) => h({ ...f, currency: P }),
1834
1846
  showFormattedPreview: !1
1835
1847
  }
1836
1848
  ) }),
1837
- /* @__PURE__ */ b("div", { className: "nice-currency-converter__row", children: [
1838
- /* @__PURE__ */ c("label", { className: "nice-currency-converter__label", children: "To" }),
1839
- /* @__PURE__ */ b("div", { className: "nice-currency-converter__output", children: [
1849
+ /* @__PURE__ */ _("div", { className: "nice-currency-converter__row", children: [
1850
+ /* @__PURE__ */ c("label", { className: "nice-currency-converter__label", children: u("currencyConverter.to", "To") }),
1851
+ /* @__PURE__ */ _("div", { className: "nice-currency-converter__output", children: [
1840
1852
  /* @__PURE__ */ c(
1841
1853
  Ge,
1842
1854
  {
1843
- value: N,
1844
- onChange: (M) => p(M),
1855
+ value: w,
1856
+ onChange: (P) => x(P),
1845
1857
  compact: !0
1846
1858
  }
1847
1859
  ),
1848
- /* @__PURE__ */ c("span", { className: "nice-currency-converter__amount", children: _ ? "…" : w ? "—" : D ? ie(D, { locale: o }) : "" })
1860
+ /* @__PURE__ */ c("span", { className: "nice-currency-converter__amount", children: g ? "…" : v ? "—" : m ? ie(m, { locale: o }) : "" })
1849
1861
  ] })
1850
1862
  ] }),
1851
- l && G && /* @__PURE__ */ b("p", { className: "nice-currency-converter__rate", children: [
1863
+ l && A && /* @__PURE__ */ _("p", { className: "nice-currency-converter__rate", children: [
1852
1864
  "1 ",
1853
- m.currency,
1865
+ f.currency,
1854
1866
  " = ",
1855
- ie(G, { locale: o }),
1867
+ ie(A, { locale: o }),
1856
1868
  " ",
1857
- /* @__PURE__ */ b("span", { className: "nice-currency-converter__inverse", children: [
1869
+ /* @__PURE__ */ _("span", { className: "nice-currency-converter__inverse", children: [
1858
1870
  "· 1 ",
1859
- N,
1871
+ w,
1860
1872
  " =",
1861
1873
  " ",
1862
- ie(ae(1 / He(G), m.currency), { locale: o })
1874
+ ie(ce(1 / He(A), f.currency), { locale: o })
1863
1875
  ] })
1864
1876
  ] }),
1865
- w && /* @__PURE__ */ c("p", { className: "nice-currency-converter__error", role: "alert", children: w.message })
1877
+ v && /* @__PURE__ */ c("p", { className: "nice-currency-converter__error", role: "alert", children: v.message })
1866
1878
  ]
1867
1879
  }
1868
1880
  );
@@ -1882,82 +1894,82 @@ const fr = /* @__PURE__ */ se(
1882
1894
  density: o = "comfortable",
1883
1895
  className: l,
1884
1896
  style: y,
1885
- id: v
1886
- }, f) {
1887
- const u = {
1888
- label: (s == null ? void 0 : s.label) ?? "Item",
1897
+ id: N
1898
+ }, b) {
1899
+ const { t: u } = oe(), f = {
1900
+ label: (s == null ? void 0 : s.label) ?? u("taxBreakdown.item", "Item"),
1889
1901
  rate: (s == null ? void 0 : s.rate) ?? "VAT",
1890
1902
  net: (s == null ? void 0 : s.net) ?? "Net",
1891
1903
  vat: (s == null ? void 0 : s.vat) ?? "Tax",
1892
1904
  gross: (s == null ? void 0 : s.gross) ?? "Gross",
1893
1905
  total: (s == null ? void 0 : s.total) ?? "Total"
1894
- }, m = K(() => {
1906
+ }, h = K(() => {
1895
1907
  if (n === "total") {
1896
- const p = /* @__PURE__ */ new Map();
1897
- for (const _ of e) {
1898
- let w = p.get(_.vatRate);
1899
- w || (w = [], p.set(_.vatRate, w)), w.push(_.netAmount);
1908
+ const m = /* @__PURE__ */ new Map();
1909
+ for (const v of e) {
1910
+ let S = m.get(v.vatRate);
1911
+ S || (S = [], m.set(v.vatRate, S)), S.push(v.netAmount);
1900
1912
  }
1901
- const D = [];
1902
- for (const [_, w] of p) {
1903
- const U = w.reduce((S, $) => ye(S, $), ae(0, w[0].currency)), G = Be(Ie(U, _)), M = ye(U, G);
1904
- D.push({ rate: _, net: U, vat: G, gross: M });
1913
+ const g = [];
1914
+ for (const [v, S] of m) {
1915
+ const A = S.reduce((q, I) => ye(q, I), ce(0, S[0].currency)), P = Be(Se(A, v)), M = ye(A, P);
1916
+ g.push({ rate: v, net: A, vat: P, gross: M });
1905
1917
  }
1906
- return D;
1918
+ return g;
1907
1919
  }
1908
- return e.map((p) => {
1909
- const D = Be(Ie(p.netAmount, p.vatRate)), _ = ye(p.netAmount, D);
1910
- return { label: p.label, rate: p.vatRate, net: p.netAmount, vat: D, gross: _ };
1920
+ return e.map((m) => {
1921
+ const g = Be(Se(m.netAmount, m.vatRate)), v = ye(m.netAmount, g);
1922
+ return { label: m.label, rate: m.vatRate, net: m.netAmount, vat: g, gross: v };
1911
1923
  });
1912
- }, [e, n]), g = K(() => {
1913
- if (m.length === 0)
1924
+ }, [e, n]), w = K(() => {
1925
+ if (h.length === 0)
1914
1926
  return null;
1915
- const p = m[0].net.currency;
1916
- let D = ae(0, p), _ = ae(0, p), w = ae(0, p);
1917
- for (const U of m)
1918
- D = ye(D, U.net), _ = ye(_, U.vat), w = ye(w, U.gross);
1919
- return { net: D, vat: _, gross: w };
1920
- }, [m]), N = (p) => ie(p, { locale: r });
1921
- return /* @__PURE__ */ b(
1927
+ const m = h[0].net.currency;
1928
+ let g = ce(0, m), v = ce(0, m), S = ce(0, m);
1929
+ for (const A of h)
1930
+ g = ye(g, A.net), v = ye(v, A.vat), S = ye(S, A.gross);
1931
+ return { net: g, vat: v, gross: S };
1932
+ }, [h]), x = (m) => ie(m, { locale: r });
1933
+ return /* @__PURE__ */ _(
1922
1934
  "table",
1923
1935
  {
1924
- ref: f,
1925
- id: v,
1936
+ ref: b,
1937
+ id: N,
1926
1938
  className: `nice-tax-breakdown nice-tax-breakdown--${o} ${l ?? ""}`,
1927
1939
  style: y,
1928
1940
  role: "table",
1929
- "aria-label": u.total,
1941
+ "aria-label": f.total,
1930
1942
  children: [
1931
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ b("tr", { children: [
1932
- m.some((p) => p.label !== void 0) && /* @__PURE__ */ c("th", { scope: "col", children: u.label }),
1933
- !d && /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__rate", children: u.rate }),
1934
- /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: u.net }),
1935
- /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: u.vat }),
1936
- /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: u.gross })
1943
+ /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ _("tr", { children: [
1944
+ h.some((m) => m.label !== void 0) && /* @__PURE__ */ c("th", { scope: "col", children: f.label }),
1945
+ !d && /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__rate", children: f.rate }),
1946
+ /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: f.net }),
1947
+ /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: f.vat }),
1948
+ /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: f.gross })
1937
1949
  ] }) }),
1938
- /* @__PURE__ */ c("tbody", { children: m.map((p, D) => /* @__PURE__ */ b("tr", { children: [
1939
- m.some((_) => _.label !== void 0) && /* @__PURE__ */ c("td", { children: p.label ?? "" }),
1940
- !d && /* @__PURE__ */ b("td", { className: "nice-tax-breakdown__rate", children: [
1941
- (p.rate * 100).toLocaleString(r, { maximumFractionDigits: 2 }),
1950
+ /* @__PURE__ */ c("tbody", { children: h.map((m, g) => /* @__PURE__ */ _("tr", { children: [
1951
+ h.some((v) => v.label !== void 0) && /* @__PURE__ */ c("td", { children: m.label ?? "" }),
1952
+ !d && /* @__PURE__ */ _("td", { className: "nice-tax-breakdown__rate", children: [
1953
+ (m.rate * 100).toLocaleString(r, { maximumFractionDigits: 2 }),
1942
1954
  "%"
1943
1955
  ] }),
1944
- /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: N(p.net) }),
1945
- /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: N(p.vat) }),
1946
- /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: N(p.gross) })
1947
- ] }, `${p.rate}-${D}`)) }),
1948
- a && g && /* @__PURE__ */ c("tfoot", { children: i && /* @__PURE__ */ b("tr", { className: "nice-tax-breakdown__totals", children: [
1949
- m.some((p) => p.label !== void 0) && /* @__PURE__ */ c("td", { children: u.total }),
1950
- !d && /* @__PURE__ */ c("td", { children: m.some((p) => p.label !== void 0) ? null : u.total }),
1951
- /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: N(g.net) }),
1952
- /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: N(g.vat) }),
1953
- /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: N(g.gross) })
1956
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: x(m.net) }),
1957
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: x(m.vat) }),
1958
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: x(m.gross) })
1959
+ ] }, `${m.rate}-${g}`)) }),
1960
+ a && w && /* @__PURE__ */ c("tfoot", { children: i && /* @__PURE__ */ _("tr", { className: "nice-tax-breakdown__totals", children: [
1961
+ h.some((m) => m.label !== void 0) && /* @__PURE__ */ c("td", { children: f.total }),
1962
+ !d && /* @__PURE__ */ c("td", { children: h.some((m) => m.label !== void 0) ? null : f.total }),
1963
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: x(w.net) }),
1964
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: x(w.vat) }),
1965
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: x(w.gross) })
1954
1966
  ] }) })
1955
1967
  ]
1956
1968
  }
1957
1969
  );
1958
1970
  }
1959
1971
  ), Gt = [], _r = /* @__PURE__ */ se(function(e, r) {
1960
- const { t: n } = pe(), {
1972
+ const { t: n } = oe(), {
1961
1973
  methods: a = Gt,
1962
1974
  value: i,
1963
1975
  onChange: d,
@@ -1965,64 +1977,64 @@ const fr = /* @__PURE__ */ se(
1965
1977
  columns: o = 2,
1966
1978
  currency: l,
1967
1979
  label: y,
1968
- name: v,
1969
- readOnly: f = !1,
1980
+ name: N,
1981
+ readOnly: b = !1,
1970
1982
  className: u,
1971
- style: m,
1972
- id: g,
1973
- accessMode: N,
1974
- "data-testid": p
1975
- } = e, D = _e(), _ = v ?? `nice-pm-${D}`, w = K(() => {
1983
+ style: f,
1984
+ id: h,
1985
+ accessMode: w,
1986
+ "data-testid": x
1987
+ } = e, m = _e(), g = N ?? `nice-pm-${m}`, v = K(() => {
1976
1988
  if (!l)
1977
1989
  return a;
1978
- const S = l.toUpperCase();
1990
+ const M = l.toUpperCase();
1979
1991
  return a.filter(
1980
- ($) => !$.currencies || $.currencies.map((A) => A.toUpperCase()).includes(S)
1992
+ (q) => !q.currencies || q.currencies.map((I) => I.toUpperCase()).includes(M)
1981
1993
  );
1982
1994
  }, [a, l]);
1983
- if (N === "hidden")
1995
+ if (w === "hidden")
1984
1996
  return null;
1985
- const U = f || N === "disabled" || N === "readOnly", G = `nice-payment-method-selector nice-payment-method-selector--${s}` + (u ? ` ${u}` : ""), M = s === "grid" ? { gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))` } : void 0;
1986
- return /* @__PURE__ */ b("div", { ref: r, id: g, className: G, style: m, "data-testid": p, children: [
1997
+ const S = b || w === "disabled" || w === "readOnly", A = `nice-payment-method-selector nice-payment-method-selector--${s}` + (u ? ` ${u}` : ""), P = s === "grid" ? { gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))` } : void 0;
1998
+ return /* @__PURE__ */ _("div", { ref: r, id: h, className: A, style: f, "data-testid": x, children: [
1987
1999
  y && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__label", children: y }),
1988
- /* @__PURE__ */ b(
2000
+ /* @__PURE__ */ _(
1989
2001
  "div",
1990
2002
  {
1991
2003
  className: "nice-payment-method-selector__options",
1992
- style: M,
2004
+ style: P,
1993
2005
  role: "radiogroup",
1994
- "aria-label": y ?? "Payment method",
2006
+ "aria-label": y ?? n("paymentMethodSelector.paymentMethod", "Payment method"),
1995
2007
  children: [
1996
- w.map((S) => {
1997
- const $ = S.id === i, A = U || S.disabled;
1998
- return /* @__PURE__ */ b(
2008
+ v.map((M) => {
2009
+ const q = M.id === i, I = S || M.disabled;
2010
+ return /* @__PURE__ */ _(
1999
2011
  "label",
2000
2012
  {
2001
- className: "nice-payment-method-selector__option" + ($ ? " nice-payment-method-selector__option--selected" : "") + (A ? " nice-payment-method-selector__option--disabled" : ""),
2013
+ className: "nice-payment-method-selector__option" + (q ? " nice-payment-method-selector__option--selected" : "") + (I ? " nice-payment-method-selector__option--disabled" : ""),
2002
2014
  children: [
2003
2015
  /* @__PURE__ */ c(
2004
2016
  "input",
2005
2017
  {
2006
2018
  type: "radio",
2007
2019
  className: "nice-payment-method-selector__radio",
2008
- name: _,
2009
- value: S.id,
2010
- checked: $,
2011
- disabled: A,
2012
- onChange: () => d == null ? void 0 : d(S.id)
2020
+ name: g,
2021
+ value: M.id,
2022
+ checked: q,
2023
+ disabled: I,
2024
+ onChange: () => d == null ? void 0 : d(M.id)
2013
2025
  }
2014
2026
  ),
2015
- S.icon && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__icon", children: S.icon }),
2016
- /* @__PURE__ */ b("span", { className: "nice-payment-method-selector__text", children: [
2017
- /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__name", children: S.label }),
2018
- S.description && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__desc", children: S.description })
2027
+ M.icon && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__icon", children: M.icon }),
2028
+ /* @__PURE__ */ _("span", { className: "nice-payment-method-selector__text", children: [
2029
+ /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__name", children: M.label }),
2030
+ M.description && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__desc", children: M.description })
2019
2031
  ] })
2020
2032
  ]
2021
2033
  },
2022
- S.id
2034
+ M.id
2023
2035
  );
2024
2036
  }),
2025
- w.length === 0 && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__empty", children: n("paymentMethodSelector.noMethodsAvailable", "No methods available.") })
2037
+ v.length === 0 && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__empty", children: n("paymentMethodSelector.noMethodsAvailable", "No methods available.") })
2026
2038
  ]
2027
2039
  }
2028
2040
  )
@@ -2042,7 +2054,7 @@ const fr = /* @__PURE__ */ se(
2042
2054
  credentials: {},
2043
2055
  enabledMethods: []
2044
2056
  }, gr = /* @__PURE__ */ se(function(e, r) {
2045
- const { t: n } = pe(), {
2057
+ const { t: n } = oe(), {
2046
2058
  value: a,
2047
2059
  defaultValue: i,
2048
2060
  onChange: d,
@@ -2050,69 +2062,69 @@ const fr = /* @__PURE__ */ se(
2050
2062
  onTestConnection: o,
2051
2063
  showWebhookUrl: l = !0,
2052
2064
  baseUrl: y,
2053
- readOnly: v = !1,
2054
- testLabel: f = "Test connection",
2065
+ readOnly: N = !1,
2066
+ testLabel: b = n("paymentProviderConfig.testConnection", "Test connection"),
2055
2067
  tutorial: u,
2056
- className: m,
2057
- style: g,
2058
- id: N,
2059
- accessMode: p,
2060
- "data-testid": D
2061
- } = e, [_, w] = Pe({
2068
+ className: f,
2069
+ style: h,
2070
+ id: w,
2071
+ accessMode: x,
2072
+ "data-testid": m
2073
+ } = e, [g, v] = Me({
2062
2074
  value: a,
2063
2075
  defaultValue: i,
2064
2076
  fallbackValue: Jt,
2065
2077
  onChange: d,
2066
2078
  componentName: "NicePaymentProviderConfig"
2067
- }), U = _e(), [G, M] = z(/* @__PURE__ */ new Set()), [S, $] = z(!1), [A, W] = z(null), O = K(() => s ? s.map((h) => we[h]).filter((h) => !!h) : Kt, [s]), k = we[_.providerId];
2068
- if (p === "hidden")
2079
+ }), S = _e(), [A, P] = H(/* @__PURE__ */ new Set()), [M, q] = H(!1), [I, W] = H(null), B = K(() => s ? s.map((p) => we[p]).filter((p) => !!p) : Ot, [s]), D = we[g.providerId];
2080
+ if (x === "hidden")
2069
2081
  return null;
2070
- const B = v || p === "disabled" || p === "readOnly", F = (h) => {
2071
- W(null), M(/* @__PURE__ */ new Set()), w({ providerId: h, mode: _.mode, credentials: {}, enabledMethods: [] });
2072
- }, Q = (h, q) => {
2073
- w({ ..._, credentials: { ..._.credentials, [h]: q } });
2074
- }, ce = (h) => {
2075
- const q = new Set(_.enabledMethods ?? []);
2076
- q.has(h) ? q.delete(h) : q.add(h), w({ ..._, enabledMethods: [...q] });
2077
- }, H = (h) => {
2078
- M((q) => {
2079
- const j = new Set(q);
2080
- return j.has(h) ? j.delete(h) : j.add(h), j;
2082
+ const T = N || x === "disabled" || x === "readOnly", O = (p) => {
2083
+ W(null), P(/* @__PURE__ */ new Set()), v({ providerId: p, mode: g.mode, credentials: {}, enabledMethods: [] });
2084
+ }, X = (p, F) => {
2085
+ v({ ...g, credentials: { ...g.credentials, [p]: F } });
2086
+ }, ne = (p) => {
2087
+ const F = new Set(g.enabledMethods ?? []);
2088
+ F.has(p) ? F.delete(p) : F.add(p), v({ ...g, enabledMethods: [...F] });
2089
+ }, Y = (p) => {
2090
+ P((F) => {
2091
+ const z = new Set(F);
2092
+ return z.has(p) ? z.delete(p) : z.add(p), z;
2081
2093
  });
2082
- }, te = async () => {
2094
+ }, Z = async () => {
2083
2095
  if (o) {
2084
- $(!0), W(null);
2096
+ q(!0), W(null);
2085
2097
  try {
2086
- W(await o(_));
2087
- } catch (h) {
2088
- W({ ok: !1, message: h instanceof Error ? h.message : String(h) });
2098
+ W(await o(g));
2099
+ } catch (p) {
2100
+ W({ ok: !1, message: p instanceof Error ? p.message : String(p) });
2089
2101
  } finally {
2090
- $(!1);
2102
+ q(!1);
2091
2103
  }
2092
2104
  }
2093
- }, J = k != null && k.webhookPath ? `${(y ?? "").replace(/\/$/, "")}${k.webhookPath}` : "", T = (k == null ? void 0 : k.supportedCurrencies) === "*" ? "All currencies" : ((k == null ? void 0 : k.supportedCurrencies) ?? []).join(", "), E = "nice-payment-provider-config" + (m ? ` ${m}` : ""), P = ((k == null ? void 0 : k.credentials) ?? []).filter(
2094
- (h) => !h.testOnly || _.mode === "test"
2105
+ }, Q = D != null && D.webhookPath ? `${(y ?? "").replace(/\/$/, "")}${D.webhookPath}` : "", ae = (D == null ? void 0 : D.supportedCurrencies) === "*" ? n("paymentProviderConfig.allCurrencies", "All currencies") : ((D == null ? void 0 : D.supportedCurrencies) ?? []).join(", "), E = "nice-payment-provider-config" + (f ? ` ${f}` : ""), k = ((D == null ? void 0 : D.credentials) ?? []).filter(
2106
+ (p) => !p.testOnly || g.mode === "test"
2095
2107
  );
2096
- return /* @__PURE__ */ b("div", { ref: r, id: N, className: E, style: g, "data-testid": D, children: [
2108
+ return /* @__PURE__ */ _("div", { ref: r, id: w, className: E, style: h, "data-testid": m, children: [
2097
2109
  u && /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__tutorial", children: /* @__PURE__ */ c(st, { steps: ot(u, Zt) }) }),
2098
- /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__row", children: [
2099
- /* @__PURE__ */ b("label", { className: "nice-payment-provider-config__field", children: [
2110
+ /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__row", children: [
2111
+ /* @__PURE__ */ _("label", { className: "nice-payment-provider-config__field", children: [
2100
2112
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.provider", "Provider") }),
2101
- /* @__PURE__ */ b(
2113
+ /* @__PURE__ */ _(
2102
2114
  "select",
2103
2115
  {
2104
2116
  className: "nice-payment-provider-config__select",
2105
- value: _.providerId,
2106
- disabled: B,
2107
- onChange: (h) => F(h.target.value),
2117
+ value: g.providerId,
2118
+ disabled: T,
2119
+ onChange: (p) => O(p.target.value),
2108
2120
  children: [
2109
- /* @__PURE__ */ c("option", { value: "", children: "— select provider —" }),
2110
- O.map((h) => /* @__PURE__ */ c("option", { value: h.id, children: h.name }, h.id))
2121
+ /* @__PURE__ */ c("option", { value: "", children: n("paymentProviderConfig.selectProvider", "— select provider —") }),
2122
+ B.map((p) => /* @__PURE__ */ c("option", { value: p.id, children: p.name }, p.id))
2111
2123
  ]
2112
2124
  }
2113
2125
  )
2114
2126
  ] }),
2115
- (k == null ? void 0 : k.hasTestMode) && /* @__PURE__ */ b(
2127
+ (D == null ? void 0 : D.hasTestMode) && /* @__PURE__ */ _(
2116
2128
  "div",
2117
2129
  {
2118
2130
  className: "nice-payment-provider-config__mode",
@@ -2123,9 +2135,9 @@ const fr = /* @__PURE__ */ se(
2123
2135
  "button",
2124
2136
  {
2125
2137
  type: "button",
2126
- className: "nice-payment-provider-config__mode-btn" + (_.mode === "test" ? " nice-payment-provider-config__mode-btn--active" : ""),
2127
- onClick: () => w({ ..._, mode: "test" }),
2128
- disabled: B,
2138
+ className: "nice-payment-provider-config__mode-btn" + (g.mode === "test" ? " nice-payment-provider-config__mode-btn--active" : ""),
2139
+ onClick: () => v({ ...g, mode: "test" }),
2140
+ disabled: T,
2129
2141
  children: n("paymentProviderConfig.test", "Test")
2130
2142
  }
2131
2143
  ),
@@ -2133,9 +2145,9 @@ const fr = /* @__PURE__ */ se(
2133
2145
  "button",
2134
2146
  {
2135
2147
  type: "button",
2136
- className: "nice-payment-provider-config__mode-btn" + (_.mode === "live" ? " nice-payment-provider-config__mode-btn--active" : ""),
2137
- onClick: () => w({ ..._, mode: "live" }),
2138
- disabled: B,
2148
+ className: "nice-payment-provider-config__mode-btn" + (g.mode === "live" ? " nice-payment-provider-config__mode-btn--active" : ""),
2149
+ onClick: () => v({ ...g, mode: "live" }),
2150
+ disabled: T,
2139
2151
  children: n("paymentProviderConfig.live", "Live")
2140
2152
  }
2141
2153
  )
@@ -2143,84 +2155,84 @@ const fr = /* @__PURE__ */ se(
2143
2155
  }
2144
2156
  )
2145
2157
  ] }),
2146
- k && /* @__PURE__ */ b(it, { children: [
2147
- /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__meta", children: [
2148
- /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__badge", children: k.type }),
2149
- /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__currencies", children: T })
2158
+ D && /* @__PURE__ */ _(it, { children: [
2159
+ /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__meta", children: [
2160
+ /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__badge", children: D.type }),
2161
+ /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__currencies", children: ae })
2150
2162
  ] }),
2151
- /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__credentials", children: P.map((h) => {
2152
- const q = `${U}-${h.key}`, j = h.secret, C = G.has(h.key);
2153
- return /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__field", children: [
2154
- /* @__PURE__ */ b("label", { className: "nice-payment-provider-config__field-label", htmlFor: q, children: [
2155
- h.label,
2156
- h.required && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__required", children: " *" })
2163
+ /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__credentials", children: k.map((p) => {
2164
+ const F = `${S}-${p.key}`, z = p.secret, C = A.has(p.key);
2165
+ return /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__field", children: [
2166
+ /* @__PURE__ */ _("label", { className: "nice-payment-provider-config__field-label", htmlFor: F, children: [
2167
+ p.label,
2168
+ p.required && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__required", children: " *" })
2157
2169
  ] }),
2158
- /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__input-wrap", children: [
2170
+ /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__input-wrap", children: [
2159
2171
  /* @__PURE__ */ c(
2160
2172
  "input",
2161
2173
  {
2162
- id: q,
2163
- type: j && !C ? "password" : "text",
2174
+ id: F,
2175
+ type: z && !C ? "password" : "text",
2164
2176
  className: "nice-payment-provider-config__input",
2165
- value: _.credentials[h.key] ?? "",
2166
- readOnly: B,
2167
- autoComplete: j ? "new-password" : "off",
2168
- onChange: (L) => Q(h.key, L.target.value)
2177
+ value: g.credentials[p.key] ?? "",
2178
+ readOnly: T,
2179
+ autoComplete: z ? "new-password" : "off",
2180
+ onChange: (L) => X(p.key, L.target.value)
2169
2181
  }
2170
2182
  ),
2171
- j && /* @__PURE__ */ c(
2183
+ z && /* @__PURE__ */ c(
2172
2184
  "button",
2173
2185
  {
2174
2186
  type: "button",
2175
2187
  className: "nice-payment-provider-config__reveal",
2176
- onClick: () => H(h.key),
2177
- "aria-label": C ? "Hide" : "Reveal",
2188
+ onClick: () => Y(p.key),
2189
+ "aria-label": C ? n("paymentProviderConfig.hide", "Hide") : n("paymentProviderConfig.reveal", "Reveal"),
2178
2190
  "aria-pressed": C,
2179
- children: /* @__PURE__ */ c(Me, { name: C ? "eye-off" : "eye", size: 14 })
2191
+ children: /* @__PURE__ */ c(Pe, { name: C ? "eye-off" : "eye", size: 14 })
2180
2192
  }
2181
2193
  )
2182
2194
  ] }),
2183
- h.help && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__help", children: h.help })
2184
- ] }, h.key);
2195
+ p.help && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__help", children: p.help })
2196
+ ] }, p.key);
2185
2197
  }) }),
2186
- k.supportedMethods && k.supportedMethods.length > 0 && /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__methods", children: [
2198
+ D.supportedMethods && D.supportedMethods.length > 0 && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__methods", children: [
2187
2199
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.enabledMethods", "Enabled methods") }),
2188
- /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__method-list", children: k.supportedMethods.map((h) => /* @__PURE__ */ b("label", { className: "nice-payment-provider-config__method", children: [
2200
+ /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__method-list", children: D.supportedMethods.map((p) => /* @__PURE__ */ _("label", { className: "nice-payment-provider-config__method", children: [
2189
2201
  /* @__PURE__ */ c(
2190
2202
  "input",
2191
2203
  {
2192
2204
  type: "checkbox",
2193
- checked: (_.enabledMethods ?? []).includes(h),
2194
- disabled: B,
2195
- onChange: () => ce(h)
2205
+ checked: (g.enabledMethods ?? []).includes(p),
2206
+ disabled: T,
2207
+ onChange: () => ne(p)
2196
2208
  }
2197
2209
  ),
2198
- h
2199
- ] }, h)) })
2210
+ p
2211
+ ] }, p)) })
2200
2212
  ] }),
2201
- l && k.webhookPath && /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__field", children: [
2213
+ l && D.webhookPath && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__field", children: [
2202
2214
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.webhookUrl", "Webhook URL") }),
2203
- /* @__PURE__ */ c("code", { className: "nice-payment-provider-config__webhook", children: J })
2215
+ /* @__PURE__ */ c("code", { className: "nice-payment-provider-config__webhook", children: Q })
2204
2216
  ] }),
2205
- o && /* @__PURE__ */ b("div", { className: "nice-payment-provider-config__test", children: [
2217
+ o && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__test", children: [
2206
2218
  /* @__PURE__ */ c(
2207
2219
  "button",
2208
2220
  {
2209
2221
  type: "button",
2210
2222
  className: "nice-payment-provider-config__test-btn",
2211
- onClick: () => void te(),
2212
- disabled: B || S,
2213
- children: S ? "Testing…" : f
2223
+ onClick: () => void Z(),
2224
+ disabled: T || M,
2225
+ children: M ? n("paymentProviderConfig.testing", "Testing…") : b
2214
2226
  }
2215
2227
  ),
2216
- A && /* @__PURE__ */ b(
2228
+ I && /* @__PURE__ */ _(
2217
2229
  "span",
2218
2230
  {
2219
- className: "nice-payment-provider-config__test-result nice-payment-provider-config__test-result--" + (A.ok ? "ok" : "error"),
2231
+ className: "nice-payment-provider-config__test-result nice-payment-provider-config__test-result--" + (I.ok ? "ok" : "error"),
2220
2232
  children: [
2221
- /* @__PURE__ */ c(Me, { name: A.ok ? "check" : "close", size: 14 }),
2233
+ /* @__PURE__ */ c(Pe, { name: I.ok ? "check" : "close", size: 14 }),
2222
2234
  " ",
2223
- A.message ?? (A.ok ? "OK" : "Failed")
2235
+ I.message ?? (I.ok ? n("paymentProviderConfig.ok", "OK") : n("paymentProviderConfig.failed", "Failed"))
2224
2236
  ]
2225
2237
  }
2226
2238
  )
@@ -2236,14 +2248,14 @@ export {
2236
2248
  vt as MockPaymentProcessor,
2237
2249
  fe as NICE_CURRENCY_CATALOG,
2238
2250
  pr as NICE_CURRENCY_CODES,
2239
- Et as NICE_PAYMENT_PROCESSORS,
2240
- Kt as NICE_PAYMENT_PROVIDER_LIST,
2251
+ Tt as NICE_PAYMENT_PROCESSORS,
2252
+ Ot as NICE_PAYMENT_PROVIDER_LIST,
2241
2253
  we as NICE_PAYMENT_PROVIDER_PROFILES,
2242
2254
  bt as NbpRatesProvider,
2243
2255
  Lt as NiceCreditCardInput,
2244
2256
  br as NiceCurrencyConverter,
2245
2257
  Ge as NiceCurrencySelector,
2246
- Ke as NiceMoney,
2258
+ Oe as NiceMoney,
2247
2259
  Ze as NiceMoneyInput,
2248
2260
  yr as NicePaymentForm,
2249
2261
  _r as NicePaymentMethodSelector,
@@ -2261,7 +2273,7 @@ export {
2261
2273
  lr as createOpenExchangeRatesProvider,
2262
2274
  ke as detectCardBrand,
2263
2275
  be as expectedCvcLength,
2264
- ne as findCurrency,
2276
+ re as findCurrency,
2265
2277
  ur as findPaymentProviderProfile,
2266
2278
  mt as formatCardNumber,
2267
2279
  ie as formatMoney,
@@ -2273,27 +2285,27 @@ export {
2273
2285
  kt as makeAdyenAdapter,
2274
2286
  xt as makeAutopayAdapter,
2275
2287
  Rt as makeBlikAdapter,
2276
- Mt as makeBraintreeAdapter,
2288
+ Pt as makeBraintreeAdapter,
2277
2289
  At as makeCoinbaseCommerceAdapter,
2278
2290
  Ut as makeKlarnaAdapter,
2279
2291
  Dt as makeMollieAdapter,
2280
2292
  wt as makePayPalAdapter,
2281
- It as makePayUAdapter,
2282
- St as makePrzelewy24Adapter,
2283
- Pt as makeRazorpayAdapter,
2293
+ St as makePayUAdapter,
2294
+ It as makePrzelewy24Adapter,
2295
+ Mt as makeRazorpayAdapter,
2284
2296
  Ct as makeSquareAdapter,
2285
2297
  Nt as makeStripeAdapter,
2286
2298
  $t as makeTpayAdapter,
2287
2299
  cr as maskCardNumber,
2288
- Ie as multiplyMoney,
2300
+ Se as multiplyMoney,
2289
2301
  ar as negateMoney,
2290
2302
  je as normaliseExpiry,
2291
2303
  ut as parseMoney,
2292
2304
  er as registerCurrency,
2293
2305
  dt as subtractMoney,
2294
- ae as toMoney,
2295
- Se as useNiceExchangeRate,
2306
+ ce as toMoney,
2307
+ Ie as useNiceExchangeRate,
2296
2308
  mr as useNiceMoney,
2297
- Ot as useNicePayment,
2309
+ Kt as useNicePayment,
2298
2310
  qe as validateCreditCard
2299
2311
  };