@odus/checkout 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout.es.js +1069 -4675
- package/dist/elements.es.js +23 -18
- package/dist/index.css +1 -1
- package/dist/package.json +4 -2
- package/dist/phone.js +3433 -0
- package/dist/shared.js +4084 -0
- package/package.json +4 -2
- package/dist/Alert-B4nrSL91.js +0 -7475
package/dist/shared.js
ADDED
|
@@ -0,0 +1,4084 @@
|
|
|
1
|
+
const we = (i) => i === "test" ? "https://sandbox-api.odus.com" : i === "live" ? "https://api.odus.com" : "http://localhost:3000", ls = async ({
|
|
2
|
+
id: i,
|
|
3
|
+
checkoutKey: e,
|
|
4
|
+
environment: t
|
|
5
|
+
}) => {
|
|
6
|
+
const r = we(t), n = await fetch(`${r}/payments/${i}/checkout-details`, {
|
|
7
|
+
method: "GET",
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
Authorization: `Bearer ${e}`
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
if (!n.ok)
|
|
14
|
+
throw new Error(`HTTP error! Status: ${n.status}`);
|
|
15
|
+
return await n.json();
|
|
16
|
+
};
|
|
17
|
+
var et = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
18
|
+
function k(i) {
|
|
19
|
+
return et.charAt(i);
|
|
20
|
+
}
|
|
21
|
+
function tt(i, e) {
|
|
22
|
+
return i & e;
|
|
23
|
+
}
|
|
24
|
+
function ie(i, e) {
|
|
25
|
+
return i | e;
|
|
26
|
+
}
|
|
27
|
+
function xe(i, e) {
|
|
28
|
+
return i ^ e;
|
|
29
|
+
}
|
|
30
|
+
function Ae(i, e) {
|
|
31
|
+
return i & ~e;
|
|
32
|
+
}
|
|
33
|
+
function it(i) {
|
|
34
|
+
if (i == 0)
|
|
35
|
+
return -1;
|
|
36
|
+
var e = 0;
|
|
37
|
+
return (i & 65535) == 0 && (i >>= 16, e += 16), (i & 255) == 0 && (i >>= 8, e += 8), (i & 15) == 0 && (i >>= 4, e += 4), (i & 3) == 0 && (i >>= 2, e += 2), (i & 1) == 0 && ++e, e;
|
|
38
|
+
}
|
|
39
|
+
function rt(i) {
|
|
40
|
+
for (var e = 0; i != 0; )
|
|
41
|
+
i &= i - 1, ++e;
|
|
42
|
+
return e;
|
|
43
|
+
}
|
|
44
|
+
var H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", $e = "=";
|
|
45
|
+
function X(i) {
|
|
46
|
+
var e, t, r = "";
|
|
47
|
+
for (e = 0; e + 3 <= i.length; e += 3)
|
|
48
|
+
t = parseInt(i.substring(e, e + 3), 16), r += H.charAt(t >> 6) + H.charAt(t & 63);
|
|
49
|
+
for (e + 1 == i.length ? (t = parseInt(i.substring(e, e + 1), 16), r += H.charAt(t << 2)) : e + 2 == i.length && (t = parseInt(i.substring(e, e + 2), 16), r += H.charAt(t >> 2) + H.charAt((t & 3) << 4)); (r.length & 3) > 0; )
|
|
50
|
+
r += $e;
|
|
51
|
+
return r;
|
|
52
|
+
}
|
|
53
|
+
function Re(i) {
|
|
54
|
+
var e = "", t, r = 0, n = 0;
|
|
55
|
+
for (t = 0; t < i.length && i.charAt(t) != $e; ++t) {
|
|
56
|
+
var s = H.indexOf(i.charAt(t));
|
|
57
|
+
s < 0 || (r == 0 ? (e += k(s >> 2), n = s & 3, r = 1) : r == 1 ? (e += k(n << 2 | s >> 4), n = s & 15, r = 2) : r == 2 ? (e += k(n), e += k(s >> 2), n = s & 3, r = 3) : (e += k(n << 2 | s >> 4), e += k(s & 15), r = 0));
|
|
58
|
+
}
|
|
59
|
+
return r == 1 && (e += k(n << 2)), e;
|
|
60
|
+
}
|
|
61
|
+
var j, nt = {
|
|
62
|
+
decode: function(i) {
|
|
63
|
+
var e;
|
|
64
|
+
if (j === void 0) {
|
|
65
|
+
var t = "0123456789ABCDEF", r = ` \f
|
|
66
|
+
\r \u2028\u2029`;
|
|
67
|
+
for (j = {}, e = 0; e < 16; ++e)
|
|
68
|
+
j[t.charAt(e)] = e;
|
|
69
|
+
for (t = t.toLowerCase(), e = 10; e < 16; ++e)
|
|
70
|
+
j[t.charAt(e)] = e;
|
|
71
|
+
for (e = 0; e < r.length; ++e)
|
|
72
|
+
j[r.charAt(e)] = -1;
|
|
73
|
+
}
|
|
74
|
+
var n = [], s = 0, a = 0;
|
|
75
|
+
for (e = 0; e < i.length; ++e) {
|
|
76
|
+
var o = i.charAt(e);
|
|
77
|
+
if (o == "=")
|
|
78
|
+
break;
|
|
79
|
+
if (o = j[o], o != -1) {
|
|
80
|
+
if (o === void 0)
|
|
81
|
+
throw new Error("Illegal character at offset " + e);
|
|
82
|
+
s |= o, ++a >= 2 ? (n[n.length] = s, s = 0, a = 0) : s <<= 4;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (a)
|
|
86
|
+
throw new Error("Hex encoding incomplete: 4 bits missing");
|
|
87
|
+
return n;
|
|
88
|
+
}
|
|
89
|
+
}, O, Se = {
|
|
90
|
+
decode: function(i) {
|
|
91
|
+
var e;
|
|
92
|
+
if (O === void 0) {
|
|
93
|
+
var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = `= \f
|
|
94
|
+
\r \u2028\u2029`;
|
|
95
|
+
for (O = /* @__PURE__ */ Object.create(null), e = 0; e < 64; ++e)
|
|
96
|
+
O[t.charAt(e)] = e;
|
|
97
|
+
for (O["-"] = 62, O._ = 63, e = 0; e < r.length; ++e)
|
|
98
|
+
O[r.charAt(e)] = -1;
|
|
99
|
+
}
|
|
100
|
+
var n = [], s = 0, a = 0;
|
|
101
|
+
for (e = 0; e < i.length; ++e) {
|
|
102
|
+
var o = i.charAt(e);
|
|
103
|
+
if (o == "=")
|
|
104
|
+
break;
|
|
105
|
+
if (o = O[o], o != -1) {
|
|
106
|
+
if (o === void 0)
|
|
107
|
+
throw new Error("Illegal character at offset " + e);
|
|
108
|
+
s |= o, ++a >= 4 ? (n[n.length] = s >> 16, n[n.length] = s >> 8 & 255, n[n.length] = s & 255, s = 0, a = 0) : s <<= 6;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
switch (a) {
|
|
112
|
+
case 1:
|
|
113
|
+
throw new Error("Base64 encoding incomplete: at least 2 bits missing");
|
|
114
|
+
case 2:
|
|
115
|
+
n[n.length] = s >> 10;
|
|
116
|
+
break;
|
|
117
|
+
case 3:
|
|
118
|
+
n[n.length] = s >> 16, n[n.length] = s >> 8 & 255;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
return n;
|
|
122
|
+
},
|
|
123
|
+
re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
|
|
124
|
+
unarmor: function(i) {
|
|
125
|
+
var e = Se.re.exec(i);
|
|
126
|
+
if (e)
|
|
127
|
+
if (e[1])
|
|
128
|
+
i = e[1];
|
|
129
|
+
else if (e[2])
|
|
130
|
+
i = e[2];
|
|
131
|
+
else
|
|
132
|
+
throw new Error("RegExp out of sync");
|
|
133
|
+
return Se.decode(i);
|
|
134
|
+
}
|
|
135
|
+
}, $ = 1e13, J = (
|
|
136
|
+
/** @class */
|
|
137
|
+
function() {
|
|
138
|
+
function i(e) {
|
|
139
|
+
this.buf = [+e || 0];
|
|
140
|
+
}
|
|
141
|
+
return i.prototype.mulAdd = function(e, t) {
|
|
142
|
+
var r = this.buf, n = r.length, s, a;
|
|
143
|
+
for (s = 0; s < n; ++s)
|
|
144
|
+
a = r[s] * e + t, a < $ ? t = 0 : (t = 0 | a / $, a -= t * $), r[s] = a;
|
|
145
|
+
t > 0 && (r[s] = t);
|
|
146
|
+
}, i.prototype.sub = function(e) {
|
|
147
|
+
var t = this.buf, r = t.length, n, s;
|
|
148
|
+
for (n = 0; n < r; ++n)
|
|
149
|
+
s = t[n] - e, s < 0 ? (s += $, e = 1) : e = 0, t[n] = s;
|
|
150
|
+
for (; t[t.length - 1] === 0; )
|
|
151
|
+
t.pop();
|
|
152
|
+
}, i.prototype.toString = function(e) {
|
|
153
|
+
if ((e || 10) != 10)
|
|
154
|
+
throw new Error("only base 10 is supported");
|
|
155
|
+
for (var t = this.buf, r = t[t.length - 1].toString(), n = t.length - 2; n >= 0; --n)
|
|
156
|
+
r += ($ + t[n]).toString().substring(1);
|
|
157
|
+
return r;
|
|
158
|
+
}, i.prototype.valueOf = function() {
|
|
159
|
+
for (var e = this.buf, t = 0, r = e.length - 1; r >= 0; --r)
|
|
160
|
+
t = t * $ + e[r];
|
|
161
|
+
return t;
|
|
162
|
+
}, i.prototype.simplify = function() {
|
|
163
|
+
var e = this.buf;
|
|
164
|
+
return e.length == 1 ? e[0] : this;
|
|
165
|
+
}, i;
|
|
166
|
+
}()
|
|
167
|
+
), He = "…", st = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, at = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
|
|
168
|
+
function K(i, e) {
|
|
169
|
+
return i.length > e && (i = i.substring(0, e) + He), i;
|
|
170
|
+
}
|
|
171
|
+
var ve = (
|
|
172
|
+
/** @class */
|
|
173
|
+
function() {
|
|
174
|
+
function i(e, t) {
|
|
175
|
+
this.hexDigits = "0123456789ABCDEF", e instanceof i ? (this.enc = e.enc, this.pos = e.pos) : (this.enc = e, this.pos = t);
|
|
176
|
+
}
|
|
177
|
+
return i.prototype.get = function(e) {
|
|
178
|
+
if (e === void 0 && (e = this.pos++), e >= this.enc.length)
|
|
179
|
+
throw new Error("Requesting byte offset ".concat(e, " on a stream of length ").concat(this.enc.length));
|
|
180
|
+
return typeof this.enc == "string" ? this.enc.charCodeAt(e) : this.enc[e];
|
|
181
|
+
}, i.prototype.hexByte = function(e) {
|
|
182
|
+
return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(e & 15);
|
|
183
|
+
}, i.prototype.hexDump = function(e, t, r) {
|
|
184
|
+
for (var n = "", s = e; s < t; ++s)
|
|
185
|
+
if (n += this.hexByte(this.get(s)), r !== !0)
|
|
186
|
+
switch (s & 15) {
|
|
187
|
+
case 7:
|
|
188
|
+
n += " ";
|
|
189
|
+
break;
|
|
190
|
+
case 15:
|
|
191
|
+
n += `
|
|
192
|
+
`;
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
n += " ";
|
|
196
|
+
}
|
|
197
|
+
return n;
|
|
198
|
+
}, i.prototype.isASCII = function(e, t) {
|
|
199
|
+
for (var r = e; r < t; ++r) {
|
|
200
|
+
var n = this.get(r);
|
|
201
|
+
if (n < 32 || n > 176)
|
|
202
|
+
return !1;
|
|
203
|
+
}
|
|
204
|
+
return !0;
|
|
205
|
+
}, i.prototype.parseStringISO = function(e, t) {
|
|
206
|
+
for (var r = "", n = e; n < t; ++n)
|
|
207
|
+
r += String.fromCharCode(this.get(n));
|
|
208
|
+
return r;
|
|
209
|
+
}, i.prototype.parseStringUTF = function(e, t) {
|
|
210
|
+
for (var r = "", n = e; n < t; ) {
|
|
211
|
+
var s = this.get(n++);
|
|
212
|
+
s < 128 ? r += String.fromCharCode(s) : s > 191 && s < 224 ? r += String.fromCharCode((s & 31) << 6 | this.get(n++) & 63) : r += String.fromCharCode((s & 15) << 12 | (this.get(n++) & 63) << 6 | this.get(n++) & 63);
|
|
213
|
+
}
|
|
214
|
+
return r;
|
|
215
|
+
}, i.prototype.parseStringBMP = function(e, t) {
|
|
216
|
+
for (var r = "", n, s, a = e; a < t; )
|
|
217
|
+
n = this.get(a++), s = this.get(a++), r += String.fromCharCode(n << 8 | s);
|
|
218
|
+
return r;
|
|
219
|
+
}, i.prototype.parseTime = function(e, t, r) {
|
|
220
|
+
var n = this.parseStringISO(e, t), s = (r ? st : at).exec(n);
|
|
221
|
+
return s ? (r && (s[1] = +s[1], s[1] += +s[1] < 70 ? 2e3 : 1900), n = s[1] + "-" + s[2] + "-" + s[3] + " " + s[4], s[5] && (n += ":" + s[5], s[6] && (n += ":" + s[6], s[7] && (n += "." + s[7]))), s[8] && (n += " UTC", s[8] != "Z" && (n += s[8], s[9] && (n += ":" + s[9]))), n) : "Unrecognized time: " + n;
|
|
222
|
+
}, i.prototype.parseInteger = function(e, t) {
|
|
223
|
+
for (var r = this.get(e), n = r > 127, s = n ? 255 : 0, a, o = ""; r == s && ++e < t; )
|
|
224
|
+
r = this.get(e);
|
|
225
|
+
if (a = t - e, a === 0)
|
|
226
|
+
return n ? -1 : 0;
|
|
227
|
+
if (a > 4) {
|
|
228
|
+
for (o = r, a <<= 3; ((+o ^ s) & 128) == 0; )
|
|
229
|
+
o = +o << 1, --a;
|
|
230
|
+
o = "(" + a + ` bit)
|
|
231
|
+
`;
|
|
232
|
+
}
|
|
233
|
+
n && (r = r - 256);
|
|
234
|
+
for (var l = new J(r), h = e + 1; h < t; ++h)
|
|
235
|
+
l.mulAdd(256, this.get(h));
|
|
236
|
+
return o + l.toString();
|
|
237
|
+
}, i.prototype.parseBitString = function(e, t, r) {
|
|
238
|
+
for (var n = this.get(e), s = (t - e - 1 << 3) - n, a = "(" + s + ` bit)
|
|
239
|
+
`, o = "", l = e + 1; l < t; ++l) {
|
|
240
|
+
for (var h = this.get(l), u = l == t - 1 ? n : 0, d = 7; d >= u; --d)
|
|
241
|
+
o += h >> d & 1 ? "1" : "0";
|
|
242
|
+
if (o.length > r)
|
|
243
|
+
return a + K(o, r);
|
|
244
|
+
}
|
|
245
|
+
return a + o;
|
|
246
|
+
}, i.prototype.parseOctetString = function(e, t, r) {
|
|
247
|
+
if (this.isASCII(e, t))
|
|
248
|
+
return K(this.parseStringISO(e, t), r);
|
|
249
|
+
var n = t - e, s = "(" + n + ` byte)
|
|
250
|
+
`;
|
|
251
|
+
r /= 2, n > r && (t = e + r);
|
|
252
|
+
for (var a = e; a < t; ++a)
|
|
253
|
+
s += this.hexByte(this.get(a));
|
|
254
|
+
return n > r && (s += He), s;
|
|
255
|
+
}, i.prototype.parseOID = function(e, t, r) {
|
|
256
|
+
for (var n = "", s = new J(), a = 0, o = e; o < t; ++o) {
|
|
257
|
+
var l = this.get(o);
|
|
258
|
+
if (s.mulAdd(128, l & 127), a += 7, !(l & 128)) {
|
|
259
|
+
if (n === "")
|
|
260
|
+
if (s = s.simplify(), s instanceof J)
|
|
261
|
+
s.sub(80), n = "2." + s.toString();
|
|
262
|
+
else {
|
|
263
|
+
var h = s < 80 ? s < 40 ? 0 : 1 : 2;
|
|
264
|
+
n = h + "." + (s - h * 40);
|
|
265
|
+
}
|
|
266
|
+
else
|
|
267
|
+
n += "." + s.toString();
|
|
268
|
+
if (n.length > r)
|
|
269
|
+
return K(n, r);
|
|
270
|
+
s = new J(), a = 0;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return a > 0 && (n += ".incomplete"), n;
|
|
274
|
+
}, i;
|
|
275
|
+
}()
|
|
276
|
+
), ot = (
|
|
277
|
+
/** @class */
|
|
278
|
+
function() {
|
|
279
|
+
function i(e, t, r, n, s) {
|
|
280
|
+
if (!(n instanceof Ie))
|
|
281
|
+
throw new Error("Invalid tag value.");
|
|
282
|
+
this.stream = e, this.header = t, this.length = r, this.tag = n, this.sub = s;
|
|
283
|
+
}
|
|
284
|
+
return i.prototype.typeName = function() {
|
|
285
|
+
switch (this.tag.tagClass) {
|
|
286
|
+
case 0:
|
|
287
|
+
switch (this.tag.tagNumber) {
|
|
288
|
+
case 0:
|
|
289
|
+
return "EOC";
|
|
290
|
+
case 1:
|
|
291
|
+
return "BOOLEAN";
|
|
292
|
+
case 2:
|
|
293
|
+
return "INTEGER";
|
|
294
|
+
case 3:
|
|
295
|
+
return "BIT_STRING";
|
|
296
|
+
case 4:
|
|
297
|
+
return "OCTET_STRING";
|
|
298
|
+
case 5:
|
|
299
|
+
return "NULL";
|
|
300
|
+
case 6:
|
|
301
|
+
return "OBJECT_IDENTIFIER";
|
|
302
|
+
case 7:
|
|
303
|
+
return "ObjectDescriptor";
|
|
304
|
+
case 8:
|
|
305
|
+
return "EXTERNAL";
|
|
306
|
+
case 9:
|
|
307
|
+
return "REAL";
|
|
308
|
+
case 10:
|
|
309
|
+
return "ENUMERATED";
|
|
310
|
+
case 11:
|
|
311
|
+
return "EMBEDDED_PDV";
|
|
312
|
+
case 12:
|
|
313
|
+
return "UTF8String";
|
|
314
|
+
case 16:
|
|
315
|
+
return "SEQUENCE";
|
|
316
|
+
case 17:
|
|
317
|
+
return "SET";
|
|
318
|
+
case 18:
|
|
319
|
+
return "NumericString";
|
|
320
|
+
case 19:
|
|
321
|
+
return "PrintableString";
|
|
322
|
+
// ASCII subset
|
|
323
|
+
case 20:
|
|
324
|
+
return "TeletexString";
|
|
325
|
+
// aka T61String
|
|
326
|
+
case 21:
|
|
327
|
+
return "VideotexString";
|
|
328
|
+
case 22:
|
|
329
|
+
return "IA5String";
|
|
330
|
+
// ASCII
|
|
331
|
+
case 23:
|
|
332
|
+
return "UTCTime";
|
|
333
|
+
case 24:
|
|
334
|
+
return "GeneralizedTime";
|
|
335
|
+
case 25:
|
|
336
|
+
return "GraphicString";
|
|
337
|
+
case 26:
|
|
338
|
+
return "VisibleString";
|
|
339
|
+
// ASCII subset
|
|
340
|
+
case 27:
|
|
341
|
+
return "GeneralString";
|
|
342
|
+
case 28:
|
|
343
|
+
return "UniversalString";
|
|
344
|
+
case 30:
|
|
345
|
+
return "BMPString";
|
|
346
|
+
}
|
|
347
|
+
return "Universal_" + this.tag.tagNumber.toString();
|
|
348
|
+
case 1:
|
|
349
|
+
return "Application_" + this.tag.tagNumber.toString();
|
|
350
|
+
case 2:
|
|
351
|
+
return "[" + this.tag.tagNumber.toString() + "]";
|
|
352
|
+
// Context
|
|
353
|
+
case 3:
|
|
354
|
+
return "Private_" + this.tag.tagNumber.toString();
|
|
355
|
+
}
|
|
356
|
+
}, i.prototype.content = function(e) {
|
|
357
|
+
if (this.tag === void 0)
|
|
358
|
+
return null;
|
|
359
|
+
e === void 0 && (e = 1 / 0);
|
|
360
|
+
var t = this.posContent(), r = Math.abs(this.length);
|
|
361
|
+
if (!this.tag.isUniversal())
|
|
362
|
+
return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(t, t + r, e);
|
|
363
|
+
switch (this.tag.tagNumber) {
|
|
364
|
+
case 1:
|
|
365
|
+
return this.stream.get(t) === 0 ? "false" : "true";
|
|
366
|
+
case 2:
|
|
367
|
+
return this.stream.parseInteger(t, t + r);
|
|
368
|
+
case 3:
|
|
369
|
+
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(t, t + r, e);
|
|
370
|
+
case 4:
|
|
371
|
+
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(t, t + r, e);
|
|
372
|
+
// case 0x05: // NULL
|
|
373
|
+
case 6:
|
|
374
|
+
return this.stream.parseOID(t, t + r, e);
|
|
375
|
+
// case 0x07: // ObjectDescriptor
|
|
376
|
+
// case 0x08: // EXTERNAL
|
|
377
|
+
// case 0x09: // REAL
|
|
378
|
+
// case 0x0A: // ENUMERATED
|
|
379
|
+
// case 0x0B: // EMBEDDED_PDV
|
|
380
|
+
case 16:
|
|
381
|
+
// SEQUENCE
|
|
382
|
+
case 17:
|
|
383
|
+
return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)";
|
|
384
|
+
case 12:
|
|
385
|
+
return K(this.stream.parseStringUTF(t, t + r), e);
|
|
386
|
+
case 18:
|
|
387
|
+
// NumericString
|
|
388
|
+
case 19:
|
|
389
|
+
// PrintableString
|
|
390
|
+
case 20:
|
|
391
|
+
// TeletexString
|
|
392
|
+
case 21:
|
|
393
|
+
// VideotexString
|
|
394
|
+
case 22:
|
|
395
|
+
// IA5String
|
|
396
|
+
// case 0x19: // GraphicString
|
|
397
|
+
case 26:
|
|
398
|
+
return K(this.stream.parseStringISO(t, t + r), e);
|
|
399
|
+
case 30:
|
|
400
|
+
return K(this.stream.parseStringBMP(t, t + r), e);
|
|
401
|
+
case 23:
|
|
402
|
+
// UTCTime
|
|
403
|
+
case 24:
|
|
404
|
+
return this.stream.parseTime(t, t + r, this.tag.tagNumber == 23);
|
|
405
|
+
}
|
|
406
|
+
return null;
|
|
407
|
+
}, i.prototype.toString = function() {
|
|
408
|
+
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
|
|
409
|
+
}, i.prototype.toPrettyString = function(e) {
|
|
410
|
+
e === void 0 && (e = "");
|
|
411
|
+
var t = e + this.typeName() + " @" + this.stream.pos;
|
|
412
|
+
if (this.length >= 0 && (t += "+"), t += this.length, this.tag.tagConstructed ? t += " (constructed)" : this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null && (t += " (encapsulates)"), t += `
|
|
413
|
+
`, this.sub !== null) {
|
|
414
|
+
e += " ";
|
|
415
|
+
for (var r = 0, n = this.sub.length; r < n; ++r)
|
|
416
|
+
t += this.sub[r].toPrettyString(e);
|
|
417
|
+
}
|
|
418
|
+
return t;
|
|
419
|
+
}, i.prototype.posStart = function() {
|
|
420
|
+
return this.stream.pos;
|
|
421
|
+
}, i.prototype.posContent = function() {
|
|
422
|
+
return this.stream.pos + this.header;
|
|
423
|
+
}, i.prototype.posEnd = function() {
|
|
424
|
+
return this.stream.pos + this.header + Math.abs(this.length);
|
|
425
|
+
}, i.prototype.toHexString = function() {
|
|
426
|
+
return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
|
|
427
|
+
}, i.decodeLength = function(e) {
|
|
428
|
+
var t = e.get(), r = t & 127;
|
|
429
|
+
if (r == t)
|
|
430
|
+
return r;
|
|
431
|
+
if (r > 6)
|
|
432
|
+
throw new Error("Length over 48 bits not supported at position " + (e.pos - 1));
|
|
433
|
+
if (r === 0)
|
|
434
|
+
return null;
|
|
435
|
+
t = 0;
|
|
436
|
+
for (var n = 0; n < r; ++n)
|
|
437
|
+
t = t * 256 + e.get();
|
|
438
|
+
return t;
|
|
439
|
+
}, i.prototype.getHexStringValue = function() {
|
|
440
|
+
var e = this.toHexString(), t = this.header * 2, r = this.length * 2;
|
|
441
|
+
return e.substring(t, t + r);
|
|
442
|
+
}, i.decode = function(e) {
|
|
443
|
+
var t;
|
|
444
|
+
e instanceof ve ? t = e : t = new ve(e, 0);
|
|
445
|
+
var r = new ve(t), n = new Ie(t), s = i.decodeLength(t), a = t.pos, o = a - r.pos, l = null, h = function() {
|
|
446
|
+
var d = [];
|
|
447
|
+
if (s !== null) {
|
|
448
|
+
for (var p = a + s; t.pos < p; )
|
|
449
|
+
d[d.length] = i.decode(t);
|
|
450
|
+
if (t.pos != p)
|
|
451
|
+
throw new Error("Content size is not correct for container starting at offset " + a);
|
|
452
|
+
} else
|
|
453
|
+
try {
|
|
454
|
+
for (; ; ) {
|
|
455
|
+
var f = i.decode(t);
|
|
456
|
+
if (f.tag.isEOC())
|
|
457
|
+
break;
|
|
458
|
+
d[d.length] = f;
|
|
459
|
+
}
|
|
460
|
+
s = a - t.pos;
|
|
461
|
+
} catch (g) {
|
|
462
|
+
throw new Error("Exception while decoding undefined length content: " + g);
|
|
463
|
+
}
|
|
464
|
+
return d;
|
|
465
|
+
};
|
|
466
|
+
if (n.tagConstructed)
|
|
467
|
+
l = h();
|
|
468
|
+
else if (n.isUniversal() && (n.tagNumber == 3 || n.tagNumber == 4))
|
|
469
|
+
try {
|
|
470
|
+
if (n.tagNumber == 3 && t.get() != 0)
|
|
471
|
+
throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
|
|
472
|
+
l = h();
|
|
473
|
+
for (var u = 0; u < l.length; ++u)
|
|
474
|
+
if (l[u].tag.isEOC())
|
|
475
|
+
throw new Error("EOC is not supposed to be actual content.");
|
|
476
|
+
} catch {
|
|
477
|
+
l = null;
|
|
478
|
+
}
|
|
479
|
+
if (l === null) {
|
|
480
|
+
if (s === null)
|
|
481
|
+
throw new Error("We can't skip over an invalid tag with undefined length at offset " + a);
|
|
482
|
+
t.pos = a + Math.abs(s);
|
|
483
|
+
}
|
|
484
|
+
return new i(r, o, s, n, l);
|
|
485
|
+
}, i;
|
|
486
|
+
}()
|
|
487
|
+
), Ie = (
|
|
488
|
+
/** @class */
|
|
489
|
+
function() {
|
|
490
|
+
function i(e) {
|
|
491
|
+
var t = e.get();
|
|
492
|
+
if (this.tagClass = t >> 6, this.tagConstructed = (t & 32) !== 0, this.tagNumber = t & 31, this.tagNumber == 31) {
|
|
493
|
+
var r = new J();
|
|
494
|
+
do
|
|
495
|
+
t = e.get(), r.mulAdd(128, t & 127);
|
|
496
|
+
while (t & 128);
|
|
497
|
+
this.tagNumber = r.simplify();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return i.prototype.isUniversal = function() {
|
|
501
|
+
return this.tagClass === 0;
|
|
502
|
+
}, i.prototype.isEOC = function() {
|
|
503
|
+
return this.tagClass === 0 && this.tagNumber === 0;
|
|
504
|
+
}, i;
|
|
505
|
+
}()
|
|
506
|
+
), q, lt = 244837814094590, Ce = (lt & 16777215) == 15715070, R = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], ct = (1 << 26) / R[R.length - 1], m = (
|
|
507
|
+
/** @class */
|
|
508
|
+
function() {
|
|
509
|
+
function i(e, t, r) {
|
|
510
|
+
e != null && (typeof e == "number" ? this.fromNumber(e, t, r) : t == null && typeof e != "string" ? this.fromString(e, 256) : this.fromString(e, t));
|
|
511
|
+
}
|
|
512
|
+
return i.prototype.toString = function(e) {
|
|
513
|
+
if (this.s < 0)
|
|
514
|
+
return "-" + this.negate().toString(e);
|
|
515
|
+
var t;
|
|
516
|
+
if (e == 16)
|
|
517
|
+
t = 4;
|
|
518
|
+
else if (e == 8)
|
|
519
|
+
t = 3;
|
|
520
|
+
else if (e == 2)
|
|
521
|
+
t = 1;
|
|
522
|
+
else if (e == 32)
|
|
523
|
+
t = 5;
|
|
524
|
+
else if (e == 4)
|
|
525
|
+
t = 2;
|
|
526
|
+
else
|
|
527
|
+
return this.toRadix(e);
|
|
528
|
+
var r = (1 << t) - 1, n, s = !1, a = "", o = this.t, l = this.DB - o * this.DB % t;
|
|
529
|
+
if (o-- > 0)
|
|
530
|
+
for (l < this.DB && (n = this[o] >> l) > 0 && (s = !0, a = k(n)); o >= 0; )
|
|
531
|
+
l < t ? (n = (this[o] & (1 << l) - 1) << t - l, n |= this[--o] >> (l += this.DB - t)) : (n = this[o] >> (l -= t) & r, l <= 0 && (l += this.DB, --o)), n > 0 && (s = !0), s && (a += k(n));
|
|
532
|
+
return s ? a : "0";
|
|
533
|
+
}, i.prototype.negate = function() {
|
|
534
|
+
var e = v();
|
|
535
|
+
return i.ZERO.subTo(this, e), e;
|
|
536
|
+
}, i.prototype.abs = function() {
|
|
537
|
+
return this.s < 0 ? this.negate() : this;
|
|
538
|
+
}, i.prototype.compareTo = function(e) {
|
|
539
|
+
var t = this.s - e.s;
|
|
540
|
+
if (t != 0)
|
|
541
|
+
return t;
|
|
542
|
+
var r = this.t;
|
|
543
|
+
if (t = r - e.t, t != 0)
|
|
544
|
+
return this.s < 0 ? -t : t;
|
|
545
|
+
for (; --r >= 0; )
|
|
546
|
+
if ((t = this[r] - e[r]) != 0)
|
|
547
|
+
return t;
|
|
548
|
+
return 0;
|
|
549
|
+
}, i.prototype.bitLength = function() {
|
|
550
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + re(this[this.t - 1] ^ this.s & this.DM);
|
|
551
|
+
}, i.prototype.mod = function(e) {
|
|
552
|
+
var t = v();
|
|
553
|
+
return this.abs().divRemTo(e, null, t), this.s < 0 && t.compareTo(i.ZERO) > 0 && e.subTo(t, t), t;
|
|
554
|
+
}, i.prototype.modPowInt = function(e, t) {
|
|
555
|
+
var r;
|
|
556
|
+
return e < 256 || t.isEven() ? r = new Le(t) : r = new De(t), this.exp(e, r);
|
|
557
|
+
}, i.prototype.clone = function() {
|
|
558
|
+
var e = v();
|
|
559
|
+
return this.copyTo(e), e;
|
|
560
|
+
}, i.prototype.intValue = function() {
|
|
561
|
+
if (this.s < 0) {
|
|
562
|
+
if (this.t == 1)
|
|
563
|
+
return this[0] - this.DV;
|
|
564
|
+
if (this.t == 0)
|
|
565
|
+
return -1;
|
|
566
|
+
} else {
|
|
567
|
+
if (this.t == 1)
|
|
568
|
+
return this[0];
|
|
569
|
+
if (this.t == 0)
|
|
570
|
+
return 0;
|
|
571
|
+
}
|
|
572
|
+
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
573
|
+
}, i.prototype.byteValue = function() {
|
|
574
|
+
return this.t == 0 ? this.s : this[0] << 24 >> 24;
|
|
575
|
+
}, i.prototype.shortValue = function() {
|
|
576
|
+
return this.t == 0 ? this.s : this[0] << 16 >> 16;
|
|
577
|
+
}, i.prototype.signum = function() {
|
|
578
|
+
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
|
|
579
|
+
}, i.prototype.toByteArray = function() {
|
|
580
|
+
var e = this.t, t = [];
|
|
581
|
+
t[0] = this.s;
|
|
582
|
+
var r = this.DB - e * this.DB % 8, n, s = 0;
|
|
583
|
+
if (e-- > 0)
|
|
584
|
+
for (r < this.DB && (n = this[e] >> r) != (this.s & this.DM) >> r && (t[s++] = n | this.s << this.DB - r); e >= 0; )
|
|
585
|
+
r < 8 ? (n = (this[e] & (1 << r) - 1) << 8 - r, n |= this[--e] >> (r += this.DB - 8)) : (n = this[e] >> (r -= 8) & 255, r <= 0 && (r += this.DB, --e)), (n & 128) != 0 && (n |= -256), s == 0 && (this.s & 128) != (n & 128) && ++s, (s > 0 || n != this.s) && (t[s++] = n);
|
|
586
|
+
return t;
|
|
587
|
+
}, i.prototype.equals = function(e) {
|
|
588
|
+
return this.compareTo(e) == 0;
|
|
589
|
+
}, i.prototype.min = function(e) {
|
|
590
|
+
return this.compareTo(e) < 0 ? this : e;
|
|
591
|
+
}, i.prototype.max = function(e) {
|
|
592
|
+
return this.compareTo(e) > 0 ? this : e;
|
|
593
|
+
}, i.prototype.and = function(e) {
|
|
594
|
+
var t = v();
|
|
595
|
+
return this.bitwiseTo(e, tt, t), t;
|
|
596
|
+
}, i.prototype.or = function(e) {
|
|
597
|
+
var t = v();
|
|
598
|
+
return this.bitwiseTo(e, ie, t), t;
|
|
599
|
+
}, i.prototype.xor = function(e) {
|
|
600
|
+
var t = v();
|
|
601
|
+
return this.bitwiseTo(e, xe, t), t;
|
|
602
|
+
}, i.prototype.andNot = function(e) {
|
|
603
|
+
var t = v();
|
|
604
|
+
return this.bitwiseTo(e, Ae, t), t;
|
|
605
|
+
}, i.prototype.not = function() {
|
|
606
|
+
for (var e = v(), t = 0; t < this.t; ++t)
|
|
607
|
+
e[t] = this.DM & ~this[t];
|
|
608
|
+
return e.t = this.t, e.s = ~this.s, e;
|
|
609
|
+
}, i.prototype.shiftLeft = function(e) {
|
|
610
|
+
var t = v();
|
|
611
|
+
return e < 0 ? this.rShiftTo(-e, t) : this.lShiftTo(e, t), t;
|
|
612
|
+
}, i.prototype.shiftRight = function(e) {
|
|
613
|
+
var t = v();
|
|
614
|
+
return e < 0 ? this.lShiftTo(-e, t) : this.rShiftTo(e, t), t;
|
|
615
|
+
}, i.prototype.getLowestSetBit = function() {
|
|
616
|
+
for (var e = 0; e < this.t; ++e)
|
|
617
|
+
if (this[e] != 0)
|
|
618
|
+
return e * this.DB + it(this[e]);
|
|
619
|
+
return this.s < 0 ? this.t * this.DB : -1;
|
|
620
|
+
}, i.prototype.bitCount = function() {
|
|
621
|
+
for (var e = 0, t = this.s & this.DM, r = 0; r < this.t; ++r)
|
|
622
|
+
e += rt(this[r] ^ t);
|
|
623
|
+
return e;
|
|
624
|
+
}, i.prototype.testBit = function(e) {
|
|
625
|
+
var t = Math.floor(e / this.DB);
|
|
626
|
+
return t >= this.t ? this.s != 0 : (this[t] & 1 << e % this.DB) != 0;
|
|
627
|
+
}, i.prototype.setBit = function(e) {
|
|
628
|
+
return this.changeBit(e, ie);
|
|
629
|
+
}, i.prototype.clearBit = function(e) {
|
|
630
|
+
return this.changeBit(e, Ae);
|
|
631
|
+
}, i.prototype.flipBit = function(e) {
|
|
632
|
+
return this.changeBit(e, xe);
|
|
633
|
+
}, i.prototype.add = function(e) {
|
|
634
|
+
var t = v();
|
|
635
|
+
return this.addTo(e, t), t;
|
|
636
|
+
}, i.prototype.subtract = function(e) {
|
|
637
|
+
var t = v();
|
|
638
|
+
return this.subTo(e, t), t;
|
|
639
|
+
}, i.prototype.multiply = function(e) {
|
|
640
|
+
var t = v();
|
|
641
|
+
return this.multiplyTo(e, t), t;
|
|
642
|
+
}, i.prototype.divide = function(e) {
|
|
643
|
+
var t = v();
|
|
644
|
+
return this.divRemTo(e, t, null), t;
|
|
645
|
+
}, i.prototype.remainder = function(e) {
|
|
646
|
+
var t = v();
|
|
647
|
+
return this.divRemTo(e, null, t), t;
|
|
648
|
+
}, i.prototype.divideAndRemainder = function(e) {
|
|
649
|
+
var t = v(), r = v();
|
|
650
|
+
return this.divRemTo(e, t, r), [t, r];
|
|
651
|
+
}, i.prototype.modPow = function(e, t) {
|
|
652
|
+
var r = e.bitLength(), n, s = V(1), a;
|
|
653
|
+
if (r <= 0)
|
|
654
|
+
return s;
|
|
655
|
+
r < 18 ? n = 1 : r < 48 ? n = 3 : r < 144 ? n = 4 : r < 768 ? n = 5 : n = 6, r < 8 ? a = new Le(t) : t.isEven() ? a = new dt(t) : a = new De(t);
|
|
656
|
+
var o = [], l = 3, h = n - 1, u = (1 << n) - 1;
|
|
657
|
+
if (o[1] = a.convert(this), n > 1) {
|
|
658
|
+
var d = v();
|
|
659
|
+
for (a.sqrTo(o[1], d); l <= u; )
|
|
660
|
+
o[l] = v(), a.mulTo(d, o[l - 2], o[l]), l += 2;
|
|
661
|
+
}
|
|
662
|
+
var p = e.t - 1, f, g = !0, b = v(), E;
|
|
663
|
+
for (r = re(e[p]) - 1; p >= 0; ) {
|
|
664
|
+
for (r >= h ? f = e[p] >> r - h & u : (f = (e[p] & (1 << r + 1) - 1) << h - r, p > 0 && (f |= e[p - 1] >> this.DB + r - h)), l = n; (f & 1) == 0; )
|
|
665
|
+
f >>= 1, --l;
|
|
666
|
+
if ((r -= l) < 0 && (r += this.DB, --p), g)
|
|
667
|
+
o[f].copyTo(s), g = !1;
|
|
668
|
+
else {
|
|
669
|
+
for (; l > 1; )
|
|
670
|
+
a.sqrTo(s, b), a.sqrTo(b, s), l -= 2;
|
|
671
|
+
l > 0 ? a.sqrTo(s, b) : (E = s, s = b, b = E), a.mulTo(b, o[f], s);
|
|
672
|
+
}
|
|
673
|
+
for (; p >= 0 && (e[p] & 1 << r) == 0; )
|
|
674
|
+
a.sqrTo(s, b), E = s, s = b, b = E, --r < 0 && (r = this.DB - 1, --p);
|
|
675
|
+
}
|
|
676
|
+
return a.revert(s);
|
|
677
|
+
}, i.prototype.modInverse = function(e) {
|
|
678
|
+
var t = e.isEven();
|
|
679
|
+
if (this.isEven() && t || e.signum() == 0)
|
|
680
|
+
return i.ZERO;
|
|
681
|
+
for (var r = e.clone(), n = this.clone(), s = V(1), a = V(0), o = V(0), l = V(1); r.signum() != 0; ) {
|
|
682
|
+
for (; r.isEven(); )
|
|
683
|
+
r.rShiftTo(1, r), t ? ((!s.isEven() || !a.isEven()) && (s.addTo(this, s), a.subTo(e, a)), s.rShiftTo(1, s)) : a.isEven() || a.subTo(e, a), a.rShiftTo(1, a);
|
|
684
|
+
for (; n.isEven(); )
|
|
685
|
+
n.rShiftTo(1, n), t ? ((!o.isEven() || !l.isEven()) && (o.addTo(this, o), l.subTo(e, l)), o.rShiftTo(1, o)) : l.isEven() || l.subTo(e, l), l.rShiftTo(1, l);
|
|
686
|
+
r.compareTo(n) >= 0 ? (r.subTo(n, r), t && s.subTo(o, s), a.subTo(l, a)) : (n.subTo(r, n), t && o.subTo(s, o), l.subTo(a, l));
|
|
687
|
+
}
|
|
688
|
+
if (n.compareTo(i.ONE) != 0)
|
|
689
|
+
return i.ZERO;
|
|
690
|
+
if (l.compareTo(e) >= 0)
|
|
691
|
+
return l.subtract(e);
|
|
692
|
+
if (l.signum() < 0)
|
|
693
|
+
l.addTo(e, l);
|
|
694
|
+
else
|
|
695
|
+
return l;
|
|
696
|
+
return l.signum() < 0 ? l.add(e) : l;
|
|
697
|
+
}, i.prototype.pow = function(e) {
|
|
698
|
+
return this.exp(e, new ht());
|
|
699
|
+
}, i.prototype.gcd = function(e) {
|
|
700
|
+
var t = this.s < 0 ? this.negate() : this.clone(), r = e.s < 0 ? e.negate() : e.clone();
|
|
701
|
+
if (t.compareTo(r) < 0) {
|
|
702
|
+
var n = t;
|
|
703
|
+
t = r, r = n;
|
|
704
|
+
}
|
|
705
|
+
var s = t.getLowestSetBit(), a = r.getLowestSetBit();
|
|
706
|
+
if (a < 0)
|
|
707
|
+
return t;
|
|
708
|
+
for (s < a && (a = s), a > 0 && (t.rShiftTo(a, t), r.rShiftTo(a, r)); t.signum() > 0; )
|
|
709
|
+
(s = t.getLowestSetBit()) > 0 && t.rShiftTo(s, t), (s = r.getLowestSetBit()) > 0 && r.rShiftTo(s, r), t.compareTo(r) >= 0 ? (t.subTo(r, t), t.rShiftTo(1, t)) : (r.subTo(t, r), r.rShiftTo(1, r));
|
|
710
|
+
return a > 0 && r.lShiftTo(a, r), r;
|
|
711
|
+
}, i.prototype.isProbablePrime = function(e) {
|
|
712
|
+
var t, r = this.abs();
|
|
713
|
+
if (r.t == 1 && r[0] <= R[R.length - 1]) {
|
|
714
|
+
for (t = 0; t < R.length; ++t)
|
|
715
|
+
if (r[0] == R[t])
|
|
716
|
+
return !0;
|
|
717
|
+
return !1;
|
|
718
|
+
}
|
|
719
|
+
if (r.isEven())
|
|
720
|
+
return !1;
|
|
721
|
+
for (t = 1; t < R.length; ) {
|
|
722
|
+
for (var n = R[t], s = t + 1; s < R.length && n < ct; )
|
|
723
|
+
n *= R[s++];
|
|
724
|
+
for (n = r.modInt(n); t < s; )
|
|
725
|
+
if (n % R[t++] == 0)
|
|
726
|
+
return !1;
|
|
727
|
+
}
|
|
728
|
+
return r.millerRabin(e);
|
|
729
|
+
}, i.prototype.copyTo = function(e) {
|
|
730
|
+
for (var t = this.t - 1; t >= 0; --t)
|
|
731
|
+
e[t] = this[t];
|
|
732
|
+
e.t = this.t, e.s = this.s;
|
|
733
|
+
}, i.prototype.fromInt = function(e) {
|
|
734
|
+
this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0;
|
|
735
|
+
}, i.prototype.fromString = function(e, t) {
|
|
736
|
+
var r;
|
|
737
|
+
if (t == 16)
|
|
738
|
+
r = 4;
|
|
739
|
+
else if (t == 8)
|
|
740
|
+
r = 3;
|
|
741
|
+
else if (t == 256)
|
|
742
|
+
r = 8;
|
|
743
|
+
else if (t == 2)
|
|
744
|
+
r = 1;
|
|
745
|
+
else if (t == 32)
|
|
746
|
+
r = 5;
|
|
747
|
+
else if (t == 4)
|
|
748
|
+
r = 2;
|
|
749
|
+
else {
|
|
750
|
+
this.fromRadix(e, t);
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
this.t = 0, this.s = 0;
|
|
754
|
+
for (var n = e.length, s = !1, a = 0; --n >= 0; ) {
|
|
755
|
+
var o = r == 8 ? +e[n] & 255 : ke(e, n);
|
|
756
|
+
if (o < 0) {
|
|
757
|
+
e.charAt(n) == "-" && (s = !0);
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
s = !1, a == 0 ? this[this.t++] = o : a + r > this.DB ? (this[this.t - 1] |= (o & (1 << this.DB - a) - 1) << a, this[this.t++] = o >> this.DB - a) : this[this.t - 1] |= o << a, a += r, a >= this.DB && (a -= this.DB);
|
|
761
|
+
}
|
|
762
|
+
r == 8 && (+e[0] & 128) != 0 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), s && i.ZERO.subTo(this, this);
|
|
763
|
+
}, i.prototype.clamp = function() {
|
|
764
|
+
for (var e = this.s & this.DM; this.t > 0 && this[this.t - 1] == e; )
|
|
765
|
+
--this.t;
|
|
766
|
+
}, i.prototype.dlShiftTo = function(e, t) {
|
|
767
|
+
var r;
|
|
768
|
+
for (r = this.t - 1; r >= 0; --r)
|
|
769
|
+
t[r + e] = this[r];
|
|
770
|
+
for (r = e - 1; r >= 0; --r)
|
|
771
|
+
t[r] = 0;
|
|
772
|
+
t.t = this.t + e, t.s = this.s;
|
|
773
|
+
}, i.prototype.drShiftTo = function(e, t) {
|
|
774
|
+
for (var r = e; r < this.t; ++r)
|
|
775
|
+
t[r - e] = this[r];
|
|
776
|
+
t.t = Math.max(this.t - e, 0), t.s = this.s;
|
|
777
|
+
}, i.prototype.lShiftTo = function(e, t) {
|
|
778
|
+
for (var r = e % this.DB, n = this.DB - r, s = (1 << n) - 1, a = Math.floor(e / this.DB), o = this.s << r & this.DM, l = this.t - 1; l >= 0; --l)
|
|
779
|
+
t[l + a + 1] = this[l] >> n | o, o = (this[l] & s) << r;
|
|
780
|
+
for (var l = a - 1; l >= 0; --l)
|
|
781
|
+
t[l] = 0;
|
|
782
|
+
t[a] = o, t.t = this.t + a + 1, t.s = this.s, t.clamp();
|
|
783
|
+
}, i.prototype.rShiftTo = function(e, t) {
|
|
784
|
+
t.s = this.s;
|
|
785
|
+
var r = Math.floor(e / this.DB);
|
|
786
|
+
if (r >= this.t) {
|
|
787
|
+
t.t = 0;
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
var n = e % this.DB, s = this.DB - n, a = (1 << n) - 1;
|
|
791
|
+
t[0] = this[r] >> n;
|
|
792
|
+
for (var o = r + 1; o < this.t; ++o)
|
|
793
|
+
t[o - r - 1] |= (this[o] & a) << s, t[o - r] = this[o] >> n;
|
|
794
|
+
n > 0 && (t[this.t - r - 1] |= (this.s & a) << s), t.t = this.t - r, t.clamp();
|
|
795
|
+
}, i.prototype.subTo = function(e, t) {
|
|
796
|
+
for (var r = 0, n = 0, s = Math.min(e.t, this.t); r < s; )
|
|
797
|
+
n += this[r] - e[r], t[r++] = n & this.DM, n >>= this.DB;
|
|
798
|
+
if (e.t < this.t) {
|
|
799
|
+
for (n -= e.s; r < this.t; )
|
|
800
|
+
n += this[r], t[r++] = n & this.DM, n >>= this.DB;
|
|
801
|
+
n += this.s;
|
|
802
|
+
} else {
|
|
803
|
+
for (n += this.s; r < e.t; )
|
|
804
|
+
n -= e[r], t[r++] = n & this.DM, n >>= this.DB;
|
|
805
|
+
n -= e.s;
|
|
806
|
+
}
|
|
807
|
+
t.s = n < 0 ? -1 : 0, n < -1 ? t[r++] = this.DV + n : n > 0 && (t[r++] = n), t.t = r, t.clamp();
|
|
808
|
+
}, i.prototype.multiplyTo = function(e, t) {
|
|
809
|
+
var r = this.abs(), n = e.abs(), s = r.t;
|
|
810
|
+
for (t.t = s + n.t; --s >= 0; )
|
|
811
|
+
t[s] = 0;
|
|
812
|
+
for (s = 0; s < n.t; ++s)
|
|
813
|
+
t[s + r.t] = r.am(0, n[s], t, s, 0, r.t);
|
|
814
|
+
t.s = 0, t.clamp(), this.s != e.s && i.ZERO.subTo(t, t);
|
|
815
|
+
}, i.prototype.squareTo = function(e) {
|
|
816
|
+
for (var t = this.abs(), r = e.t = 2 * t.t; --r >= 0; )
|
|
817
|
+
e[r] = 0;
|
|
818
|
+
for (r = 0; r < t.t - 1; ++r) {
|
|
819
|
+
var n = t.am(r, t[r], e, 2 * r, 0, 1);
|
|
820
|
+
(e[r + t.t] += t.am(r + 1, 2 * t[r], e, 2 * r + 1, n, t.t - r - 1)) >= t.DV && (e[r + t.t] -= t.DV, e[r + t.t + 1] = 1);
|
|
821
|
+
}
|
|
822
|
+
e.t > 0 && (e[e.t - 1] += t.am(r, t[r], e, 2 * r, 0, 1)), e.s = 0, e.clamp();
|
|
823
|
+
}, i.prototype.divRemTo = function(e, t, r) {
|
|
824
|
+
var n = e.abs();
|
|
825
|
+
if (!(n.t <= 0)) {
|
|
826
|
+
var s = this.abs();
|
|
827
|
+
if (s.t < n.t) {
|
|
828
|
+
t?.fromInt(0), r != null && this.copyTo(r);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
r == null && (r = v());
|
|
832
|
+
var a = v(), o = this.s, l = e.s, h = this.DB - re(n[n.t - 1]);
|
|
833
|
+
h > 0 ? (n.lShiftTo(h, a), s.lShiftTo(h, r)) : (n.copyTo(a), s.copyTo(r));
|
|
834
|
+
var u = a.t, d = a[u - 1];
|
|
835
|
+
if (d != 0) {
|
|
836
|
+
var p = d * (1 << this.F1) + (u > 1 ? a[u - 2] >> this.F2 : 0), f = this.FV / p, g = (1 << this.F1) / p, b = 1 << this.F2, E = r.t, w = E - u, x = t ?? v();
|
|
837
|
+
for (a.dlShiftTo(w, x), r.compareTo(x) >= 0 && (r[r.t++] = 1, r.subTo(x, r)), i.ONE.dlShiftTo(u, x), x.subTo(a, a); a.t < u; )
|
|
838
|
+
a[a.t++] = 0;
|
|
839
|
+
for (; --w >= 0; ) {
|
|
840
|
+
var I = r[--E] == d ? this.DM : Math.floor(r[E] * f + (r[E - 1] + b) * g);
|
|
841
|
+
if ((r[E] += a.am(0, I, r, w, 0, u)) < I)
|
|
842
|
+
for (a.dlShiftTo(w, x), r.subTo(x, r); r[E] < --I; )
|
|
843
|
+
r.subTo(x, r);
|
|
844
|
+
}
|
|
845
|
+
t != null && (r.drShiftTo(u, t), o != l && i.ZERO.subTo(t, t)), r.t = u, r.clamp(), h > 0 && r.rShiftTo(h, r), o < 0 && i.ZERO.subTo(r, r);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}, i.prototype.invDigit = function() {
|
|
849
|
+
if (this.t < 1)
|
|
850
|
+
return 0;
|
|
851
|
+
var e = this[0];
|
|
852
|
+
if ((e & 1) == 0)
|
|
853
|
+
return 0;
|
|
854
|
+
var t = e & 3;
|
|
855
|
+
return t = t * (2 - (e & 15) * t) & 15, t = t * (2 - (e & 255) * t) & 255, t = t * (2 - ((e & 65535) * t & 65535)) & 65535, t = t * (2 - e * t % this.DV) % this.DV, t > 0 ? this.DV - t : -t;
|
|
856
|
+
}, i.prototype.isEven = function() {
|
|
857
|
+
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
858
|
+
}, i.prototype.exp = function(e, t) {
|
|
859
|
+
if (e > 4294967295 || e < 1)
|
|
860
|
+
return i.ONE;
|
|
861
|
+
var r = v(), n = v(), s = t.convert(this), a = re(e) - 1;
|
|
862
|
+
for (s.copyTo(r); --a >= 0; )
|
|
863
|
+
if (t.sqrTo(r, n), (e & 1 << a) > 0)
|
|
864
|
+
t.mulTo(n, s, r);
|
|
865
|
+
else {
|
|
866
|
+
var o = r;
|
|
867
|
+
r = n, n = o;
|
|
868
|
+
}
|
|
869
|
+
return t.revert(r);
|
|
870
|
+
}, i.prototype.chunkSize = function(e) {
|
|
871
|
+
return Math.floor(Math.LN2 * this.DB / Math.log(e));
|
|
872
|
+
}, i.prototype.toRadix = function(e) {
|
|
873
|
+
if (e == null && (e = 10), this.signum() == 0 || e < 2 || e > 36)
|
|
874
|
+
return "0";
|
|
875
|
+
var t = this.chunkSize(e), r = Math.pow(e, t), n = V(r), s = v(), a = v(), o = "";
|
|
876
|
+
for (this.divRemTo(n, s, a); s.signum() > 0; )
|
|
877
|
+
o = (r + a.intValue()).toString(e).substring(1) + o, s.divRemTo(n, s, a);
|
|
878
|
+
return a.intValue().toString(e) + o;
|
|
879
|
+
}, i.prototype.fromRadix = function(e, t) {
|
|
880
|
+
this.fromInt(0), t == null && (t = 10);
|
|
881
|
+
for (var r = this.chunkSize(t), n = Math.pow(t, r), s = !1, a = 0, o = 0, l = 0; l < e.length; ++l) {
|
|
882
|
+
var h = ke(e, l);
|
|
883
|
+
if (h < 0) {
|
|
884
|
+
e.charAt(l) == "-" && this.signum() == 0 && (s = !0);
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
o = t * o + h, ++a >= r && (this.dMultiply(n), this.dAddOffset(o, 0), a = 0, o = 0);
|
|
888
|
+
}
|
|
889
|
+
a > 0 && (this.dMultiply(Math.pow(t, a)), this.dAddOffset(o, 0)), s && i.ZERO.subTo(this, this);
|
|
890
|
+
}, i.prototype.fromNumber = function(e, t, r) {
|
|
891
|
+
if (typeof t == "number")
|
|
892
|
+
if (e < 2)
|
|
893
|
+
this.fromInt(1);
|
|
894
|
+
else
|
|
895
|
+
for (this.fromNumber(e, r), this.testBit(e - 1) || this.bitwiseTo(i.ONE.shiftLeft(e - 1), ie, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(t); )
|
|
896
|
+
this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(i.ONE.shiftLeft(e - 1), this);
|
|
897
|
+
else {
|
|
898
|
+
var n = [], s = e & 7;
|
|
899
|
+
n.length = (e >> 3) + 1, t.nextBytes(n), s > 0 ? n[0] &= (1 << s) - 1 : n[0] = 0, this.fromString(n, 256);
|
|
900
|
+
}
|
|
901
|
+
}, i.prototype.bitwiseTo = function(e, t, r) {
|
|
902
|
+
var n, s, a = Math.min(e.t, this.t);
|
|
903
|
+
for (n = 0; n < a; ++n)
|
|
904
|
+
r[n] = t(this[n], e[n]);
|
|
905
|
+
if (e.t < this.t) {
|
|
906
|
+
for (s = e.s & this.DM, n = a; n < this.t; ++n)
|
|
907
|
+
r[n] = t(this[n], s);
|
|
908
|
+
r.t = this.t;
|
|
909
|
+
} else {
|
|
910
|
+
for (s = this.s & this.DM, n = a; n < e.t; ++n)
|
|
911
|
+
r[n] = t(s, e[n]);
|
|
912
|
+
r.t = e.t;
|
|
913
|
+
}
|
|
914
|
+
r.s = t(this.s, e.s), r.clamp();
|
|
915
|
+
}, i.prototype.changeBit = function(e, t) {
|
|
916
|
+
var r = i.ONE.shiftLeft(e);
|
|
917
|
+
return this.bitwiseTo(r, t, r), r;
|
|
918
|
+
}, i.prototype.addTo = function(e, t) {
|
|
919
|
+
for (var r = 0, n = 0, s = Math.min(e.t, this.t); r < s; )
|
|
920
|
+
n += this[r] + e[r], t[r++] = n & this.DM, n >>= this.DB;
|
|
921
|
+
if (e.t < this.t) {
|
|
922
|
+
for (n += e.s; r < this.t; )
|
|
923
|
+
n += this[r], t[r++] = n & this.DM, n >>= this.DB;
|
|
924
|
+
n += this.s;
|
|
925
|
+
} else {
|
|
926
|
+
for (n += this.s; r < e.t; )
|
|
927
|
+
n += e[r], t[r++] = n & this.DM, n >>= this.DB;
|
|
928
|
+
n += e.s;
|
|
929
|
+
}
|
|
930
|
+
t.s = n < 0 ? -1 : 0, n > 0 ? t[r++] = n : n < -1 && (t[r++] = this.DV + n), t.t = r, t.clamp();
|
|
931
|
+
}, i.prototype.dMultiply = function(e) {
|
|
932
|
+
this[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
|
|
933
|
+
}, i.prototype.dAddOffset = function(e, t) {
|
|
934
|
+
if (e != 0) {
|
|
935
|
+
for (; this.t <= t; )
|
|
936
|
+
this[this.t++] = 0;
|
|
937
|
+
for (this[t] += e; this[t] >= this.DV; )
|
|
938
|
+
this[t] -= this.DV, ++t >= this.t && (this[this.t++] = 0), ++this[t];
|
|
939
|
+
}
|
|
940
|
+
}, i.prototype.multiplyLowerTo = function(e, t, r) {
|
|
941
|
+
var n = Math.min(this.t + e.t, t);
|
|
942
|
+
for (r.s = 0, r.t = n; n > 0; )
|
|
943
|
+
r[--n] = 0;
|
|
944
|
+
for (var s = r.t - this.t; n < s; ++n)
|
|
945
|
+
r[n + this.t] = this.am(0, e[n], r, n, 0, this.t);
|
|
946
|
+
for (var s = Math.min(e.t, t); n < s; ++n)
|
|
947
|
+
this.am(0, e[n], r, n, 0, t - n);
|
|
948
|
+
r.clamp();
|
|
949
|
+
}, i.prototype.multiplyUpperTo = function(e, t, r) {
|
|
950
|
+
--t;
|
|
951
|
+
var n = r.t = this.t + e.t - t;
|
|
952
|
+
for (r.s = 0; --n >= 0; )
|
|
953
|
+
r[n] = 0;
|
|
954
|
+
for (n = Math.max(t - this.t, 0); n < e.t; ++n)
|
|
955
|
+
r[this.t + n - t] = this.am(t - n, e[n], r, 0, 0, this.t + n - t);
|
|
956
|
+
r.clamp(), r.drShiftTo(1, r);
|
|
957
|
+
}, i.prototype.modInt = function(e) {
|
|
958
|
+
if (e <= 0)
|
|
959
|
+
return 0;
|
|
960
|
+
var t = this.DV % e, r = this.s < 0 ? e - 1 : 0;
|
|
961
|
+
if (this.t > 0)
|
|
962
|
+
if (t == 0)
|
|
963
|
+
r = this[0] % e;
|
|
964
|
+
else
|
|
965
|
+
for (var n = this.t - 1; n >= 0; --n)
|
|
966
|
+
r = (t * r + this[n]) % e;
|
|
967
|
+
return r;
|
|
968
|
+
}, i.prototype.millerRabin = function(e) {
|
|
969
|
+
var t = this.subtract(i.ONE), r = t.getLowestSetBit();
|
|
970
|
+
if (r <= 0)
|
|
971
|
+
return !1;
|
|
972
|
+
var n = t.shiftRight(r);
|
|
973
|
+
e = e + 1 >> 1, e > R.length && (e = R.length);
|
|
974
|
+
for (var s = v(), a = 0; a < e; ++a) {
|
|
975
|
+
s.fromInt(R[Math.floor(Math.random() * R.length)]);
|
|
976
|
+
var o = s.modPow(n, this);
|
|
977
|
+
if (o.compareTo(i.ONE) != 0 && o.compareTo(t) != 0) {
|
|
978
|
+
for (var l = 1; l++ < r && o.compareTo(t) != 0; )
|
|
979
|
+
if (o = o.modPowInt(2, this), o.compareTo(i.ONE) == 0)
|
|
980
|
+
return !1;
|
|
981
|
+
if (o.compareTo(t) != 0)
|
|
982
|
+
return !1;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return !0;
|
|
986
|
+
}, i.prototype.square = function() {
|
|
987
|
+
var e = v();
|
|
988
|
+
return this.squareTo(e), e;
|
|
989
|
+
}, i.prototype.gcda = function(e, t) {
|
|
990
|
+
var r = this.s < 0 ? this.negate() : this.clone(), n = e.s < 0 ? e.negate() : e.clone();
|
|
991
|
+
if (r.compareTo(n) < 0) {
|
|
992
|
+
var s = r;
|
|
993
|
+
r = n, n = s;
|
|
994
|
+
}
|
|
995
|
+
var a = r.getLowestSetBit(), o = n.getLowestSetBit();
|
|
996
|
+
if (o < 0) {
|
|
997
|
+
t(r);
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
a < o && (o = a), o > 0 && (r.rShiftTo(o, r), n.rShiftTo(o, n));
|
|
1001
|
+
var l = function() {
|
|
1002
|
+
(a = r.getLowestSetBit()) > 0 && r.rShiftTo(a, r), (a = n.getLowestSetBit()) > 0 && n.rShiftTo(a, n), r.compareTo(n) >= 0 ? (r.subTo(n, r), r.rShiftTo(1, r)) : (n.subTo(r, n), n.rShiftTo(1, n)), r.signum() > 0 ? setTimeout(l, 0) : (o > 0 && n.lShiftTo(o, n), setTimeout(function() {
|
|
1003
|
+
t(n);
|
|
1004
|
+
}, 0));
|
|
1005
|
+
};
|
|
1006
|
+
setTimeout(l, 10);
|
|
1007
|
+
}, i.prototype.fromNumberAsync = function(e, t, r, n) {
|
|
1008
|
+
if (typeof t == "number")
|
|
1009
|
+
if (e < 2)
|
|
1010
|
+
this.fromInt(1);
|
|
1011
|
+
else {
|
|
1012
|
+
this.fromNumber(e, r), this.testBit(e - 1) || this.bitwiseTo(i.ONE.shiftLeft(e - 1), ie, this), this.isEven() && this.dAddOffset(1, 0);
|
|
1013
|
+
var s = this, a = function() {
|
|
1014
|
+
s.dAddOffset(2, 0), s.bitLength() > e && s.subTo(i.ONE.shiftLeft(e - 1), s), s.isProbablePrime(t) ? setTimeout(function() {
|
|
1015
|
+
n();
|
|
1016
|
+
}, 0) : setTimeout(a, 0);
|
|
1017
|
+
};
|
|
1018
|
+
setTimeout(a, 0);
|
|
1019
|
+
}
|
|
1020
|
+
else {
|
|
1021
|
+
var o = [], l = e & 7;
|
|
1022
|
+
o.length = (e >> 3) + 1, t.nextBytes(o), l > 0 ? o[0] &= (1 << l) - 1 : o[0] = 0, this.fromString(o, 256);
|
|
1023
|
+
}
|
|
1024
|
+
}, i;
|
|
1025
|
+
}()
|
|
1026
|
+
), ht = (
|
|
1027
|
+
/** @class */
|
|
1028
|
+
function() {
|
|
1029
|
+
function i() {
|
|
1030
|
+
}
|
|
1031
|
+
return i.prototype.convert = function(e) {
|
|
1032
|
+
return e;
|
|
1033
|
+
}, i.prototype.revert = function(e) {
|
|
1034
|
+
return e;
|
|
1035
|
+
}, i.prototype.mulTo = function(e, t, r) {
|
|
1036
|
+
e.multiplyTo(t, r);
|
|
1037
|
+
}, i.prototype.sqrTo = function(e, t) {
|
|
1038
|
+
e.squareTo(t);
|
|
1039
|
+
}, i;
|
|
1040
|
+
}()
|
|
1041
|
+
), Le = (
|
|
1042
|
+
/** @class */
|
|
1043
|
+
function() {
|
|
1044
|
+
function i(e) {
|
|
1045
|
+
this.m = e;
|
|
1046
|
+
}
|
|
1047
|
+
return i.prototype.convert = function(e) {
|
|
1048
|
+
return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
|
|
1049
|
+
}, i.prototype.revert = function(e) {
|
|
1050
|
+
return e;
|
|
1051
|
+
}, i.prototype.reduce = function(e) {
|
|
1052
|
+
e.divRemTo(this.m, null, e);
|
|
1053
|
+
}, i.prototype.mulTo = function(e, t, r) {
|
|
1054
|
+
e.multiplyTo(t, r), this.reduce(r);
|
|
1055
|
+
}, i.prototype.sqrTo = function(e, t) {
|
|
1056
|
+
e.squareTo(t), this.reduce(t);
|
|
1057
|
+
}, i;
|
|
1058
|
+
}()
|
|
1059
|
+
), De = (
|
|
1060
|
+
/** @class */
|
|
1061
|
+
function() {
|
|
1062
|
+
function i(e) {
|
|
1063
|
+
this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
|
|
1064
|
+
}
|
|
1065
|
+
return i.prototype.convert = function(e) {
|
|
1066
|
+
var t = v();
|
|
1067
|
+
return e.abs().dlShiftTo(this.m.t, t), t.divRemTo(this.m, null, t), e.s < 0 && t.compareTo(m.ZERO) > 0 && this.m.subTo(t, t), t;
|
|
1068
|
+
}, i.prototype.revert = function(e) {
|
|
1069
|
+
var t = v();
|
|
1070
|
+
return e.copyTo(t), this.reduce(t), t;
|
|
1071
|
+
}, i.prototype.reduce = function(e) {
|
|
1072
|
+
for (; e.t <= this.mt2; )
|
|
1073
|
+
e[e.t++] = 0;
|
|
1074
|
+
for (var t = 0; t < this.m.t; ++t) {
|
|
1075
|
+
var r = e[t] & 32767, n = r * this.mpl + ((r * this.mph + (e[t] >> 15) * this.mpl & this.um) << 15) & e.DM;
|
|
1076
|
+
for (r = t + this.m.t, e[r] += this.m.am(0, n, e, t, 0, this.m.t); e[r] >= e.DV; )
|
|
1077
|
+
e[r] -= e.DV, e[++r]++;
|
|
1078
|
+
}
|
|
1079
|
+
e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
|
|
1080
|
+
}, i.prototype.mulTo = function(e, t, r) {
|
|
1081
|
+
e.multiplyTo(t, r), this.reduce(r);
|
|
1082
|
+
}, i.prototype.sqrTo = function(e, t) {
|
|
1083
|
+
e.squareTo(t), this.reduce(t);
|
|
1084
|
+
}, i;
|
|
1085
|
+
}()
|
|
1086
|
+
), dt = (
|
|
1087
|
+
/** @class */
|
|
1088
|
+
function() {
|
|
1089
|
+
function i(e) {
|
|
1090
|
+
this.m = e, this.r2 = v(), this.q3 = v(), m.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e);
|
|
1091
|
+
}
|
|
1092
|
+
return i.prototype.convert = function(e) {
|
|
1093
|
+
if (e.s < 0 || e.t > 2 * this.m.t)
|
|
1094
|
+
return e.mod(this.m);
|
|
1095
|
+
if (e.compareTo(this.m) < 0)
|
|
1096
|
+
return e;
|
|
1097
|
+
var t = v();
|
|
1098
|
+
return e.copyTo(t), this.reduce(t), t;
|
|
1099
|
+
}, i.prototype.revert = function(e) {
|
|
1100
|
+
return e;
|
|
1101
|
+
}, i.prototype.reduce = function(e) {
|
|
1102
|
+
for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0; )
|
|
1103
|
+
e.dAddOffset(1, this.m.t + 1);
|
|
1104
|
+
for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0; )
|
|
1105
|
+
e.subTo(this.m, e);
|
|
1106
|
+
}, i.prototype.mulTo = function(e, t, r) {
|
|
1107
|
+
e.multiplyTo(t, r), this.reduce(r);
|
|
1108
|
+
}, i.prototype.sqrTo = function(e, t) {
|
|
1109
|
+
e.squareTo(t), this.reduce(t);
|
|
1110
|
+
}, i;
|
|
1111
|
+
}()
|
|
1112
|
+
);
|
|
1113
|
+
function v() {
|
|
1114
|
+
return new m(null);
|
|
1115
|
+
}
|
|
1116
|
+
function S(i, e) {
|
|
1117
|
+
return new m(i, e);
|
|
1118
|
+
}
|
|
1119
|
+
var Be = typeof navigator < "u";
|
|
1120
|
+
Be && Ce && navigator.appName == "Microsoft Internet Explorer" ? (m.prototype.am = function(e, t, r, n, s, a) {
|
|
1121
|
+
for (var o = t & 32767, l = t >> 15; --a >= 0; ) {
|
|
1122
|
+
var h = this[e] & 32767, u = this[e++] >> 15, d = l * h + u * o;
|
|
1123
|
+
h = o * h + ((d & 32767) << 15) + r[n] + (s & 1073741823), s = (h >>> 30) + (d >>> 15) + l * u + (s >>> 30), r[n++] = h & 1073741823;
|
|
1124
|
+
}
|
|
1125
|
+
return s;
|
|
1126
|
+
}, q = 30) : Be && Ce && navigator.appName != "Netscape" ? (m.prototype.am = function(e, t, r, n, s, a) {
|
|
1127
|
+
for (; --a >= 0; ) {
|
|
1128
|
+
var o = t * this[e++] + r[n] + s;
|
|
1129
|
+
s = Math.floor(o / 67108864), r[n++] = o & 67108863;
|
|
1130
|
+
}
|
|
1131
|
+
return s;
|
|
1132
|
+
}, q = 26) : (m.prototype.am = function(e, t, r, n, s, a) {
|
|
1133
|
+
for (var o = t & 16383, l = t >> 14; --a >= 0; ) {
|
|
1134
|
+
var h = this[e] & 16383, u = this[e++] >> 14, d = l * h + u * o;
|
|
1135
|
+
h = o * h + ((d & 16383) << 14) + r[n] + s, s = (h >> 28) + (d >> 14) + l * u, r[n++] = h & 268435455;
|
|
1136
|
+
}
|
|
1137
|
+
return s;
|
|
1138
|
+
}, q = 28);
|
|
1139
|
+
m.prototype.DB = q;
|
|
1140
|
+
m.prototype.DM = (1 << q) - 1;
|
|
1141
|
+
m.prototype.DV = 1 << q;
|
|
1142
|
+
var Te = 52;
|
|
1143
|
+
m.prototype.FV = Math.pow(2, Te);
|
|
1144
|
+
m.prototype.F1 = Te - q;
|
|
1145
|
+
m.prototype.F2 = 2 * q - Te;
|
|
1146
|
+
var pe = [], G, C;
|
|
1147
|
+
G = 48;
|
|
1148
|
+
for (C = 0; C <= 9; ++C)
|
|
1149
|
+
pe[G++] = C;
|
|
1150
|
+
G = 97;
|
|
1151
|
+
for (C = 10; C < 36; ++C)
|
|
1152
|
+
pe[G++] = C;
|
|
1153
|
+
G = 65;
|
|
1154
|
+
for (C = 10; C < 36; ++C)
|
|
1155
|
+
pe[G++] = C;
|
|
1156
|
+
function ke(i, e) {
|
|
1157
|
+
var t = pe[i.charCodeAt(e)];
|
|
1158
|
+
return t ?? -1;
|
|
1159
|
+
}
|
|
1160
|
+
function V(i) {
|
|
1161
|
+
var e = v();
|
|
1162
|
+
return e.fromInt(i), e;
|
|
1163
|
+
}
|
|
1164
|
+
function re(i) {
|
|
1165
|
+
var e = 1, t;
|
|
1166
|
+
return (t = i >>> 16) != 0 && (i = t, e += 16), (t = i >> 8) != 0 && (i = t, e += 8), (t = i >> 4) != 0 && (i = t, e += 4), (t = i >> 2) != 0 && (i = t, e += 2), (t = i >> 1) != 0 && (i = t, e += 1), e;
|
|
1167
|
+
}
|
|
1168
|
+
m.ZERO = V(0);
|
|
1169
|
+
m.ONE = V(1);
|
|
1170
|
+
var ut = (
|
|
1171
|
+
/** @class */
|
|
1172
|
+
function() {
|
|
1173
|
+
function i() {
|
|
1174
|
+
this.i = 0, this.j = 0, this.S = [];
|
|
1175
|
+
}
|
|
1176
|
+
return i.prototype.init = function(e) {
|
|
1177
|
+
var t, r, n;
|
|
1178
|
+
for (t = 0; t < 256; ++t)
|
|
1179
|
+
this.S[t] = t;
|
|
1180
|
+
for (r = 0, t = 0; t < 256; ++t)
|
|
1181
|
+
r = r + this.S[t] + e[t % e.length] & 255, n = this.S[t], this.S[t] = this.S[r], this.S[r] = n;
|
|
1182
|
+
this.i = 0, this.j = 0;
|
|
1183
|
+
}, i.prototype.next = function() {
|
|
1184
|
+
var e;
|
|
1185
|
+
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, e = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = e, this.S[e + this.S[this.i] & 255];
|
|
1186
|
+
}, i;
|
|
1187
|
+
}()
|
|
1188
|
+
);
|
|
1189
|
+
function ft() {
|
|
1190
|
+
return new ut();
|
|
1191
|
+
}
|
|
1192
|
+
var Ke = 256, ne, P = null, D;
|
|
1193
|
+
if (P == null) {
|
|
1194
|
+
P = [], D = 0;
|
|
1195
|
+
var se = void 0;
|
|
1196
|
+
if (typeof window < "u" && self.crypto && self.crypto.getRandomValues) {
|
|
1197
|
+
var ye = new Uint32Array(256);
|
|
1198
|
+
for (self.crypto.getRandomValues(ye), se = 0; se < ye.length; ++se)
|
|
1199
|
+
P[D++] = ye[se] & 255;
|
|
1200
|
+
}
|
|
1201
|
+
var ae = 0, oe = function(i) {
|
|
1202
|
+
if (ae = ae || 0, ae >= 256 || D >= Ke) {
|
|
1203
|
+
self.removeEventListener ? self.removeEventListener("mousemove", oe, !1) : self.detachEvent && self.detachEvent("onmousemove", oe);
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
try {
|
|
1207
|
+
var e = i.x + i.y;
|
|
1208
|
+
P[D++] = e & 255, ae += 1;
|
|
1209
|
+
} catch {
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
typeof window < "u" && (self.addEventListener ? self.addEventListener("mousemove", oe, !1) : self.attachEvent && self.attachEvent("onmousemove", oe));
|
|
1213
|
+
}
|
|
1214
|
+
function pt() {
|
|
1215
|
+
if (ne == null) {
|
|
1216
|
+
for (ne = ft(); D < Ke; ) {
|
|
1217
|
+
var i = Math.floor(65536 * Math.random());
|
|
1218
|
+
P[D++] = i & 255;
|
|
1219
|
+
}
|
|
1220
|
+
for (ne.init(P), D = 0; D < P.length; ++D)
|
|
1221
|
+
P[D] = 0;
|
|
1222
|
+
D = 0;
|
|
1223
|
+
}
|
|
1224
|
+
return ne.next();
|
|
1225
|
+
}
|
|
1226
|
+
var he = (
|
|
1227
|
+
/** @class */
|
|
1228
|
+
function() {
|
|
1229
|
+
function i() {
|
|
1230
|
+
}
|
|
1231
|
+
return i.prototype.nextBytes = function(e) {
|
|
1232
|
+
for (var t = 0; t < e.length; ++t)
|
|
1233
|
+
e[t] = pt();
|
|
1234
|
+
}, i;
|
|
1235
|
+
}()
|
|
1236
|
+
);
|
|
1237
|
+
function Ne(i) {
|
|
1238
|
+
return gt(Tt(mt(i), i.length * 8));
|
|
1239
|
+
}
|
|
1240
|
+
function Me(i) {
|
|
1241
|
+
for (var e = "0123456789abcdef", t = "", r = 0; r < i.length; r++) {
|
|
1242
|
+
var n = i.charCodeAt(r);
|
|
1243
|
+
t += e.charAt(n >>> 4 & 15) + e.charAt(n & 15);
|
|
1244
|
+
}
|
|
1245
|
+
return t;
|
|
1246
|
+
}
|
|
1247
|
+
function mt(i) {
|
|
1248
|
+
for (var e = Array(i.length >> 2), t = 0; t < e.length; t++)
|
|
1249
|
+
e[t] = 0;
|
|
1250
|
+
for (var t = 0; t < i.length * 8; t += 8)
|
|
1251
|
+
e[t >> 5] |= (i.charCodeAt(t / 8) & 255) << 24 - t % 32;
|
|
1252
|
+
return e;
|
|
1253
|
+
}
|
|
1254
|
+
function gt(i) {
|
|
1255
|
+
for (var e = "", t = 0; t < i.length * 32; t += 8)
|
|
1256
|
+
e += String.fromCharCode(i[t >> 5] >>> 24 - t % 32 & 255);
|
|
1257
|
+
return e;
|
|
1258
|
+
}
|
|
1259
|
+
function B(i, e) {
|
|
1260
|
+
return i >>> e | i << 32 - e;
|
|
1261
|
+
}
|
|
1262
|
+
function Ge(i, e) {
|
|
1263
|
+
return i >>> e;
|
|
1264
|
+
}
|
|
1265
|
+
function vt(i, e, t) {
|
|
1266
|
+
return i & e ^ ~i & t;
|
|
1267
|
+
}
|
|
1268
|
+
function yt(i, e, t) {
|
|
1269
|
+
return i & e ^ i & t ^ e & t;
|
|
1270
|
+
}
|
|
1271
|
+
function bt(i) {
|
|
1272
|
+
return B(i, 2) ^ B(i, 13) ^ B(i, 22);
|
|
1273
|
+
}
|
|
1274
|
+
function Et(i) {
|
|
1275
|
+
return B(i, 6) ^ B(i, 11) ^ B(i, 25);
|
|
1276
|
+
}
|
|
1277
|
+
function St(i) {
|
|
1278
|
+
return B(i, 7) ^ B(i, 18) ^ Ge(i, 3);
|
|
1279
|
+
}
|
|
1280
|
+
function Nt(i) {
|
|
1281
|
+
return B(i, 17) ^ B(i, 19) ^ Ge(i, 10);
|
|
1282
|
+
}
|
|
1283
|
+
var wt = new Array(1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998);
|
|
1284
|
+
function Tt(i, e) {
|
|
1285
|
+
var t = new Array(1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225), r = new Array(64), n, s, a, o, l, h, u, d, p, f, g, b;
|
|
1286
|
+
for (i[e >> 5] |= 128 << 24 - e % 32, i[(e + 64 >> 9 << 4) + 15] = e, p = 0; p < i.length; p += 16) {
|
|
1287
|
+
for (n = t[0], s = t[1], a = t[2], o = t[3], l = t[4], h = t[5], u = t[6], d = t[7], f = 0; f < 64; f++)
|
|
1288
|
+
f < 16 ? r[f] = i[f + p] : r[f] = A(A(A(Nt(r[f - 2]), r[f - 7]), St(r[f - 15])), r[f - 16]), g = A(A(A(A(d, Et(l)), vt(l, h, u)), wt[f]), r[f]), b = A(bt(n), yt(n, s, a)), d = u, u = h, h = l, l = A(o, g), o = a, a = s, s = n, n = A(g, b);
|
|
1289
|
+
t[0] = A(n, t[0]), t[1] = A(s, t[1]), t[2] = A(a, t[2]), t[3] = A(o, t[3]), t[4] = A(l, t[4]), t[5] = A(h, t[5]), t[6] = A(u, t[6]), t[7] = A(d, t[7]);
|
|
1290
|
+
}
|
|
1291
|
+
return t;
|
|
1292
|
+
}
|
|
1293
|
+
function A(i, e) {
|
|
1294
|
+
var t = (i & 65535) + (e & 65535), r = (i >> 16) + (e >> 16) + (t >> 16);
|
|
1295
|
+
return r << 16 | t & 65535;
|
|
1296
|
+
}
|
|
1297
|
+
function xt(i, e) {
|
|
1298
|
+
if (e < i.length + 22)
|
|
1299
|
+
return console.error("Message too long for RSA"), null;
|
|
1300
|
+
for (var t = e - i.length - 6, r = "", n = 0; n < t; n += 2)
|
|
1301
|
+
r += "ff";
|
|
1302
|
+
var s = "0001" + r + "00" + i;
|
|
1303
|
+
return S(s, 16);
|
|
1304
|
+
}
|
|
1305
|
+
function At(i, e) {
|
|
1306
|
+
if (e < i.length + 11)
|
|
1307
|
+
return console.error("Message too long for RSA"), null;
|
|
1308
|
+
for (var t = [], r = i.length - 1; r >= 0 && e > 0; ) {
|
|
1309
|
+
var n = i.charCodeAt(r--);
|
|
1310
|
+
n < 128 ? t[--e] = n : n > 127 && n < 2048 ? (t[--e] = n & 63 | 128, t[--e] = n >> 6 | 192) : (t[--e] = n & 63 | 128, t[--e] = n >> 6 & 63 | 128, t[--e] = n >> 12 | 224);
|
|
1311
|
+
}
|
|
1312
|
+
t[--e] = 0;
|
|
1313
|
+
for (var s = new he(), a = []; e > 2; ) {
|
|
1314
|
+
for (a[0] = 0; a[0] == 0; )
|
|
1315
|
+
s.nextBytes(a);
|
|
1316
|
+
t[--e] = a[0];
|
|
1317
|
+
}
|
|
1318
|
+
return t[--e] = 2, t[--e] = 0, new m(t);
|
|
1319
|
+
}
|
|
1320
|
+
function Ve(i, e, t) {
|
|
1321
|
+
for (var r = "", n = 0; r.length < e; )
|
|
1322
|
+
r += t(String.fromCharCode.apply(String, i.concat([
|
|
1323
|
+
(n & 4278190080) >> 24,
|
|
1324
|
+
(n & 16711680) >> 16,
|
|
1325
|
+
(n & 65280) >> 8,
|
|
1326
|
+
n & 255
|
|
1327
|
+
]))), n += 1;
|
|
1328
|
+
return r;
|
|
1329
|
+
}
|
|
1330
|
+
var Rt = 32;
|
|
1331
|
+
function It(i, e) {
|
|
1332
|
+
var t = Rt, r = Ne;
|
|
1333
|
+
if (i.length + 2 * t + 2 > e)
|
|
1334
|
+
throw "Message too long for RSA";
|
|
1335
|
+
var n = "", s;
|
|
1336
|
+
for (s = 0; s < e - i.length - 2 * t - 2; s += 1)
|
|
1337
|
+
n += "\0";
|
|
1338
|
+
var a = r("") + n + "" + i, o = new Array(t);
|
|
1339
|
+
new he().nextBytes(o);
|
|
1340
|
+
var l = Ve(o, a.length, r), h = [];
|
|
1341
|
+
for (s = 0; s < a.length; s += 1)
|
|
1342
|
+
h[s] = a.charCodeAt(s) ^ l.charCodeAt(s);
|
|
1343
|
+
var u = Ve(h, o.length, r), d = [0];
|
|
1344
|
+
for (s = 0; s < o.length; s += 1)
|
|
1345
|
+
d[s + 1] = o[s] ^ u.charCodeAt(s);
|
|
1346
|
+
return new m(d.concat(h));
|
|
1347
|
+
}
|
|
1348
|
+
var Ct = (
|
|
1349
|
+
/** @class */
|
|
1350
|
+
function() {
|
|
1351
|
+
function i() {
|
|
1352
|
+
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
|
|
1353
|
+
}
|
|
1354
|
+
return i.prototype.doPublic = function(e) {
|
|
1355
|
+
return e.modPowInt(this.e, this.n);
|
|
1356
|
+
}, i.prototype.doPrivate = function(e) {
|
|
1357
|
+
if (this.p == null || this.q == null)
|
|
1358
|
+
return e.modPow(this.d, this.n);
|
|
1359
|
+
for (var t = e.mod(this.p).modPow(this.dmp1, this.p), r = e.mod(this.q).modPow(this.dmq1, this.q); t.compareTo(r) < 0; )
|
|
1360
|
+
t = t.add(this.p);
|
|
1361
|
+
return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r);
|
|
1362
|
+
}, i.prototype.setPublic = function(e, t) {
|
|
1363
|
+
e != null && t != null && e.length > 0 && t.length > 0 ? (this.n = S(e, 16), this.e = parseInt(t, 16)) : console.error("Invalid RSA public key");
|
|
1364
|
+
}, i.prototype.encrypt = function(e, t) {
|
|
1365
|
+
typeof t > "u" && (t = At);
|
|
1366
|
+
var r = this.n.bitLength() + 7 >> 3, n = t(e, r);
|
|
1367
|
+
if (n == null)
|
|
1368
|
+
return null;
|
|
1369
|
+
var s = this.doPublic(n);
|
|
1370
|
+
if (s == null)
|
|
1371
|
+
return null;
|
|
1372
|
+
for (var a = s.toString(16), o = a.length, l = 0; l < r * 2 - o; l++)
|
|
1373
|
+
a = "0" + a;
|
|
1374
|
+
return a;
|
|
1375
|
+
}, i.prototype.setPrivate = function(e, t, r) {
|
|
1376
|
+
e != null && t != null && e.length > 0 && t.length > 0 ? (this.n = S(e, 16), this.e = parseInt(t, 16), this.d = S(r, 16)) : console.error("Invalid RSA private key");
|
|
1377
|
+
}, i.prototype.setPrivateEx = function(e, t, r, n, s, a, o, l) {
|
|
1378
|
+
e != null && t != null && e.length > 0 && t.length > 0 ? (this.n = S(e, 16), this.e = parseInt(t, 16), this.d = S(r, 16), this.p = S(n, 16), this.q = S(s, 16), this.dmp1 = S(a, 16), this.dmq1 = S(o, 16), this.coeff = S(l, 16)) : console.error("Invalid RSA private key");
|
|
1379
|
+
}, i.prototype.generate = function(e, t) {
|
|
1380
|
+
var r = new he(), n = e >> 1;
|
|
1381
|
+
this.e = parseInt(t, 16);
|
|
1382
|
+
for (var s = new m(t, 16); ; ) {
|
|
1383
|
+
for (; this.p = new m(e - n, 1, r), !(this.p.subtract(m.ONE).gcd(s).compareTo(m.ONE) == 0 && this.p.isProbablePrime(10)); )
|
|
1384
|
+
;
|
|
1385
|
+
for (; this.q = new m(n, 1, r), !(this.q.subtract(m.ONE).gcd(s).compareTo(m.ONE) == 0 && this.q.isProbablePrime(10)); )
|
|
1386
|
+
;
|
|
1387
|
+
if (this.p.compareTo(this.q) <= 0) {
|
|
1388
|
+
var a = this.p;
|
|
1389
|
+
this.p = this.q, this.q = a;
|
|
1390
|
+
}
|
|
1391
|
+
var o = this.p.subtract(m.ONE), l = this.q.subtract(m.ONE), h = o.multiply(l);
|
|
1392
|
+
if (h.gcd(s).compareTo(m.ONE) == 0) {
|
|
1393
|
+
this.n = this.p.multiply(this.q), this.d = s.modInverse(h), this.dmp1 = this.d.mod(o), this.dmq1 = this.d.mod(l), this.coeff = this.q.modInverse(this.p);
|
|
1394
|
+
break;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
}, i.prototype.decrypt = function(e) {
|
|
1398
|
+
var t = S(e, 16), r = this.doPrivate(t);
|
|
1399
|
+
return r == null ? null : Lt(r, this.n.bitLength() + 7 >> 3);
|
|
1400
|
+
}, i.prototype.generateAsync = function(e, t, r) {
|
|
1401
|
+
var n = new he(), s = e >> 1;
|
|
1402
|
+
this.e = parseInt(t, 16);
|
|
1403
|
+
var a = new m(t, 16), o = this, l = function() {
|
|
1404
|
+
var h = function() {
|
|
1405
|
+
if (o.p.compareTo(o.q) <= 0) {
|
|
1406
|
+
var p = o.p;
|
|
1407
|
+
o.p = o.q, o.q = p;
|
|
1408
|
+
}
|
|
1409
|
+
var f = o.p.subtract(m.ONE), g = o.q.subtract(m.ONE), b = f.multiply(g);
|
|
1410
|
+
b.gcd(a).compareTo(m.ONE) == 0 ? (o.n = o.p.multiply(o.q), o.d = a.modInverse(b), o.dmp1 = o.d.mod(f), o.dmq1 = o.d.mod(g), o.coeff = o.q.modInverse(o.p), setTimeout(function() {
|
|
1411
|
+
r();
|
|
1412
|
+
}, 0)) : setTimeout(l, 0);
|
|
1413
|
+
}, u = function() {
|
|
1414
|
+
o.q = v(), o.q.fromNumberAsync(s, 1, n, function() {
|
|
1415
|
+
o.q.subtract(m.ONE).gcda(a, function(p) {
|
|
1416
|
+
p.compareTo(m.ONE) == 0 && o.q.isProbablePrime(10) ? setTimeout(h, 0) : setTimeout(u, 0);
|
|
1417
|
+
});
|
|
1418
|
+
});
|
|
1419
|
+
}, d = function() {
|
|
1420
|
+
o.p = v(), o.p.fromNumberAsync(e - s, 1, n, function() {
|
|
1421
|
+
o.p.subtract(m.ONE).gcda(a, function(p) {
|
|
1422
|
+
p.compareTo(m.ONE) == 0 && o.p.isProbablePrime(10) ? setTimeout(u, 0) : setTimeout(d, 0);
|
|
1423
|
+
});
|
|
1424
|
+
});
|
|
1425
|
+
};
|
|
1426
|
+
setTimeout(d, 0);
|
|
1427
|
+
};
|
|
1428
|
+
setTimeout(l, 0);
|
|
1429
|
+
}, i.prototype.sign = function(e, t, r) {
|
|
1430
|
+
var n = Dt(r), s = n + t(e).toString(), a = this.n.bitLength() / 4, o = xt(s, a);
|
|
1431
|
+
if (o == null)
|
|
1432
|
+
return null;
|
|
1433
|
+
var l = this.doPrivate(o);
|
|
1434
|
+
if (l == null)
|
|
1435
|
+
return null;
|
|
1436
|
+
for (var h = l.toString(16), u = h.length, d = 0; d < a - u; d++)
|
|
1437
|
+
h = "0" + h;
|
|
1438
|
+
return h;
|
|
1439
|
+
}, i.prototype.verify = function(e, t, r) {
|
|
1440
|
+
var n = S(t, 16), s = this.doPublic(n);
|
|
1441
|
+
if (s == null)
|
|
1442
|
+
return null;
|
|
1443
|
+
var a = s.toString(16).replace(/^1f+00/, ""), o = Bt(a);
|
|
1444
|
+
return o == r(e).toString();
|
|
1445
|
+
}, i;
|
|
1446
|
+
}()
|
|
1447
|
+
);
|
|
1448
|
+
function Lt(i, e) {
|
|
1449
|
+
for (var t = i.toByteArray(), r = 0; r < t.length && t[r] == 0; )
|
|
1450
|
+
++r;
|
|
1451
|
+
if (t.length - r != e - 1 || t[r] != 2)
|
|
1452
|
+
return null;
|
|
1453
|
+
for (++r; t[r] != 0; )
|
|
1454
|
+
if (++r >= t.length)
|
|
1455
|
+
return null;
|
|
1456
|
+
for (var n = ""; ++r < t.length; ) {
|
|
1457
|
+
var s = t[r] & 255;
|
|
1458
|
+
s < 128 ? n += String.fromCharCode(s) : s > 191 && s < 224 ? (n += String.fromCharCode((s & 31) << 6 | t[r + 1] & 63), ++r) : (n += String.fromCharCode((s & 15) << 12 | (t[r + 1] & 63) << 6 | t[r + 2] & 63), r += 2);
|
|
1459
|
+
}
|
|
1460
|
+
return n;
|
|
1461
|
+
}
|
|
1462
|
+
var ce = {
|
|
1463
|
+
md2: "3020300c06082a864886f70d020205000410",
|
|
1464
|
+
md5: "3020300c06082a864886f70d020505000410",
|
|
1465
|
+
sha1: "3021300906052b0e03021a05000414",
|
|
1466
|
+
sha224: "302d300d06096086480165030402040500041c",
|
|
1467
|
+
sha256: "3031300d060960864801650304020105000420",
|
|
1468
|
+
sha384: "3041300d060960864801650304020205000430",
|
|
1469
|
+
sha512: "3051300d060960864801650304020305000440",
|
|
1470
|
+
ripemd160: "3021300906052b2403020105000414"
|
|
1471
|
+
};
|
|
1472
|
+
function Dt(i) {
|
|
1473
|
+
return ce[i] || "";
|
|
1474
|
+
}
|
|
1475
|
+
function Bt(i) {
|
|
1476
|
+
for (var e in ce)
|
|
1477
|
+
if (ce.hasOwnProperty(e)) {
|
|
1478
|
+
var t = ce[e], r = t.length;
|
|
1479
|
+
if (i.substring(0, r) == t)
|
|
1480
|
+
return i.substring(r);
|
|
1481
|
+
}
|
|
1482
|
+
return i;
|
|
1483
|
+
}
|
|
1484
|
+
function T(i, e, t) {
|
|
1485
|
+
if (!e || !i)
|
|
1486
|
+
throw new Error("extend failed, please check that all dependencies are included.");
|
|
1487
|
+
var r = function() {
|
|
1488
|
+
};
|
|
1489
|
+
r.prototype = e.prototype, i.prototype = new r(), i.prototype.constructor = i, i.superclass = e.prototype, e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e);
|
|
1490
|
+
}
|
|
1491
|
+
var c = {};
|
|
1492
|
+
(typeof c.asn1 > "u" || !c.asn1) && (c.asn1 = {});
|
|
1493
|
+
c.asn1.ASN1Util = new function() {
|
|
1494
|
+
this.integerToByteHex = function(i) {
|
|
1495
|
+
var e = i.toString(16);
|
|
1496
|
+
return e.length % 2 == 1 && (e = "0" + e), e;
|
|
1497
|
+
}, this.bigIntToMinTwosComplementsHex = function(i) {
|
|
1498
|
+
var e = i.toString(16);
|
|
1499
|
+
if (e.substring(0, 1) != "-")
|
|
1500
|
+
e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e);
|
|
1501
|
+
else {
|
|
1502
|
+
var t = e.substring(1), r = t.length;
|
|
1503
|
+
r % 2 == 1 ? r += 1 : e.match(/^[0-7]/) || (r += 2);
|
|
1504
|
+
for (var n = "", s = 0; s < r; s++)
|
|
1505
|
+
n += "f";
|
|
1506
|
+
var a = new m(n, 16), o = a.xor(i).add(m.ONE);
|
|
1507
|
+
e = o.toString(16).replace(/^-/, "");
|
|
1508
|
+
}
|
|
1509
|
+
return e;
|
|
1510
|
+
}, this.getPEMStringFromHex = function(i, e) {
|
|
1511
|
+
return hextopem(i, e);
|
|
1512
|
+
}, this.newObject = function(i) {
|
|
1513
|
+
var e = c, t = e.asn1, r = t.DERBoolean, n = t.DERInteger, s = t.DERBitString, a = t.DEROctetString, o = t.DERNull, l = t.DERObjectIdentifier, h = t.DEREnumerated, u = t.DERUTF8String, d = t.DERNumericString, p = t.DERPrintableString, f = t.DERTeletexString, g = t.DERIA5String, b = t.DERUTCTime, E = t.DERGeneralizedTime, w = t.DERSequence, x = t.DERSet, I = t.DERTaggedObject, z = t.ASN1Util.newObject, _ = Object.keys(i);
|
|
1514
|
+
if (_.length != 1)
|
|
1515
|
+
throw "key of param shall be only one.";
|
|
1516
|
+
var y = _[0];
|
|
1517
|
+
if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + y + ":") == -1)
|
|
1518
|
+
throw "undefined key: " + y;
|
|
1519
|
+
if (y == "bool")
|
|
1520
|
+
return new r(i[y]);
|
|
1521
|
+
if (y == "int")
|
|
1522
|
+
return new n(i[y]);
|
|
1523
|
+
if (y == "bitstr")
|
|
1524
|
+
return new s(i[y]);
|
|
1525
|
+
if (y == "octstr")
|
|
1526
|
+
return new a(i[y]);
|
|
1527
|
+
if (y == "null")
|
|
1528
|
+
return new o(i[y]);
|
|
1529
|
+
if (y == "oid")
|
|
1530
|
+
return new l(i[y]);
|
|
1531
|
+
if (y == "enum")
|
|
1532
|
+
return new h(i[y]);
|
|
1533
|
+
if (y == "utf8str")
|
|
1534
|
+
return new u(i[y]);
|
|
1535
|
+
if (y == "numstr")
|
|
1536
|
+
return new d(i[y]);
|
|
1537
|
+
if (y == "prnstr")
|
|
1538
|
+
return new p(i[y]);
|
|
1539
|
+
if (y == "telstr")
|
|
1540
|
+
return new f(i[y]);
|
|
1541
|
+
if (y == "ia5str")
|
|
1542
|
+
return new g(i[y]);
|
|
1543
|
+
if (y == "utctime")
|
|
1544
|
+
return new b(i[y]);
|
|
1545
|
+
if (y == "gentime")
|
|
1546
|
+
return new E(i[y]);
|
|
1547
|
+
if (y == "seq") {
|
|
1548
|
+
for (var Z = i[y], U = [], F = 0; F < Z.length; F++) {
|
|
1549
|
+
var ge = z(Z[F]);
|
|
1550
|
+
U.push(ge);
|
|
1551
|
+
}
|
|
1552
|
+
return new w({ array: U });
|
|
1553
|
+
}
|
|
1554
|
+
if (y == "set") {
|
|
1555
|
+
for (var Z = i[y], U = [], F = 0; F < Z.length; F++) {
|
|
1556
|
+
var ge = z(Z[F]);
|
|
1557
|
+
U.push(ge);
|
|
1558
|
+
}
|
|
1559
|
+
return new x({ array: U });
|
|
1560
|
+
}
|
|
1561
|
+
if (y == "tag") {
|
|
1562
|
+
var L = i[y];
|
|
1563
|
+
if (Object.prototype.toString.call(L) === "[object Array]" && L.length == 3) {
|
|
1564
|
+
var Xe = z(L[2]);
|
|
1565
|
+
return new I({
|
|
1566
|
+
tag: L[0],
|
|
1567
|
+
explicit: L[1],
|
|
1568
|
+
obj: Xe
|
|
1569
|
+
});
|
|
1570
|
+
} else {
|
|
1571
|
+
var te = {};
|
|
1572
|
+
if (L.explicit !== void 0 && (te.explicit = L.explicit), L.tag !== void 0 && (te.tag = L.tag), L.obj === void 0)
|
|
1573
|
+
throw "obj shall be specified for 'tag'.";
|
|
1574
|
+
return te.obj = z(L.obj), new I(te);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
}, this.jsonToASN1HEX = function(i) {
|
|
1578
|
+
var e = this.newObject(i);
|
|
1579
|
+
return e.getEncodedHex();
|
|
1580
|
+
};
|
|
1581
|
+
}();
|
|
1582
|
+
c.asn1.ASN1Util.oidHexToInt = function(i) {
|
|
1583
|
+
for (var n = "", e = parseInt(i.substring(0, 2), 16), t = Math.floor(e / 40), r = e % 40, n = t + "." + r, s = "", a = 2; a < i.length; a += 2) {
|
|
1584
|
+
var o = parseInt(i.substring(a, a + 2), 16), l = ("00000000" + o.toString(2)).slice(-8);
|
|
1585
|
+
if (s = s + l.substring(1, 8), l.substring(0, 1) == "0") {
|
|
1586
|
+
var h = new m(s, 2);
|
|
1587
|
+
n = n + "." + h.toString(10), s = "";
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return n;
|
|
1591
|
+
};
|
|
1592
|
+
c.asn1.ASN1Util.oidIntToHex = function(i) {
|
|
1593
|
+
var e = function(o) {
|
|
1594
|
+
var l = o.toString(16);
|
|
1595
|
+
return l.length == 1 && (l = "0" + l), l;
|
|
1596
|
+
}, t = function(o) {
|
|
1597
|
+
var l = "", h = new m(o, 10), u = h.toString(2), d = 7 - u.length % 7;
|
|
1598
|
+
d == 7 && (d = 0);
|
|
1599
|
+
for (var p = "", f = 0; f < d; f++)
|
|
1600
|
+
p += "0";
|
|
1601
|
+
u = p + u;
|
|
1602
|
+
for (var f = 0; f < u.length - 1; f += 7) {
|
|
1603
|
+
var g = u.substring(f, f + 7);
|
|
1604
|
+
f != u.length - 7 && (g = "1" + g), l += e(parseInt(g, 2));
|
|
1605
|
+
}
|
|
1606
|
+
return l;
|
|
1607
|
+
};
|
|
1608
|
+
if (!i.match(/^[0-9.]+$/))
|
|
1609
|
+
throw "malformed oid string: " + i;
|
|
1610
|
+
var r = "", n = i.split("."), s = parseInt(n[0]) * 40 + parseInt(n[1]);
|
|
1611
|
+
r += e(s), n.splice(0, 2);
|
|
1612
|
+
for (var a = 0; a < n.length; a++)
|
|
1613
|
+
r += t(n[a]);
|
|
1614
|
+
return r;
|
|
1615
|
+
};
|
|
1616
|
+
c.asn1.ASN1Object = function() {
|
|
1617
|
+
var i = "";
|
|
1618
|
+
this.getLengthHexFromValue = function() {
|
|
1619
|
+
if (typeof this.hV > "u" || this.hV == null)
|
|
1620
|
+
throw "this.hV is null or undefined.";
|
|
1621
|
+
if (this.hV.length % 2 == 1)
|
|
1622
|
+
throw "value hex must be even length: n=" + i.length + ",v=" + this.hV;
|
|
1623
|
+
var e = this.hV.length / 2, t = e.toString(16);
|
|
1624
|
+
if (t.length % 2 == 1 && (t = "0" + t), e < 128)
|
|
1625
|
+
return t;
|
|
1626
|
+
var r = t.length / 2;
|
|
1627
|
+
if (r > 15)
|
|
1628
|
+
throw "ASN.1 length too long to represent by 8x: n = " + e.toString(16);
|
|
1629
|
+
var n = 128 + r;
|
|
1630
|
+
return n.toString(16) + t;
|
|
1631
|
+
}, this.getEncodedHex = function() {
|
|
1632
|
+
return (this.hTLV == null || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;
|
|
1633
|
+
}, this.getValueHex = function() {
|
|
1634
|
+
return this.getEncodedHex(), this.hV;
|
|
1635
|
+
}, this.getFreshValueHex = function() {
|
|
1636
|
+
return "";
|
|
1637
|
+
};
|
|
1638
|
+
};
|
|
1639
|
+
c.asn1.DERAbstractString = function(i) {
|
|
1640
|
+
c.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function() {
|
|
1641
|
+
return this.s;
|
|
1642
|
+
}, this.setString = function(e) {
|
|
1643
|
+
this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(this.s);
|
|
1644
|
+
}, this.setStringHex = function(e) {
|
|
1645
|
+
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
|
|
1646
|
+
}, this.getFreshValueHex = function() {
|
|
1647
|
+
return this.hV;
|
|
1648
|
+
}, typeof i < "u" && (typeof i == "string" ? this.setString(i) : typeof i.str < "u" ? this.setString(i.str) : typeof i.hex < "u" && this.setStringHex(i.hex));
|
|
1649
|
+
};
|
|
1650
|
+
T(c.asn1.DERAbstractString, c.asn1.ASN1Object);
|
|
1651
|
+
c.asn1.DERAbstractTime = function(i) {
|
|
1652
|
+
c.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function(e) {
|
|
1653
|
+
utc = e.getTime() + e.getTimezoneOffset() * 6e4;
|
|
1654
|
+
var t = new Date(utc);
|
|
1655
|
+
return t;
|
|
1656
|
+
}, this.formatDate = function(e, t, r) {
|
|
1657
|
+
var n = this.zeroPadding, s = this.localDateToUTC(e), a = String(s.getFullYear());
|
|
1658
|
+
t == "utc" && (a = a.substring(2, 4));
|
|
1659
|
+
var o = n(String(s.getMonth() + 1), 2), l = n(String(s.getDate()), 2), h = n(String(s.getHours()), 2), u = n(String(s.getMinutes()), 2), d = n(String(s.getSeconds()), 2), p = a + o + l + h + u + d;
|
|
1660
|
+
if (r === !0) {
|
|
1661
|
+
var f = s.getMilliseconds();
|
|
1662
|
+
if (f != 0) {
|
|
1663
|
+
var g = n(String(f), 3);
|
|
1664
|
+
g = g.replace(/[0]+$/, ""), p = p + "." + g;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return p + "Z";
|
|
1668
|
+
}, this.zeroPadding = function(e, t) {
|
|
1669
|
+
return e.length >= t ? e : new Array(t - e.length + 1).join("0") + e;
|
|
1670
|
+
}, this.getString = function() {
|
|
1671
|
+
return this.s;
|
|
1672
|
+
}, this.setString = function(e) {
|
|
1673
|
+
this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(e);
|
|
1674
|
+
}, this.setByDateValue = function(e, t, r, n, s, a) {
|
|
1675
|
+
var o = new Date(Date.UTC(e, t - 1, r, n, s, a, 0));
|
|
1676
|
+
this.setByDate(o);
|
|
1677
|
+
}, this.getFreshValueHex = function() {
|
|
1678
|
+
return this.hV;
|
|
1679
|
+
};
|
|
1680
|
+
};
|
|
1681
|
+
T(c.asn1.DERAbstractTime, c.asn1.ASN1Object);
|
|
1682
|
+
c.asn1.DERAbstractStructured = function(i) {
|
|
1683
|
+
c.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function(e) {
|
|
1684
|
+
this.hTLV = null, this.isModified = !0, this.asn1Array = e;
|
|
1685
|
+
}, this.appendASN1Object = function(e) {
|
|
1686
|
+
this.hTLV = null, this.isModified = !0, this.asn1Array.push(e);
|
|
1687
|
+
}, this.asn1Array = new Array(), typeof i < "u" && typeof i.array < "u" && (this.asn1Array = i.array);
|
|
1688
|
+
};
|
|
1689
|
+
T(c.asn1.DERAbstractStructured, c.asn1.ASN1Object);
|
|
1690
|
+
c.asn1.DERBoolean = function() {
|
|
1691
|
+
c.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
|
|
1692
|
+
};
|
|
1693
|
+
T(c.asn1.DERBoolean, c.asn1.ASN1Object);
|
|
1694
|
+
c.asn1.DERInteger = function(i) {
|
|
1695
|
+
c.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(e) {
|
|
1696
|
+
this.hTLV = null, this.isModified = !0, this.hV = c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
|
|
1697
|
+
}, this.setByInteger = function(e) {
|
|
1698
|
+
var t = new m(String(e), 10);
|
|
1699
|
+
this.setByBigInteger(t);
|
|
1700
|
+
}, this.setValueHex = function(e) {
|
|
1701
|
+
this.hV = e;
|
|
1702
|
+
}, this.getFreshValueHex = function() {
|
|
1703
|
+
return this.hV;
|
|
1704
|
+
}, typeof i < "u" && (typeof i.bigint < "u" ? this.setByBigInteger(i.bigint) : typeof i.int < "u" ? this.setByInteger(i.int) : typeof i == "number" ? this.setByInteger(i) : typeof i.hex < "u" && this.setValueHex(i.hex));
|
|
1705
|
+
};
|
|
1706
|
+
T(c.asn1.DERInteger, c.asn1.ASN1Object);
|
|
1707
|
+
c.asn1.DERBitString = function(i) {
|
|
1708
|
+
if (i !== void 0 && typeof i.obj < "u") {
|
|
1709
|
+
var e = c.asn1.ASN1Util.newObject(i.obj);
|
|
1710
|
+
i.hex = "00" + e.getEncodedHex();
|
|
1711
|
+
}
|
|
1712
|
+
c.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(t) {
|
|
1713
|
+
this.hTLV = null, this.isModified = !0, this.hV = t;
|
|
1714
|
+
}, this.setUnusedBitsAndHexValue = function(t, r) {
|
|
1715
|
+
if (t < 0 || 7 < t)
|
|
1716
|
+
throw "unused bits shall be from 0 to 7: u = " + t;
|
|
1717
|
+
var n = "0" + t;
|
|
1718
|
+
this.hTLV = null, this.isModified = !0, this.hV = n + r;
|
|
1719
|
+
}, this.setByBinaryString = function(t) {
|
|
1720
|
+
t = t.replace(/0+$/, "");
|
|
1721
|
+
var r = 8 - t.length % 8;
|
|
1722
|
+
r == 8 && (r = 0);
|
|
1723
|
+
for (var n = 0; n <= r; n++)
|
|
1724
|
+
t += "0";
|
|
1725
|
+
for (var s = "", n = 0; n < t.length - 1; n += 8) {
|
|
1726
|
+
var a = t.substring(n, n + 8), o = parseInt(a, 2).toString(16);
|
|
1727
|
+
o.length == 1 && (o = "0" + o), s += o;
|
|
1728
|
+
}
|
|
1729
|
+
this.hTLV = null, this.isModified = !0, this.hV = "0" + r + s;
|
|
1730
|
+
}, this.setByBooleanArray = function(t) {
|
|
1731
|
+
for (var r = "", n = 0; n < t.length; n++)
|
|
1732
|
+
t[n] == !0 ? r += "1" : r += "0";
|
|
1733
|
+
this.setByBinaryString(r);
|
|
1734
|
+
}, this.newFalseArray = function(t) {
|
|
1735
|
+
for (var r = new Array(t), n = 0; n < t; n++)
|
|
1736
|
+
r[n] = !1;
|
|
1737
|
+
return r;
|
|
1738
|
+
}, this.getFreshValueHex = function() {
|
|
1739
|
+
return this.hV;
|
|
1740
|
+
}, typeof i < "u" && (typeof i == "string" && i.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(i) : typeof i.hex < "u" ? this.setHexValueIncludingUnusedBits(i.hex) : typeof i.bin < "u" ? this.setByBinaryString(i.bin) : typeof i.array < "u" && this.setByBooleanArray(i.array));
|
|
1741
|
+
};
|
|
1742
|
+
T(c.asn1.DERBitString, c.asn1.ASN1Object);
|
|
1743
|
+
c.asn1.DEROctetString = function(i) {
|
|
1744
|
+
if (i !== void 0 && typeof i.obj < "u") {
|
|
1745
|
+
var e = c.asn1.ASN1Util.newObject(i.obj);
|
|
1746
|
+
i.hex = e.getEncodedHex();
|
|
1747
|
+
}
|
|
1748
|
+
c.asn1.DEROctetString.superclass.constructor.call(this, i), this.hT = "04";
|
|
1749
|
+
};
|
|
1750
|
+
T(c.asn1.DEROctetString, c.asn1.DERAbstractString);
|
|
1751
|
+
c.asn1.DERNull = function() {
|
|
1752
|
+
c.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
|
|
1753
|
+
};
|
|
1754
|
+
T(c.asn1.DERNull, c.asn1.ASN1Object);
|
|
1755
|
+
c.asn1.DERObjectIdentifier = function(i) {
|
|
1756
|
+
var e = function(r) {
|
|
1757
|
+
var n = r.toString(16);
|
|
1758
|
+
return n.length == 1 && (n = "0" + n), n;
|
|
1759
|
+
}, t = function(r) {
|
|
1760
|
+
var n = "", s = new m(r, 10), a = s.toString(2), o = 7 - a.length % 7;
|
|
1761
|
+
o == 7 && (o = 0);
|
|
1762
|
+
for (var l = "", h = 0; h < o; h++)
|
|
1763
|
+
l += "0";
|
|
1764
|
+
a = l + a;
|
|
1765
|
+
for (var h = 0; h < a.length - 1; h += 7) {
|
|
1766
|
+
var u = a.substring(h, h + 7);
|
|
1767
|
+
h != a.length - 7 && (u = "1" + u), n += e(parseInt(u, 2));
|
|
1768
|
+
}
|
|
1769
|
+
return n;
|
|
1770
|
+
};
|
|
1771
|
+
c.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(r) {
|
|
1772
|
+
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = r;
|
|
1773
|
+
}, this.setValueOidString = function(r) {
|
|
1774
|
+
if (!r.match(/^[0-9.]+$/))
|
|
1775
|
+
throw "malformed oid string: " + r;
|
|
1776
|
+
var n = "", s = r.split("."), a = parseInt(s[0]) * 40 + parseInt(s[1]);
|
|
1777
|
+
n += e(a), s.splice(0, 2);
|
|
1778
|
+
for (var o = 0; o < s.length; o++)
|
|
1779
|
+
n += t(s[o]);
|
|
1780
|
+
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = n;
|
|
1781
|
+
}, this.setValueName = function(r) {
|
|
1782
|
+
var n = c.asn1.x509.OID.name2oid(r);
|
|
1783
|
+
if (n !== "")
|
|
1784
|
+
this.setValueOidString(n);
|
|
1785
|
+
else
|
|
1786
|
+
throw "DERObjectIdentifier oidName undefined: " + r;
|
|
1787
|
+
}, this.getFreshValueHex = function() {
|
|
1788
|
+
return this.hV;
|
|
1789
|
+
}, i !== void 0 && (typeof i == "string" ? i.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(i) : this.setValueName(i) : i.oid !== void 0 ? this.setValueOidString(i.oid) : i.hex !== void 0 ? this.setValueHex(i.hex) : i.name !== void 0 && this.setValueName(i.name));
|
|
1790
|
+
};
|
|
1791
|
+
T(c.asn1.DERObjectIdentifier, c.asn1.ASN1Object);
|
|
1792
|
+
c.asn1.DEREnumerated = function(i) {
|
|
1793
|
+
c.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(e) {
|
|
1794
|
+
this.hTLV = null, this.isModified = !0, this.hV = c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
|
|
1795
|
+
}, this.setByInteger = function(e) {
|
|
1796
|
+
var t = new m(String(e), 10);
|
|
1797
|
+
this.setByBigInteger(t);
|
|
1798
|
+
}, this.setValueHex = function(e) {
|
|
1799
|
+
this.hV = e;
|
|
1800
|
+
}, this.getFreshValueHex = function() {
|
|
1801
|
+
return this.hV;
|
|
1802
|
+
}, typeof i < "u" && (typeof i.int < "u" ? this.setByInteger(i.int) : typeof i == "number" ? this.setByInteger(i) : typeof i.hex < "u" && this.setValueHex(i.hex));
|
|
1803
|
+
};
|
|
1804
|
+
T(c.asn1.DEREnumerated, c.asn1.ASN1Object);
|
|
1805
|
+
c.asn1.DERUTF8String = function(i) {
|
|
1806
|
+
c.asn1.DERUTF8String.superclass.constructor.call(this, i), this.hT = "0c";
|
|
1807
|
+
};
|
|
1808
|
+
T(c.asn1.DERUTF8String, c.asn1.DERAbstractString);
|
|
1809
|
+
c.asn1.DERNumericString = function(i) {
|
|
1810
|
+
c.asn1.DERNumericString.superclass.constructor.call(this, i), this.hT = "12";
|
|
1811
|
+
};
|
|
1812
|
+
T(c.asn1.DERNumericString, c.asn1.DERAbstractString);
|
|
1813
|
+
c.asn1.DERPrintableString = function(i) {
|
|
1814
|
+
c.asn1.DERPrintableString.superclass.constructor.call(this, i), this.hT = "13";
|
|
1815
|
+
};
|
|
1816
|
+
T(c.asn1.DERPrintableString, c.asn1.DERAbstractString);
|
|
1817
|
+
c.asn1.DERTeletexString = function(i) {
|
|
1818
|
+
c.asn1.DERTeletexString.superclass.constructor.call(this, i), this.hT = "14";
|
|
1819
|
+
};
|
|
1820
|
+
T(c.asn1.DERTeletexString, c.asn1.DERAbstractString);
|
|
1821
|
+
c.asn1.DERIA5String = function(i) {
|
|
1822
|
+
c.asn1.DERIA5String.superclass.constructor.call(this, i), this.hT = "16";
|
|
1823
|
+
};
|
|
1824
|
+
T(c.asn1.DERIA5String, c.asn1.DERAbstractString);
|
|
1825
|
+
c.asn1.DERUTCTime = function(i) {
|
|
1826
|
+
c.asn1.DERUTCTime.superclass.constructor.call(this, i), this.hT = "17", this.setByDate = function(e) {
|
|
1827
|
+
this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
|
|
1828
|
+
}, this.getFreshValueHex = function() {
|
|
1829
|
+
return typeof this.date > "u" && typeof this.s > "u" && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
|
|
1830
|
+
}, i !== void 0 && (i.str !== void 0 ? this.setString(i.str) : typeof i == "string" && i.match(/^[0-9]{12}Z$/) ? this.setString(i) : i.hex !== void 0 ? this.setStringHex(i.hex) : i.date !== void 0 && this.setByDate(i.date));
|
|
1831
|
+
};
|
|
1832
|
+
T(c.asn1.DERUTCTime, c.asn1.DERAbstractTime);
|
|
1833
|
+
c.asn1.DERGeneralizedTime = function(i) {
|
|
1834
|
+
c.asn1.DERGeneralizedTime.superclass.constructor.call(this, i), this.hT = "18", this.withMillis = !1, this.setByDate = function(e) {
|
|
1835
|
+
this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
|
|
1836
|
+
}, this.getFreshValueHex = function() {
|
|
1837
|
+
return this.date === void 0 && this.s === void 0 && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
|
|
1838
|
+
}, i !== void 0 && (i.str !== void 0 ? this.setString(i.str) : typeof i == "string" && i.match(/^[0-9]{14}Z$/) ? this.setString(i) : i.hex !== void 0 ? this.setStringHex(i.hex) : i.date !== void 0 && this.setByDate(i.date), i.millis === !0 && (this.withMillis = !0));
|
|
1839
|
+
};
|
|
1840
|
+
T(c.asn1.DERGeneralizedTime, c.asn1.DERAbstractTime);
|
|
1841
|
+
c.asn1.DERSequence = function(i) {
|
|
1842
|
+
c.asn1.DERSequence.superclass.constructor.call(this, i), this.hT = "30", this.getFreshValueHex = function() {
|
|
1843
|
+
for (var e = "", t = 0; t < this.asn1Array.length; t++) {
|
|
1844
|
+
var r = this.asn1Array[t];
|
|
1845
|
+
e += r.getEncodedHex();
|
|
1846
|
+
}
|
|
1847
|
+
return this.hV = e, this.hV;
|
|
1848
|
+
};
|
|
1849
|
+
};
|
|
1850
|
+
T(c.asn1.DERSequence, c.asn1.DERAbstractStructured);
|
|
1851
|
+
c.asn1.DERSet = function(i) {
|
|
1852
|
+
c.asn1.DERSet.superclass.constructor.call(this, i), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function() {
|
|
1853
|
+
for (var e = new Array(), t = 0; t < this.asn1Array.length; t++) {
|
|
1854
|
+
var r = this.asn1Array[t];
|
|
1855
|
+
e.push(r.getEncodedHex());
|
|
1856
|
+
}
|
|
1857
|
+
return this.sortFlag == !0 && e.sort(), this.hV = e.join(""), this.hV;
|
|
1858
|
+
}, typeof i < "u" && typeof i.sortflag < "u" && i.sortflag == !1 && (this.sortFlag = !1);
|
|
1859
|
+
};
|
|
1860
|
+
T(c.asn1.DERSet, c.asn1.DERAbstractStructured);
|
|
1861
|
+
c.asn1.DERTaggedObject = function(i) {
|
|
1862
|
+
c.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(e, t, r) {
|
|
1863
|
+
this.hT = t, this.isExplicit = e, this.asn1Object = r, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = r.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, t), this.isModified = !1);
|
|
1864
|
+
}, this.getFreshValueHex = function() {
|
|
1865
|
+
return this.hV;
|
|
1866
|
+
}, typeof i < "u" && (typeof i.tag < "u" && (this.hT = i.tag), typeof i.explicit < "u" && (this.isExplicit = i.explicit), typeof i.obj < "u" && (this.asn1Object = i.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
|
|
1867
|
+
};
|
|
1868
|
+
T(c.asn1.DERTaggedObject, c.asn1.ASN1Object);
|
|
1869
|
+
var kt = /* @__PURE__ */ function() {
|
|
1870
|
+
var i = function(e, t) {
|
|
1871
|
+
return i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
|
|
1872
|
+
r.__proto__ = n;
|
|
1873
|
+
} || function(r, n) {
|
|
1874
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (r[s] = n[s]);
|
|
1875
|
+
}, i(e, t);
|
|
1876
|
+
};
|
|
1877
|
+
return function(e, t) {
|
|
1878
|
+
if (typeof t != "function" && t !== null)
|
|
1879
|
+
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
1880
|
+
i(e, t);
|
|
1881
|
+
function r() {
|
|
1882
|
+
this.constructor = e;
|
|
1883
|
+
}
|
|
1884
|
+
e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
1885
|
+
};
|
|
1886
|
+
}(), Pe = (
|
|
1887
|
+
/** @class */
|
|
1888
|
+
function(i) {
|
|
1889
|
+
kt(e, i);
|
|
1890
|
+
function e(t) {
|
|
1891
|
+
var r = i.call(this) || this;
|
|
1892
|
+
return t && (typeof t == "string" ? r.parseKey(t) : (e.hasPrivateKeyProperty(t) || e.hasPublicKeyProperty(t)) && r.parsePropertiesFrom(t)), r;
|
|
1893
|
+
}
|
|
1894
|
+
return e.prototype.parseKey = function(t) {
|
|
1895
|
+
try {
|
|
1896
|
+
var r = 0, n = 0, s = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, a = s.test(t) ? nt.decode(t) : Se.unarmor(t), o = ot.decode(a);
|
|
1897
|
+
if (o.sub.length === 3 && (o = o.sub[2].sub[0]), o.sub.length === 9) {
|
|
1898
|
+
r = o.sub[1].getHexStringValue(), this.n = S(r, 16), n = o.sub[2].getHexStringValue(), this.e = parseInt(n, 16);
|
|
1899
|
+
var l = o.sub[3].getHexStringValue();
|
|
1900
|
+
this.d = S(l, 16);
|
|
1901
|
+
var h = o.sub[4].getHexStringValue();
|
|
1902
|
+
this.p = S(h, 16);
|
|
1903
|
+
var u = o.sub[5].getHexStringValue();
|
|
1904
|
+
this.q = S(u, 16);
|
|
1905
|
+
var d = o.sub[6].getHexStringValue();
|
|
1906
|
+
this.dmp1 = S(d, 16);
|
|
1907
|
+
var p = o.sub[7].getHexStringValue();
|
|
1908
|
+
this.dmq1 = S(p, 16);
|
|
1909
|
+
var f = o.sub[8].getHexStringValue();
|
|
1910
|
+
this.coeff = S(f, 16);
|
|
1911
|
+
} else if (o.sub.length === 2)
|
|
1912
|
+
if (o.sub[0].sub) {
|
|
1913
|
+
var g = o.sub[1], b = g.sub[0];
|
|
1914
|
+
r = b.sub[0].getHexStringValue(), this.n = S(r, 16), n = b.sub[1].getHexStringValue(), this.e = parseInt(n, 16);
|
|
1915
|
+
} else
|
|
1916
|
+
r = o.sub[0].getHexStringValue(), this.n = S(r, 16), n = o.sub[1].getHexStringValue(), this.e = parseInt(n, 16);
|
|
1917
|
+
else
|
|
1918
|
+
return !1;
|
|
1919
|
+
return !0;
|
|
1920
|
+
} catch {
|
|
1921
|
+
return !1;
|
|
1922
|
+
}
|
|
1923
|
+
}, e.prototype.getPrivateBaseKey = function() {
|
|
1924
|
+
var t = {
|
|
1925
|
+
array: [
|
|
1926
|
+
new c.asn1.DERInteger({ int: 0 }),
|
|
1927
|
+
new c.asn1.DERInteger({ bigint: this.n }),
|
|
1928
|
+
new c.asn1.DERInteger({ int: this.e }),
|
|
1929
|
+
new c.asn1.DERInteger({ bigint: this.d }),
|
|
1930
|
+
new c.asn1.DERInteger({ bigint: this.p }),
|
|
1931
|
+
new c.asn1.DERInteger({ bigint: this.q }),
|
|
1932
|
+
new c.asn1.DERInteger({ bigint: this.dmp1 }),
|
|
1933
|
+
new c.asn1.DERInteger({ bigint: this.dmq1 }),
|
|
1934
|
+
new c.asn1.DERInteger({ bigint: this.coeff })
|
|
1935
|
+
]
|
|
1936
|
+
}, r = new c.asn1.DERSequence(t);
|
|
1937
|
+
return r.getEncodedHex();
|
|
1938
|
+
}, e.prototype.getPrivateBaseKeyB64 = function() {
|
|
1939
|
+
return X(this.getPrivateBaseKey());
|
|
1940
|
+
}, e.prototype.getPublicBaseKey = function() {
|
|
1941
|
+
var t = new c.asn1.DERSequence({
|
|
1942
|
+
array: [
|
|
1943
|
+
new c.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }),
|
|
1944
|
+
// RSA Encryption pkcs #1 oid
|
|
1945
|
+
new c.asn1.DERNull()
|
|
1946
|
+
]
|
|
1947
|
+
}), r = new c.asn1.DERSequence({
|
|
1948
|
+
array: [
|
|
1949
|
+
new c.asn1.DERInteger({ bigint: this.n }),
|
|
1950
|
+
new c.asn1.DERInteger({ int: this.e })
|
|
1951
|
+
]
|
|
1952
|
+
}), n = new c.asn1.DERBitString({
|
|
1953
|
+
hex: "00" + r.getEncodedHex()
|
|
1954
|
+
}), s = new c.asn1.DERSequence({
|
|
1955
|
+
array: [t, n]
|
|
1956
|
+
});
|
|
1957
|
+
return s.getEncodedHex();
|
|
1958
|
+
}, e.prototype.getPublicBaseKeyB64 = function() {
|
|
1959
|
+
return X(this.getPublicBaseKey());
|
|
1960
|
+
}, e.wordwrap = function(t, r) {
|
|
1961
|
+
if (r = r || 64, !t)
|
|
1962
|
+
return t;
|
|
1963
|
+
var n = "(.{1," + r + `})( +|$
|
|
1964
|
+
?)|(.{1,` + r + "})";
|
|
1965
|
+
return t.match(RegExp(n, "g")).join(`
|
|
1966
|
+
`);
|
|
1967
|
+
}, e.prototype.getPrivateKey = function() {
|
|
1968
|
+
var t = `-----BEGIN RSA PRIVATE KEY-----
|
|
1969
|
+
`;
|
|
1970
|
+
return t += e.wordwrap(this.getPrivateBaseKeyB64()) + `
|
|
1971
|
+
`, t += "-----END RSA PRIVATE KEY-----", t;
|
|
1972
|
+
}, e.prototype.getPublicKey = function() {
|
|
1973
|
+
var t = `-----BEGIN PUBLIC KEY-----
|
|
1974
|
+
`;
|
|
1975
|
+
return t += e.wordwrap(this.getPublicBaseKeyB64()) + `
|
|
1976
|
+
`, t += "-----END PUBLIC KEY-----", t;
|
|
1977
|
+
}, e.hasPublicKeyProperty = function(t) {
|
|
1978
|
+
return t = t || {}, t.hasOwnProperty("n") && t.hasOwnProperty("e");
|
|
1979
|
+
}, e.hasPrivateKeyProperty = function(t) {
|
|
1980
|
+
return t = t || {}, t.hasOwnProperty("n") && t.hasOwnProperty("e") && t.hasOwnProperty("d") && t.hasOwnProperty("p") && t.hasOwnProperty("q") && t.hasOwnProperty("dmp1") && t.hasOwnProperty("dmq1") && t.hasOwnProperty("coeff");
|
|
1981
|
+
}, e.prototype.parsePropertiesFrom = function(t) {
|
|
1982
|
+
this.n = t.n, this.e = t.e, t.hasOwnProperty("d") && (this.d = t.d, this.p = t.p, this.q = t.q, this.dmp1 = t.dmp1, this.dmq1 = t.dmq1, this.coeff = t.coeff);
|
|
1983
|
+
}, e;
|
|
1984
|
+
}(Ct)
|
|
1985
|
+
), be, Mt = typeof process < "u" ? (be = process.env) === null || be === void 0 ? void 0 : be.npm_package_version : void 0, Vt = (
|
|
1986
|
+
/** @class */
|
|
1987
|
+
function() {
|
|
1988
|
+
function i(e) {
|
|
1989
|
+
e === void 0 && (e = {}), this.default_key_size = e.default_key_size ? parseInt(e.default_key_size, 10) : 1024, this.default_public_exponent = e.default_public_exponent || "010001", this.log = e.log || !1, this.key = e.key || null;
|
|
1990
|
+
}
|
|
1991
|
+
return i.prototype.setKey = function(e) {
|
|
1992
|
+
e ? (this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new Pe(e)) : !this.key && this.log && console.error("A key was not set.");
|
|
1993
|
+
}, i.prototype.setPrivateKey = function(e) {
|
|
1994
|
+
this.setKey(e);
|
|
1995
|
+
}, i.prototype.setPublicKey = function(e) {
|
|
1996
|
+
this.setKey(e);
|
|
1997
|
+
}, i.prototype.decrypt = function(e) {
|
|
1998
|
+
try {
|
|
1999
|
+
return this.getKey().decrypt(Re(e));
|
|
2000
|
+
} catch {
|
|
2001
|
+
return !1;
|
|
2002
|
+
}
|
|
2003
|
+
}, i.prototype.encrypt = function(e) {
|
|
2004
|
+
try {
|
|
2005
|
+
return X(this.getKey().encrypt(e));
|
|
2006
|
+
} catch {
|
|
2007
|
+
return !1;
|
|
2008
|
+
}
|
|
2009
|
+
}, i.prototype.encryptOAEP = function(e) {
|
|
2010
|
+
try {
|
|
2011
|
+
return X(this.getKey().encrypt(e, It));
|
|
2012
|
+
} catch {
|
|
2013
|
+
return !1;
|
|
2014
|
+
}
|
|
2015
|
+
}, i.prototype.sign = function(e, t, r) {
|
|
2016
|
+
t === void 0 && (t = function(n) {
|
|
2017
|
+
return n;
|
|
2018
|
+
}), r === void 0 && (r = "");
|
|
2019
|
+
try {
|
|
2020
|
+
return X(this.getKey().sign(e, t, r));
|
|
2021
|
+
} catch {
|
|
2022
|
+
return !1;
|
|
2023
|
+
}
|
|
2024
|
+
}, i.prototype.signSha256 = function(e) {
|
|
2025
|
+
return this.sign(e, function(t) {
|
|
2026
|
+
return Me(Ne(t));
|
|
2027
|
+
}, "sha256");
|
|
2028
|
+
}, i.prototype.verify = function(e, t, r) {
|
|
2029
|
+
r === void 0 && (r = function(n) {
|
|
2030
|
+
return n;
|
|
2031
|
+
});
|
|
2032
|
+
try {
|
|
2033
|
+
return this.getKey().verify(e, Re(t), r);
|
|
2034
|
+
} catch {
|
|
2035
|
+
return !1;
|
|
2036
|
+
}
|
|
2037
|
+
}, i.prototype.verifySha256 = function(e, t) {
|
|
2038
|
+
return this.verify(e, t, function(r) {
|
|
2039
|
+
return Me(Ne(r));
|
|
2040
|
+
});
|
|
2041
|
+
}, i.prototype.getKey = function(e) {
|
|
2042
|
+
if (!this.key) {
|
|
2043
|
+
if (this.key = new Pe(), e && {}.toString.call(e) === "[object Function]") {
|
|
2044
|
+
this.key.generateAsync(this.default_key_size, this.default_public_exponent, e);
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
this.key.generate(this.default_key_size, this.default_public_exponent);
|
|
2048
|
+
}
|
|
2049
|
+
return this.key;
|
|
2050
|
+
}, i.prototype.getPrivateKey = function() {
|
|
2051
|
+
return this.getKey().getPrivateKey();
|
|
2052
|
+
}, i.prototype.getPrivateKeyB64 = function() {
|
|
2053
|
+
return this.getKey().getPrivateBaseKeyB64();
|
|
2054
|
+
}, i.prototype.getPublicKey = function() {
|
|
2055
|
+
return this.getKey().getPublicKey();
|
|
2056
|
+
}, i.prototype.getPublicKeyB64 = function() {
|
|
2057
|
+
return this.getKey().getPublicBaseKeyB64();
|
|
2058
|
+
}, i.version = Mt, i;
|
|
2059
|
+
}()
|
|
2060
|
+
);
|
|
2061
|
+
let Y = null, le = null;
|
|
2062
|
+
function cs() {
|
|
2063
|
+
return Y ? Promise.resolve(Y) : le || (le = import("./phone.js").then((i) => (Y = i, Y)), le);
|
|
2064
|
+
}
|
|
2065
|
+
function _e() {
|
|
2066
|
+
return Y;
|
|
2067
|
+
}
|
|
2068
|
+
const Pt = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpegirp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhECn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJEocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wtoAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB", qt = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB";
|
|
2069
|
+
class hs {
|
|
2070
|
+
apiKey;
|
|
2071
|
+
baseUrl;
|
|
2072
|
+
browserInfo;
|
|
2073
|
+
publicKey;
|
|
2074
|
+
constructor(e, t, r) {
|
|
2075
|
+
this.apiKey = e, this.baseUrl = we(t), this.publicKey = t === "test" ? Pt : qt, this.browserInfo = r || {
|
|
2076
|
+
colorDepth: screen.colorDepth,
|
|
2077
|
+
javaEnabled: navigator.javaEnabled(),
|
|
2078
|
+
screenHeight: screen.height,
|
|
2079
|
+
language: navigator.language,
|
|
2080
|
+
screenWidth: screen.width,
|
|
2081
|
+
timeZoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset().toString()
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
mapAddressToApiFormat(e) {
|
|
2085
|
+
return {
|
|
2086
|
+
firstName: e.firstName,
|
|
2087
|
+
lastName: e.lastName,
|
|
2088
|
+
line1: e.street,
|
|
2089
|
+
city: e.city,
|
|
2090
|
+
state: e.state,
|
|
2091
|
+
postalCode: e.zipCode,
|
|
2092
|
+
country: e.country
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
hasAddressData(e) {
|
|
2096
|
+
return e ? !!(e.street || e.firstName || e.lastName || e.city || e.state || e.zipCode || e.country) : !1;
|
|
2097
|
+
}
|
|
2098
|
+
buildAddressData(e) {
|
|
2099
|
+
const t = this.hasAddressData(e.billingAddress), r = this.hasAddressData(e.shippingAddress), n = {}, s = t ? e.billingAddress : r ? e.shippingAddress : void 0;
|
|
2100
|
+
s && this.hasAddressData(s) && (n.billingAddress = this.mapAddressToApiFormat(s));
|
|
2101
|
+
const a = r ? e.shippingAddress : t ? e.billingAddress : void 0;
|
|
2102
|
+
return a && this.hasAddressData(a) && (n.shippingAddress = this.mapAddressToApiFormat(a)), n;
|
|
2103
|
+
}
|
|
2104
|
+
getAttributionParams() {
|
|
2105
|
+
const e = new URLSearchParams(globalThis.location?.search ?? ""), t = [
|
|
2106
|
+
"utm_source",
|
|
2107
|
+
"utm_medium",
|
|
2108
|
+
"utm_campaign",
|
|
2109
|
+
"utm_term",
|
|
2110
|
+
"utm_content",
|
|
2111
|
+
"utm_id",
|
|
2112
|
+
"utm_contentid",
|
|
2113
|
+
"fbclid",
|
|
2114
|
+
"ref_id",
|
|
2115
|
+
"cmpid",
|
|
2116
|
+
"sub1",
|
|
2117
|
+
"sub2",
|
|
2118
|
+
"sub3",
|
|
2119
|
+
"sub4",
|
|
2120
|
+
"sub5",
|
|
2121
|
+
"sub6",
|
|
2122
|
+
"sub7",
|
|
2123
|
+
"sub8",
|
|
2124
|
+
"sub9",
|
|
2125
|
+
"sub10"
|
|
2126
|
+
], r = {};
|
|
2127
|
+
for (const n of t) {
|
|
2128
|
+
const s = e.get(n);
|
|
2129
|
+
s && (r[n] = s.slice(0, 255));
|
|
2130
|
+
}
|
|
2131
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
2132
|
+
}
|
|
2133
|
+
async fetchApi({
|
|
2134
|
+
endpoint: e,
|
|
2135
|
+
method: t = "POST",
|
|
2136
|
+
body: r,
|
|
2137
|
+
customHeaders: n = {}
|
|
2138
|
+
}) {
|
|
2139
|
+
const s = {
|
|
2140
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
2141
|
+
"Content-Type": "application/json",
|
|
2142
|
+
...n
|
|
2143
|
+
};
|
|
2144
|
+
try {
|
|
2145
|
+
const a = await fetch(`${this.baseUrl}${e}`, {
|
|
2146
|
+
method: t,
|
|
2147
|
+
headers: s,
|
|
2148
|
+
body: r ? JSON.stringify(r) : void 0
|
|
2149
|
+
});
|
|
2150
|
+
if (!a.ok) {
|
|
2151
|
+
let o;
|
|
2152
|
+
try {
|
|
2153
|
+
o = await a.json();
|
|
2154
|
+
} catch {
|
|
2155
|
+
}
|
|
2156
|
+
throw {
|
|
2157
|
+
message: o?.message[0] || `API request failed: ${a.status} ${a.statusText}`,
|
|
2158
|
+
status: a.status,
|
|
2159
|
+
statusText: a.statusText,
|
|
2160
|
+
details: o
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
return a.json();
|
|
2164
|
+
} catch (a) {
|
|
2165
|
+
throw a instanceof Error ? {
|
|
2166
|
+
message: a.message,
|
|
2167
|
+
status: 0,
|
|
2168
|
+
statusText: "Network Error",
|
|
2169
|
+
details: { message: a.message }
|
|
2170
|
+
} : a;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
async authorizePayment({
|
|
2174
|
+
paymentId: e,
|
|
2175
|
+
checkoutKey: t,
|
|
2176
|
+
formData: r,
|
|
2177
|
+
returnUrl: n,
|
|
2178
|
+
applePayData: s,
|
|
2179
|
+
customCustomerData: a
|
|
2180
|
+
}) {
|
|
2181
|
+
const o = this.getAttributionParams();
|
|
2182
|
+
let l = {};
|
|
2183
|
+
if (s) {
|
|
2184
|
+
const h = this.hasAddressData(s.billingAddress), u = this.hasAddressData(s.shippingAddress), d = {}, p = h ? s.billingAddress : u ? s.shippingAddress : void 0;
|
|
2185
|
+
p && this.hasAddressData(p) && (d.billingAddress = this.mapAddressToApiFormat(p));
|
|
2186
|
+
const f = u ? s.shippingAddress : h ? s.billingAddress : void 0;
|
|
2187
|
+
f && this.hasAddressData(f) && (d.shippingAddress = this.mapAddressToApiFormat(f));
|
|
2188
|
+
const g = {
|
|
2189
|
+
email: s.email,
|
|
2190
|
+
name: s.name,
|
|
2191
|
+
...d
|
|
2192
|
+
};
|
|
2193
|
+
s.phone && (g.phoneNumber = s.phone), l = {
|
|
2194
|
+
paymentMethodData: {
|
|
2195
|
+
type: "applePay",
|
|
2196
|
+
applePay: {
|
|
2197
|
+
paymentData: s.paymentData,
|
|
2198
|
+
displayName: s.displayName
|
|
2199
|
+
}
|
|
2200
|
+
},
|
|
2201
|
+
customerData: g,
|
|
2202
|
+
context: {
|
|
2203
|
+
returnUrl: n,
|
|
2204
|
+
userAgent: globalThis.navigator.userAgent,
|
|
2205
|
+
...o && { attribution: o }
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
} else if (r) {
|
|
2209
|
+
const h = r.cardExpiry.replace(/\s+/g, "").split("/"), u = h[0];
|
|
2210
|
+
let d = h[1];
|
|
2211
|
+
d && d.length === 2 && (d = `20${d}`);
|
|
2212
|
+
const p = new Vt();
|
|
2213
|
+
p.setPublicKey(this.publicKey);
|
|
2214
|
+
const f = p.encrypt(
|
|
2215
|
+
r.cardNumber.replace(/\s+/g, "")
|
|
2216
|
+
), g = p.encrypt(r.cardCvv), b = r.billingAddress || r.shippingAddress, E = b?.firstName && b?.lastName ? `${b.firstName} ${b.lastName}`.trim() : r.name;
|
|
2217
|
+
l = {
|
|
2218
|
+
paymentMethodData: {
|
|
2219
|
+
type: "card",
|
|
2220
|
+
card: {
|
|
2221
|
+
expMonth: u,
|
|
2222
|
+
expYear: d,
|
|
2223
|
+
cardholderName: E,
|
|
2224
|
+
encryptedCardNumber: f,
|
|
2225
|
+
encryptedCvv: g
|
|
2226
|
+
}
|
|
2227
|
+
},
|
|
2228
|
+
customerData: {
|
|
2229
|
+
email: r.email,
|
|
2230
|
+
name: E,
|
|
2231
|
+
...r.phoneNumber && {
|
|
2232
|
+
phoneNumber: r.phoneCountryCode != null || r.phoneNumber.startsWith("+") ? _e()?.toE164(
|
|
2233
|
+
r.phoneNumber,
|
|
2234
|
+
r.phoneCountryCode ?? "US"
|
|
2235
|
+
) ?? r.phoneNumber.replace(/\s+/g, "") : r.phoneNumber.replace(/\s+/g, "")
|
|
2236
|
+
},
|
|
2237
|
+
...this.buildAddressData(r),
|
|
2238
|
+
...a
|
|
2239
|
+
},
|
|
2240
|
+
context: {
|
|
2241
|
+
returnUrl: n,
|
|
2242
|
+
browserInfo: this.browserInfo,
|
|
2243
|
+
...o && { attribution: o }
|
|
2244
|
+
}
|
|
2245
|
+
};
|
|
2246
|
+
} else
|
|
2247
|
+
l = {
|
|
2248
|
+
paymentMethodData: {
|
|
2249
|
+
type: "paypal"
|
|
2250
|
+
},
|
|
2251
|
+
...a && { customerData: a },
|
|
2252
|
+
context: {
|
|
2253
|
+
returnUrl: n,
|
|
2254
|
+
browserInfo: this.browserInfo,
|
|
2255
|
+
...o && { attribution: o }
|
|
2256
|
+
}
|
|
2257
|
+
};
|
|
2258
|
+
return await this.fetchApi({
|
|
2259
|
+
endpoint: `/payments/${e}/authorize`,
|
|
2260
|
+
customHeaders: {
|
|
2261
|
+
Authorization: `Bearer ${t}`,
|
|
2262
|
+
"X-Idempotency-Key": e
|
|
2263
|
+
},
|
|
2264
|
+
body: l
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
class zt {
|
|
2269
|
+
events = /* @__PURE__ */ new Map();
|
|
2270
|
+
/**
|
|
2271
|
+
* Subscribe to an event
|
|
2272
|
+
* @param eventName - The name of the event to subscribe to
|
|
2273
|
+
* @param callback - The callback function to be called when the event is published
|
|
2274
|
+
* @returns A function to unsubscribe from the event
|
|
2275
|
+
*/
|
|
2276
|
+
subscribe(e, t) {
|
|
2277
|
+
return this.events.has(e) || this.events.set(e, /* @__PURE__ */ new Set()), this.events.get(e)?.add(t), () => {
|
|
2278
|
+
const r = this.events.get(e);
|
|
2279
|
+
r && (r.delete(t), r.size === 0 && this.events.delete(e));
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Publish an event with data
|
|
2284
|
+
* @param eventName - The name of the event to publish
|
|
2285
|
+
* @param data - The data to pass to subscribers
|
|
2286
|
+
*/
|
|
2287
|
+
publish(e, t) {
|
|
2288
|
+
const r = this.events.get(e);
|
|
2289
|
+
r && r.forEach((n) => n(t));
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Clear all event subscriptions
|
|
2293
|
+
*/
|
|
2294
|
+
clear() {
|
|
2295
|
+
this.events.clear();
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Get the number of subscribers for an event
|
|
2299
|
+
* @param eventName - The name of the event
|
|
2300
|
+
* @returns The number of subscribers
|
|
2301
|
+
*/
|
|
2302
|
+
subscriberCount(e) {
|
|
2303
|
+
return this.events.get(e)?.size || 0;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
const Ft = new zt();
|
|
2307
|
+
class Ot {
|
|
2308
|
+
state;
|
|
2309
|
+
initialState;
|
|
2310
|
+
eventBus;
|
|
2311
|
+
stateChangedEvent = "state-changed";
|
|
2312
|
+
constructor(e, t = Ft) {
|
|
2313
|
+
this.initialState = { ...e }, this.state = { ...e }, this.eventBus = t;
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Get the current state
|
|
2317
|
+
*/
|
|
2318
|
+
getState() {
|
|
2319
|
+
return Object.freeze({ ...this.state });
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Update the state
|
|
2323
|
+
* @param partialState - Partial state to merge with current state
|
|
2324
|
+
*/
|
|
2325
|
+
setState(e) {
|
|
2326
|
+
const t = { ...this.state, ...e };
|
|
2327
|
+
JSON.stringify(this.state) !== JSON.stringify(t) && (this.state = t, this.eventBus.publish(this.stateChangedEvent, this.getState()));
|
|
2328
|
+
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Reset the state to initial values
|
|
2331
|
+
*/
|
|
2332
|
+
resetState() {
|
|
2333
|
+
this.state = { ...this.initialState }, this.eventBus.publish(this.stateChangedEvent, this.getState());
|
|
2334
|
+
}
|
|
2335
|
+
/**
|
|
2336
|
+
* Subscribe to state changes
|
|
2337
|
+
* @param callback - Function to call when state changes
|
|
2338
|
+
* @returns Unsubscribe function
|
|
2339
|
+
*/
|
|
2340
|
+
subscribe(e) {
|
|
2341
|
+
return this.eventBus.subscribe(this.stateChangedEvent, e);
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Get a specific value from the state
|
|
2345
|
+
* @param key - The key to get the value for
|
|
2346
|
+
* @returns The value for the key
|
|
2347
|
+
*/
|
|
2348
|
+
getValue(e) {
|
|
2349
|
+
return this.state[e];
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
function jt(i) {
|
|
2353
|
+
return new Ot(i);
|
|
2354
|
+
}
|
|
2355
|
+
const de = (i) => {
|
|
2356
|
+
const e = i.replace(/\s/g, "");
|
|
2357
|
+
return /^4\d{0,15}$/.test(e) ? "visa" : /^(5[1-5]\d{4}|677189|222[1-9]\d{2}|22[3-9]\d{3}|2[3-6]\d{4}|27[01]\d{3}|2720\d{2})\d{0,13}$/.test(
|
|
2358
|
+
e
|
|
2359
|
+
) ? "mastercard" : /^3[47]\d{0,17}$/.test(e) ? "amex" : /^(6011|65\d{2}|64[4-9]\d)\d{0,15}|^(62\d{0,17})$/.test(e) ? "discover" : "unknown";
|
|
2360
|
+
}, Ze = {
|
|
2361
|
+
cardNumber: (i) => (i.replace(/\s/g, "").match(/.{1,4}/g) || []).join(" "),
|
|
2362
|
+
cardExpiry: (i) => {
|
|
2363
|
+
const t = i.replace(/\D/g, "").slice(0, 4);
|
|
2364
|
+
return t.length > 2 ? `${t.slice(0, 2)} / ${t.slice(2, 4)}` : t;
|
|
2365
|
+
},
|
|
2366
|
+
cardCvv: (i, e = 3) => i.replace(/\D/g, "").slice(0, e)
|
|
2367
|
+
}, $t = (i) => i.replace(/\D/g, "").split("").reverse().map(Number).reduce((r, n, s) => {
|
|
2368
|
+
if (s % 2 === 1) {
|
|
2369
|
+
const a = n * 2;
|
|
2370
|
+
return r + (a > 9 ? a - 9 : a);
|
|
2371
|
+
}
|
|
2372
|
+
return r + n;
|
|
2373
|
+
}, 0) % 10 === 0, Ue = {
|
|
2374
|
+
"gmail.com": [
|
|
2375
|
+
"gmal.com",
|
|
2376
|
+
"gmil.com",
|
|
2377
|
+
"gmai.com",
|
|
2378
|
+
"gmial.com",
|
|
2379
|
+
"gmail.co",
|
|
2380
|
+
"gmaill.com",
|
|
2381
|
+
"gamil.com",
|
|
2382
|
+
"gmailcom",
|
|
2383
|
+
"gmail.cm",
|
|
2384
|
+
"gmail.om"
|
|
2385
|
+
],
|
|
2386
|
+
"yahoo.com": [
|
|
2387
|
+
"yaho.com",
|
|
2388
|
+
"yahooo.com",
|
|
2389
|
+
"yahoo.co",
|
|
2390
|
+
"yhoo.com",
|
|
2391
|
+
"yahocom",
|
|
2392
|
+
"yahoo.cm",
|
|
2393
|
+
"yah00.com",
|
|
2394
|
+
"yaho0.com",
|
|
2395
|
+
"hoo.com"
|
|
2396
|
+
],
|
|
2397
|
+
"hotmail.com": [
|
|
2398
|
+
"hotmal.com",
|
|
2399
|
+
"hotamail.com",
|
|
2400
|
+
"hotmai.com",
|
|
2401
|
+
"hotmial.com",
|
|
2402
|
+
"hotmail.co",
|
|
2403
|
+
"hotmailcom",
|
|
2404
|
+
"hotmail.cm",
|
|
2405
|
+
"htmail.com",
|
|
2406
|
+
"hotmil.com"
|
|
2407
|
+
],
|
|
2408
|
+
"outlook.com": [
|
|
2409
|
+
"outlok.com",
|
|
2410
|
+
"outloo.com",
|
|
2411
|
+
"outlook.co",
|
|
2412
|
+
"outllok.com",
|
|
2413
|
+
"outlook.cm",
|
|
2414
|
+
"outlookcom",
|
|
2415
|
+
"outloook.com",
|
|
2416
|
+
"outook.com",
|
|
2417
|
+
"otlook.com"
|
|
2418
|
+
],
|
|
2419
|
+
"icloud.com": [
|
|
2420
|
+
"iclod.com",
|
|
2421
|
+
"iclud.com",
|
|
2422
|
+
"icloud.co",
|
|
2423
|
+
"icloudcom",
|
|
2424
|
+
"icloud.cm",
|
|
2425
|
+
"iclou.com",
|
|
2426
|
+
"icloude.com",
|
|
2427
|
+
"icld.com",
|
|
2428
|
+
"iclould.com"
|
|
2429
|
+
],
|
|
2430
|
+
"aol.com": ["aol.co", "aolcom", "aol.cm", "aolmail.com", "al.com", "ao.com", "aol.comm"],
|
|
2431
|
+
"protonmail.com": [
|
|
2432
|
+
"protonmal.com",
|
|
2433
|
+
"protonmai.com",
|
|
2434
|
+
"protonmial.com",
|
|
2435
|
+
"protonmail.co",
|
|
2436
|
+
"protonmailcom",
|
|
2437
|
+
"protonmail.cm",
|
|
2438
|
+
"protonmil.com"
|
|
2439
|
+
],
|
|
2440
|
+
"zoho.com": ["zoho.co", "zohocom", "zoho.cm", "zoh.com", "zohomail.com", "zho.com"],
|
|
2441
|
+
"mail.com": ["mail.co", "mailcom", "mail.cm", "mal.com", "mial.com", "mail.comm"],
|
|
2442
|
+
"comcast.net": ["comcast.com", "comcat.net", "comcst.net", "comcastnet", "comcast.nt", "comcas.net"],
|
|
2443
|
+
"verizon.net": ["verizon.com", "verizon.nt", "verizonnet", "verizn.net", "verizon.ne", "verzon.net"],
|
|
2444
|
+
"att.net": ["att.com", "at.net", "att.nt", "attnet", "att.ne", "attt.net"]
|
|
2445
|
+
}, Ht = (i) => {
|
|
2446
|
+
if (!i || i.includes("."))
|
|
2447
|
+
return null;
|
|
2448
|
+
const e = ["com", "net", "org", "edu", "gov", "io", "co"];
|
|
2449
|
+
for (const t of e) {
|
|
2450
|
+
if (i === "companycok" && t === "co")
|
|
2451
|
+
return "company.co";
|
|
2452
|
+
if (i.endsWith(t) && !i.includes(".")) {
|
|
2453
|
+
const r = i.length - t.length;
|
|
2454
|
+
return `${i.substring(0, r)}.${t}`;
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
return null;
|
|
2458
|
+
}, Kt = (i, e) => {
|
|
2459
|
+
if (i.length === 0) return e.length;
|
|
2460
|
+
if (e.length === 0) return i.length;
|
|
2461
|
+
const t = e.length + 1, r = i.length + 1, n = Array.from(
|
|
2462
|
+
{ length: t },
|
|
2463
|
+
(s, a) => Array.from({ length: r }, (o, l) => a === 0 ? l : l === 0 ? a : 0)
|
|
2464
|
+
);
|
|
2465
|
+
for (let s = 1; s < t; s++)
|
|
2466
|
+
for (let a = 1; a < r; a++) {
|
|
2467
|
+
const o = i[a - 1] === e[s - 1] ? 0 : 1;
|
|
2468
|
+
n[s][a] = Math.min(
|
|
2469
|
+
n[s - 1][a] + 1,
|
|
2470
|
+
// deletion
|
|
2471
|
+
n[s][a - 1] + 1,
|
|
2472
|
+
// insertion
|
|
2473
|
+
n[s - 1][a - 1] + o
|
|
2474
|
+
// substitution
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
return n[e.length][i.length];
|
|
2478
|
+
}, Gt = (i) => {
|
|
2479
|
+
let t = null, r = 3;
|
|
2480
|
+
const n = i.toLowerCase();
|
|
2481
|
+
for (const s of Object.keys(Ue)) {
|
|
2482
|
+
const a = Kt(n, s);
|
|
2483
|
+
a <= 2 && a < r && (r = a, t = s);
|
|
2484
|
+
}
|
|
2485
|
+
return t;
|
|
2486
|
+
}, _t = () => {
|
|
2487
|
+
const { t: i } = Je();
|
|
2488
|
+
return {
|
|
2489
|
+
validateEmail: (t) => {
|
|
2490
|
+
const r = /^[^\s@]+@[^\s@.]+\.[^\s@]+$/;
|
|
2491
|
+
if (!t)
|
|
2492
|
+
return {
|
|
2493
|
+
isValid: !1,
|
|
2494
|
+
message: i("validation.emailRequired"),
|
|
2495
|
+
suggestion: null
|
|
2496
|
+
};
|
|
2497
|
+
const n = t.indexOf("@");
|
|
2498
|
+
if (n === -1)
|
|
2499
|
+
return {
|
|
2500
|
+
isValid: !1,
|
|
2501
|
+
message: i("validation.emailInvalid"),
|
|
2502
|
+
suggestion: null
|
|
2503
|
+
};
|
|
2504
|
+
const s = t.substring(0, n), a = t.substring(n + 1);
|
|
2505
|
+
if (!a.includes(".")) {
|
|
2506
|
+
const l = Ht(a);
|
|
2507
|
+
if (l)
|
|
2508
|
+
return {
|
|
2509
|
+
isValid: !1,
|
|
2510
|
+
message: i("validation.emailSuggestion", {
|
|
2511
|
+
email: `${s}@${l}`
|
|
2512
|
+
}),
|
|
2513
|
+
suggestion: `${s}@${l}`
|
|
2514
|
+
};
|
|
2515
|
+
for (const h of Object.keys(Ue))
|
|
2516
|
+
if (h.replace(/\./g, "") === a)
|
|
2517
|
+
return {
|
|
2518
|
+
isValid: !1,
|
|
2519
|
+
message: i("validation.emailSuggestion", {
|
|
2520
|
+
email: `${s}@${h}`
|
|
2521
|
+
}),
|
|
2522
|
+
suggestion: `${s}@${h}`
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
if (!r.test(t))
|
|
2526
|
+
return {
|
|
2527
|
+
isValid: !1,
|
|
2528
|
+
message: i("validation.emailInvalid"),
|
|
2529
|
+
suggestion: null
|
|
2530
|
+
};
|
|
2531
|
+
const o = Gt(a);
|
|
2532
|
+
if (o && o !== a) {
|
|
2533
|
+
const l = `${s}@${o}`;
|
|
2534
|
+
return {
|
|
2535
|
+
isValid: !1,
|
|
2536
|
+
message: i("validation.emailSuggestion", { email: l }),
|
|
2537
|
+
suggestion: l
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
return {
|
|
2541
|
+
isValid: !0,
|
|
2542
|
+
message: "Email is valid",
|
|
2543
|
+
suggestion: null
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
}, ds = () => {
|
|
2548
|
+
const { t: i } = Je(), { validateEmail: e } = _t();
|
|
2549
|
+
return {
|
|
2550
|
+
email: (t) => {
|
|
2551
|
+
const r = e(t);
|
|
2552
|
+
return r.isValid ? void 0 : r.message;
|
|
2553
|
+
},
|
|
2554
|
+
phoneNumber: (t, r) => {
|
|
2555
|
+
if (!t.trim())
|
|
2556
|
+
return i("validation.phoneNumberRequired");
|
|
2557
|
+
if (r) {
|
|
2558
|
+
const s = _e();
|
|
2559
|
+
if (!s) {
|
|
2560
|
+
const a = t.replace(/\D/g, "");
|
|
2561
|
+
return a.length < 7 || a.length > 15 ? i("validation.phoneNumberInvalid") : void 0;
|
|
2562
|
+
}
|
|
2563
|
+
return s.isValidPhoneNumber(t, r) ? void 0 : i("validation.phoneNumberInvalid");
|
|
2564
|
+
}
|
|
2565
|
+
const n = t.replace(/\D/g, "");
|
|
2566
|
+
if (n.length < 7 || n.length > 15)
|
|
2567
|
+
return i("validation.phoneNumberInvalid");
|
|
2568
|
+
},
|
|
2569
|
+
name: (t) => {
|
|
2570
|
+
if (!t.trim())
|
|
2571
|
+
return i("validation.nameRequired");
|
|
2572
|
+
},
|
|
2573
|
+
cardExpiry: (t) => {
|
|
2574
|
+
const r = t.replace(/\s/g, ""), [n, s] = r.split("/").map((d) => d.trim());
|
|
2575
|
+
if (!n || !s || n.length !== 2 || s.length !== 2)
|
|
2576
|
+
return i("validation.cardExpiryFormat");
|
|
2577
|
+
const a = /* @__PURE__ */ new Date(), o = a.getFullYear() % 100, l = a.getMonth() + 1, h = parseInt(n, 10), u = parseInt(s, 10);
|
|
2578
|
+
if (h < 1 || h > 12)
|
|
2579
|
+
return i("validation.cardExpiryFormat");
|
|
2580
|
+
if (u < o || u === o && h < l)
|
|
2581
|
+
return i("validation.cardExpiryInvalid");
|
|
2582
|
+
},
|
|
2583
|
+
cardNumber: (t) => {
|
|
2584
|
+
const r = t.replace(/\s/g, "");
|
|
2585
|
+
if (!r)
|
|
2586
|
+
return i("validation.cardNumberRequired");
|
|
2587
|
+
const n = de(r);
|
|
2588
|
+
if (n === "unknown")
|
|
2589
|
+
return i("validation.cardNumberInvalid");
|
|
2590
|
+
const s = n === "amex" ? 15 : 16;
|
|
2591
|
+
if (r.length !== s)
|
|
2592
|
+
return i("validation.cardNumberInvalid");
|
|
2593
|
+
if (!$t(r))
|
|
2594
|
+
return i("validation.cardNumberLuhnInvalid");
|
|
2595
|
+
},
|
|
2596
|
+
cardCvv: (t, r) => {
|
|
2597
|
+
const n = t.replace(/\s/g, "");
|
|
2598
|
+
if (!n || !/^\d+$/.test(n))
|
|
2599
|
+
return i("validation.cardSecurityFormat");
|
|
2600
|
+
const a = (r ? de(r) : "unknown") === "amex" ? 4 : 3;
|
|
2601
|
+
if (n.length !== a)
|
|
2602
|
+
return i("validation.cardSecurityFormat");
|
|
2603
|
+
},
|
|
2604
|
+
// Address field validators
|
|
2605
|
+
street: (t) => {
|
|
2606
|
+
if (!t.trim())
|
|
2607
|
+
return i("validation.addressLine1Required");
|
|
2608
|
+
},
|
|
2609
|
+
firstName: (t) => {
|
|
2610
|
+
if (!t.trim())
|
|
2611
|
+
return i("validation.firstNameRequired");
|
|
2612
|
+
},
|
|
2613
|
+
lastName: (t) => {
|
|
2614
|
+
if (!t.trim())
|
|
2615
|
+
return i("validation.lastNameRequired");
|
|
2616
|
+
},
|
|
2617
|
+
city: (t) => {
|
|
2618
|
+
if (!t.trim())
|
|
2619
|
+
return i("validation.townCityRequired");
|
|
2620
|
+
},
|
|
2621
|
+
state: (t) => {
|
|
2622
|
+
if (!t.trim())
|
|
2623
|
+
return i("validation.stateRequired");
|
|
2624
|
+
},
|
|
2625
|
+
zipCode: (t) => {
|
|
2626
|
+
if (!t.trim())
|
|
2627
|
+
return i("validation.postalCodeRequired");
|
|
2628
|
+
},
|
|
2629
|
+
country: (t) => {
|
|
2630
|
+
if (!t.trim())
|
|
2631
|
+
return i("validation.countryRequired");
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
}, Zt = "E-mail", Ut = "email@priklad.cz", Jt = "Telefonní číslo", Yt = "Hledat země", Wt = "Nebyly nalezeny žádné výsledky", Qt = "Jméno držitele karty", Xt = "Informace o kartě", ei = "Celé jméno na kartě", ti = "MM / RR", ii = "Nezavírejte okno", ri = { pay: "ZAPLATIT", submit: "ODESLAT", getPlan: "ZÍSKAT MŮJ PLÁN", donate: "DAROVAT", book: "REZERVOVAT NYNÍ", order: "OBJEDNAT NYNÍ" }, ni = { billingTitle: "Fakturační adresa", shippingTitle: "Dodací adresa", sameAsBilling: "Použít mou fakturační adresu", street: "Ulice", addressLine1: "Adresa (1. řádek)", firstName: "Jméno", lastName: "Příjmení", state: "Stát / Region", city: "Město", townCity: "Obec/Město", zipCode: "PSČ", postalCode: "PSČ", country: "Země", chooseCountry: "Vyberte zemi", chooseState: "Vyberte stát", chooseProvince: "Vyberte provincii", placeholder: { firstName: "Jan", lastName: "Novák", street: "Hlavní 1", city: "Praha", zipCode: "110 00" } }, si = { emailSuggestion: "Mysleli jste {{email}}?", emailInvalid: "Váš e-mail je neúplný", emailRequired: "E-mail je povinný", cardNumberRequired: "Číslo karty je povinné", cardExpiryInvalid: "Datum vypršení platnosti karty je v minulosti", cardExpiryFormat: "Datum vypršení platnosti karty je neúplné", cardSecurityFormat: "Bezpečnostní kód karty je neúplný", nameRequired: "Zadejte jméno tak, jak je uvedeno na kartě", cardNumberInvalid: "Číslo karty je neúplné", cardNumberLuhnInvalid: "Číslo karty je neplatné", phoneNumberRequired: "Telefonní číslo je povinné", phoneNumberInvalid: "Vaše telefonní číslo je neplatné. Ujistěte se, že je v rozbalovací nabídce vybrána správná země.", "invalid-checkout": "Nepodařilo se spustit pokladnu", streetRequired: "Ulice je povinná", firstNameRequired: "Jméno je povinné", lastNameRequired: "Příjmení je povinné", stateRequired: "Stát / Region je povinný", cityRequired: "Město je povinné", zipCodeRequired: "PSČ je povinné", addressLine1Required: "Ulice je povinná", townCityRequired: "Město je povinné", postalCodeRequired: "PSČ je povinné", zipCodeInvalid: "Zadejte platné PSČ", countryRequired: "Země je povinná" }, ai = {
|
|
2635
|
+
email: Zt,
|
|
2636
|
+
emailPlaceholder: Ut,
|
|
2637
|
+
phoneNumber: Jt,
|
|
2638
|
+
countrySearch: Yt,
|
|
2639
|
+
countryNoResults: Wt,
|
|
2640
|
+
cardholderNameLabel: Qt,
|
|
2641
|
+
cardInformation: Xt,
|
|
2642
|
+
cardholderNamePlaceholder: ei,
|
|
2643
|
+
cardExpiry: ti,
|
|
2644
|
+
loading: ii,
|
|
2645
|
+
"pay-with-card": "nebo zaplaťte kartou",
|
|
2646
|
+
buttonTexts: ri,
|
|
2647
|
+
address: ni,
|
|
2648
|
+
validation: si
|
|
2649
|
+
}, oi = "E-Mail", li = "email@beispiel.de", ci = "Telefonnummer", hi = "Länder suchen", di = "Keine Ergebnisse gefunden", ui = "Name des/der Karteninhaber/in", fi = "Kartendaten", pi = "Vollständiger Name", mi = "MM / JJ", gi = "Das Fenster nicht schließen", vi = { pay: "ZAHLEN", submit: "ABSENDEN", getPlan: "MEINEN PLAN ERHALTEN", donate: "spenden", book: "jetzt buchen", order: "jetzt bestellen" }, yi = { billingTitle: "Rechnungsadresse", shippingTitle: "Lieferadresse", sameAsBilling: "Meine Rechnungsadresse verwenden", street: "Straße und Hausnummer", addressLine1: "Adresszeile 1", firstName: "Vorname", lastName: "Nachname", state: "Bundesland / Region", city: "Stadt", townCity: "Stadt/Gemeinde", zipCode: "Postleitzahl", postalCode: "Postleitzahl", country: "Land", chooseCountry: "Land auswählen", chooseState: "Bundesland auswählen", chooseProvince: "Provinz auswählen", placeholder: { firstName: "Max", lastName: "Mustermann", street: "Musterstraße 1", city: "Berlin", zipCode: "10115" } }, bi = { emailSuggestion: "Meinten Sie {{email}}?", emailInvalid: "Ihre E-Mail-Adresse ist nicht korrekt", emailRequired: "E-Mail-Adresse ist erforderlich", cardNumberRequired: "Kartennummer ist erforderlich", cardExpiryInvalid: "Das Ablaufdatum Ihrer Karte liegt in der Vergangenheit", cardExpiryFormat: "Das Ablaufdatum Ihrer Karte ist unvollständig", cardSecurityFormat: "Der Sicherheitscode Ihrer Karte ist unvollständig", nameRequired: "Gib deinen Namen genau so ein, wie er auf deiner Karte steht", cardNumberInvalid: "Die Kartennummer ist unvollständig", cardNumberLuhnInvalid: "Die Kartennummer ist ungültig", phoneNumberRequired: "Telefonnummer ist erforderlich", phoneNumberInvalid: "Ihre Telefonnummer ist ungültig. Bitte stellen Sie sicher, dass das richtige Land im Dropdown-Menü ausgewählt ist.", "invalid-checkout": "Checkout konnte nicht initialisiert werden", streetRequired: "Straße ist erforderlich", firstNameRequired: "Vorname ist erforderlich", lastNameRequired: "Nachname ist erforderlich", stateRequired: "Bundesland / Region ist erforderlich", cityRequired: "Stadt ist erforderlich", zipCodeRequired: "Postleitzahl ist erforderlich", addressLine1Required: "Adresszeile 1 ist erforderlich", townCityRequired: "Stadt ist erforderlich", postalCodeRequired: "Postleitzahl ist erforderlich", zipCodeInvalid: "Bitte geben Sie eine gültige Postleitzahl ein", countryRequired: "Land ist erforderlich" }, Ei = {
|
|
2650
|
+
email: oi,
|
|
2651
|
+
emailPlaceholder: li,
|
|
2652
|
+
phoneNumber: ci,
|
|
2653
|
+
countrySearch: hi,
|
|
2654
|
+
countryNoResults: di,
|
|
2655
|
+
cardholderNameLabel: ui,
|
|
2656
|
+
cardInformation: fi,
|
|
2657
|
+
cardholderNamePlaceholder: pi,
|
|
2658
|
+
cardExpiry: mi,
|
|
2659
|
+
loading: gi,
|
|
2660
|
+
"pay-with-card": "oder mit Karte bezahlen",
|
|
2661
|
+
buttonTexts: vi,
|
|
2662
|
+
address: yi,
|
|
2663
|
+
validation: bi
|
|
2664
|
+
}, Si = "Email", Ni = "email@example.com", wi = "Phone Number", Ti = "Search countries", xi = "No results found", Ai = "Cardholder name", Ri = "Card information", Ii = "Full name on card", Ci = "MM / YY", Li = "Do not close the window", Di = { pay: "PAY", submit: "SUBMIT", getPlan: "GET MY PLAN", donate: "DONATE", book: "BOOK NOW", order: "ORDER NOW" }, Bi = { billingTitle: "Billing Address", shippingTitle: "Shipping Address", sameAsBilling: "Use my billing address", street: "Street Address", addressLine1: "Address Line 1", firstName: "First Name", lastName: "Last Name", state: "State / Region", city: "City", townCity: "Town/City", zipCode: "Zip Code", postalCode: "Postal/Zip Code", country: "Country", chooseCountry: "Choose country", chooseState: "Choose state", chooseProvince: "Choose province", placeholder: { firstName: "John", lastName: "Doe", street: "123 Main St", city: "New York", zipCode: "10001" } }, ki = { emailSuggestion: "Did you mean {{email}}?", emailInvalid: "Your email is incomplete", emailRequired: "Email is required", cardNumberRequired: "Card number is required", cardExpiryInvalid: "Your card's expiration date is in the past", cardExpiryFormat: "Your card's expiration date is incomplete", cardSecurityFormat: "Your card's security code is incomplete", nameRequired: "Please enter the name as it appears on your card", cardNumberInvalid: "Your card number is incomplete", cardNumberLuhnInvalid: "Your card number is invalid", phoneNumberRequired: "Phone number is required", phoneNumberInvalid: "Your phone number is invalid. Please ensure the correct country is selected in the dropdown.", "invalid-checkout": "Failed to initialize checkout", streetRequired: "Street address is required", firstNameRequired: "First name is required", lastNameRequired: "Last name is required", stateRequired: "State / Region is required", cityRequired: "City is required", zipCodeRequired: "Zip code is required", addressLine1Required: "Address line 1 is required", townCityRequired: "Town/City is required", postalCodeRequired: "Postal/Zip code is required", zipCodeInvalid: "Please enter a valid zip code", countryRequired: "Country is required" }, Mi = {
|
|
2665
|
+
email: Si,
|
|
2666
|
+
emailPlaceholder: Ni,
|
|
2667
|
+
phoneNumber: wi,
|
|
2668
|
+
countrySearch: Ti,
|
|
2669
|
+
countryNoResults: xi,
|
|
2670
|
+
cardholderNameLabel: Ai,
|
|
2671
|
+
cardInformation: Ri,
|
|
2672
|
+
cardholderNamePlaceholder: Ii,
|
|
2673
|
+
cardExpiry: Ci,
|
|
2674
|
+
loading: Li,
|
|
2675
|
+
"pay-with-card": "or pay with card",
|
|
2676
|
+
buttonTexts: Di,
|
|
2677
|
+
address: Bi,
|
|
2678
|
+
validation: ki
|
|
2679
|
+
}, Vi = "Correo electrónico", Pi = "email@ejemplo.es", qi = "Número de teléfono", zi = "Buscar países", Fi = "No se encontraron resultados", Oi = "Nombre del titular de la tarjeta", ji = "Información de la tarjeta", $i = "Nombre completo en la tarjeta", Hi = "MM / AA", Ki = "Por favor, no cierre esta ventana", Gi = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTENER MI PLAN", donate: "DONAR", book: "RESERVAR AHORA", order: "ORDENAR AHORA" }, _i = { billingTitle: "Dirección de facturación", shippingTitle: "Dirección de envío", sameAsBilling: "Usar mi dirección de facturación", street: "Dirección", addressLine1: "Dirección línea 1", firstName: "Nombre", lastName: "Apellido", state: "Estado / Región", city: "Ciudad", townCity: "Localidad/Ciudad", zipCode: "Código postal", postalCode: "Código postal", country: "País", chooseCountry: "Seleccionar país", chooseState: "Seleccionar estado", chooseProvince: "Seleccionar provincia", placeholder: { firstName: "Juan", lastName: "García", street: "Calle Mayor 1", city: "Madrid", zipCode: "28001" } }, Zi = { emailSuggestion: "¿Quisiste decir {{email}}?", emailInvalid: "Su correo electrónico no es válido", emailRequired: "El correo electrónico es obligatorio", cardNumberRequired: "El número de tarjeta es obligatorio", cardExpiryInvalid: "La fecha de vencimiento de la tarjeta ya pasó", cardExpiryFormat: "La fecha de vencimiento de su tarjeta está incompleta", cardSecurityFormat: "El código de seguridad de su tarjeta está incompleto", nameRequired: "Por favor, ingrese el nombre tal como aparece en su tarjeta", cardNumberInvalid: "Su número de tarjeta no es válido", cardNumberLuhnInvalid: "Su número de tarjeta no es válido", phoneNumberRequired: "El número de teléfono es obligatorio", phoneNumberInvalid: "Su número de teléfono no es válido. Asegúrese de que el país correcto esté seleccionado en el menú desplegable.", "invalid-checkout": "No se pudo inicializar el checkout", streetRequired: "La dirección es obligatoria", firstNameRequired: "El nombre es obligatorio", lastNameRequired: "El apellido es obligatorio", stateRequired: "El estado / región es obligatorio", cityRequired: "La ciudad es obligatoria", zipCodeRequired: "El código postal es obligatorio", addressLine1Required: "La dirección es obligatoria", townCityRequired: "La ciudad es obligatoria", postalCodeRequired: "El código postal es obligatorio", zipCodeInvalid: "Por favor, ingrese un código postal válido", countryRequired: "El país es obligatorio" }, Ui = {
|
|
2680
|
+
email: Vi,
|
|
2681
|
+
emailPlaceholder: Pi,
|
|
2682
|
+
phoneNumber: qi,
|
|
2683
|
+
countrySearch: zi,
|
|
2684
|
+
countryNoResults: Fi,
|
|
2685
|
+
cardholderNameLabel: Oi,
|
|
2686
|
+
cardInformation: ji,
|
|
2687
|
+
cardholderNamePlaceholder: $i,
|
|
2688
|
+
cardExpiry: Hi,
|
|
2689
|
+
loading: Ki,
|
|
2690
|
+
"pay-with-card": "o paga con tarjeta",
|
|
2691
|
+
buttonTexts: Gi,
|
|
2692
|
+
address: _i,
|
|
2693
|
+
validation: Zi
|
|
2694
|
+
}, Ji = "E-mail", Yi = "email@exemple.fr", Wi = "Numéro de téléphone", Qi = "Rechercher des pays", Xi = "Aucun résultat trouvé", er = "Nom du titulaire de la carte", tr = "Informations de la carte", ir = "Nom complet figurant sur la carte", rr = "MM / AA", nr = "Veuillez ne pas fermer cette fenêtre", sr = { pay: "PAYER", submit: "ENVOYER", getPlan: "OBTENIR MON PLAN", donate: "FAIRE UN DON", book: "RÉSERVER MAINTENANT", order: "COMMANDER MAINTENANT" }, ar = { billingTitle: "Adresse de facturation", shippingTitle: "Adresse de livraison", sameAsBilling: "Utiliser mon adresse de facturation", street: "Adresse", addressLine1: "Adresse ligne 1", firstName: "Prénom", lastName: "Nom", state: "État / Région", city: "Ville", townCity: "Ville/Commune", zipCode: "Code postal", postalCode: "Code postal", country: "Pays", chooseCountry: "Choisir un pays", chooseState: "Choisir un état", chooseProvince: "Choisir une province", placeholder: { firstName: "Jean", lastName: "Dupont", street: "1 rue de la Paix", city: "Paris", zipCode: "75001" } }, or = { emailSuggestion: "Vouliez-vous dire {{email}}?", emailInvalid: "Votre adresse e-mail n'est pas valide", emailRequired: "L'adresse e-mail est requise", cardNumberRequired: "Le numéro de carte est requis", cardExpiryInvalid: "La date d'expiration de votre carte est dans le passé", cardExpiryFormat: "La date d'expiration de votre carte est incomplète", cardSecurityFormat: "Le code de sécurité de votre carte est incomplet", nameRequired: "Veuillez saisir le nom tel qu'il figure sur votre carte", cardNumberInvalid: "Votre numéro de carte est invalide", cardNumberLuhnInvalid: "Votre numéro de carte est invalide", phoneNumberRequired: "Le numéro de téléphone est requis", phoneNumberInvalid: "Votre numéro de téléphone est invalide. Veuillez vous assurer que le bon pays est sélectionné dans le menu déroulant.", "invalid-checkout": "Échec de l'initialisation du checkout", streetRequired: "L'adresse est requise", firstNameRequired: "Le prénom est requis", lastNameRequired: "Le nom est requis", stateRequired: "L'état / région est requis", cityRequired: "La ville est requise", zipCodeRequired: "Le code postal est requis", addressLine1Required: "L'adresse est requise", townCityRequired: "La ville est requise", postalCodeRequired: "Le code postal est requis", zipCodeInvalid: "Veuillez saisir un code postal valide", countryRequired: "Le pays est requis" }, lr = {
|
|
2695
|
+
email: Ji,
|
|
2696
|
+
emailPlaceholder: Yi,
|
|
2697
|
+
phoneNumber: Wi,
|
|
2698
|
+
countrySearch: Qi,
|
|
2699
|
+
countryNoResults: Xi,
|
|
2700
|
+
cardholderNameLabel: er,
|
|
2701
|
+
cardInformation: tr,
|
|
2702
|
+
cardholderNamePlaceholder: ir,
|
|
2703
|
+
cardExpiry: rr,
|
|
2704
|
+
loading: nr,
|
|
2705
|
+
"pay-with-card": "ou payez avec une carte",
|
|
2706
|
+
buttonTexts: sr,
|
|
2707
|
+
address: ar,
|
|
2708
|
+
validation: or
|
|
2709
|
+
}, cr = "Email", hr = "email@esempio.it", dr = "Numero di telefono", ur = "Cerca paesi", fr = "Nessun risultato trovato", pr = "Nome del titolare della carta", mr = "Informazioni sulla carta", gr = "Nome completo sulla carta", vr = "MM / AA", yr = "Non chiudere la finestra", br = { pay: "PAGA", submit: "INVIA", getPlan: "OTTIENI IL MIO PIANO", donate: "DONARE", book: "PRENOTA ORA", order: "ORDINA ORA" }, Er = { billingTitle: "Indirizzo di fatturazione", shippingTitle: "Indirizzo di spedizione", sameAsBilling: "Usa il mio indirizzo di fatturazione", street: "Indirizzo", addressLine1: "Indirizzo riga 1", firstName: "Nome", lastName: "Cognome", state: "Stato / Regione", city: "Città", townCity: "Città/Comune", zipCode: "Codice postale", postalCode: "Codice postale", country: "Paese", chooseCountry: "Scegli paese", chooseState: "Scegli stato", chooseProvince: "Scegli provincia", placeholder: { firstName: "Marco", lastName: "Rossi", street: "Via Roma 1", city: "Roma", zipCode: "00100" } }, Sr = { emailSuggestion: "Intendevi {{email}}?", emailInvalid: "La tua email non è corretta", emailRequired: "L'indirizzo email è obbligatorio", cardNumberRequired: "Il numero della carta è obbligatorio", cardExpiryInvalid: "La data di scadenza della tua carta è nel passato", cardExpiryFormat: "La data di scadenza della tua carta è incompleta", cardSecurityFormat: "Il codice di sicurezza della tua carta è incompleto", nameRequired: "Inserisci il nome come appare sulla tua carta", cardNumberInvalid: "Il numero della tua carta non è valido", cardNumberLuhnInvalid: "Il numero della tua carta non è valido", phoneNumberRequired: "Il numero di telefono è obbligatorio", phoneNumberInvalid: "Il tuo numero di telefono non è valido. Assicurati che il paese corretto sia selezionato nel menu a discesa.", "invalid-checkout": "Impossibile inizializzare il checkout", streetRequired: "L'indirizzo è obbligatorio", firstNameRequired: "Il nome è obbligatorio", lastNameRequired: "Il cognome è obbligatorio", stateRequired: "Lo stato / regione è obbligatorio", cityRequired: "La città è obbligatoria", zipCodeRequired: "Il codice postale è obbligatorio", addressLine1Required: "L'indirizzo è obbligatorio", townCityRequired: "La città è obbligatoria", postalCodeRequired: "Il codice postale è obbligatorio", zipCodeInvalid: "Inserisci un codice postale valido", countryRequired: "Il paese è obbligatorio" }, Nr = {
|
|
2710
|
+
email: cr,
|
|
2711
|
+
emailPlaceholder: hr,
|
|
2712
|
+
phoneNumber: dr,
|
|
2713
|
+
countrySearch: ur,
|
|
2714
|
+
countryNoResults: fr,
|
|
2715
|
+
cardholderNameLabel: pr,
|
|
2716
|
+
cardInformation: mr,
|
|
2717
|
+
cardholderNamePlaceholder: gr,
|
|
2718
|
+
cardExpiry: vr,
|
|
2719
|
+
loading: yr,
|
|
2720
|
+
"pay-with-card": "o paga con carta",
|
|
2721
|
+
buttonTexts: br,
|
|
2722
|
+
address: Er,
|
|
2723
|
+
validation: Sr
|
|
2724
|
+
}, wr = "E-mail", Tr = "email@voorbeeld.nl", xr = "Telefoonnummer", Ar = "Landen zoeken", Rr = "Geen resultaten gevonden", Ir = "Naam kaarthouder", Cr = "Kaartinformatie", Lr = "Volledige naam op kaart", Dr = "MM / JJ", Br = "Sluit het venster niet", kr = { pay: "BETALEN", submit: "VERZENDEN", getPlan: "ONTVANG MIJN PLAN", donate: "DONEREN", book: "NU BOEKEN", order: "NU BESTELLEN" }, Mr = { billingTitle: "Factuuradres", shippingTitle: "Verzendadres", sameAsBilling: "Gebruik mijn factuuradres", street: "Adres", addressLine1: "Adresregel 1", firstName: "Voornaam", lastName: "Achternaam", state: "Staat / Regio", city: "Stad", townCity: "Stad/Plaats", zipCode: "Postcode", postalCode: "Postcode", country: "Land", chooseCountry: "Kies land", chooseState: "Kies staat", chooseProvince: "Kies provincie", placeholder: { firstName: "Jan", lastName: "Jansen", street: "Kerkstraat 1", city: "Amsterdam", zipCode: "1011 AB" } }, Vr = { emailSuggestion: "Bedoelde u {{email}}?", emailInvalid: "Uw e-mailadres is onvolledig", emailRequired: "E-mailadres is verplicht", cardNumberRequired: "Kaartnummer is verplicht", cardExpiryInvalid: "De vervaldatum van uw kaart ligt in het verleden", cardExpiryFormat: "De vervaldatum van uw kaart is onvolledig", cardSecurityFormat: "De beveiligingscode van uw kaart is onvolledig", nameRequired: "Voer de naam in zoals deze op uw kaart staat", cardNumberInvalid: "Uw kaartnummer is onvolledig", cardNumberLuhnInvalid: "Uw kaartnummer is ongeldig", phoneNumberRequired: "Telefoonnummer is verplicht", phoneNumberInvalid: "Uw telefoonnummer is ongeldig. Zorg ervoor dat het juiste land is geselecteerd in het dropdownmenu.", "invalid-checkout": "Initialiseren van afrekenen mislukt", streetRequired: "Adres is verplicht", firstNameRequired: "Voornaam is verplicht", lastNameRequired: "Achternaam is verplicht", stateRequired: "Staat / Regio is verplicht", cityRequired: "Stad is verplicht", zipCodeRequired: "Postcode is verplicht", addressLine1Required: "Adres is verplicht", townCityRequired: "Stad is verplicht", postalCodeRequired: "Postcode is verplicht", zipCodeInvalid: "Voer een geldige postcode in", countryRequired: "Land is verplicht" }, Pr = {
|
|
2725
|
+
email: wr,
|
|
2726
|
+
emailPlaceholder: Tr,
|
|
2727
|
+
phoneNumber: xr,
|
|
2728
|
+
countrySearch: Ar,
|
|
2729
|
+
countryNoResults: Rr,
|
|
2730
|
+
cardholderNameLabel: Ir,
|
|
2731
|
+
cardInformation: Cr,
|
|
2732
|
+
cardholderNamePlaceholder: Lr,
|
|
2733
|
+
cardExpiry: Dr,
|
|
2734
|
+
loading: Br,
|
|
2735
|
+
"pay-with-card": "of betaal met kaart",
|
|
2736
|
+
buttonTexts: kr,
|
|
2737
|
+
address: Mr,
|
|
2738
|
+
validation: Vr
|
|
2739
|
+
}, qr = "Adres e-mail", zr = "email@przyklad.pl", Fr = "Numer telefonu", Or = "Szukaj krajów", jr = "Brak wyników", $r = "Imię i nazwisko posiadacza karty", Hr = "Informacje o karcie", Kr = "Imię i nazwisko na karcie", Gr = "MM / RR", _r = "Proszę nie zamykać tego okna", Zr = { pay: "ZAPŁAĆ", submit: "WYŚLIJ", getPlan: "POBIERZ MÓJ PLAN", donate: "PRZEKAŻ DAROWIZNĘ", book: "ZAREZERWUJ TERAZ", order: "ZAMÓW TERAZ" }, Ur = { billingTitle: "Adres rozliczeniowy", shippingTitle: "Adres dostawy", sameAsBilling: "Użyj mojego adresu rozliczeniowego", street: "Ulica i numer", addressLine1: "Adres - linia 1", firstName: "Imię", lastName: "Nazwisko", state: "Województwo / Region", city: "Miasto", townCity: "Miejscowość/Miasto", zipCode: "Kod pocztowy", postalCode: "Kod pocztowy", country: "Kraj", chooseCountry: "Wybierz kraj", chooseState: "Wybierz województwo", chooseProvince: "Wybierz prowincję", placeholder: { firstName: "Jan", lastName: "Kowalski", street: "ul. Kwiatowa 1", city: "Warszawa", zipCode: "00-001" } }, Jr = { emailSuggestion: "Czy chodziło Ci o {{email}}?", emailInvalid: "Państwa adres e-mail jest nieprawidłowy", emailRequired: "Adres e-mail jest wymagany", cardNumberRequired: "Numer karty jest wymagany", cardExpiryInvalid: "Data ważności Państwa karty jest w przeszłości", cardExpiryFormat: "Data ważności Państwa karty jest niekompletna", cardSecurityFormat: "Kod zabezpieczający Państwa karty jest niekompletny", nameRequired: "Proszę wpisać imię i nazwisko tak, jak widnieje na karcie", cardNumberInvalid: "Numer Państwa karty jest nieprawidłowy", cardNumberLuhnInvalid: "Numer Państwa karty jest nieprawidłowy", phoneNumberRequired: "Numer telefonu jest wymagany", phoneNumberInvalid: "Twój numer telefonu jest nieprawidłowy. Upewnij się, że w menu rozwijanym wybrany jest właściwy kraj.", "invalid-checkout": "Nie udało się zainicjować procesu płatności", streetRequired: "Adres jest wymagany", firstNameRequired: "Imię jest wymagane", lastNameRequired: "Nazwisko jest wymagane", stateRequired: "Województwo / Region jest wymagane", cityRequired: "Miasto jest wymagane", zipCodeRequired: "Kod pocztowy jest wymagany", addressLine1Required: "Adres jest wymagany", townCityRequired: "Miasto jest wymagane", postalCodeRequired: "Kod pocztowy jest wymagany", zipCodeInvalid: "Proszę wpisać prawidłowy kod pocztowy", countryRequired: "Kraj jest wymagany" }, Yr = {
|
|
2740
|
+
email: qr,
|
|
2741
|
+
emailPlaceholder: zr,
|
|
2742
|
+
phoneNumber: Fr,
|
|
2743
|
+
countrySearch: Or,
|
|
2744
|
+
countryNoResults: jr,
|
|
2745
|
+
cardholderNameLabel: $r,
|
|
2746
|
+
cardInformation: Hr,
|
|
2747
|
+
cardholderNamePlaceholder: Kr,
|
|
2748
|
+
cardExpiry: Gr,
|
|
2749
|
+
loading: _r,
|
|
2750
|
+
"pay-with-card": "albo zapłać kartą",
|
|
2751
|
+
buttonTexts: Zr,
|
|
2752
|
+
address: Ur,
|
|
2753
|
+
validation: Jr
|
|
2754
|
+
}, Wr = "E-mail", Qr = "email@exemplo.pt", Xr = "Número de telefone", en = "Pesquisar países", tn = "Nenhum resultado encontrado", rn = "Nome do titular do cartão", nn = "Informações do cartão", sn = "Nome completo no cartão", an = "MM / AA", on = "Por favor, não feche esta janela", ln = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTER MEU PLANO", donate: "DOAR", book: "RESERVAR AGORA", order: "FAZER PEDIDO" }, cn = { billingTitle: "Endereço de faturação", shippingTitle: "Endereço de envio", sameAsBilling: "Usar o meu endereço de faturação", street: "Morada", addressLine1: "Morada linha 1", firstName: "Nome", lastName: "Apelido", state: "Estado / Região", city: "Cidade", townCity: "Localidade/Cidade", zipCode: "Código postal", postalCode: "Código postal", country: "País", chooseCountry: "Escolher país", chooseState: "Escolher estado", chooseProvince: "Escolher província", placeholder: { firstName: "João", lastName: "Silva", street: "Rua Augusta 1", city: "Lisboa", zipCode: "1100-048" } }, hn = { emailSuggestion: "Você quis dizer {{email}}?", emailInvalid: "O seu endereço de e-mail não é válido", emailRequired: "O endereço de e-mail é obrigatório", cardNumberRequired: "O número do cartão é obrigatório", cardExpiryInvalid: "A data de validade do seu cartão está no passado", cardExpiryFormat: "A data de validade do seu cartão está incompleta", cardSecurityFormat: "O código de segurança do seu cartão está incompleto", nameRequired: "Por favor, insira o nome conforme aparece no cartão", cardNumberInvalid: "O número do seu cartão é inválido", cardNumberLuhnInvalid: "O número do seu cartão é inválido", phoneNumberRequired: "O número de telefone é obrigatório", phoneNumberInvalid: "O seu número de telefone é inválido. Certifique-se de que o país correto está selecionado no menu suspenso.", "invalid-checkout": "Falha ao inicializar o checkout", streetRequired: "A morada é obrigatória", firstNameRequired: "O nome é obrigatório", lastNameRequired: "O apelido é obrigatório", stateRequired: "O estado / região é obrigatório", cityRequired: "A cidade é obrigatória", zipCodeRequired: "O código postal é obrigatório", addressLine1Required: "A morada é obrigatória", townCityRequired: "A cidade é obrigatória", postalCodeRequired: "O código postal é obrigatório", zipCodeInvalid: "Por favor, insira um código postal válido", countryRequired: "O país é obrigatório" }, dn = {
|
|
2755
|
+
email: Wr,
|
|
2756
|
+
emailPlaceholder: Qr,
|
|
2757
|
+
phoneNumber: Xr,
|
|
2758
|
+
countrySearch: en,
|
|
2759
|
+
countryNoResults: tn,
|
|
2760
|
+
cardholderNameLabel: rn,
|
|
2761
|
+
cardInformation: nn,
|
|
2762
|
+
cardholderNamePlaceholder: sn,
|
|
2763
|
+
cardExpiry: an,
|
|
2764
|
+
loading: on,
|
|
2765
|
+
"pay-with-card": "ou pagar com cartão",
|
|
2766
|
+
buttonTexts: ln,
|
|
2767
|
+
address: cn,
|
|
2768
|
+
validation: hn
|
|
2769
|
+
}, un = "E-mail", fn = "email@priklad.sk", pn = "Telefónne číslo", mn = "Vyhľadať krajiny", gn = "Nenašli sa žiadne výsledky", vn = "Meno držiteľa karty", yn = "Informácie o karte", bn = "Meno na karte", En = "MM/RR", Sn = "Nezatvárajte okno", Nn = { pay: "ZAPLATIŤ", submit: "ODOSLAŤ", getPlan: "ZÍSKAŤ MÔJ PLÁN", donate: "DAROVAŤ", book: "REZERVOVAŤ TERAZ", order: "OBJEDNAJTE TERAZ" }, wn = { billingTitle: "Fakturačná adresa", shippingTitle: "Doručovacia adresa", sameAsBilling: "Použiť moju fakturačnú adresu", street: "Ulica", addressLine1: "Adresa (1. riadok)", firstName: "Meno", lastName: "Priezvisko", state: "Štát / Región", city: "Mesto", townCity: "Obec/Mesto", zipCode: "PSČ", postalCode: "PSČ", country: "Krajina", chooseCountry: "Vyberte krajinu", chooseState: "Vyberte štát", chooseProvince: "Vyberte provinciu", placeholder: { firstName: "Ján", lastName: "Novák", street: "Hlavná 1", city: "Bratislava", zipCode: "811 01" } }, Tn = { emailSuggestion: "Mali ste na mysli {{email}}?", emailInvalid: "Váš e-mail nie je úplný", emailRequired: "E-mail je povinný", cardNumberRequired: "Číslo karty je povinné", cardExpiryInvalid: "Dátum exspirácie karty je v minulosti", cardExpiryFormat: "Dátum exspirácie karty je neúplný", cardSecurityFormat: "Váš CVV kód je neúplný", nameRequired: "Zadajte meno tak, ako je uvedené na karte", cardNumberInvalid: "Číslo karty je neúplné", cardNumberLuhnInvalid: "Číslo karty je neplatné", phoneNumberRequired: "Telefónne číslo je povinné", phoneNumberInvalid: "Vaše telefónne číslo je neplatné. Uistite sa, že v rozbaľovacej ponuke je vybraná správna krajina.", "invalid-checkout": "Nepodarilo sa spustiť pokladňu", streetRequired: "Ulica je povinná", firstNameRequired: "Meno je povinné", lastNameRequired: "Priezvisko je povinné", stateRequired: "Štát / Región je povinný", cityRequired: "Mesto je povinné", zipCodeRequired: "PSČ je povinné", addressLine1Required: "Ulica je povinná", townCityRequired: "Mesto je povinné", postalCodeRequired: "PSČ je povinné", zipCodeInvalid: "Zadajte platné PSČ", countryRequired: "Krajina je povinná" }, xn = {
|
|
2770
|
+
email: un,
|
|
2771
|
+
emailPlaceholder: fn,
|
|
2772
|
+
phoneNumber: pn,
|
|
2773
|
+
countrySearch: mn,
|
|
2774
|
+
countryNoResults: gn,
|
|
2775
|
+
cardholderNameLabel: vn,
|
|
2776
|
+
cardInformation: yn,
|
|
2777
|
+
cardholderNamePlaceholder: bn,
|
|
2778
|
+
cardExpiry: En,
|
|
2779
|
+
loading: Sn,
|
|
2780
|
+
"pay-with-card": "alebo zaplaťte kartou",
|
|
2781
|
+
buttonTexts: Nn,
|
|
2782
|
+
address: wn,
|
|
2783
|
+
validation: Tn
|
|
2784
|
+
}, An = "E-posta", Rn = "email@ornek.com.tr", In = "Telefon Numarası", Cn = "Ülkeleri ara", Ln = "Sonuç bulunamadı", Dn = "Kart sahibinin adı", Bn = "Kart bilgileri", kn = "Kart üzerindeki tam ad", Mn = "AA / YY", Vn = "Lütfen pencereyi kapatmayın", Pn = { pay: "ÖDE", submit: "GÖNDER", getPlan: "PLANIMI AL", donate: "BAĞIŞ YAP", book: "ŞİMDİ REZERVASYON YAP", order: "ŞİMDİ SİPARİŞ VER" }, qn = { billingTitle: "Fatura Adresi", shippingTitle: "Teslimat Adresi", sameAsBilling: "Fatura adresimi kullan", street: "Sokak Adresi", addressLine1: "Adres Satırı 1", firstName: "Ad", lastName: "Soyad", state: "İl / Bölge", city: "Şehir", townCity: "Şehir/İlçe", zipCode: "Posta Kodu", postalCode: "Posta Kodu", country: "Ülke", chooseCountry: "Ülke seçin", chooseState: "İl seçin", chooseProvince: "Eyalet seçin", placeholder: { firstName: "Ahmet", lastName: "Yılmaz", street: "Atatürk Caddesi 1", city: "İstanbul", zipCode: "34000" } }, zn = { emailSuggestion: "{{email}} demek mi istediniz?", emailInvalid: "E-posta adresiniz geçerli değil", emailRequired: "E-posta adresi gerekli", cardNumberRequired: "Kart numarası gerekli", cardExpiryInvalid: "Kartınızın son kullanma tarihi geçmiş", cardExpiryFormat: "Kartınızın son kullanma tarihi eksik", cardSecurityFormat: "Kartınızın güvenlik kodu eksik", nameRequired: "Lütfen kart üzerindeki ismi girin", cardNumberInvalid: "Kart numaranız geçersiz", cardNumberLuhnInvalid: "Kart numaranız geçersiz", phoneNumberRequired: "Telefon numarası gerekli", phoneNumberInvalid: "Telefon numaranız geçersiz. Lütfen açılır menüden doğru ülkenin seçili olduğundan emin olun.", "invalid-checkout": "Checkout başlatılamadı", streetRequired: "Sokak adresi gerekli", firstNameRequired: "Ad gerekli", lastNameRequired: "Soyad gerekli", stateRequired: "İl / Bölge gerekli", cityRequired: "Şehir gerekli", zipCodeRequired: "Posta kodu gerekli", addressLine1Required: "Sokak adresi gerekli", townCityRequired: "Şehir gerekli", postalCodeRequired: "Posta kodu gerekli", zipCodeInvalid: "Lütfen geçerli bir posta kodu girin", countryRequired: "Ülke gerekli" }, Fn = {
|
|
2785
|
+
email: An,
|
|
2786
|
+
emailPlaceholder: Rn,
|
|
2787
|
+
phoneNumber: In,
|
|
2788
|
+
countrySearch: Cn,
|
|
2789
|
+
countryNoResults: Ln,
|
|
2790
|
+
cardholderNameLabel: Dn,
|
|
2791
|
+
cardInformation: Bn,
|
|
2792
|
+
cardholderNamePlaceholder: kn,
|
|
2793
|
+
cardExpiry: Mn,
|
|
2794
|
+
loading: Vn,
|
|
2795
|
+
"pay-with-card": "veya bir kartla ödeyin",
|
|
2796
|
+
buttonTexts: Pn,
|
|
2797
|
+
address: qn,
|
|
2798
|
+
validation: zn
|
|
2799
|
+
}, qe = {
|
|
2800
|
+
en: Mi,
|
|
2801
|
+
de: Ei,
|
|
2802
|
+
es: Ui,
|
|
2803
|
+
fr: lr,
|
|
2804
|
+
pl: Yr,
|
|
2805
|
+
pt: dn,
|
|
2806
|
+
tr: Fn,
|
|
2807
|
+
it: Nr,
|
|
2808
|
+
sk: xn,
|
|
2809
|
+
cs: ai,
|
|
2810
|
+
nl: Pr
|
|
2811
|
+
// Add other locales here
|
|
2812
|
+
};
|
|
2813
|
+
class On {
|
|
2814
|
+
locale;
|
|
2815
|
+
loadedLocales = /* @__PURE__ */ new Set();
|
|
2816
|
+
constructor(e = "en") {
|
|
2817
|
+
this.locale = e, this.loadedLocales.add(e);
|
|
2818
|
+
}
|
|
2819
|
+
setLocale(e) {
|
|
2820
|
+
this.locale = e, this.loadedLocales.add(e);
|
|
2821
|
+
}
|
|
2822
|
+
getLocale() {
|
|
2823
|
+
return this.locale;
|
|
2824
|
+
}
|
|
2825
|
+
translate(e, t) {
|
|
2826
|
+
const r = this.getNestedTranslation(e);
|
|
2827
|
+
return !t || r === e ? r : this.interpolate(r, t);
|
|
2828
|
+
}
|
|
2829
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2830
|
+
getNestedTranslation(e) {
|
|
2831
|
+
const t = this.locale in qe ? qe[this.locale] : {}, r = this.findNestedValue(t, e);
|
|
2832
|
+
return r === void 0 ? e : r;
|
|
2833
|
+
}
|
|
2834
|
+
findNestedValue(e, t) {
|
|
2835
|
+
const r = t.split(".");
|
|
2836
|
+
let n = e;
|
|
2837
|
+
for (const s of r) {
|
|
2838
|
+
if (n == null || !Object.prototype.hasOwnProperty.call(n, s))
|
|
2839
|
+
return;
|
|
2840
|
+
n = n[s];
|
|
2841
|
+
}
|
|
2842
|
+
return typeof n == "string" ? n : void 0;
|
|
2843
|
+
}
|
|
2844
|
+
interpolate(e, t) {
|
|
2845
|
+
return e.replace(/{{(\w+)}}/g, (r, n) => {
|
|
2846
|
+
const s = t[n];
|
|
2847
|
+
return s === void 0 ? r : String(s);
|
|
2848
|
+
});
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
const ze = [
|
|
2852
|
+
"en",
|
|
2853
|
+
"de",
|
|
2854
|
+
"es",
|
|
2855
|
+
"fr",
|
|
2856
|
+
"pl",
|
|
2857
|
+
"pt",
|
|
2858
|
+
"it",
|
|
2859
|
+
"tr",
|
|
2860
|
+
"cs",
|
|
2861
|
+
"sk",
|
|
2862
|
+
"nl"
|
|
2863
|
+
], jn = "en";
|
|
2864
|
+
function $n(i) {
|
|
2865
|
+
const e = new On(), r = (() => {
|
|
2866
|
+
const o = navigator?.language?.split("-")[0]?.toLowerCase();
|
|
2867
|
+
return ze.includes(o) ? o : jn;
|
|
2868
|
+
})();
|
|
2869
|
+
e.setLocale(r);
|
|
2870
|
+
const n = jt({
|
|
2871
|
+
locale: r,
|
|
2872
|
+
translationService: e
|
|
2873
|
+
});
|
|
2874
|
+
return {
|
|
2875
|
+
store: n,
|
|
2876
|
+
translate: (o, l) => n.getState().translationService.translate(o, l),
|
|
2877
|
+
setLocale: (o) => {
|
|
2878
|
+
ze.includes(o) && (n.getState().translationService.setLocale(o), n.setState({ locale: o }));
|
|
2879
|
+
},
|
|
2880
|
+
getLocale: () => n.getValue("locale"),
|
|
2881
|
+
subscribe: n.subscribe.bind(n)
|
|
2882
|
+
};
|
|
2883
|
+
}
|
|
2884
|
+
const Hn = $n(), Je = () => {
|
|
2885
|
+
const { translate: i, getLocale: e, setLocale: t, subscribe: r } = Hn;
|
|
2886
|
+
return {
|
|
2887
|
+
t: i,
|
|
2888
|
+
translate: i,
|
|
2889
|
+
locale: e(),
|
|
2890
|
+
setLocale: t,
|
|
2891
|
+
subscribe: r
|
|
2892
|
+
};
|
|
2893
|
+
}, Ye = "https://fonts.googleapis.com/", Kn = (i) => i.rel === "stylesheet" && i.href.startsWith(Ye), us = ({ fontFamily: i }) => {
|
|
2894
|
+
if (!i)
|
|
2895
|
+
return { cleanup: () => {
|
|
2896
|
+
} };
|
|
2897
|
+
const e = i.trim().replace(/\s+/g, "+"), t = `${Ye}css2?family=${e}:wght@400;700&display=swap`, r = [...document.head.querySelectorAll("link")].filter(
|
|
2898
|
+
Kn
|
|
2899
|
+
), n = document.createElement("link");
|
|
2900
|
+
n.rel = "stylesheet", n.href = t;
|
|
2901
|
+
const s = r.find(
|
|
2902
|
+
(o) => o.href.includes(`family=${e}`)
|
|
2903
|
+
);
|
|
2904
|
+
if (s)
|
|
2905
|
+
s.href = t;
|
|
2906
|
+
else if (r.length > 0) {
|
|
2907
|
+
const o = r.at(-1);
|
|
2908
|
+
o?.nextSibling ? document.head.insertBefore(n, o.nextSibling) : document.head.appendChild(n);
|
|
2909
|
+
} else
|
|
2910
|
+
document.head.appendChild(n);
|
|
2911
|
+
return { cleanup: () => {
|
|
2912
|
+
document.head.contains(n) && document.head.removeChild(n);
|
|
2913
|
+
} };
|
|
2914
|
+
};
|
|
2915
|
+
class fs {
|
|
2916
|
+
// The sequence of fields to focus in order
|
|
2917
|
+
focusSequence = [
|
|
2918
|
+
"cardNumber",
|
|
2919
|
+
"cardExpiry",
|
|
2920
|
+
"cardCvv",
|
|
2921
|
+
"name"
|
|
2922
|
+
];
|
|
2923
|
+
// Track the current focus index
|
|
2924
|
+
currentFocusIndex = 0;
|
|
2925
|
+
// Map of field names to their focus functions
|
|
2926
|
+
fields = {
|
|
2927
|
+
email: null,
|
|
2928
|
+
phoneNumber: null,
|
|
2929
|
+
cardNumber: null,
|
|
2930
|
+
cardExpiry: null,
|
|
2931
|
+
cardCvv: null,
|
|
2932
|
+
name: null
|
|
2933
|
+
};
|
|
2934
|
+
// Track the validation state of each field
|
|
2935
|
+
fieldValidState = {
|
|
2936
|
+
email: !1,
|
|
2937
|
+
phoneNumber: !1,
|
|
2938
|
+
cardNumber: !1,
|
|
2939
|
+
cardExpiry: !1,
|
|
2940
|
+
cardCvv: !1,
|
|
2941
|
+
name: !1
|
|
2942
|
+
};
|
|
2943
|
+
// Track if field was previously valid (to detect transitions)
|
|
2944
|
+
previousFieldValidState = {
|
|
2945
|
+
email: !1,
|
|
2946
|
+
phoneNumber: !1,
|
|
2947
|
+
cardNumber: !1,
|
|
2948
|
+
cardExpiry: !1,
|
|
2949
|
+
cardCvv: !1,
|
|
2950
|
+
name: !1
|
|
2951
|
+
};
|
|
2952
|
+
/**
|
|
2953
|
+
* Register a field with the focus manager
|
|
2954
|
+
*/
|
|
2955
|
+
registerField(e, t) {
|
|
2956
|
+
this.fields[e] = t;
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* Handle field focus events
|
|
2960
|
+
*/
|
|
2961
|
+
handleFieldFocus(e) {
|
|
2962
|
+
const t = this.focusSequence.findIndex(
|
|
2963
|
+
(r) => r === e
|
|
2964
|
+
);
|
|
2965
|
+
t >= 0 && (this.currentFocusIndex = t);
|
|
2966
|
+
}
|
|
2967
|
+
/**
|
|
2968
|
+
* Update the validation state of fields based on form state
|
|
2969
|
+
*/
|
|
2970
|
+
handleStateUpdate(e, t, r) {
|
|
2971
|
+
Object.assign(this.previousFieldValidState, this.fieldValidState);
|
|
2972
|
+
const n = !!e.email && !t.email && !!r.email;
|
|
2973
|
+
this.fieldValidState.email = n;
|
|
2974
|
+
const s = !!e.phoneNumber && !t.phoneNumber && !!r.phoneNumber;
|
|
2975
|
+
this.fieldValidState.phoneNumber = s;
|
|
2976
|
+
const a = !!e.cardNumber && !t.cardNumber && !!r.cardNumber;
|
|
2977
|
+
this.fieldValidState.cardNumber = a;
|
|
2978
|
+
const o = !!e.cardExpiry && !t.cardExpiry && !!r.cardExpiry;
|
|
2979
|
+
this.fieldValidState.cardExpiry = o;
|
|
2980
|
+
const l = !!e.cardCvv && !t.cardCvv && !!r.cardCvv;
|
|
2981
|
+
this.fieldValidState.cardCvv = l;
|
|
2982
|
+
const h = !!e.name && !t.name && !!r.name;
|
|
2983
|
+
this.fieldValidState.name = h, this.checkForValidTransitions();
|
|
2984
|
+
}
|
|
2985
|
+
/**
|
|
2986
|
+
* Check if any fields have transitioned from invalid to valid and progress focus if needed
|
|
2987
|
+
*/
|
|
2988
|
+
checkForValidTransitions() {
|
|
2989
|
+
const e = this.focusSequence[this.currentFocusIndex];
|
|
2990
|
+
e && this.fieldValidState[e] && !this.previousFieldValidState[e] && this.focusNextField();
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Focus the next field in sequence
|
|
2994
|
+
*/
|
|
2995
|
+
focusNextField() {
|
|
2996
|
+
this.currentFocusIndex = Math.min(
|
|
2997
|
+
this.currentFocusIndex + 1,
|
|
2998
|
+
this.focusSequence.length - 1
|
|
2999
|
+
), this.applyFocusToCurrentField();
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Focus a specific field by its index in the sequence
|
|
3003
|
+
*/
|
|
3004
|
+
focusFieldByIndex(e) {
|
|
3005
|
+
e >= 0 && e < this.focusSequence.length && (this.currentFocusIndex = e, this.applyFocusToCurrentField());
|
|
3006
|
+
}
|
|
3007
|
+
/**
|
|
3008
|
+
* Apply focus to the current field based on focus index
|
|
3009
|
+
*/
|
|
3010
|
+
applyFocusToCurrentField() {
|
|
3011
|
+
const e = this.focusSequence[this.currentFocusIndex], t = this.fields[e];
|
|
3012
|
+
t && setTimeout(() => {
|
|
3013
|
+
t.focus();
|
|
3014
|
+
}, 0);
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* Focus the card number field (first field)
|
|
3018
|
+
* Used for setting initial focus on page load
|
|
3019
|
+
*/
|
|
3020
|
+
focusCardNumberField() {
|
|
3021
|
+
this.currentFocusIndex = 0, this.applyFocusToCurrentField();
|
|
3022
|
+
}
|
|
3023
|
+
/**
|
|
3024
|
+
* Focus a specific field by name
|
|
3025
|
+
* Used for manual focus control (e.g., Tab key navigation)
|
|
3026
|
+
*/
|
|
3027
|
+
focusField(e) {
|
|
3028
|
+
const t = this.focusSequence.findIndex(
|
|
3029
|
+
(r) => r === e
|
|
3030
|
+
);
|
|
3031
|
+
if (t >= 0)
|
|
3032
|
+
this.currentFocusIndex = t, this.applyFocusToCurrentField();
|
|
3033
|
+
else if (this.fields[e]) {
|
|
3034
|
+
const r = this.fields[e];
|
|
3035
|
+
r && setTimeout(() => {
|
|
3036
|
+
r.focus();
|
|
3037
|
+
}, 0);
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
class N {
|
|
3042
|
+
element;
|
|
3043
|
+
children = [];
|
|
3044
|
+
eventListeners = [];
|
|
3045
|
+
/**
|
|
3046
|
+
* Create a new component with the specified element
|
|
3047
|
+
* @param tagName The HTML tag name to create
|
|
3048
|
+
* @param classNames Optional CSS class names to add
|
|
3049
|
+
* @param attributes Optional attributes to set on the element
|
|
3050
|
+
*/
|
|
3051
|
+
constructor(e, t = [], r = {}) {
|
|
3052
|
+
this.element = document.createElement(e), t.length > 0 && this.addClass(...t), Object.entries(r).forEach(([n, s]) => {
|
|
3053
|
+
this.setAttribute(n, s);
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
3057
|
+
* Get the DOM element for this component
|
|
3058
|
+
*/
|
|
3059
|
+
getElement() {
|
|
3060
|
+
return this.element;
|
|
3061
|
+
}
|
|
3062
|
+
/**
|
|
3063
|
+
* Add CSS classes to the element
|
|
3064
|
+
*/
|
|
3065
|
+
addClass(...e) {
|
|
3066
|
+
return this.element.classList.add(...e), this;
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* Remove CSS classes from the element
|
|
3070
|
+
*/
|
|
3071
|
+
removeClass(...e) {
|
|
3072
|
+
return this.element.classList.remove(...e), this;
|
|
3073
|
+
}
|
|
3074
|
+
/**
|
|
3075
|
+
* Set an attribute on the element
|
|
3076
|
+
*/
|
|
3077
|
+
setAttribute(e, t) {
|
|
3078
|
+
return this.element.setAttribute(e, t), this;
|
|
3079
|
+
}
|
|
3080
|
+
/**
|
|
3081
|
+
* Set the inner text of the element
|
|
3082
|
+
*/
|
|
3083
|
+
setText(e) {
|
|
3084
|
+
return this.element.textContent = e, this;
|
|
3085
|
+
}
|
|
3086
|
+
/**
|
|
3087
|
+
* Set the inner HTML of the element
|
|
3088
|
+
* Note: Use with caution to avoid XSS vulnerabilities
|
|
3089
|
+
*/
|
|
3090
|
+
setHTML(e) {
|
|
3091
|
+
return this.element.innerHTML = e, this;
|
|
3092
|
+
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Append a child component to this component
|
|
3095
|
+
*/
|
|
3096
|
+
appendChild(e) {
|
|
3097
|
+
return this.children.push(e), this.element.appendChild(e.getElement()), this;
|
|
3098
|
+
}
|
|
3099
|
+
/**
|
|
3100
|
+
* Append this component to a parent element
|
|
3101
|
+
*/
|
|
3102
|
+
appendTo(e) {
|
|
3103
|
+
return e instanceof N ? e.appendChild(this) : e.appendChild(this.element), this;
|
|
3104
|
+
}
|
|
3105
|
+
/**
|
|
3106
|
+
* Add an event listener to the element
|
|
3107
|
+
*/
|
|
3108
|
+
addEventListener(e, t, r) {
|
|
3109
|
+
return this.element.addEventListener(e, t, r), this.eventListeners.push({ type: e, listener: t }), this;
|
|
3110
|
+
}
|
|
3111
|
+
/**
|
|
3112
|
+
* Remove an event listener from the element
|
|
3113
|
+
*/
|
|
3114
|
+
removeEventListener(e, t, r) {
|
|
3115
|
+
return this.element.removeEventListener(e, t, r), this;
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Hide this component
|
|
3119
|
+
*/
|
|
3120
|
+
hide() {
|
|
3121
|
+
return this.element.style.display = "none", this;
|
|
3122
|
+
}
|
|
3123
|
+
/**
|
|
3124
|
+
* Show this component
|
|
3125
|
+
*/
|
|
3126
|
+
show() {
|
|
3127
|
+
return this.element.style.display = "", this;
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Destroy this component and clean up resources
|
|
3131
|
+
*/
|
|
3132
|
+
destroy() {
|
|
3133
|
+
this.eventListeners.forEach(({ type: e, listener: t }) => {
|
|
3134
|
+
this.element.removeEventListener(e, t);
|
|
3135
|
+
}), this.eventListeners = [], this.children.forEach((e) => e.destroy()), this.children = [], this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
var ue;
|
|
3139
|
+
(function(i) {
|
|
3140
|
+
i.Alberta = "AB", i.BritishColumbia = "BC", i.Manitoba = "MB", i.NewBrunswick = "NB", i.NewfoundlandAndLabrador = "NL", i.NorthwestTerritories = "NT", i.NovaScotia = "NS", i.Nunavut = "NU", i.Ontario = "ON", i.PrinceEdwardIsland = "PE", i.Quebec = "QC", i.Saskatchewan = "SK", i.Yukon = "YT";
|
|
3141
|
+
})(ue || (ue = {}));
|
|
3142
|
+
var ee;
|
|
3143
|
+
(function(i) {
|
|
3144
|
+
i.Afghanistan = "AF", i.AlandIslands = "AX", i.Albania = "AL", i.Algeria = "DZ", i.AmericanSamoa = "AS", i.Andorra = "AD", i.Angola = "AO", i.Anguilla = "AI", i.Antarctica = "AQ", i.AntiguaAndBarbuda = "AG", i.Argentina = "AR", i.Armenia = "AM", i.Aruba = "AW", i.Australia = "AU", i.Austria = "AT", i.Azerbaijan = "AZ", i.Bahamas = "BS", i.Bahrain = "BH", i.Bangladesh = "BD", i.Barbados = "BB", i.Belarus = "BY", i.Belgium = "BE", i.Belize = "BZ", i.Benin = "BJ", i.Bermuda = "BM", i.Bhutan = "BT", i.Bolivia = "BO", i.BonaireSintEustatiusSaba = "BQ", i.BosniaAndHerzegovina = "BA", i.Botswana = "BW", i.BouvetIsland = "BV", i.Brazil = "BR", i.BritishIndianOceanTerritory = "IO", i.BruneiDarussalam = "BN", i.Bulgaria = "BG", i.BurkinaFaso = "BF", i.Burundi = "BI", i.Cambodia = "KH", i.Cameroon = "CM", i.Canada = "CA", i.CapeVerde = "CV", i.CaymanIslands = "KY", i.CentralAfricanRepublic = "CF", i.Chad = "TD", i.Chile = "CL", i.China = "CN", i.ChristmasIsland = "CX", i.CocosKeelingIslands = "CC", i.Colombia = "CO", i.Comoros = "KM", i.Congo = "CG", i.CongoDemocraticRepublic = "CD", i.CookIslands = "CK", i.CostaRica = "CR", i.CoteDIvoire = "CI", i.Croatia = "HR", i.Cuba = "CU", i.Curacao = "CW", i.Cyprus = "CY", i.CzechRepublic = "CZ", i.Denmark = "DK", i.Djibouti = "DJ", i.Dominica = "DM", i.DominicanRepublic = "DO", i.Ecuador = "EC", i.Egypt = "EG", i.ElSalvador = "SV", i.EquatorialGuinea = "GQ", i.Eritrea = "ER", i.Estonia = "EE", i.Ethiopia = "ET", i.FalklandIslands = "FK", i.FaroeIslands = "FO", i.Fiji = "FJ", i.Finland = "FI", i.France = "FR", i.FrenchGuiana = "GF", i.FrenchPolynesia = "PF", i.FrenchSouthernTerritories = "TF", i.Gabon = "GA", i.Gambia = "GM", i.Georgia = "GE", i.Germany = "DE", i.Ghana = "GH", i.Gibraltar = "GI", i.Greece = "GR", i.Greenland = "GL", i.Grenada = "GD", i.Guadeloupe = "GP", i.Guam = "GU", i.Guatemala = "GT", i.Guernsey = "GG", i.Guinea = "GN", i.GuineaBissau = "GW", i.Guyana = "GY", i.Haiti = "HT", i.HeardIslandMcdonaldIslands = "HM", i.HolySeeVaticanCityState = "VA", i.Honduras = "HN", i.HongKong = "HK", i.Hungary = "HU", i.Iceland = "IS", i.India = "IN", i.Indonesia = "ID", i.Iran = "IR", i.Iraq = "IQ", i.Ireland = "IE", i.IsleOfMan = "IM", i.Israel = "IL", i.Italy = "IT", i.Jamaica = "JM", i.Japan = "JP", i.Jersey = "JE", i.Jordan = "JO", i.Kazakhstan = "KZ", i.Kenya = "KE", i.Kiribati = "KI", i.Korea = "KR", i.KoreaDemocraticPeoplesRepublic = "KP", i.Kuwait = "KW", i.Kyrgyzstan = "KG", i.LaoPeoplesDemocraticRepublic = "LA", i.Latvia = "LV", i.Lebanon = "LB", i.Lesotho = "LS", i.Liberia = "LR", i.LibyanArabJamahiriya = "LY", i.Liechtenstein = "LI", i.Lithuania = "LT", i.Luxembourg = "LU", i.Macao = "MO", i.Macedonia = "MK", i.Madagascar = "MG", i.Malawi = "MW", i.Malaysia = "MY", i.Maldives = "MV", i.Mali = "ML", i.Malta = "MT", i.MarshallIslands = "MH", i.Martinique = "MQ", i.Mauritania = "MR", i.Mauritius = "MU", i.Mayotte = "YT", i.Mexico = "MX", i.Micronesia = "FM", i.Moldova = "MD", i.Monaco = "MC", i.Mongolia = "MN", i.Montenegro = "ME", i.Montserrat = "MS", i.Morocco = "MA", i.Mozambique = "MZ", i.Myanmar = "MM", i.Namibia = "NA", i.Nauru = "NR", i.Nepal = "NP", i.Netherlands = "NL", i.NewCaledonia = "NC", i.NewZealand = "NZ", i.Nicaragua = "NI", i.Niger = "NE", i.Nigeria = "NG", i.Niue = "NU", i.NorfolkIsland = "NF", i.NorthernMarianaIslands = "MP", i.Norway = "NO", i.Oman = "OM", i.Pakistan = "PK", i.Palau = "PW", i.PalestinianTerritory = "PS", i.Panama = "PA", i.PapuaNewGuinea = "PG", i.Paraguay = "PY", i.Peru = "PE", i.Philippines = "PH", i.Pitcairn = "PN", i.Poland = "PL", i.Portugal = "PT", i.PuertoRico = "PR", i.Qatar = "QA", i.Reunion = "RE", i.Romania = "RO", i.RussianFederation = "RU", i.Rwanda = "RW", i.SaintBarthelemy = "BL", i.SaintHelena = "SH", i.SaintKittsAndNevis = "KN", i.SaintLucia = "LC", i.SaintMartin = "MF", i.SaintPierreAndMiquelon = "PM", i.SaintVincentAndGrenadines = "VC", i.Samoa = "WS", i.SanMarino = "SM", i.SaoTomeAndPrincipe = "ST", i.SaudiArabia = "SA", i.Senegal = "SN", i.Serbia = "RS", i.Seychelles = "SC", i.SierraLeone = "SL", i.Singapore = "SG", i.SintMaarten = "SX", i.Slovakia = "SK", i.Slovenia = "SI", i.SolomonIslands = "SB", i.Somalia = "SO", i.SouthAfrica = "ZA", i.SouthGeorgiaAndSandwichIsl = "GS", i.SouthSudan = "SS", i.Spain = "ES", i.SriLanka = "LK", i.Sudan = "SD", i.Suriname = "SR", i.SvalbardAndJanMayen = "SJ", i.Swaziland = "SZ", i.Sweden = "SE", i.Switzerland = "CH", i.SyrianArabRepublic = "SY", i.Taiwan = "TW", i.Tajikistan = "TJ", i.Tanzania = "TZ", i.Thailand = "TH", i.TimorLeste = "TL", i.Togo = "TG", i.Tokelau = "TK", i.Tonga = "TO", i.TrinidadAndTobago = "TT", i.Tunisia = "TN", i.Turkey = "TR", i.Turkmenistan = "TM", i.TurksAndCaicosIslands = "TC", i.Tuvalu = "TV", i.Uganda = "UG", i.Ukraine = "UA", i.UnitedArabEmirates = "AE", i.UnitedKingdom = "GB", i.UnitedStates = "US", i.UnitedStatesOutlyingIslands = "UM", i.Uruguay = "UY", i.Uzbekistan = "UZ", i.Vanuatu = "VU", i.Venezuela = "VE", i.Vietnam = "VN", i.VirginIslandsBritish = "VG", i.VirginIslandsUS = "VI", i.WallisAndFutuna = "WF", i.WesternSahara = "EH", i.Yemen = "YE", i.Zambia = "ZM", i.Zimbabwe = "ZW";
|
|
3145
|
+
})(ee || (ee = {}));
|
|
3146
|
+
var Fe;
|
|
3147
|
+
(function(i) {
|
|
3148
|
+
i.usd = "usd", i.eur = "eur", i.gbp = "gbp", i.cad = "cad", i.aud = "aud", i.pln = "pln", i.czk = "czk", i.sek = "sek", i.dkk = "dkk";
|
|
3149
|
+
})(Fe || (Fe = {}));
|
|
3150
|
+
var fe;
|
|
3151
|
+
(function(i) {
|
|
3152
|
+
i.Alabama = "AL", i.Alaska = "AK", i.Arizona = "AZ", i.Arkansas = "AR", i.California = "CA", i.Colorado = "CO", i.Connecticut = "CT", i.Delaware = "DE", i.DistrictOfColumbia = "DC", i.Florida = "FL", i.Georgia = "GA", i.Hawaii = "HI", i.Idaho = "ID", i.Illinois = "IL", i.Indiana = "IN", i.Iowa = "IA", i.Kansas = "KS", i.Kentucky = "KY", i.Louisiana = "LA", i.Maine = "ME", i.Maryland = "MD", i.Massachusetts = "MA", i.Michigan = "MI", i.Minnesota = "MN", i.Mississippi = "MS", i.Missouri = "MO", i.Montana = "MT", i.Nebraska = "NE", i.Nevada = "NV", i.NewHampshire = "NH", i.NewJersey = "NJ", i.NewMexico = "NM", i.NewYork = "NY", i.NorthCarolina = "NC", i.NorthDakota = "ND", i.Ohio = "OH", i.Oklahoma = "OK", i.Oregon = "OR", i.Pennsylvania = "PA", i.RhodeIsland = "RI", i.SouthCarolina = "SC", i.SouthDakota = "SD", i.Tennessee = "TN", i.Texas = "TX", i.Utah = "UT", i.Vermont = "VT", i.Virginia = "VA", i.Washington = "WA", i.WestVirginia = "WV", i.Wisconsin = "WI", i.Wyoming = "WY";
|
|
3153
|
+
})(fe || (fe = {}));
|
|
3154
|
+
const Gn = (i) => i.replace(/([A-Z])/g, " $1").trim(), _n = Object.fromEntries(
|
|
3155
|
+
Object.entries(ee).map(([i, e]) => [
|
|
3156
|
+
e,
|
|
3157
|
+
Gn(i)
|
|
3158
|
+
])
|
|
3159
|
+
), Zn = new Set(Object.values(ee)), Ee = /* @__PURE__ */ new Map(), Un = (i) => (Ee.has(i) || Ee.set(
|
|
3160
|
+
i,
|
|
3161
|
+
new Intl.DisplayNames([i], { type: "region" })
|
|
3162
|
+
), Ee.get(i)), Jn = () => Object.values(ee), Yn = (i, e) => {
|
|
3163
|
+
const t = i.toUpperCase();
|
|
3164
|
+
if (e)
|
|
3165
|
+
try {
|
|
3166
|
+
const r = Un(e).of(t);
|
|
3167
|
+
if (r) return r;
|
|
3168
|
+
} catch {
|
|
3169
|
+
}
|
|
3170
|
+
return _n[t] || t;
|
|
3171
|
+
}, ps = (i, e) => (i && i.length > 0 ? i.map((r) => r.toUpperCase()).filter((r) => Zn.has(r)) : Jn()).map((r) => ({
|
|
3172
|
+
value: r,
|
|
3173
|
+
text: Yn(r, e)
|
|
3174
|
+
})).sort((r, n) => r.text.localeCompare(n.text, e)), We = {
|
|
3175
|
+
US: fe,
|
|
3176
|
+
CA: ue
|
|
3177
|
+
}, Oe = (i) => Object.fromEntries(
|
|
3178
|
+
Object.entries(i).map(([e, t]) => [
|
|
3179
|
+
t,
|
|
3180
|
+
e.replace(/([A-Z])/g, " $1").trim()
|
|
3181
|
+
])
|
|
3182
|
+
), Wn = {
|
|
3183
|
+
US: Oe(fe),
|
|
3184
|
+
CA: Oe(ue)
|
|
3185
|
+
}, Qn = (i = "US") => Object.values(We[i]), Xn = (i, e = "US") => Wn[e][i.toUpperCase()] || i, ms = (i, e = "US") => {
|
|
3186
|
+
const t = We[e], r = Object.values(t), n = i && i.length > 0 ? [...new Set(i.map((a) => a.toUpperCase()))] : null;
|
|
3187
|
+
return (n ? n.filter((a) => r.includes(a)) : Qn(e)).map((a) => ({
|
|
3188
|
+
value: a,
|
|
3189
|
+
text: Xn(a, e)
|
|
3190
|
+
})).sort((a, o) => a.text.localeCompare(o.text));
|
|
3191
|
+
};
|
|
3192
|
+
class W {
|
|
3193
|
+
/**
|
|
3194
|
+
* Create a div element
|
|
3195
|
+
*/
|
|
3196
|
+
static createDiv(e = [], t = {}) {
|
|
3197
|
+
return new N("div", e, t);
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Create a span element
|
|
3201
|
+
*/
|
|
3202
|
+
static createSpan(e = [], t = {}) {
|
|
3203
|
+
return new N("span", e, t);
|
|
3204
|
+
}
|
|
3205
|
+
/**
|
|
3206
|
+
* Create a button element
|
|
3207
|
+
*/
|
|
3208
|
+
static createButton(e, t = [], r = {}) {
|
|
3209
|
+
const n = new N("button", t, r);
|
|
3210
|
+
return n.setText(e), n;
|
|
3211
|
+
}
|
|
3212
|
+
/**
|
|
3213
|
+
* Create an input element
|
|
3214
|
+
*/
|
|
3215
|
+
static createInput(e, t = [], r = {}) {
|
|
3216
|
+
const n = { type: e, ...r };
|
|
3217
|
+
return new N("input", t, n);
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Create a text input
|
|
3221
|
+
*/
|
|
3222
|
+
static createTextInput(e = "", t = [], r = {}) {
|
|
3223
|
+
const n = {
|
|
3224
|
+
type: "text",
|
|
3225
|
+
placeholder: e,
|
|
3226
|
+
...r
|
|
3227
|
+
};
|
|
3228
|
+
return new N("input", t, n);
|
|
3229
|
+
}
|
|
3230
|
+
/**
|
|
3231
|
+
* Create a form element
|
|
3232
|
+
*/
|
|
3233
|
+
static createForm(e = [], t = {}) {
|
|
3234
|
+
return new N("form", e, t);
|
|
3235
|
+
}
|
|
3236
|
+
/**
|
|
3237
|
+
* Create a label element
|
|
3238
|
+
*/
|
|
3239
|
+
static createLabel(e, t = "", r = [], n = {}) {
|
|
3240
|
+
const s = t ? { for: t, ...n } : n, a = new N("label", r, s);
|
|
3241
|
+
return a.setText(e), a;
|
|
3242
|
+
}
|
|
3243
|
+
/**
|
|
3244
|
+
* Create a select element
|
|
3245
|
+
*/
|
|
3246
|
+
static createSelect(e, t = [], r = {}) {
|
|
3247
|
+
const n = new N("select", t, r);
|
|
3248
|
+
return e.forEach((s) => {
|
|
3249
|
+
const a = document.createElement("option");
|
|
3250
|
+
a.value = s.value, a.textContent = s.text, s.selected && (a.selected = !0), n.getElement().appendChild(a);
|
|
3251
|
+
}), n;
|
|
3252
|
+
}
|
|
3253
|
+
/**
|
|
3254
|
+
* Create an image element
|
|
3255
|
+
*/
|
|
3256
|
+
static createImage(e, t = "", r = [], n = {}) {
|
|
3257
|
+
const s = { src: e, alt: t, ...n };
|
|
3258
|
+
return new N("img", r, s);
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
class M extends N {
|
|
3262
|
+
span;
|
|
3263
|
+
constructor(e) {
|
|
3264
|
+
super("div", []), this.span = document.createElement("span"), this.span.className = "form-helper-text", e.visible === !1 && this.span.classList.add("form-helper-text-hidden"), this.span.textContent = e.text || "", this.getElement().appendChild(this.span);
|
|
3265
|
+
}
|
|
3266
|
+
setText(e) {
|
|
3267
|
+
return this.span && (this.span.textContent = e), this;
|
|
3268
|
+
}
|
|
3269
|
+
toggleVisibility(e) {
|
|
3270
|
+
return e ? this.showMessage() : this.hideMessage(), this;
|
|
3271
|
+
}
|
|
3272
|
+
showMessage() {
|
|
3273
|
+
return this.span && this.span.classList.remove("form-helper-text-hidden"), this;
|
|
3274
|
+
}
|
|
3275
|
+
hideMessage() {
|
|
3276
|
+
return this.span && this.span.classList.add("form-helper-text-hidden"), this;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
class Qe extends N {
|
|
3280
|
+
constructor(e) {
|
|
3281
|
+
if (super("label", ["input-label"], {
|
|
3282
|
+
for: e.id
|
|
3283
|
+
}), this.setText(e.label), !e.styles)
|
|
3284
|
+
return;
|
|
3285
|
+
const t = this.getElement();
|
|
3286
|
+
e.styles.color && (t.style.color = e.styles.color), e.styles.fontSize && (t.style.fontSize = `${e.styles.fontSize}px`);
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
class me extends N {
|
|
3290
|
+
inputElement;
|
|
3291
|
+
helperText = null;
|
|
3292
|
+
constructor(e) {
|
|
3293
|
+
if (super("div", ["input-wrapper"]), e.label) {
|
|
3294
|
+
const r = new Qe({
|
|
3295
|
+
styles: e.styles ? {
|
|
3296
|
+
color: e.styles.color,
|
|
3297
|
+
fontSize: e.styles.fontSize
|
|
3298
|
+
} : void 0,
|
|
3299
|
+
label: e.label,
|
|
3300
|
+
id: e.name
|
|
3301
|
+
});
|
|
3302
|
+
this.appendChild(r);
|
|
3303
|
+
}
|
|
3304
|
+
const t = {
|
|
3305
|
+
id: e.name,
|
|
3306
|
+
name: e.name,
|
|
3307
|
+
class: `form-input ${e.error ? "form-input-error" : ""}`
|
|
3308
|
+
};
|
|
3309
|
+
if (e.placeholder && (t.placeholder = e.placeholder), e.value && (t.value = e.value), e.required && (t.required = String(e.required)), e.disabled && (t.disabled = String(e.disabled)), e.autocomplete && (t.autocomplete = e.autocomplete), e.maxLength && (t.maxlength = String(e.maxLength)), this.inputElement = W.createInput(
|
|
3310
|
+
e.type || "text",
|
|
3311
|
+
[],
|
|
3312
|
+
t
|
|
3313
|
+
), e.styles) {
|
|
3314
|
+
const r = this.inputElement.getElement();
|
|
3315
|
+
r.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, r.style.color = e.styles.color, r.style.fontSize = `${e.styles.fontSize}px`, r.style.borderRadius = e.styles.borderRadius;
|
|
3316
|
+
}
|
|
3317
|
+
e.onChange && this.inputElement.getElement().addEventListener("input", e.onChange), this.getElement().appendChild(this.inputElement.getElement()), e.error ? (this.helperText = new M({
|
|
3318
|
+
text: e.errorMsg,
|
|
3319
|
+
visible: !0
|
|
3320
|
+
}), this.appendChild(this.helperText)) : (this.helperText = new M({ text: "", visible: !1 }), this.appendChild(this.helperText));
|
|
3321
|
+
}
|
|
3322
|
+
getValue() {
|
|
3323
|
+
return this.inputElement.getElement().value;
|
|
3324
|
+
}
|
|
3325
|
+
setValue(e) {
|
|
3326
|
+
return this.inputElement.getElement().value = e, this;
|
|
3327
|
+
}
|
|
3328
|
+
setError(e, t) {
|
|
3329
|
+
const r = this.inputElement.getElement();
|
|
3330
|
+
return e ? (r.classList.add("form-input-error"), !this.helperText && t ? (this.helperText = new M({ text: t }), this.appendChild(this.helperText)) : this.helperText && t ? this.helperText.setText(t).toggleVisibility(!0) : this.helperText && this.helperText.toggleVisibility(!0)) : (r.classList.remove("form-input-error"), this.helperText && this.helperText.toggleVisibility(!1)), this;
|
|
3331
|
+
}
|
|
3332
|
+
addEventListener(e, t, r) {
|
|
3333
|
+
return this.inputElement.getElement().addEventListener(e, t, r), this;
|
|
3334
|
+
}
|
|
3335
|
+
/**
|
|
3336
|
+
* Focus the input element
|
|
3337
|
+
*/
|
|
3338
|
+
focus() {
|
|
3339
|
+
this.inputElement.getElement().focus();
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
class Q extends N {
|
|
3343
|
+
static PLACEHOLDER_COLOR = "#D4D4D5";
|
|
3344
|
+
selectElement;
|
|
3345
|
+
helperText = null;
|
|
3346
|
+
configuredColor = null;
|
|
3347
|
+
constructor(e) {
|
|
3348
|
+
super("div", ["input-wrapper"]);
|
|
3349
|
+
const t = {
|
|
3350
|
+
id: e.name,
|
|
3351
|
+
name: e.name,
|
|
3352
|
+
class: `form-select ${e.error ? "form-select-error" : ""}`
|
|
3353
|
+
};
|
|
3354
|
+
if (e.required && (t.required = String(e.required)), e.disabled && (t.disabled = String(e.disabled)), e.autocomplete && (t.autocomplete = e.autocomplete), this.selectElement = new N(
|
|
3355
|
+
"select",
|
|
3356
|
+
[],
|
|
3357
|
+
t
|
|
3358
|
+
), e.placeholder) {
|
|
3359
|
+
const r = document.createElement("option");
|
|
3360
|
+
r.value = "", r.textContent = e.placeholder, r.disabled = !0, r.selected = !e.value, this.selectElement.getElement().appendChild(r);
|
|
3361
|
+
}
|
|
3362
|
+
if (e.groups?.length ? e.groups.forEach((r) => {
|
|
3363
|
+
const n = document.createElement("optgroup");
|
|
3364
|
+
n.label = r.label, r.options.forEach((s) => {
|
|
3365
|
+
const a = document.createElement("option");
|
|
3366
|
+
a.value = s.value, a.textContent = s.text, e.value && s.value === e.value && (a.selected = !0), n.appendChild(a);
|
|
3367
|
+
}), this.selectElement.getElement().appendChild(n);
|
|
3368
|
+
}) : (e.options ?? []).forEach((r) => {
|
|
3369
|
+
const n = document.createElement("option");
|
|
3370
|
+
n.value = r.value, n.textContent = r.text, e.value && r.value === e.value && (n.selected = !0), this.selectElement.getElement().appendChild(n);
|
|
3371
|
+
}), e.styles) {
|
|
3372
|
+
const r = this.selectElement.getElement();
|
|
3373
|
+
r.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, r.style.fontSize = `${e.styles.fontSize}px`, r.style.borderRadius = e.styles.borderRadius, this.configuredColor = e.styles.color;
|
|
3374
|
+
}
|
|
3375
|
+
if (e.placeholder && !e.value ? (this.selectElement.getElement().classList.add("form-select-placeholder"), this.selectElement.getElement().style.color = Q.PLACEHOLDER_COLOR) : this.configuredColor && (this.selectElement.getElement().style.color = this.configuredColor), this.selectElement.getElement().addEventListener("change", (r) => {
|
|
3376
|
+
const n = this.selectElement.getElement();
|
|
3377
|
+
n.value === "" ? (n.classList.add("form-select-placeholder"), n.style.color = Q.PLACEHOLDER_COLOR) : (n.classList.remove("form-select-placeholder"), this.configuredColor ? n.style.color = this.configuredColor : n.style.color = ""), e.onChange?.(r);
|
|
3378
|
+
}), e.label) {
|
|
3379
|
+
const r = new Qe({
|
|
3380
|
+
styles: e.styles ? {
|
|
3381
|
+
color: e.styles.color,
|
|
3382
|
+
fontSize: e.styles.fontSize
|
|
3383
|
+
} : void 0,
|
|
3384
|
+
label: e.label,
|
|
3385
|
+
id: e.name
|
|
3386
|
+
});
|
|
3387
|
+
this.appendChild(r);
|
|
3388
|
+
}
|
|
3389
|
+
this.getElement().appendChild(this.selectElement.getElement()), e.error ? (this.helperText = new M({
|
|
3390
|
+
text: e.errorMsg,
|
|
3391
|
+
visible: !0
|
|
3392
|
+
}), this.appendChild(this.helperText)) : (this.helperText = new M({ text: "", visible: !1 }), this.appendChild(this.helperText));
|
|
3393
|
+
}
|
|
3394
|
+
getValue() {
|
|
3395
|
+
return this.selectElement.getElement().value;
|
|
3396
|
+
}
|
|
3397
|
+
setValue(e) {
|
|
3398
|
+
const t = this.selectElement.getElement();
|
|
3399
|
+
return t.value = e, e === "" ? (t.classList.add("form-select-placeholder"), t.style.color = Q.PLACEHOLDER_COLOR) : (t.classList.remove("form-select-placeholder"), this.configuredColor ? t.style.color = this.configuredColor : t.style.color = ""), this;
|
|
3400
|
+
}
|
|
3401
|
+
setError(e, t) {
|
|
3402
|
+
const r = this.selectElement.getElement();
|
|
3403
|
+
return e ? (r.classList.add("form-select-error"), !this.helperText && t ? (this.helperText = new M({ text: t }), this.appendChild(this.helperText)) : this.helperText && t ? this.helperText.setText(t).toggleVisibility(!0) : this.helperText && this.helperText.toggleVisibility(!0)) : (r.classList.remove("form-select-error"), this.helperText && this.helperText.toggleVisibility(!1)), this;
|
|
3404
|
+
}
|
|
3405
|
+
addEventListener(e, t, r) {
|
|
3406
|
+
return this.selectElement.getElement().addEventListener(e, t, r), this;
|
|
3407
|
+
}
|
|
3408
|
+
/**
|
|
3409
|
+
* Focus the select element
|
|
3410
|
+
*/
|
|
3411
|
+
focus() {
|
|
3412
|
+
this.selectElement.getElement().focus();
|
|
3413
|
+
}
|
|
3414
|
+
/**
|
|
3415
|
+
* Update the options in the select element
|
|
3416
|
+
*/
|
|
3417
|
+
setOptions(e, t) {
|
|
3418
|
+
const r = this.selectElement.getElement(), n = r.value;
|
|
3419
|
+
if (r.innerHTML = "", t) {
|
|
3420
|
+
const a = document.createElement("option");
|
|
3421
|
+
a.value = "", a.textContent = t, a.disabled = !0, r.appendChild(a);
|
|
3422
|
+
}
|
|
3423
|
+
return e.forEach((a) => {
|
|
3424
|
+
const o = document.createElement("option");
|
|
3425
|
+
o.value = a.value, o.textContent = a.text, r.appendChild(o);
|
|
3426
|
+
}), e.some((a) => a.value === n) ? (r.value = n, n !== "" && (r.classList.remove("form-select-placeholder"), this.configuredColor ? r.style.color = this.configuredColor : r.style.color = "")) : (r.value = "", t ? (r.classList.add("form-select-placeholder"), r.style.color = Q.PLACEHOLDER_COLOR) : (r.classList.remove("form-select-placeholder"), this.configuredColor ? r.style.color = this.configuredColor : r.style.color = "")), this;
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
class es {
|
|
3430
|
+
input;
|
|
3431
|
+
options;
|
|
3432
|
+
currentMaxLength = 3;
|
|
3433
|
+
constructor(e) {
|
|
3434
|
+
this.options = e, this.currentMaxLength = this.getMaxLengthForCardBrand(
|
|
3435
|
+
e.cardBrand || "unknown"
|
|
3436
|
+
), this.input = new me({
|
|
3437
|
+
name: "cardCvv",
|
|
3438
|
+
placeholder: "CVV",
|
|
3439
|
+
type: "tel",
|
|
3440
|
+
autocomplete: "cc-csc",
|
|
3441
|
+
required: !0,
|
|
3442
|
+
error: !1,
|
|
3443
|
+
styles: {
|
|
3444
|
+
color: e.checkoutProfile.styles.textColor,
|
|
3445
|
+
borderRadius: `0px 0px ${e.checkoutProfile.styles.borderRadius}px 0px`,
|
|
3446
|
+
fontSize: e.checkoutProfile.styles.fontSize,
|
|
3447
|
+
fontFamily: e.checkoutProfile.styles.fontFamily
|
|
3448
|
+
},
|
|
3449
|
+
onChange: this.handleChange
|
|
3450
|
+
}), this.input.addEventListener("blur", this.handleBlur), this.input.addEventListener("focus", this.handleFocus);
|
|
3451
|
+
}
|
|
3452
|
+
getMaxLengthForCardBrand(e) {
|
|
3453
|
+
return e === "amex" ? 4 : 3;
|
|
3454
|
+
}
|
|
3455
|
+
updateCardBrand(e) {
|
|
3456
|
+
const t = this.getMaxLengthForCardBrand(e);
|
|
3457
|
+
if (t !== this.currentMaxLength) {
|
|
3458
|
+
this.currentMaxLength = t;
|
|
3459
|
+
const r = this.input.getValue();
|
|
3460
|
+
r.length > t && this.input.setValue(r.slice(0, t));
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
handleChange = (e) => {
|
|
3464
|
+
const r = e.target.value, n = Ze.cardCvv(r, this.currentMaxLength);
|
|
3465
|
+
this.input.setValue(n), this.options.onChange && this.options.onChange(n);
|
|
3466
|
+
};
|
|
3467
|
+
handleBlur = () => {
|
|
3468
|
+
this.options.onBlur && this.options.onBlur();
|
|
3469
|
+
};
|
|
3470
|
+
handleFocus = () => {
|
|
3471
|
+
this.options.onFocus && this.options.onFocus();
|
|
3472
|
+
};
|
|
3473
|
+
getElement() {
|
|
3474
|
+
return this.input.getElement();
|
|
3475
|
+
}
|
|
3476
|
+
getValue() {
|
|
3477
|
+
return this.input.getValue();
|
|
3478
|
+
}
|
|
3479
|
+
setValue(e) {
|
|
3480
|
+
this.input.setValue(e);
|
|
3481
|
+
}
|
|
3482
|
+
setError(e) {
|
|
3483
|
+
this.input.getElement().querySelector(".form-input")?.classList.toggle("form-input-error", e);
|
|
3484
|
+
}
|
|
3485
|
+
isFocused() {
|
|
3486
|
+
const e = this.input.getElement().querySelector("input");
|
|
3487
|
+
return document.activeElement === e;
|
|
3488
|
+
}
|
|
3489
|
+
focus() {
|
|
3490
|
+
this.input.focus();
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
const ts = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='30px'%20width='30px'%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23306FC5;'%20d='M512,402.281c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.997,0,402.281V109.717%20c0-16.715,13.55-30.266,30.265-30.266h451.47c16.716,0,30.265,13.551,30.265,30.266V402.281L512,402.281z'/%3e%3cpath%20style='opacity:0.15;fill:%23202121;enable-background:new%20;'%20d='M21.517,402.281V109.717%20c0-16.715,13.552-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.001,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52%20C35.07,432.549,21.517,418.997,21.517,402.281z'/%3e%3cg%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='74.59,220.748%2089.888,220.748%2082.241,201.278%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='155.946,286.107%20155.946,295.148%20181.675,295.148%20181.675,304.885%20155.946,304.885%20155.946,315.318%20184.455,315.318%20197.666,300.712%20185.151,286.107%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='356.898,201.278%20348.553,220.748%20364.548,220.748%20'/%3e%3cpolygon%20style='fill:%23FFFFFF;'%20points='230.348,320.875%20230.348,281.241%20212.268,300.712%20'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M264.42,292.368c-0.696-4.172-3.48-6.261-7.654-6.261h-14.599v12.516h15.299%20C261.637,298.624,264.42,296.539,264.42,292.368z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M313.09,297.236c1.391-0.697,2.089-2.785,2.089-4.867c0.696-2.779-0.698-4.172-2.089-4.868%20c-1.387-0.696-3.476-0.696-5.559-0.696h-13.91v11.127h13.909C309.613,297.932,311.702,297.932,313.09,297.236z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M413.217,183.198v8.344l-4.169-8.344H376.37v8.344l-4.174-8.344h-44.502%20c-7.648,0-13.909,1.392-19.469,4.173v-4.173h-31.289v0.696v3.477c-3.476-2.78-7.648-4.173-13.211-4.173h-111.95l-7.652,17.384%20l-7.647-17.384h-25.031h-10.431v8.344l-3.477-8.344h-0.696H66.942l-13.909,32.68L37.042,251.34l-0.294,0.697h0.294h35.463h0.444%20l0.252-0.697l4.174-10.428h9.039l4.172,11.125h40.326v-0.697v-7.647l3.479,8.343h20.163l3.475-8.343v7.647v0.697h15.993h79.965%20h0.696v-18.08h1.394c1.389,0,1.389,0,1.389,2.087v15.297h50.065v-4.172c4.172,2.089,10.426,4.172,18.771,4.172h20.863l4.172-11.123%20h9.732l4.172,11.123h40.328v-6.952v-3.476l6.261,10.428h1.387h0.698h30.595v-68.143h-31.291l0,0H413.217z%20M177.501,241.609h-6.955%20h-4.171v-4.169v-34.076l-0.696,1.595v-0.019l-16.176,36.669h-0.512h-3.719h-6.017l-16.687-38.245v38.245h-23.64l-4.867-10.43%20H70.417l-4.868,10.43H53.326l20.57-48.675h17.382l19.469,46.587v-46.587h4.171h14.251l0.328,0.697h0.024l8.773,19.094l6.3,14.306%20l0.223-0.721l13.906-33.375H177.5v48.674H177.501L177.501,241.609z%20M225.481,203.364h-27.119v9.039h26.423v9.734h-26.423v9.738%20h27.119v10.427h-38.939v-49.367h38.939V203.364L225.481,203.364z%20M275.076,221.294c0.018,0.016,0.041,0.027,0.063,0.042%20c0.263,0.278,0.488,0.557,0.68,0.824c1.332,1.746,2.409,4.343,2.463,8.151c0.004,0.066,0.007,0.131,0.011,0.197%20c0,0.038,0.007,0.071,0.007,0.11c0,0.022-0.002,0.039-0.002,0.06c0.016,0.383,0.026,0.774,0.026,1.197v9.735h-10.428v-5.565%20c0-2.781,0-6.954-2.089-9.735c-0.657-0.657-1.322-1.09-2.046-1.398c-1.042-0.675-3.017-0.686-6.295-0.686h-12.52v17.384h-11.818%20v-48.675h26.425c6.254,0,10.428,0,13.906,2.086c3.407,2.046,5.465,5.439,5.543,10.812c-0.161,7.4-4.911,11.46-8.326,12.829%20C270.676,218.662,272.996,219.129,275.076,221.294z%20M298.491,241.609h-11.822v-48.675h11.822V241.609z%20M434.083,241.609h-15.3%20l-22.25-36.855v30.595l-0.073-0.072v6.362h-11.747v-0.029h-11.822l-4.172-10.43H344.38l-4.172,11.123h-13.211%20c-5.559,0-12.517-1.389-16.687-5.561c-4.172-4.172-6.256-9.735-6.256-18.773c0-6.953,1.389-13.911,6.256-19.472%20c3.474-4.175,9.735-5.562,17.382-5.562h11.128v10.429h-11.128c-4.172,0-6.254,0.693-9.041,2.783%20c-2.082,2.085-3.474,6.256-3.474,11.123c0,5.564,0.696,9.04,3.474,11.821c2.091,2.089,4.87,2.785,8.346,2.785h4.867l15.991-38.243%20h6.957h10.428l19.472,46.587v-2.376v-15.705v-1.389v-27.116h17.382l20.161,34.07v-34.07h11.826v47.977h0.002L434.083,241.609%20L434.083,241.609z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M265.161,213.207c0.203-0.217,0.387-0.463,0.543-0.745c0.63-0.997,1.352-2.793,0.963-5.244%20c-0.016-0.225-0.057-0.433-0.105-0.634c-0.013-0.056-0.011-0.105-0.026-0.161l-0.007,0.001c-0.346-1.191-1.229-1.923-2.11-2.367%20c-1.394-0.693-3.48-0.693-5.565-0.693h-13.909v11.127h13.909c2.085,0,4.172,0,5.565-0.697c0.209-0.106,0.395-0.25,0.574-0.413%20l0.002,0.009C264.996,213.389,265.067,213.315,265.161,213.207z'/%3e%3cpath%20style='fill:%23FFFFFF;'%20d='M475.105,311.144c0-4.867-1.389-9.736-3.474-13.212v-31.289h-0.032v-2.089c0,0-29.145,0-33.483,0%20c-4.336,0-9.598,4.171-9.598,4.171v-4.171h-31.984c-4.87,0-11.124,1.392-13.909,4.171v-4.171h-57.016v2.089v2.081%20c-4.169-3.474-11.824-4.171-15.298-4.171h-37.549v2.089v2.081c-3.476-3.474-11.824-4.171-15.998-4.171H215.05l-9.737,10.431%20l-9.04-10.431h-2.911h-4.737h-54.93v2.089v5.493v62.651h61.19l10.054-10.057l8.715,10.057h0.698h35.258h1.598h0.696h0.692v-6.953%20v-9.039h3.479c4.863,0,11.124,0,15.991-2.089v17.382v1.394h31.291v-1.394V317.4h1.387c2.089,0,2.089,0,2.089,2.086v14.6v1.394%20h94.563c6.263,0,12.517-1.394,15.993-4.175v2.781v1.394h29.902c6.254,0,12.517-0.695,16.689-3.478%20c6.402-3.841,10.437-10.64,11.037-18.749c0.028-0.24,0.063-0.48,0.085-0.721l-0.041-0.039%20C475.087,312.043,475.105,311.598,475.105,311.144z%20M256.076,306.973h-13.91v2.081v4.174v4.173v7.649h-22.855l-13.302-15.299%20l-0.046,0.051l-0.65-0.748l-15.297,15.996h-44.501v-48.673h45.197l12.348,13.525l2.596,2.832l0.352-0.365l14.604-15.991h36.852%20c7.152,0,15.161,1.765,18.196,9.042c0.365,1.441,0.577,3.043,0.577,4.863C276.237,304.189,266.502,306.973,256.076,306.973z%20M325.609,306.276c1.389,2.081,2.085,4.867,2.085,9.041v9.732h-11.819v-6.256c0-2.786,0-7.65-2.089-9.739%20c-1.387-2.081-4.172-2.081-8.341-2.081H292.93v18.077h-11.82v-49.369h26.421c5.559,0,10.426,0,13.909,2.084%20c3.474,2.088,6.254,5.565,6.254,11.128c0,7.647-4.865,11.819-8.343,13.212C322.829,303.49,324.914,304.885,325.609,306.276z%20M373.589,286.107h-27.122v9.04h26.424v9.737h-26.424v9.736h27.122v10.429H334.65V275.68h38.939V286.107z%20M402.791,325.05h-22.252%20v-10.429h22.252c2.082,0,3.476,0,4.87-1.392c0.696-0.697,1.387-2.085,1.387-3.477c0-1.394-0.691-2.778-1.387-3.475%20c-0.698-0.695-2.091-1.391-4.176-1.391c-11.126-0.696-24.337,0-24.337-15.296c0-6.954,4.172-14.604,16.689-14.604h22.945v11.819%20h-21.554c-2.085,0-3.478,0-4.87,0.696c-1.387,0.697-1.387,2.089-1.387,3.478c0,2.087,1.387,2.783,2.778,3.473%20c1.394,0.697,2.783,0.697,4.172,0.697h6.259c6.259,0,10.43,1.391,13.211,4.173c2.087,2.087,3.478,5.564,3.478,10.43%20C420.869,320.179,414.611,325.05,402.791,325.05z%20M462.59,320.179c-2.778,2.785-7.648,4.871-14.604,4.871H425.74v-10.429h22.245%20c2.087,0,3.481,0,4.87-1.392c0.693-0.697,1.391-2.085,1.391-3.477c0-1.394-0.698-2.778-1.391-3.475%20c-0.696-0.695-2.085-1.391-4.172-1.391c-11.122-0.696-24.337,0-24.337-15.295c0-6.609,3.781-12.579,13.106-14.352%20c1.115-0.154,2.293-0.253,3.583-0.253h22.948v11.819h-15.3h-5.561h-0.696c-2.087,0-3.476,0-4.865,0.696%20c-0.7,0.697-1.396,2.089-1.396,3.478c0,2.087,0.696,2.783,2.785,3.473c1.389,0.697,2.78,0.697,4.172,0.697h0.691h5.565%20c3.039,0,5.337,0.375,7.44,1.114c1.926,0.697,8.302,3.549,9.728,10.994c0.124,0.78,0.215,1.594,0.215,2.495%20C466.761,313.925,465.37,317.401,462.59,320.179z'/%3e%3c/g%3e%3c/svg%3e", is = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='30px'%20width='30px'%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%2334495E;'%20d='M512,402.282c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.996,0,402.282V109.717%20c0-16.716,13.55-30.266,30.265-30.266h451.469c16.716,0,30.265,13.551,30.265,30.266L512,402.282L512,402.282z'/%3e%3cpath%20style='opacity:0.15;fill:%23202121;enable-background:new%20;'%20d='M21.517,402.282V109.717%20c0-16.716,13.552-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.003,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52%20C35.07,432.549,21.517,418.996,21.517,402.282z'/%3e%3cpath%20style='fill:%23F26E21;'%20d='M309.389,255.801c0.041-9.636-3.572-19.286-10.843-26.558c-7.287-7.287-16.961-10.897-26.617-10.839%20c-0.046,0-0.091-0.003-0.139-0.003c-20.968,0-37.6,16.628-37.6,37.602c0,20.767,16.837,37.599,37.6,37.599%20c20.974,0,37.604-16.631,37.604-37.599C309.394,255.934,309.389,255.869,309.389,255.801z'/%3e%3cg%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M227.198,271.909c-5.62,5.626-10.807,7.824-16.394,7.943c-13.611-0.122-23.618-10.202-23.618-24.573%20c0-7.234,2.739-13.163,7.078-18.228l0,0c4.069-3.863,9.311-6.359,15.339-6.359c6.507,0,11.571,2.169,17.352,7.954v-16.631%20c-5.78-2.891-10.846-4.338-17.352-4.338c-9.192,0.657-17.859,4.371-24.507,10.203l0,0c-1.916,1.724-3.752,3.627-5.309,5.805%20c-4.856,6.294-7.791,14.001-7.791,22.32c0,20.967,16.637,36.875,37.606,36.875c0.102,0,0.203-0.009,0.302-0.01%20c0.141,0.002,0.28,0.01,0.42,0.01c5.784,0,10.85-1.443,17.357-4.336L227.198,271.909c-0.244,0.244,0.242,0.471,0,0.702V271.909z'/%3e%3cpolygon%20style='fill:%23E7E8E3;'%20points='356.863,228.033%20356.863,228.033%20340.487,268.295%20321.685,220.566%20306.502,220.566%20336.148,293.601%20344.102,293.601%20375.196,220.566%20360.013,220.566%20'/%3e%3cpolygon%20style='fill:%23E7E8E3;'%20points='380.983,252.384%20380.983,291.435%20420.033,291.435%20420.753,291.435%20420.753,279.861%20408.461,279.861%20395.445,279.861%20395.445,266.848%20395.445,260.342%20420.033,260.342%20420.033,248.045%20395.445,248.045%20395.445,232.861%20420.753,232.861%20420.753,220.566%20380.983,220.566%20'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M54.135,220.566H33.884v70.869h20.25c10.845,0,18.798-2.895,25.306-7.957%20c7.953-6.508,13.017-16.629,13.017-27.474C92.458,235.028,77.27,220.566,54.135,220.566z%20M70.765,274.08%20c-4.339,3.614-10.124,5.781-18.802,5.781h-4.339V232.86h3.615c8.678,0,14.463,1.446,18.803,5.783%20c5.061,4.336,7.955,10.848,7.955,17.358C78.72,262.509,75.828,269.737,70.765,274.08z'/%3e%3crect%20x='98.97'%20y='220.56'%20style='fill:%23E7E8E3;'%20width='13.739'%20height='70.867'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M147.415,248.045c-8.676-2.892-10.848-5.063-10.848-8.677c0-4.339,4.339-7.954,10.124-7.954%20c4.339,0,7.954,1.447,11.57,5.786l7.233-9.4c-5.787-5.064-13.015-7.953-20.97-7.953c-12.296,0-22.42,8.678-22.42,20.244%20c0,10.126,4.343,14.464,17.357,19.526c5.785,2.166,7.955,2.892,9.404,4.338c2.887,1.444,4.336,4.339,4.336,7.228%20c0,5.786-4.336,10.126-10.848,10.126c-6.514,0-12.294-3.615-15.187-9.401l-8.678,8.678c6.511,9.4,14.465,13.738,24.589,13.738%20c14.461,0,24.58-9.4,24.58-23.141C167.659,258.893,163.324,253.831,147.415,248.045z'/%3e%3cpath%20style='fill:%23E7E8E3;'%20d='M459.804,261.783c10.843-2.166,16.63-9.4,16.63-20.244c0-13.014-9.402-20.973-25.308-20.973h-20.972%20v70.869h13.739V263.23h2.172l19.519,28.205h16.634L459.804,261.783z%20M448.23,253.105h-4.336v-21.691h4.336%20c8.678,0,13.742,3.614,13.742,10.85C461.972,249.492,456.909,253.105,448.23,253.105z'/%3e%3c/g%3e%3c/svg%3e", rs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20291.791%20291.791'%20xml:space='preserve'%3e%3cg%3e%3cpath%20style='fill:%23E2574C;'%20d='M182.298,145.895c0,50.366-40.801,91.176-91.149,91.176S0,196.252,0,145.895%20s40.811-91.176,91.149-91.176S182.298,95.538,182.298,145.895z'/%3e%3cpath%20style='fill:%23F4B459;'%20d='M200.616,54.719c-20.442,0-39.261,6.811-54.469,18.181l0.073,0.009%20c2.991,2.89,6.291,4.924,8.835,8.251l-18.965,0.301c-2.972,3-5.68,6.264-8.233,9.656H161.3c2.544,3.054,4.896,5.708,7.03,9.081%20h-46.536c-1.705,2.936-3.282,5.954-4.659,9.09h56.493c1.477,3.127,2.799,5.489,3.921,8.799h-63.76%20c-1.012,3.146-1.878,6.364-2.535,9.646h68.966c0.675,3.155,1.194,6.072,1.55,9.045h-71.884c-0.301,3-0.456,6.045-0.456,9.118%20h72.859c0,3.228-0.228,6.218-0.556,9.118h-71.847c0.31,3.091,0.766,6.127,1.368,9.118h68.856c-0.711,2.954-1.532,5.926-2.562,9.008%20h-63.969c0.966,3.118,2.143,6.145,3.428,9.099h56.621c-1.568,3.319-3.346,5.972-5.306,9.081h-46.691%20c1.842,3.191,3.875,6.236,6.081,9.154l33.589,0.501c-2.863,3.437-6.537,5.507-9.884,8.516c0.182,0.146-5.352-0.018-16.248-0.191%20c16.576,17.105,39.744,27.772,65.446,27.772c50.357,0,91.176-40.82,91.176-91.176S250.981,54.719,200.616,54.719z'/%3e%3c/g%3e%3c/svg%3e", ns = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%20-140%20780%20780'%20enable-background='new%200%200%20780%20500'%20version='1.1'%20xml:space='preserve'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40%20C0,17.909,17.909,0,40,0z'%20fill='%230E4595'/%3e%3cpath%20d='m293.2%20348.73l33.361-195.76h53.36l-33.385%20195.76h-53.336zm246.11-191.54c-10.57-3.966-27.137-8.222-47.822-8.222-52.725%200-89.865%2026.55-90.18%2064.603-0.299%2028.13%2026.514%2043.822%2046.752%2053.186%2020.771%209.595%2027.752%2015.714%2027.654%2024.283-0.131%2013.121-16.586%2019.116-31.922%2019.116-21.357%200-32.703-2.967-50.227-10.276l-6.876-3.11-7.489%2043.823c12.463%205.464%2035.51%2010.198%2059.438%2010.443%2056.09%200%2092.5-26.246%2092.916-66.882%200.199-22.269-14.016-39.216-44.801-53.188-18.65-9.055-30.072-15.099-29.951-24.268%200-8.137%209.668-16.839%2030.557-16.839%2017.449-0.27%2030.09%203.535%2039.938%207.5l4.781%202.26%207.232-42.429m137.31-4.223h-41.232c-12.773%200-22.332%203.487-27.941%2016.234l-79.244%20179.4h56.031s9.16-24.123%2011.232-29.418c6.125%200%2060.555%200.084%2068.338%200.084%201.596%206.853%206.49%2029.334%206.49%2029.334h49.514l-43.188-195.64zm-65.418%20126.41c4.412-11.279%2021.26-54.723%2021.26-54.723-0.316%200.522%204.379-11.334%207.074-18.684l3.605%2016.879s10.219%2046.729%2012.354%2056.528h-44.293zm-363.3-126.41l-52.24%20133.5-5.567-27.13c-9.725-31.273-40.025-65.155-73.898-82.118l47.766%20171.2%2056.456-0.064%2084.004-195.39h-56.521'%20fill='%23ffffff'/%3e%3cpath%20d='m146.92%20152.96h-86.041l-0.681%204.073c66.938%2016.204%20111.23%2055.363%20129.62%20102.41l-18.71-89.96c-3.23-12.395-12.597-16.094-24.186-16.527'%20fill='%23F2AE14'/%3e%3c/svg%3e", je = [
|
|
3494
|
+
{
|
|
3495
|
+
type: "visa",
|
|
3496
|
+
imgSrc: ns
|
|
3497
|
+
},
|
|
3498
|
+
{
|
|
3499
|
+
type: "mastercard",
|
|
3500
|
+
imgSrc: rs
|
|
3501
|
+
},
|
|
3502
|
+
{
|
|
3503
|
+
type: "amex",
|
|
3504
|
+
imgSrc: ts
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
type: "discover",
|
|
3508
|
+
imgSrc: is
|
|
3509
|
+
}
|
|
3510
|
+
];
|
|
3511
|
+
class ss {
|
|
3512
|
+
input;
|
|
3513
|
+
currentCardBrand = "unknown";
|
|
3514
|
+
options;
|
|
3515
|
+
cardIconsContainer;
|
|
3516
|
+
wrapper;
|
|
3517
|
+
inputContainer = null;
|
|
3518
|
+
constructor(e) {
|
|
3519
|
+
this.options = e, this.wrapper = document.createElement("div"), this.wrapper.style.position = "relative", this.input = new me({
|
|
3520
|
+
name: "cardNumber",
|
|
3521
|
+
label: e.translationFunc?.("cardInformation") ?? "Card number",
|
|
3522
|
+
placeholder: "1234 5678 9012 3456",
|
|
3523
|
+
type: "tel",
|
|
3524
|
+
autocomplete: "cc-number",
|
|
3525
|
+
required: !0,
|
|
3526
|
+
error: !1,
|
|
3527
|
+
styles: {
|
|
3528
|
+
color: e.checkoutProfile.styles.textColor,
|
|
3529
|
+
borderRadius: `${e.checkoutProfile.styles.borderRadius}px ${e.checkoutProfile.styles.borderRadius}px 0px 0px`,
|
|
3530
|
+
fontSize: e.checkoutProfile.styles.fontSize,
|
|
3531
|
+
fontFamily: e.checkoutProfile.styles.fontFamily
|
|
3532
|
+
},
|
|
3533
|
+
onChange: this.handleChange
|
|
3534
|
+
}), this.cardIconsContainer = document.createElement("div"), this.cardIconsContainer.className = "cards-position", this.updateCardIcons("unknown");
|
|
3535
|
+
const t = this.input.getElement(), r = t.querySelector(".form-input");
|
|
3536
|
+
if (r) {
|
|
3537
|
+
this.inputContainer = document.createElement("div"), this.inputContainer.style.position = "relative", this.inputContainer.style.zIndex = "1";
|
|
3538
|
+
const n = r.parentElement;
|
|
3539
|
+
n && (n.insertBefore(this.inputContainer, r), this.inputContainer.appendChild(r), this.inputContainer.appendChild(this.cardIconsContainer));
|
|
3540
|
+
}
|
|
3541
|
+
this.wrapper.appendChild(t), this.input.addEventListener("blur", this.handleBlur), this.input.addEventListener("focus", this.handleFocus);
|
|
3542
|
+
}
|
|
3543
|
+
updateCardIcons(e) {
|
|
3544
|
+
if (this.cardIconsContainer.innerHTML = "", e === "unknown")
|
|
3545
|
+
je.forEach((t) => {
|
|
3546
|
+
this.cardIconsContainer.appendChild(this.createCardIcon(t));
|
|
3547
|
+
});
|
|
3548
|
+
else {
|
|
3549
|
+
const t = je.find((r) => r.type === e);
|
|
3550
|
+
t && this.cardIconsContainer.appendChild(this.createCardIcon(t));
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
createCardIcon(e) {
|
|
3554
|
+
const t = document.createElement("div");
|
|
3555
|
+
t.className = "card-icon";
|
|
3556
|
+
const r = document.createElement("img");
|
|
3557
|
+
return r.src = e.imgSrc, r.alt = e.type, t.appendChild(r), t;
|
|
3558
|
+
}
|
|
3559
|
+
handleChange = (e) => {
|
|
3560
|
+
let n = e.target.value.replace(/\D/g, "");
|
|
3561
|
+
const s = de(n), a = s === "amex" ? 15 : 16;
|
|
3562
|
+
n = n.slice(0, a);
|
|
3563
|
+
const o = Ze.cardNumber(n);
|
|
3564
|
+
this.input.setValue(o), this.currentCardBrand = s, this.updateCardIcons(this.currentCardBrand), this.options.onChange && this.options.onChange(o, this.currentCardBrand);
|
|
3565
|
+
};
|
|
3566
|
+
handleBlur = () => {
|
|
3567
|
+
this.inputContainer && (this.inputContainer.style.zIndex = "1"), this.options.onBlur && this.options.onBlur();
|
|
3568
|
+
};
|
|
3569
|
+
handleFocus = () => {
|
|
3570
|
+
this.inputContainer && (this.inputContainer.style.zIndex = "10"), this.options.onFocus && this.options.onFocus();
|
|
3571
|
+
};
|
|
3572
|
+
getElement() {
|
|
3573
|
+
return this.wrapper;
|
|
3574
|
+
}
|
|
3575
|
+
getValue() {
|
|
3576
|
+
return this.input.getValue();
|
|
3577
|
+
}
|
|
3578
|
+
setValue(e) {
|
|
3579
|
+
this.input.setValue(e), this.currentCardBrand = de(e), this.updateCardIcons(this.currentCardBrand);
|
|
3580
|
+
}
|
|
3581
|
+
setError(e) {
|
|
3582
|
+
this.input.getElement().querySelector(".form-input")?.classList.toggle("form-input-error", e);
|
|
3583
|
+
}
|
|
3584
|
+
isFocused() {
|
|
3585
|
+
const e = this.input.getElement().querySelector("input");
|
|
3586
|
+
return document.activeElement === e;
|
|
3587
|
+
}
|
|
3588
|
+
getCardBrand() {
|
|
3589
|
+
return this.currentCardBrand;
|
|
3590
|
+
}
|
|
3591
|
+
focus() {
|
|
3592
|
+
this.input.focus();
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
class gs extends N {
|
|
3596
|
+
cardNumberElement;
|
|
3597
|
+
cardExpiry;
|
|
3598
|
+
cardCvvElement;
|
|
3599
|
+
currentCardBrand = "unknown";
|
|
3600
|
+
cardNumberHelperText;
|
|
3601
|
+
cardExpiryHelperText;
|
|
3602
|
+
cardCvvHelperText;
|
|
3603
|
+
errorMessagesContainer;
|
|
3604
|
+
constructor(e) {
|
|
3605
|
+
super("div", []);
|
|
3606
|
+
const {
|
|
3607
|
+
checkoutProfile: t,
|
|
3608
|
+
cardNumber: r,
|
|
3609
|
+
cardNumberError: n,
|
|
3610
|
+
cardCvv: s,
|
|
3611
|
+
cardCvvError: a,
|
|
3612
|
+
cardExpiry: o,
|
|
3613
|
+
cardExpiryError: l,
|
|
3614
|
+
onChange: h,
|
|
3615
|
+
onBlur: u,
|
|
3616
|
+
onCardBrandChange: d,
|
|
3617
|
+
translationFunc: p,
|
|
3618
|
+
cardExpiryAutocomplete: f = "cc-exp"
|
|
3619
|
+
} = e, g = document.createElement("div");
|
|
3620
|
+
g.className = "card-grid", this.cardNumberElement = new ss({
|
|
3621
|
+
checkoutProfile: t,
|
|
3622
|
+
translationFunc: p,
|
|
3623
|
+
onChange: (w, x) => {
|
|
3624
|
+
this.currentCardBrand = x, this.cardCvvElement.updateCardBrand(x), this.cardNumberElement.setError(!1), this.cardNumberHelperText.toggleVisibility(!1), d && d(x);
|
|
3625
|
+
const I = new Event("input", { bubbles: !0 });
|
|
3626
|
+
Object.defineProperty(I, "target", {
|
|
3627
|
+
writable: !1,
|
|
3628
|
+
value: { name: "cardNumber", value: w }
|
|
3629
|
+
}), h(I);
|
|
3630
|
+
},
|
|
3631
|
+
onBlur: () => {
|
|
3632
|
+
const w = new Event("blur", { bubbles: !0 });
|
|
3633
|
+
Object.defineProperty(w, "target", {
|
|
3634
|
+
writable: !1,
|
|
3635
|
+
value: {
|
|
3636
|
+
name: "cardNumber",
|
|
3637
|
+
value: this.cardNumberElement.getValue()
|
|
3638
|
+
}
|
|
3639
|
+
}), u(w);
|
|
3640
|
+
}
|
|
3641
|
+
}), r && this.cardNumberElement.setValue(r), g.appendChild(this.cardNumberElement.getElement());
|
|
3642
|
+
const b = document.createElement("div");
|
|
3643
|
+
b.className = "card-details", this.cardExpiry = new me({
|
|
3644
|
+
name: "cardExpiry",
|
|
3645
|
+
type: "tel",
|
|
3646
|
+
placeholder: p("cardExpiry"),
|
|
3647
|
+
error: !1,
|
|
3648
|
+
value: o,
|
|
3649
|
+
autocomplete: f,
|
|
3650
|
+
maxLength: 7,
|
|
3651
|
+
styles: {
|
|
3652
|
+
color: t.styles.textColor,
|
|
3653
|
+
borderRadius: `0px 0px 0px ${t.styles.borderRadius}px`,
|
|
3654
|
+
fontSize: t.styles.fontSize,
|
|
3655
|
+
fontFamily: t.styles.fontFamily
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3658
|
+
const E = this.cardExpiry.getElement().querySelector("input");
|
|
3659
|
+
E.addEventListener("input", (w) => {
|
|
3660
|
+
const x = w.inputType?.startsWith("delete") ?? !1;
|
|
3661
|
+
this.cardExpiry.getElement().querySelector(".form-input")?.classList.remove("form-input-error"), this.cardExpiryHelperText.toggleVisibility(!1);
|
|
3662
|
+
const { value: I, cursor: z } = this._formatExpiry(
|
|
3663
|
+
E.value,
|
|
3664
|
+
x
|
|
3665
|
+
);
|
|
3666
|
+
E.value = I;
|
|
3667
|
+
const _ = new Event("input", { bubbles: !0 });
|
|
3668
|
+
Object.defineProperty(_, "target", {
|
|
3669
|
+
writable: !1,
|
|
3670
|
+
value: { name: "cardExpiry", value: I }
|
|
3671
|
+
}), h(_), E.setSelectionRange(z, z);
|
|
3672
|
+
}), this.cardExpiry.addEventListener("blur", (w) => {
|
|
3673
|
+
u(w);
|
|
3674
|
+
}), this.cardCvvElement = new es({
|
|
3675
|
+
checkoutProfile: t,
|
|
3676
|
+
cardBrand: this.currentCardBrand,
|
|
3677
|
+
onChange: (w) => {
|
|
3678
|
+
this.cardCvvElement.setError(!1), this.cardCvvHelperText.toggleVisibility(!1);
|
|
3679
|
+
const x = new Event("input", { bubbles: !0 });
|
|
3680
|
+
Object.defineProperty(x, "target", {
|
|
3681
|
+
writable: !1,
|
|
3682
|
+
value: { name: "cardCvv", value: w }
|
|
3683
|
+
}), h(x);
|
|
3684
|
+
},
|
|
3685
|
+
onBlur: () => {
|
|
3686
|
+
const w = new Event("blur", { bubbles: !0 });
|
|
3687
|
+
Object.defineProperty(w, "target", {
|
|
3688
|
+
writable: !1,
|
|
3689
|
+
value: { name: "cardCvv", value: this.cardCvvElement.getValue() }
|
|
3690
|
+
}), u(w);
|
|
3691
|
+
}
|
|
3692
|
+
}), s && this.cardCvvElement.setValue(s), b.appendChild(this.cardExpiry.getElement()), b.appendChild(this.cardCvvElement.getElement()), g.appendChild(b), this.getElement().appendChild(g), this.errorMessagesContainer = document.createElement("div"), this.errorMessagesContainer.className = "error-messages-container", this.getElement().appendChild(this.errorMessagesContainer), this.cardNumberHelperText = new M({
|
|
3693
|
+
text: n,
|
|
3694
|
+
visible: !1
|
|
3695
|
+
}), this.cardExpiryHelperText = new M({
|
|
3696
|
+
text: l,
|
|
3697
|
+
visible: !1
|
|
3698
|
+
}), this.cardCvvHelperText = new M({
|
|
3699
|
+
text: a,
|
|
3700
|
+
visible: !1
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
updateCardExpiry(e, t, r) {
|
|
3704
|
+
const n = this.cardExpiry.getElement().querySelector("input"), s = document.activeElement === n;
|
|
3705
|
+
s || this.cardExpiry.setValue(e);
|
|
3706
|
+
const a = !s && !!(r && t);
|
|
3707
|
+
return this.cardExpiry.getElement().querySelector(".form-input")?.classList.toggle("form-input-error", a), a && t ? (this.clearOtherErrors("cardExpiry"), this.cardExpiryHelperText.setText(t), this.cardExpiryHelperText.getElement().parentElement || this.errorMessagesContainer.appendChild(
|
|
3708
|
+
this.cardExpiryHelperText.getElement()
|
|
3709
|
+
), this.cardExpiryHelperText.toggleVisibility(!0)) : this.cardExpiryHelperText.getElement().parentElement && this.cardExpiryHelperText.getElement().remove(), this;
|
|
3710
|
+
}
|
|
3711
|
+
updateCardNumber(e, t, r) {
|
|
3712
|
+
this.cardNumberElement.setValue(e);
|
|
3713
|
+
const s = !this.cardNumberElement.isFocused() && !!(r && t);
|
|
3714
|
+
return this.cardNumberElement.setError(s), s && t ? (this.clearOtherErrors("cardNumber"), this.cardNumberHelperText.setText(t), this.cardNumberHelperText.getElement().parentElement || this.errorMessagesContainer.appendChild(
|
|
3715
|
+
this.cardNumberHelperText.getElement()
|
|
3716
|
+
), this.cardNumberHelperText.toggleVisibility(!0)) : this.cardNumberHelperText.getElement().parentElement && this.cardNumberHelperText.getElement().remove(), this;
|
|
3717
|
+
}
|
|
3718
|
+
updateCardCvv(e, t, r) {
|
|
3719
|
+
this.cardCvvElement.setValue(e);
|
|
3720
|
+
const s = !this.cardCvvElement.isFocused() && !!(r && t);
|
|
3721
|
+
return this.cardCvvElement.setError(s), s && t ? (this.clearOtherErrors("cardCvv"), this.cardCvvHelperText.setText(t), this.cardCvvHelperText.getElement().parentElement || this.errorMessagesContainer.appendChild(
|
|
3722
|
+
this.cardCvvHelperText.getElement()
|
|
3723
|
+
), this.cardCvvHelperText.toggleVisibility(!0)) : this.cardCvvHelperText.getElement().parentElement && this.cardCvvHelperText.getElement().remove(), this;
|
|
3724
|
+
}
|
|
3725
|
+
clearOtherErrors(e) {
|
|
3726
|
+
e !== "cardNumber" && (this.cardNumberElement.setError(!1), this.cardNumberHelperText.toggleVisibility(!1), this.cardNumberHelperText.getElement().parentElement && this.cardNumberHelperText.getElement().remove()), e !== "cardExpiry" && (this.cardExpiry.getElement().querySelector(".form-input")?.classList.remove("form-input-error"), this.cardExpiryHelperText.toggleVisibility(!1), this.cardExpiryHelperText.getElement().parentElement && this.cardExpiryHelperText.getElement().remove()), e !== "cardCvv" && (this.cardCvvElement.setError(!1), this.cardCvvHelperText.toggleVisibility(!1), this.cardCvvHelperText.getElement().parentElement && this.cardCvvHelperText.getElement().remove());
|
|
3727
|
+
}
|
|
3728
|
+
focusField(e) {
|
|
3729
|
+
switch (e) {
|
|
3730
|
+
case "cardNumber":
|
|
3731
|
+
this.cardNumberElement.focus();
|
|
3732
|
+
break;
|
|
3733
|
+
case "cardExpiry":
|
|
3734
|
+
this.cardExpiry.focus();
|
|
3735
|
+
break;
|
|
3736
|
+
case "cardCvv":
|
|
3737
|
+
this.cardCvvElement.focus();
|
|
3738
|
+
break;
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
focus() {
|
|
3742
|
+
this.cardNumberElement.focus();
|
|
3743
|
+
}
|
|
3744
|
+
_formatExpiry(e, t) {
|
|
3745
|
+
const r = e.replace(/\D/g, "").slice(0, 4);
|
|
3746
|
+
if (r.length === 0)
|
|
3747
|
+
return { value: "", cursor: 0 };
|
|
3748
|
+
if (r.length === 1) {
|
|
3749
|
+
const o = parseInt(r, 10);
|
|
3750
|
+
return o >= 2 ? { value: `${`0${o}`} / `, cursor: 5 } : { value: r, cursor: 1 };
|
|
3751
|
+
}
|
|
3752
|
+
let n = r.slice(0, 2);
|
|
3753
|
+
parseInt(n, 10) > 12 && (n = "12");
|
|
3754
|
+
const s = r.slice(2);
|
|
3755
|
+
if (r.length === 2)
|
|
3756
|
+
return t && !e.endsWith(" / ") ? { value: n, cursor: n.length } : { value: `${n} / `, cursor: 5 };
|
|
3757
|
+
const a = `${n} / ${s}`;
|
|
3758
|
+
return { value: a, cursor: a.length };
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
class vs {
|
|
3762
|
+
input;
|
|
3763
|
+
constructor(e) {
|
|
3764
|
+
const {
|
|
3765
|
+
value: t,
|
|
3766
|
+
onChange: r,
|
|
3767
|
+
onBlur: n,
|
|
3768
|
+
onTab: s,
|
|
3769
|
+
errorMsg: a,
|
|
3770
|
+
checkoutProfile: o,
|
|
3771
|
+
translationFunc: l,
|
|
3772
|
+
autocomplete: h = "email"
|
|
3773
|
+
} = e;
|
|
3774
|
+
this.input = new me({
|
|
3775
|
+
name: "email",
|
|
3776
|
+
label: l("email"),
|
|
3777
|
+
// Always hide error initially - we'll show it only on blur if needed
|
|
3778
|
+
error: !1,
|
|
3779
|
+
errorMsg: a,
|
|
3780
|
+
styles: {
|
|
3781
|
+
color: o.styles.textColor,
|
|
3782
|
+
borderRadius: `${o.styles.borderRadius}px`,
|
|
3783
|
+
fontSize: o.styles.fontSize,
|
|
3784
|
+
fontFamily: o.styles.fontFamily
|
|
3785
|
+
},
|
|
3786
|
+
placeholder: l("emailPlaceholder"),
|
|
3787
|
+
type: "email",
|
|
3788
|
+
value: t,
|
|
3789
|
+
autocomplete: h,
|
|
3790
|
+
// Wrap the original onChange to apply trim and hide errors during typing
|
|
3791
|
+
onChange: (u) => {
|
|
3792
|
+
this.input.setError(!1), this.trim(), r(u);
|
|
3793
|
+
}
|
|
3794
|
+
}), this.input.addEventListener("blur", (u) => {
|
|
3795
|
+
n(u);
|
|
3796
|
+
}), s && this.input.addEventListener("keydown", (u) => {
|
|
3797
|
+
const d = u;
|
|
3798
|
+
d.key === "Tab" && !d.shiftKey && (d.preventDefault(), s());
|
|
3799
|
+
});
|
|
3800
|
+
}
|
|
3801
|
+
getValue() {
|
|
3802
|
+
return this.input.getValue();
|
|
3803
|
+
}
|
|
3804
|
+
setValue(e) {
|
|
3805
|
+
return this.input.setValue(e), this;
|
|
3806
|
+
}
|
|
3807
|
+
trim() {
|
|
3808
|
+
const e = this.getValue().trim();
|
|
3809
|
+
return this.setValue(e), this;
|
|
3810
|
+
}
|
|
3811
|
+
setError(e, t) {
|
|
3812
|
+
const r = this.input.getElement().querySelector("input");
|
|
3813
|
+
return document.activeElement !== r && this.input.setError(e, t), this;
|
|
3814
|
+
}
|
|
3815
|
+
getElement() {
|
|
3816
|
+
return this.input.getElement();
|
|
3817
|
+
}
|
|
3818
|
+
appendTo(e) {
|
|
3819
|
+
return this.input.appendTo(e), this;
|
|
3820
|
+
}
|
|
3821
|
+
focus() {
|
|
3822
|
+
this.input.focus();
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
const as = async ({
|
|
3826
|
+
id: i,
|
|
3827
|
+
domainName: e,
|
|
3828
|
+
displayName: t,
|
|
3829
|
+
checkoutKey: r,
|
|
3830
|
+
environment: n
|
|
3831
|
+
}) => {
|
|
3832
|
+
const s = we(n), a = await fetch(
|
|
3833
|
+
`${s}/payments/${i}/create-apple-pay-session`,
|
|
3834
|
+
{
|
|
3835
|
+
method: "POST",
|
|
3836
|
+
headers: {
|
|
3837
|
+
"Content-Type": "application/json",
|
|
3838
|
+
Authorization: `Bearer ${r}`
|
|
3839
|
+
},
|
|
3840
|
+
body: JSON.stringify({
|
|
3841
|
+
domainName: e,
|
|
3842
|
+
displayName: t
|
|
3843
|
+
})
|
|
3844
|
+
}
|
|
3845
|
+
);
|
|
3846
|
+
if (!a.ok)
|
|
3847
|
+
throw new Error(`HTTP error! Status: ${a.status}`);
|
|
3848
|
+
return await a.json();
|
|
3849
|
+
};
|
|
3850
|
+
class ys extends N {
|
|
3851
|
+
formData;
|
|
3852
|
+
onSubmit;
|
|
3853
|
+
isSubmitting = !1;
|
|
3854
|
+
paymentId;
|
|
3855
|
+
checkoutKey;
|
|
3856
|
+
checkoutDetails;
|
|
3857
|
+
environment;
|
|
3858
|
+
displayName;
|
|
3859
|
+
requiredBillingContactFields;
|
|
3860
|
+
requiredShippingContactFields;
|
|
3861
|
+
constructor(e) {
|
|
3862
|
+
super("apple-pay-button", []);
|
|
3863
|
+
const {
|
|
3864
|
+
formData: t,
|
|
3865
|
+
onSubmit: r,
|
|
3866
|
+
paymentId: n,
|
|
3867
|
+
checkoutKey: s,
|
|
3868
|
+
checkoutDetails: a,
|
|
3869
|
+
environment: o,
|
|
3870
|
+
displayName: l,
|
|
3871
|
+
requiredBillingContactFields: h,
|
|
3872
|
+
requiredShippingContactFields: u
|
|
3873
|
+
} = e;
|
|
3874
|
+
this.formData = t, this.onSubmit = r, this.paymentId = n, this.checkoutKey = s, this.checkoutDetails = a, this.environment = o, this.displayName = l || "Payment", this.requiredBillingContactFields = h, this.requiredShippingContactFields = u;
|
|
3875
|
+
const d = this.getElement();
|
|
3876
|
+
d.setAttribute("buttonstyle", "black"), d.setAttribute("type", "plain"), d.setAttribute("locale", "en"), d.style.setProperty("--apple-pay-button-height", "40px"), d.style.setProperty("--apple-pay-button-border-radius", "4px"), d.style.setProperty("--apple-pay-button-padding", "0px 0px"), d.style.setProperty("--apple-pay-button-box-sizing", "border-box"), d.style.cursor = r ? "pointer" : "default", d.style.opacity = "1", this.isApplePayAvailable() || (d.style.display = "none"), r && this.getElement().addEventListener(
|
|
3877
|
+
"click",
|
|
3878
|
+
() => this.handleApplePayClick()
|
|
3879
|
+
);
|
|
3880
|
+
}
|
|
3881
|
+
isApplePayAvailable() {
|
|
3882
|
+
return typeof window < "u" && typeof window.ApplePaySession < "u" && window.ApplePaySession.canMakePayments();
|
|
3883
|
+
}
|
|
3884
|
+
async handleApplePayClick() {
|
|
3885
|
+
if (!(!this.onSubmit || this.isSubmitting)) {
|
|
3886
|
+
this.isSubmitting = !0, this.getElement().style.opacity = "0.7";
|
|
3887
|
+
try {
|
|
3888
|
+
await this.initializeApplePaySession();
|
|
3889
|
+
} catch (e) {
|
|
3890
|
+
throw console.error("Error during Apple Pay initialization:", e), e;
|
|
3891
|
+
} finally {
|
|
3892
|
+
this.isSubmitting = !1, this.getElement().style.opacity = "1";
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
async initializeApplePaySession() {
|
|
3897
|
+
const e = this.checkoutDetails?.countryCode.toUpperCase() || "US", t = this.checkoutDetails?.currency.toUpperCase() || "USD", r = this.checkoutDetails?.amount ? (this.checkoutDetails.amount / 100).toFixed(2) : "0.00", n = {
|
|
3898
|
+
countryCode: e,
|
|
3899
|
+
currencyCode: t,
|
|
3900
|
+
supportedNetworks: ["visa", "masterCard", "amex", "discover"],
|
|
3901
|
+
requiredShippingContactFields: this.requiredShippingContactFields ?? [
|
|
3902
|
+
"email",
|
|
3903
|
+
"name"
|
|
3904
|
+
],
|
|
3905
|
+
merchantCapabilities: ["supports3DS"],
|
|
3906
|
+
total: {
|
|
3907
|
+
label: this.displayName,
|
|
3908
|
+
amount: r
|
|
3909
|
+
}
|
|
3910
|
+
};
|
|
3911
|
+
this.requiredBillingContactFields && (n.requiredBillingContactFields = this.requiredBillingContactFields);
|
|
3912
|
+
const s = new window.ApplePaySession(3, n);
|
|
3913
|
+
s.onvalidatemerchant = async () => {
|
|
3914
|
+
try {
|
|
3915
|
+
const a = await as({
|
|
3916
|
+
id: this.paymentId,
|
|
3917
|
+
domainName: window.location.hostname,
|
|
3918
|
+
displayName: this.displayName,
|
|
3919
|
+
checkoutKey: this.checkoutKey,
|
|
3920
|
+
environment: this.environment
|
|
3921
|
+
}), o = JSON.parse(atob(a.sessionData));
|
|
3922
|
+
s.completeMerchantValidation(o);
|
|
3923
|
+
} catch (a) {
|
|
3924
|
+
console.error("Merchant validation failed:", a), s.abort();
|
|
3925
|
+
}
|
|
3926
|
+
}, s.onpaymentauthorized = async (a) => {
|
|
3927
|
+
try {
|
|
3928
|
+
if (!this.onSubmit) {
|
|
3929
|
+
s.completePayment(window.ApplePaySession.STATUS_FAILURE);
|
|
3930
|
+
return;
|
|
3931
|
+
}
|
|
3932
|
+
const { payment: o } = a, l = btoa(
|
|
3933
|
+
JSON.stringify(o.token.paymentData)
|
|
3934
|
+
), h = o.token.paymentMethod.displayName || "", u = o.shippingContact?.emailAddress || "", d = o.shippingContact?.givenName || "", p = o.shippingContact?.familyName || "", f = `${d} ${p}`.trim(), g = o.shippingContact?.phoneNumber || "", b = (E) => {
|
|
3935
|
+
if (!(!E || !E.addressLines?.[0] && !E.locality && !E.postalCode))
|
|
3936
|
+
return {
|
|
3937
|
+
firstName: E.givenName || "",
|
|
3938
|
+
lastName: E.familyName || "",
|
|
3939
|
+
street: E.addressLines?.join(", ") || "",
|
|
3940
|
+
city: E.locality || "",
|
|
3941
|
+
state: E.administrativeArea || "",
|
|
3942
|
+
zipCode: E.postalCode || "",
|
|
3943
|
+
country: E.countryCode || ""
|
|
3944
|
+
};
|
|
3945
|
+
};
|
|
3946
|
+
await this.onSubmit({
|
|
3947
|
+
formData: this.formData,
|
|
3948
|
+
applePayData: {
|
|
3949
|
+
paymentData: l,
|
|
3950
|
+
displayName: h,
|
|
3951
|
+
email: u,
|
|
3952
|
+
name: f,
|
|
3953
|
+
...g && { phone: g },
|
|
3954
|
+
shippingAddress: b(o.shippingContact),
|
|
3955
|
+
billingAddress: b(o.billingContact)
|
|
3956
|
+
}
|
|
3957
|
+
}), s.completePayment(window.ApplePaySession.STATUS_SUCCESS);
|
|
3958
|
+
} catch (o) {
|
|
3959
|
+
console.error("Payment authorization failed:", o), s.completePayment(window.ApplePaySession.STATUS_FAILURE);
|
|
3960
|
+
}
|
|
3961
|
+
}, s.oncancel = () => {
|
|
3962
|
+
this.isSubmitting = !1, this.getElement().style.opacity = "1";
|
|
3963
|
+
}, s.begin();
|
|
3964
|
+
}
|
|
3965
|
+
updateFormData(e) {
|
|
3966
|
+
return this.formData = e, this;
|
|
3967
|
+
}
|
|
3968
|
+
setSubmitting(e) {
|
|
3969
|
+
return this.isSubmitting = e, this.getElement().style.opacity = e ? "0.7" : "1", this;
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
const os = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='101px'%20height='32'%20viewBox='0%200%20101%2032'%20preserveAspectRatio='xMinYMin%20meet'%3e%3cpath%20fill='%23003087'%20d='M%2012.237%202.8%20L%204.437%202.8%20C%203.937%202.8%203.437%203.2%203.337%203.7%20L%200.237%2023.7%20C%200.137%2024.1%200.437%2024.4%200.837%2024.4%20L%204.537%2024.4%20C%205.037%2024.4%205.537%2024%205.637%2023.5%20L%206.437%2018.1%20C%206.537%2017.6%206.937%2017.2%207.537%2017.2%20L%2010.037%2017.2%20C%2015.137%2017.2%2018.137%2014.7%2018.937%209.8%20C%2019.237%207.7%2018.937%206%2017.937%204.8%20C%2016.837%203.5%2014.837%202.8%2012.237%202.8%20Z%20M%2013.137%2010.1%20C%2012.737%2012.9%2010.537%2012.9%208.537%2012.9%20L%207.337%2012.9%20L%208.137%207.7%20C%208.137%207.4%208.437%207.2%208.737%207.2%20L%209.237%207.2%20C%2010.637%207.2%2011.937%207.2%2012.637%208%20C%2013.137%208.4%2013.337%209.1%2013.137%2010.1%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2035.437%2010%20L%2031.737%2010%20C%2031.437%2010%2031.137%2010.2%2031.137%2010.5%20L%2030.937%2011.5%20L%2030.637%2011.1%20C%2029.837%209.9%2028.037%209.5%2026.237%209.5%20C%2022.137%209.5%2018.637%2012.6%2017.937%2017%20C%2017.537%2019.2%2018.037%2021.3%2019.337%2022.7%20C%2020.437%2024%2022.137%2024.6%2024.037%2024.6%20C%2027.337%2024.6%2029.237%2022.5%2029.237%2022.5%20L%2029.037%2023.5%20C%2028.937%2023.9%2029.237%2024.3%2029.637%2024.3%20L%2033.037%2024.3%20C%2033.537%2024.3%2034.037%2023.9%2034.137%2023.4%20L%2036.137%2010.6%20C%2036.237%2010.4%2035.837%2010%2035.437%2010%20Z%20M%2030.337%2017.2%20C%2029.937%2019.3%2028.337%2020.8%2026.137%2020.8%20C%2025.037%2020.8%2024.237%2020.5%2023.637%2019.8%20C%2023.037%2019.1%2022.837%2018.2%2023.037%2017.2%20C%2023.337%2015.1%2025.137%2013.6%2027.237%2013.6%20C%2028.337%2013.6%2029.137%2014%2029.737%2014.6%20C%2030.237%2015.3%2030.437%2016.2%2030.337%2017.2%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2055.337%2010%20L%2051.637%2010%20C%2051.237%2010%2050.937%2010.2%2050.737%2010.5%20L%2045.537%2018.1%20L%2043.337%2010.8%20C%2043.237%2010.3%2042.737%2010%2042.337%2010%20L%2038.637%2010%20C%2038.237%2010%2037.837%2010.4%2038.037%2010.9%20L%2042.137%2023%20L%2038.237%2028.4%20C%2037.937%2028.8%2038.237%2029.4%2038.737%2029.4%20L%2042.437%2029.4%20C%2042.837%2029.4%2043.137%2029.2%2043.337%2028.9%20L%2055.837%2010.9%20C%2056.137%2010.6%2055.837%2010%2055.337%2010%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2067.737%202.8%20L%2059.937%202.8%20C%2059.437%202.8%2058.937%203.2%2058.837%203.7%20L%2055.737%2023.6%20C%2055.637%2024%2055.937%2024.3%2056.337%2024.3%20L%2060.337%2024.3%20C%2060.737%2024.3%2061.037%2024%2061.037%2023.7%20L%2061.937%2018%20C%2062.037%2017.5%2062.437%2017.1%2063.037%2017.1%20L%2065.537%2017.1%20C%2070.637%2017.1%2073.637%2014.6%2074.437%209.7%20C%2074.737%207.6%2074.437%205.9%2073.437%204.7%20C%2072.237%203.5%2070.337%202.8%2067.737%202.8%20Z%20M%2068.637%2010.1%20C%2068.237%2012.9%2066.037%2012.9%2064.037%2012.9%20L%2062.837%2012.9%20L%2063.637%207.7%20C%2063.637%207.4%2063.937%207.2%2064.237%207.2%20L%2064.737%207.2%20C%2066.137%207.2%2067.437%207.2%2068.137%208%20C%2068.637%208.4%2068.737%209.1%2068.637%2010.1%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2090.937%2010%20L%2087.237%2010%20C%2086.937%2010%2086.637%2010.2%2086.637%2010.5%20L%2086.437%2011.5%20L%2086.137%2011.1%20C%2085.337%209.9%2083.537%209.5%2081.737%209.5%20C%2077.637%209.5%2074.137%2012.6%2073.437%2017%20C%2073.037%2019.2%2073.537%2021.3%2074.837%2022.7%20C%2075.937%2024%2077.637%2024.6%2079.537%2024.6%20C%2082.837%2024.6%2084.737%2022.5%2084.737%2022.5%20L%2084.537%2023.5%20C%2084.437%2023.9%2084.737%2024.3%2085.137%2024.3%20L%2088.537%2024.3%20C%2089.037%2024.3%2089.537%2023.9%2089.637%2023.4%20L%2091.637%2010.6%20C%2091.637%2010.4%2091.337%2010%2090.937%2010%20Z%20M%2085.737%2017.2%20C%2085.337%2019.3%2083.737%2020.8%2081.537%2020.8%20C%2080.437%2020.8%2079.637%2020.5%2079.037%2019.8%20C%2078.437%2019.1%2078.237%2018.2%2078.437%2017.2%20C%2078.737%2015.1%2080.537%2013.6%2082.637%2013.6%20C%2083.737%2013.6%2084.537%2014%2085.137%2014.6%20C%2085.737%2015.3%2085.937%2016.2%2085.737%2017.2%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2095.337%203.3%20L%2092.137%2023.6%20C%2092.037%2024%2092.337%2024.3%2092.737%2024.3%20L%2095.937%2024.3%20C%2096.437%2024.3%2096.937%2023.9%2097.037%2023.4%20L%20100.237%203.5%20C%20100.337%203.1%20100.037%202.8%2099.637%202.8%20L%2096.037%202.8%20C%2095.637%202.8%2095.437%203%2095.337%203.3%20Z'/%3e%3c/svg%3e";
|
|
3973
|
+
class bs extends N {
|
|
3974
|
+
formData;
|
|
3975
|
+
onSubmit;
|
|
3976
|
+
isSubmitting = !1;
|
|
3977
|
+
constructor(e) {
|
|
3978
|
+
super("div", ["paypal"]);
|
|
3979
|
+
const { formData: t, onSubmit: r } = e;
|
|
3980
|
+
this.formData = t, this.onSubmit = r, this.getElement().style.cursor = r ? "pointer" : "default", this.getElement().style.opacity = "1";
|
|
3981
|
+
const n = document.createElement("div");
|
|
3982
|
+
n.className = "paypal-icon-container";
|
|
3983
|
+
const s = document.createElement("img");
|
|
3984
|
+
s.src = os, s.style.width = "69px", s.style.height = "22px", s.style.maxWidth = "100%", s.style.display = "block", s.style.height = "auto", n.appendChild(s), this.getElement().appendChild(n), r && this.getElement().addEventListener("click", () => this.handleSubmit());
|
|
3985
|
+
}
|
|
3986
|
+
async handleSubmit() {
|
|
3987
|
+
if (!(!this.onSubmit || this.isSubmitting)) {
|
|
3988
|
+
this.isSubmitting = !0, this.getElement().style.opacity = "0.7";
|
|
3989
|
+
try {
|
|
3990
|
+
await this.onSubmit({ formData: this.formData });
|
|
3991
|
+
} catch (e) {
|
|
3992
|
+
console.error("Error during PayPal submission:", e);
|
|
3993
|
+
} finally {
|
|
3994
|
+
this.isSubmitting = !1, this.getElement().style.opacity = "1";
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
updateFormData(e) {
|
|
3999
|
+
return this.formData = e, this;
|
|
4000
|
+
}
|
|
4001
|
+
setSubmitting(e) {
|
|
4002
|
+
return this.isSubmitting = e, this.getElement().style.opacity = e ? "0.7" : "1", this;
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
class Es extends N {
|
|
4006
|
+
messageComponent;
|
|
4007
|
+
constructor(e) {
|
|
4008
|
+
super("div", []);
|
|
4009
|
+
const t = W.createDiv(["error-alert"], {
|
|
4010
|
+
role: "alert",
|
|
4011
|
+
"aria-live": "polite"
|
|
4012
|
+
}), r = W.createDiv(["error-alert-content"]), n = W.createDiv([
|
|
4013
|
+
"error-alert-icon-container"
|
|
4014
|
+
]);
|
|
4015
|
+
n.getElement().innerHTML = this.createAlertCircleSVG();
|
|
4016
|
+
const s = W.createDiv([
|
|
4017
|
+
"error-alert-text-container"
|
|
4018
|
+
]), a = new N("h4", [
|
|
4019
|
+
"error-alert-title"
|
|
4020
|
+
]);
|
|
4021
|
+
a.setText("Checkout Error"), this.messageComponent = new N("p", [
|
|
4022
|
+
"error-alert-message"
|
|
4023
|
+
]), this.messageComponent.setText(e.message || "Bad request"), s.appendChild(a), s.appendChild(this.messageComponent), r.appendChild(n), r.appendChild(s), t.appendChild(r), this.appendChild(t);
|
|
4024
|
+
}
|
|
4025
|
+
createAlertCircleSVG() {
|
|
4026
|
+
return `
|
|
4027
|
+
<svg
|
|
4028
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4029
|
+
width="14"
|
|
4030
|
+
height="14"
|
|
4031
|
+
viewBox="0 0 24 24"
|
|
4032
|
+
fill="none"
|
|
4033
|
+
stroke="currentColor"
|
|
4034
|
+
stroke-width="2"
|
|
4035
|
+
stroke-linecap="round"
|
|
4036
|
+
stroke-linejoin="round"
|
|
4037
|
+
>
|
|
4038
|
+
<circle cx="12" cy="12" r="10" />
|
|
4039
|
+
<line x1="12" x2="12" y1="8" y2="12" />
|
|
4040
|
+
<line x1="12" x2="12.01" y1="16" y2="16" />
|
|
4041
|
+
</svg>
|
|
4042
|
+
`;
|
|
4043
|
+
}
|
|
4044
|
+
setMessage(e) {
|
|
4045
|
+
return this.messageComponent.setText(e), this;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
export {
|
|
4049
|
+
ys as A,
|
|
4050
|
+
N as C,
|
|
4051
|
+
vs as E,
|
|
4052
|
+
fs as F,
|
|
4053
|
+
M as H,
|
|
4054
|
+
me as I,
|
|
4055
|
+
Vt as J,
|
|
4056
|
+
bs as P,
|
|
4057
|
+
Q as S,
|
|
4058
|
+
ds as a,
|
|
4059
|
+
ms as b,
|
|
4060
|
+
jt as c,
|
|
4061
|
+
de as d,
|
|
4062
|
+
W as e,
|
|
4063
|
+
Ze as f,
|
|
4064
|
+
ps as g,
|
|
4065
|
+
gs as h,
|
|
4066
|
+
us as i,
|
|
4067
|
+
Es as j,
|
|
4068
|
+
Je as k,
|
|
4069
|
+
cs as l,
|
|
4070
|
+
hs as m,
|
|
4071
|
+
ls as n,
|
|
4072
|
+
Ei as o,
|
|
4073
|
+
Mi as p,
|
|
4074
|
+
Ui as q,
|
|
4075
|
+
lr as r,
|
|
4076
|
+
Nr as s,
|
|
4077
|
+
Yr as t,
|
|
4078
|
+
dn as u,
|
|
4079
|
+
Fn as v,
|
|
4080
|
+
Hn as w,
|
|
4081
|
+
ee as x,
|
|
4082
|
+
Yn as y,
|
|
4083
|
+
Qe as z
|
|
4084
|
+
};
|