@invoice-sdk/widget 1.84.1 → 1.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ var $B = (g, A, E) => A in g ? BQ(g, A, { enumerable: !0, configurable: !0, writ
9
9
  for (var E of Tg(A))
10
10
  gC.call(A, E) && $B(g, E, A[E]);
11
11
  return g;
12
- }, bA = (g, A) => CQ(g, QQ(A));
12
+ }, jA = (g, A) => CQ(g, QQ(A));
13
13
  var Og = (g, A) => {
14
14
  var E = {};
15
15
  for (var Q in g)
@@ -35,7 +35,7 @@ var V = (g, A, E) => new Promise((Q, B) => {
35
35
  }, I = (n) => n.done ? Q(n.value) : Promise.resolve(n.value).then(C, t);
36
36
  I((E = E.apply(g, A)).next());
37
37
  });
38
- import { t as a, g as wB, a as EQ, b as IQ, G as nQ, C as tQ, c as eB, d as ag, e as hQ, f as cQ, h as Yg, O as zC, s as Qg, i as aB, j as wQ, k as eQ, l as aQ, m as oQ, n as DQ, o as uQ, v as iQ, r as NC, u as bC } from "./index-B3zerqp-.js";
38
+ import { t as a, g as wB, a as EQ, b as IQ, G as nQ, C as tQ, c as eB, d as ag, e as hQ, f as cQ, h as Yg, O as zC, s as Qg, i as aB, j as wQ, k as eQ, l as aQ, m as oQ, n as DQ, o as uQ, v as iQ, r as NC, u as bC } from "./index-BuUQi4Zw.js";
39
39
  import { g as jC } from "./_commonjsHelpers-bAxELxBV.js";
40
40
  function BC({ steps: g = [], currentStep: A = 1 } = {}) {
41
41
  const E = document.createElement("div");
@@ -932,12 +932,12 @@ const vQ = ({
932
932
  typeof u != "string" || u.length !== 7 || /^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(u) && (q.value = u[0], m.value = u[1], r.value = u.slice(2, 4), R.value = u[4], z.value = u.slice(5, 7), w());
933
933
  }
934
934
  };
935
- }, LA = EQ.create({
935
+ }, zA = EQ.create({
936
936
  headers: {
937
937
  Accept: "application/json"
938
938
  }
939
939
  });
940
- LA.interceptors.request.use(
940
+ zA.interceptors.request.use(
941
941
  function(g) {
942
942
  return g.baseURL = wB().invoiceHubBaseUrl, g;
943
943
  },
@@ -945,12 +945,12 @@ LA.interceptors.request.use(
945
945
  return Promise.reject(g);
946
946
  }
947
947
  );
948
- IQ(LA, {});
948
+ IQ(zA, {});
949
949
  function MQ(g) {
950
950
  return V(this, null, function* () {
951
951
  if (!g)
952
952
  throw new Error("Tax code is required to fetch tax information.");
953
- return yield LA.get(nQ, {
953
+ return yield zA.get(nQ, {
954
954
  params: {
955
955
  tax: g
956
956
  }
@@ -961,7 +961,7 @@ function TQ(g, A) {
961
961
  return V(this, null, function* () {
962
962
  if (!A)
963
963
  throw new Error("Tax code is required to check new customer.");
964
- return (yield LA.get(tQ, {
964
+ return (yield zA.get(tQ, {
965
965
  params: {
966
966
  provider: g,
967
967
  taxCode: A
@@ -1136,15 +1136,15 @@ function xQ() {
1136
1136
  return e.isDisabled && w.push("is-disabled"), e.isToday && w.push("is-today"), e.isSelected && (w.push("is-selected"), u = "true"), e.hasEvent && w.push("has-event"), e.isInRange && w.push("is-inrange"), e.isStartRange && w.push("is-startrange"), e.isEndRange && w.push("is-endrange"), '<td data-day="' + e.day + '" class="' + w.join(" ") + '" aria-selected="' + u + '"><button class="pika-button pika-day" type="button" data-pika-year="' + e.year + '" data-pika-month="' + e.month + '" data-pika-day="' + e.day + '">' + e.day + "</button></td>";
1137
1137
  }, X = function(e, w) {
1138
1138
  e.setHours(0, 0, 0, 0);
1139
- var u = e.getDate(), l = e.getDay(), L = w, N = L - 1, b = 7, IA = function(cA) {
1140
- return (cA + b - 1) % b;
1139
+ var u = e.getDate(), l = e.getDay(), L = w, b = L - 1, N = 7, IA = function(cA) {
1140
+ return (cA + N - 1) % N;
1141
1141
  };
1142
- e.setDate(u + N - IA(l));
1143
- var S = new Date(e.getFullYear(), 0, L), U = 1440 * 60 * 1e3, nA = (e.getTime() - S.getTime()) / U, aA = 1 + Math.round((nA - N + IA(S.getDay())) / b);
1142
+ e.setDate(u + b - IA(l));
1143
+ var S = new Date(e.getFullYear(), 0, L), U = 1440 * 60 * 1e3, nA = (e.getTime() - S.getTime()) / U, aA = 1 + Math.round((nA - b + IA(S.getDay())) / N);
1144
1144
  return aA;
1145
1145
  }, k = function(e, w, u, l) {
1146
- var L = new Date(u, w, e), N = Q ? E(L).isoWeek() : X(L, l);
1147
- return '<td class="pika-week">' + N + "</td>";
1146
+ var L = new Date(u, w, e), b = Q ? E(L).isoWeek() : X(L, l);
1147
+ return '<td class="pika-week">' + b + "</td>";
1148
1148
  }, R = function(e, w, u, l) {
1149
1149
  return '<tr class="pika-row' + (u ? " pick-whole-week" : "") + (l ? " is-selected" : "") + '">' + (w ? e.reverse() : e).join("") + "</tr>";
1150
1150
  }, T = function(e) {
@@ -1154,12 +1154,12 @@ function xQ() {
1154
1154
  for (e.showWeekNumber && u.push("<th></th>"), w = 0; w < 7; w++)
1155
1155
  u.push('<th scope="col"><abbr title="' + r(e, w) + '">' + r(e, w, !0) + "</abbr></th>");
1156
1156
  return "<thead><tr>" + (e.isRTL ? u.reverse() : u).join("") + "</tr></thead>";
1157
- }, y = function(e, w, u, l, L, N) {
1158
- var b, IA, S, U = e._o, nA = u === U.minYear, aA = u === U.maxYear, cA = '<div id="' + N + '" class="pika-title" role="heading" aria-live="assertive">', YA, JA, kA = !0, iA = !0;
1159
- for (S = [], b = 0; b < 12; b++)
1160
- S.push('<option value="' + (u === L ? b - w : 12 + b - w) + '"' + (b === l ? ' selected="selected"' : "") + (nA && b < U.minMonth || aA && b > U.maxMonth ? ' disabled="disabled"' : "") + ">" + U.i18n.months[b] + "</option>");
1161
- for (YA = '<div class="pika-label">' + U.i18n.months[l] + '<select class="pika-select pika-select-month" tabindex="-1">' + S.join("") + "</select></div>", D(U.yearRange) ? (b = U.yearRange[0], IA = U.yearRange[1] + 1) : (b = u - U.yearRange, IA = 1 + u + U.yearRange), S = []; b < IA && b <= U.maxYear; b++)
1162
- b >= U.minYear && S.push('<option value="' + b + '"' + (b === u ? ' selected="selected"' : "") + ">" + b + "</option>");
1157
+ }, y = function(e, w, u, l, L, b) {
1158
+ var N, IA, S, U = e._o, nA = u === U.minYear, aA = u === U.maxYear, cA = '<div id="' + b + '" class="pika-title" role="heading" aria-live="assertive">', YA, JA, kA = !0, iA = !0;
1159
+ for (S = [], N = 0; N < 12; N++)
1160
+ S.push('<option value="' + (u === L ? N - w : 12 + N - w) + '"' + (N === l ? ' selected="selected"' : "") + (nA && N < U.minMonth || aA && N > U.maxMonth ? ' disabled="disabled"' : "") + ">" + U.i18n.months[N] + "</option>");
1161
+ for (YA = '<div class="pika-label">' + U.i18n.months[l] + '<select class="pika-select pika-select-month" tabindex="-1">' + S.join("") + "</select></div>", D(U.yearRange) ? (N = U.yearRange[0], IA = U.yearRange[1] + 1) : (N = u - U.yearRange, IA = 1 + u + U.yearRange), S = []; N < IA && N <= U.maxYear; N++)
1162
+ N >= U.minYear && S.push('<option value="' + N + '"' + (N === u ? ' selected="selected"' : "") + ">" + N + "</option>");
1163
1163
  return JA = '<div class="pika-label">' + u + U.yearSuffix + '<select class="pika-select pika-select-year" tabindex="-1">' + S.join("") + "</select></div>", U.showMonthAfterYear ? cA += JA + YA : cA += YA + JA, nA && (l === 0 || U.minMonth >= l) && (kA = !1), aA && (l === 11 || U.maxMonth <= l) && (iA = !1), w === 0 && (cA += '<button class="pika-prev' + (kA ? "" : " is-disabled") + '" type="button">' + U.i18n.previousMonth + "</button>"), w === e._o.numberOfMonths - 1 && (cA += '<button class="pika-next' + (iA ? "" : " is-disabled") + '" type="button">' + U.i18n.nextMonth + "</button>"), cA += "</div>";
1164
1164
  }, K = function(e, w, u) {
1165
1165
  return '<table cellpadding="0" cellspacing="0" class="pika-table" role="grid" aria-labelledby="' + u + '">' + Y(e) + T(w) + "</table>";
@@ -1168,11 +1168,11 @@ function xQ() {
1168
1168
  w._onMouseDown = function(L) {
1169
1169
  if (w._v) {
1170
1170
  L = L || window.event;
1171
- var N = L.target || L.srcElement;
1172
- if (N)
1173
- if (h(N, "is-disabled") || (h(N, "pika-button") && !h(N, "is-empty") && !h(N.parentNode, "is-disabled") ? (w.setDate(new Date(N.getAttribute("data-pika-year"), N.getAttribute("data-pika-month"), N.getAttribute("data-pika-day"))), u.bound && t(function() {
1171
+ var b = L.target || L.srcElement;
1172
+ if (b)
1173
+ if (h(b, "is-disabled") || (h(b, "pika-button") && !h(b, "is-empty") && !h(b.parentNode, "is-disabled") ? (w.setDate(new Date(b.getAttribute("data-pika-year"), b.getAttribute("data-pika-month"), b.getAttribute("data-pika-day"))), u.bound && t(function() {
1174
1174
  w.hide(), u.blurFieldOnSelect && u.field && u.field.blur();
1175
- }, 100)) : h(N, "pika-prev") ? w.prevMonth() : h(N, "pika-next") && w.nextMonth()), h(N, "pika-select"))
1175
+ }, 100)) : h(b, "pika-prev") ? w.prevMonth() : h(b, "pika-next") && w.nextMonth()), h(b, "pika-select"))
1176
1176
  w._c = !0;
1177
1177
  else if (L.preventDefault)
1178
1178
  L.preventDefault();
@@ -1181,8 +1181,8 @@ function xQ() {
1181
1181
  }
1182
1182
  }, w._onChange = function(L) {
1183
1183
  L = L || window.event;
1184
- var N = L.target || L.srcElement;
1185
- N && (h(N, "pika-select-month") ? w.gotoMonth(N.value) : h(N, "pika-select-year") && w.gotoYear(N.value));
1184
+ var b = L.target || L.srcElement;
1185
+ b && (h(b, "pika-select-month") ? w.gotoMonth(b.value) : h(b, "pika-select-year") && w.gotoYear(b.value));
1186
1186
  }, w._onKeyChange = function(L) {
1187
1187
  if (L = L || window.event, w.isVisible())
1188
1188
  switch (L.keyCode) {
@@ -1216,8 +1216,8 @@ function xQ() {
1216
1216
  } else
1217
1217
  return new Date(Date.parse(u.field.value));
1218
1218
  }, w._onInputChange = function(L) {
1219
- var N;
1220
- L.firedBy !== w && (N = w._parseFieldValue(), s(N) && w.setDate(N), w._v || w.show());
1219
+ var b;
1220
+ L.firedBy !== w && (b = w._parseFieldValue(), s(b) && w.setDate(b), w._v || w.show());
1221
1221
  }, w._onInputFocus = function() {
1222
1222
  w.show();
1223
1223
  }, w._onInputClick = function() {
@@ -1233,14 +1233,14 @@ function xQ() {
1233
1233
  }, 50)), w._c = !1;
1234
1234
  }, w._onClick = function(L) {
1235
1235
  L = L || window.event;
1236
- var N = L.target || L.srcElement, b = N;
1237
- if (N) {
1238
- !B && h(N, "pika-select") && (N.onchange || (N.setAttribute("onchange", "return;"), I(N, "change", w._onChange)));
1236
+ var b = L.target || L.srcElement, N = b;
1237
+ if (b) {
1238
+ !B && h(b, "pika-select") && (b.onchange || (b.setAttribute("onchange", "return;"), I(b, "change", w._onChange)));
1239
1239
  do
1240
- if (h(b, "pika-single") || b === u.trigger)
1240
+ if (h(N, "pika-single") || N === u.trigger)
1241
1241
  return;
1242
- while (b = b.parentNode);
1243
- w._v && N !== u.trigger && b !== u.trigger && w.hide();
1242
+ while (N = N.parentNode);
1243
+ w._v && b !== u.trigger && N !== u.trigger && w.hide();
1244
1244
  }
1245
1245
  }, w.el = C.createElement("div"), w.el.className = "pika-single" + (u.isRTL ? " is-rtl" : "") + (u.theme ? " " + u.theme : ""), I(w.el, "mousedown", w._onMouseDown, !0), I(w.el, "touchend", w._onMouseDown, !0), I(w.el, "change", w._onChange), u.keyboardInput && I(C, "keydown", w._onKeyChange), u.field && (u.container ? u.container.appendChild(w.el) : u.bound ? C.body.appendChild(w.el) : u.field.parentNode.insertBefore(w.el, u.field.nextSibling), I(u.field, "change", w._onInputChange), u.defaultDate || (u.defaultDate = w._parseFieldValue(), u.setDefaultDate = !0));
1246
1246
  var l = u.defaultDate;
@@ -1376,40 +1376,40 @@ function xQ() {
1376
1376
  */
1377
1377
  draw: function(e) {
1378
1378
  if (!(!this._v && !e)) {
1379
- var w = this._o, u = w.minYear, l = w.maxYear, L = w.minMonth, N = w.maxMonth, b = "", IA;
1380
- this._y <= u && (this._y = u, !isNaN(L) && this._m < L && (this._m = L)), this._y >= l && (this._y = l, !isNaN(N) && this._m > N && (this._m = N));
1379
+ var w = this._o, u = w.minYear, l = w.maxYear, L = w.minMonth, b = w.maxMonth, N = "", IA;
1380
+ this._y <= u && (this._y = u, !isNaN(L) && this._m < L && (this._m = L)), this._y >= l && (this._y = l, !isNaN(b) && this._m > b && (this._m = b));
1381
1381
  for (var S = 0; S < w.numberOfMonths; S++)
1382
- IA = "pika-title-" + Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 2), b += '<div class="pika-lendar">' + y(this, S, this.calendars[S].year, this.calendars[S].month, this.calendars[0].year, IA) + this.render(this.calendars[S].year, this.calendars[S].month, IA) + "</div>";
1383
- this.el.innerHTML = b, w.bound && w.field.type !== "hidden" && t(function() {
1382
+ IA = "pika-title-" + Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 2), N += '<div class="pika-lendar">' + y(this, S, this.calendars[S].year, this.calendars[S].month, this.calendars[0].year, IA) + this.render(this.calendars[S].year, this.calendars[S].month, IA) + "</div>";
1383
+ this.el.innerHTML = N, w.bound && w.field.type !== "hidden" && t(function() {
1384
1384
  w.trigger.focus();
1385
1385
  }, 1), typeof this._o.onDraw == "function" && this._o.onDraw(this), w.bound && w.field.setAttribute("aria-label", w.ariaLabel);
1386
1386
  }
1387
1387
  },
1388
1388
  adjustPosition: function() {
1389
- var e, w, u, l, L, N, b, IA, S, U, nA, aA;
1389
+ var e, w, u, l, L, b, N, IA, S, U, nA, aA;
1390
1390
  if (!this._o.container) {
1391
- if (this.el.style.position = "absolute", e = this._o.trigger, w = e, u = this.el.offsetWidth, l = this.el.offsetHeight, L = window.innerWidth || C.documentElement.clientWidth, N = window.innerHeight || C.documentElement.clientHeight, b = window.pageYOffset || C.body.scrollTop || C.documentElement.scrollTop, nA = !0, aA = !0, typeof e.getBoundingClientRect == "function")
1391
+ if (this.el.style.position = "absolute", e = this._o.trigger, w = e, u = this.el.offsetWidth, l = this.el.offsetHeight, L = window.innerWidth || C.documentElement.clientWidth, b = window.innerHeight || C.documentElement.clientHeight, N = window.pageYOffset || C.body.scrollTop || C.documentElement.scrollTop, nA = !0, aA = !0, typeof e.getBoundingClientRect == "function")
1392
1392
  U = e.getBoundingClientRect(), IA = U.left + window.pageXOffset, S = U.bottom + window.pageYOffset;
1393
1393
  else
1394
1394
  for (IA = w.offsetLeft, S = w.offsetTop + w.offsetHeight; w = w.offsetParent; )
1395
1395
  IA += w.offsetLeft, S += w.offsetTop;
1396
- (this._o.reposition && IA + u > L || this._o.position.indexOf("right") > -1 && IA - u + e.offsetWidth > 0) && (IA = IA - u + e.offsetWidth, nA = !1), (this._o.reposition && S + l > N + b || this._o.position.indexOf("top") > -1 && S - l - e.offsetHeight > 0) && (S = S - l - e.offsetHeight, aA = !1), this.el.style.left = IA + "px", this.el.style.top = S + "px", i(this.el, nA ? "left-aligned" : "right-aligned"), i(this.el, aA ? "bottom-aligned" : "top-aligned"), c(this.el, nA ? "right-aligned" : "left-aligned"), c(this.el, aA ? "top-aligned" : "bottom-aligned");
1396
+ (this._o.reposition && IA + u > L || this._o.position.indexOf("right") > -1 && IA - u + e.offsetWidth > 0) && (IA = IA - u + e.offsetWidth, nA = !1), (this._o.reposition && S + l > b + N || this._o.position.indexOf("top") > -1 && S - l - e.offsetHeight > 0) && (S = S - l - e.offsetHeight, aA = !1), this.el.style.left = IA + "px", this.el.style.top = S + "px", i(this.el, nA ? "left-aligned" : "right-aligned"), i(this.el, aA ? "bottom-aligned" : "top-aligned"), c(this.el, nA ? "right-aligned" : "left-aligned"), c(this.el, aA ? "top-aligned" : "bottom-aligned");
1397
1397
  }
1398
1398
  },
1399
1399
  /**
1400
1400
  * render HTML for a particular month
1401
1401
  */
1402
1402
  render: function(e, w, u) {
1403
- var l = this._o, L = /* @__PURE__ */ new Date(), N = J(e, w), b = new Date(e, w, 1).getDay(), IA = [], S = [];
1404
- H(L), l.firstDay > 0 && (b -= l.firstDay, b < 0 && (b += 7));
1405
- for (var U = w === 0 ? 11 : w - 1, nA = w === 11 ? 0 : w + 1, aA = w === 0 ? e - 1 : e, cA = w === 11 ? e + 1 : e, YA = J(aA, U), JA = N + b, kA = JA; kA > 7; )
1403
+ var l = this._o, L = /* @__PURE__ */ new Date(), b = J(e, w), N = new Date(e, w, 1).getDay(), IA = [], S = [];
1404
+ H(L), l.firstDay > 0 && (N -= l.firstDay, N < 0 && (N += 7));
1405
+ for (var U = w === 0 ? 11 : w - 1, nA = w === 11 ? 0 : w + 1, aA = w === 0 ? e - 1 : e, cA = w === 11 ? e + 1 : e, YA = J(aA, U), JA = b + N, kA = JA; kA > 7; )
1406
1406
  kA -= 7;
1407
1407
  JA += 7 - kA;
1408
1408
  for (var iA = !1, rA = 0, FA = 0; rA < JA; rA++) {
1409
- var PA = new Date(e, w, 1 + (rA - b)), yA = s(this._d) ? P(PA, this._d) : !1, sg = P(PA, L), tg = l.events.indexOf(PA.toDateString()) !== -1, $A = rA < b || rA >= N + b, zA = 1 + (rA - b), hg = w, VA = e, Ag = l.startRange && P(l.startRange, PA), WA = l.endRange && P(l.endRange, PA), NA = l.startRange && l.endRange && l.startRange < PA && PA < l.endRange, KA = l.minDate && PA < l.minDate || l.maxDate && PA > l.maxDate || l.disableWeekends && q(PA) || l.disableDayFn && l.disableDayFn(PA);
1410
- $A && (rA < b ? (zA = YA + zA, hg = U, VA = aA) : (zA = zA - N, hg = nA, VA = cA));
1409
+ var PA = new Date(e, w, 1 + (rA - N)), yA = s(this._d) ? P(PA, this._d) : !1, sg = P(PA, L), tg = l.events.indexOf(PA.toDateString()) !== -1, $A = rA < N || rA >= b + N, NA = 1 + (rA - N), hg = w, VA = e, Ag = l.startRange && P(l.startRange, PA), WA = l.endRange && P(l.endRange, PA), bA = l.startRange && l.endRange && l.startRange < PA && PA < l.endRange, KA = l.minDate && PA < l.minDate || l.maxDate && PA > l.maxDate || l.disableWeekends && q(PA) || l.disableDayFn && l.disableDayFn(PA);
1410
+ $A && (rA < N ? (NA = YA + NA, hg = U, VA = aA) : (NA = NA - b, hg = nA, VA = cA));
1411
1411
  var UA = {
1412
- day: zA,
1412
+ day: NA,
1413
1413
  month: hg,
1414
1414
  year: VA,
1415
1415
  hasEvent: tg,
@@ -1419,11 +1419,11 @@ function xQ() {
1419
1419
  isEmpty: $A,
1420
1420
  isStartRange: Ag,
1421
1421
  isEndRange: WA,
1422
- isInRange: NA,
1422
+ isInRange: bA,
1423
1423
  showDaysInNextAndPreviousMonths: l.showDaysInNextAndPreviousMonths,
1424
1424
  enableSelectionDaysInNextAndPreviousMonths: l.enableSelectionDaysInNextAndPreviousMonths
1425
1425
  };
1426
- l.pickWholeWeek && yA && (iA = !0), S.push(M(UA)), ++FA === 7 && (l.showWeekNumber && S.unshift(k(rA - b, w, e, l.firstWeekOfYearMinDays)), IA.push(R(S, l.isRTL, l.pickWholeWeek, iA)), S = [], FA = 0, iA = !1);
1426
+ l.pickWholeWeek && yA && (iA = !0), S.push(M(UA)), ++FA === 7 && (l.showWeekNumber && S.unshift(k(rA - N, w, e, l.firstWeekOfYearMinDays)), IA.push(R(S, l.isRTL, l.pickWholeWeek, iA)), S = [], FA = 0, iA = !1);
1427
1427
  }
1428
1428
  return K(l, IA, u);
1429
1429
  },
@@ -1571,10 +1571,10 @@ function FQ() {
1571
1571
  KC(), mA && mA.parentNode && mA.parentNode.removeChild(mA), Dg && window.removeEventListener("resize", Dg), mA = null, Dg = null, ng = [];
1572
1572
  }
1573
1573
  const og = {
1574
- info: (g, A = {}) => Hg(g, bA(RA({}, A), { type: "info" })),
1575
- success: (g, A = {}) => Hg(g, bA(RA({}, A), { type: "success" })),
1576
- warning: (g, A = {}) => Hg(g, bA(RA({}, A), { type: "warning" })),
1577
- error: (g, A = {}) => Hg(g, bA(RA({}, A), { type: "error" })),
1574
+ info: (g, A = {}) => Hg(g, jA(RA({}, A), { type: "info" })),
1575
+ success: (g, A = {}) => Hg(g, jA(RA({}, A), { type: "success" })),
1576
+ warning: (g, A = {}) => Hg(g, jA(RA({}, A), { type: "warning" })),
1577
+ error: (g, A = {}) => Hg(g, jA(RA({}, A), { type: "error" })),
1578
1578
  clear: KC,
1579
1579
  destroy: FQ
1580
1580
  };
@@ -1876,7 +1876,7 @@ function pQ(n) {
1876
1876
  o.className = "wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";
1877
1877
  const h = document.createElement("form");
1878
1878
  h.className = "wgt:w-full wgt:max-w-[1072px] wgt:mx-auto wgt:space-y-4", h.addEventListener("submit", (G) => {
1879
- if (G.preventDefault(), !vA()) return;
1879
+ if (G.preventDefault(), !qA()) return;
1880
1880
  const O = hA();
1881
1881
  typeof g == "function" && g(O);
1882
1882
  }), o.appendChild(h);
@@ -2187,7 +2187,7 @@ function pQ(n) {
2187
2187
  ) : H.setError(null);
2188
2188
  }
2189
2189
  });
2190
- const N = dA({
2190
+ const b = dA({
2191
2191
  name: "invoiceSymbol",
2192
2192
  label: a("invoiceSymbol", "Ký hiệu hóa đơn"),
2193
2193
  required: !0,
@@ -2202,7 +2202,7 @@ function pQ(n) {
2202
2202
  k = vQ({
2203
2203
  initialValue: ((bB = A == null ? void 0 : A.eInvoiceRegistration) == null ? void 0 : bB.invoiceSymbol) || "1C25TYY",
2204
2204
  onChange: (G) => {
2205
- N.inputEl.value = G, $();
2205
+ b.inputEl.value = G, $();
2206
2206
  }
2207
2207
  }), R = document.createElement("input"), R.type = "checkbox", R.name = "hasUsedEInvoiceCB", R.className = "wgt:cursor-pointer", R.checked = (jB = A == null ? void 0 : A.eInvoiceRegistration) == null ? void 0 : jB.hasUsedEInvoice, R.addEventListener("change", (G) => {
2208
2208
  G.target.checked ? (W.appendChild(EA), W.appendChild(QA)) : (T.checked = !1, y.inputEl.value = "", y.setError(null), Y && (Y.inputEl.value = "", Y.setError(null), QA.contains(Y.container) && QA.removeChild(Y.container)), W.removeChild(EA), W.removeChild(QA));
@@ -2257,33 +2257,33 @@ function pQ(n) {
2257
2257
  );
2258
2258
  }
2259
2259
  });
2260
- let b = 0;
2260
+ let N = 0;
2261
2261
  function IA(G) {
2262
2262
  return V(this, null, function* () {
2263
- const O = ++b;
2263
+ const O = ++N;
2264
2264
  i.setError(null);
2265
2265
  try {
2266
2266
  const gA = yield MQ(G);
2267
- if (O !== b)
2267
+ if (O !== N)
2268
2268
  return;
2269
2269
  if (gA.error)
2270
2270
  c.inputEl.value = "", D.inputEl.value = "", s.setValue && s.setValue("", "", ""), s.setDisabled(!1);
2271
2271
  else {
2272
2272
  if (c.inputEl.value = gA.ten_cty || "", D.inputEl.value = gA.dia_chi || "", gA.cqthue_ql) {
2273
- const DA = (OA) => OA.toLowerCase().replace(/phường\s+/i, "").replace(/xã\s+/i, "").replace(/quận\s+/i, "").trim(), fA = DA(gA.cqthue_ql), qA = l.find((OA) => {
2273
+ const DA = (OA) => OA.toLowerCase().replace(/phường\s+/i, "").replace(/xã\s+/i, "").replace(/quận\s+/i, "").trim(), fA = DA(gA.cqthue_ql), vA = l.find((OA) => {
2274
2274
  const GA = DA(OA.label);
2275
2275
  return GA.includes(fA) || fA.includes(GA);
2276
2276
  });
2277
- qA && (s.setValue && s.setValue(
2278
- qA.value,
2279
- qA.label,
2280
- qA.id
2277
+ vA && (s.setValue && s.setValue(
2278
+ vA.value,
2279
+ vA.label,
2280
+ vA.id
2281
2281
  ), s.setDisabled(!1));
2282
2282
  }
2283
2283
  i.setError(null);
2284
2284
  }
2285
2285
  } catch (gA) {
2286
- O === b && (og.error(
2286
+ O === N && (og.error(
2287
2287
  a("errorFetchTaxInfo", "Lỗi khi lấy thông tin mã số thuế."),
2288
2288
  {
2289
2289
  autoClose: 5e3,
@@ -2294,7 +2294,7 @@ function pQ(n) {
2294
2294
  a("errorFetchTaxInfo", "Lỗi khi lấy thông tin mã số thuế.")
2295
2295
  ));
2296
2296
  } finally {
2297
- O === b && $();
2297
+ O === N && $();
2298
2298
  }
2299
2299
  });
2300
2300
  }
@@ -2336,25 +2336,25 @@ function pQ(n) {
2336
2336
  const eg = fA.slice(0, 2), Fg = fA.slice(2, 4), gQ = fA.slice(4, 8);
2337
2337
  return `${eg}/${Fg}/${gQ}`;
2338
2338
  }
2339
- const [qA, OA, GA] = fA.split("/"), wg = new Date(+GA, +OA - 1, +qA);
2339
+ const [vA, OA, GA] = fA.split("/"), wg = new Date(+GA, +OA - 1, +vA);
2340
2340
  if (isNaN(wg)) return "";
2341
2341
  const Xg = String(wg.getDate()).padStart(2, "0"), rg = String(wg.getMonth() + 1).padStart(2, "0"), Mg = wg.getFullYear();
2342
2342
  return `${Xg}/${rg}/${Mg}`;
2343
2343
  }, DA = new Image();
2344
2344
  DA.src = URL.createObjectURL(G), DA.onload = () => V(null, null, function* () {
2345
2345
  try {
2346
- const fA = yield KQ(DA).then((qA) => JSON.parse(qA).status !== "success" ? (kA = !0, iA = !1, O(), FA(), null) : JSON.parse(qA).data);
2346
+ const fA = yield KQ(DA).then((vA) => JSON.parse(vA).status !== "success" ? (kA = !0, iA = !1, O(), FA(), null) : JSON.parse(vA).data);
2347
2347
  if (fA) {
2348
2348
  kA = !1, iA = !0, FA();
2349
2349
  const OA = Object.values(fA).every((eg) => !eg);
2350
2350
  if (O(), OA) {
2351
- zA(
2351
+ NA(
2352
2352
  a("errorInvalidCard", "Vui lòng tải lên ảnh CMND/CCCD hợp lệ")
2353
2353
  ), O();
2354
2354
  return;
2355
2355
  }
2356
2356
  const { address: GA, date_of_birth: wg, full_name: Xg, id_number: rg, sex: Mg } = fA;
2357
- if (!rg || !/^\d{12}$/.test(rg) ? (zA(
2357
+ if (!rg || !/^\d{12}$/.test(rg) ? (NA(
2358
2358
  a("errorInvalidCard", "Số CCCD phải có 12 chữ số")
2359
2359
  ), f.inputEl.value = "") : (f.inputEl.value = rg, f.setError(null)), P.inputEl.value = Xg || "", m.inputEl.value = gA(wg), X.inputEl.value = GA || "", Mg) {
2360
2360
  const eg = EC.find(
@@ -2375,10 +2375,10 @@ function pQ(n) {
2375
2375
  DA.src = URL.createObjectURL(G), DA.onload = () => V(null, null, function* () {
2376
2376
  yield UQ(DA).then((fA) => {
2377
2377
  var OA, GA;
2378
- const qA = JSON.parse(fA);
2379
- console.log("🚀 ~ result:", qA), O && !((OA = qA == null ? void 0 : qA.data) != null && OA.isFront) ? zA(
2378
+ const vA = JSON.parse(fA);
2379
+ O && !((OA = vA == null ? void 0 : vA.data) != null && OA.isFront) ? NA(
2380
2380
  a("errorInvalidCard", "Vui lòng tải lên ảnh CMND/CCCD hợp lệ")
2381
- ) : gA && !((GA = qA == null ? void 0 : qA.data) != null && GA.isBack) && hg(
2381
+ ) : gA && !((GA = vA == null ? void 0 : vA.data) != null && GA.isBack) && hg(
2382
2382
  a("errorInvalidCard", "Vui lòng tải lên ảnh CMND/CCCD hợp lệ")
2383
2383
  );
2384
2384
  });
@@ -2388,7 +2388,7 @@ function pQ(n) {
2388
2388
  container: sg,
2389
2389
  getFrontFileError: tg,
2390
2390
  getBackFileError: $A,
2391
- setFrontFileError: zA,
2391
+ setFrontFileError: NA,
2392
2392
  setBackFileError: hg,
2393
2393
  getFrontFile: VA,
2394
2394
  getBackFile: Ag
@@ -2424,8 +2424,8 @@ function pQ(n) {
2424
2424
  JA.appendChild(sg);
2425
2425
  const WA = document.createElement("div");
2426
2426
  WA.className = "wgt:space-y-4", WA.appendChild(P.container);
2427
- const NA = document.createElement("div");
2428
- NA.className = "wgt:grid wgt:grid-cols-1 wgt:@min-2xl:grid-cols-2 wgt:gap-4", WA.appendChild(NA), NA.appendChild(m.container), NA.appendChild(d.container), JA.appendChild(WA);
2427
+ const bA = document.createElement("div");
2428
+ bA.className = "wgt:grid wgt:grid-cols-1 wgt:@min-2xl:grid-cols-2 wgt:gap-4", WA.appendChild(bA), bA.appendChild(m.container), bA.appendChild(d.container), JA.appendChild(WA);
2429
2429
  const KA = document.createElement("div");
2430
2430
  KA.className = "wgt:grid wgt:grid-cols-1 wgt:@min-2xl:grid-cols-4 wgt:gap-4 wgt:items-start", KA.appendChild(f.container), KA.appendChild(r.container), KA.appendChild(v.container), KA.appendChild(M.container), cA.appendChild(JA), cA.appendChild(KA), cA.appendChild(X.container), cA.appendChild(z.container);
2431
2431
  const UA = document.createElement("ul");
@@ -2446,7 +2446,7 @@ function pQ(n) {
2446
2446
  const xA = document.createElement("h3");
2447
2447
  xA.className = "wgt:text-lg wgt:font-semibold wgt:mb-2", xA.innerText = a("invoiceUsageInfo", "4. THÔNG TIN SỬ DỤNG HDDT:"), SA.appendChild(xA), h.appendChild(SA);
2448
2448
  const j = document.createElement("div");
2449
- j.className = "wgt:w-full wgt:flex wgt:gap-4 wgt:items-start wgt:flex-row wgt:@max-4xl:flex-col", j.appendChild(k.container), j.appendChild(N.container), SA.appendChild(j);
2449
+ j.className = "wgt:w-full wgt:flex wgt:gap-4 wgt:items-start wgt:flex-row wgt:@max-4xl:flex-col", j.appendChild(k.container), j.appendChild(b.container), SA.appendChild(j);
2450
2450
  const W = document.createElement("div");
2451
2451
  W.className = "wgt:flex wgt:flex-col wgt:space-y-4 wgt:border wgt:border-soft-200 wgt:px-6 wgt:py-4 wgt:rounded-xl", h.appendChild(W);
2452
2452
  const CA = document.createElement("div");
@@ -2517,7 +2517,7 @@ function pQ(n) {
2517
2517
  "wgt:disabled:cursor-not-allowed",
2518
2518
  "wgt:cursor-pointer"
2519
2519
  ].join(" "), eA.appendChild(u), o.appendChild(eA);
2520
- function vA() {
2520
+ function qA() {
2521
2521
  const G = hA(), O = G.eInvoiceRegistration;
2522
2522
  if (!O.contactPerson.address || !O.organization.name || !O.organization.address || !O.organization.taxCode || !O.organization.taxAuthority || !O.contactPerson.name || !O.contactPerson.email || !O.contactPerson.phone || !O.legalRepresentative.name || !O.legalRepresentative.dob || !O.legalRepresentative.gender || !O.legalRepresentative.phone || !O.legalRepresentative.idCard || !O.legalRepresentative.permanentAddress || !O.invoiceSymbol || O.hasUsedEInvoice && !O.taxAuthorityCode || O.isUsedEInvoiceBefore && !O.previousEInvoiceProvider || !lg(O.contactPerson.name) || !lg(O.legalRepresentative.name) || !/^[\p{L}0-9\s,.\-/()]*$/u.test(O.contactPerson.address) || !/^[\p{L}0-9\s,.\-/()]*$/u.test(
2523
2523
  O.legalRepresentative.permanentAddress
@@ -2527,7 +2527,7 @@ function pQ(n) {
2527
2527
  return !(!GA.test(fA) || !GA.test(OA) || !/^\d{12}$/.test(O.legalRepresentative.idCard) || !new RegExp("^(?!\\.)(?!.*\\.\\.)[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]{1,64}(?<!\\.)@(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9-]{2,63}$").test(O.contactPerson.email) || !/^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(O.invoiceSymbol) || !G.license || !G.logo || !G.idCard || !G.idCardBack);
2528
2528
  }
2529
2529
  function $() {
2530
- u.disabled = !vA() || !tA || tg() || $A() || K.getError() || z.getError();
2530
+ u.disabled = !qA() || !tA || tg() || $A() || K.getError() || z.getError();
2531
2531
  }
2532
2532
  function hA() {
2533
2533
  var G, O;
@@ -2589,7 +2589,7 @@ function pQ(n) {
2589
2589
  }), [R, T].forEach((G) => {
2590
2590
  G.addEventListener("change", $);
2591
2591
  }), u.addEventListener("click", (G) => {
2592
- if (G.preventDefault(), !vA()) return;
2592
+ if (G.preventDefault(), !qA()) return;
2593
2593
  const O = hA();
2594
2594
  typeof g == "function" && g(O);
2595
2595
  });
@@ -2758,10 +2758,10 @@ function nC({
2758
2758
  }
2759
2759
  };
2760
2760
  }
2761
- const _Q = "1.84.1";
2761
+ const _Q = "1.85.0";
2762
2762
  function $Q(E) {
2763
2763
  return V(this, arguments, function* ({ search: g, bank: A }) {
2764
- return (yield LA.get(`${Yg}`, {
2764
+ return (yield zA.get(`${Yg}`, {
2765
2765
  params: {
2766
2766
  isActive: !0,
2767
2767
  search: g || null,
@@ -2773,7 +2773,7 @@ function $Q(E) {
2773
2773
  }
2774
2774
  function AE(A) {
2775
2775
  return V(this, arguments, function* ({ bank: g }) {
2776
- return (yield LA.get(`${Yg}`, {
2776
+ return (yield zA.get(`${Yg}`, {
2777
2777
  params: {
2778
2778
  isActive: !0,
2779
2779
  type: "initial_fee",
@@ -2784,7 +2784,7 @@ function AE(A) {
2784
2784
  }
2785
2785
  function gE(A) {
2786
2786
  return V(this, arguments, function* ({ bank: g }) {
2787
- return (yield LA.get(`${Yg}`, {
2787
+ return (yield zA.get(`${Yg}`, {
2788
2788
  params: {
2789
2789
  isActive: !0,
2790
2790
  type: "service",
@@ -2796,7 +2796,7 @@ function gE(A) {
2796
2796
  }
2797
2797
  function BE(A) {
2798
2798
  return V(this, arguments, function* ({ bank: g }) {
2799
- return (yield LA.get(`${Yg}`, {
2799
+ return (yield zA.get(`${Yg}`, {
2800
2800
  params: {
2801
2801
  isActive: !0,
2802
2802
  type: "signature",
@@ -2817,7 +2817,7 @@ function SC(g) {
2817
2817
  g.organizationRegistrationCert
2818
2818
  ), g.legalRepresentativeIdCard.forEach((Q) => {
2819
2819
  A.append("legalRepresentativeIdCard", Q);
2820
- }), yield LA.post(hQ, A, {
2820
+ }), yield zA.post(hQ, A, {
2821
2821
  headers: {
2822
2822
  "Content-Type": "multipart/form-data",
2823
2823
  "X-Invoice-Widget-Mode": eB(),
@@ -2828,17 +2828,17 @@ function SC(g) {
2828
2828
  }
2829
2829
  function CE(g) {
2830
2830
  return V(this, null, function* () {
2831
- return yield LA.get(`${zC}/${g}/status`);
2831
+ return yield zA.get(`${zC}/${g}/status`);
2832
2832
  });
2833
2833
  }
2834
2834
  function tC(g) {
2835
2835
  return V(this, null, function* () {
2836
- yield LA.delete(`${zC}/${g}`);
2836
+ yield zA.delete(`${zC}/${g}`);
2837
2837
  });
2838
2838
  }
2839
2839
  function QE() {
2840
2840
  return V(this, null, function* () {
2841
- return (yield LA.get(`${cQ}`)).data;
2841
+ return (yield zA.get(`${cQ}`)).data;
2842
2842
  });
2843
2843
  }
2844
2844
  function EE({ name: g, value: A, feeLabel: E, required: Q, description: B, isChecked: C = !0 }) {
@@ -3146,8 +3146,8 @@ function eE(J) {
3146
3146
  const {
3147
3147
  container: l,
3148
3148
  invoiceSelectorWrapper: L,
3149
- setInvoicePackages: N,
3150
- getInvoicePackages: b,
3149
+ setInvoicePackages: b,
3150
+ getInvoicePackages: N,
3151
3151
  getFilteredInvoiceOptions: IA,
3152
3152
  setFilteredInvoiceOptions: S,
3153
3153
  findInvoiceById: U,
@@ -3234,16 +3234,16 @@ function eE(J) {
3234
3234
  title: a("next"),
3235
3235
  className: "wgt:text-white wgt:bg-primary",
3236
3236
  handleClick: () => V(null, null, function* () {
3237
- const j = b().find(
3237
+ const j = N().find(
3238
3238
  (_) => _._id === P
3239
3239
  ), W = v.find(
3240
3240
  (_) => _._id === m
3241
3241
  );
3242
3242
  let CA = null;
3243
- X && !(j != null && j.withoutInitialFee) ? (CA = bA(RA({}, f[0]), {
3243
+ X && !(j != null && j.withoutInitialFee) ? (CA = jA(RA({}, f[0]), {
3244
3244
  quantity: R
3245
3245
  }), C(CA)) : C(null);
3246
- let p = bA(RA({}, j), { quantity: T }), EA = bA(RA({}, W), { quantity: Y });
3246
+ let p = jA(RA({}, j), { quantity: T }), EA = jA(RA({}, W), { quantity: Y });
3247
3247
  t(p), I(EA), s(d), yield tg(
3248
3248
  CA,
3249
3249
  p,
@@ -3253,7 +3253,7 @@ function eE(J) {
3253
3253
  })
3254
3254
  });
3255
3255
  yA.appendChild($A);
3256
- function zA() {
3256
+ function NA() {
3257
3257
  return V(this, null, function* () {
3258
3258
  var j, W, CA, p, EA;
3259
3259
  try {
@@ -3302,7 +3302,7 @@ function eE(J) {
3302
3302
  }), Object.keys(r).length > 0 && (d = c || Object.keys(r).filter(
3303
3303
  (Z) => r[Z].bank === h && r[Z].expiredAt >= (/* @__PURE__ */ new Date()).toISOString() && r[Z].limit > r[Z].used
3304
3304
  ), _A())) : console.error("Failed to load promotions:", QA.reason), tA.status === "fulfilled") {
3305
- if (N(tA.value || []), tA.value.length > 0) {
3305
+ if (b(tA.value || []), tA.value.length > 0) {
3306
3306
  const Z = tA.value.find(
3307
3307
  (MA) => M.includes(MA.code)
3308
3308
  );
@@ -3315,7 +3315,7 @@ function eE(J) {
3315
3315
  tA.reason
3316
3316
  ), og.error(
3317
3317
  a("errorLoadingInvoicePackages") || "Failed to load invoice packages"
3318
- ), N([]), nA();
3318
+ ), b([]), nA();
3319
3319
  if (wA.status === "fulfilled") {
3320
3320
  if (v = wA.value || [], v.length > 0) {
3321
3321
  const Z = v.find(
@@ -3372,11 +3372,11 @@ function eE(J) {
3372
3372
  selectedPackageId: P,
3373
3373
  handlePackageSelect: (j) => {
3374
3374
  var p, EA;
3375
- let W = (p = b().find(
3375
+ let W = (p = N().find(
3376
3376
  (_) => _._id === P
3377
- )) == null ? void 0 : p.code, CA = (EA = b().find((_) => _._id === j)) == null ? void 0 : EA.code;
3377
+ )) == null ? void 0 : p.code, CA = (EA = N().find((_) => _._id === j)) == null ? void 0 : EA.code;
3378
3378
  VA(W, CA, () => {
3379
- P = j, Ag.setSelectedPackageId(j), S(b()), fg(), cg(), SA(), T = 1, xA();
3379
+ P = j, Ag.setSelectedPackageId(j), S(N()), fg(), cg(), SA(), T = 1, xA();
3380
3380
  });
3381
3381
  }
3382
3382
  }), L.appendChild(Ag.container);
@@ -3385,10 +3385,10 @@ function eE(J) {
3385
3385
  j.className = "wgt:text-text-sub-600", j.innerText = a("noPackageFound"), L.appendChild(j), Ag = null;
3386
3386
  }
3387
3387
  }
3388
- let NA = null;
3388
+ let bA = null;
3389
3389
  function KA() {
3390
3390
  if (cA.innerHTML = "", v.length > 0)
3391
- NA = nC({
3391
+ bA = nC({
3392
3392
  type: "signature",
3393
3393
  packageOptions: v.filter((j) => !j.isBonusPackage),
3394
3394
  disCountedPackages: M,
@@ -3400,20 +3400,20 @@ function eE(J) {
3400
3400
  (_) => _._id === m
3401
3401
  )) == null ? void 0 : p.code, CA = (EA = v.find((_) => _._id === j)) == null ? void 0 : EA.code;
3402
3402
  VA(W, CA, () => {
3403
- m = j, NA.setSelectedPackageId(j), fg(), cg(), SA(), Y = 1, xA();
3403
+ m = j, bA.setSelectedPackageId(j), fg(), cg(), SA(), Y = 1, xA();
3404
3404
  });
3405
3405
  }
3406
- }), cA.appendChild(NA.container);
3406
+ }), cA.appendChild(bA.container);
3407
3407
  else {
3408
3408
  const j = document.createElement("span");
3409
- j.className = "wgt:text-text-sub-600", j.innerText = a("noPackageFound"), cA.appendChild(j), NA = null;
3409
+ j.className = "wgt:text-text-sub-600", j.innerText = a("noPackageFound"), cA.appendChild(j), bA = null;
3410
3410
  }
3411
3411
  }
3412
3412
  const UA = document.createElement("div");
3413
3413
  UA.className = "wgt:w-full", u.appendChild(UA);
3414
3414
  function cg() {
3415
3415
  YA.remove(), UA.innerHTML = "";
3416
- const j = b().find(
3416
+ const j = N().find(
3417
3417
  (W) => W._id === P
3418
3418
  );
3419
3419
  if (f.length > 0) {
@@ -3433,7 +3433,7 @@ function eE(J) {
3433
3433
  const XA = document.createElement("div");
3434
3434
  XA.className = "promotion-wrapper wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";
3435
3435
  function fg() {
3436
- const j = b().find(
3436
+ const j = N().find(
3437
3437
  (CA) => CA._id === P
3438
3438
  ), W = v.find(
3439
3439
  (CA) => CA._id === m
@@ -3510,7 +3510,7 @@ function eE(J) {
3510
3510
  if (QA.length > 0)
3511
3511
  QA.forEach((AA) => {
3512
3512
  const { container: tA } = IE({
3513
- promotion: bA(RA({}, AA), {
3513
+ promotion: jA(RA({}, AA), {
3514
3514
  isSelected: d.includes(AA.code)
3515
3515
  }),
3516
3516
  onSelect: (wA, Z) => {
@@ -3527,7 +3527,7 @@ function eE(J) {
3527
3527
  }
3528
3528
  function xA() {
3529
3529
  var wA, Z, MA, gg, Bg;
3530
- if (iA.innerHTML = "", u.appendChild(kA), u.appendChild(rA), u.appendChild(JA), b().length === 0 && v.length === 0) {
3530
+ if (iA.innerHTML = "", u.appendChild(kA), u.appendChild(rA), u.appendChild(JA), N().length === 0 && v.length === 0) {
3531
3531
  const x = document.createElement("tr");
3532
3532
  x.innerHTML = `
3533
3533
  <td colspan="5" class="wgt:px-3 wgt:py-8 wgt:text-center wgt:text-text-sub-600 wgt:@max-2xl:col-span-5">
@@ -3536,7 +3536,7 @@ function eE(J) {
3536
3536
  `, iA.appendChild(x), o(0);
3537
3537
  return;
3538
3538
  }
3539
- const j = b().find(
3539
+ const j = N().find(
3540
3540
  (x) => x._id === P
3541
3541
  );
3542
3542
  if (X && (f == null ? void 0 : f.length) > 0 && !(j != null && j.withoutInitialFee)) {
@@ -3546,8 +3546,8 @@ function eE(J) {
3546
3546
  BA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2 wgt:@max-2xl:text-base wgt:@max-2xl:font-semibold", BA.innerText = ag() === "vi" ? f[0].name : f[0].nameEn, x.appendChild(BA);
3547
3547
  const eA = document.createElement("td");
3548
3548
  eA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:hidden", eA.innerText = a("package"), x.appendChild(eA);
3549
- const vA = document.createElement("td");
3550
- vA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-2.5 wgt:text-center wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2";
3549
+ const qA = document.createElement("td");
3550
+ qA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-2.5 wgt:text-center wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2";
3551
3551
  const $ = document.createElement("div");
3552
3552
  $.className = "wgt:w-full wgt:justify-between wgt:inline-flex wgt:items-center wgt:border wgt:border-soft-200 wgt:rounded-lg wgt:@max-2xl:w-full wgt:@max-2xl:max-w-[200px] wgt:@max-2xl:mx-auto";
3553
3553
  const hA = document.createElement("button");
@@ -3559,7 +3559,7 @@ function eE(J) {
3559
3559
  const sA = document.createElement("button");
3560
3560
  sA.type = "button", sA.ariaLabel = a("increase"), sA.disabled = !0, sA.className = "wgt:flex wgt:h-8 wgt:w-8 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950 wgt:cursor-not-allowed wgt:opacity-50 wgt:@max-2xl:h-12 wgt:@max-2xl:w-12 wgt:@max-2xl:text-lg wgt:@max-2xl:font-bold", sA.innerText = "+", sA.addEventListener("click", () => {
3561
3561
  R += 1, xA();
3562
- }), $.appendChild(sA), vA.appendChild($), x.appendChild(vA);
3562
+ }), $.appendChild(sA), qA.appendChild($), x.appendChild(qA);
3563
3563
  const uA = document.createElement("td");
3564
3564
  uA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:hidden", uA.innerText = HA((wA = f[0]) == null ? void 0 : wA.price) + " VND", x.appendChild(uA);
3565
3565
  const TA = document.createElement("td");
@@ -3587,8 +3587,8 @@ function eE(J) {
3587
3587
  BA.className = "wgt:@max-2xl:block wgt:@max-2xl:mb-4 wgt:@max-2xl:p-4 wgt:@max-2xl:bg-white wgt:@max-2xl:rounded-lg wgt:@max-2xl:border wgt:@max-2xl:border-soft-200 wgt:@max-2xl:shadow-sm";
3588
3588
  const eA = document.createElement("td");
3589
3589
  eA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2 wgt:@max-2xl:text-base wgt:@max-2xl:font-semibold", eA.innerText = ag() === "vi" ? x == null ? void 0 : x.name : x == null ? void 0 : x.nameEn, BA.appendChild(eA);
3590
- const vA = document.createElement("td");
3591
- vA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:hidden", vA.innerText = a("package"), BA.appendChild(vA);
3590
+ const qA = document.createElement("td");
3591
+ qA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:hidden", qA.innerText = a("package"), BA.appendChild(qA);
3592
3592
  const $ = document.createElement("td");
3593
3593
  $.className = "wgt:whitespace-nowrap wgt:px-4 wgt:py-3 wgt:text-center wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2";
3594
3594
  const hA = document.createElement("div");
@@ -3631,8 +3631,8 @@ function eE(J) {
3631
3631
  BA.className = "wgt:@max-2xl:block wgt:@max-2xl:mb-4 wgt:@max-2xl:p-4 wgt:@max-2xl:bg-white wgt:@max-2xl:rounded-lg wgt:@max-2xl:border wgt:@max-2xl:border-soft-200 wgt:@max-2xl:shadow-sm";
3632
3632
  const eA = document.createElement("td");
3633
3633
  eA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2 wgt:@max-2xl:text-base wgt:@max-2xl:font-semibold", eA.innerText = ag() === "vi" ? x == null ? void 0 : x.name : x == null ? void 0 : x.nameEn, BA.appendChild(eA);
3634
- const vA = document.createElement("td");
3635
- vA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:hidden", vA.innerText = a("package"), BA.appendChild(vA);
3634
+ const qA = document.createElement("td");
3635
+ qA.className = "wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium wgt:@max-2xl:hidden", qA.innerText = a("package"), BA.appendChild(qA);
3636
3636
  const $ = document.createElement("td");
3637
3637
  $.className = "wgt:whitespace-nowrap wgt:px-4 wgt:py-3 wgt:text-center wgt:@max-2xl:col-span-2 wgt:@max-2xl:block wgt:@max-2xl:px-0 wgt:@max-2xl:py-2";
3638
3638
  const hA = document.createElement("div");
@@ -3685,8 +3685,8 @@ function eE(J) {
3685
3685
  <span class="wgt:text-text-sub-600 wgt:@max-2xl:text-sm wgt:@max-2xl:font-medium">${ag() === "vi" ? x == null ? void 0 : x.name : (x == null ? void 0 : x.nameEn) || (x == null ? void 0 : x.code)}</span>
3686
3686
  </div>
3687
3687
  `, BA.appendChild(eA);
3688
- const vA = document.createElement("td");
3689
- vA.className = "wgt:@max-2xl:hidden", BA.appendChild(vA);
3688
+ const qA = document.createElement("td");
3689
+ qA.className = "wgt:@max-2xl:hidden", BA.appendChild(qA);
3690
3690
  const $ = document.createElement("td");
3691
3691
  $.className = "wgt:px-3 wgt:py-2 wgt:text-sm wgt:font-semibold wgt:@max-2xl:text-base wgt:@max-2xl:font-bold wgt:@max-2xl:p-0", x.type === "discount" ? ($.innerText = `-${HA(
3692
3692
  (hA = x == null ? void 0 : x.reward) == null ? void 0 : hA.discountAmount
@@ -3706,7 +3706,7 @@ function eE(J) {
3706
3706
  }
3707
3707
  PA.innerText = HA(tA) + " VND";
3708
3708
  }
3709
- return zA(), { container: K };
3709
+ return NA(), { container: K };
3710
3710
  });
3711
3711
  }
3712
3712
  function aE({
@@ -3860,7 +3860,7 @@ function DE({
3860
3860
  F();
3861
3861
  const J = () => {
3862
3862
  c = setInterval(() => {
3863
- i--, F(), i <= 0 && jA(c);
3863
+ i--, F(), i <= 0 && LA(c);
3864
3864
  }, 1e3), AQ(c);
3865
3865
  };
3866
3866
  J(), D.appendChild(s);
@@ -3913,9 +3913,9 @@ function DE({
3913
3913
  const l = document.createElement("h4");
3914
3914
  l.className = "wgt:text-sm wgt:font-normal wgt:leading-5 wgt:text-[#475467]", l.innerText = a("promotion");
3915
3915
  const L = document.createElement("div");
3916
- L.className = "wgt:flex wgt:items-center wgt:justify-end wgt:flex-wrap wgt:gap-2", n.forEach((N) => {
3917
- const b = document.createElement("div");
3918
- b.className = "wgt:w-fit wgt:px-3 wgt:py-1 wgt:text-xs wgt:font-normal wgt:text-primary wgt:border wgt:border-primary", b.innerText = N, L.appendChild(b);
3916
+ L.className = "wgt:flex wgt:items-center wgt:justify-end wgt:flex-wrap wgt:gap-2", n.forEach((b) => {
3917
+ const N = document.createElement("div");
3918
+ N.className = "wgt:w-fit wgt:px-3 wgt:py-1 wgt:text-xs wgt:font-normal wgt:text-primary wgt:border wgt:border-primary", N.innerText = b, L.appendChild(N);
3919
3919
  }), u.appendChild(l), u.appendChild(L), m.appendChild(u);
3920
3920
  }
3921
3921
  const y = document.createElement("hr");
@@ -3930,12 +3930,12 @@ function DE({
3930
3930
  title: a("cancelTransaction"),
3931
3931
  className: "wgt:bg-transparent wgt:border wgt:border-primary wgt:text-primary wgt:hover:bg-transparent",
3932
3932
  handleClick: () => {
3933
- c && jA(c);
3933
+ c && LA(c);
3934
3934
  const { container: u, open: l } = aB({
3935
3935
  message: a("transactionCanceled"),
3936
3936
  okLabel: a("ok"),
3937
3937
  onClose: () => V(null, null, function* () {
3938
- i = 3600, jA(c), yield tC(B), typeof o == "function" && (yield o());
3938
+ i = 3600, LA(c), yield tC(B), typeof o == "function" && (yield o());
3939
3939
  }),
3940
3940
  preventClose: !0
3941
3941
  });
@@ -3943,7 +3943,7 @@ function DE({
3943
3943
  }
3944
3944
  });
3945
3945
  return P.appendChild(w), h.appendChild(P), window.addEventListener("beforeunload", () => V(null, null, function* () {
3946
- c && jA(c), yield tC(B);
3946
+ c && LA(c), yield tC(B);
3947
3947
  })), {
3948
3948
  container: h,
3949
3949
  setSelectedProvider(u) {
@@ -5272,15 +5272,15 @@ function YE() {
5272
5272
  const M = g.getSymbolTotalCodewords(f), X = I.getTotalCodewordsCount(f, r), k = M - X, R = I.getBlocksCount(f, r), T = M % R, Y = R - T, y = Math.floor(M / R), K = Math.floor(k / R), z = K + 1, e = y - K, w = new n(e);
5273
5273
  let u = 0;
5274
5274
  const l = new Array(R), L = new Array(R);
5275
- let N = 0;
5276
- const b = new Uint8Array(v.buffer);
5275
+ let b = 0;
5276
+ const N = new Uint8Array(v.buffer);
5277
5277
  for (let aA = 0; aA < R; aA++) {
5278
5278
  const cA = aA < Y ? K : z;
5279
- l[aA] = b.slice(u, u + cA), L[aA] = w.encode(l[aA]), u += cA, N = Math.max(N, cA);
5279
+ l[aA] = N.slice(u, u + cA), L[aA] = w.encode(l[aA]), u += cA, b = Math.max(b, cA);
5280
5280
  }
5281
5281
  const IA = new Uint8Array(M);
5282
5282
  let S = 0, U, nA;
5283
- for (U = 0; U < N; U++)
5283
+ for (U = 0; U < b; U++)
5284
5284
  for (nA = 0; nA < R; nA++)
5285
5285
  U < l[nA].length && (IA[S++] = l[nA][U]);
5286
5286
  for (U = 0; U < e; U++)
@@ -5501,7 +5501,7 @@ function zE(I) {
5501
5501
  H.className = "wgt:w-full wgt:flex wgt:items-start wgt:gap-6 wgt:@max-2xl:flex-col-reverse";
5502
5502
  const P = document.createElement("div");
5503
5503
  P.className = "wgt:flex-1 wgt:@max-2xl:w-full";
5504
- const m = a("paymentInstructions"), d = Array.isArray(m) ? m : [m], { container: v, update: f } = oE(bA(RA({
5504
+ const m = a("paymentInstructions"), d = Array.isArray(m) ? m : [m], { container: v, update: f } = oE(jA(RA({
5505
5505
  qrSrc: "",
5506
5506
  accountName: "",
5507
5507
  accountNumber: "",
@@ -5511,12 +5511,12 @@ function zE(I) {
5511
5511
  theme: t
5512
5512
  }));
5513
5513
  P.appendChild(v), H.appendChild(P);
5514
- const { container: r, resetCountdown: M } = DE(bA(RA({}, B), {
5514
+ const { container: r, resetCountdown: M } = DE(jA(RA({}, B), {
5515
5515
  qrData: null,
5516
5516
  qrSrc: "",
5517
5517
  selectedPromotions: (B == null ? void 0 : B.selectedPromotions) || [],
5518
5518
  onResetToStep1: () => {
5519
- B != null && B.onResetToStep1 && B.onResetToStep1(), jA(h);
5519
+ h && (LA(h), h = null), B != null && B.onResetToStep1 && B.onResetToStep1();
5520
5520
  }
5521
5521
  }));
5522
5522
  H.appendChild(r), s.appendChild(H);
@@ -5527,18 +5527,18 @@ function zE(I) {
5527
5527
  title: a("back"),
5528
5528
  className: "wgt:bg-transparent wgt:!text-primary wgt:hover:bg-transparent wgt:underline",
5529
5529
  handleClick: () => {
5530
- A && (A(), jA(h));
5530
+ A && (A(), LA(h));
5531
5531
  }
5532
5532
  });
5533
5533
  X.appendChild(k), s.appendChild(X);
5534
5534
  function R() {
5535
- n = null, o = "", i = null, c = !1, D = 0, B != null && B.onResetToStep1 && B.onResetToStep1();
5535
+ n = null, o = "", i = null, c = !1, D = 0, h && (LA(h), h = null), B != null && B.onResetToStep1 && B.onResetToStep1();
5536
5536
  }
5537
5537
  function T() {
5538
5538
  return V(this, null, function* () {
5539
5539
  const { registrationData: e } = B, l = e.eInvoiceRegistration, { isUsedEInvoiceBefore: w } = l, u = Og(l, ["isUsedEInvoiceBefore"]);
5540
5540
  try {
5541
- const N = (yield SC({
5541
+ const b = (yield SC({
5542
5542
  eInvoiceRegistration: RA({}, u),
5543
5543
  bank: e.bank,
5544
5544
  provider: e.provider,
@@ -5551,7 +5551,7 @@ function zE(I) {
5551
5551
  packages: e.packages,
5552
5552
  promotionCodes: e.promotionCodes
5553
5553
  })).orderId;
5554
- N !== i && (i = N, C(N), yield Y(N), M());
5554
+ b !== i && (i = b, C(b), yield Y(b), M());
5555
5555
  } catch (L) {
5556
5556
  console.error("Error creating order:", L), Qg(a("errorCreatingOrder") || "Failed to create order");
5557
5557
  return;
@@ -5562,18 +5562,20 @@ function zE(I) {
5562
5562
  }
5563
5563
  function Y(e) {
5564
5564
  return V(this, null, function* () {
5565
- var w, u, l, L;
5565
+ var w, u, l, L, b;
5566
5566
  if (c) {
5567
5567
  console.log("Already fetching QR data, skipping...");
5568
5568
  return;
5569
5569
  }
5570
5570
  c = !0, F();
5571
5571
  try {
5572
- n = yield wQ({
5572
+ if (n = yield wQ({
5573
5573
  orderId: e != null ? e : B == null ? void 0 : B.orderId,
5574
5574
  amount: B == null ? void 0 : B.totalAmountText,
5575
5575
  baseURL: mQ(t)
5576
- }), o = yield GE.toDataURL(n.qr_string, {
5576
+ }), !(n != null && n.qr_string))
5577
+ throw new Error("QR string is empty or undefined");
5578
+ o = yield GE.toDataURL(n.qr_string, {
5577
5579
  errorCorrectionLevel: "H",
5578
5580
  margin: 1,
5579
5581
  width: 200,
@@ -5590,8 +5592,8 @@ function zE(I) {
5590
5592
  bankName: (n == null ? void 0 : n.bank_code) || ""
5591
5593
  }), z();
5592
5594
  } catch (N) {
5593
- if (console.log("🚀 ~ error:", N), ((u = (w = N.response) == null ? void 0 : w.data) == null ? void 0 : u.error_code) === "BILL_ID_EXISTED") {
5594
- if (console.log("Bill ID existed, recalling createOrder..."), c = !1, D++, D >= LE) {
5595
+ if (((u = (w = N.response) == null ? void 0 : w.data) == null ? void 0 : u.error_code) === "BILL_ID_EXISTED") {
5596
+ if (console.log("Bill ID existed, recalling createOrder..."), D++, D >= LE) {
5595
5597
  Qg(a("errorQRGeneration"), {
5596
5598
  okLabel: a("ok"),
5597
5599
  onClose: () => {
@@ -5600,7 +5602,7 @@ function zE(I) {
5600
5602
  });
5601
5603
  return;
5602
5604
  }
5603
- yield T();
5605
+ c = !1, yield T();
5604
5606
  return;
5605
5607
  } else if (((L = (l = N.response) == null ? void 0 : l.data) == null ? void 0 : L.error_code) === "AUTHEN_FAIL") {
5606
5608
  Qg(a("errorQRGeneration"), {
@@ -5610,6 +5612,9 @@ function zE(I) {
5610
5612
  }
5611
5613
  });
5612
5614
  return;
5615
+ } else if (((b = N.response) == null ? void 0 : b.status) === 401) {
5616
+ console.log("Token refresh in progress, not showing error popup");
5617
+ return;
5613
5618
  } else
5614
5619
  Qg(
5615
5620
  a(
@@ -5631,17 +5636,17 @@ function zE(I) {
5631
5636
  i && (yield Y(i));
5632
5637
  let y = !1;
5633
5638
  function K() {
5634
- y = !navigator.onLine;
5639
+ y = !navigator.onLine, console.log("Network status changed:", y ? "offline" : "online");
5635
5640
  }
5636
5641
  function z() {
5637
- h && jA(h), h = setInterval(() => V(null, null, function* () {
5642
+ h && LA(h), h = setInterval(() => V(null, null, function* () {
5638
5643
  var e, w;
5639
5644
  try {
5640
5645
  const u = yield CE(i);
5641
5646
  if (u.paymentStatus === "pending")
5642
5647
  return;
5643
5648
  const l = u.paymentStatus === "paid" ? a("paymentSuccess") : a("paymentFailed");
5644
- jA(h);
5649
+ LA(h);
5645
5650
  const L = aB({
5646
5651
  message: l,
5647
5652
  okLabel: "OK",
@@ -5653,34 +5658,34 @@ function zE(I) {
5653
5658
  });
5654
5659
  s.appendChild(L.container), L.open();
5655
5660
  } catch (u) {
5656
- y ? Qg(a("errorNetwork"), {
5661
+ !navigator.onLine || !u.response ? (y = !0, Qg(a("errorNetwork"), {
5657
5662
  okLabel: a("tryAgain"),
5658
5663
  onClose: function() {
5659
5664
  return V(this, null, function* () {
5660
5665
  yield T();
5661
5666
  });
5662
5667
  },
5663
- isOffline: y
5664
- }) : ((e = u.response) == null ? void 0 : e.status) === 404 ? (Qg(a("errorOrderNotFound"), {
5668
+ isOffline: !0
5669
+ })) : ((e = u.response) == null ? void 0 : e.status) === 404 ? (Qg(a("errorOrderNotFound"), {
5665
5670
  okLabel: a("tryAgain"),
5666
5671
  onClose: function() {
5667
5672
  return V(this, null, function* () {
5668
5673
  yield T();
5669
5674
  });
5670
5675
  }
5671
- }), jA(h)) : ((w = u.response) == null ? void 0 : w.status) === 410 ? (Qg(a("paymentTimeoutMessage"), {
5676
+ }), LA(h)) : ((w = u.response) == null ? void 0 : w.status) === 410 ? (Qg(a("paymentTimeoutMessage"), {
5672
5677
  okLabel: a("tryAgain"),
5673
5678
  onClose: function() {
5674
5679
  return V(this, null, function* () {
5675
5680
  yield T();
5676
5681
  });
5677
5682
  }
5678
- }), jA(h)) : z();
5683
+ }), LA(h)) : z();
5679
5684
  }
5680
5685
  }), 5e3), AQ(h);
5681
5686
  }
5682
5687
  return window.addEventListener("online", K), window.addEventListener("offline", K), window.addEventListener("beforeunload", function() {
5683
- h && jA(h);
5688
+ h && LA(h);
5684
5689
  }), { container: s };
5685
5690
  });
5686
5691
  }
@@ -5957,7 +5962,7 @@ let Rg = /* @__PURE__ */ new Set();
5957
5962
  function AQ(g) {
5958
5963
  g && Rg.add(g);
5959
5964
  }
5960
- function jA(g) {
5965
+ function LA(g) {
5961
5966
  g && (Rg.delete(g), window.clearInterval(g));
5962
5967
  }
5963
5968
  function WE() {
@@ -6253,5 +6258,5 @@ export {
6253
6258
  gI as InvoiceRegisterWidget,
6254
6259
  AQ as registerWidgetInterval,
6255
6260
  WE as stopAllIntervals,
6256
- jA as unregisterWidgetInterval
6261
+ LA as unregisterWidgetInterval
6257
6262
  };