@solarpunkltd/swarm-chat-js 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +704 -632
- package/dist/index.js +10 -10
- package/dist/interfaces/message.d.ts +4 -0
- package/dist/interfaces/message.d.ts.map +1 -1
- package/dist/lib/core.d.ts +2 -2
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/swarm-chat-umd.js +10 -10
- package/dist/utils/validation.d.ts +13 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FeedIndex as
|
|
2
|
-
const
|
|
1
|
+
import { FeedIndex as ui, Identifier as Bt, Span as Le, Bytes as Pe, PrivateKey as ke, Reference as li, BeeArgumentError as Pl, Signature as Zl, Topic as De, Stamper as xn, Bee as Bl, EthAddress as Ll } from "@ethersphere/bee-js";
|
|
2
|
+
const P = [];
|
|
3
3
|
for (let a = 0; a < 256; ++a)
|
|
4
|
-
|
|
4
|
+
P.push((a + 256).toString(16).slice(1));
|
|
5
5
|
function zl(a, r = 0) {
|
|
6
|
-
return (
|
|
6
|
+
return (P[a[r + 0]] + P[a[r + 1]] + P[a[r + 2]] + P[a[r + 3]] + "-" + P[a[r + 4]] + P[a[r + 5]] + "-" + P[a[r + 6]] + P[a[r + 7]] + "-" + P[a[r + 8]] + P[a[r + 9]] + "-" + P[a[r + 10]] + P[a[r + 11]] + P[a[r + 12]] + P[a[r + 13]] + P[a[r + 14]] + P[a[r + 15]]).toLowerCase();
|
|
7
7
|
}
|
|
8
8
|
let kn;
|
|
9
9
|
const Fl = new Uint8Array(16);
|
|
@@ -15,10 +15,10 @@ function Vl() {
|
|
|
15
15
|
}
|
|
16
16
|
return kn(Fl);
|
|
17
17
|
}
|
|
18
|
-
const Wl = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
18
|
+
const Wl = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ri = { randomUUID: Wl };
|
|
19
19
|
function Hl(a, r, i) {
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
20
|
+
if (ri.randomUUID && !r && !a)
|
|
21
|
+
return ri.randomUUID();
|
|
22
22
|
a = a || {};
|
|
23
23
|
const c = a.random || (a.rng || Vl)();
|
|
24
24
|
return c[6] = c[6] & 15 | 64, c[8] = c[8] & 63 | 128, zl(c);
|
|
@@ -26,7 +26,7 @@ function Hl(a, r, i) {
|
|
|
26
26
|
function ql(a) {
|
|
27
27
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var di = {};
|
|
30
30
|
(function(a) {
|
|
31
31
|
var r;
|
|
32
32
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.Vector = a.Cache = a.Assertions = a.Strings = a.Types = a.Objects = a.Dates = a.Promises = a.Numbers = a.System = a.Arrays = a.Random = a.Elliptic = a.Binary = a.AsyncQueue = a.PubSubChannel = a.FixedPointNumber = a.MerkleTree = a.Chunk = a.Uint8ArrayWriter = a.Uint8ArrayReader = a.AsyncLazy = a.Lazy = a.Optional = void 0;
|
|
@@ -37,7 +37,7 @@ var li = {};
|
|
|
37
37
|
return i(Promise.all(e.map(i)));
|
|
38
38
|
}
|
|
39
39
|
async function u(e, t = 1) {
|
|
40
|
-
const n =
|
|
40
|
+
const n = Ts(e, t), s = [], o = n.map(async (d) => {
|
|
41
41
|
for (const f of d) s.push(await f());
|
|
42
42
|
});
|
|
43
43
|
return await Promise.all(o), s;
|
|
@@ -60,10 +60,10 @@ var li = {};
|
|
|
60
60
|
if (e.length === 1) return e[0];
|
|
61
61
|
throw Error(`Expected exactly one element, actual: ${e.length}`);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function g(e) {
|
|
64
64
|
return e.length === 1 ? e[0] : null;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function y(e) {
|
|
67
67
|
return e.length > 0 ? e[0] : null;
|
|
68
68
|
}
|
|
69
69
|
function E(e) {
|
|
@@ -98,7 +98,7 @@ var li = {};
|
|
|
98
98
|
return !0;
|
|
99
99
|
}
|
|
100
100
|
function Oe(e, t, n = Math.random) {
|
|
101
|
-
return h(
|
|
101
|
+
return h(Jn(0, e.length - 1), n).slice(0, t);
|
|
102
102
|
}
|
|
103
103
|
function Jt(e, t) {
|
|
104
104
|
return e.map((n) => n[t]);
|
|
@@ -112,7 +112,7 @@ var li = {};
|
|
|
112
112
|
function He(e, t, n = Math.random) {
|
|
113
113
|
return Math.floor(n() * (t - e + 1)) + e;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Nn(e, t, n = Math.random) {
|
|
116
116
|
return n() * (t - e) + e;
|
|
117
117
|
}
|
|
118
118
|
function Ai() {
|
|
@@ -130,9 +130,9 @@ var li = {};
|
|
|
130
130
|
}
|
|
131
131
|
function Mi(e, t = Math.random) {
|
|
132
132
|
const n = Math.floor(e), s = e - n;
|
|
133
|
-
return
|
|
133
|
+
return jn(s, t) ? n + 1 : n;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function jn(e, t = Math.random) {
|
|
136
136
|
return t() < e;
|
|
137
137
|
}
|
|
138
138
|
function Yt(e, t = Math.random) {
|
|
@@ -152,22 +152,22 @@ var li = {};
|
|
|
152
152
|
return o;
|
|
153
153
|
}
|
|
154
154
|
function Ri(e, t, n, s, o, d = Math.random) {
|
|
155
|
-
const f = e.filter((p) => p !== t && p !== n),
|
|
156
|
-
for (t !== null &&
|
|
155
|
+
const f = e.filter((p) => p !== t && p !== n), v = [];
|
|
156
|
+
for (t !== null && v.push(t); f.length && v.length < s; ) {
|
|
157
157
|
const p = a.Random.intBetween(0, f.length - 1, d);
|
|
158
|
-
o(f[p],
|
|
158
|
+
o(f[p], v) && v.push(f[p]), f.splice(p, 1);
|
|
159
159
|
}
|
|
160
|
-
return h(
|
|
160
|
+
return h(v, d), { values: v, indexOfGuaranteed: t !== null ? v.indexOf(t) : -1 };
|
|
161
161
|
}
|
|
162
162
|
function qe(e) {
|
|
163
163
|
if (!e.length) throw Error("Received empty array");
|
|
164
164
|
return e[e.length - 1];
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function Dn(e, t, n) {
|
|
167
167
|
return n(t.reduce((s, o) => o(s), e));
|
|
168
168
|
}
|
|
169
169
|
function Ci(e, t) {
|
|
170
|
-
return (n) =>
|
|
170
|
+
return (n) => Dn(n, e, t);
|
|
171
171
|
}
|
|
172
172
|
function Ni(e, t, n) {
|
|
173
173
|
if (n === void 0 && (n = Math.random()), e.length !== t.length) throw new Error("Array length mismatch");
|
|
@@ -181,7 +181,7 @@ var li = {};
|
|
|
181
181
|
for (let d = 0; d < e.length; d++) o.push([e[d], s[d]]);
|
|
182
182
|
return o.sort((d, f) => f[1] - d[1]).map((d) => d[0]);
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function ye(e, t) {
|
|
185
185
|
if (e == null) return null;
|
|
186
186
|
const n = t.split(".");
|
|
187
187
|
let s = e;
|
|
@@ -191,37 +191,37 @@ var li = {};
|
|
|
191
191
|
}
|
|
192
192
|
return s;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function ve(e, t, n) {
|
|
195
195
|
const s = t.split(/\.|\[/);
|
|
196
196
|
let o = e;
|
|
197
197
|
for (let d = 0; d < s.length; d++) {
|
|
198
|
-
const f = s[d],
|
|
198
|
+
const f = s[d], v = d < s.length - 1 && s[d + 1].includes("]"), p = f.includes("]") ? f.replace(/\[|\]/g, "") : f;
|
|
199
199
|
if (d === s.length - 1) return o[p] = n, n;
|
|
200
|
-
ce(o[p]) || (
|
|
200
|
+
ce(o[p]) || (v ? o[p] = [] : o[p] = {}), o = o[p];
|
|
201
201
|
}
|
|
202
202
|
return n;
|
|
203
203
|
}
|
|
204
204
|
function Di(e, t, n = 1) {
|
|
205
|
-
const s =
|
|
206
|
-
return
|
|
205
|
+
const s = ye(e, t) || 0;
|
|
206
|
+
return ve(e, t, s + n), s;
|
|
207
207
|
}
|
|
208
208
|
function Ui(e, t, n) {
|
|
209
|
-
return
|
|
209
|
+
return ye(e, t) || ve(e, t, n);
|
|
210
210
|
}
|
|
211
211
|
function Pi(e, t) {
|
|
212
|
-
const n = ar(t, "."), s =
|
|
212
|
+
const n = ar(t, "."), s = Yn(t, ".");
|
|
213
213
|
if (!n || !s) return;
|
|
214
|
-
const o =
|
|
214
|
+
const o = ye(e, n);
|
|
215
215
|
delete o[s];
|
|
216
216
|
}
|
|
217
217
|
function Zi(e, t, n) {
|
|
218
|
-
const s =
|
|
218
|
+
const s = ye(e, t);
|
|
219
219
|
if (!s) throw new Error("Key '" + t + "' does not exist.");
|
|
220
|
-
return
|
|
220
|
+
return ve(e, t, n), s;
|
|
221
221
|
}
|
|
222
222
|
function Bi(e, t, n) {
|
|
223
223
|
for (const s of t) {
|
|
224
|
-
const o =
|
|
224
|
+
const o = ye(e, s);
|
|
225
225
|
if (o) return o;
|
|
226
226
|
}
|
|
227
227
|
if (n) {
|
|
@@ -262,7 +262,7 @@ var li = {};
|
|
|
262
262
|
return "#" + e.map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
263
263
|
}
|
|
264
264
|
function qi(e, t, n, s) {
|
|
265
|
-
const o = e * Math.PI / 180, d = n * Math.PI / 180, f = (n - e) * Math.PI / 180,
|
|
265
|
+
const o = e * Math.PI / 180, d = n * Math.PI / 180, f = (n - e) * Math.PI / 180, v = (s - t) * Math.PI / 180, p = Math.sin(f / 2) * Math.sin(f / 2) + Math.cos(o) * Math.cos(d) * Math.sin(v / 2) * Math.sin(v / 2);
|
|
266
266
|
return 6371e3 * (2 * Math.atan2(Math.sqrt(p), Math.sqrt(1 - p)));
|
|
267
267
|
}
|
|
268
268
|
function St(e, t) {
|
|
@@ -285,7 +285,7 @@ var li = {};
|
|
|
285
285
|
function Me(e) {
|
|
286
286
|
return ce(e) && !Array.isArray(e);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function Un(e) {
|
|
289
289
|
return Array.isArray(e) && e.length === 0;
|
|
290
290
|
}
|
|
291
291
|
function Yi(e) {
|
|
@@ -303,7 +303,7 @@ var li = {};
|
|
|
303
303
|
function ue(e) {
|
|
304
304
|
return typeof e == "number" && isFinite(e);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function Pn(e) {
|
|
307
307
|
return e === !0 || e === !1;
|
|
308
308
|
}
|
|
309
309
|
function Ie(e) {
|
|
@@ -315,13 +315,13 @@ var li = {};
|
|
|
315
315
|
function er(e) {
|
|
316
316
|
return ue(e) && Number.isInteger(e) && e >= 1;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Zn(e) {
|
|
319
319
|
return V(e) && e.match(/^-?\d+$/) !== null;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Bn(e) {
|
|
322
322
|
return V(e) && e.match(/^(0x)?[0-9a-f]+$/i) !== null;
|
|
323
323
|
}
|
|
324
|
-
const Qi = "!@#$%^&*()_+-=[]{}|;:<>?,./", Xi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), tr = "abcdefghijklmnopqrstuvwxyz", ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ta = "1234567890", rr = tr + ea + ta,
|
|
324
|
+
const Qi = "!@#$%^&*()_+-=[]{}|;:<>?,./", Xi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), tr = "abcdefghijklmnopqrstuvwxyz", ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ta = "1234567890", rr = tr + ea + ta, Ln = rr + Qi, zn = [
|
|
325
325
|
"—",
|
|
326
326
|
"\\",
|
|
327
327
|
"東",
|
|
@@ -338,7 +338,7 @@ var li = {};
|
|
|
338
338
|
"ᛇ",
|
|
339
339
|
"ᚻ",
|
|
340
340
|
"ᛦ"
|
|
341
|
-
],
|
|
341
|
+
], Fn = "0123456789abcdef";
|
|
342
342
|
function ra(e, t = Math.random) {
|
|
343
343
|
let n = "";
|
|
344
344
|
for (let s = 0; s < e; s++) n += tr[Math.floor(t() * tr.length)];
|
|
@@ -351,12 +351,12 @@ var li = {};
|
|
|
351
351
|
}
|
|
352
352
|
function sa(e, t = Math.random) {
|
|
353
353
|
let n = "";
|
|
354
|
-
for (let s = 0; s < e; s++) n +=
|
|
354
|
+
for (let s = 0; s < e; s++) n += Ln[Math.floor(t() * Ln.length)];
|
|
355
355
|
return n;
|
|
356
356
|
}
|
|
357
357
|
function ia(e, t = Math.random) {
|
|
358
358
|
let n = "";
|
|
359
|
-
for (let s = 0; s < e; s++) n +=
|
|
359
|
+
for (let s = 0; s < e; s++) n += zn[Math.floor(t() * zn.length)];
|
|
360
360
|
return n;
|
|
361
361
|
}
|
|
362
362
|
function aa(e, t) {
|
|
@@ -364,17 +364,17 @@ var li = {};
|
|
|
364
364
|
return s ? s[0] : null;
|
|
365
365
|
}
|
|
366
366
|
function oa(e, t, n = Xi) {
|
|
367
|
-
const s =
|
|
367
|
+
const s = Qn(e, n);
|
|
368
368
|
for (const o of s) if (t(o)) return o;
|
|
369
369
|
return null;
|
|
370
370
|
}
|
|
371
371
|
function ca(e, t = Math.random) {
|
|
372
372
|
let n = "";
|
|
373
|
-
for (let s = 0; s < e; s++) n +=
|
|
373
|
+
for (let s = 0; s < e; s++) n += Fn[Math.floor(t() * Fn.length)];
|
|
374
374
|
return n;
|
|
375
375
|
}
|
|
376
376
|
function ua(e, t) {
|
|
377
|
-
if (!
|
|
377
|
+
if (!Zn(e)) throw new TypeError(`Expected integer string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
378
378
|
const n = BigInt(e);
|
|
379
379
|
if (t && (t.min && n < t.min || t.max && n > t.max))
|
|
380
380
|
throw RangeError(
|
|
@@ -382,7 +382,7 @@ var li = {};
|
|
|
382
382
|
);
|
|
383
383
|
return e;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function Vn(e, t) {
|
|
386
386
|
if (At(e)) throw new TypeError(`Expected string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
387
387
|
if (t && (t.min !== void 0 && e.length < t.min || t.max !== void 0 && e.length > t.max))
|
|
388
388
|
throw RangeError(
|
|
@@ -391,7 +391,7 @@ var li = {};
|
|
|
391
391
|
return e;
|
|
392
392
|
}
|
|
393
393
|
function la(e, t) {
|
|
394
|
-
if (!
|
|
394
|
+
if (!Bn(e)) throw new TypeError(`Expected hex string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
395
395
|
const n = e.replace(/^0x/, "");
|
|
396
396
|
if (t && t.byteLength && n.length !== t.byteLength * 2)
|
|
397
397
|
throw RangeError(
|
|
@@ -400,11 +400,11 @@ var li = {};
|
|
|
400
400
|
return n;
|
|
401
401
|
}
|
|
402
402
|
function da(e, t) {
|
|
403
|
-
if (!
|
|
403
|
+
if (!Vn(e, t).split("").every((n) => n === "_" || Ke(n)))
|
|
404
404
|
throw new TypeError(`Expected safe string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
405
405
|
return e;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Wn(e, t) {
|
|
408
408
|
if (t.min !== void 0 && e < t.min || t.max !== void 0 && e > t.max)
|
|
409
409
|
throw RangeError(
|
|
410
410
|
`Expected value${t != null && t.name ? ` for ${t.name}` : ""} in range: ${t.min ?? "-inf"}..${t.max ?? "inf"}; got: ${e}`
|
|
@@ -415,11 +415,11 @@ var li = {};
|
|
|
415
415
|
return e;
|
|
416
416
|
}
|
|
417
417
|
function Tt(e, t) {
|
|
418
|
-
if (ue(e)) return t &&
|
|
418
|
+
if (ue(e)) return t && Wn(e, t), e;
|
|
419
419
|
if (!V(e) || !e.match(/^-?\d+(\.\d+)?$/))
|
|
420
420
|
throw new TypeError(`Expected number${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
421
421
|
const n = parseFloat(e);
|
|
422
|
-
return t &&
|
|
422
|
+
return t && Wn(n, t), n;
|
|
423
423
|
}
|
|
424
424
|
function nr(e, t) {
|
|
425
425
|
return Tt(e, t) | 0;
|
|
@@ -427,7 +427,7 @@ var li = {};
|
|
|
427
427
|
function ha(e, t) {
|
|
428
428
|
if (e === "true") return !0;
|
|
429
429
|
if (e === "false") return !1;
|
|
430
|
-
if (!
|
|
430
|
+
if (!Pn(e)) throw new TypeError(`Expected boolean${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
431
431
|
return e;
|
|
432
432
|
}
|
|
433
433
|
function ma(e, t) {
|
|
@@ -479,11 +479,11 @@ var li = {};
|
|
|
479
479
|
throw new TypeError(`Expected numeric dictionary${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
480
480
|
return n;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Hn(e) {
|
|
483
483
|
return V(e) && e.match(/^https?:\/\/.+/) !== null;
|
|
484
484
|
}
|
|
485
485
|
function ka(e, t) {
|
|
486
|
-
if (!
|
|
486
|
+
if (!Hn(e)) throw new TypeError(`Expected url${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
487
487
|
return e;
|
|
488
488
|
}
|
|
489
489
|
function Ea(e, t) {
|
|
@@ -495,13 +495,13 @@ var li = {};
|
|
|
495
495
|
function Aa(e, t) {
|
|
496
496
|
return t == null ? void 0 : e(t);
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function qn(e, t) {
|
|
499
499
|
for (const [n, s] of Object.entries(t)) if (!s(e[n])) throw TypeError(`${n} in value does not exist or match shape`);
|
|
500
500
|
for (const n of Object.keys(e)) if (!t[n]) throw TypeError(`${n} exists in value but not in shape`);
|
|
501
501
|
return !0;
|
|
502
502
|
}
|
|
503
503
|
function Ta(e, t) {
|
|
504
|
-
return e.every((n) =>
|
|
504
|
+
return e.every((n) => qn(n, t));
|
|
505
505
|
}
|
|
506
506
|
function Ge(e, t = "json", n = 0) {
|
|
507
507
|
if (ce(e, !1)) {
|
|
@@ -530,27 +530,27 @@ var li = {};
|
|
|
530
530
|
return t && e.stack ? s + `
|
|
531
531
|
` + e.stack : s;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function we(e, t) {
|
|
534
534
|
if (Me(e) && Me(t))
|
|
535
535
|
for (const n in t)
|
|
536
|
-
Me(t[n]) ? (e[n] || (e[n] = {}),
|
|
536
|
+
Me(t[n]) ? (e[n] || (e[n] = {}), we(e[n], t[n])) : Array.isArray(t[n]) ? e[n] = [...t[n]] : (t[n] !== null && t[n] !== void 0 || e[n] === null || e[n] === void 0) && (e[n] = t[n]);
|
|
537
537
|
return e;
|
|
538
538
|
}
|
|
539
539
|
function Ma(e, t) {
|
|
540
540
|
const n = {};
|
|
541
|
-
return
|
|
541
|
+
return we(n, e), we(n, t), n;
|
|
542
542
|
}
|
|
543
543
|
function Ia(e, t, n) {
|
|
544
544
|
const s = {};
|
|
545
|
-
return
|
|
545
|
+
return we(s, e), we(s, t), we(s, n), s;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function Gn(e, t) {
|
|
548
548
|
const n = {};
|
|
549
549
|
for (const s of e) for (const o of Object.keys(s)) n[o] ? n[o] = t(n[o], s[o]) : n[o] = s[o];
|
|
550
550
|
return n;
|
|
551
551
|
}
|
|
552
552
|
function $a(e) {
|
|
553
|
-
return
|
|
553
|
+
return Gn(e, (t, n) => t + n);
|
|
554
554
|
}
|
|
555
555
|
function Ra(e, t, n) {
|
|
556
556
|
e[t] || (e[t] = []), e[t].push(n);
|
|
@@ -624,7 +624,7 @@ var li = {};
|
|
|
624
624
|
function Ja(e, t) {
|
|
625
625
|
return e - (t - 1) / 2;
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function Jn(e, t) {
|
|
628
628
|
const n = [];
|
|
629
629
|
for (let s = e; s <= t; s++) n.push(s);
|
|
630
630
|
return n;
|
|
@@ -648,7 +648,7 @@ var li = {};
|
|
|
648
648
|
return e.split("-").map($t).join(" ");
|
|
649
649
|
}
|
|
650
650
|
function to(e) {
|
|
651
|
-
return
|
|
651
|
+
return es(e.split("-").map($t).join(""));
|
|
652
652
|
}
|
|
653
653
|
function ro(e, t = ", ", n = " and ") {
|
|
654
654
|
return !e || !e.length ? "" : e.length === 1 ? e[0] : e.length === 2 ? `${e[0]}${n}${e[1]}` : `${e.slice(0, e.length - 1).join(t)}${n}${e[e.length - 1]}`;
|
|
@@ -676,7 +676,7 @@ var li = {};
|
|
|
676
676
|
for (const [n, s] of Object.entries(oo)) t = t.replaceAll(n, s);
|
|
677
677
|
return t;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function Kn(e, t) {
|
|
680
680
|
const n = e.indexOf(t);
|
|
681
681
|
return n === -1 ? null : e.slice(0, n);
|
|
682
682
|
}
|
|
@@ -688,7 +688,7 @@ var li = {};
|
|
|
688
688
|
const n = e.lastIndexOf(t);
|
|
689
689
|
return n === -1 ? null : e.slice(0, n);
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Yn(e, t) {
|
|
692
692
|
const n = e.lastIndexOf(t);
|
|
693
693
|
return n === -1 ? null : e.slice(n + t.length);
|
|
694
694
|
}
|
|
@@ -698,13 +698,13 @@ var li = {};
|
|
|
698
698
|
}
|
|
699
699
|
function lo(e, t, n) {
|
|
700
700
|
const s = ir(e, t);
|
|
701
|
-
return s ?
|
|
701
|
+
return s ? Kn(s, n) : null;
|
|
702
702
|
}
|
|
703
703
|
function or(e, t, n = !1) {
|
|
704
704
|
const s = n ? e.lastIndexOf(t) : e.indexOf(t);
|
|
705
705
|
return s === -1 ? n ? [null, e] : [e, null] : [e.slice(0, s), e.slice(s + t.length)];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function Qn(e, t) {
|
|
708
708
|
let n = [e];
|
|
709
709
|
for (const s of t) n = n.flatMap((o) => o.split(s));
|
|
710
710
|
return n.filter((s) => s);
|
|
@@ -735,13 +735,13 @@ var li = {};
|
|
|
735
735
|
function po(e, t = Math.random) {
|
|
736
736
|
return e.replace(/\{(.+?)\}/g, (n, s) => Yt(s.split("|"), t));
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function Xn(e) {
|
|
739
739
|
const t = /\{(.+?)\}/, n = e.match(t);
|
|
740
740
|
if (!n || !n.index) return [e];
|
|
741
741
|
const s = n[1].split(","), o = e.slice(0, n.index), d = e.slice(n.index + n[0].length);
|
|
742
742
|
let f = [];
|
|
743
|
-
for (const
|
|
744
|
-
const p =
|
|
743
|
+
for (const v of s) {
|
|
744
|
+
const p = Xn(o + v + d);
|
|
745
745
|
f = f.concat(p);
|
|
746
746
|
}
|
|
747
747
|
return f;
|
|
@@ -756,21 +756,21 @@ var li = {};
|
|
|
756
756
|
function $t(e) {
|
|
757
757
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
758
758
|
}
|
|
759
|
-
function
|
|
759
|
+
function es(e) {
|
|
760
760
|
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function ts(e) {
|
|
763
763
|
if (!e) return !1;
|
|
764
764
|
const t = e.charCodeAt(0);
|
|
765
765
|
return t >= 65 && t <= 90 || t >= 97 && t <= 122;
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function rs(e) {
|
|
768
768
|
if (!e) return !1;
|
|
769
769
|
const t = e.charCodeAt(0);
|
|
770
770
|
return t >= 48 && t <= 57;
|
|
771
771
|
}
|
|
772
772
|
function Ke(e) {
|
|
773
|
-
return
|
|
773
|
+
return ts(e) || rs(e);
|
|
774
774
|
}
|
|
775
775
|
const go = `
|
|
776
776
|
\r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");
|
|
@@ -783,16 +783,16 @@ var li = {};
|
|
|
783
783
|
function wo(e, t, n, s, o) {
|
|
784
784
|
return e.slice(0, t) + s + e.slice(t, t + n) + o + e.slice(t + n);
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function ns(e, t, n = 0) {
|
|
787
787
|
const s = t.exec(e.slice(n));
|
|
788
788
|
return s ? { index: s.index, match: s[0] } : null;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function ss(e, t, n = !0) {
|
|
791
791
|
if (!n) return t.every((o) => o instanceof RegExp ? o.test(e) : e.indexOf(o, 0) !== -1);
|
|
792
792
|
let s = 0;
|
|
793
793
|
for (const o of t)
|
|
794
794
|
if (o instanceof RegExp) {
|
|
795
|
-
const d =
|
|
795
|
+
const d = ns(e, o, s);
|
|
796
796
|
if (!d) return !1;
|
|
797
797
|
s = d.index + d.match.length;
|
|
798
798
|
} else {
|
|
@@ -806,7 +806,7 @@ var li = {};
|
|
|
806
806
|
let s = 0;
|
|
807
807
|
for (const o of t) {
|
|
808
808
|
let d = !1;
|
|
809
|
-
for (; !d && s < e.length; )
|
|
809
|
+
for (; !d && s < e.length; ) ss(e[s], o, n) && (d = !0), s++;
|
|
810
810
|
if (!d) return !1;
|
|
811
811
|
}
|
|
812
812
|
return !0;
|
|
@@ -830,10 +830,10 @@ var li = {};
|
|
|
830
830
|
for (let n = t; n < e.length; n++) if (e[n] === "#" && Ke(e[n + 1])) return n;
|
|
831
831
|
return -1;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function is(e, t, n = 0) {
|
|
834
834
|
return e.slice(0, n).lastIndexOf(t);
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function as(e, t = 0, n = "{", s = "}") {
|
|
837
837
|
let o = 1;
|
|
838
838
|
for (let d = t; d < e.length; d++)
|
|
839
839
|
if (e.slice(d, d + s.length) === s) {
|
|
@@ -841,7 +841,7 @@ var li = {};
|
|
|
841
841
|
} else e.slice(d, d + n.length) === n && o++;
|
|
842
842
|
return -1;
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function os(e, t) {
|
|
845
845
|
const n = t.wordBoundary ? $e(
|
|
846
846
|
e,
|
|
847
847
|
[
|
|
@@ -852,7 +852,7 @@ var li = {};
|
|
|
852
852
|
t.start || 0
|
|
853
853
|
) : e.indexOf(t.opening, t.start || 0);
|
|
854
854
|
if (n === -1) return null;
|
|
855
|
-
const s =
|
|
855
|
+
const s = as(e, n + t.opening.length, t.opening, t.closing);
|
|
856
856
|
return s === -1 ? null : t.exclusive ? e.slice(n + t.opening.length, s) : e.slice(n, s + t.closing.length);
|
|
857
857
|
}
|
|
858
858
|
function Eo(e, t) {
|
|
@@ -868,7 +868,7 @@ var li = {};
|
|
|
868
868
|
) : e.indexOf(t.opening, t.start || 0);
|
|
869
869
|
for (; ; ) {
|
|
870
870
|
if (s === -1) return n;
|
|
871
|
-
const o =
|
|
871
|
+
const o = os(e, { ...t, start: s });
|
|
872
872
|
if (!o) return n;
|
|
873
873
|
n.push(o), s = t.wordBoundary ? $e(
|
|
874
874
|
e,
|
|
@@ -952,25 +952,25 @@ var li = {};
|
|
|
952
952
|
}
|
|
953
953
|
return t;
|
|
954
954
|
}
|
|
955
|
-
const
|
|
955
|
+
const cs = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", us = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
956
956
|
function Mo(e) {
|
|
957
|
-
return
|
|
957
|
+
return ls(e, cs);
|
|
958
958
|
}
|
|
959
959
|
function Io(e) {
|
|
960
|
-
return
|
|
960
|
+
return ds(e, cs);
|
|
961
961
|
}
|
|
962
962
|
function $o(e) {
|
|
963
|
-
return
|
|
963
|
+
return ls(e, us);
|
|
964
964
|
}
|
|
965
965
|
function Ro(e) {
|
|
966
|
-
return
|
|
966
|
+
return ds(e, us);
|
|
967
967
|
}
|
|
968
|
-
function
|
|
968
|
+
function ls(e, t) {
|
|
969
969
|
const n = "=", s = t.length;
|
|
970
970
|
let o = 0, d = 0;
|
|
971
971
|
const f = [];
|
|
972
|
-
for (let
|
|
973
|
-
const p = e[
|
|
972
|
+
for (let v = 0; v < e.length; v++) {
|
|
973
|
+
const p = e[v];
|
|
974
974
|
if (p === n) break;
|
|
975
975
|
const x = t.indexOf(p);
|
|
976
976
|
if (x === -1) throw new Error(`Invalid character: ${p}`);
|
|
@@ -978,7 +978,7 @@ var li = {};
|
|
|
978
978
|
}
|
|
979
979
|
return new Uint8Array(f);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function ds(e, t) {
|
|
982
982
|
const n = t.length;
|
|
983
983
|
let s = 0, o = 0, d = "";
|
|
984
984
|
for (let f = 0; f < e.length; f++)
|
|
@@ -1017,7 +1017,7 @@ var li = {};
|
|
|
1017
1017
|
const o = a.Arrays.shuffle(
|
|
1018
1018
|
t.map((f) => ({
|
|
1019
1019
|
variants: a.Arrays.shuffle(
|
|
1020
|
-
f.variants.map((
|
|
1020
|
+
f.variants.map((v) => v),
|
|
1021
1021
|
s
|
|
1022
1022
|
),
|
|
1023
1023
|
avoid: f.avoid
|
|
@@ -1025,13 +1025,13 @@ var li = {};
|
|
|
1025
1025
|
s
|
|
1026
1026
|
), d = [];
|
|
1027
1027
|
for (const f of o) {
|
|
1028
|
-
const
|
|
1029
|
-
if (p && (Mt(d, lr(e, p,
|
|
1028
|
+
const v = f.variants.filter((x) => x !== f.avoid), p = v.find((x) => e.includes(x));
|
|
1029
|
+
if (p && (Mt(d, lr(e, p, v)), d.length >= n)) break;
|
|
1030
1030
|
}
|
|
1031
1031
|
if (d.length < n)
|
|
1032
1032
|
for (const f of o) {
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1033
|
+
const v = f.variants.find((p) => e.includes(p));
|
|
1034
|
+
if (v && (Mt(d, lr(e, v, f.variants)), d.length >= n)) break;
|
|
1035
1035
|
}
|
|
1036
1036
|
return d.slice(0, n);
|
|
1037
1037
|
}
|
|
@@ -1046,7 +1046,7 @@ var li = {};
|
|
|
1046
1046
|
function Zo(e) {
|
|
1047
1047
|
return e.replace(/<[^>]*>/g, "");
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function fs(e) {
|
|
1050
1050
|
const t = e.lastIndexOf(" ");
|
|
1051
1051
|
if (t === -1) return { line: e, rest: "" };
|
|
1052
1052
|
const n = e.slice(0, t), s = e.slice(t + 1);
|
|
@@ -1059,10 +1059,10 @@ var li = {};
|
|
|
1059
1059
|
const s = [];
|
|
1060
1060
|
let o = "", d = 0;
|
|
1061
1061
|
for (let f = 0; f < e.length; f++) {
|
|
1062
|
-
const
|
|
1063
|
-
if (o +=
|
|
1064
|
-
const { line: x, rest: I } =
|
|
1065
|
-
s.push(x), o = I, d = I.split("").map((
|
|
1062
|
+
const v = e[f], p = n[v] || 1;
|
|
1063
|
+
if (o += v, d += p, d > t) {
|
|
1064
|
+
const { line: x, rest: I } = fs(o);
|
|
1065
|
+
s.push(x), o = I, d = I.split("").map((U) => n[U] || 1).reduce((U, je) => U + je, 0);
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
return o && s.push(o), s;
|
|
@@ -1099,10 +1099,10 @@ var li = {};
|
|
|
1099
1099
|
return s;
|
|
1100
1100
|
}
|
|
1101
1101
|
function Wo(e, t, n = "$", s = ":") {
|
|
1102
|
-
for (const o in t) e =
|
|
1103
|
-
return e =
|
|
1102
|
+
for (const o in t) e = hs(e, o, t[o], n, s);
|
|
1103
|
+
return e = ms(e), e;
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function hs(e, t, n, s = "$", o = ":") {
|
|
1106
1106
|
if (n === "") return e;
|
|
1107
1107
|
let d = e.indexOf(`${s}${t}`);
|
|
1108
1108
|
for (; d !== -1; ) {
|
|
@@ -1117,7 +1117,7 @@ var li = {};
|
|
|
1117
1117
|
}
|
|
1118
1118
|
return e;
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function ms(e, t = "$", n = ":") {
|
|
1121
1121
|
let s = e.indexOf(t);
|
|
1122
1122
|
for (; s !== -1; ) {
|
|
1123
1123
|
const o = Rt(e, s + 1);
|
|
@@ -1134,16 +1134,16 @@ var li = {};
|
|
|
1134
1134
|
function Ho(e, t) {
|
|
1135
1135
|
let n = e.indexOf("](");
|
|
1136
1136
|
for (; n !== -1; ) {
|
|
1137
|
-
const s =
|
|
1137
|
+
const s = is(e, "[", n), o = e.indexOf(")", n);
|
|
1138
1138
|
if (s !== -1 && o !== -1) {
|
|
1139
|
-
const [d, f] = e.slice(s + 1, o).split("]("),
|
|
1140
|
-
e = e.slice(0, s) +
|
|
1139
|
+
const [d, f] = e.slice(s + 1, o).split("]("), v = t(d, f);
|
|
1140
|
+
e = e.slice(0, s) + v + e.slice(o + 1);
|
|
1141
1141
|
}
|
|
1142
1142
|
n = e.indexOf("](", n + 1);
|
|
1143
1143
|
}
|
|
1144
1144
|
return e;
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function ps(e, t = !0) {
|
|
1147
1147
|
const n = Object.entries(e).filter(([s, o]) => o != null).map(([s, o]) => `${s}=${encodeURIComponent(o)}`).join("&");
|
|
1148
1148
|
return n ? (t ? "?" : "") + n : "";
|
|
1149
1149
|
}
|
|
@@ -1168,7 +1168,7 @@ var li = {};
|
|
|
1168
1168
|
}
|
|
1169
1169
|
function Ko(e, t, n, s) {
|
|
1170
1170
|
const o = e.find((f) => f[t] === n), d = e.find((f) => f[t] === n + s);
|
|
1171
|
-
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((f,
|
|
1171
|
+
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((f, v) => Tt(f[t]) - Tt(v[t])), e.forEach((f, v) => f[t] = v + 1);
|
|
1172
1172
|
}
|
|
1173
1173
|
function Yo(e) {
|
|
1174
1174
|
const t = Object.keys(e);
|
|
@@ -1181,13 +1181,13 @@ var li = {};
|
|
|
1181
1181
|
);
|
|
1182
1182
|
}
|
|
1183
1183
|
function Xo(e, t, n) {
|
|
1184
|
-
return
|
|
1184
|
+
return ws(e, t) + ps(n || {});
|
|
1185
1185
|
}
|
|
1186
1186
|
function ec(e, t = ",", n = '"') {
|
|
1187
1187
|
const s = [];
|
|
1188
1188
|
let o = "", d = !1;
|
|
1189
1189
|
const f = e.split("");
|
|
1190
|
-
for (const
|
|
1190
|
+
for (const v of f) v === t && !d ? (s.push(o), o = "") : v === n && (!o && !d || d) ? d = !d : o += v;
|
|
1191
1191
|
return s.push(o), s;
|
|
1192
1192
|
}
|
|
1193
1193
|
function tc(e) {
|
|
@@ -1246,7 +1246,7 @@ var li = {};
|
|
|
1246
1246
|
const s = Math.floor(e / 1e3);
|
|
1247
1247
|
return t ? `${G(t)}:${G(n)}:${G(s)}` : `${G(n)}:${G(s)}`;
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1249
|
+
function be(e) {
|
|
1250
1250
|
return Math.floor((Ie(e) ? e.getTime() : e) / 864e5);
|
|
1251
1251
|
}
|
|
1252
1252
|
const dc = {
|
|
@@ -1263,12 +1263,12 @@ var li = {};
|
|
|
1263
1263
|
};
|
|
1264
1264
|
function fc(e, t) {
|
|
1265
1265
|
const n = new Date((t == null ? void 0 : t.now) || Date.now()), s = (t == null ? void 0 : t.labels) || dc, o = Ie(e) ? e : new Date(e);
|
|
1266
|
-
if (
|
|
1267
|
-
if (
|
|
1266
|
+
if (be(n) === be(o)) return s.today(o.getUTCHours(), o.getUTCMinutes(), o.getUTCHours() > 12);
|
|
1267
|
+
if (be(n) - be(o) === 1) return s.yesterday();
|
|
1268
1268
|
const d = hr(o);
|
|
1269
|
-
return
|
|
1269
|
+
return be(n) - be(o) < 7 ? s[d.day]() : s.weeks(Math.round((n.getTime() - o.getTime()) / 6048e5));
|
|
1270
1270
|
}
|
|
1271
|
-
const
|
|
1271
|
+
const gs = {
|
|
1272
1272
|
now: () => "A few seconds",
|
|
1273
1273
|
seconds: (e) => `${e} seconds`,
|
|
1274
1274
|
minutes: (e) => `${e} minutes`,
|
|
@@ -1276,13 +1276,13 @@ var li = {};
|
|
|
1276
1276
|
days: (e) => `${e} days`,
|
|
1277
1277
|
weeks: (e) => `${e} weeks`
|
|
1278
1278
|
};
|
|
1279
|
-
function
|
|
1280
|
-
const n = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) ||
|
|
1279
|
+
function ys(e, t) {
|
|
1280
|
+
const n = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) || gs, o = a.Types.isDate(e) ? e.getTime() : e;
|
|
1281
1281
|
let d = (n - o) / 1e3;
|
|
1282
1282
|
return d < 10 ? s.now() : d < 120 ? s.seconds(Math.floor(d)) : (d /= 60, d < 120 ? s.minutes(Math.floor(d)) : (d /= 60, d < 48 ? s.hours(Math.floor(d)) : (d /= 24, d < 14 ? s.days(Math.floor(d)) : (d /= 7, s.weeks(Math.floor(d))))));
|
|
1283
1283
|
}
|
|
1284
|
-
function hc(e, t =
|
|
1285
|
-
return
|
|
1284
|
+
function hc(e, t = gs) {
|
|
1285
|
+
return ys(0, { now: e * 1e3, labels: t });
|
|
1286
1286
|
}
|
|
1287
1287
|
function mc(e, t, n) {
|
|
1288
1288
|
const s = ((n == null ? void 0 : n.now) ?? Date.now()) - e, o = Math.floor(s / t), d = t / ((n == null ? void 0 : n.precision) ?? 1) - Math.ceil(s % t / ((n == null ? void 0 : n.precision) ?? 1));
|
|
@@ -1298,8 +1298,8 @@ var li = {};
|
|
|
1298
1298
|
}
|
|
1299
1299
|
function vc(e, t, n, s) {
|
|
1300
1300
|
s || (s = Date.now());
|
|
1301
|
-
const o = t / n, d = s - e, f = d / t,
|
|
1302
|
-
return { deltaMs: d, progress: o, baseTimeMs: f, totalTimeMs:
|
|
1301
|
+
const o = t / n, d = s - e, f = d / t, v = f * n, p = v - d;
|
|
1302
|
+
return { deltaMs: d, progress: o, baseTimeMs: f, totalTimeMs: v, remainingTimeMs: p };
|
|
1303
1303
|
}
|
|
1304
1304
|
const wc = {
|
|
1305
1305
|
0: "sunday",
|
|
@@ -1310,11 +1310,11 @@ var li = {};
|
|
|
1310
1310
|
5: "friday",
|
|
1311
1311
|
6: "saturday"
|
|
1312
1312
|
};
|
|
1313
|
-
function
|
|
1313
|
+
function vs(e) {
|
|
1314
1314
|
return { zeroBasedIndex: e, day: wc[e] };
|
|
1315
1315
|
}
|
|
1316
1316
|
function hr(e) {
|
|
1317
|
-
return
|
|
1317
|
+
return vs(e.getDay());
|
|
1318
1318
|
}
|
|
1319
1319
|
function bc(e) {
|
|
1320
1320
|
return hr(new Date(e));
|
|
@@ -1404,7 +1404,7 @@ var li = {};
|
|
|
1404
1404
|
function $c(e) {
|
|
1405
1405
|
delete mr[e];
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1407
|
+
function ws(...e) {
|
|
1408
1408
|
return e.filter((t) => t).join("/").replace(new RegExp("(?<!:)\\/+", "g"), "/");
|
|
1409
1409
|
}
|
|
1410
1410
|
function Rc(e, t, n, s, o = !0) {
|
|
@@ -1431,23 +1431,23 @@ var li = {};
|
|
|
1431
1431
|
for (; e = e.replace(/(\w+)[\s,']+\w+/g, "$1"), e.length !== t; ) t = e.length;
|
|
1432
1432
|
return e = e.replaceAll(/[A-Z][a-zA-Z0-9]*/g, "A"), e = e.replaceAll(/[a-z][a-zA-Z0-9]*/g, "a"), e = e.replaceAll(/[\u4E00-\u9FA5]+/g, "Z"), e;
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function bs(e) {
|
|
1435
1435
|
const t = Object.keys(e).sort((s, o) => s.localeCompare(o)), n = {};
|
|
1436
|
-
for (const s of t) n[s] =
|
|
1436
|
+
for (const s of t) n[s] = _e(e[s]);
|
|
1437
1437
|
return n;
|
|
1438
1438
|
}
|
|
1439
|
-
function
|
|
1439
|
+
function _s(e) {
|
|
1440
1440
|
const t = [];
|
|
1441
|
-
return e.sort((n, s) => JSON.stringify(
|
|
1441
|
+
return e.sort((n, s) => JSON.stringify(_e(n)).localeCompare(JSON.stringify(_e(s)))).forEach((n) => t.push(_e(n))), t;
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1444
|
-
return Array.isArray(e) ?
|
|
1443
|
+
function _e(e) {
|
|
1444
|
+
return Array.isArray(e) ? _s(e) : ce(e) ? bs(e) : e;
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return JSON.stringify(
|
|
1446
|
+
function xs(e, t) {
|
|
1447
|
+
return JSON.stringify(_e(e)) === JSON.stringify(_e(t));
|
|
1448
1448
|
}
|
|
1449
1449
|
function Dc(...e) {
|
|
1450
|
-
for (let t = 1; t < e.length; t++) if (!
|
|
1450
|
+
for (let t = 1; t < e.length; t++) if (!xs(e[t - 1], e[t])) return !1;
|
|
1451
1451
|
return !0;
|
|
1452
1452
|
}
|
|
1453
1453
|
function Uc(e) {
|
|
@@ -1477,7 +1477,7 @@ var li = {};
|
|
|
1477
1477
|
for (const f of Object.keys(t)) d[f] = [];
|
|
1478
1478
|
d[s] = [], o && (e = e.sort(o));
|
|
1479
1479
|
for (const f of e) {
|
|
1480
|
-
const
|
|
1480
|
+
const v = f[n], p = t[v] ? v : s;
|
|
1481
1481
|
d[p].length >= t[p] ? d[s].push(f) : d[p].push(f);
|
|
1482
1482
|
}
|
|
1483
1483
|
return d;
|
|
@@ -1486,12 +1486,12 @@ var li = {};
|
|
|
1486
1486
|
const n = Object.keys(e), s = Object.keys(t);
|
|
1487
1487
|
return { uniqueToA: n.filter((o) => !s.includes(o)), uniqueToB: s.filter((o) => !n.includes(o)) };
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function ks(e) {
|
|
1490
1490
|
const t = Object.keys(e);
|
|
1491
1491
|
return t[Math.floor(Math.random() * t.length)];
|
|
1492
1492
|
}
|
|
1493
1493
|
function Fc(e, t) {
|
|
1494
|
-
const n =
|
|
1494
|
+
const n = ks(e);
|
|
1495
1495
|
return e[n] = t(e[n]), n;
|
|
1496
1496
|
}
|
|
1497
1497
|
function Vc(e) {
|
|
@@ -1518,7 +1518,7 @@ var li = {};
|
|
|
1518
1518
|
"eth",
|
|
1519
1519
|
"dai",
|
|
1520
1520
|
"decillion"
|
|
1521
|
-
],
|
|
1521
|
+
], Es = ["K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "O", "N", "gwei", "bzz", "eth", "btc", "dai", "D"];
|
|
1522
1522
|
function Hc(e, t, n) {
|
|
1523
1523
|
let s = e.length - t;
|
|
1524
1524
|
if (s <= 0) return "0." + "0".repeat(-s) + e + (n ? " " + n : "");
|
|
@@ -1526,7 +1526,7 @@ var li = {};
|
|
|
1526
1526
|
return o === "" && (o = "0"), o + "." + d + (n ? " " + n : "");
|
|
1527
1527
|
}
|
|
1528
1528
|
function qc(e, t) {
|
|
1529
|
-
const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc :
|
|
1529
|
+
const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc : Es, d = (t == null ? void 0 : t.precision) ?? 1;
|
|
1530
1530
|
if (e < le[0]) return `${e}${s}`;
|
|
1531
1531
|
for (let f = 0; f < le.length - 1; f++)
|
|
1532
1532
|
if (e < le[f + 1]) return `${(e / le[f]).toFixed(d)}${n ? " " : ""}${o[f]}${s}`;
|
|
@@ -1535,7 +1535,7 @@ var li = {};
|
|
|
1535
1535
|
function pr(e) {
|
|
1536
1536
|
const t = parseFloat(e);
|
|
1537
1537
|
if (isNaN(t)) throw Error("makeNumber got NaN for input");
|
|
1538
|
-
const n = e.replace(/^-?[0-9.]+/, "").trim(), s =
|
|
1538
|
+
const n = e.replace(/^-?[0-9.]+/, "").trim(), s = Es.findIndex((o) => o.toLowerCase() === n.toLowerCase());
|
|
1539
1539
|
return s === -1 ? t : t * le[s];
|
|
1540
1540
|
}
|
|
1541
1541
|
function gr(e, t, n) {
|
|
@@ -1564,7 +1564,7 @@ var li = {};
|
|
|
1564
1564
|
}
|
|
1565
1565
|
function eu(e) {
|
|
1566
1566
|
for (const t of Object.keys(e))
|
|
1567
|
-
(
|
|
1567
|
+
(Un(e[t]) || Array.isArray(e[t]) && e[t].every((n) => n == null)) && delete e[t];
|
|
1568
1568
|
return e;
|
|
1569
1569
|
}
|
|
1570
1570
|
function tu(e) {
|
|
@@ -1604,8 +1604,8 @@ var li = {};
|
|
|
1604
1604
|
n != null && (e[t] = n);
|
|
1605
1605
|
}
|
|
1606
1606
|
function cu(e, t, n, s) {
|
|
1607
|
-
const o =
|
|
1608
|
-
o != null &&
|
|
1607
|
+
const o = ye(n, s);
|
|
1608
|
+
o != null && ve(e, t, o);
|
|
1609
1609
|
}
|
|
1610
1610
|
function uu(e) {
|
|
1611
1611
|
const t = {};
|
|
@@ -1613,16 +1613,16 @@ var li = {};
|
|
|
1613
1613
|
return t;
|
|
1614
1614
|
}
|
|
1615
1615
|
function lu(e) {
|
|
1616
|
-
const t = Object.keys(e), n = t.map((
|
|
1616
|
+
const t = Object.keys(e), n = t.map((v) => e[v].length), s = n.reduce((v, p) => v *= p);
|
|
1617
1617
|
let o = 1;
|
|
1618
1618
|
const d = [1];
|
|
1619
|
-
for (let
|
|
1619
|
+
for (let v = 0; v < n.length - 1; v++) o *= n[v], d.push(o);
|
|
1620
1620
|
const f = [];
|
|
1621
|
-
for (let
|
|
1621
|
+
for (let v = 0; v < s; v++) {
|
|
1622
1622
|
const p = {};
|
|
1623
1623
|
for (let x = 0; x < t.length; x++) {
|
|
1624
|
-
const I = e[t[x]],
|
|
1625
|
-
p[t[x]] = I[
|
|
1624
|
+
const I = e[t[x]], U = Math.floor(v / d[x]) % I.length;
|
|
1625
|
+
p[t[x]] = I[U];
|
|
1626
1626
|
}
|
|
1627
1627
|
f.push(p);
|
|
1628
1628
|
}
|
|
@@ -1637,29 +1637,29 @@ var li = {};
|
|
|
1637
1637
|
function Nt(e, t, n, s, o) {
|
|
1638
1638
|
if (!ce(t)) return t;
|
|
1639
1639
|
for (const [d, f] of Object.entries(t)) {
|
|
1640
|
-
const
|
|
1641
|
-
Array.isArray(f) ? o ? Nt(e, f,
|
|
1640
|
+
const v = fu(n, d, s);
|
|
1641
|
+
Array.isArray(f) ? o ? Nt(e, f, v, !0, o) : e[v] = f.map((p) => Nt(Array.isArray(p) ? [] : {}, p, "", !1, o)) : ce(f) ? Nt(e, f, v, !1, o) : e[v] = f;
|
|
1642
1642
|
}
|
|
1643
1643
|
return e;
|
|
1644
1644
|
}
|
|
1645
1645
|
function hu(e, t = !1, n) {
|
|
1646
1646
|
return Nt({}, e, n || "", !1, t);
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function Ss(e) {
|
|
1649
1649
|
if (!ce(e)) return e;
|
|
1650
1650
|
const t = Array.isArray(e) ? [] : {};
|
|
1651
1651
|
for (const [n, s] of Object.entries(e))
|
|
1652
|
-
Array.isArray(s) ?
|
|
1652
|
+
Array.isArray(s) ? ve(
|
|
1653
1653
|
t,
|
|
1654
1654
|
n,
|
|
1655
|
-
s.map((o) =>
|
|
1656
|
-
) :
|
|
1655
|
+
s.map((o) => Ss(o))
|
|
1656
|
+
) : ve(t, n, s);
|
|
1657
1657
|
return t;
|
|
1658
1658
|
}
|
|
1659
1659
|
function mu(e, t, n) {
|
|
1660
1660
|
return t[e] ? t[e] : n;
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1662
|
+
function As(e, t) {
|
|
1663
1663
|
const n = {};
|
|
1664
1664
|
for (const s of e) {
|
|
1665
1665
|
const o = t(s);
|
|
@@ -1680,30 +1680,30 @@ var li = {};
|
|
|
1680
1680
|
for (let s = 0; s < e.length; s += t) n.push(e.slice(s, s + t));
|
|
1681
1681
|
return n;
|
|
1682
1682
|
}
|
|
1683
|
-
function
|
|
1683
|
+
function Ts(e, t) {
|
|
1684
1684
|
const n = Math.ceil(e.length / t), s = [];
|
|
1685
1685
|
for (let o = 0; o < e.length; o += n) s.push(e.slice(o, o + n));
|
|
1686
1686
|
return s;
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1688
|
+
function Os(e, t) {
|
|
1689
1689
|
const n = [], s = Math.ceil(e.length / t);
|
|
1690
1690
|
for (let o = 0; o < s; o++) n.push(e.slice(o * t, o * t + t));
|
|
1691
1691
|
return n;
|
|
1692
1692
|
}
|
|
1693
1693
|
function yu(e, t) {
|
|
1694
1694
|
const n = Math.ceil(e.length / t);
|
|
1695
|
-
return
|
|
1695
|
+
return Os(e, n);
|
|
1696
1696
|
}
|
|
1697
1697
|
function vu(e, t) {
|
|
1698
|
-
return Object.values(
|
|
1698
|
+
return Object.values(As(e, t));
|
|
1699
1699
|
}
|
|
1700
1700
|
function wu(e, t, n, s, o) {
|
|
1701
1701
|
const d = t ? e.map(t) : e, f = {};
|
|
1702
1702
|
for (const p of d) f[p] = (f[p] || 0) + 1;
|
|
1703
|
-
const
|
|
1704
|
-
return n ? Object.keys(
|
|
1703
|
+
const v = s ? Ms(f, o ? (p, x) => p[1] - x[1] : (p, x) => x[1] - p[1]) : f;
|
|
1704
|
+
return n ? Object.keys(v) : v;
|
|
1705
1705
|
}
|
|
1706
|
-
function
|
|
1706
|
+
function Ms(e, t) {
|
|
1707
1707
|
return Object.fromEntries(Object.entries(e).sort(t));
|
|
1708
1708
|
}
|
|
1709
1709
|
function bu(e) {
|
|
@@ -1734,7 +1734,7 @@ var li = {};
|
|
|
1734
1734
|
function Eu() {
|
|
1735
1735
|
return { map: /* @__PURE__ */ new Map(), keys: [] };
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1737
|
+
function Is(e, t, n, s = 100) {
|
|
1738
1738
|
if (e.map.has(t)) {
|
|
1739
1739
|
const o = e.keys.indexOf(t);
|
|
1740
1740
|
e.keys.splice(o, 1);
|
|
@@ -1755,7 +1755,7 @@ var li = {};
|
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
1757
|
function Au(e, t, n, s, o = 100) {
|
|
1758
|
-
|
|
1758
|
+
Is(e, t, { validUntil: Date.now() + s, data: n }, o);
|
|
1759
1759
|
}
|
|
1760
1760
|
function Tu(e, t) {
|
|
1761
1761
|
const n = e.map.get(t);
|
|
@@ -1855,19 +1855,19 @@ var li = {};
|
|
|
1855
1855
|
if (!x) return;
|
|
1856
1856
|
const I = p[n];
|
|
1857
1857
|
if (I) {
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1858
|
+
const U = d.get(I);
|
|
1859
|
+
U && U.children.push(x);
|
|
1860
1860
|
} else f.push(x);
|
|
1861
1861
|
});
|
|
1862
|
-
const
|
|
1862
|
+
const v = (p) => {
|
|
1863
1863
|
p.children.sort((x, I) => {
|
|
1864
|
-
const
|
|
1865
|
-
return o ? je -
|
|
1866
|
-
}), p.children.forEach(
|
|
1864
|
+
const U = x.value[s], je = I.value[s];
|
|
1865
|
+
return o ? je - U : U - je;
|
|
1866
|
+
}), p.children.forEach(v);
|
|
1867
1867
|
};
|
|
1868
|
-
return f.forEach(
|
|
1868
|
+
return f.forEach(v), f;
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function $s(e, t) {
|
|
1871
1871
|
if (Math.log2(e.length) % 1 !== 0) throw new Error("Array length must be a power of 2");
|
|
1872
1872
|
let n = [...e];
|
|
1873
1873
|
for (; n.length > 1; ) {
|
|
@@ -1887,17 +1887,17 @@ var li = {};
|
|
|
1887
1887
|
n.set(o, s), s += o.length;
|
|
1888
1888
|
}), n;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Rs(e) {
|
|
1891
1891
|
return e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71;
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function Cs(e) {
|
|
1894
1894
|
return e[0] === 255 && e[1] === 216;
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1896
|
+
function Ns(e) {
|
|
1897
1897
|
return e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80;
|
|
1898
1898
|
}
|
|
1899
1899
|
function Pu(e) {
|
|
1900
|
-
return
|
|
1900
|
+
return Rs(e) || Cs(e) || Ns(e);
|
|
1901
1901
|
}
|
|
1902
1902
|
function Zu(e) {
|
|
1903
1903
|
return new Uint8Array([e]);
|
|
@@ -1956,7 +1956,7 @@ var li = {};
|
|
|
1956
1956
|
for (let s = 0; s < e.length; s += t) n.push(e.subarray(s, s + t));
|
|
1957
1957
|
return n;
|
|
1958
1958
|
}
|
|
1959
|
-
const
|
|
1959
|
+
const js = [
|
|
1960
1960
|
0,
|
|
1961
1961
|
1,
|
|
1962
1962
|
0,
|
|
@@ -2008,21 +2008,21 @@ var li = {};
|
|
|
2008
2008
|
];
|
|
2009
2009
|
function qu(e) {
|
|
2010
2010
|
for (let t = 0; t < 24; t++) {
|
|
2011
|
-
const n = e[0] ^ e[10] ^ e[20] ^ e[30] ^ e[40], s = e[1] ^ e[11] ^ e[21] ^ e[31] ^ e[41], o = e[2] ^ e[12] ^ e[22] ^ e[32] ^ e[42], d = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43], f = e[4] ^ e[14] ^ e[24] ^ e[34] ^ e[44],
|
|
2011
|
+
const n = e[0] ^ e[10] ^ e[20] ^ e[30] ^ e[40], s = e[1] ^ e[11] ^ e[21] ^ e[31] ^ e[41], o = e[2] ^ e[12] ^ e[22] ^ e[32] ^ e[42], d = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43], f = e[4] ^ e[14] ^ e[24] ^ e[34] ^ e[44], v = e[5] ^ e[15] ^ e[25] ^ e[35] ^ e[45], p = e[6] ^ e[16] ^ e[26] ^ e[36] ^ e[46], x = e[7] ^ e[17] ^ e[27] ^ e[37] ^ e[47], I = e[8] ^ e[18] ^ e[28] ^ e[38] ^ e[48], U = e[9] ^ e[19] ^ e[29] ^ e[39] ^ e[49], je = o << 1 | d >>> 31, Ml = d << 1 | o >>> 31, Xe = I ^ je, et = U ^ Ml, Il = f << 1 | v >>> 31, $l = v << 1 | f >>> 31, tt = n ^ Il, rt = s ^ $l, Rl = p << 1 | x >>> 31, Cl = x << 1 | p >>> 31, nt = o ^ Rl, st = d ^ Cl, Nl = I << 1 | U >>> 31, jl = U << 1 | I >>> 31, it = f ^ Nl, at = v ^ jl, Dl = n << 1 | s >>> 31, Ul = s << 1 | n >>> 31, ot = p ^ Dl, ct = x ^ Ul;
|
|
2012
2012
|
e[0] ^= Xe, e[1] ^= et, e[2] ^= tt, e[3] ^= rt, e[4] ^= nt, e[5] ^= st, e[6] ^= it, e[7] ^= at, e[8] ^= ot, e[9] ^= ct, e[10] ^= Xe, e[11] ^= et, e[12] ^= tt, e[13] ^= rt, e[14] ^= nt, e[15] ^= st, e[16] ^= it, e[17] ^= at, e[18] ^= ot, e[19] ^= ct, e[20] ^= Xe, e[21] ^= et, e[22] ^= tt, e[23] ^= rt, e[24] ^= nt, e[25] ^= st, e[26] ^= it, e[27] ^= at, e[28] ^= ot, e[29] ^= ct, e[30] ^= Xe, e[31] ^= et, e[32] ^= tt, e[33] ^= rt, e[34] ^= nt, e[35] ^= st, e[36] ^= it, e[37] ^= at, e[38] ^= ot, e[39] ^= ct, e[40] ^= Xe, e[41] ^= et, e[42] ^= tt, e[43] ^= rt, e[44] ^= nt, e[45] ^= st, e[46] ^= it, e[47] ^= at, e[48] ^= ot, e[49] ^= ct;
|
|
2013
2013
|
const Sr = e[0], Ar = e[1], Tr = e[2] << 1 | e[3] >>> 31, Or = e[3] << 1 | e[2] >>> 31, Mr = e[5] << 30 | e[4] >>> 2, Ir = e[4] << 30 | e[5] >>> 2, $r = e[6] << 28 | e[7] >>> 4, Rr = e[7] << 28 | e[6] >>> 4, Cr = e[8] << 27 | e[9] >>> 5, Nr = e[9] << 27 | e[8] >>> 5, jr = e[11] << 4 | e[10] >>> 28, Dr = e[10] << 4 | e[11] >>> 28, Ur = e[13] << 12 | e[12] >>> 20, Pr = e[12] << 12 | e[13] >>> 20, Zr = e[14] << 6 | e[15] >>> 26, Br = e[15] << 6 | e[14] >>> 26, Lr = e[17] << 23 | e[16] >>> 9, zr = e[16] << 23 | e[17] >>> 9, Fr = e[18] << 20 | e[19] >>> 12, Vr = e[19] << 20 | e[18] >>> 12, Wr = e[20] << 3 | e[21] >>> 29, Hr = e[21] << 3 | e[20] >>> 29, qr = e[22] << 10 | e[23] >>> 22, Gr = e[23] << 10 | e[22] >>> 22, Jr = e[25] << 11 | e[24] >>> 21, Kr = e[24] << 11 | e[25] >>> 21, Yr = e[26] << 25 | e[27] >>> 7, Qr = e[27] << 25 | e[26] >>> 7, Xr = e[29] << 7 | e[28] >>> 25, en = e[28] << 7 | e[29] >>> 25, tn = e[31] << 9 | e[30] >>> 23, rn = e[30] << 9 | e[31] >>> 23, nn = e[33] << 13 | e[32] >>> 19, sn = e[32] << 13 | e[33] >>> 19, an = e[34] << 15 | e[35] >>> 17, on = e[35] << 15 | e[34] >>> 17, cn = e[36] << 21 | e[37] >>> 11, un = e[37] << 21 | e[36] >>> 11, ln = e[38] << 8 | e[39] >>> 24, dn = e[39] << 8 | e[38] >>> 24, fn = e[40] << 18 | e[41] >>> 14, hn = e[41] << 18 | e[40] >>> 14, mn = e[42] << 2 | e[43] >>> 30, pn = e[43] << 2 | e[42] >>> 30, gn = e[45] << 29 | e[44] >>> 3, yn = e[44] << 29 | e[45] >>> 3, vn = e[47] << 24 | e[46] >>> 8, wn = e[46] << 24 | e[47] >>> 8, bn = e[48] << 14 | e[49] >>> 18, _n = e[49] << 14 | e[48] >>> 18;
|
|
2014
|
-
e[0] = Sr ^ ~Ur & Jr, e[1] = Ar ^ ~Pr & Kr, e[2] = Ur ^ ~Jr & cn, e[3] = Pr ^ ~Kr & un, e[4] = Jr ^ ~cn & bn, e[5] = Kr ^ ~un & _n, e[6] = cn ^ ~bn & Sr, e[7] = un ^ ~_n & Ar, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Ar & Pr, e[10] = $r ^ ~Fr & Wr, e[11] = Rr ^ ~Vr & Hr, e[12] = Fr ^ ~Wr & nn, e[13] = Vr ^ ~Hr & sn, e[14] = Wr ^ ~nn & gn, e[15] = Hr ^ ~sn & yn, e[16] = nn ^ ~gn & $r, e[17] = sn ^ ~yn & Rr, e[18] = gn ^ ~$r & Fr, e[19] = yn ^ ~Rr & Vr, e[20] = Tr ^ ~Zr & Yr, e[21] = Or ^ ~Br & Qr, e[22] = Zr ^ ~Yr & ln, e[23] = Br ^ ~Qr & dn, e[24] = Yr ^ ~ln & fn, e[25] = Qr ^ ~dn & hn, e[26] = ln ^ ~fn & Tr, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Tr & Zr, e[29] = hn ^ ~Or & Br, e[30] = Cr ^ ~jr & qr, e[31] = Nr ^ ~Dr & Gr, e[32] = jr ^ ~qr & an, e[33] = Dr ^ ~Gr & on, e[34] = qr ^ ~an & vn, e[35] = Gr ^ ~on & wn, e[36] = an ^ ~vn & Cr, e[37] = on ^ ~wn & Nr, e[38] = vn ^ ~Cr & jr, e[39] = wn ^ ~Nr & Dr, e[40] = Mr ^ ~Lr & Xr, e[41] = Ir ^ ~zr & en, e[42] = Lr ^ ~Xr & tn, e[43] = zr ^ ~en & rn, e[44] = Xr ^ ~tn & mn, e[45] = en ^ ~rn & pn, e[46] = tn ^ ~mn & Mr, e[47] = rn ^ ~pn & Ir, e[48] = mn ^ ~Mr & Lr, e[49] = pn ^ ~Ir & zr, e[0] ^=
|
|
2014
|
+
e[0] = Sr ^ ~Ur & Jr, e[1] = Ar ^ ~Pr & Kr, e[2] = Ur ^ ~Jr & cn, e[3] = Pr ^ ~Kr & un, e[4] = Jr ^ ~cn & bn, e[5] = Kr ^ ~un & _n, e[6] = cn ^ ~bn & Sr, e[7] = un ^ ~_n & Ar, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Ar & Pr, e[10] = $r ^ ~Fr & Wr, e[11] = Rr ^ ~Vr & Hr, e[12] = Fr ^ ~Wr & nn, e[13] = Vr ^ ~Hr & sn, e[14] = Wr ^ ~nn & gn, e[15] = Hr ^ ~sn & yn, e[16] = nn ^ ~gn & $r, e[17] = sn ^ ~yn & Rr, e[18] = gn ^ ~$r & Fr, e[19] = yn ^ ~Rr & Vr, e[20] = Tr ^ ~Zr & Yr, e[21] = Or ^ ~Br & Qr, e[22] = Zr ^ ~Yr & ln, e[23] = Br ^ ~Qr & dn, e[24] = Yr ^ ~ln & fn, e[25] = Qr ^ ~dn & hn, e[26] = ln ^ ~fn & Tr, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Tr & Zr, e[29] = hn ^ ~Or & Br, e[30] = Cr ^ ~jr & qr, e[31] = Nr ^ ~Dr & Gr, e[32] = jr ^ ~qr & an, e[33] = Dr ^ ~Gr & on, e[34] = qr ^ ~an & vn, e[35] = Gr ^ ~on & wn, e[36] = an ^ ~vn & Cr, e[37] = on ^ ~wn & Nr, e[38] = vn ^ ~Cr & jr, e[39] = wn ^ ~Nr & Dr, e[40] = Mr ^ ~Lr & Xr, e[41] = Ir ^ ~zr & en, e[42] = Lr ^ ~Xr & tn, e[43] = zr ^ ~en & rn, e[44] = Xr ^ ~tn & mn, e[45] = en ^ ~rn & pn, e[46] = tn ^ ~mn & Mr, e[47] = rn ^ ~pn & Ir, e[48] = mn ^ ~Mr & Lr, e[49] = pn ^ ~Ir & zr, e[0] ^= js[t * 2], e[1] ^= js[t * 2 + 1];
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
function
|
|
2017
|
+
function Ds(e) {
|
|
2018
2018
|
const t = [];
|
|
2019
2019
|
for (let n = 0; n < e.length; n += 4) t.push(e[n] | e[n + 1] << 8 | e[n + 2] << 16 | e[n + 3] << 24);
|
|
2020
2020
|
return t;
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function Us(e, t) {
|
|
2023
2023
|
if (!e.length) {
|
|
2024
2024
|
const o = new Uint8Array(136);
|
|
2025
|
-
return o[0] = t, o[135] = 128, [
|
|
2025
|
+
return o[0] = t, o[135] = 128, [Ds(o)];
|
|
2026
2026
|
}
|
|
2027
2027
|
const n = wr(e, 136), s = n[n.length - 1];
|
|
2028
2028
|
if (s.length < 136) {
|
|
@@ -2033,16 +2033,16 @@ var li = {};
|
|
|
2033
2033
|
const o = new Uint8Array(136);
|
|
2034
2034
|
o[0] = t, o[135] = 128, n.push(o);
|
|
2035
2035
|
}
|
|
2036
|
-
return n.map(
|
|
2036
|
+
return n.map(Ds);
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function Ps(e, t) {
|
|
2039
2039
|
for (const n of t) {
|
|
2040
2040
|
for (let s = 0; s < 34; s += 2) e[s] ^= n[s + 1], e[s + 1] ^= n[s];
|
|
2041
2041
|
qu(e);
|
|
2042
2042
|
}
|
|
2043
2043
|
return e;
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2045
|
+
function Zs(e) {
|
|
2046
2046
|
return new Uint8Array([
|
|
2047
2047
|
e[1],
|
|
2048
2048
|
e[1] >> -24,
|
|
@@ -2079,10 +2079,10 @@ var li = {};
|
|
|
2079
2079
|
]);
|
|
2080
2080
|
}
|
|
2081
2081
|
function ne(e) {
|
|
2082
|
-
return Ps(
|
|
2082
|
+
return Zs(Ps(new Array(50).fill(0), Us(e, 1)));
|
|
2083
2083
|
}
|
|
2084
2084
|
function Gu(e) {
|
|
2085
|
-
return Ps(
|
|
2085
|
+
return Zs(Ps(new Array(50).fill(0), Us(e, 6)));
|
|
2086
2086
|
}
|
|
2087
2087
|
function Ju(e, t, n) {
|
|
2088
2088
|
const s = Math.min(e.length, t.length, n / 8 + 1);
|
|
@@ -2110,23 +2110,23 @@ var li = {};
|
|
|
2110
2110
|
for (let o = 0; o < t.length && e[s + o] === t[o]; o++) if (o === t.length - 1) return s;
|
|
2111
2111
|
return -1;
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function Bs(e, t, n = 0) {
|
|
2114
2114
|
if (e.length >= t) return e;
|
|
2115
2115
|
const s = new Uint8Array(t);
|
|
2116
2116
|
return s.fill(n), s.set(e, t - e.length), s;
|
|
2117
2117
|
}
|
|
2118
2118
|
function el(e, t, n = 0) {
|
|
2119
2119
|
const s = e.length % t;
|
|
2120
|
-
return s === 0 ? e :
|
|
2120
|
+
return s === 0 ? e : Bs(e, e.length + t - s, n);
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function Ls(e, t, n = 0) {
|
|
2123
2123
|
if (e.length >= t) return e;
|
|
2124
2124
|
const s = new Uint8Array(t);
|
|
2125
2125
|
return s.fill(n), s.set(e, 0), s;
|
|
2126
2126
|
}
|
|
2127
2127
|
function tl(e, t, n = 0) {
|
|
2128
2128
|
const s = e.length % t;
|
|
2129
|
-
return s === 0 ? e :
|
|
2129
|
+
return s === 0 ? e : Ls(e, e.length + t - s, n);
|
|
2130
2130
|
}
|
|
2131
2131
|
function rl(e, t) {
|
|
2132
2132
|
const n = new Uint8Array(e.length);
|
|
@@ -2156,10 +2156,10 @@ var li = {};
|
|
|
2156
2156
|
for (e = $(e, n); t > 0; ) t % 2n === 1n && (s = $(s * e, n)), e = $(e * e, n), t = t / 2n;
|
|
2157
2157
|
return s;
|
|
2158
2158
|
}
|
|
2159
|
-
function
|
|
2159
|
+
function zs(e, t) {
|
|
2160
2160
|
return $(e, t) === 0n ? 0n : t % 4n === 3n ? sl(e, (t + 1n) / 4n, t) : null;
|
|
2161
2161
|
}
|
|
2162
|
-
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,
|
|
2162
|
+
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, D = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n, jt = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n, Dt = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;
|
|
2163
2163
|
function br(e, t, n) {
|
|
2164
2164
|
if (t === 0n) return [0n, 0n];
|
|
2165
2165
|
const s = $(3n * e * e * Ye(2n * t, n), n), o = $(s * s - 2n * e, n), d = $(s * (e - o) - t, n);
|
|
@@ -2170,12 +2170,12 @@ var li = {};
|
|
|
2170
2170
|
if (n === 0n && s === 0n) return [e, t];
|
|
2171
2171
|
if (e === n && t === $(-s, o)) return [0n, 0n];
|
|
2172
2172
|
if (e === n && t === s) return br(e, t, o);
|
|
2173
|
-
const d = $((s - t) * Ye(n - e, o), o), f = $(d * d - e - n, o),
|
|
2174
|
-
return [f,
|
|
2173
|
+
const d = $((s - t) * Ye(n - e, o), o), f = $(d * d - e - n, o), v = $(d * (e - f) - t, o);
|
|
2174
|
+
return [f, v];
|
|
2175
2175
|
}
|
|
2176
2176
|
function il(e) {
|
|
2177
|
-
if (e <= 0n || e >=
|
|
2178
|
-
return
|
|
2177
|
+
if (e <= 0n || e >= D) throw new Error("Invalid private key");
|
|
2178
|
+
return xe(jt, Dt, e, Z);
|
|
2179
2179
|
}
|
|
2180
2180
|
function al(e) {
|
|
2181
2181
|
const t = e[1] % 2n === 0n ? 2 : 3;
|
|
@@ -2183,7 +2183,7 @@ var li = {};
|
|
|
2183
2183
|
}
|
|
2184
2184
|
function ol(e) {
|
|
2185
2185
|
if (e.length !== 33 || e[0] !== 2 && e[0] !== 3) throw new Error("Invalid compressed public key");
|
|
2186
|
-
const t = Ne(e.slice(1), "BE"), n =
|
|
2186
|
+
const t = Ne(e.slice(1), "BE"), n = zs($(t ** 3n + 7n, Z), Z);
|
|
2187
2187
|
if (!n) throw Error("Invalid x: does not correspond to a valid curve point");
|
|
2188
2188
|
const s = $(-n, Z), o = n % 2n === 0n;
|
|
2189
2189
|
return [t, e[0] === 2 ? o ? n : s : o ? s : n];
|
|
@@ -2198,43 +2198,43 @@ var li = {};
|
|
|
2198
2198
|
for (let o = 0; o < t.length; o++) parseInt(n[o], 16) > 7 ? s += t[o].toUpperCase() : s += t[o];
|
|
2199
2199
|
return s;
|
|
2200
2200
|
}
|
|
2201
|
-
function
|
|
2201
|
+
function xe(e, t, n, s) {
|
|
2202
2202
|
let o = [0n, 0n], d = [e, t];
|
|
2203
2203
|
const f = n.toString(2);
|
|
2204
|
-
for (const
|
|
2205
|
-
|
|
2204
|
+
for (const v of f)
|
|
2205
|
+
v === "0" ? (d = Ut(o[0], o[1], d[0], d[1], s), o = br(o[0], o[1], s)) : (o = Ut(o[0], o[1], d[0], d[1], s), d = br(d[0], d[1], s));
|
|
2206
2206
|
return o;
|
|
2207
2207
|
}
|
|
2208
2208
|
function ll(e, t, n) {
|
|
2209
|
-
return
|
|
2209
|
+
return Fs(Ne(ne(e), "BE"), t, n);
|
|
2210
2210
|
}
|
|
2211
|
-
function
|
|
2212
|
-
if (t <= 0n || t >=
|
|
2211
|
+
function Fs(e, t, n) {
|
|
2212
|
+
if (t <= 0n || t >= D) throw new Error("Invalid private key");
|
|
2213
2213
|
if (n || (n = $(
|
|
2214
2214
|
Ne(
|
|
2215
2215
|
ne(Re(ne(Ce(t, "BE")), Ce(e, "BE"))),
|
|
2216
2216
|
"BE"
|
|
2217
2217
|
),
|
|
2218
|
-
|
|
2219
|
-
)), n <= 0n || n >=
|
|
2218
|
+
D
|
|
2219
|
+
)), n <= 0n || n >= D)
|
|
2220
2220
|
throw new Error("Invalid nonce");
|
|
2221
|
-
const s = $(e,
|
|
2222
|
-
let f = $((s + $(d,
|
|
2221
|
+
const s = $(e, D), o = xe(jt, Dt, n, Z), d = $(o[0], D);
|
|
2222
|
+
let f = $((s + $(d, D) * t) * Ye(n, D), D);
|
|
2223
2223
|
if (d === 0n || f === 0n) throw new Error("Invalid r or s value");
|
|
2224
|
-
let
|
|
2225
|
-
return f >
|
|
2224
|
+
let v = o[1] % 2n === 0n ? 27n : 28n;
|
|
2225
|
+
return f > D / 2n && (f = D - f, v = v === 27n ? 28n : 27n), [d, f, v];
|
|
2226
2226
|
}
|
|
2227
2227
|
function dl(e, t, n, s) {
|
|
2228
|
-
const o =
|
|
2228
|
+
const o = zs($(t ** 3n + 7n, Z), Z);
|
|
2229
2229
|
if (!o) throw new Error("Invalid r: does not correspond to a valid curve point");
|
|
2230
|
-
const d = s === 27n ? 0n : 1n, f = o % 2n === d ? o : Z - o,
|
|
2231
|
-
return
|
|
2230
|
+
const d = s === 27n ? 0n : 1n, f = o % 2n === d ? o : Z - o, v = $(Ne(ne(e), "BE"), D), p = xe(t, f, n, Z), x = xe(jt, Dt, v, Z), I = Ut(p[0], p[1], x[0], $(-x[1], Z), Z);
|
|
2231
|
+
return xe(I[0], I[1], Ye(t, D), Z);
|
|
2232
2232
|
}
|
|
2233
2233
|
function fl(e, t, n, s) {
|
|
2234
|
-
const o = $(Ne(ne(e), "BE"),
|
|
2235
|
-
return n === $(I[0],
|
|
2234
|
+
const o = $(Ne(ne(e), "BE"), D), d = Ye(s, D), f = $(o * d, D), v = $(n * d, D), p = xe(jt, Dt, f, Z), x = xe(t[0], t[1], v, Z), I = Ut(p[0], p[1], x[0], x[1], Z);
|
|
2235
|
+
return n === $(I[0], D);
|
|
2236
2236
|
}
|
|
2237
|
-
class
|
|
2237
|
+
class Vs {
|
|
2238
2238
|
constructor(t) {
|
|
2239
2239
|
this.cursor = 0, this.buffer = t;
|
|
2240
2240
|
}
|
|
@@ -2246,8 +2246,8 @@ var li = {};
|
|
|
2246
2246
|
return this.buffer.length - this.cursor;
|
|
2247
2247
|
}
|
|
2248
2248
|
}
|
|
2249
|
-
a.Uint8ArrayReader =
|
|
2250
|
-
class
|
|
2249
|
+
a.Uint8ArrayReader = Vs;
|
|
2250
|
+
class Ws {
|
|
2251
2251
|
constructor(t) {
|
|
2252
2252
|
this.buffer = t, this.cursor = 0;
|
|
2253
2253
|
}
|
|
@@ -2259,16 +2259,16 @@ var li = {};
|
|
|
2259
2259
|
return this.buffer.length - this.cursor;
|
|
2260
2260
|
}
|
|
2261
2261
|
}
|
|
2262
|
-
a.Uint8ArrayWriter =
|
|
2262
|
+
a.Uint8ArrayWriter = Ws;
|
|
2263
2263
|
class Pt {
|
|
2264
2264
|
constructor(t, n = 0n) {
|
|
2265
|
-
this.span = n, this.writer = new
|
|
2265
|
+
this.span = n, this.writer = new Ws(new Uint8Array(t));
|
|
2266
2266
|
}
|
|
2267
2267
|
build() {
|
|
2268
2268
|
return Re(vr(this.span, "LE"), this.writer.buffer);
|
|
2269
2269
|
}
|
|
2270
2270
|
hash() {
|
|
2271
|
-
const t =
|
|
2271
|
+
const t = $s(wr(this.writer.buffer, 32), (n, s) => ne(Re(n, s)));
|
|
2272
2272
|
return ne(Re(vr(this.span, "LE"), t));
|
|
2273
2273
|
}
|
|
2274
2274
|
}
|
|
@@ -2282,7 +2282,7 @@ var li = {};
|
|
|
2282
2282
|
return await s.append(t), s.finalize();
|
|
2283
2283
|
}
|
|
2284
2284
|
async append(t, n = 0, s = 0n) {
|
|
2285
|
-
const o = new
|
|
2285
|
+
const o = new Vs(t);
|
|
2286
2286
|
for (; o.max() > 0; ) {
|
|
2287
2287
|
this.chunks[n].writer.max() === 0 && await this.elevate(n);
|
|
2288
2288
|
const d = this.chunks[n].writer.write(o);
|
|
@@ -2355,7 +2355,7 @@ var li = {};
|
|
|
2355
2355
|
return t.ttlMax ? --t.ttl <= 0 && e.shift() : t.ttlMax = t.ttl, { progress: (t.ttlMax - t.ttl) / t.ttlMax, data: t.data };
|
|
2356
2356
|
}
|
|
2357
2357
|
function Zt(e, t, n, s) {
|
|
2358
|
-
const o = e.findIndex((
|
|
2358
|
+
const o = e.findIndex((v) => v === `--${t}` || v.startsWith(`--${t}=`)), d = e[o];
|
|
2359
2359
|
if (!d) return (n || {})[s || t || ""] || null;
|
|
2360
2360
|
if (d.includes("=")) return d.split("=")[1];
|
|
2361
2361
|
const f = e[o + 1];
|
|
@@ -2374,33 +2374,33 @@ var li = {};
|
|
|
2374
2374
|
const o = e.some((p) => p.endsWith("-" + t)), d = Zt(e, t, n, s);
|
|
2375
2375
|
if (!d && o) return !0;
|
|
2376
2376
|
if (!d && !o) return null;
|
|
2377
|
-
const f = ["true", "1", "yes", "y", "on"],
|
|
2377
|
+
const f = ["true", "1", "yes", "y", "on"], v = ["false", "0", "no", "n", "off"];
|
|
2378
2378
|
if (f.includes(d.toLowerCase())) return !0;
|
|
2379
|
-
if (
|
|
2379
|
+
if (v.includes(d.toLowerCase())) return !1;
|
|
2380
2380
|
throw Error(`Invalid boolean argument ${t}: ${d}`);
|
|
2381
2381
|
}
|
|
2382
|
-
function
|
|
2382
|
+
function Hs(e, t, n, s) {
|
|
2383
2383
|
const o = Zt(e, t, n, s);
|
|
2384
2384
|
if (!o) throw new Error(`Missing argument ${t}`);
|
|
2385
2385
|
return o;
|
|
2386
2386
|
}
|
|
2387
2387
|
function gl(e, t, n, s) {
|
|
2388
|
-
const o =
|
|
2388
|
+
const o = Hs(e, t, n, s);
|
|
2389
2389
|
try {
|
|
2390
2390
|
return pr(o);
|
|
2391
2391
|
} catch {
|
|
2392
2392
|
throw new Error(`Invalid argument ${t}: ${o}`);
|
|
2393
2393
|
}
|
|
2394
2394
|
}
|
|
2395
|
-
function
|
|
2395
|
+
function qs(e, t) {
|
|
2396
2396
|
const n = e[t];
|
|
2397
2397
|
e.splice(t, 1), e.unshift(n);
|
|
2398
2398
|
}
|
|
2399
2399
|
function yl(e, t) {
|
|
2400
2400
|
const n = [...e];
|
|
2401
|
-
return
|
|
2401
|
+
return qs(n, t), n;
|
|
2402
2402
|
}
|
|
2403
|
-
function
|
|
2403
|
+
function Gs(e, t) {
|
|
2404
2404
|
return { x: e.x + t.x, y: e.y + t.y };
|
|
2405
2405
|
}
|
|
2406
2406
|
function vl(e, t) {
|
|
@@ -2413,10 +2413,10 @@ var li = {};
|
|
|
2413
2413
|
const t = Math.sqrt(e.x * e.x + e.y * e.y);
|
|
2414
2414
|
return { x: e.x / t, y: e.y / t };
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function Js(e, t, n) {
|
|
2417
2417
|
return { x: e.x + Math.cos(t) * n, y: e.y + Math.sin(t) * n };
|
|
2418
2418
|
}
|
|
2419
|
-
function
|
|
2419
|
+
function Ks(e, t) {
|
|
2420
2420
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
2421
2421
|
}
|
|
2422
2422
|
function Qe(e, t, n = "row-first") {
|
|
@@ -2434,24 +2434,24 @@ var li = {};
|
|
|
2434
2434
|
var s, o;
|
|
2435
2435
|
return e[t][n + 1] && e[t][n - 1] && !((s = e[t - 1]) != null && s[n]) && !((o = e[t + 1]) != null && o[n]);
|
|
2436
2436
|
}
|
|
2437
|
-
function
|
|
2437
|
+
function Ys(e, t, n) {
|
|
2438
2438
|
var s;
|
|
2439
2439
|
return !((s = e[t - 1]) != null && s[n]);
|
|
2440
2440
|
}
|
|
2441
|
-
function
|
|
2441
|
+
function Qs(e, t, n) {
|
|
2442
2442
|
var s;
|
|
2443
2443
|
return !((s = e[t + 1]) != null && s[n]);
|
|
2444
2444
|
}
|
|
2445
|
-
function
|
|
2445
|
+
function Xs(e, t, n) {
|
|
2446
2446
|
return !e[t][n - 1];
|
|
2447
2447
|
}
|
|
2448
|
-
function
|
|
2448
|
+
function ei(e, t, n) {
|
|
2449
2449
|
return !e[t][n + 1];
|
|
2450
2450
|
}
|
|
2451
2451
|
function xl(e, t, n) {
|
|
2452
|
-
var o, d, f,
|
|
2452
|
+
var o, d, f, v, p, x, I, U;
|
|
2453
2453
|
const s = [];
|
|
2454
|
-
return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) &&
|
|
2454
|
+
return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) && Ys(e, t, n) && Xs(e, t, n) && s.push({ x: t, y: n }), !((d = e[t + 1]) != null && d[n - 1]) && Qs(e, t, n) && Xs(e, t, n) && s.push({ x: t + 1, y: n }), !((f = e[t - 1]) != null && f[n + 1]) && Ys(e, t, n) && ei(e, t, n) && s.push({ x: t, y: n + 1 }), !((v = e[t + 1]) != null && v[n + 1]) && Qs(e, t, n) && ei(e, t, n) && s.push({ x: t + 1, y: n + 1 }), s) : ((p = e[t - 1]) != null && p[n] && e[t][n - 1] && s.push({ x: t, y: n }), (x = e[t + 1]) != null && x[n] && e[t][n - 1] && s.push({ x: t + 1, y: n }), (I = e[t - 1]) != null && I[n] && e[t][n + 1] && s.push({ x: t, y: n + 1 }), (U = e[t + 1]) != null && U[n] && e[t][n + 1] && s.push({ x: t + 1, y: n + 1 }), s);
|
|
2455
2455
|
}
|
|
2456
2456
|
function kl(e, t, n, s) {
|
|
2457
2457
|
const o = [
|
|
@@ -2462,8 +2462,8 @@ var li = {};
|
|
|
2462
2462
|
];
|
|
2463
2463
|
for (let d = 0; d < e.length; d++)
|
|
2464
2464
|
for (let f = 0; f < e[0].length; f++) {
|
|
2465
|
-
const
|
|
2466
|
-
for (const p of
|
|
2465
|
+
const v = xl(e, d, f);
|
|
2466
|
+
for (const p of v) o.some((x) => x.x === p.x && x.y === p.y) || o.push(p);
|
|
2467
2467
|
}
|
|
2468
2468
|
return o.map((d) => ({ x: d.x * t, y: d.y * t }));
|
|
2469
2469
|
}
|
|
@@ -2492,10 +2492,10 @@ var li = {};
|
|
|
2492
2492
|
dy: 1
|
|
2493
2493
|
}));
|
|
2494
2494
|
n.forEach((p) => p.y++), d.forEach((p) => p.x++);
|
|
2495
|
-
const f = yr([...o, ...d], (p, x) => p.x === x.x && p.y - 1 === x.y),
|
|
2496
|
-
return [...f, ...
|
|
2495
|
+
const f = yr([...o, ...d], (p, x) => p.x === x.x && p.y - 1 === x.y), v = yr([...s, ...n], (p, x) => p.y === x.y && p.x - 1 === x.x);
|
|
2496
|
+
return [...f, ...v].map((p) => ({ start: p[0], end: qe(p) })).map((p) => ({
|
|
2497
2497
|
start: xr(p.start, t),
|
|
2498
|
-
end: xr(
|
|
2498
|
+
end: xr(Gs(p.end, { x: p.start.dx, y: p.start.dy }), t)
|
|
2499
2499
|
}));
|
|
2500
2500
|
}
|
|
2501
2501
|
function Sl(e, t) {
|
|
@@ -2504,29 +2504,29 @@ var li = {};
|
|
|
2504
2504
|
function Al(e, t) {
|
|
2505
2505
|
return t.map((n) => Sl(e, n)).sort((n, s) => n - s);
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2507
|
+
function ti(e, t, n, s) {
|
|
2508
2508
|
const o = (s.y - n.y) * (t.x - e.x) - (s.x - n.x) * (t.y - e.y);
|
|
2509
2509
|
if (o === 0) return null;
|
|
2510
2510
|
let d = e.y - n.y, f = e.x - n.x;
|
|
2511
|
-
const
|
|
2512
|
-
return d =
|
|
2511
|
+
const v = (s.x - n.x) * d - (s.y - n.y) * f, p = (t.x - e.x) * d - (t.y - e.y) * f;
|
|
2512
|
+
return d = v / o, f = p / o, d > 0 && d < 1 && f > 0 && f < 1 ? { x: e.x + d * (t.x - e.x), y: e.y + d * (t.y - e.y) } : null;
|
|
2513
2513
|
}
|
|
2514
2514
|
function kr(e, t, n) {
|
|
2515
|
-
const s = [], o =
|
|
2515
|
+
const s = [], o = Js(e, n, 1e4);
|
|
2516
2516
|
for (const d of t) {
|
|
2517
|
-
const f =
|
|
2517
|
+
const f = ti(e, o, d.start, d.end);
|
|
2518
2518
|
f && s.push(f);
|
|
2519
2519
|
}
|
|
2520
2520
|
return s.length ? s.reduce((d, f) => {
|
|
2521
|
-
const
|
|
2522
|
-
return
|
|
2521
|
+
const v = Ks(e, f), p = Ks(e, d);
|
|
2522
|
+
return v < p ? f : d;
|
|
2523
2523
|
}) : null;
|
|
2524
2524
|
}
|
|
2525
2525
|
function Tl(e, t, n) {
|
|
2526
2526
|
const s = Al(e, n), o = [];
|
|
2527
2527
|
for (const d of s) {
|
|
2528
|
-
const f = kr(e, t, d - 1e-3),
|
|
2529
|
-
f && o.push(f),
|
|
2528
|
+
const f = kr(e, t, d - 1e-3), v = kr(e, t, d + 1e-3);
|
|
2529
|
+
f && o.push(f), v && o.push(v);
|
|
2530
2530
|
}
|
|
2531
2531
|
return o;
|
|
2532
2532
|
}
|
|
@@ -2587,7 +2587,7 @@ var li = {};
|
|
|
2587
2587
|
uint8ArrayToBase64: Io,
|
|
2588
2588
|
base32ToUint8Array: $o,
|
|
2589
2589
|
uint8ArrayToBase32: Ro,
|
|
2590
|
-
log2Reduce:
|
|
2590
|
+
log2Reduce: $s,
|
|
2591
2591
|
partition: wr,
|
|
2592
2592
|
concatBytes: Re,
|
|
2593
2593
|
numberToUint8: Zu,
|
|
@@ -2609,9 +2609,9 @@ var li = {};
|
|
|
2609
2609
|
getBit: Qu,
|
|
2610
2610
|
indexOf: Xu,
|
|
2611
2611
|
equals: nl,
|
|
2612
|
-
padStart:
|
|
2612
|
+
padStart: Bs,
|
|
2613
2613
|
padStartToMultiple: el,
|
|
2614
|
-
padEnd:
|
|
2614
|
+
padEnd: Ls,
|
|
2615
2615
|
padEndToMultiple: tl,
|
|
2616
2616
|
xorCypher: rl
|
|
2617
2617
|
}, a.Elliptic = {
|
|
@@ -2620,14 +2620,14 @@ var li = {};
|
|
|
2620
2620
|
publicKeyFromCompressed: ol,
|
|
2621
2621
|
publicKeyToAddress: cl,
|
|
2622
2622
|
signMessage: ll,
|
|
2623
|
-
signHash:
|
|
2623
|
+
signHash: Fs,
|
|
2624
2624
|
verifySignature: fl,
|
|
2625
2625
|
recoverPublicKey: dl,
|
|
2626
2626
|
checksumEncode: ul
|
|
2627
2627
|
}, a.Random = {
|
|
2628
2628
|
intBetween: He,
|
|
2629
|
-
floatBetween:
|
|
2630
|
-
chance:
|
|
2629
|
+
floatBetween: Nn,
|
|
2630
|
+
chance: jn,
|
|
2631
2631
|
signed: Ai,
|
|
2632
2632
|
makeSeededRng: Kt,
|
|
2633
2633
|
point: Oi,
|
|
@@ -2636,13 +2636,13 @@ var li = {};
|
|
|
2636
2636
|
countUnique: wu,
|
|
2637
2637
|
makeUnique: vu,
|
|
2638
2638
|
splitBySize: gu,
|
|
2639
|
-
splitByCount:
|
|
2640
|
-
index:
|
|
2639
|
+
splitByCount: Ts,
|
|
2640
|
+
index: As,
|
|
2641
2641
|
indexCollection: pu,
|
|
2642
2642
|
onlyOrThrow: m,
|
|
2643
|
-
onlyOrNull:
|
|
2643
|
+
onlyOrNull: g,
|
|
2644
2644
|
firstOrThrow: E,
|
|
2645
|
-
firstOrNull:
|
|
2645
|
+
firstOrNull: y,
|
|
2646
2646
|
shuffle: h,
|
|
2647
2647
|
initialize: N,
|
|
2648
2648
|
initialize2D: re,
|
|
@@ -2657,7 +2657,7 @@ var li = {};
|
|
|
2657
2657
|
pickRandomIndices: Oe,
|
|
2658
2658
|
pickGuaranteed: Ri,
|
|
2659
2659
|
last: qe,
|
|
2660
|
-
pipe:
|
|
2660
|
+
pipe: Dn,
|
|
2661
2661
|
makePipe: Ci,
|
|
2662
2662
|
sortWeighted: ji,
|
|
2663
2663
|
pushAll: Mt,
|
|
@@ -2675,10 +2675,10 @@ var li = {};
|
|
|
2675
2675
|
getArgument: Zt,
|
|
2676
2676
|
getBooleanArgument: pl,
|
|
2677
2677
|
getNumberArgument: ml,
|
|
2678
|
-
requireStringArgument:
|
|
2678
|
+
requireStringArgument: Hs,
|
|
2679
2679
|
requireNumberArgument: gl,
|
|
2680
2680
|
bringToFront: yl,
|
|
2681
|
-
bringToFrontInPlace:
|
|
2681
|
+
bringToFrontInPlace: qs,
|
|
2682
2682
|
findInstance: Ru,
|
|
2683
2683
|
filterInstances: Cu,
|
|
2684
2684
|
interleave: Nu,
|
|
@@ -2693,7 +2693,7 @@ var li = {};
|
|
|
2693
2693
|
median: Ga,
|
|
2694
2694
|
getDistanceFromMidpoint: Ja,
|
|
2695
2695
|
clamp: gr,
|
|
2696
|
-
range:
|
|
2696
|
+
range: Jn,
|
|
2697
2697
|
interpolate: Wa,
|
|
2698
2698
|
createSequence: Pc,
|
|
2699
2699
|
increment: Gc,
|
|
@@ -2712,7 +2712,7 @@ var li = {};
|
|
|
2712
2712
|
searchFloat: Ki
|
|
2713
2713
|
}, a.Promises = { raceFulfilled: c, invert: i, runInParallelBatches: u }, a.Dates = {
|
|
2714
2714
|
getTimestamp: fc,
|
|
2715
|
-
getTimeDelta:
|
|
2715
|
+
getTimeDelta: ys,
|
|
2716
2716
|
secondsToHumanTime: hc,
|
|
2717
2717
|
countCycles: mc,
|
|
2718
2718
|
isoDate: ac,
|
|
@@ -2726,7 +2726,7 @@ var li = {};
|
|
|
2726
2726
|
humanizeTime: Ct,
|
|
2727
2727
|
humanizeProgress: tc,
|
|
2728
2728
|
createTimeDigits: G,
|
|
2729
|
-
mapDayNumber:
|
|
2729
|
+
mapDayNumber: vs,
|
|
2730
2730
|
getDayInfoFromDate: hr,
|
|
2731
2731
|
getDayInfoFromDateTimeString: bc,
|
|
2732
2732
|
seconds: _c,
|
|
@@ -2735,36 +2735,36 @@ var li = {};
|
|
|
2735
2735
|
days: Ec,
|
|
2736
2736
|
make: Ac,
|
|
2737
2737
|
normalizeTime: lc,
|
|
2738
|
-
absoluteDays:
|
|
2738
|
+
absoluteDays: be
|
|
2739
2739
|
}, a.Objects = {
|
|
2740
2740
|
safeParse: Uc,
|
|
2741
2741
|
deleteDeep: Pi,
|
|
2742
|
-
getDeep:
|
|
2743
|
-
setDeep:
|
|
2742
|
+
getDeep: ye,
|
|
2743
|
+
setDeep: ve,
|
|
2744
2744
|
incrementDeep: Di,
|
|
2745
2745
|
ensureDeep: Ui,
|
|
2746
2746
|
replaceDeep: Zi,
|
|
2747
2747
|
getFirstDeep: Bi,
|
|
2748
|
-
deepMergeInPlace:
|
|
2748
|
+
deepMergeInPlace: we,
|
|
2749
2749
|
deepMerge2: Ma,
|
|
2750
2750
|
deepMerge3: Ia,
|
|
2751
2751
|
mapAllAsync: Da,
|
|
2752
2752
|
cloneWithJson: sc,
|
|
2753
|
-
sortObject:
|
|
2754
|
-
sortArray:
|
|
2755
|
-
sortAny:
|
|
2756
|
-
deepEquals:
|
|
2753
|
+
sortObject: bs,
|
|
2754
|
+
sortArray: _s,
|
|
2755
|
+
sortAny: _e,
|
|
2756
|
+
deepEquals: xs,
|
|
2757
2757
|
deepEqualsEvery: Dc,
|
|
2758
2758
|
runOn: Kc,
|
|
2759
2759
|
ifPresent: Yc,
|
|
2760
|
-
zip:
|
|
2760
|
+
zip: Gn,
|
|
2761
2761
|
zipSum: $a,
|
|
2762
2762
|
removeEmptyArrays: eu,
|
|
2763
2763
|
removeEmptyValues: tu,
|
|
2764
2764
|
flatten: hu,
|
|
2765
|
-
unflatten:
|
|
2765
|
+
unflatten: Ss,
|
|
2766
2766
|
match: mu,
|
|
2767
|
-
sort:
|
|
2767
|
+
sort: Ms,
|
|
2768
2768
|
map: su,
|
|
2769
2769
|
mapIterable: iu,
|
|
2770
2770
|
filterKeys: ru,
|
|
@@ -2780,16 +2780,16 @@ var li = {};
|
|
|
2780
2780
|
incrementMulti: _u,
|
|
2781
2781
|
createBidirectionalMap: ku,
|
|
2782
2782
|
createTemporalBidirectionalMap: Eu,
|
|
2783
|
-
pushToBidirectionalMap:
|
|
2783
|
+
pushToBidirectionalMap: Is,
|
|
2784
2784
|
unshiftToBidirectionalMap: Su,
|
|
2785
2785
|
addToTemporalBidirectionalMap: Au,
|
|
2786
2786
|
getFromTemporalBidirectionalMap: Tu,
|
|
2787
2787
|
createStatefulToggle: Bc,
|
|
2788
2788
|
diffKeys: zc,
|
|
2789
|
-
pickRandomKey:
|
|
2789
|
+
pickRandomKey: ks,
|
|
2790
2790
|
mapRandomKey: Fc,
|
|
2791
2791
|
fromObjectString: Vc,
|
|
2792
|
-
toQueryString:
|
|
2792
|
+
toQueryString: ps,
|
|
2793
2793
|
parseQueryString: qo,
|
|
2794
2794
|
hasKey: Go,
|
|
2795
2795
|
selectMax: Jo,
|
|
@@ -2800,20 +2800,20 @@ var li = {};
|
|
|
2800
2800
|
isFunction: Xt,
|
|
2801
2801
|
isObject: ce,
|
|
2802
2802
|
isStrictlyObject: Me,
|
|
2803
|
-
isEmptyArray:
|
|
2803
|
+
isEmptyArray: Un,
|
|
2804
2804
|
isEmptyObject: Yi,
|
|
2805
2805
|
isUndefined: Qt,
|
|
2806
2806
|
isString: V,
|
|
2807
2807
|
isNumber: ue,
|
|
2808
|
-
isBoolean:
|
|
2808
|
+
isBoolean: Pn,
|
|
2809
2809
|
isDate: Ie,
|
|
2810
2810
|
isBlank: At,
|
|
2811
2811
|
isId: er,
|
|
2812
|
-
isIntegerString:
|
|
2813
|
-
isHexString:
|
|
2814
|
-
isUrl:
|
|
2812
|
+
isIntegerString: Zn,
|
|
2813
|
+
isHexString: Bn,
|
|
2814
|
+
isUrl: Hn,
|
|
2815
2815
|
isNullable: Ea,
|
|
2816
|
-
asString:
|
|
2816
|
+
asString: Vn,
|
|
2817
2817
|
asHexString: la,
|
|
2818
2818
|
asSafeString: da,
|
|
2819
2819
|
asIntegerString: ua,
|
|
@@ -2834,15 +2834,15 @@ var li = {};
|
|
|
2834
2834
|
asUrl: ka,
|
|
2835
2835
|
asNullable: Sa,
|
|
2836
2836
|
asOptional: Aa,
|
|
2837
|
-
enforceObjectShape:
|
|
2837
|
+
enforceObjectShape: qn,
|
|
2838
2838
|
enforceArrayShape: Ta,
|
|
2839
|
-
isPng:
|
|
2840
|
-
isJpg:
|
|
2841
|
-
isWebp:
|
|
2839
|
+
isPng: Rs,
|
|
2840
|
+
isJpg: Cs,
|
|
2841
|
+
isWebp: Ns,
|
|
2842
2842
|
isImage: Pu
|
|
2843
2843
|
}, a.Strings = {
|
|
2844
2844
|
tokenizeByCount: yu,
|
|
2845
|
-
tokenizeByLength:
|
|
2845
|
+
tokenizeByLength: Os,
|
|
2846
2846
|
searchHex: aa,
|
|
2847
2847
|
searchSubstring: oa,
|
|
2848
2848
|
randomHex: ca,
|
|
@@ -2857,24 +2857,24 @@ var li = {};
|
|
|
2857
2857
|
escapeHtml: ao,
|
|
2858
2858
|
decodeHtmlEntities: co,
|
|
2859
2859
|
after: ir,
|
|
2860
|
-
afterLast:
|
|
2861
|
-
before:
|
|
2860
|
+
afterLast: Yn,
|
|
2861
|
+
before: Kn,
|
|
2862
2862
|
beforeLast: ar,
|
|
2863
2863
|
betweenWide: uo,
|
|
2864
2864
|
betweenNarrow: lo,
|
|
2865
2865
|
getPreLine: Mc,
|
|
2866
2866
|
containsWord: dr,
|
|
2867
2867
|
containsWords: Fo,
|
|
2868
|
-
joinUrl:
|
|
2868
|
+
joinUrl: ws,
|
|
2869
2869
|
getFuzzyMatchScore: It,
|
|
2870
2870
|
sortByFuzzyScore: io,
|
|
2871
2871
|
splitOnce: or,
|
|
2872
|
-
splitAll:
|
|
2872
|
+
splitAll: Qn,
|
|
2873
2873
|
randomize: po,
|
|
2874
|
-
expand:
|
|
2874
|
+
expand: Xn,
|
|
2875
2875
|
shrinkTrim: Je,
|
|
2876
2876
|
capitalize: $t,
|
|
2877
|
-
decapitalize:
|
|
2877
|
+
decapitalize: es,
|
|
2878
2878
|
csvEscape: _o,
|
|
2879
2879
|
parseCsv: ec,
|
|
2880
2880
|
surroundInOut: no,
|
|
@@ -2887,24 +2887,24 @@ var li = {};
|
|
|
2887
2887
|
slugToTitle: eo,
|
|
2888
2888
|
slugToCamel: to,
|
|
2889
2889
|
joinHumanly: ro,
|
|
2890
|
-
findWeightedPair:
|
|
2891
|
-
extractBlock:
|
|
2890
|
+
findWeightedPair: as,
|
|
2891
|
+
extractBlock: os,
|
|
2892
2892
|
extractAllBlocks: Eo,
|
|
2893
2893
|
replaceBlocks: So,
|
|
2894
2894
|
indexOfEarliest: $e,
|
|
2895
|
-
lastIndexOfBefore:
|
|
2895
|
+
lastIndexOfBefore: is,
|
|
2896
2896
|
parseHtmlAttributes: Vo,
|
|
2897
2897
|
readNextWord: Rt,
|
|
2898
2898
|
resolveVariables: Wo,
|
|
2899
|
-
resolveVariableWithDefaultSyntax:
|
|
2900
|
-
resolveRemainingVariablesWithDefaults:
|
|
2901
|
-
isLetter:
|
|
2902
|
-
isDigit:
|
|
2899
|
+
resolveVariableWithDefaultSyntax: hs,
|
|
2900
|
+
resolveRemainingVariablesWithDefaults: ms,
|
|
2901
|
+
isLetter: ts,
|
|
2902
|
+
isDigit: rs,
|
|
2903
2903
|
isLetterOrDigit: Ke,
|
|
2904
2904
|
isValidObjectPathCharacter: vo,
|
|
2905
2905
|
insert: wo,
|
|
2906
|
-
indexOfRegex:
|
|
2907
|
-
lineMatches:
|
|
2906
|
+
indexOfRegex: ns,
|
|
2907
|
+
lineMatches: ss,
|
|
2908
2908
|
linesMatchInOrder: bo,
|
|
2909
2909
|
represent: Ge,
|
|
2910
2910
|
resolveMarkdownLinks: Ho,
|
|
@@ -2923,25 +2923,25 @@ var li = {};
|
|
|
2923
2923
|
replaceWord: Uo,
|
|
2924
2924
|
replacePascalCaseWords: Po,
|
|
2925
2925
|
stripHtml: Zo,
|
|
2926
|
-
breakLine:
|
|
2926
|
+
breakLine: fs,
|
|
2927
2927
|
measureTextWidth: Bo,
|
|
2928
2928
|
toLines: Lo,
|
|
2929
2929
|
levenshteinDistance: zo
|
|
2930
2930
|
}, a.Assertions = { asEqual: Pa, asTrue: Za, asTruthy: Ba, asFalse: La, asFalsy: za, asEither: Fa }, a.Cache = { get: Ic, invalidate: $c }, a.Vector = {
|
|
2931
|
-
addPoint:
|
|
2931
|
+
addPoint: Gs,
|
|
2932
2932
|
subtractPoint: vl,
|
|
2933
2933
|
multiplyPoint: xr,
|
|
2934
2934
|
normalizePoint: wl,
|
|
2935
|
-
pushPoint:
|
|
2935
|
+
pushPoint: Js,
|
|
2936
2936
|
filterCoordinates: Qe,
|
|
2937
2937
|
findCorners: kl,
|
|
2938
2938
|
findLines: El,
|
|
2939
2939
|
raycast: kr,
|
|
2940
2940
|
raycastCircle: Tl,
|
|
2941
|
-
getLineIntersectionPoint:
|
|
2941
|
+
getLineIntersectionPoint: ti
|
|
2942
2942
|
};
|
|
2943
|
-
})(
|
|
2944
|
-
const R = /* @__PURE__ */ ql(
|
|
2943
|
+
})(di);
|
|
2944
|
+
const R = /* @__PURE__ */ ql(di);
|
|
2945
2945
|
R.Arrays;
|
|
2946
2946
|
R.Assertions;
|
|
2947
2947
|
const B = R.Binary;
|
|
@@ -2967,13 +2967,13 @@ R.AsyncLazy;
|
|
|
2967
2967
|
R.AsyncQueue;
|
|
2968
2968
|
R.Uint8ArrayReader;
|
|
2969
2969
|
R.Uint8ArrayWriter;
|
|
2970
|
-
const Jl = new TextEncoder(),
|
|
2971
|
-
function
|
|
2972
|
-
return r = typeof r == "number" ?
|
|
2970
|
+
const Jl = new TextEncoder(), ni = 1, si = 4096, En = 4096, Kl = 32;
|
|
2971
|
+
function fi(a, r) {
|
|
2972
|
+
return r = typeof r == "number" ? ui.fromBigInt(BigInt(r)) : r, new Bt(B.keccak256(B.concatBytes(a.toUint8Array(), r.toUint8Array())));
|
|
2973
2973
|
}
|
|
2974
2974
|
function Yl(a) {
|
|
2975
2975
|
const r = a.slice(0, Le.LENGTH), i = a.slice(Le.LENGTH), c = Ql(i), u = B.keccak256(B.concatBytes(r, c));
|
|
2976
|
-
return new
|
|
2976
|
+
return new li(u);
|
|
2977
2977
|
}
|
|
2978
2978
|
function Ql(a) {
|
|
2979
2979
|
if (a.length > En)
|
|
@@ -2984,10 +2984,10 @@ function Ql(a) {
|
|
|
2984
2984
|
const r = new Uint8Array(En);
|
|
2985
2985
|
return r.set(a), B.log2Reduce(B.partition(r, Kl), (i, c) => B.keccak256(B.concatBytes(i, c)));
|
|
2986
2986
|
}
|
|
2987
|
-
function
|
|
2988
|
-
if (a instanceof Uint8Array || (a = Jl.encode(a)), a.length <
|
|
2987
|
+
function ii(a) {
|
|
2988
|
+
if (a instanceof Uint8Array || (a = Jl.encode(a)), a.length < ni || a.length > si)
|
|
2989
2989
|
throw new RangeError(
|
|
2990
|
-
`payload size ${a.length} exceeds limits [${
|
|
2990
|
+
`payload size ${a.length} exceeds limits [${ni}, ${si}]`
|
|
2991
2991
|
);
|
|
2992
2992
|
const r = Le.fromBigInt(BigInt(a.length)), i = B.concatBytes(r.toUint8Array(), a);
|
|
2993
2993
|
return {
|
|
@@ -2998,10 +2998,10 @@ function si(a) {
|
|
|
2998
2998
|
};
|
|
2999
2999
|
}
|
|
3000
3000
|
function Xl(a, r) {
|
|
3001
|
-
return new
|
|
3001
|
+
return new li(B.keccak256(B.concatBytes(a.toUint8Array(), r.toUint8Array())));
|
|
3002
3002
|
}
|
|
3003
|
-
function
|
|
3004
|
-
r = new Bt(r), i = new
|
|
3003
|
+
function ai(a, r, i) {
|
|
3004
|
+
r = new Bt(r), i = new ke(i);
|
|
3005
3005
|
const c = Xl(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), h = Le.fromSlice(a.data, 0), m = Pe.fromSlice(a.data, Le.LENGTH);
|
|
3006
3006
|
return {
|
|
3007
3007
|
data: l,
|
|
@@ -3175,7 +3175,7 @@ const _ = M.arrayToEnum([
|
|
|
3175
3175
|
default:
|
|
3176
3176
|
return _.unknown;
|
|
3177
3177
|
}
|
|
3178
|
-
},
|
|
3178
|
+
}, w = M.arrayToEnum([
|
|
3179
3179
|
"invalid_type",
|
|
3180
3180
|
"invalid_literal",
|
|
3181
3181
|
"custom",
|
|
@@ -3220,10 +3220,10 @@ class F extends Error {
|
|
|
3220
3220
|
else if (h.path.length === 0)
|
|
3221
3221
|
c._errors.push(i(h));
|
|
3222
3222
|
else {
|
|
3223
|
-
let m = c,
|
|
3224
|
-
for (;
|
|
3225
|
-
const
|
|
3226
|
-
|
|
3223
|
+
let m = c, g = 0;
|
|
3224
|
+
for (; g < h.path.length; ) {
|
|
3225
|
+
const y = h.path[g];
|
|
3226
|
+
g === h.path.length - 1 ? (m[y] = m[y] || { _errors: [] }, m[y]._errors.push(i(h))) : m[y] = m[y] || { _errors: [] }, m = m[y], g++;
|
|
3227
3227
|
}
|
|
3228
3228
|
}
|
|
3229
3229
|
};
|
|
@@ -3256,52 +3256,52 @@ F.create = (a) => new F(a);
|
|
|
3256
3256
|
const ze = (a, r) => {
|
|
3257
3257
|
let i;
|
|
3258
3258
|
switch (a.code) {
|
|
3259
|
-
case
|
|
3259
|
+
case w.invalid_type:
|
|
3260
3260
|
a.received === _.undefined ? i = "Required" : i = `Expected ${a.expected}, received ${a.received}`;
|
|
3261
3261
|
break;
|
|
3262
|
-
case
|
|
3262
|
+
case w.invalid_literal:
|
|
3263
3263
|
i = `Invalid literal value, expected ${JSON.stringify(a.expected, M.jsonStringifyReplacer)}`;
|
|
3264
3264
|
break;
|
|
3265
|
-
case
|
|
3265
|
+
case w.unrecognized_keys:
|
|
3266
3266
|
i = `Unrecognized key(s) in object: ${M.joinValues(a.keys, ", ")}`;
|
|
3267
3267
|
break;
|
|
3268
|
-
case
|
|
3268
|
+
case w.invalid_union:
|
|
3269
3269
|
i = "Invalid input";
|
|
3270
3270
|
break;
|
|
3271
|
-
case
|
|
3271
|
+
case w.invalid_union_discriminator:
|
|
3272
3272
|
i = `Invalid discriminator value. Expected ${M.joinValues(a.options)}`;
|
|
3273
3273
|
break;
|
|
3274
|
-
case
|
|
3274
|
+
case w.invalid_enum_value:
|
|
3275
3275
|
i = `Invalid enum value. Expected ${M.joinValues(a.options)}, received '${a.received}'`;
|
|
3276
3276
|
break;
|
|
3277
|
-
case
|
|
3277
|
+
case w.invalid_arguments:
|
|
3278
3278
|
i = "Invalid function arguments";
|
|
3279
3279
|
break;
|
|
3280
|
-
case
|
|
3280
|
+
case w.invalid_return_type:
|
|
3281
3281
|
i = "Invalid function return type";
|
|
3282
3282
|
break;
|
|
3283
|
-
case
|
|
3283
|
+
case w.invalid_date:
|
|
3284
3284
|
i = "Invalid date";
|
|
3285
3285
|
break;
|
|
3286
|
-
case
|
|
3286
|
+
case w.invalid_string:
|
|
3287
3287
|
typeof a.validation == "object" ? "includes" in a.validation ? (i = `Invalid input: must include "${a.validation.includes}"`, typeof a.validation.position == "number" && (i = `${i} at one or more positions greater than or equal to ${a.validation.position}`)) : "startsWith" in a.validation ? i = `Invalid input: must start with "${a.validation.startsWith}"` : "endsWith" in a.validation ? i = `Invalid input: must end with "${a.validation.endsWith}"` : M.assertNever(a.validation) : a.validation !== "regex" ? i = `Invalid ${a.validation}` : i = "Invalid";
|
|
3288
3288
|
break;
|
|
3289
|
-
case
|
|
3289
|
+
case w.too_small:
|
|
3290
3290
|
a.type === "array" ? i = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "more than"} ${a.minimum} element(s)` : a.type === "string" ? i = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "over"} ${a.minimum} character(s)` : a.type === "number" ? i = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "date" ? i = `Date must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(a.minimum))}` : i = "Invalid input";
|
|
3291
3291
|
break;
|
|
3292
|
-
case
|
|
3292
|
+
case w.too_big:
|
|
3293
3293
|
a.type === "array" ? i = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "less than"} ${a.maximum} element(s)` : a.type === "string" ? i = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "under"} ${a.maximum} character(s)` : a.type === "number" ? i = `Number must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "bigint" ? i = `BigInt must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "date" ? i = `Date must be ${a.exact ? "exactly" : a.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(a.maximum))}` : i = "Invalid input";
|
|
3294
3294
|
break;
|
|
3295
|
-
case
|
|
3295
|
+
case w.custom:
|
|
3296
3296
|
i = "Invalid input";
|
|
3297
3297
|
break;
|
|
3298
|
-
case
|
|
3298
|
+
case w.invalid_intersection_types:
|
|
3299
3299
|
i = "Intersection results could not be merged";
|
|
3300
3300
|
break;
|
|
3301
|
-
case
|
|
3301
|
+
case w.not_multiple_of:
|
|
3302
3302
|
i = `Number must be a multiple of ${a.multipleOf}`;
|
|
3303
3303
|
break;
|
|
3304
|
-
case
|
|
3304
|
+
case w.not_finite:
|
|
3305
3305
|
i = "Number must be finite";
|
|
3306
3306
|
break;
|
|
3307
3307
|
default:
|
|
@@ -3309,12 +3309,12 @@ const ze = (a, r) => {
|
|
|
3309
3309
|
}
|
|
3310
3310
|
return { message: i };
|
|
3311
3311
|
};
|
|
3312
|
-
let
|
|
3312
|
+
let hi = ze;
|
|
3313
3313
|
function id(a) {
|
|
3314
|
-
|
|
3314
|
+
hi = a;
|
|
3315
3315
|
}
|
|
3316
3316
|
function Lt() {
|
|
3317
|
-
return
|
|
3317
|
+
return hi;
|
|
3318
3318
|
}
|
|
3319
3319
|
const zt = (a) => {
|
|
3320
3320
|
const { data: r, path: i, errorMaps: c, issueData: u } = a, l = [...i, ...u.path || []], h = {
|
|
@@ -3328,9 +3328,9 @@ const zt = (a) => {
|
|
|
3328
3328
|
message: u.message
|
|
3329
3329
|
};
|
|
3330
3330
|
let m = "";
|
|
3331
|
-
const
|
|
3332
|
-
for (const
|
|
3333
|
-
m =
|
|
3331
|
+
const g = c.filter((y) => !!y).slice().reverse();
|
|
3332
|
+
for (const y of g)
|
|
3333
|
+
m = y(h, { data: r, defaultError: m }).message;
|
|
3334
3334
|
return {
|
|
3335
3335
|
...u,
|
|
3336
3336
|
path: l,
|
|
@@ -3398,12 +3398,12 @@ class L {
|
|
|
3398
3398
|
}
|
|
3399
3399
|
const A = Object.freeze({
|
|
3400
3400
|
status: "aborted"
|
|
3401
|
-
}), Ze = (a) => ({ status: "dirty", value: a }), z = (a) => ({ status: "valid", value: a }), Mn = (a) => a.status === "aborted", In = (a) => a.status === "dirty",
|
|
3401
|
+
}), Ze = (a) => ({ status: "dirty", value: a }), z = (a) => ({ status: "valid", value: a }), Mn = (a) => a.status === "aborted", In = (a) => a.status === "dirty", Se = (a) => a.status === "valid", dt = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
3402
3402
|
function Ft(a, r, i, c) {
|
|
3403
3403
|
if (typeof r == "function" ? a !== r || !c : !r.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3404
3404
|
return r.get(a);
|
|
3405
3405
|
}
|
|
3406
|
-
function
|
|
3406
|
+
function mi(a, r, i, c, u) {
|
|
3407
3407
|
if (typeof r == "function" ? a !== r || !u : !r.has(a)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3408
3408
|
return r.set(a, i), i;
|
|
3409
3409
|
}
|
|
@@ -3420,8 +3420,8 @@ class X {
|
|
|
3420
3420
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
|
-
const
|
|
3424
|
-
if (
|
|
3423
|
+
const oi = (a, r) => {
|
|
3424
|
+
if (Se(r))
|
|
3425
3425
|
return { success: !0, data: r.value };
|
|
3426
3426
|
if (!a.common.issues.length)
|
|
3427
3427
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -3442,9 +3442,9 @@ function T(a) {
|
|
|
3442
3442
|
if (r && (i || c))
|
|
3443
3443
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
3444
3444
|
return r ? { errorMap: r, description: u } : { errorMap: (h, m) => {
|
|
3445
|
-
var
|
|
3445
|
+
var g, y;
|
|
3446
3446
|
const { message: E } = a;
|
|
3447
|
-
return h.code === "invalid_enum_value" ? { message: E ?? m.defaultError } : typeof m.data > "u" ? { message: (
|
|
3447
|
+
return h.code === "invalid_enum_value" ? { message: E ?? m.defaultError } : typeof m.data > "u" ? { message: (g = E ?? c) !== null && g !== void 0 ? g : m.defaultError } : h.code !== "invalid_type" ? { message: m.defaultError } : { message: (y = E ?? i) !== null && y !== void 0 ? y : m.defaultError };
|
|
3448
3448
|
}, description: u };
|
|
3449
3449
|
}
|
|
3450
3450
|
class O {
|
|
@@ -3507,7 +3507,7 @@ class O {
|
|
|
3507
3507
|
data: r,
|
|
3508
3508
|
parsedType: ie(r)
|
|
3509
3509
|
}, l = this._parseSync({ data: r, path: u.path, parent: u });
|
|
3510
|
-
return
|
|
3510
|
+
return oi(u, l);
|
|
3511
3511
|
}
|
|
3512
3512
|
"~validate"(r) {
|
|
3513
3513
|
var i, c;
|
|
@@ -3525,7 +3525,7 @@ class O {
|
|
|
3525
3525
|
if (!this["~standard"].async)
|
|
3526
3526
|
try {
|
|
3527
3527
|
const l = this._parseSync({ data: r, path: [], parent: u });
|
|
3528
|
-
return
|
|
3528
|
+
return Se(l) ? {
|
|
3529
3529
|
value: l.value
|
|
3530
3530
|
} : {
|
|
3531
3531
|
issues: u.common.issues
|
|
@@ -3536,7 +3536,7 @@ class O {
|
|
|
3536
3536
|
async: !0
|
|
3537
3537
|
};
|
|
3538
3538
|
}
|
|
3539
|
-
return this._parseAsync({ data: r, path: [], parent: u }).then((l) =>
|
|
3539
|
+
return this._parseAsync({ data: r, path: [], parent: u }).then((l) => Se(l) ? {
|
|
3540
3540
|
value: l.value
|
|
3541
3541
|
} : {
|
|
3542
3542
|
issues: u.common.issues
|
|
@@ -3561,16 +3561,16 @@ class O {
|
|
|
3561
3561
|
data: r,
|
|
3562
3562
|
parsedType: ie(r)
|
|
3563
3563
|
}, u = this._parse({ data: r, path: c.path, parent: c }), l = await (dt(u) ? u : Promise.resolve(u));
|
|
3564
|
-
return
|
|
3564
|
+
return oi(c, l);
|
|
3565
3565
|
}
|
|
3566
3566
|
refine(r, i) {
|
|
3567
3567
|
const c = (u) => typeof i == "string" || typeof i > "u" ? { message: i } : typeof i == "function" ? i(u) : i;
|
|
3568
3568
|
return this._refinement((u, l) => {
|
|
3569
3569
|
const h = r(u), m = () => l.addIssue({
|
|
3570
|
-
code:
|
|
3570
|
+
code: w.custom,
|
|
3571
3571
|
...c(u)
|
|
3572
3572
|
});
|
|
3573
|
-
return typeof Promise < "u" && h instanceof Promise ? h.then((
|
|
3573
|
+
return typeof Promise < "u" && h instanceof Promise ? h.then((g) => g ? !0 : (m(), !1)) : h ? !0 : (m(), !1);
|
|
3574
3574
|
});
|
|
3575
3575
|
}
|
|
3576
3576
|
refinement(r, i) {
|
|
@@ -3669,16 +3669,16 @@ class O {
|
|
|
3669
3669
|
}
|
|
3670
3670
|
const od = /^c[^\s-]{8,}$/i, cd = /^[0-9a-z]+$/, ud = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ld = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, dd = /^[a-z0-9_-]{21}$/i, fd = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, hd = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, md = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, pd = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
3671
3671
|
let Sn;
|
|
3672
|
-
const gd = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, yd = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, vd = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, wd = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, bd = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, _d = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
3673
|
-
function
|
|
3672
|
+
const gd = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, yd = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, vd = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, wd = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, bd = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, _d = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, pi = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", xd = new RegExp(`^${pi}$`);
|
|
3673
|
+
function gi(a) {
|
|
3674
3674
|
let r = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
3675
3675
|
return a.precision ? r = `${r}\\.\\d{${a.precision}}` : a.precision == null && (r = `${r}(\\.\\d+)?`), r;
|
|
3676
3676
|
}
|
|
3677
3677
|
function kd(a) {
|
|
3678
|
-
return new RegExp(`^${
|
|
3678
|
+
return new RegExp(`^${gi(a)}$`);
|
|
3679
3679
|
}
|
|
3680
|
-
function
|
|
3681
|
-
let r = `${
|
|
3680
|
+
function yi(a) {
|
|
3681
|
+
let r = `${pi}T${gi(a)}`;
|
|
3682
3682
|
const i = [];
|
|
3683
3683
|
return i.push(a.local ? "Z?" : "Z"), a.offset && i.push("([+-]\\d{2}:?\\d{2})"), r = `${r}(${i.join("|")})`, new RegExp(`^${r}$`);
|
|
3684
3684
|
}
|
|
@@ -3703,7 +3703,7 @@ class W extends O {
|
|
|
3703
3703
|
if (this._def.coerce && (r.data = String(r.data)), this._getType(r) !== _.string) {
|
|
3704
3704
|
const l = this._getOrReturnCtx(r);
|
|
3705
3705
|
return b(l, {
|
|
3706
|
-
code:
|
|
3706
|
+
code: w.invalid_type,
|
|
3707
3707
|
expected: _.string,
|
|
3708
3708
|
received: l.parsedType
|
|
3709
3709
|
}), A;
|
|
@@ -3713,7 +3713,7 @@ class W extends O {
|
|
|
3713
3713
|
for (const l of this._def.checks)
|
|
3714
3714
|
if (l.kind === "min")
|
|
3715
3715
|
r.data.length < l.value && (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3716
|
-
code:
|
|
3716
|
+
code: w.too_small,
|
|
3717
3717
|
minimum: l.value,
|
|
3718
3718
|
type: "string",
|
|
3719
3719
|
inclusive: !0,
|
|
@@ -3722,7 +3722,7 @@ class W extends O {
|
|
|
3722
3722
|
}), c.dirty());
|
|
3723
3723
|
else if (l.kind === "max")
|
|
3724
3724
|
r.data.length > l.value && (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3725
|
-
code:
|
|
3725
|
+
code: w.too_big,
|
|
3726
3726
|
maximum: l.value,
|
|
3727
3727
|
type: "string",
|
|
3728
3728
|
inclusive: !0,
|
|
@@ -3732,14 +3732,14 @@ class W extends O {
|
|
|
3732
3732
|
else if (l.kind === "length") {
|
|
3733
3733
|
const h = r.data.length > l.value, m = r.data.length < l.value;
|
|
3734
3734
|
(h || m) && (u = this._getOrReturnCtx(r, u), h ? b(u, {
|
|
3735
|
-
code:
|
|
3735
|
+
code: w.too_big,
|
|
3736
3736
|
maximum: l.value,
|
|
3737
3737
|
type: "string",
|
|
3738
3738
|
inclusive: !0,
|
|
3739
3739
|
exact: !0,
|
|
3740
3740
|
message: l.message
|
|
3741
3741
|
}) : m && b(u, {
|
|
3742
|
-
code:
|
|
3742
|
+
code: w.too_small,
|
|
3743
3743
|
minimum: l.value,
|
|
3744
3744
|
type: "string",
|
|
3745
3745
|
inclusive: !0,
|
|
@@ -3749,43 +3749,43 @@ class W extends O {
|
|
|
3749
3749
|
} else if (l.kind === "email")
|
|
3750
3750
|
md.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3751
3751
|
validation: "email",
|
|
3752
|
-
code:
|
|
3752
|
+
code: w.invalid_string,
|
|
3753
3753
|
message: l.message
|
|
3754
3754
|
}), c.dirty());
|
|
3755
3755
|
else if (l.kind === "emoji")
|
|
3756
3756
|
Sn || (Sn = new RegExp(pd, "u")), Sn.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3757
3757
|
validation: "emoji",
|
|
3758
|
-
code:
|
|
3758
|
+
code: w.invalid_string,
|
|
3759
3759
|
message: l.message
|
|
3760
3760
|
}), c.dirty());
|
|
3761
3761
|
else if (l.kind === "uuid")
|
|
3762
3762
|
ld.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3763
3763
|
validation: "uuid",
|
|
3764
|
-
code:
|
|
3764
|
+
code: w.invalid_string,
|
|
3765
3765
|
message: l.message
|
|
3766
3766
|
}), c.dirty());
|
|
3767
3767
|
else if (l.kind === "nanoid")
|
|
3768
3768
|
dd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3769
3769
|
validation: "nanoid",
|
|
3770
|
-
code:
|
|
3770
|
+
code: w.invalid_string,
|
|
3771
3771
|
message: l.message
|
|
3772
3772
|
}), c.dirty());
|
|
3773
3773
|
else if (l.kind === "cuid")
|
|
3774
3774
|
od.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3775
3775
|
validation: "cuid",
|
|
3776
|
-
code:
|
|
3776
|
+
code: w.invalid_string,
|
|
3777
3777
|
message: l.message
|
|
3778
3778
|
}), c.dirty());
|
|
3779
3779
|
else if (l.kind === "cuid2")
|
|
3780
3780
|
cd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3781
3781
|
validation: "cuid2",
|
|
3782
|
-
code:
|
|
3782
|
+
code: w.invalid_string,
|
|
3783
3783
|
message: l.message
|
|
3784
3784
|
}), c.dirty());
|
|
3785
3785
|
else if (l.kind === "ulid")
|
|
3786
3786
|
ud.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3787
3787
|
validation: "ulid",
|
|
3788
|
-
code:
|
|
3788
|
+
code: w.invalid_string,
|
|
3789
3789
|
message: l.message
|
|
3790
3790
|
}), c.dirty());
|
|
3791
3791
|
else if (l.kind === "url")
|
|
@@ -3794,61 +3794,61 @@ class W extends O {
|
|
|
3794
3794
|
} catch {
|
|
3795
3795
|
u = this._getOrReturnCtx(r, u), b(u, {
|
|
3796
3796
|
validation: "url",
|
|
3797
|
-
code:
|
|
3797
|
+
code: w.invalid_string,
|
|
3798
3798
|
message: l.message
|
|
3799
3799
|
}), c.dirty();
|
|
3800
3800
|
}
|
|
3801
3801
|
else l.kind === "regex" ? (l.regex.lastIndex = 0, l.regex.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3802
3802
|
validation: "regex",
|
|
3803
|
-
code:
|
|
3803
|
+
code: w.invalid_string,
|
|
3804
3804
|
message: l.message
|
|
3805
3805
|
}), c.dirty())) : l.kind === "trim" ? r.data = r.data.trim() : l.kind === "includes" ? r.data.includes(l.value, l.position) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3806
|
-
code:
|
|
3806
|
+
code: w.invalid_string,
|
|
3807
3807
|
validation: { includes: l.value, position: l.position },
|
|
3808
3808
|
message: l.message
|
|
3809
3809
|
}), c.dirty()) : l.kind === "toLowerCase" ? r.data = r.data.toLowerCase() : l.kind === "toUpperCase" ? r.data = r.data.toUpperCase() : l.kind === "startsWith" ? r.data.startsWith(l.value) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3810
|
-
code:
|
|
3810
|
+
code: w.invalid_string,
|
|
3811
3811
|
validation: { startsWith: l.value },
|
|
3812
3812
|
message: l.message
|
|
3813
3813
|
}), c.dirty()) : l.kind === "endsWith" ? r.data.endsWith(l.value) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3814
|
-
code:
|
|
3814
|
+
code: w.invalid_string,
|
|
3815
3815
|
validation: { endsWith: l.value },
|
|
3816
3816
|
message: l.message
|
|
3817
|
-
}), c.dirty()) : l.kind === "datetime" ?
|
|
3818
|
-
code:
|
|
3817
|
+
}), c.dirty()) : l.kind === "datetime" ? yi(l).test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3818
|
+
code: w.invalid_string,
|
|
3819
3819
|
validation: "datetime",
|
|
3820
3820
|
message: l.message
|
|
3821
3821
|
}), c.dirty()) : l.kind === "date" ? xd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3822
|
-
code:
|
|
3822
|
+
code: w.invalid_string,
|
|
3823
3823
|
validation: "date",
|
|
3824
3824
|
message: l.message
|
|
3825
3825
|
}), c.dirty()) : l.kind === "time" ? kd(l).test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3826
|
-
code:
|
|
3826
|
+
code: w.invalid_string,
|
|
3827
3827
|
validation: "time",
|
|
3828
3828
|
message: l.message
|
|
3829
3829
|
}), c.dirty()) : l.kind === "duration" ? hd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3830
3830
|
validation: "duration",
|
|
3831
|
-
code:
|
|
3831
|
+
code: w.invalid_string,
|
|
3832
3832
|
message: l.message
|
|
3833
3833
|
}), c.dirty()) : l.kind === "ip" ? Ed(r.data, l.version) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3834
3834
|
validation: "ip",
|
|
3835
|
-
code:
|
|
3835
|
+
code: w.invalid_string,
|
|
3836
3836
|
message: l.message
|
|
3837
3837
|
}), c.dirty()) : l.kind === "jwt" ? Sd(r.data, l.alg) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3838
3838
|
validation: "jwt",
|
|
3839
|
-
code:
|
|
3839
|
+
code: w.invalid_string,
|
|
3840
3840
|
message: l.message
|
|
3841
3841
|
}), c.dirty()) : l.kind === "cidr" ? Ad(r.data, l.version) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3842
3842
|
validation: "cidr",
|
|
3843
|
-
code:
|
|
3843
|
+
code: w.invalid_string,
|
|
3844
3844
|
message: l.message
|
|
3845
3845
|
}), c.dirty()) : l.kind === "base64" ? bd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3846
3846
|
validation: "base64",
|
|
3847
|
-
code:
|
|
3847
|
+
code: w.invalid_string,
|
|
3848
3848
|
message: l.message
|
|
3849
3849
|
}), c.dirty()) : l.kind === "base64url" ? _d.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3850
3850
|
validation: "base64url",
|
|
3851
|
-
code:
|
|
3851
|
+
code: w.invalid_string,
|
|
3852
3852
|
message: l.message
|
|
3853
3853
|
}), c.dirty()) : M.assertNever(l);
|
|
3854
3854
|
return { status: c.value, value: r.data };
|
|
@@ -3856,7 +3856,7 @@ class W extends O {
|
|
|
3856
3856
|
_regex(r, i, c) {
|
|
3857
3857
|
return this.refinement((u) => r.test(u), {
|
|
3858
3858
|
validation: i,
|
|
3859
|
-
code:
|
|
3859
|
+
code: w.invalid_string,
|
|
3860
3860
|
...k.errToObj(c)
|
|
3861
3861
|
});
|
|
3862
3862
|
}
|
|
@@ -4097,7 +4097,7 @@ class fe extends O {
|
|
|
4097
4097
|
if (this._def.coerce && (r.data = Number(r.data)), this._getType(r) !== _.number) {
|
|
4098
4098
|
const l = this._getOrReturnCtx(r);
|
|
4099
4099
|
return b(l, {
|
|
4100
|
-
code:
|
|
4100
|
+
code: w.invalid_type,
|
|
4101
4101
|
expected: _.number,
|
|
4102
4102
|
received: l.parsedType
|
|
4103
4103
|
}), A;
|
|
@@ -4106,30 +4106,30 @@ class fe extends O {
|
|
|
4106
4106
|
const u = new L();
|
|
4107
4107
|
for (const l of this._def.checks)
|
|
4108
4108
|
l.kind === "int" ? M.isInteger(r.data) || (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4109
|
-
code:
|
|
4109
|
+
code: w.invalid_type,
|
|
4110
4110
|
expected: "integer",
|
|
4111
4111
|
received: "float",
|
|
4112
4112
|
message: l.message
|
|
4113
4113
|
}), u.dirty()) : l.kind === "min" ? (l.inclusive ? r.data < l.value : r.data <= l.value) && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4114
|
-
code:
|
|
4114
|
+
code: w.too_small,
|
|
4115
4115
|
minimum: l.value,
|
|
4116
4116
|
type: "number",
|
|
4117
4117
|
inclusive: l.inclusive,
|
|
4118
4118
|
exact: !1,
|
|
4119
4119
|
message: l.message
|
|
4120
4120
|
}), u.dirty()) : l.kind === "max" ? (l.inclusive ? r.data > l.value : r.data >= l.value) && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4121
|
-
code:
|
|
4121
|
+
code: w.too_big,
|
|
4122
4122
|
maximum: l.value,
|
|
4123
4123
|
type: "number",
|
|
4124
4124
|
inclusive: l.inclusive,
|
|
4125
4125
|
exact: !1,
|
|
4126
4126
|
message: l.message
|
|
4127
4127
|
}), u.dirty()) : l.kind === "multipleOf" ? Td(r.data, l.value) !== 0 && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4128
|
-
code:
|
|
4128
|
+
code: w.not_multiple_of,
|
|
4129
4129
|
multipleOf: l.value,
|
|
4130
4130
|
message: l.message
|
|
4131
4131
|
}), u.dirty()) : l.kind === "finite" ? Number.isFinite(r.data) || (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4132
|
-
code:
|
|
4132
|
+
code: w.not_finite,
|
|
4133
4133
|
message: l.message
|
|
4134
4134
|
}), u.dirty()) : M.assertNever(l);
|
|
4135
4135
|
return { status: u.value, value: r.data };
|
|
@@ -4278,19 +4278,19 @@ class he extends O {
|
|
|
4278
4278
|
const u = new L();
|
|
4279
4279
|
for (const l of this._def.checks)
|
|
4280
4280
|
l.kind === "min" ? (l.inclusive ? r.data < l.value : r.data <= l.value) && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4281
|
-
code:
|
|
4281
|
+
code: w.too_small,
|
|
4282
4282
|
type: "bigint",
|
|
4283
4283
|
minimum: l.value,
|
|
4284
4284
|
inclusive: l.inclusive,
|
|
4285
4285
|
message: l.message
|
|
4286
4286
|
}), u.dirty()) : l.kind === "max" ? (l.inclusive ? r.data > l.value : r.data >= l.value) && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4287
|
-
code:
|
|
4287
|
+
code: w.too_big,
|
|
4288
4288
|
type: "bigint",
|
|
4289
4289
|
maximum: l.value,
|
|
4290
4290
|
inclusive: l.inclusive,
|
|
4291
4291
|
message: l.message
|
|
4292
4292
|
}), u.dirty()) : l.kind === "multipleOf" ? r.data % l.value !== BigInt(0) && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4293
|
-
code:
|
|
4293
|
+
code: w.not_multiple_of,
|
|
4294
4294
|
multipleOf: l.value,
|
|
4295
4295
|
message: l.message
|
|
4296
4296
|
}), u.dirty()) : M.assertNever(l);
|
|
@@ -4299,7 +4299,7 @@ class he extends O {
|
|
|
4299
4299
|
_getInvalidInput(r) {
|
|
4300
4300
|
const i = this._getOrReturnCtx(r);
|
|
4301
4301
|
return b(i, {
|
|
4302
|
-
code:
|
|
4302
|
+
code: w.invalid_type,
|
|
4303
4303
|
expected: _.bigint,
|
|
4304
4304
|
received: i.parsedType
|
|
4305
4305
|
}), A;
|
|
@@ -4402,7 +4402,7 @@ class ft extends O {
|
|
|
4402
4402
|
if (this._def.coerce && (r.data = !!r.data), this._getType(r) !== _.boolean) {
|
|
4403
4403
|
const c = this._getOrReturnCtx(r);
|
|
4404
4404
|
return b(c, {
|
|
4405
|
-
code:
|
|
4405
|
+
code: w.invalid_type,
|
|
4406
4406
|
expected: _.boolean,
|
|
4407
4407
|
received: c.parsedType
|
|
4408
4408
|
}), A;
|
|
@@ -4415,12 +4415,12 @@ ft.create = (a) => new ft({
|
|
|
4415
4415
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4416
4416
|
...T(a)
|
|
4417
4417
|
});
|
|
4418
|
-
class
|
|
4418
|
+
class Ae extends O {
|
|
4419
4419
|
_parse(r) {
|
|
4420
4420
|
if (this._def.coerce && (r.data = new Date(r.data)), this._getType(r) !== _.date) {
|
|
4421
4421
|
const l = this._getOrReturnCtx(r);
|
|
4422
4422
|
return b(l, {
|
|
4423
|
-
code:
|
|
4423
|
+
code: w.invalid_type,
|
|
4424
4424
|
expected: _.date,
|
|
4425
4425
|
received: l.parsedType
|
|
4426
4426
|
}), A;
|
|
@@ -4428,21 +4428,21 @@ class Se extends O {
|
|
|
4428
4428
|
if (isNaN(r.data.getTime())) {
|
|
4429
4429
|
const l = this._getOrReturnCtx(r);
|
|
4430
4430
|
return b(l, {
|
|
4431
|
-
code:
|
|
4431
|
+
code: w.invalid_date
|
|
4432
4432
|
}), A;
|
|
4433
4433
|
}
|
|
4434
4434
|
const c = new L();
|
|
4435
4435
|
let u;
|
|
4436
4436
|
for (const l of this._def.checks)
|
|
4437
4437
|
l.kind === "min" ? r.data.getTime() < l.value && (u = this._getOrReturnCtx(r, u), b(u, {
|
|
4438
|
-
code:
|
|
4438
|
+
code: w.too_small,
|
|
4439
4439
|
message: l.message,
|
|
4440
4440
|
inclusive: !0,
|
|
4441
4441
|
exact: !1,
|
|
4442
4442
|
minimum: l.value,
|
|
4443
4443
|
type: "date"
|
|
4444
4444
|
}), c.dirty()) : l.kind === "max" ? r.data.getTime() > l.value && (u = this._getOrReturnCtx(r, u), b(u, {
|
|
4445
|
-
code:
|
|
4445
|
+
code: w.too_big,
|
|
4446
4446
|
message: l.message,
|
|
4447
4447
|
inclusive: !0,
|
|
4448
4448
|
exact: !1,
|
|
@@ -4455,7 +4455,7 @@ class Se extends O {
|
|
|
4455
4455
|
};
|
|
4456
4456
|
}
|
|
4457
4457
|
_addCheck(r) {
|
|
4458
|
-
return new
|
|
4458
|
+
return new Ae({
|
|
4459
4459
|
...this._def,
|
|
4460
4460
|
checks: [...this._def.checks, r]
|
|
4461
4461
|
});
|
|
@@ -4487,7 +4487,7 @@ class Se extends O {
|
|
|
4487
4487
|
return r != null ? new Date(r) : null;
|
|
4488
4488
|
}
|
|
4489
4489
|
}
|
|
4490
|
-
|
|
4490
|
+
Ae.create = (a) => new Ae({
|
|
4491
4491
|
checks: [],
|
|
4492
4492
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4493
4493
|
typeName: S.ZodDate,
|
|
@@ -4498,7 +4498,7 @@ class Vt extends O {
|
|
|
4498
4498
|
if (this._getType(r) !== _.symbol) {
|
|
4499
4499
|
const c = this._getOrReturnCtx(r);
|
|
4500
4500
|
return b(c, {
|
|
4501
|
-
code:
|
|
4501
|
+
code: w.invalid_type,
|
|
4502
4502
|
expected: _.symbol,
|
|
4503
4503
|
received: c.parsedType
|
|
4504
4504
|
}), A;
|
|
@@ -4515,7 +4515,7 @@ class ht extends O {
|
|
|
4515
4515
|
if (this._getType(r) !== _.undefined) {
|
|
4516
4516
|
const c = this._getOrReturnCtx(r);
|
|
4517
4517
|
return b(c, {
|
|
4518
|
-
code:
|
|
4518
|
+
code: w.invalid_type,
|
|
4519
4519
|
expected: _.undefined,
|
|
4520
4520
|
received: c.parsedType
|
|
4521
4521
|
}), A;
|
|
@@ -4532,7 +4532,7 @@ class mt extends O {
|
|
|
4532
4532
|
if (this._getType(r) !== _.null) {
|
|
4533
4533
|
const c = this._getOrReturnCtx(r);
|
|
4534
4534
|
return b(c, {
|
|
4535
|
-
code:
|
|
4535
|
+
code: w.invalid_type,
|
|
4536
4536
|
expected: _.null,
|
|
4537
4537
|
received: c.parsedType
|
|
4538
4538
|
}), A;
|
|
@@ -4556,7 +4556,7 @@ Fe.create = (a) => new Fe({
|
|
|
4556
4556
|
typeName: S.ZodAny,
|
|
4557
4557
|
...T(a)
|
|
4558
4558
|
});
|
|
4559
|
-
class
|
|
4559
|
+
class Ee extends O {
|
|
4560
4560
|
constructor() {
|
|
4561
4561
|
super(...arguments), this._unknown = !0;
|
|
4562
4562
|
}
|
|
@@ -4564,7 +4564,7 @@ class ke extends O {
|
|
|
4564
4564
|
return z(r.data);
|
|
4565
4565
|
}
|
|
4566
4566
|
}
|
|
4567
|
-
|
|
4567
|
+
Ee.create = (a) => new Ee({
|
|
4568
4568
|
typeName: S.ZodUnknown,
|
|
4569
4569
|
...T(a)
|
|
4570
4570
|
});
|
|
@@ -4572,7 +4572,7 @@ class oe extends O {
|
|
|
4572
4572
|
_parse(r) {
|
|
4573
4573
|
const i = this._getOrReturnCtx(r);
|
|
4574
4574
|
return b(i, {
|
|
4575
|
-
code:
|
|
4575
|
+
code: w.invalid_type,
|
|
4576
4576
|
expected: _.never,
|
|
4577
4577
|
received: i.parsedType
|
|
4578
4578
|
}), A;
|
|
@@ -4587,7 +4587,7 @@ class Wt extends O {
|
|
|
4587
4587
|
if (this._getType(r) !== _.undefined) {
|
|
4588
4588
|
const c = this._getOrReturnCtx(r);
|
|
4589
4589
|
return b(c, {
|
|
4590
|
-
code:
|
|
4590
|
+
code: w.invalid_type,
|
|
4591
4591
|
expected: _.void,
|
|
4592
4592
|
received: c.parsedType
|
|
4593
4593
|
}), A;
|
|
@@ -4604,14 +4604,14 @@ class H extends O {
|
|
|
4604
4604
|
const { ctx: i, status: c } = this._processInputParams(r), u = this._def;
|
|
4605
4605
|
if (i.parsedType !== _.array)
|
|
4606
4606
|
return b(i, {
|
|
4607
|
-
code:
|
|
4607
|
+
code: w.invalid_type,
|
|
4608
4608
|
expected: _.array,
|
|
4609
4609
|
received: i.parsedType
|
|
4610
4610
|
}), A;
|
|
4611
4611
|
if (u.exactLength !== null) {
|
|
4612
4612
|
const h = i.data.length > u.exactLength.value, m = i.data.length < u.exactLength.value;
|
|
4613
4613
|
(h || m) && (b(i, {
|
|
4614
|
-
code: h ?
|
|
4614
|
+
code: h ? w.too_big : w.too_small,
|
|
4615
4615
|
minimum: m ? u.exactLength.value : void 0,
|
|
4616
4616
|
maximum: h ? u.exactLength.value : void 0,
|
|
4617
4617
|
type: "array",
|
|
@@ -4621,14 +4621,14 @@ class H extends O {
|
|
|
4621
4621
|
}), c.dirty());
|
|
4622
4622
|
}
|
|
4623
4623
|
if (u.minLength !== null && i.data.length < u.minLength.value && (b(i, {
|
|
4624
|
-
code:
|
|
4624
|
+
code: w.too_small,
|
|
4625
4625
|
minimum: u.minLength.value,
|
|
4626
4626
|
type: "array",
|
|
4627
4627
|
inclusive: !0,
|
|
4628
4628
|
exact: !1,
|
|
4629
4629
|
message: u.minLength.message
|
|
4630
4630
|
}), c.dirty()), u.maxLength !== null && i.data.length > u.maxLength.value && (b(i, {
|
|
4631
|
-
code:
|
|
4631
|
+
code: w.too_big,
|
|
4632
4632
|
maximum: u.maxLength.value,
|
|
4633
4633
|
type: "array",
|
|
4634
4634
|
inclusive: !0,
|
|
@@ -4700,47 +4700,47 @@ class C extends O {
|
|
|
4700
4700
|
}
|
|
4701
4701
|
_parse(r) {
|
|
4702
4702
|
if (this._getType(r) !== _.object) {
|
|
4703
|
-
const
|
|
4704
|
-
return b(
|
|
4705
|
-
code:
|
|
4703
|
+
const y = this._getOrReturnCtx(r);
|
|
4704
|
+
return b(y, {
|
|
4705
|
+
code: w.invalid_type,
|
|
4706
4706
|
expected: _.object,
|
|
4707
|
-
received:
|
|
4707
|
+
received: y.parsedType
|
|
4708
4708
|
}), A;
|
|
4709
4709
|
}
|
|
4710
4710
|
const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: h } = this._getCached(), m = [];
|
|
4711
4711
|
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
4712
|
-
for (const
|
|
4713
|
-
h.includes(
|
|
4714
|
-
const
|
|
4715
|
-
for (const
|
|
4716
|
-
const E = l[
|
|
4717
|
-
|
|
4718
|
-
key: { status: "valid", value:
|
|
4719
|
-
value: E._parse(new X(u, N, u.path,
|
|
4720
|
-
alwaysSet:
|
|
4712
|
+
for (const y in u.data)
|
|
4713
|
+
h.includes(y) || m.push(y);
|
|
4714
|
+
const g = [];
|
|
4715
|
+
for (const y of h) {
|
|
4716
|
+
const E = l[y], N = u.data[y];
|
|
4717
|
+
g.push({
|
|
4718
|
+
key: { status: "valid", value: y },
|
|
4719
|
+
value: E._parse(new X(u, N, u.path, y)),
|
|
4720
|
+
alwaysSet: y in u.data
|
|
4721
4721
|
});
|
|
4722
4722
|
}
|
|
4723
4723
|
if (this._def.catchall instanceof oe) {
|
|
4724
|
-
const
|
|
4725
|
-
if (
|
|
4724
|
+
const y = this._def.unknownKeys;
|
|
4725
|
+
if (y === "passthrough")
|
|
4726
4726
|
for (const E of m)
|
|
4727
|
-
|
|
4727
|
+
g.push({
|
|
4728
4728
|
key: { status: "valid", value: E },
|
|
4729
4729
|
value: { status: "valid", value: u.data[E] }
|
|
4730
4730
|
});
|
|
4731
|
-
else if (
|
|
4731
|
+
else if (y === "strict")
|
|
4732
4732
|
m.length > 0 && (b(u, {
|
|
4733
|
-
code:
|
|
4733
|
+
code: w.unrecognized_keys,
|
|
4734
4734
|
keys: m
|
|
4735
4735
|
}), c.dirty());
|
|
4736
|
-
else if (
|
|
4736
|
+
else if (y !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
4737
4737
|
} else {
|
|
4738
|
-
const
|
|
4738
|
+
const y = this._def.catchall;
|
|
4739
4739
|
for (const E of m) {
|
|
4740
4740
|
const N = u.data[E];
|
|
4741
|
-
|
|
4741
|
+
g.push({
|
|
4742
4742
|
key: { status: "valid", value: E },
|
|
4743
|
-
value:
|
|
4743
|
+
value: y._parse(
|
|
4744
4744
|
new X(u, N, u.path, E)
|
|
4745
4745
|
//, ctx.child(key), value, getParsedType(value)
|
|
4746
4746
|
),
|
|
@@ -4749,17 +4749,17 @@ class C extends O {
|
|
|
4749
4749
|
}
|
|
4750
4750
|
}
|
|
4751
4751
|
return u.common.async ? Promise.resolve().then(async () => {
|
|
4752
|
-
const
|
|
4753
|
-
for (const E of
|
|
4752
|
+
const y = [];
|
|
4753
|
+
for (const E of g) {
|
|
4754
4754
|
const N = await E.key, te = await E.value;
|
|
4755
|
-
|
|
4755
|
+
y.push({
|
|
4756
4756
|
key: N,
|
|
4757
4757
|
value: te,
|
|
4758
4758
|
alwaysSet: E.alwaysSet
|
|
4759
4759
|
});
|
|
4760
4760
|
}
|
|
4761
|
-
return
|
|
4762
|
-
}).then((
|
|
4761
|
+
return y;
|
|
4762
|
+
}).then((y) => L.mergeObjectSync(c, y)) : L.mergeObjectSync(c, g);
|
|
4763
4763
|
}
|
|
4764
4764
|
get shape() {
|
|
4765
4765
|
return this._def.shape();
|
|
@@ -4771,11 +4771,11 @@ class C extends O {
|
|
|
4771
4771
|
...r !== void 0 ? {
|
|
4772
4772
|
errorMap: (i, c) => {
|
|
4773
4773
|
var u, l, h, m;
|
|
4774
|
-
const
|
|
4774
|
+
const g = (h = (l = (u = this._def).errorMap) === null || l === void 0 ? void 0 : l.call(u, i, c).message) !== null && h !== void 0 ? h : c.defaultError;
|
|
4775
4775
|
return i.code === "unrecognized_keys" ? {
|
|
4776
|
-
message: (m = k.errToObj(r).message) !== null && m !== void 0 ? m :
|
|
4776
|
+
message: (m = k.errToObj(r).message) !== null && m !== void 0 ? m : g
|
|
4777
4777
|
} : {
|
|
4778
|
-
message:
|
|
4778
|
+
message: g
|
|
4779
4779
|
};
|
|
4780
4780
|
}
|
|
4781
4781
|
} : {}
|
|
@@ -4951,7 +4951,7 @@ class C extends O {
|
|
|
4951
4951
|
});
|
|
4952
4952
|
}
|
|
4953
4953
|
keyof() {
|
|
4954
|
-
return
|
|
4954
|
+
return vi(M.objectKeys(this.shape));
|
|
4955
4955
|
}
|
|
4956
4956
|
}
|
|
4957
4957
|
C.create = (a, r) => new C({
|
|
@@ -4987,7 +4987,7 @@ class pt extends O {
|
|
|
4987
4987
|
return i.common.issues.push(...m.ctx.common.issues), m.result;
|
|
4988
4988
|
const h = l.map((m) => new F(m.ctx.common.issues));
|
|
4989
4989
|
return b(i, {
|
|
4990
|
-
code:
|
|
4990
|
+
code: w.invalid_union,
|
|
4991
4991
|
unionErrors: h
|
|
4992
4992
|
}), A;
|
|
4993
4993
|
}
|
|
@@ -5013,28 +5013,28 @@ class pt extends O {
|
|
|
5013
5013
|
{
|
|
5014
5014
|
let l;
|
|
5015
5015
|
const h = [];
|
|
5016
|
-
for (const
|
|
5017
|
-
const
|
|
5016
|
+
for (const g of c) {
|
|
5017
|
+
const y = {
|
|
5018
5018
|
...i,
|
|
5019
5019
|
common: {
|
|
5020
5020
|
...i.common,
|
|
5021
5021
|
issues: []
|
|
5022
5022
|
},
|
|
5023
5023
|
parent: null
|
|
5024
|
-
}, E =
|
|
5024
|
+
}, E = g._parseSync({
|
|
5025
5025
|
data: i.data,
|
|
5026
5026
|
path: i.path,
|
|
5027
|
-
parent:
|
|
5027
|
+
parent: y
|
|
5028
5028
|
});
|
|
5029
5029
|
if (E.status === "valid")
|
|
5030
5030
|
return E;
|
|
5031
|
-
E.status === "dirty" && !l && (l = { result: E, ctx:
|
|
5031
|
+
E.status === "dirty" && !l && (l = { result: E, ctx: y }), y.common.issues.length && h.push(y.common.issues);
|
|
5032
5032
|
}
|
|
5033
5033
|
if (l)
|
|
5034
5034
|
return i.common.issues.push(...l.ctx.common.issues), l.result;
|
|
5035
|
-
const m = h.map((
|
|
5035
|
+
const m = h.map((g) => new F(g));
|
|
5036
5036
|
return b(i, {
|
|
5037
|
-
code:
|
|
5037
|
+
code: w.invalid_union,
|
|
5038
5038
|
unionErrors: m
|
|
5039
5039
|
}), A;
|
|
5040
5040
|
}
|
|
@@ -5054,7 +5054,7 @@ class Gt extends O {
|
|
|
5054
5054
|
const { ctx: i } = this._processInputParams(r);
|
|
5055
5055
|
if (i.parsedType !== _.object)
|
|
5056
5056
|
return b(i, {
|
|
5057
|
-
code:
|
|
5057
|
+
code: w.invalid_type,
|
|
5058
5058
|
expected: _.object,
|
|
5059
5059
|
received: i.parsedType
|
|
5060
5060
|
}), A;
|
|
@@ -5068,7 +5068,7 @@ class Gt extends O {
|
|
|
5068
5068
|
path: i.path,
|
|
5069
5069
|
parent: i
|
|
5070
5070
|
}) : (b(i, {
|
|
5071
|
-
code:
|
|
5071
|
+
code: w.invalid_union_discriminator,
|
|
5072
5072
|
options: Array.from(this.optionsMap.keys()),
|
|
5073
5073
|
path: [c]
|
|
5074
5074
|
}), A);
|
|
@@ -5118,10 +5118,10 @@ function $n(a, r) {
|
|
|
5118
5118
|
if (i === _.object && c === _.object) {
|
|
5119
5119
|
const u = M.objectKeys(r), l = M.objectKeys(a).filter((m) => u.indexOf(m) !== -1), h = { ...a, ...r };
|
|
5120
5120
|
for (const m of l) {
|
|
5121
|
-
const
|
|
5122
|
-
if (!
|
|
5121
|
+
const g = $n(a[m], r[m]);
|
|
5122
|
+
if (!g.valid)
|
|
5123
5123
|
return { valid: !1 };
|
|
5124
|
-
h[m] =
|
|
5124
|
+
h[m] = g.data;
|
|
5125
5125
|
}
|
|
5126
5126
|
return { valid: !0, data: h };
|
|
5127
5127
|
} else if (i === _.array && c === _.array) {
|
|
@@ -5129,10 +5129,10 @@ function $n(a, r) {
|
|
|
5129
5129
|
return { valid: !1 };
|
|
5130
5130
|
const u = [];
|
|
5131
5131
|
for (let l = 0; l < a.length; l++) {
|
|
5132
|
-
const h = a[l], m = r[l],
|
|
5133
|
-
if (!
|
|
5132
|
+
const h = a[l], m = r[l], g = $n(h, m);
|
|
5133
|
+
if (!g.valid)
|
|
5134
5134
|
return { valid: !1 };
|
|
5135
|
-
u.push(
|
|
5135
|
+
u.push(g.data);
|
|
5136
5136
|
}
|
|
5137
5137
|
return { valid: !0, data: u };
|
|
5138
5138
|
} else return i === _.date && c === _.date && +a == +r ? { valid: !0, data: a } : { valid: !1 };
|
|
@@ -5144,7 +5144,7 @@ class gt extends O {
|
|
|
5144
5144
|
return A;
|
|
5145
5145
|
const m = $n(l.value, h.value);
|
|
5146
5146
|
return m.valid ? ((In(l) || In(h)) && i.dirty(), { status: i.value, value: m.data }) : (b(c, {
|
|
5147
|
-
code:
|
|
5147
|
+
code: w.invalid_intersection_types
|
|
5148
5148
|
}), A);
|
|
5149
5149
|
};
|
|
5150
5150
|
return c.common.async ? Promise.all([
|
|
@@ -5180,28 +5180,28 @@ class ee extends O {
|
|
|
5180
5180
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5181
5181
|
if (c.parsedType !== _.array)
|
|
5182
5182
|
return b(c, {
|
|
5183
|
-
code:
|
|
5183
|
+
code: w.invalid_type,
|
|
5184
5184
|
expected: _.array,
|
|
5185
5185
|
received: c.parsedType
|
|
5186
5186
|
}), A;
|
|
5187
5187
|
if (c.data.length < this._def.items.length)
|
|
5188
5188
|
return b(c, {
|
|
5189
|
-
code:
|
|
5189
|
+
code: w.too_small,
|
|
5190
5190
|
minimum: this._def.items.length,
|
|
5191
5191
|
inclusive: !0,
|
|
5192
5192
|
exact: !1,
|
|
5193
5193
|
type: "array"
|
|
5194
5194
|
}), A;
|
|
5195
5195
|
!this._def.rest && c.data.length > this._def.items.length && (b(c, {
|
|
5196
|
-
code:
|
|
5196
|
+
code: w.too_big,
|
|
5197
5197
|
maximum: this._def.items.length,
|
|
5198
5198
|
inclusive: !0,
|
|
5199
5199
|
exact: !1,
|
|
5200
5200
|
type: "array"
|
|
5201
5201
|
}), i.dirty());
|
|
5202
5202
|
const l = [...c.data].map((h, m) => {
|
|
5203
|
-
const
|
|
5204
|
-
return
|
|
5203
|
+
const g = this._def.items[m] || this._def.rest;
|
|
5204
|
+
return g ? g._parse(new X(c, h, c.path, m)) : null;
|
|
5205
5205
|
}).filter((h) => !!h);
|
|
5206
5206
|
return c.common.async ? Promise.all(l).then((h) => L.mergeArray(i, h)) : L.mergeArray(i, l);
|
|
5207
5207
|
}
|
|
@@ -5236,7 +5236,7 @@ class yt extends O {
|
|
|
5236
5236
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5237
5237
|
if (c.parsedType !== _.object)
|
|
5238
5238
|
return b(c, {
|
|
5239
|
-
code:
|
|
5239
|
+
code: w.invalid_type,
|
|
5240
5240
|
expected: _.object,
|
|
5241
5241
|
received: c.parsedType
|
|
5242
5242
|
}), A;
|
|
@@ -5277,32 +5277,32 @@ class Ht extends O {
|
|
|
5277
5277
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5278
5278
|
if (c.parsedType !== _.map)
|
|
5279
5279
|
return b(c, {
|
|
5280
|
-
code:
|
|
5280
|
+
code: w.invalid_type,
|
|
5281
5281
|
expected: _.map,
|
|
5282
5282
|
received: c.parsedType
|
|
5283
5283
|
}), A;
|
|
5284
|
-
const u = this._def.keyType, l = this._def.valueType, h = [...c.data.entries()].map(([m,
|
|
5285
|
-
key: u._parse(new X(c, m, c.path, [
|
|
5286
|
-
value: l._parse(new X(c,
|
|
5284
|
+
const u = this._def.keyType, l = this._def.valueType, h = [...c.data.entries()].map(([m, g], y) => ({
|
|
5285
|
+
key: u._parse(new X(c, m, c.path, [y, "key"])),
|
|
5286
|
+
value: l._parse(new X(c, g, c.path, [y, "value"]))
|
|
5287
5287
|
}));
|
|
5288
5288
|
if (c.common.async) {
|
|
5289
5289
|
const m = /* @__PURE__ */ new Map();
|
|
5290
5290
|
return Promise.resolve().then(async () => {
|
|
5291
|
-
for (const
|
|
5292
|
-
const
|
|
5293
|
-
if (
|
|
5291
|
+
for (const g of h) {
|
|
5292
|
+
const y = await g.key, E = await g.value;
|
|
5293
|
+
if (y.status === "aborted" || E.status === "aborted")
|
|
5294
5294
|
return A;
|
|
5295
|
-
(
|
|
5295
|
+
(y.status === "dirty" || E.status === "dirty") && i.dirty(), m.set(y.value, E.value);
|
|
5296
5296
|
}
|
|
5297
5297
|
return { status: i.value, value: m };
|
|
5298
5298
|
});
|
|
5299
5299
|
} else {
|
|
5300
5300
|
const m = /* @__PURE__ */ new Map();
|
|
5301
|
-
for (const
|
|
5302
|
-
const
|
|
5303
|
-
if (
|
|
5301
|
+
for (const g of h) {
|
|
5302
|
+
const y = g.key, E = g.value;
|
|
5303
|
+
if (y.status === "aborted" || E.status === "aborted")
|
|
5304
5304
|
return A;
|
|
5305
|
-
(
|
|
5305
|
+
(y.status === "dirty" || E.status === "dirty") && i.dirty(), m.set(y.value, E.value);
|
|
5306
5306
|
}
|
|
5307
5307
|
return { status: i.value, value: m };
|
|
5308
5308
|
}
|
|
@@ -5314,25 +5314,25 @@ Ht.create = (a, r, i) => new Ht({
|
|
|
5314
5314
|
typeName: S.ZodMap,
|
|
5315
5315
|
...T(i)
|
|
5316
5316
|
});
|
|
5317
|
-
class
|
|
5317
|
+
class Te extends O {
|
|
5318
5318
|
_parse(r) {
|
|
5319
5319
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5320
5320
|
if (c.parsedType !== _.set)
|
|
5321
5321
|
return b(c, {
|
|
5322
|
-
code:
|
|
5322
|
+
code: w.invalid_type,
|
|
5323
5323
|
expected: _.set,
|
|
5324
5324
|
received: c.parsedType
|
|
5325
5325
|
}), A;
|
|
5326
5326
|
const u = this._def;
|
|
5327
5327
|
u.minSize !== null && c.data.size < u.minSize.value && (b(c, {
|
|
5328
|
-
code:
|
|
5328
|
+
code: w.too_small,
|
|
5329
5329
|
minimum: u.minSize.value,
|
|
5330
5330
|
type: "set",
|
|
5331
5331
|
inclusive: !0,
|
|
5332
5332
|
exact: !1,
|
|
5333
5333
|
message: u.minSize.message
|
|
5334
5334
|
}), i.dirty()), u.maxSize !== null && c.data.size > u.maxSize.value && (b(c, {
|
|
5335
|
-
code:
|
|
5335
|
+
code: w.too_big,
|
|
5336
5336
|
maximum: u.maxSize.value,
|
|
5337
5337
|
type: "set",
|
|
5338
5338
|
inclusive: !0,
|
|
@@ -5340,26 +5340,26 @@ class Ae extends O {
|
|
|
5340
5340
|
message: u.maxSize.message
|
|
5341
5341
|
}), i.dirty());
|
|
5342
5342
|
const l = this._def.valueType;
|
|
5343
|
-
function h(
|
|
5344
|
-
const
|
|
5345
|
-
for (const E of
|
|
5343
|
+
function h(g) {
|
|
5344
|
+
const y = /* @__PURE__ */ new Set();
|
|
5345
|
+
for (const E of g) {
|
|
5346
5346
|
if (E.status === "aborted")
|
|
5347
5347
|
return A;
|
|
5348
|
-
E.status === "dirty" && i.dirty(),
|
|
5348
|
+
E.status === "dirty" && i.dirty(), y.add(E.value);
|
|
5349
5349
|
}
|
|
5350
|
-
return { status: i.value, value:
|
|
5350
|
+
return { status: i.value, value: y };
|
|
5351
5351
|
}
|
|
5352
|
-
const m = [...c.data.values()].map((
|
|
5353
|
-
return c.common.async ? Promise.all(m).then((
|
|
5352
|
+
const m = [...c.data.values()].map((g, y) => l._parse(new X(c, g, c.path, y)));
|
|
5353
|
+
return c.common.async ? Promise.all(m).then((g) => h(g)) : h(m);
|
|
5354
5354
|
}
|
|
5355
5355
|
min(r, i) {
|
|
5356
|
-
return new
|
|
5356
|
+
return new Te({
|
|
5357
5357
|
...this._def,
|
|
5358
5358
|
minSize: { value: r, message: k.toString(i) }
|
|
5359
5359
|
});
|
|
5360
5360
|
}
|
|
5361
5361
|
max(r, i) {
|
|
5362
|
-
return new
|
|
5362
|
+
return new Te({
|
|
5363
5363
|
...this._def,
|
|
5364
5364
|
maxSize: { value: r, message: k.toString(i) }
|
|
5365
5365
|
});
|
|
@@ -5371,7 +5371,7 @@ class Ae extends O {
|
|
|
5371
5371
|
return this.min(1, r);
|
|
5372
5372
|
}
|
|
5373
5373
|
}
|
|
5374
|
-
|
|
5374
|
+
Te.create = (a, r) => new Te({
|
|
5375
5375
|
valueType: a,
|
|
5376
5376
|
minSize: null,
|
|
5377
5377
|
maxSize: null,
|
|
@@ -5386,11 +5386,11 @@ class Be extends O {
|
|
|
5386
5386
|
const { ctx: i } = this._processInputParams(r);
|
|
5387
5387
|
if (i.parsedType !== _.function)
|
|
5388
5388
|
return b(i, {
|
|
5389
|
-
code:
|
|
5389
|
+
code: w.invalid_type,
|
|
5390
5390
|
expected: _.function,
|
|
5391
5391
|
received: i.parsedType
|
|
5392
5392
|
}), A;
|
|
5393
|
-
function c(m,
|
|
5393
|
+
function c(m, g) {
|
|
5394
5394
|
return zt({
|
|
5395
5395
|
data: m,
|
|
5396
5396
|
path: i.path,
|
|
@@ -5399,14 +5399,14 @@ class Be extends O {
|
|
|
5399
5399
|
i.schemaErrorMap,
|
|
5400
5400
|
Lt(),
|
|
5401
5401
|
ze
|
|
5402
|
-
].filter((
|
|
5402
|
+
].filter((y) => !!y),
|
|
5403
5403
|
issueData: {
|
|
5404
|
-
code:
|
|
5405
|
-
argumentsError:
|
|
5404
|
+
code: w.invalid_arguments,
|
|
5405
|
+
argumentsError: g
|
|
5406
5406
|
}
|
|
5407
5407
|
});
|
|
5408
5408
|
}
|
|
5409
|
-
function u(m,
|
|
5409
|
+
function u(m, g) {
|
|
5410
5410
|
return zt({
|
|
5411
5411
|
data: m,
|
|
5412
5412
|
path: i.path,
|
|
@@ -5415,31 +5415,31 @@ class Be extends O {
|
|
|
5415
5415
|
i.schemaErrorMap,
|
|
5416
5416
|
Lt(),
|
|
5417
5417
|
ze
|
|
5418
|
-
].filter((
|
|
5418
|
+
].filter((y) => !!y),
|
|
5419
5419
|
issueData: {
|
|
5420
|
-
code:
|
|
5421
|
-
returnTypeError:
|
|
5420
|
+
code: w.invalid_return_type,
|
|
5421
|
+
returnTypeError: g
|
|
5422
5422
|
}
|
|
5423
5423
|
});
|
|
5424
5424
|
}
|
|
5425
5425
|
const l = { errorMap: i.common.contextualErrorMap }, h = i.data;
|
|
5426
5426
|
if (this._def.returns instanceof Ve) {
|
|
5427
5427
|
const m = this;
|
|
5428
|
-
return z(async function(...
|
|
5429
|
-
const
|
|
5430
|
-
throw
|
|
5428
|
+
return z(async function(...g) {
|
|
5429
|
+
const y = new F([]), E = await m._def.args.parseAsync(g, l).catch((re) => {
|
|
5430
|
+
throw y.addIssue(c(g, re)), y;
|
|
5431
5431
|
}), N = await Reflect.apply(h, this, E);
|
|
5432
5432
|
return await m._def.returns._def.type.parseAsync(N, l).catch((re) => {
|
|
5433
|
-
throw
|
|
5433
|
+
throw y.addIssue(u(N, re)), y;
|
|
5434
5434
|
});
|
|
5435
5435
|
});
|
|
5436
5436
|
} else {
|
|
5437
5437
|
const m = this;
|
|
5438
|
-
return z(function(...
|
|
5439
|
-
const
|
|
5440
|
-
if (!
|
|
5441
|
-
throw new F([c(
|
|
5442
|
-
const E = Reflect.apply(h, this,
|
|
5438
|
+
return z(function(...g) {
|
|
5439
|
+
const y = m._def.args.safeParse(g, l);
|
|
5440
|
+
if (!y.success)
|
|
5441
|
+
throw new F([c(g, y.error)]);
|
|
5442
|
+
const E = Reflect.apply(h, this, y.data), N = m._def.returns.safeParse(E, l);
|
|
5443
5443
|
if (!N.success)
|
|
5444
5444
|
throw new F([u(E, N.error)]);
|
|
5445
5445
|
return N.data;
|
|
@@ -5455,7 +5455,7 @@ class Be extends O {
|
|
|
5455
5455
|
args(...r) {
|
|
5456
5456
|
return new Be({
|
|
5457
5457
|
...this._def,
|
|
5458
|
-
args: ee.create(r).rest(
|
|
5458
|
+
args: ee.create(r).rest(Ee.create())
|
|
5459
5459
|
});
|
|
5460
5460
|
}
|
|
5461
5461
|
returns(r) {
|
|
@@ -5472,8 +5472,8 @@ class Be extends O {
|
|
|
5472
5472
|
}
|
|
5473
5473
|
static create(r, i, c) {
|
|
5474
5474
|
return new Be({
|
|
5475
|
-
args: r || ee.create([]).rest(
|
|
5476
|
-
returns: i ||
|
|
5475
|
+
args: r || ee.create([]).rest(Ee.create()),
|
|
5476
|
+
returns: i || Ee.create(),
|
|
5477
5477
|
typeName: S.ZodFunction,
|
|
5478
5478
|
...T(c)
|
|
5479
5479
|
});
|
|
@@ -5499,7 +5499,7 @@ class wt extends O {
|
|
|
5499
5499
|
const i = this._getOrReturnCtx(r);
|
|
5500
5500
|
return b(i, {
|
|
5501
5501
|
received: i.data,
|
|
5502
|
-
code:
|
|
5502
|
+
code: w.invalid_literal,
|
|
5503
5503
|
expected: this._def.value
|
|
5504
5504
|
}), A;
|
|
5505
5505
|
}
|
|
@@ -5514,7 +5514,7 @@ wt.create = (a, r) => new wt({
|
|
|
5514
5514
|
typeName: S.ZodLiteral,
|
|
5515
5515
|
...T(r)
|
|
5516
5516
|
});
|
|
5517
|
-
function
|
|
5517
|
+
function vi(a, r) {
|
|
5518
5518
|
return new me({
|
|
5519
5519
|
values: a,
|
|
5520
5520
|
typeName: S.ZodEnum,
|
|
@@ -5531,14 +5531,14 @@ class me extends O {
|
|
|
5531
5531
|
return b(i, {
|
|
5532
5532
|
expected: M.joinValues(c),
|
|
5533
5533
|
received: i.parsedType,
|
|
5534
|
-
code:
|
|
5534
|
+
code: w.invalid_type
|
|
5535
5535
|
}), A;
|
|
5536
5536
|
}
|
|
5537
|
-
if (Ft(this, ut) ||
|
|
5537
|
+
if (Ft(this, ut) || mi(this, ut, new Set(this._def.values)), !Ft(this, ut).has(r.data)) {
|
|
5538
5538
|
const i = this._getOrReturnCtx(r), c = this._def.values;
|
|
5539
5539
|
return b(i, {
|
|
5540
5540
|
received: i.data,
|
|
5541
|
-
code:
|
|
5541
|
+
code: w.invalid_enum_value,
|
|
5542
5542
|
options: c
|
|
5543
5543
|
}), A;
|
|
5544
5544
|
}
|
|
@@ -5579,7 +5579,7 @@ class me extends O {
|
|
|
5579
5579
|
}
|
|
5580
5580
|
}
|
|
5581
5581
|
ut = /* @__PURE__ */ new WeakMap();
|
|
5582
|
-
me.create =
|
|
5582
|
+
me.create = vi;
|
|
5583
5583
|
class bt extends O {
|
|
5584
5584
|
constructor() {
|
|
5585
5585
|
super(...arguments), lt.set(this, void 0);
|
|
@@ -5591,14 +5591,14 @@ class bt extends O {
|
|
|
5591
5591
|
return b(c, {
|
|
5592
5592
|
expected: M.joinValues(u),
|
|
5593
5593
|
received: c.parsedType,
|
|
5594
|
-
code:
|
|
5594
|
+
code: w.invalid_type
|
|
5595
5595
|
}), A;
|
|
5596
5596
|
}
|
|
5597
|
-
if (Ft(this, lt) ||
|
|
5597
|
+
if (Ft(this, lt) || mi(this, lt, new Set(M.getValidEnumValues(this._def.values))), !Ft(this, lt).has(r.data)) {
|
|
5598
5598
|
const u = M.objectValues(i);
|
|
5599
5599
|
return b(c, {
|
|
5600
5600
|
received: c.data,
|
|
5601
|
-
code:
|
|
5601
|
+
code: w.invalid_enum_value,
|
|
5602
5602
|
options: u
|
|
5603
5603
|
}), A;
|
|
5604
5604
|
}
|
|
@@ -5622,7 +5622,7 @@ class Ve extends O {
|
|
|
5622
5622
|
const { ctx: i } = this._processInputParams(r);
|
|
5623
5623
|
if (i.parsedType !== _.promise && i.common.async === !1)
|
|
5624
5624
|
return b(i, {
|
|
5625
|
-
code:
|
|
5625
|
+
code: w.invalid_type,
|
|
5626
5626
|
expected: _.promise,
|
|
5627
5627
|
received: i.parsedType
|
|
5628
5628
|
}), A;
|
|
@@ -5660,12 +5660,12 @@ class q extends O {
|
|
|
5660
5660
|
return Promise.resolve(h).then(async (m) => {
|
|
5661
5661
|
if (i.value === "aborted")
|
|
5662
5662
|
return A;
|
|
5663
|
-
const
|
|
5663
|
+
const g = await this._def.schema._parseAsync({
|
|
5664
5664
|
data: m,
|
|
5665
5665
|
path: c.path,
|
|
5666
5666
|
parent: c
|
|
5667
5667
|
});
|
|
5668
|
-
return
|
|
5668
|
+
return g.status === "aborted" ? A : g.status === "dirty" || i.value === "dirty" ? Ze(g.value) : g;
|
|
5669
5669
|
});
|
|
5670
5670
|
{
|
|
5671
5671
|
if (i.value === "aborted")
|
|
@@ -5680,10 +5680,10 @@ class q extends O {
|
|
|
5680
5680
|
}
|
|
5681
5681
|
if (u.type === "refinement") {
|
|
5682
5682
|
const h = (m) => {
|
|
5683
|
-
const
|
|
5683
|
+
const g = u.refinement(m, l);
|
|
5684
5684
|
if (c.common.async)
|
|
5685
|
-
return Promise.resolve(
|
|
5686
|
-
if (
|
|
5685
|
+
return Promise.resolve(g);
|
|
5686
|
+
if (g instanceof Promise)
|
|
5687
5687
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5688
5688
|
return m;
|
|
5689
5689
|
};
|
|
@@ -5704,14 +5704,14 @@ class q extends O {
|
|
|
5704
5704
|
path: c.path,
|
|
5705
5705
|
parent: c
|
|
5706
5706
|
});
|
|
5707
|
-
if (!
|
|
5707
|
+
if (!Se(h))
|
|
5708
5708
|
return h;
|
|
5709
5709
|
const m = u.transform(h.value, l);
|
|
5710
5710
|
if (m instanceof Promise)
|
|
5711
5711
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5712
5712
|
return { status: i.value, value: m };
|
|
5713
5713
|
} else
|
|
5714
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) =>
|
|
5714
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) => Se(h) ? Promise.resolve(u.transform(h.value, l)).then((m) => ({ status: i.value, value: m })) : h);
|
|
5715
5715
|
M.assertNever(u);
|
|
5716
5716
|
}
|
|
5717
5717
|
}
|
|
@@ -5821,7 +5821,7 @@ class qt extends O {
|
|
|
5821
5821
|
if (this._getType(r) !== _.nan) {
|
|
5822
5822
|
const c = this._getOrReturnCtx(r);
|
|
5823
5823
|
return b(c, {
|
|
5824
|
-
code:
|
|
5824
|
+
code: w.invalid_type,
|
|
5825
5825
|
expected: _.nan,
|
|
5826
5826
|
received: c.parsedType
|
|
5827
5827
|
}), A;
|
|
@@ -5889,7 +5889,7 @@ class Et extends O {
|
|
|
5889
5889
|
}
|
|
5890
5890
|
class kt extends O {
|
|
5891
5891
|
_parse(r) {
|
|
5892
|
-
const i = this._def.innerType._parse(r), c = (u) => (
|
|
5892
|
+
const i = this._def.innerType._parse(r), c = (u) => (Se(u) && (u.value = Object.freeze(u.value)), u);
|
|
5893
5893
|
return dt(i) ? i.then((u) => c(u)) : c(i);
|
|
5894
5894
|
}
|
|
5895
5895
|
unwrap() {
|
|
@@ -5901,12 +5901,12 @@ kt.create = (a, r) => new kt({
|
|
|
5901
5901
|
typeName: S.ZodReadonly,
|
|
5902
5902
|
...T(r)
|
|
5903
5903
|
});
|
|
5904
|
-
function
|
|
5904
|
+
function wi(a, r = {}, i) {
|
|
5905
5905
|
return a ? Fe.create().superRefine((c, u) => {
|
|
5906
5906
|
var l, h;
|
|
5907
5907
|
if (!a(c)) {
|
|
5908
|
-
const m = typeof r == "function" ? r(c) : typeof r == "string" ? { message: r } : r,
|
|
5909
|
-
u.addIssue({ code: "custom", ...
|
|
5908
|
+
const m = typeof r == "function" ? r(c) : typeof r == "string" ? { message: r } : r, g = (h = (l = m.fatal) !== null && l !== void 0 ? l : i) !== null && h !== void 0 ? h : !0, y = typeof m == "string" ? { message: m } : m;
|
|
5909
|
+
u.addIssue({ code: "custom", ...y, fatal: g });
|
|
5910
5910
|
}
|
|
5911
5911
|
}) : Fe.create();
|
|
5912
5912
|
}
|
|
@@ -5919,7 +5919,7 @@ var S;
|
|
|
5919
5919
|
})(S || (S = {}));
|
|
5920
5920
|
const Id = (a, r = {
|
|
5921
5921
|
message: `Input not instance of ${a.name}`
|
|
5922
|
-
}) =>
|
|
5922
|
+
}) => wi((i) => i instanceof a, r), bi = W.create, _i = fe.create, $d = qt.create, Rd = he.create, xi = ft.create, Cd = Ae.create, Nd = Vt.create, jd = ht.create, Dd = mt.create, Ud = Fe.create, Pd = Ee.create, Zd = oe.create, Bd = Wt.create, Ld = H.create, zd = C.create, Fd = C.strictCreate, Vd = pt.create, Wd = Gt.create, Hd = gt.create, qd = ee.create, Gd = yt.create, Jd = Ht.create, Kd = Te.create, Yd = Be.create, Qd = vt.create, Xd = wt.create, ef = me.create, tf = bt.create, rf = Ve.create, ci = q.create, nf = Q.create, sf = pe.create, af = q.createWithPreprocess, of = Et.create, cf = () => bi().optional(), uf = () => _i().optional(), lf = () => xi().optional(), df = {
|
|
5923
5923
|
string: (a) => W.create({ ...a, coerce: !0 }),
|
|
5924
5924
|
number: (a) => fe.create({ ...a, coerce: !0 }),
|
|
5925
5925
|
boolean: (a) => ft.create({
|
|
@@ -5927,9 +5927,9 @@ const Id = (a, r = {
|
|
|
5927
5927
|
coerce: !0
|
|
5928
5928
|
}),
|
|
5929
5929
|
bigint: (a) => he.create({ ...a, coerce: !0 }),
|
|
5930
|
-
date: (a) =>
|
|
5930
|
+
date: (a) => Ae.create({ ...a, coerce: !0 })
|
|
5931
5931
|
}, ff = A;
|
|
5932
|
-
var
|
|
5932
|
+
var j = /* @__PURE__ */ Object.freeze({
|
|
5933
5933
|
__proto__: null,
|
|
5934
5934
|
defaultErrorMap: ze,
|
|
5935
5935
|
setErrorMap: id,
|
|
@@ -5943,7 +5943,7 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
5943
5943
|
OK: z,
|
|
5944
5944
|
isAborted: Mn,
|
|
5945
5945
|
isDirty: In,
|
|
5946
|
-
isValid:
|
|
5946
|
+
isValid: Se,
|
|
5947
5947
|
isAsync: dt,
|
|
5948
5948
|
get util() {
|
|
5949
5949
|
return M;
|
|
@@ -5954,17 +5954,17 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
5954
5954
|
ZodParsedType: _,
|
|
5955
5955
|
getParsedType: ie,
|
|
5956
5956
|
ZodType: O,
|
|
5957
|
-
datetimeRegex:
|
|
5957
|
+
datetimeRegex: yi,
|
|
5958
5958
|
ZodString: W,
|
|
5959
5959
|
ZodNumber: fe,
|
|
5960
5960
|
ZodBigInt: he,
|
|
5961
5961
|
ZodBoolean: ft,
|
|
5962
|
-
ZodDate:
|
|
5962
|
+
ZodDate: Ae,
|
|
5963
5963
|
ZodSymbol: Vt,
|
|
5964
5964
|
ZodUndefined: ht,
|
|
5965
5965
|
ZodNull: mt,
|
|
5966
5966
|
ZodAny: Fe,
|
|
5967
|
-
ZodUnknown:
|
|
5967
|
+
ZodUnknown: Ee,
|
|
5968
5968
|
ZodNever: oe,
|
|
5969
5969
|
ZodVoid: Wt,
|
|
5970
5970
|
ZodArray: H,
|
|
@@ -5975,7 +5975,7 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
5975
5975
|
ZodTuple: ee,
|
|
5976
5976
|
ZodRecord: yt,
|
|
5977
5977
|
ZodMap: Ht,
|
|
5978
|
-
ZodSet:
|
|
5978
|
+
ZodSet: Te,
|
|
5979
5979
|
ZodFunction: Be,
|
|
5980
5980
|
ZodLazy: vt,
|
|
5981
5981
|
ZodLiteral: wt,
|
|
@@ -5993,7 +5993,7 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
5993
5993
|
ZodBranded: Rn,
|
|
5994
5994
|
ZodPipeline: Et,
|
|
5995
5995
|
ZodReadonly: kt,
|
|
5996
|
-
custom:
|
|
5996
|
+
custom: wi,
|
|
5997
5997
|
Schema: O,
|
|
5998
5998
|
ZodSchema: O,
|
|
5999
5999
|
late: Md,
|
|
@@ -6004,10 +6004,10 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
6004
6004
|
any: Ud,
|
|
6005
6005
|
array: Ld,
|
|
6006
6006
|
bigint: Rd,
|
|
6007
|
-
boolean:
|
|
6007
|
+
boolean: xi,
|
|
6008
6008
|
date: Cd,
|
|
6009
6009
|
discriminatedUnion: Wd,
|
|
6010
|
-
effect:
|
|
6010
|
+
effect: ci,
|
|
6011
6011
|
enum: ef,
|
|
6012
6012
|
function: Yd,
|
|
6013
6013
|
instanceof: Id,
|
|
@@ -6020,7 +6020,7 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
6020
6020
|
never: Zd,
|
|
6021
6021
|
null: Dd,
|
|
6022
6022
|
nullable: sf,
|
|
6023
|
-
number:
|
|
6023
|
+
number: _i,
|
|
6024
6024
|
object: zd,
|
|
6025
6025
|
oboolean: lf,
|
|
6026
6026
|
onumber: uf,
|
|
@@ -6032,53 +6032,72 @@ var P = /* @__PURE__ */ Object.freeze({
|
|
|
6032
6032
|
record: Gd,
|
|
6033
6033
|
set: Kd,
|
|
6034
6034
|
strictObject: Fd,
|
|
6035
|
-
string:
|
|
6035
|
+
string: bi,
|
|
6036
6036
|
symbol: Nd,
|
|
6037
|
-
transformer:
|
|
6037
|
+
transformer: ci,
|
|
6038
6038
|
tuple: qd,
|
|
6039
6039
|
undefined: jd,
|
|
6040
6040
|
union: Vd,
|
|
6041
6041
|
unknown: Pd,
|
|
6042
6042
|
void: Bd,
|
|
6043
6043
|
NEVER: ff,
|
|
6044
|
-
ZodIssueCode:
|
|
6044
|
+
ZodIssueCode: w,
|
|
6045
6045
|
quotelessJson: sd,
|
|
6046
6046
|
ZodError: F
|
|
6047
|
-
}),
|
|
6048
|
-
const
|
|
6049
|
-
id
|
|
6050
|
-
targetMessageId
|
|
6051
|
-
type
|
|
6052
|
-
message
|
|
6053
|
-
username
|
|
6054
|
-
address
|
|
6055
|
-
timestamp
|
|
6056
|
-
signature
|
|
6057
|
-
index
|
|
6058
|
-
chatTopic
|
|
6059
|
-
userTopic
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6047
|
+
}), ki = /* @__PURE__ */ ((a) => (a.TEXT = "text", a.THREAD = "thread", a.REACTION = "reaction", a))(ki || {});
|
|
6048
|
+
const ge = Y.getInstance(), hf = [
|
|
6049
|
+
"id",
|
|
6050
|
+
"targetMessageId",
|
|
6051
|
+
"type",
|
|
6052
|
+
"message",
|
|
6053
|
+
"username",
|
|
6054
|
+
"address",
|
|
6055
|
+
"timestamp",
|
|
6056
|
+
"signature",
|
|
6057
|
+
"index",
|
|
6058
|
+
"chatTopic",
|
|
6059
|
+
"userTopic",
|
|
6060
|
+
"additionalProps"
|
|
6061
|
+
], Cn = j.object({
|
|
6062
|
+
id: j.string(),
|
|
6063
|
+
targetMessageId: j.string().optional(),
|
|
6064
|
+
type: j.nativeEnum(ki),
|
|
6065
|
+
message: j.string(),
|
|
6066
|
+
username: j.string(),
|
|
6067
|
+
address: j.string(),
|
|
6068
|
+
timestamp: j.number(),
|
|
6069
|
+
signature: j.string(),
|
|
6070
|
+
index: j.number(),
|
|
6071
|
+
chatTopic: j.string(),
|
|
6072
|
+
userTopic: j.string(),
|
|
6073
|
+
additionalProps: j.record(j.any()).optional()
|
|
6074
|
+
}).refine(
|
|
6075
|
+
(a) => !a.additionalProps || Object.keys(a.additionalProps).length === 0 ? !0 : vf(a.additionalProps).isValid,
|
|
6076
|
+
{
|
|
6077
|
+
message: "Invalid additional properties in message"
|
|
6078
|
+
}
|
|
6079
|
+
), mf = j.object({
|
|
6080
|
+
reference: j.string(),
|
|
6081
|
+
timestamp: j.number()
|
|
6082
|
+
}), pf = j.object({
|
|
6083
|
+
message: Cn,
|
|
6084
|
+
messageStateRefs: j.array(mf).nullable()
|
|
6066
6085
|
});
|
|
6067
6086
|
function Ei(a) {
|
|
6068
|
-
const r =
|
|
6069
|
-
return r.success ? Si(a.message) ? !0 : (
|
|
6087
|
+
const r = pf.safeParse(a);
|
|
6088
|
+
return r.success ? Si(a.message) ? !0 : (ge.warn("Invalid main message signature"), !1) : (ge.warn("GSOC message validation failed:", r.error.format()), !1);
|
|
6070
6089
|
}
|
|
6071
|
-
function
|
|
6090
|
+
function gf(a) {
|
|
6072
6091
|
if (!Array.isArray(a))
|
|
6073
|
-
return
|
|
6092
|
+
return ge.warn("Message state must be an array"), !1;
|
|
6074
6093
|
for (const r of a)
|
|
6075
|
-
if (!
|
|
6076
|
-
return
|
|
6094
|
+
if (!yf(r))
|
|
6095
|
+
return ge.warn("Invalid message in message state:", r.id), !1;
|
|
6077
6096
|
return !0;
|
|
6078
6097
|
}
|
|
6079
|
-
function
|
|
6080
|
-
const r =
|
|
6081
|
-
return r.success ? Si(a) ? !0 : (
|
|
6098
|
+
function yf(a) {
|
|
6099
|
+
const r = Cn.safeParse(a);
|
|
6100
|
+
return r.success ? Si(a) ? !0 : (ge.warn("Invalid message signature"), !1) : (ge.warn("Message data validation failed:", r.error.format()), !1);
|
|
6082
6101
|
}
|
|
6083
6102
|
function Si(a) {
|
|
6084
6103
|
try {
|
|
@@ -6096,9 +6115,57 @@ function Si(a) {
|
|
|
6096
6115
|
throw new Error("Signature verification failed!");
|
|
6097
6116
|
return !0;
|
|
6098
6117
|
} catch (r) {
|
|
6099
|
-
return
|
|
6118
|
+
return ge.warn("Error in validateUserSignature", r), !1;
|
|
6100
6119
|
}
|
|
6101
6120
|
}
|
|
6121
|
+
function vf(a) {
|
|
6122
|
+
const r = [];
|
|
6123
|
+
if (a == null)
|
|
6124
|
+
return { isValid: !0, errors: [] };
|
|
6125
|
+
if (typeof a != "object" || Array.isArray(a))
|
|
6126
|
+
return r.push("Additional properties must be a plain object"), { isValid: !1, errors: r };
|
|
6127
|
+
for (const g of Object.keys(a))
|
|
6128
|
+
hf.includes(g) && r.push(`Property '${g}' is reserved and cannot be overridden`);
|
|
6129
|
+
const i = JSON.stringify(a), c = new TextEncoder().encode(i).length, u = 1 * 1024;
|
|
6130
|
+
c > u && r.push(`Additional properties too large: ${c} bytes (max: ${u} bytes)`);
|
|
6131
|
+
const l = 5;
|
|
6132
|
+
function h(g, y = 0) {
|
|
6133
|
+
if (y > l) return !1;
|
|
6134
|
+
if (typeof g == "object" && g !== null && !Array.isArray(g)) {
|
|
6135
|
+
for (const E of Object.values(g))
|
|
6136
|
+
if (!h(E, y + 1)) return !1;
|
|
6137
|
+
}
|
|
6138
|
+
return !0;
|
|
6139
|
+
}
|
|
6140
|
+
h(a) || r.push(`Additional properties nested too deeply (max depth: ${l})`);
|
|
6141
|
+
for (const [g, y] of Object.entries(a))
|
|
6142
|
+
if (g.length > 100 && r.push(`Property key '${g}' too long (max: 100 characters)`), typeof y == "string" && y.length > 1e3 && r.push(`Property '${g}' value too long (max: 1000 characters)`), typeof y == "string") {
|
|
6143
|
+
const E = [
|
|
6144
|
+
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
6145
|
+
/javascript:/gi,
|
|
6146
|
+
/data:text\/html/gi,
|
|
6147
|
+
/vbscript:/gi,
|
|
6148
|
+
/on\w+\s*=/gi
|
|
6149
|
+
];
|
|
6150
|
+
for (const N of E)
|
|
6151
|
+
if (N.test(y)) {
|
|
6152
|
+
r.push(`Property '${g}' contains potentially dangerous content`);
|
|
6153
|
+
break;
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
const m = 20;
|
|
6157
|
+
return Object.keys(a).length > m && r.push(`Too many additional properties: ${Object.keys(a).length} (max: ${m})`), { isValid: r.length === 0, errors: r };
|
|
6158
|
+
}
|
|
6159
|
+
function wf(a) {
|
|
6160
|
+
const r = Cn.safeParse(a);
|
|
6161
|
+
if (!r.success) {
|
|
6162
|
+
const i = r.error.issues.map(
|
|
6163
|
+
(c) => c.path.length > 0 ? `${c.path.join(".")}: ${c.message}` : c.message
|
|
6164
|
+
);
|
|
6165
|
+
return ge.warn("Message validation failed:", r.error.format()), { isValid: !1, errors: i };
|
|
6166
|
+
}
|
|
6167
|
+
return { isValid: !0, errors: [] };
|
|
6168
|
+
}
|
|
6102
6169
|
const K = {
|
|
6103
6170
|
LOADING_INIT: "loadingInit",
|
|
6104
6171
|
LOADING_PREVIOUS_MESSAGES: "loadingPreviousMessages",
|
|
@@ -6108,7 +6175,7 @@ const K = {
|
|
|
6108
6175
|
MESSAGE_REQUEST_ERROR: "messageRequestError",
|
|
6109
6176
|
CRITICAL_ERROR: "criticalError"
|
|
6110
6177
|
};
|
|
6111
|
-
class
|
|
6178
|
+
class bf {
|
|
6112
6179
|
constructor(r, i) {
|
|
6113
6180
|
this.utils = r, this.emitter = i, this.logger = Y.getInstance(), this.errorHandler = ae.getInstance(), this.processedRefs = /* @__PURE__ */ new Set(), this.refRetryCount = /* @__PURE__ */ new Map(), this.bannedRefs = /* @__PURE__ */ new Set(), this.latestStatefulMessage = null, this.MAX_RETRIES = 3, this.RETRY_DELAY = 1e3;
|
|
6114
6181
|
}
|
|
@@ -6123,7 +6190,7 @@ class yf {
|
|
|
6123
6190
|
}
|
|
6124
6191
|
return i;
|
|
6125
6192
|
} catch (r) {
|
|
6126
|
-
return this.errorHandler.handleError(r, "SwarmHistory.init"),
|
|
6193
|
+
return this.errorHandler.handleError(r, "SwarmHistory.init"), ui.fromBigInt(0n);
|
|
6127
6194
|
}
|
|
6128
6195
|
}
|
|
6129
6196
|
async initMessageState(r) {
|
|
@@ -6177,7 +6244,7 @@ class yf {
|
|
|
6177
6244
|
}
|
|
6178
6245
|
async processMessageRef(r) {
|
|
6179
6246
|
const i = await this.utils.downloadObjectFromBee(r);
|
|
6180
|
-
if (!
|
|
6247
|
+
if (!gf(i))
|
|
6181
6248
|
throw new Error(`Invalid message state for ref: ${r}`);
|
|
6182
6249
|
this.processedRefs.add(r), this.refRetryCount.delete(r);
|
|
6183
6250
|
for (const u of i)
|
|
@@ -6200,7 +6267,7 @@ class yf {
|
|
|
6200
6267
|
this.processedRefs.clear(), this.refRetryCount.clear(), this.bannedRefs.clear(), this.latestStatefulMessage = null;
|
|
6201
6268
|
}
|
|
6202
6269
|
}
|
|
6203
|
-
class
|
|
6270
|
+
class _f {
|
|
6204
6271
|
constructor(r, i) {
|
|
6205
6272
|
this.userDetails = r, this.swarmSettings = i, this.depth = 26, this.errorHandler = ae.getInstance(), this.UPLOAD_GSOC_TIMEOUT = 2e3;
|
|
6206
6273
|
}
|
|
@@ -6220,16 +6287,16 @@ class vf {
|
|
|
6220
6287
|
throw new Error("Enveloped mode is enabled, but stamp is not provided");
|
|
6221
6288
|
}
|
|
6222
6289
|
async writeOwnFeedDataByIndexOwned(r, i) {
|
|
6223
|
-
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: h, ownAddress: m } = this.userDetails,
|
|
6224
|
-
await c.makeFeedWriter(
|
|
6290
|
+
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: h, ownAddress: m } = this.userDetails, g = this.generateUserOwnedFeedId(l, m), y = De.fromString(g);
|
|
6291
|
+
await c.makeFeedWriter(y, new ke(h)).uploadPayload(u, JSON.stringify(i), {
|
|
6225
6292
|
index: r
|
|
6226
6293
|
});
|
|
6227
6294
|
}
|
|
6228
6295
|
// TODO: support for wrapped chunks
|
|
6229
6296
|
async writeOwnFeedDataByIndexEnvelope(r, i) {
|
|
6230
|
-
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: h, ownAddress: m } = this.userDetails,
|
|
6297
|
+
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: h, ownAddress: m } = this.userDetails, g = new ke(h), y = xn.fromBlank(h, u, this.depth), E = this.generateUserOwnedFeedId(l, m), N = De.fromString(E), te = fi(N, r), re = ii(i), We = ai(re, te, g), Oe = {
|
|
6231
6298
|
hash: () => We.address.toUint8Array()
|
|
6232
|
-
}, Jt =
|
|
6299
|
+
}, Jt = y.stamp(Oe), { upload: Kt } = c.makeSOCWriter(g), He = Pe.fromUtf8(i);
|
|
6233
6300
|
return (await Kt(Jt, te, He.toUint8Array())).reference.toHex();
|
|
6234
6301
|
}
|
|
6235
6302
|
orderMessages(r) {
|
|
@@ -6261,20 +6328,20 @@ class vf {
|
|
|
6261
6328
|
}
|
|
6262
6329
|
async uploadObjectToBeeEnvelope(r) {
|
|
6263
6330
|
try {
|
|
6264
|
-
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), h = Pe.fromUtf8(JSON.stringify(r)), m = new Gl(async (
|
|
6265
|
-
await i.uploadChunk(l.stamp(
|
|
6331
|
+
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), h = Pe.fromUtf8(JSON.stringify(r)), m = new Gl(async (y) => {
|
|
6332
|
+
await i.uploadChunk(l.stamp(y), y.build());
|
|
6266
6333
|
});
|
|
6267
6334
|
await m.append(h.toUint8Array());
|
|
6268
|
-
const
|
|
6269
|
-
return B.uint8ArrayToHex(
|
|
6335
|
+
const g = await m.finalize();
|
|
6336
|
+
return B.uint8ArrayToHex(g.hash());
|
|
6270
6337
|
} catch (i) {
|
|
6271
6338
|
return this.errorHandler.handleError(i, "Utils.uploadObjectToBee"), null;
|
|
6272
6339
|
}
|
|
6273
6340
|
}
|
|
6274
6341
|
async getOwnLatestFeedIndex() {
|
|
6275
6342
|
try {
|
|
6276
|
-
const { bee: r, chatTopic: i } = this.swarmSettings, { ownAddress: c } = this.userDetails, u = this.generateUserOwnedFeedId(i, c), l = De.fromString(u), m = await r.makeFeedReader(l, c).downloadPayload(),
|
|
6277
|
-
return { latestIndex:
|
|
6343
|
+
const { bee: r, chatTopic: i } = this.swarmSettings, { ownAddress: c } = this.userDetails, u = this.generateUserOwnedFeedId(i, c), l = De.fromString(u), m = await r.makeFeedReader(l, c).downloadPayload(), g = Number(m.feedIndex.toBigInt()), y = g + 1;
|
|
6344
|
+
return { latestIndex: g, nextIndex: y };
|
|
6278
6345
|
} catch (r) {
|
|
6279
6346
|
if (this.isNotFoundError(r))
|
|
6280
6347
|
return { latestIndex: -1, nextIndex: 0 };
|
|
@@ -6311,24 +6378,24 @@ class vf {
|
|
|
6311
6378
|
return u.text();
|
|
6312
6379
|
}
|
|
6313
6380
|
async sendMessageToGsocOwn(r) {
|
|
6314
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, h = new
|
|
6381
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, h = new ke(l), m = Bt.fromString(u), g = Pe.fromUtf8(r), { upload: y } = i.makeSOCWriter(h, {
|
|
6315
6382
|
timeout: this.UPLOAD_GSOC_TIMEOUT
|
|
6316
6383
|
});
|
|
6317
|
-
await
|
|
6384
|
+
await y(c, m, g.toUint8Array());
|
|
6318
6385
|
}
|
|
6319
6386
|
async sendMessageToGsocEnvelope(r) {
|
|
6320
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, { privateKey: h } = this.userDetails, m = xn.fromBlank(h, c, this.depth),
|
|
6387
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, { privateKey: h } = this.userDetails, m = xn.fromBlank(h, c, this.depth), g = new ke(l), y = Bt.fromString(u), E = Pe.fromUtf8(r), N = ii(E.toUint8Array()), te = ai(N, y, g), re = {
|
|
6321
6388
|
hash: () => te.address.toUint8Array()
|
|
6322
|
-
}, We = m.stamp(re), { upload: Oe } = i.makeSOCWriter(
|
|
6389
|
+
}, We = m.stamp(re), { upload: Oe } = i.makeSOCWriter(g, {
|
|
6323
6390
|
timeout: this.UPLOAD_GSOC_TIMEOUT
|
|
6324
6391
|
});
|
|
6325
|
-
await Oe(We,
|
|
6392
|
+
await Oe(We, y, E.toUint8Array());
|
|
6326
6393
|
}
|
|
6327
6394
|
}
|
|
6328
|
-
class
|
|
6395
|
+
class kf {
|
|
6329
6396
|
constructor(r) {
|
|
6330
6397
|
this.logger = Y.getInstance(), this.errorHandler = ae.getInstance(), this.gsocIndex = null, this.fetchProcessRunning = !1, this.stopFetch = !1;
|
|
6331
|
-
const i = new
|
|
6398
|
+
const i = new ke(An(r.user.privateKey));
|
|
6332
6399
|
this.userDetails = {
|
|
6333
6400
|
privateKey: r.user.privateKey,
|
|
6334
6401
|
ownAddress: i.publicKey().address().toString(),
|
|
@@ -6344,7 +6411,7 @@ class bf {
|
|
|
6344
6411
|
gsocResourceId: r.infra.gsocResourceId,
|
|
6345
6412
|
chatTopic: r.infra.chatTopic,
|
|
6346
6413
|
chatAddress: r.infra.chatAddress
|
|
6347
|
-
}, this.emitter = new nd(), this.utils = new
|
|
6414
|
+
}, this.emitter = new nd(), this.utils = new _f(this.userDetails, this.swarmSettings), this.history = new bf(this.utils, this.emitter);
|
|
6348
6415
|
}
|
|
6349
6416
|
start() {
|
|
6350
6417
|
this.init(), this.startMessagesFetchProcess();
|
|
@@ -6358,8 +6425,8 @@ class bf {
|
|
|
6358
6425
|
orderMessages(r) {
|
|
6359
6426
|
return this.utils.orderMessages(r);
|
|
6360
6427
|
}
|
|
6361
|
-
async sendMessage(r, i, c, u) {
|
|
6362
|
-
const
|
|
6428
|
+
async sendMessage(r, i, c, u, l) {
|
|
6429
|
+
const h = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1, m = {
|
|
6363
6430
|
id: u || Hl(),
|
|
6364
6431
|
username: this.userDetails.nickname,
|
|
6365
6432
|
address: this.userDetails.ownAddress,
|
|
@@ -6367,15 +6434,20 @@ class bf {
|
|
|
6367
6434
|
userTopic: this.utils.generateUserOwnedFeedId(this.swarmSettings.chatTopic, this.userDetails.ownAddress),
|
|
6368
6435
|
signature: this.getSignature(r),
|
|
6369
6436
|
timestamp: Date.now(),
|
|
6370
|
-
index:
|
|
6437
|
+
index: h,
|
|
6371
6438
|
type: i,
|
|
6372
6439
|
targetMessageId: c,
|
|
6373
|
-
message: r
|
|
6374
|
-
|
|
6440
|
+
message: r,
|
|
6441
|
+
additionalProps: l
|
|
6442
|
+
}, g = wf(m);
|
|
6443
|
+
if (!g.isValid) {
|
|
6444
|
+
const y = `Invalid message: ${g.errors.join(", ")}`;
|
|
6445
|
+
throw this.logger.error(y), new Error(y);
|
|
6446
|
+
}
|
|
6375
6447
|
try {
|
|
6376
|
-
this.emitter.emit(K.MESSAGE_REQUEST_INITIATED,
|
|
6377
|
-
} catch (
|
|
6378
|
-
this.emitter.emit(K.MESSAGE_REQUEST_ERROR,
|
|
6448
|
+
this.emitter.emit(K.MESSAGE_REQUEST_INITIATED, m), await this.utils.writeOwnFeedDataByIndex(h, JSON.stringify(m)), this.userDetails.ownIndex = h, this.emitter.emit(K.MESSAGE_REQUEST_UPLOADED, m), await this.broadcastUserMessage(m);
|
|
6449
|
+
} catch (y) {
|
|
6450
|
+
this.emitter.emit(K.MESSAGE_REQUEST_ERROR, m), this.errorHandler.handleError(y, "Chat.sendMessage");
|
|
6379
6451
|
}
|
|
6380
6452
|
}
|
|
6381
6453
|
async fetchPreviousMessages() {
|
|
@@ -6389,7 +6461,7 @@ class bf {
|
|
|
6389
6461
|
return this.history.hasPreviousMessages();
|
|
6390
6462
|
}
|
|
6391
6463
|
async retrySendMessage(r) {
|
|
6392
|
-
this.sendMessage(r.message, r.type, r.targetMessageId, r.id);
|
|
6464
|
+
this.sendMessage(r.message, r.type, r.targetMessageId, r.id, r.additionalProps);
|
|
6393
6465
|
}
|
|
6394
6466
|
async retryBroadcastUserMessage(r) {
|
|
6395
6467
|
await this.broadcastUserMessage(r);
|
|
@@ -6414,7 +6486,7 @@ class bf {
|
|
|
6414
6486
|
try {
|
|
6415
6487
|
if (!this.gsocIndex)
|
|
6416
6488
|
return;
|
|
6417
|
-
const r = De.fromString(this.swarmSettings.chatTopic), i =
|
|
6489
|
+
const r = De.fromString(this.swarmSettings.chatTopic), i = fi(r, this.gsocIndex), c = await this.utils.rawSocDownload(this.swarmSettings.chatAddress, i.toString()), u = JSON.parse(c);
|
|
6418
6490
|
if (!Ei(u)) {
|
|
6419
6491
|
this.logger.warn("Invalid GSOC message during fetching");
|
|
6420
6492
|
return;
|
|
@@ -6434,11 +6506,11 @@ class bf {
|
|
|
6434
6506
|
}
|
|
6435
6507
|
}
|
|
6436
6508
|
getSignature(r) {
|
|
6437
|
-
const { ownAddress: i, privateKey: c, nickname: u } = this.userDetails, l = new Ll(i).toString(), h = new
|
|
6509
|
+
const { ownAddress: i, privateKey: c, nickname: u } = this.userDetails, l = new Ll(i).toString(), h = new ke(c);
|
|
6438
6510
|
if (h.publicKey().address().toString() !== l)
|
|
6439
6511
|
throw new Error("The provided address does not match the address derived from the private key");
|
|
6440
|
-
const
|
|
6441
|
-
return h.sign(JSON.stringify({ username: u, address: l, message: r, timestamp:
|
|
6512
|
+
const g = Date.now();
|
|
6513
|
+
return h.sign(JSON.stringify({ username: u, address: l, message: r, timestamp: g })).toHex();
|
|
6442
6514
|
}
|
|
6443
6515
|
async startMessagesFetchProcess() {
|
|
6444
6516
|
if (this.fetchProcessRunning) return;
|
|
@@ -6458,6 +6530,6 @@ class bf {
|
|
|
6458
6530
|
}
|
|
6459
6531
|
export {
|
|
6460
6532
|
K as EVENTS,
|
|
6461
|
-
|
|
6462
|
-
|
|
6533
|
+
ki as MessageType,
|
|
6534
|
+
kf as SwarmChat
|
|
6463
6535
|
};
|