@invoice-sdk/widget 1.105.14 → 1.113.3

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.
@@ -0,0 +1,660 @@
1
+ var U = Object.defineProperty;
2
+ var W = Object.getOwnPropertySymbols;
3
+ var X = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
4
+ var $ = (i, a, e) => a in i ? U(i, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[a] = e, S = (i, a) => {
5
+ for (var e in a || (a = {}))
6
+ X.call(a, e) && $(i, e, a[e]);
7
+ if (W)
8
+ for (var e of W(a))
9
+ G.call(a, e) && $(i, e, a[e]);
10
+ return i;
11
+ };
12
+ var F = (i, a, e) => new Promise((t, o) => {
13
+ var s = (d) => {
14
+ try {
15
+ l(e.next(d));
16
+ } catch (b) {
17
+ o(b);
18
+ }
19
+ }, r = (d) => {
20
+ try {
21
+ l(e.throw(d));
22
+ } catch (b) {
23
+ o(b);
24
+ }
25
+ }, l = (d) => d.done ? t(d.value) : Promise.resolve(d.value).then(s, r);
26
+ l((e = e.apply(i, a)).next());
27
+ });
28
+ import { c as q, f as z, b as J, n as D, s as K } from "./invoice-Cl3kUjw8.js";
29
+ import { t as n, c as P } from "./index-NuRe-rnZ.js";
30
+ function Q({ defaultValues: i = {}, onChange: a } = {}) {
31
+ const e = {
32
+ representativeName: i.representativeName || "",
33
+ buyerAddress: i.buyerAddress || "",
34
+ email: i.email || "",
35
+ phone: i.phone || ""
36
+ }, t = document.createElement("div");
37
+ t.className = "wgt:space-y-2";
38
+ function o() {
39
+ typeof a == "function" && a(S({}, e));
40
+ }
41
+ function s({ label: c, required: h, name: m, type: M = "text", placeholder: H }) {
42
+ const v = document.createElement("div");
43
+ v.className = "";
44
+ const E = document.createElement("label");
45
+ E.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", E.htmlFor = m, E.innerHTML = h ? `${c} <span class="wgt:text-semantic-error wgt:text-[#ED1C24]">*</span>` : c;
46
+ const u = document.createElement("input");
47
+ return u.id = m, u.name = m, u.type = M, u.placeholder = H || "", u.className = "wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", u.value = e[m] || "", u.addEventListener("input", () => {
48
+ e[m] = u.value, u.classList.remove(
49
+ "wgt:border-semantic-error",
50
+ "wgt:bg-semantic-error-50"
51
+ ), o();
52
+ }), v.appendChild(E), v.appendChild(u), { field: v, input: u };
53
+ }
54
+ const { field: r, input: l } = s({
55
+ label: n("representativeName"),
56
+ required: !0,
57
+ name: "representativeName",
58
+ placeholder: n("representativeName_input")
59
+ }), { field: d } = s({
60
+ label: n("buyerAddress"),
61
+ required: !1,
62
+ name: "buyerAddress",
63
+ placeholder: n("buyerAddress_input")
64
+ }), { field: b, input: w } = s({
65
+ label: n("email"),
66
+ required: !0,
67
+ name: "email",
68
+ type: "email",
69
+ placeholder: n("email_input")
70
+ });
71
+ t.appendChild(r), t.appendChild(d), t.appendChild(b);
72
+ function L() {
73
+ let c = !0;
74
+ function h(m) {
75
+ m.classList.add(
76
+ "wgt:border-semantic-error",
77
+ "wgt:bg-semantic-error-50"
78
+ ), c = !1;
79
+ }
80
+ return e.representativeName.trim() || h(l), e.email.trim() || h(w), c;
81
+ }
82
+ function x() {
83
+ return S({}, e);
84
+ }
85
+ return { container: t, getValues: x, validate: L };
86
+ }
87
+ function Y({
88
+ defaultValues: i = {},
89
+ onChange: a,
90
+ onFetchByTaxCode: e
91
+ } = {}) {
92
+ const t = {
93
+ noTaxCode: !!i.noTaxCode,
94
+ taxCode: i.taxCode || "",
95
+ representativeName: i.representativeName || "",
96
+ buyerAddress: i.buyerAddress || "",
97
+ performerName: i.performerName || "",
98
+ email: i.email || "",
99
+ phone: i.phone || ""
100
+ }, o = document.createElement("div");
101
+ o.className = "wgt:space-y-2";
102
+ function s() {
103
+ typeof a == "function" && a(S({}, t));
104
+ }
105
+ function r({ label: g, required: p, name: N, type: y = "text", placeholder: V }) {
106
+ const k = document.createElement("div");
107
+ k.className = "";
108
+ const j = document.createElement("label");
109
+ j.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", j.htmlFor = N, j.innerHTML = p ? `${g} <span class="wgt:text-[#ED1C24]">*</span>` : g;
110
+ const A = document.createElement("input");
111
+ return A.id = N, A.name = N, A.type = y, A.placeholder = V || "", A.className = "wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", A.value = t[N] || "", A.addEventListener("input", () => {
112
+ t[N] = A.value, A.classList.remove(
113
+ "wgt:border-semantic-error",
114
+ "wgt:bg-semantic-error-50"
115
+ ), s();
116
+ }), k.appendChild(j), k.appendChild(A), { field: k, input: A };
117
+ }
118
+ const l = document.createElement("label");
119
+ l.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:font-medium wgt:text-strong-950 wgt:text-sm";
120
+ const d = document.createElement("input");
121
+ d.type = "checkbox", d.className = "wgt:h-4 wgt:w-4 wgt:rounded wgt:border-[#E4E7EC] focus:wgt:outline-none focus:wgt:ring-primary", d.checked = t.noTaxCode;
122
+ const b = document.createElement("span");
123
+ b.textContent = n("business_noTaxCode"), b.className = "wgt:italic wgt:font-normal wgt:text-[14px] wgt:leading-[20px] wgt:tracking-[0px] wgt:align-middle wgt:text-[#525866]", b.style.fontFamily = "Inter, sans-serif", d.addEventListener("change", () => {
124
+ t.noTaxCode = d.checked, c.disabled = t.noTaxCode, h.disabled = t.noTaxCode, s();
125
+ }), l.appendChild(d), l.appendChild(b);
126
+ const w = document.createElement("div");
127
+ w.className = "wgt:space-y-2";
128
+ const L = document.createElement("label");
129
+ L.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950 ", L.innerHTML = n("confirmation_popup_taxCode") + '<span class="wgt:text-[#ED1C24]">*</span>';
130
+ const x = document.createElement("div");
131
+ x.className = "wgt:flex wgt:gap-2 wgt:mt-2";
132
+ const c = document.createElement("input");
133
+ c.type = "text", c.name = "taxCode", c.placeholder = n("taxCode_input"), c.value = t.taxCode, c.className = "wgt:flex-1 wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", c.addEventListener("input", () => {
134
+ t.taxCode = c.value, c.classList.remove(
135
+ "wgt:border-semantic-error",
136
+ "wgt:bg-semantic-error-50"
137
+ ), s();
138
+ });
139
+ const h = q({
140
+ type: "button",
141
+ title: n("fetch_info"),
142
+ className: "wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:font-semibold wgt:rounded-lg wgt:flex-shrink-0 wgt:text-primary wgt:bg-white wgt:border wgt:border-primary",
143
+ handleClick: () => F(null, null, function* () {
144
+ if (t.noTaxCode || typeof e != "function")
145
+ return;
146
+ const g = String(t.taxCode || "").trim();
147
+ if (!g) {
148
+ c.classList.add(
149
+ "wgt:border-semantic-error",
150
+ "wgt:bg-semantic-error-50"
151
+ );
152
+ return;
153
+ }
154
+ try {
155
+ h.disabled = !0;
156
+ const p = yield e(g, S({}, t));
157
+ if (!p || typeof p != "object") return;
158
+ p.representativeName != null && (t.representativeName = String(p.representativeName || ""), M.value = t.representativeName), p.buyerAddress != null && (t.buyerAddress = String(p.buyerAddress || ""), v.value = t.buyerAddress), s();
159
+ } catch (p) {
160
+ c.classList.add(
161
+ "wgt:border-semantic-error",
162
+ "wgt:bg-semantic-error-50"
163
+ );
164
+ } finally {
165
+ h.disabled = t.noTaxCode;
166
+ }
167
+ })
168
+ });
169
+ x.appendChild(c), x.appendChild(h), w.appendChild(L), w.appendChild(x);
170
+ const { field: m, input: M } = r({
171
+ label: n("representativeName"),
172
+ required: !0,
173
+ name: "representativeName",
174
+ placeholder: n("representativeName_input")
175
+ }), { field: H, input: v } = r({
176
+ label: n("buyerAddress"),
177
+ required: !1,
178
+ name: "buyerAddress",
179
+ placeholder: n("buyerAddress_input")
180
+ }), { field: E, input: u } = r({
181
+ label: n("performerName"),
182
+ required: !0,
183
+ name: "performerName",
184
+ placeholder: n("performerName_input")
185
+ }), { field: T, input: Z } = r({
186
+ label: n("email"),
187
+ required: !0,
188
+ name: "email",
189
+ type: "email",
190
+ placeholder: n("email_input")
191
+ }), { field: _, input: B } = r({
192
+ label: n("phone"),
193
+ required: !0,
194
+ name: "phone",
195
+ type: "tel",
196
+ placeholder: n("phone_input")
197
+ });
198
+ o.appendChild(l), o.appendChild(w), o.appendChild(m), o.appendChild(H), o.appendChild(E), o.appendChild(T), o.appendChild(_), c.disabled = t.noTaxCode, h.disabled = t.noTaxCode;
199
+ function C() {
200
+ let g = !0;
201
+ function p(N) {
202
+ N.classList.add(
203
+ "wgt:border-semantic-error",
204
+ "wgt:bg-semantic-error-50 ",
205
+ "wgt:mt-2"
206
+ ), g = !1;
207
+ }
208
+ return !t.noTaxCode && !t.taxCode.trim() && p(c), t.representativeName.trim() || p(M), t.performerName.trim() || p(u), t.email.trim() || p(Z), t.phone.trim() || p(B), g;
209
+ }
210
+ function f() {
211
+ return S({}, t);
212
+ }
213
+ return { container: o, getValues: f, validate: C };
214
+ }
215
+ function I({
216
+ type: i,
217
+ data: a,
218
+ orderInfo: e,
219
+ theme: t,
220
+ onClose: o,
221
+ onConfirm: s
222
+ }) {
223
+ const r = document.createElement("div");
224
+ r.className = "wgt:fixed wgt:inset-0 wgt:flex wgt:items-center wgt:justify-center wgt:z-50 wgt:p-4", r.style.cssText = `
225
+ background-color: rgba(0, 0, 0, 0.5);
226
+ backdrop-filter: blur(4px);
227
+ `, t && r.setAttribute("data-theme", t);
228
+ const l = document.createElement("div");
229
+ l.className = "wgt:w-full wgt:max-w-md wgt:bg-white wgt:rounded-2xl wgt:shadow-xl wgt:max-h-[90vh] wgt:overflow-y-auto";
230
+ const d = document.createElement("div");
231
+ d.className = "wgt:px-6 wgt:pt-6 wgt:pb-4 wgt:space-y-2";
232
+ const b = document.createElement("h3");
233
+ b.className = "wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950", b.textContent = n("confirmation_popup_title");
234
+ const w = document.createElement("p");
235
+ w.className = "wgt:text-sm wgt:text-center wgt:text-[#525866]", w.textContent = n("confirmation_popup_subtitle"), d.appendChild(b), d.appendChild(w), l.appendChild(d);
236
+ const L = document.createElement("div");
237
+ L.className = "wgt:px-6 wgt:pb-4";
238
+ const x = document.createElement("div");
239
+ x.className = "wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-4 wgt:py-3";
240
+ function c(_, B, C) {
241
+ const f = document.createElement("div");
242
+ f.className = "wgt:flex wgt:items-start wgt:gap-3";
243
+ const g = document.createElement("span");
244
+ g.className = "wgt:text-primary wgt:flex-shrink-0", g.innerHTML = _;
245
+ const p = document.createElement("div");
246
+ p.className = "wgt:flex wgt:items-start wgt:justify-between wgt:flex-1 wgt:gap-2";
247
+ const N = document.createElement("span");
248
+ N.className = "wgt:text-sm wgt:text-[#525866] wgt:w-1/3", N.textContent = B;
249
+ const y = document.createElement("span");
250
+ return y.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", y.textContent = C || "-", p.appendChild(N), p.appendChild(y), f.appendChild(g), f.appendChild(p), f;
251
+ }
252
+ const h = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /></svg>', m = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /></svg>', M = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
253
+ x.appendChild(
254
+ c(
255
+ h,
256
+ n("confirmation_popup_orderCode"),
257
+ e == null ? void 0 : e.billNo
258
+ )
259
+ ), x.appendChild(
260
+ c(
261
+ m,
262
+ n("confirmation_popup_address"),
263
+ e == null ? void 0 : e.merchantAddress
264
+ )
265
+ ), x.appendChild(
266
+ c(
267
+ M,
268
+ n("confirmation_popup_totalAmount"),
269
+ z(e == null ? void 0 : e.amount) + " VND"
270
+ )
271
+ ), L.appendChild(x), l.appendChild(L);
272
+ const H = document.createElement("div");
273
+ H.className = "wgt:px-6 wgt:pb-6";
274
+ const v = document.createElement("div");
275
+ v.className = "wgt:space-y-3 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:px-4 wgt:py-4";
276
+ function E(_, B) {
277
+ const C = document.createElement("div");
278
+ C.className = "wgt:flex wgt:items-start wgt:justify-between wgt:gap-4";
279
+ const f = document.createElement("span");
280
+ f.className = "wgt:text-sm wgt:text-[#0E121B] wgt:w-1/3", f.textContent = _;
281
+ const g = document.createElement("span");
282
+ return g.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", g.textContent = B || "-", C.appendChild(f), C.appendChild(g), C;
283
+ }
284
+ i === "business" ? (v.appendChild(
285
+ E(n("confirmation_popup_taxCode"), a.taxCode)
286
+ ), v.appendChild(
287
+ E(
288
+ n("confirmation_popup_representativeName"),
289
+ a.representativeName
290
+ )
291
+ ), v.appendChild(
292
+ E(n("confirmation_popup_buyerAddress"), a.buyerAddress)
293
+ ), v.appendChild(
294
+ E(n("confirmation_popup_performerName"), a.performerName)
295
+ ), v.appendChild(
296
+ E(n("confirmation_popup_email"), a.email)
297
+ ), v.appendChild(
298
+ E(n("confirmation_popup_phone"), a.phone)
299
+ )) : (v.appendChild(
300
+ E(
301
+ n("confirmation_popup_representativeName"),
302
+ a.representativeName
303
+ )
304
+ ), v.appendChild(
305
+ E(n("confirmation_popup_buyerAddress"), a.buyerAddress)
306
+ ), v.appendChild(
307
+ E(n("confirmation_popup_email"), a.email)
308
+ )), H.appendChild(v), l.appendChild(H);
309
+ const u = document.createElement("div");
310
+ u.className = "wgt:px-6 wgt:pb-6 wgt:flex wgt:gap-3";
311
+ const T = q({
312
+ type: "button",
313
+ title: "Đóng",
314
+ className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-white wgt:text-primary wgt:border wgt:border-primary",
315
+ handleClick: () => {
316
+ typeof o == "function" && o(), r.remove();
317
+ }
318
+ }), Z = q({
319
+ type: "button",
320
+ title: "Xác nhận",
321
+ className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-primary wgt:text-white",
322
+ handleClick: () => {
323
+ typeof s == "function" && s({ type: i, data: a }), r.remove();
324
+ }
325
+ });
326
+ return u.appendChild(T), u.appendChild(Z), l.appendChild(u), r.appendChild(l), r.addEventListener("click", (_) => {
327
+ _.target === r && (typeof o == "function" && o(), r.remove());
328
+ }), { overlay: r };
329
+ }
330
+ function ee({
331
+ orderInfo: i,
332
+ onPreview: a,
333
+ theme: e,
334
+ onSubmit: t,
335
+ taxCode: o = ""
336
+ }) {
337
+ const s = document.createElement("div");
338
+ s.className = "wgt:flex wgt:flex-col wgt:items-center wgt:justify-between wgt:h-full wgt:shadow wgt:rounded-xl", e && s.setAttribute("data-theme", e);
339
+ const r = document.createElement("div");
340
+ r.className = "wgt:w-full wgt:max-w-md wgt:space-y-4 wgt:rounded-xl wgt:bg-white wgt:p-4", s.appendChild(r);
341
+ const l = document.createElement("div");
342
+ l.className = "wgt:space-y-1";
343
+ const d = document.createElement("h3");
344
+ d.className = "wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center", d.textContent = n("invoiceform_title");
345
+ const b = document.createElement("p");
346
+ b.className = "wgt:text-sm wgt:text-weak-700 wgt:text-center wgt:justify-center", b.textContent = n("invoiceform_subtitle"), l.appendChild(d), l.appendChild(b), r.appendChild(l);
347
+ const w = document.createElement("div");
348
+ w.className = "wgt:mt-2 wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-6 wgt:py-6";
349
+ function L(C, f) {
350
+ const g = document.createElement("div");
351
+ g.className = "wgt:flex wgt:items-start";
352
+ const p = document.createElement("div");
353
+ p.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:w-1/3";
354
+ const N = document.createElement("span");
355
+ N.className = "wgt:inline-flex wgt:items-center wgt:justify-center wgt:w-4 wgt:h-4 wgt:text-icon-primary";
356
+ let y = "";
357
+ C === n("orderCode") ? y = `
358
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
359
+ <path d="M12.7996 14H3.19961C3.04048 14 2.88787 13.9368 2.77535 13.8243C2.66282 13.7117 2.59961 13.5591 2.59961 13.4V2.6C2.59961 2.44087 2.66282 2.28826 2.77535 2.17574C2.88787 2.06321 3.04048 2 3.19961 2H12.7996C12.9587 2 13.1114 2.06321 13.2239 2.17574C13.3364 2.28826 13.3996 2.44087 13.3996 2.6V13.4C13.3996 13.5591 13.3364 13.7117 13.2239 13.8243C13.1114 13.9368 12.9587 14 12.7996 14ZM12.1996 12.8V3.2H3.79961V12.8H12.1996ZM5.59961 6.2H10.3996V7.4H5.59961V6.2ZM5.59961 8.6H10.3996V9.8H5.59961V8.6Z" fill="currentColor"/>
360
+ </svg>
361
+
362
+ ` : C === n("address_form") ? y = `
363
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
364
+ <path d="M7.99961 13.34L10.9696 10.37C11.557 9.78256 11.9569 9.03419 12.1189 8.21948C12.281 7.40477 12.1978 6.56031 11.8799 5.79289C11.562 5.02546 11.0236 4.36954 10.333 3.90805C9.64229 3.44657 8.83028 3.20026 7.99961 3.20026C7.16895 3.20026 6.35694 3.44657 5.66626 3.90805C4.97558 4.36954 4.43726 5.02546 4.11936 5.79289C3.80146 6.56031 3.71826 7.40477 3.88028 8.21948C4.04231 9.03419 4.44227 9.78256 5.02961 10.37L7.99961 13.34ZM7.99961 15.0368L4.18121 11.2184C3.42602 10.4631 2.91172 9.50096 2.70337 8.45346C2.49501 7.40597 2.60195 6.32021 3.01067 5.33349C3.41938 4.34678 4.11152 3.50342 4.99954 2.91006C5.88756 2.3167 6.9316 2 7.99961 2C9.06763 2 10.1117 2.3167 10.9997 2.91006C11.8877 3.50342 12.5798 4.34678 12.9886 5.33349C13.3973 6.32021 13.5042 7.40597 13.2959 8.45346C13.0875 9.50096 12.5732 10.4631 11.818 11.2184L7.99961 15.0368ZM7.99961 8.59995C8.31787 8.59995 8.6231 8.47353 8.84814 8.24848C9.07318 8.02344 9.19961 7.71821 9.19961 7.39995C9.19961 7.08169 9.07318 6.77647 8.84814 6.55143C8.6231 6.32638 8.31787 6.19995 7.99961 6.19995C7.68135 6.19995 7.37613 6.32638 7.15108 6.55143C6.92604 6.77647 6.79961 7.08169 6.79961 7.39995C6.79961 7.71821 6.92604 8.02344 7.15108 8.24848C7.37613 8.47353 7.68135 8.59995 7.99961 8.59995ZM7.99961 9.79995C7.36309 9.79995 6.75264 9.5471 6.30256 9.09701C5.85247 8.64692 5.59961 8.03647 5.59961 7.39995C5.59961 6.76343 5.85247 6.15298 6.30256 5.7029C6.75264 5.25281 7.36309 4.99995 7.99961 4.99995C8.63613 4.99995 9.24658 5.25281 9.69667 5.7029C10.1468 6.15298 10.3996 6.76343 10.3996 7.39995C10.3996 8.03647 10.1468 8.64692 9.69667 9.09701C9.24658 9.5471 8.63613 9.79995 7.99961 9.79995Z" fill="currentColor"/>
365
+ </svg>
366
+
367
+ ` : C === n("total_amount") && (y = `
368
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
369
+ <path d="M8 14C4.6862 14 2 11.3138 2 8C2 4.6862 4.6862 2 8 2C11.3138 2 14 4.6862 14 8C14 11.3138 11.3138 14 8 14ZM8 12.8C9.27304 12.8 10.4939 12.2943 11.3941 11.3941C12.2943 10.4939 12.8 9.27304 12.8 8C12.8 6.72696 12.2943 5.50606 11.3941 4.60589C10.4939 3.70571 9.27304 3.2 8 3.2C6.72696 3.2 5.50606 3.70571 4.60589 4.60589C3.70571 5.50606 3.2 6.72696 3.2 8C3.2 9.27304 3.70571 10.4939 4.60589 11.3941C5.50606 12.2943 6.72696 12.8 8 12.8V12.8ZM5.9 9.2H9.2C9.27957 9.2 9.35587 9.16839 9.41213 9.11213C9.46839 9.05587 9.5 8.97957 9.5 8.9C9.5 8.82044 9.46839 8.74413 9.41213 8.68787C9.35587 8.63161 9.27957 8.6 9.2 8.6H6.8C6.40218 8.6 6.02064 8.44197 5.73934 8.16066C5.45804 7.87936 5.3 7.49783 5.3 7.1C5.3 6.70218 5.45804 6.32065 5.73934 6.03934C6.02064 5.75804 6.40218 5.6 6.8 5.6H7.4V4.4H8.6V5.6H10.1V6.8H6.8C6.72044 6.8 6.64413 6.83161 6.58787 6.88787C6.53161 6.94413 6.5 7.02044 6.5 7.1C6.5 7.17957 6.53161 7.25587 6.58787 7.31213C6.64413 7.36839 6.72044 7.4 6.8 7.4H9.2C9.59783 7.4 9.97936 7.55804 10.2607 7.83934C10.542 8.12065 10.7 8.50218 10.7 8.9C10.7 9.29783 10.542 9.67936 10.2607 9.96066C9.97936 10.242 9.59783 10.4 9.2 10.4H8.6V11.6H7.4V10.4H5.9V9.2Z" fill="currentColor"/>
370
+ </svg>
371
+
372
+ `), N.innerHTML = y;
373
+ const V = document.createElement("span");
374
+ V.className = "wgt:text-sm wgt:text-weak-700", V.textContent = C, p.appendChild(N), p.appendChild(V);
375
+ const k = document.createElement("span");
376
+ return k.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:w-2/3 wgt:text-right", k.textContent = f, g.appendChild(p), g.appendChild(k), g;
377
+ }
378
+ w.appendChild(L(n("orderCode"), i == null ? void 0 : i.billNo)), w.appendChild(
379
+ L(n("address_form"), i == null ? void 0 : i.merchantAddress)
380
+ ), w.appendChild(
381
+ L(
382
+ n("total_amount"),
383
+ z(i == null ? void 0 : i.amount) + " VND"
384
+ )
385
+ ), r.appendChild(w);
386
+ const x = document.createElement("div");
387
+ x.className = "wgt:mt-4 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:bg-white wgt:pb-6", r.appendChild(x);
388
+ const c = document.createElement("div");
389
+ c.className = "wgt:flex wgt:border-b wgt:border-[#E1E4EA]", x.appendChild(c);
390
+ const h = document.createElement("button");
391
+ h.type = "button", h.className = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold ", h.innerHTML = `
392
+ <span class="wgt:flex wgt:items-center wgt:justify-center wgt:gap-2">
393
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
394
+ <path d="M10 12C11.4587 12 12.8572 12.5799 13.8887 13.6113C14.8016 14.5242 15.3592 15.7247 15.4756 17H14.9746C14.8598 15.8576 14.3542 14.7839 13.5352 13.9648C12.5975 13.0272 11.3261 12.5 10 12.5C8.67392 12.5 7.40253 13.0272 6.46484 13.9648C5.64577 14.7839 5.14018 15.8576 5.02539 17H4.52441C4.64082 15.7247 5.19843 14.5242 6.11133 13.6113C7.07838 12.6443 8.36805 12.0742 9.72754 12.0068L10 12ZM10 2.25C12.2101 2.25 14 4.03989 14 6.25C14 8.46011 12.2101 10.25 10 10.25C7.78989 10.25 6 8.46011 6 6.25C6 4.03989 7.78989 2.25 10 2.25ZM10 2.75C8.06636 2.75 6.5 4.31636 6.5 6.25C6.5 8.18364 8.06636 9.75 10 9.75C11.9336 9.75 13.5 8.18364 13.5 6.25C13.5 4.31636 11.9336 2.75 10 2.75Z" fill="currentColor" stroke="currentColor"/>
395
+ </svg>
396
+
397
+ ${n("individual")}
398
+ </span>
399
+ `;
400
+ const m = document.createElement("button");
401
+ m.type = "button", m.className = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold", m.innerHTML = `
402
+ <span class="wgt:flex wgt:items-center wgt:justify-center wgt:gap-2">
403
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
404
+ <path d="M4 3.875H11.5C11.5332 3.875 11.5654 3.88769 11.5889 3.91113C11.6123 3.93457 11.625 3.96685 11.625 4V15.875H15.875V8.625H14.375V8.375H16C16.0332 8.375 16.0654 8.38769 16.0889 8.41113C16.1123 8.43457 16.125 8.46685 16.125 8.5V15.875H17.625V16.125H2.375V15.875H3.875V4C3.875 3.96685 3.88769 3.93457 3.91113 3.91113C3.93457 3.88769 3.96685 3.875 4 3.875ZM4.125 15.875H11.375V4.125H4.125V15.875ZM8.625 9.875V10.125H6.875V9.875H8.625ZM8.625 6.875V7.125H6.875V6.875H8.625Z" fill="currentColor" stroke="currentColor" stroke-width="1.25"/>
405
+ </svg>
406
+
407
+ ${n("business")}
408
+ </span>
409
+ `, c.appendChild(h), c.appendChild(m);
410
+ const M = document.createElement("div");
411
+ M.className = "wgt:mt-4 wgt:px-4", x.appendChild(M);
412
+ const H = Q(), v = Y({
413
+ defaultValues: { taxCode: o || "" },
414
+ onFetchByTaxCode: (C) => F(null, null, function* () {
415
+ var g, p;
416
+ const f = yield J(C);
417
+ return {
418
+ representativeName: (g = f.nguoi_dai_dien) != null ? g : "",
419
+ buyerAddress: (p = f.dia_chi) != null ? p : ""
420
+ };
421
+ })
422
+ });
423
+ let E = "individual", u = H;
424
+ function T(C) {
425
+ E = C, h.style.borderBottom = "none", m.style.borderBottom = "none";
426
+ const f = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold";
427
+ C === "individual" ? (h.className = `${f} wgt:text-strong-950`, h.style.borderBottom = "2px solid var(--primary)", m.className = `${f} wgt:text-soft-400`, M.innerHTML = "", M.appendChild(H.container), u = H) : (m.className = `${f} wgt:text-strong-950`, m.style.borderBottom = "2px solid var(--primary)", h.className = `${f} wgt:text-soft-400`, M.innerHTML = "", M.appendChild(v.container), u = v);
428
+ }
429
+ h.addEventListener("click", () => T("individual")), m.addEventListener("click", () => T("business")), T("individual");
430
+ const Z = document.createElement("p");
431
+ Z.className = "wgt:mt-2 wgt:text-xs wgt:text-[#FF8447] wgt:text-left wgt:justify-center", Z.textContent = n("invoiceform_note"), r.appendChild(Z);
432
+ const _ = document.createElement("div");
433
+ _.className = "wgt:mt-6 wgt:w-full wgt:flex wgt:justify-center wgt:items-center";
434
+ const B = q({
435
+ type: "button",
436
+ title: n("btn_preview"),
437
+ className: "wgt:min-w-[163px] wgt:text-white",
438
+ handleClick: () => {
439
+ if (!u.validate())
440
+ return;
441
+ const C = {
442
+ type: E,
443
+ data: u.getValues()
444
+ }, { overlay: f } = I({
445
+ type: C.type,
446
+ data: C.data,
447
+ orderInfo: i,
448
+ theme: e,
449
+ onClose: () => {
450
+ console.log("Popup closed");
451
+ },
452
+ onConfirm: () => F(null, null, function* () {
453
+ var g, p, N;
454
+ f.remove();
455
+ try {
456
+ if (typeof t != "function") return;
457
+ const y = yield t({
458
+ type: C.type,
459
+ data: C.data
460
+ }), V = (N = (p = (g = y == null ? void 0 : y.finalData) != null ? g : y == null ? void 0 : y.data) != null ? p : y) != null ? N : {}, k = String((V == null ? void 0 : V.status) || "").trim().toLowerCase();
461
+ if (k === "invoiced") {
462
+ P({
463
+ message: n("invoice_success"),
464
+ description: n("invoice_description"),
465
+ okLabel: n("close"),
466
+ isSuccess: !0,
467
+ theme: e
468
+ }).open();
469
+ return;
470
+ }
471
+ if (k === "failed") {
472
+ P({
473
+ message: n("invoice_failed"),
474
+ description: n("invoice_description_failed"),
475
+ okLabel: n("close"),
476
+ isSuccess: !1,
477
+ theme: e
478
+ }).open();
479
+ return;
480
+ }
481
+ } catch (y) {
482
+ P({
483
+ message: n("invoice_failed"),
484
+ description: n("invoice_description_failed"),
485
+ okLabel: n("close"),
486
+ isSuccess: !1,
487
+ theme: e
488
+ }).open(), console.error(y);
489
+ }
490
+ })
491
+ });
492
+ document.body.appendChild(f);
493
+ }
494
+ });
495
+ return _.appendChild(B), r.appendChild(_), { container: s };
496
+ }
497
+ function te({ theme: i, onClose: a } = {}) {
498
+ const e = document.createElement("div");
499
+ e.className = " wgt:flex wgt:h-screen wgt:bg-[#F3F4F6] wgt:p-4", i && e.setAttribute("data-theme", i);
500
+ const t = document.createElement("div");
501
+ t.className = "wgt:w-full wgt:max-w-md wgt:max-h-[208px] wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:p-8 wgt:text-center";
502
+ const o = document.createElement("div");
503
+ o.className = "wgt:flex wgt:justify-center wgt:mb-4";
504
+ const s = document.createElement("div");
505
+ s.className = "wgt:w-12 wgt:h-12 wgt:rounded-full wgt:flex wgt:items-center wgt:justify-center", s.style.backgroundColor = "#335CFF", s.innerHTML = `
506
+ <svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
507
+ <path d="M20.7996 22.75H5.19961C4.94102 22.75 4.69303 22.6473 4.51018 22.4644C4.32733 22.2816 4.22461 22.0336 4.22461 21.775V4.225C4.22461 3.96641 4.32733 3.71842 4.51018 3.53557C4.69303 3.35272 4.94102 3.25 5.19961 3.25H20.7996C21.0582 3.25 21.3062 3.35272 21.489 3.53557C21.6719 3.71842 21.7746 3.96641 21.7746 4.225V21.775C21.7746 22.0336 21.6719 22.2816 21.489 22.4644C21.3062 22.6473 21.0582 22.75 20.7996 22.75ZM9.09961 10.075V12.025H16.8996V10.075H9.09961ZM9.09961 13.975V15.925H16.8996V13.975H9.09961Z" fill="white"/>
508
+ </svg>
509
+
510
+ `, o.appendChild(s), t.appendChild(o);
511
+ const r = document.createElement("h2");
512
+ r.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", r.textContent = n("invoiceCheckout_title"), t.appendChild(r);
513
+ const l = document.createElement("p");
514
+ return l.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed", l.textContent = n("invoiceCheckout_description"), t.appendChild(l), e.appendChild(t), { container: e };
515
+ }
516
+ function ne({ theme: i, onClose: a } = {}) {
517
+ const e = document.createElement("div");
518
+ e.className = "wgt:min-h-screen wgt:flex wgt:bg-[#F3F4F6] wgt:p-4", i && e.setAttribute("data-theme", i);
519
+ const t = document.createElement("div");
520
+ t.className = "wgt:w-full wgt:max-w-md wgt:max-h-[252px] wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:px-4 wgt:py-5 wgt:text-center";
521
+ const o = document.createElement("div");
522
+ o.className = "wgt:flex wgt:justify-center wgt:mb-2";
523
+ const s = document.createElement("div");
524
+ s.innerHTML = `
525
+ <svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
526
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M54.1342 21.7247L55.1467 20.5742C56.1143 19.4756 55.9467 17.7277 54.7361 16.6283C53.5262 15.5258 51.7494 15.5022 50.7825 16.6009L49.7715 17.7521L54.1342 21.7247Z" fill="#525866"/>
527
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M36.6582 10.4023H40.9028V14.1966H36.6582V10.4023Z" fill="#99A0AE"/>
528
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M35.076 6.51758H42.4863C43.3495 6.51758 44.0467 7.21472 44.0467 8.08329V9.87377C44.0467 10.7423 43.3495 11.4395 42.4863 11.4395H35.076C34.212 11.4395 33.5156 10.7423 33.5156 9.87377V8.08329C33.5156 7.21472 34.212 6.51758 35.076 6.51758Z" fill="#525866"/>
529
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M38.7787 13.9316C50.4526 13.9316 59.9162 23.4113 59.9162 35.1042C59.9162 46.7987 50.4526 56.2791 38.7787 56.2791C33.0141 56.2791 29.1962 54.3682 21.3722 51.7076L23.5505 49.5141C24.5288 48.5267 23.5695 46.7278 22.125 47.2855C15.5551 49.8128 11.7257 47.1141 9.85831 41.0181C12.6842 42.8139 16.5867 41.5758 17.8095 40.3499C19.7044 38.4535 18.9646 36.26 14.6995 37.6695C9.22974 39.473 3.46364 36.3164 0.693359 28.5092C9.06212 32.7134 9.6785 24.0612 18.5181 26.3667C17.7661 23.3335 15.7273 22.3332 11.0575 22.4528C15.6884 16.6166 22.4236 19.6383 29.5269 16.0673C32.3208 14.6996 35.4583 13.9316 38.7787 13.9316Z" fill="#FF8447"/>
530
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M53.9358 35.102C53.9358 43.4875 47.1518 50.2844 38.7784 50.2844C34.7579 50.2844 30.9026 48.6867 28.06 45.8372C25.218 42.9907 23.6211 39.1286 23.6211 35.102C23.6211 31.073 25.2173 27.2155 28.06 24.3644C30.9026 21.518 34.7579 19.918 38.7784 19.918C47.1518 19.918 53.9358 26.718 53.9358 35.102Z" fill="#F2F2F2"/>
531
+ <path d="M38.5516 22.0568C38.1143 22.0636 37.7631 22.427 37.7676 22.8651V24.0118C37.7676 25.0709 39.36 25.0709 39.36 24.0118V22.8651C39.3676 22.4149 39.0019 22.0491 38.5516 22.0568Z" fill="#808080"/>
532
+ <path d="M38.5516 45.3908C38.1143 45.3946 37.7631 45.7565 37.7676 46.1991V47.342C37.7676 48.4049 39.36 48.4049 39.36 47.342V46.1991C39.3676 45.7496 39.0019 45.3824 38.5516 45.3908Z" fill="#808080"/>
533
+ <path d="M49.64 34.3066C48.5809 34.3066 48.5809 35.8998 49.64 35.8998H50.7828C51.8411 35.8998 51.8411 34.3066 50.7828 34.3066H49.64Z" fill="#808080"/>
534
+ <path d="M26.3406 34.3066C25.2823 34.3066 25.2823 35.8998 26.3406 35.8998H27.4873C28.5463 35.8998 28.5463 34.3066 27.4873 34.3066H26.3406Z" fill="#808080"/>
535
+ <path d="M46.3873 42.1465C45.6711 42.1465 45.3206 43.0151 45.8333 43.5118L46.6379 44.321C46.945 44.6524 47.4653 44.6585 47.7846 44.3415C48.1023 44.0223 48.0916 43.505 47.7602 43.1987L46.9556 42.3903C46.8055 42.2349 46.6029 42.1465 46.3873 42.1465Z" fill="#808080"/>
536
+ <path d="M29.9141 25.6484C29.2002 25.6484 28.8513 26.517 29.361 27.0145L30.1694 27.8191C30.4749 28.149 30.9968 28.162 31.316 27.842C31.6337 27.5242 31.6216 27.0023 31.2917 26.6953L30.4871 25.8915C30.3362 25.7361 30.1297 25.6484 29.9141 25.6484Z" fill="#808080"/>
537
+ <path d="M47.1912 25.6489C46.9847 25.6535 46.7843 25.7411 46.6418 25.8919L45.8373 26.6958C45.5074 27.0028 45.4952 27.5247 45.8129 27.8424C46.1314 28.1617 46.654 28.1495 46.9596 27.8196L47.7641 27.015C48.286 26.5091 47.9157 25.6253 47.1912 25.6489Z" fill="#808080"/>
538
+ <path d="M30.7206 42.1468C30.5142 42.1552 30.3138 42.2382 30.1713 42.3906L29.3629 43.199C29.0323 43.5053 29.0246 44.0226 29.3423 44.3418C29.6608 44.6596 30.182 44.6527 30.489 44.3213L31.2936 43.5121C31.8155 43.0077 31.446 42.1277 30.7206 42.1468Z" fill="#808080"/>
539
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M38.7788 33.9142C39.4439 33.9142 39.9696 34.4369 39.9696 35.1051C39.9696 35.7748 39.4447 36.2959 38.7788 36.2959C38.1144 36.2959 37.5879 35.7748 37.5879 35.1051C37.5879 34.4361 38.1144 33.9142 38.7788 33.9142ZM44.1494 28.6799C43.9468 28.6837 43.7479 28.7675 43.6039 28.9146L39.9376 32.59C39.5826 32.4232 39.1925 32.3234 38.7788 32.3234C37.2542 32.3234 36.0039 33.5813 36.0039 35.1051C36.0039 36.6296 37.2542 37.8891 38.7788 37.8891C40.3033 37.8891 41.5544 36.6296 41.5544 35.1051C41.5544 34.5679 41.3944 34.0712 41.1285 33.6445L44.727 30.0376C45.2367 29.5317 44.8702 28.6632 44.1494 28.6799Z" fill="#808080"/>
540
+ </svg>
541
+
542
+ `, o.appendChild(s), t.appendChild(o);
543
+ const r = document.createElement("h2");
544
+ r.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", r.textContent = n("invoiceExpired_title"), t.appendChild(r);
545
+ const l = document.createElement("p");
546
+ l.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed wgt:px-2 wgt:mb-3", l.textContent = n("invoiceExpired_description"), t.appendChild(l);
547
+ const d = document.createElement("p");
548
+ return d.className = "wgt:text-sm wgt:text-[#99A0AE] wgt:italic wgt:leading-relaxed wgt:px-4", d.textContent = n("invoiceExpired_note"), t.appendChild(d), e.appendChild(t), { container: e };
549
+ }
550
+ function R({ theme: i, onClose: a } = {}) {
551
+ const e = document.createElement("div");
552
+ e.className = "wgt:min-h-screen wgt:flex wgt:items-center wgt:bg-[#F3F4F6] wgt:p-4 wgt:justify-center", i && e.setAttribute("data-theme", i);
553
+ const t = document.createElement("div");
554
+ t.className = "wgt:w-full wgt:items-center wgt:flex wgt:flex-col wgt:min-h-screen wgt:justify-center wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:px-4 wgt:py-5 wgt:text-center";
555
+ const o = document.createElement("div");
556
+ o.className = "wgt:flex wgt:justify-center wgt:mb-2 wgt:items-center wgt:justify-center";
557
+ const s = document.createElement("div");
558
+ s.innerHTML = `
559
+ <svg width="148" height="148" viewBox="0 0 148 148" fill="none" xmlns="http://www.w3.org/2000/svg">
560
+ <path d="M135.244 83.385C135.244 100.471 128.265 115.873 117.075 126.943C106.125 137.892 90.9645 144.51 74.2393 144.51C57.6344 144.51 42.4734 137.772 31.4035 126.943C20.2132 115.873 13.2344 100.471 13.2344 83.385C13.2344 49.5736 40.5482 22.2598 74.2393 22.2598C107.93 22.2598 135.244 49.6939 135.244 83.385Z" fill="#F1F3FA" stroke="#D5DAE5" stroke-width="1.58571" stroke-miterlimit="10"/>
561
+ <path d="M65.7815 28.5312L61.2562 44.4926L72.0884 51.9999L71.3267 70.3394L84.999 45.2472L78.6484 40.1734L85.9114 28.5312H94.065L118.732 55.3638L119.694 132.853C119.694 135.5 117.528 137.546 114.881 137.546H39.317C36.6697 137.546 34.5039 135.38 34.5039 132.853V33.224C34.5039 30.5768 36.6697 28.5312 39.317 28.5312H65.7815Z" fill="white" stroke="#D5DAE5" stroke-width="1.58571" stroke-miterlimit="10" stroke-linejoin="round"/>
562
+ <path d="M60.7974 44.7749H46.2381C45.3958 44.7749 44.6738 44.053 44.6738 43.2107C44.6738 42.3684 45.3958 41.6465 46.2381 41.6465H60.7974C61.6397 41.6465 62.3616 42.3684 62.3616 43.2107C62.3616 44.053 61.6397 44.7749 60.7974 44.7749Z" fill="#D5DAE5"/>
563
+ <path d="M60.1958 53.437H46.2381C45.3958 53.437 44.6738 52.7151 44.6738 51.8728C44.6738 51.0305 45.3958 50.3086 46.2381 50.3086H60.0755C60.9177 50.3086 61.6397 51.0305 61.6397 51.8728C61.6397 52.7151 60.9177 53.437 60.1958 53.437Z" fill="#D5DAE5"/>
564
+ <path d="M93.0469 28.5312V49.9491C93.0469 52.9573 95.694 55.3638 98.7022 55.3638H117.714" fill="#D5DAE5"/>
565
+ <path d="M61.7026 21.3768L57.1523 14.5273" stroke="#AAB2C5" stroke-width="1.58571"/>
566
+ <path d="M73.8365 17.9519L74.3711 0.601562" stroke="#AAB2C5" stroke-width="1.58571"/>
567
+ <path d="M84.7168 21.5372L91.9805 5.77148" stroke="#AAB2C5" stroke-width="1.58571"/>
568
+ <path d="M60.0089 108.149C59.5035 108.149 59.0991 107.947 58.6948 107.644C57.9872 106.936 57.9872 105.723 58.6948 105.016C63.3449 100.467 69.5112 97.9395 76.082 97.9395C82.6528 97.9395 88.8192 100.467 93.4692 105.016C94.1769 105.723 94.1769 106.936 93.4692 107.644C92.7616 108.352 91.5486 108.352 90.8409 107.644C86.8985 103.701 81.6419 101.579 76.082 101.579C70.5221 101.579 65.2655 103.701 61.3231 107.644C60.9187 107.947 60.5144 108.149 60.0089 108.149Z" fill="#AAB2C5"/>
569
+ <path d="M66.3775 81.0578L68.8036 78.6317C69.5113 77.9241 69.5113 76.711 68.8036 76.0034C68.096 75.2958 66.883 75.2958 66.1753 76.0034L63.7492 78.4295L61.3231 76.0034C60.6155 75.2958 59.4024 75.2958 58.6948 76.0034C57.9872 76.711 57.9872 77.9241 58.6948 78.6317L61.1209 81.0578L58.6948 83.4839C57.9872 84.1915 57.9872 85.4046 58.6948 86.1122C59.0991 86.5166 59.5035 86.6177 60.0089 86.6177C60.5144 86.6177 60.9187 86.4155 61.3231 86.1122L63.7492 83.6861L66.1753 86.1122C66.5797 86.5166 66.984 86.6177 67.4895 86.6177C67.9949 86.6177 68.3993 86.4155 68.8036 86.1122C69.5113 85.4046 69.5113 84.1915 68.8036 83.4839L66.3775 81.0578Z" fill="#AAB2C5"/>
570
+ <path d="M90.942 81.0578L93.3681 78.6317C94.0757 77.9241 94.0757 76.711 93.3681 76.0034C92.6605 75.2958 91.4474 75.2958 90.7398 76.0034L88.3137 78.4295L85.8875 76.0034C85.1799 75.2958 83.9669 75.2958 83.2592 76.0034C82.5516 76.711 82.5516 77.9241 83.2592 78.6317L85.6853 81.0578L83.2592 83.4839C82.5516 84.1915 82.5516 85.4046 83.2592 86.1122C83.6636 86.5166 84.0679 86.6177 84.5734 86.6177C85.0788 86.6177 85.4832 86.4155 85.8875 86.1122L88.3137 83.6861L90.7398 86.1122C91.1441 86.5166 91.5485 86.6177 92.0539 86.6177C92.5594 86.6177 92.9637 86.4155 93.3681 86.1122C94.0757 85.4046 94.0757 84.1915 93.3681 83.4839L90.942 81.0578Z" fill="#AAB2C5"/>
571
+ </svg>
572
+
573
+
574
+ `, o.appendChild(s), t.appendChild(o);
575
+ const r = document.createElement("h2");
576
+ return r.className = "wgt:text-base wgt:font-medium wgt:text-[#99A0AE] wgt:mb-2", r.textContent = n("order_not_found_title"), t.appendChild(r), e.appendChild(t), { container: e };
577
+ }
578
+ function O(i) {
579
+ return String(i || "").trim().toLowerCase();
580
+ }
581
+ function ce({ uuid: i, orderInfo: a, theme: e }) {
582
+ const t = document.createElement("div");
583
+ t.className = "wgt:w-full wgt:min-h-screen";
584
+ let o = !1;
585
+ function s(w) {
586
+ o || (t.innerHTML = "", t.appendChild(w));
587
+ }
588
+ function r(w) {
589
+ const L = ee({
590
+ orderInfo: w || {},
591
+ theme: e,
592
+ onSubmit: (h) => F(null, [h], function* ({ type: x, data: c }) {
593
+ const m = ae(x, c);
594
+ return yield K(i, m), { ok: !0, finalData: yield re(i, {
595
+ maxTries: 20,
596
+ intervalMs: 1500
597
+ }) };
598
+ })
599
+ });
600
+ s(L.container);
601
+ }
602
+ function l() {
603
+ return F(this, null, function* () {
604
+ const w = yield D(i);
605
+ if (String((w == null ? void 0 : w.message) || "").trim())
606
+ return s(R({ theme: e }).container);
607
+ const x = O(w == null ? void 0 : w.status);
608
+ return x === "expired" ? s(ne({ theme: e }).container) : x === "invoiced" ? s(te({ theme: e }).container) : r(w || a || {});
609
+ });
610
+ }
611
+ function d() {
612
+ return F(this, null, function* () {
613
+ if (!i)
614
+ return s(R({ theme: e }).container);
615
+ try {
616
+ yield l();
617
+ } catch (w) {
618
+ return console.error("[EINV_FLOW] init error:", w), s(R({ theme: e }).container);
619
+ }
620
+ });
621
+ }
622
+ function b() {
623
+ o = !0, t.innerHTML = "";
624
+ }
625
+ return { container: t, init: d, destroy: b };
626
+ }
627
+ function ie(i) {
628
+ const a = String(i || "").trim().toLowerCase();
629
+ return "individual";
630
+ }
631
+ function ae(i, a) {
632
+ return {
633
+ invoiceType: ie(i),
634
+ buyerName: (a == null ? void 0 : a.representativeName) || "",
635
+ address: (a == null ? void 0 : a.buyerAddress) || "",
636
+ email: (a == null ? void 0 : a.email) || ""
637
+ };
638
+ }
639
+ function re(t) {
640
+ return F(this, arguments, function* (i, { maxTries: a = 20, intervalMs: e = 1500 } = {}) {
641
+ for (let s = 0; s < a; s++) {
642
+ yield oe(e);
643
+ const r = yield D(i), l = O(r == null ? void 0 : r.status);
644
+ if (l === "invoiced")
645
+ return r;
646
+ if (l === "expired") {
647
+ const d = new Error("Invoice request expired while polling");
648
+ throw d.code = "EXPIRED", d.data = r, d;
649
+ }
650
+ }
651
+ const o = new Error("Polling timeout: status not invoiced");
652
+ throw o.code = "POLL_TIMEOUT", o;
653
+ });
654
+ }
655
+ function oe(i) {
656
+ return new Promise((a) => setTimeout(a, i));
657
+ }
658
+ export {
659
+ ce as createInvoiceRequestFlow
660
+ };