@solarpunkltd/swarm-chat-js 6.2.3 → 6.2.5
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 +924 -910
- package/dist/index.js +9 -9
- package/dist/interfaces/chat.d.ts +6 -0
- package/dist/interfaces/chat.d.ts.map +1 -1
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/swarm-chat-umd.js +9 -9
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeedIndex as
|
|
1
|
+
import { FeedIndex as ci, Identifier as Lt, Span as Be, Bytes as Ue, PrivateKey as ke, Reference as ui, BeeArgumentError as Pl, Signature as Zl, Topic as ut, Stamper as xn, Bee as Bl, EthAddress as Ll } from "@ethersphere/bee-js";
|
|
2
2
|
const P = [];
|
|
3
3
|
for (let a = 0; a < 256; ++a)
|
|
4
4
|
P.push((a + 256).toString(16).slice(1));
|
|
@@ -15,10 +15,10 @@ function Fl() {
|
|
|
15
15
|
}
|
|
16
16
|
return kn(Vl);
|
|
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), ti = { randomUUID: Wl };
|
|
19
19
|
function Hl(a, r, i) {
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
20
|
+
if (ti.randomUUID && !r && !a)
|
|
21
|
+
return ti.randomUUID();
|
|
22
22
|
a = a || {};
|
|
23
23
|
const c = a.random || (a.rng || Fl)();
|
|
24
24
|
return c[6] = c[6] & 15 | 64, c[8] = c[8] & 63 | 128, zl(c);
|
|
@@ -97,7 +97,7 @@ class ql {
|
|
|
97
97
|
function Gl(a) {
|
|
98
98
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var li = {};
|
|
101
101
|
(function(a) {
|
|
102
102
|
var r;
|
|
103
103
|
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;
|
|
@@ -108,8 +108,8 @@ var di = {};
|
|
|
108
108
|
return i(Promise.all(e.map(i)));
|
|
109
109
|
}
|
|
110
110
|
async function u(e, t = 1) {
|
|
111
|
-
const n =
|
|
112
|
-
for (const
|
|
111
|
+
const n = Ts(e, t), s = [], o = n.map(async (d) => {
|
|
112
|
+
for (const m of d) s.push(await m());
|
|
113
113
|
});
|
|
114
114
|
return await Promise.all(o), s;
|
|
115
115
|
}
|
|
@@ -127,7 +127,7 @@ var di = {};
|
|
|
127
127
|
}
|
|
128
128
|
return e;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function h(e) {
|
|
131
131
|
if (e.length === 1) return e[0];
|
|
132
132
|
throw Error(`Expected exactly one element, actual: ${e.length}`);
|
|
133
133
|
}
|
|
@@ -137,7 +137,7 @@ var di = {};
|
|
|
137
137
|
function y(e) {
|
|
138
138
|
return e.length > 0 ? e[0] : null;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function x(e) {
|
|
141
141
|
if (!e.length) throw Error("Received empty array");
|
|
142
142
|
return e[0];
|
|
143
143
|
}
|
|
@@ -162,16 +162,16 @@ var di = {};
|
|
|
162
162
|
}
|
|
163
163
|
return s;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Fe(e, t, n, s) {
|
|
166
166
|
if (n < 0 || s < 0 || s + t[0].length > e[0].length || n + t.length > e.length) return !1;
|
|
167
167
|
for (let o = 0; o < t.length; o++)
|
|
168
168
|
for (let d = 0; d < t[o].length; d++) if (t[o][d] !== void 0 && e[n + o][s + d] !== t[o][d]) return !1;
|
|
169
169
|
return !0;
|
|
170
170
|
}
|
|
171
171
|
function Oe(e, t, n = Math.random) {
|
|
172
|
-
return f(
|
|
172
|
+
return f(Gn(0, e.length - 1), n).slice(0, t);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function We(e, t) {
|
|
175
175
|
return e.map((n) => n[t]);
|
|
176
176
|
}
|
|
177
177
|
function Kt(e) {
|
|
@@ -183,7 +183,7 @@ var di = {};
|
|
|
183
183
|
function He(e, t, n = Math.random) {
|
|
184
184
|
return Math.floor(n() * (t - e + 1)) + e;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Cn(e, t, n = Math.random) {
|
|
187
187
|
return n() * (t - e) + e;
|
|
188
188
|
}
|
|
189
189
|
function Ti() {
|
|
@@ -201,9 +201,9 @@ var di = {};
|
|
|
201
201
|
}
|
|
202
202
|
function Ii(e, t = Math.random) {
|
|
203
203
|
const n = Math.floor(e), s = e - n;
|
|
204
|
-
return
|
|
204
|
+
return Nn(s, t) ? n + 1 : n;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Nn(e, t = Math.random) {
|
|
207
207
|
return t() < e;
|
|
208
208
|
}
|
|
209
209
|
function Yt(e, t = Math.random) {
|
|
@@ -218,15 +218,15 @@ var di = {};
|
|
|
218
218
|
const o = [];
|
|
219
219
|
for (; o.length < t; ) {
|
|
220
220
|
const d = Yt(e, s);
|
|
221
|
-
o.some((
|
|
221
|
+
o.some((m) => n(m, d)) || o.push(d);
|
|
222
222
|
}
|
|
223
223
|
return o;
|
|
224
224
|
}
|
|
225
225
|
function Ri(e, t, n, s, o, d = Math.random) {
|
|
226
|
-
const
|
|
227
|
-
for (t !== null && v.push(t);
|
|
228
|
-
const
|
|
229
|
-
o(
|
|
226
|
+
const m = e.filter((p) => p !== t && p !== n), v = [];
|
|
227
|
+
for (t !== null && v.push(t); m.length && v.length < s; ) {
|
|
228
|
+
const p = a.Random.intBetween(0, m.length - 1, d);
|
|
229
|
+
o(m[p], v) && v.push(m[p]), m.splice(p, 1);
|
|
230
230
|
}
|
|
231
231
|
return f(v, d), { values: v, indexOfGuaranteed: t !== null ? v.indexOf(t) : -1 };
|
|
232
232
|
}
|
|
@@ -234,15 +234,15 @@ var di = {};
|
|
|
234
234
|
if (!e.length) throw Error("Received empty array");
|
|
235
235
|
return e[e.length - 1];
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function jn(e, t, n) {
|
|
238
238
|
return n(t.reduce((s, o) => o(s), e));
|
|
239
239
|
}
|
|
240
240
|
function Ci(e, t) {
|
|
241
|
-
return (n) =>
|
|
241
|
+
return (n) => jn(n, e, t);
|
|
242
242
|
}
|
|
243
243
|
function Ni(e, t, n) {
|
|
244
244
|
if (n === void 0 && (n = Math.random()), e.length !== t.length) throw new Error("Array length mismatch");
|
|
245
|
-
let s = t.reduce((d,
|
|
245
|
+
let s = t.reduce((d, m) => d + m, 0);
|
|
246
246
|
const o = n * s;
|
|
247
247
|
for (let d = 0; d < e.length - 1; d++) if (s -= t[d], o >= s) return e[d];
|
|
248
248
|
return qe(e);
|
|
@@ -250,7 +250,7 @@ var di = {};
|
|
|
250
250
|
function ji(e, t, n = Math.random) {
|
|
251
251
|
const s = t.map((d) => n() * d), o = [];
|
|
252
252
|
for (let d = 0; d < e.length; d++) o.push([e[d], s[d]]);
|
|
253
|
-
return o.sort((d,
|
|
253
|
+
return o.sort((d, m) => m[1] - d[1]).map((d) => d[0]);
|
|
254
254
|
}
|
|
255
255
|
function ye(e, t) {
|
|
256
256
|
if (e == null) return null;
|
|
@@ -266,9 +266,9 @@ var di = {};
|
|
|
266
266
|
const s = t.split(/\.|\[/);
|
|
267
267
|
let o = e;
|
|
268
268
|
for (let d = 0; d < s.length; d++) {
|
|
269
|
-
const
|
|
270
|
-
if (d === s.length - 1) return o[
|
|
271
|
-
ce(o[
|
|
269
|
+
const m = s[d], v = d < s.length - 1 && s[d + 1].includes("]"), p = m.includes("]") ? m.replace(/\[|\]/g, "") : m;
|
|
270
|
+
if (d === s.length - 1) return o[p] = n, n;
|
|
271
|
+
ce(o[p]) || (v ? o[p] = [] : o[p] = {}), o = o[p];
|
|
272
272
|
}
|
|
273
273
|
return n;
|
|
274
274
|
}
|
|
@@ -280,7 +280,7 @@ var di = {};
|
|
|
280
280
|
return ye(e, t) || ve(e, t, n);
|
|
281
281
|
}
|
|
282
282
|
function Pi(e, t) {
|
|
283
|
-
const n = ar(t, "."), s =
|
|
283
|
+
const n = ar(t, "."), s = Kn(t, ".");
|
|
284
284
|
if (!n || !s) return;
|
|
285
285
|
const o = ye(e, n);
|
|
286
286
|
delete o[s];
|
|
@@ -333,14 +333,14 @@ var di = {};
|
|
|
333
333
|
return "#" + e.map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
334
334
|
}
|
|
335
335
|
function qi(e, t, n, s) {
|
|
336
|
-
const o = e * Math.PI / 180, d = n * Math.PI / 180,
|
|
337
|
-
return 6371e3 * (2 * Math.atan2(Math.sqrt(
|
|
336
|
+
const o = e * Math.PI / 180, d = n * Math.PI / 180, m = (n - e) * Math.PI / 180, v = (s - t) * Math.PI / 180, p = Math.sin(m / 2) * Math.sin(m / 2) + Math.cos(o) * Math.cos(d) * Math.sin(v / 2) * Math.sin(v / 2);
|
|
337
|
+
return 6371e3 * (2 * Math.atan2(Math.sqrt(p), Math.sqrt(1 - p)));
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Tt(e, t) {
|
|
340
340
|
return Math.round(e / t) * t;
|
|
341
341
|
}
|
|
342
342
|
function Gi(e) {
|
|
343
|
-
return e > 1e3 ? (e / 1e3).toFixed(0) + " km" : e >= 500 ?
|
|
343
|
+
return e > 1e3 ? (e / 1e3).toFixed(0) + " km" : e >= 500 ? Tt(e, 100) + " m" : e >= 100 ? Tt(e, 50) + " m" : Tt(e, 10) + " m";
|
|
344
344
|
}
|
|
345
345
|
function Ji(e) {
|
|
346
346
|
return e * (e + 1) / 2;
|
|
@@ -356,7 +356,7 @@ var di = {};
|
|
|
356
356
|
function Ie(e) {
|
|
357
357
|
return ce(e) && !Array.isArray(e);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Dn(e) {
|
|
360
360
|
return Array.isArray(e) && e.length === 0;
|
|
361
361
|
}
|
|
362
362
|
function Yi(e) {
|
|
@@ -374,25 +374,25 @@ var di = {};
|
|
|
374
374
|
function ue(e) {
|
|
375
375
|
return typeof e == "number" && isFinite(e);
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function Un(e) {
|
|
378
378
|
return e === !0 || e === !1;
|
|
379
379
|
}
|
|
380
380
|
function Me(e) {
|
|
381
381
|
return Object.prototype.toString.call(e) === "[object Date]";
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function At(e) {
|
|
384
384
|
return !F(e) || e.trim().length === 0;
|
|
385
385
|
}
|
|
386
386
|
function er(e) {
|
|
387
387
|
return ue(e) && Number.isInteger(e) && e >= 1;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Pn(e) {
|
|
390
390
|
return F(e) && e.match(/^-?\d+$/) !== null;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Zn(e) {
|
|
393
393
|
return F(e) && e.match(/^(0x)?[0-9a-f]+$/i) !== null;
|
|
394
394
|
}
|
|
395
|
-
const Qi = "!@#$%^&*()_+-=[]{}|;:<>?,./", Xi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), tr = "abcdefghijklmnopqrstuvwxyz", ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ta = "1234567890", rr = tr + ea + ta,
|
|
395
|
+
const Qi = "!@#$%^&*()_+-=[]{}|;:<>?,./", Xi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), tr = "abcdefghijklmnopqrstuvwxyz", ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ta = "1234567890", rr = tr + ea + ta, Bn = rr + Qi, Ln = [
|
|
396
396
|
"—",
|
|
397
397
|
"\\",
|
|
398
398
|
"東",
|
|
@@ -409,7 +409,7 @@ var di = {};
|
|
|
409
409
|
"ᛇ",
|
|
410
410
|
"ᚻ",
|
|
411
411
|
"ᛦ"
|
|
412
|
-
],
|
|
412
|
+
], zn = "0123456789abcdef";
|
|
413
413
|
function ra(e, t = Math.random) {
|
|
414
414
|
let n = "";
|
|
415
415
|
for (let s = 0; s < e; s++) n += tr[Math.floor(t() * tr.length)];
|
|
@@ -422,12 +422,12 @@ var di = {};
|
|
|
422
422
|
}
|
|
423
423
|
function sa(e, t = Math.random) {
|
|
424
424
|
let n = "";
|
|
425
|
-
for (let s = 0; s < e; s++) n +=
|
|
425
|
+
for (let s = 0; s < e; s++) n += Bn[Math.floor(t() * Bn.length)];
|
|
426
426
|
return n;
|
|
427
427
|
}
|
|
428
428
|
function ia(e, t = Math.random) {
|
|
429
429
|
let n = "";
|
|
430
|
-
for (let s = 0; s < e; s++) n +=
|
|
430
|
+
for (let s = 0; s < e; s++) n += Ln[Math.floor(t() * Ln.length)];
|
|
431
431
|
return n;
|
|
432
432
|
}
|
|
433
433
|
function aa(e, t) {
|
|
@@ -435,17 +435,17 @@ var di = {};
|
|
|
435
435
|
return s ? s[0] : null;
|
|
436
436
|
}
|
|
437
437
|
function oa(e, t, n = Xi) {
|
|
438
|
-
const s =
|
|
438
|
+
const s = Yn(e, n);
|
|
439
439
|
for (const o of s) if (t(o)) return o;
|
|
440
440
|
return null;
|
|
441
441
|
}
|
|
442
442
|
function ca(e, t = Math.random) {
|
|
443
443
|
let n = "";
|
|
444
|
-
for (let s = 0; s < e; s++) n +=
|
|
444
|
+
for (let s = 0; s < e; s++) n += zn[Math.floor(t() * zn.length)];
|
|
445
445
|
return n;
|
|
446
446
|
}
|
|
447
447
|
function ua(e, t) {
|
|
448
|
-
if (!
|
|
448
|
+
if (!Pn(e)) throw new TypeError(`Expected integer string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
449
449
|
const n = BigInt(e);
|
|
450
450
|
if (t && (t.min && n < t.min || t.max && n > t.max))
|
|
451
451
|
throw RangeError(
|
|
@@ -453,8 +453,8 @@ var di = {};
|
|
|
453
453
|
);
|
|
454
454
|
return e;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
457
|
-
if (
|
|
456
|
+
function Vn(e, t) {
|
|
457
|
+
if (At(e)) throw new TypeError(`Expected string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
458
458
|
if (t && (t.min !== void 0 && e.length < t.min || t.max !== void 0 && e.length > t.max))
|
|
459
459
|
throw RangeError(
|
|
460
460
|
`Expected string${t != null && t.name ? ` for ${t.name}` : ""} length in range: ${t.min ?? "-inf"}..${t.max ?? "inf"}; got: ${e.length}`
|
|
@@ -462,7 +462,7 @@ var di = {};
|
|
|
462
462
|
return e;
|
|
463
463
|
}
|
|
464
464
|
function la(e, t) {
|
|
465
|
-
if (!
|
|
465
|
+
if (!Zn(e)) throw new TypeError(`Expected hex string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
466
466
|
const n = e.replace(/^0x/, "");
|
|
467
467
|
if (t && t.byteLength && n.length !== t.byteLength * 2)
|
|
468
468
|
throw RangeError(
|
|
@@ -471,11 +471,11 @@ var di = {};
|
|
|
471
471
|
return n;
|
|
472
472
|
}
|
|
473
473
|
function da(e, t) {
|
|
474
|
-
if (!
|
|
474
|
+
if (!Vn(e, t).split("").every((n) => n === "_" || Ke(n)))
|
|
475
475
|
throw new TypeError(`Expected safe string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
476
476
|
return e;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Fn(e, t) {
|
|
479
479
|
if (t.min !== void 0 && e < t.min || t.max !== void 0 && e > t.max)
|
|
480
480
|
throw RangeError(
|
|
481
481
|
`Expected value${t != null && t.name ? ` for ${t.name}` : ""} in range: ${t.min ?? "-inf"}..${t.max ?? "inf"}; got: ${e}`
|
|
@@ -485,28 +485,28 @@ var di = {};
|
|
|
485
485
|
if (!Xt(e)) throw new TypeError(`Expected function${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
486
486
|
return e;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
if (ue(e)) return t &&
|
|
488
|
+
function Ot(e, t) {
|
|
489
|
+
if (ue(e)) return t && Fn(e, t), e;
|
|
490
490
|
if (!F(e) || !e.match(/^-?\d+(\.\d+)?$/))
|
|
491
491
|
throw new TypeError(`Expected number${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
492
492
|
const n = parseFloat(e);
|
|
493
|
-
return t &&
|
|
493
|
+
return t && Fn(n, t), n;
|
|
494
494
|
}
|
|
495
495
|
function nr(e, t) {
|
|
496
|
-
return
|
|
496
|
+
return Ot(e, t) | 0;
|
|
497
497
|
}
|
|
498
498
|
function ha(e, t) {
|
|
499
499
|
if (e === "true") return !0;
|
|
500
500
|
if (e === "false") return !1;
|
|
501
|
-
if (!
|
|
501
|
+
if (!Un(e)) throw new TypeError(`Expected boolean${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
502
502
|
return e;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function ma(e, t) {
|
|
505
505
|
if (!Me(e)) throw new TypeError(`Expected date${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
506
506
|
return e;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
508
|
+
function pa(e) {
|
|
509
|
+
return At(e) ? null : e;
|
|
510
510
|
}
|
|
511
511
|
function ga(e, t) {
|
|
512
512
|
if (!F(e)) throw new TypeError(`Expected string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
@@ -531,30 +531,30 @@ var di = {};
|
|
|
531
531
|
if (!Array.isArray(e)) throw new TypeError(`Expected array${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
532
532
|
return e;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function It(e, t) {
|
|
535
535
|
if (!Ie(e)) throw new TypeError(`Expected object${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
536
536
|
return e;
|
|
537
537
|
}
|
|
538
538
|
function ba(e, t) {
|
|
539
|
-
return e === null ? null :
|
|
539
|
+
return e === null ? null : It(e, t);
|
|
540
540
|
}
|
|
541
541
|
function _a(e, t) {
|
|
542
|
-
const n =
|
|
542
|
+
const n = It(e, t);
|
|
543
543
|
for (const s of Object.keys(n))
|
|
544
544
|
if (!F(n[s])) throw new TypeError(`Expected string map${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
545
545
|
return n;
|
|
546
546
|
}
|
|
547
547
|
function xa(e, t) {
|
|
548
|
-
const n =
|
|
548
|
+
const n = It(e), s = Object.keys(n), o = Object.values(n);
|
|
549
549
|
if (!s.every(F) || !o.every(ue))
|
|
550
550
|
throw new TypeError(`Expected numeric dictionary${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
551
551
|
return n;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function Wn(e) {
|
|
554
554
|
return F(e) && e.match(/^https?:\/\/.+/) !== null;
|
|
555
555
|
}
|
|
556
556
|
function ka(e, t) {
|
|
557
|
-
if (!
|
|
557
|
+
if (!Wn(e)) throw new TypeError(`Expected url${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
558
558
|
return e;
|
|
559
559
|
}
|
|
560
560
|
function Ea(e, t) {
|
|
@@ -566,13 +566,13 @@ var di = {};
|
|
|
566
566
|
function Ta(e, t) {
|
|
567
567
|
return t == null ? void 0 : e(t);
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Hn(e, t) {
|
|
570
570
|
for (const [n, s] of Object.entries(t)) if (!s(e[n])) throw TypeError(`${n} in value does not exist or match shape`);
|
|
571
571
|
for (const n of Object.keys(e)) if (!t[n]) throw TypeError(`${n} exists in value but not in shape`);
|
|
572
572
|
return !0;
|
|
573
573
|
}
|
|
574
574
|
function Aa(e, t) {
|
|
575
|
-
return e.every((n) =>
|
|
575
|
+
return e.every((n) => Hn(n, t));
|
|
576
576
|
}
|
|
577
577
|
function Ge(e, t = "json", n = 0) {
|
|
578
578
|
if (ce(e, !1)) {
|
|
@@ -615,13 +615,13 @@ var di = {};
|
|
|
615
615
|
const s = {};
|
|
616
616
|
return we(s, e), we(s, t), we(s, n), s;
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function qn(e, t) {
|
|
619
619
|
const n = {};
|
|
620
620
|
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];
|
|
621
621
|
return n;
|
|
622
622
|
}
|
|
623
623
|
function $a(e) {
|
|
624
|
-
return
|
|
624
|
+
return qn(e, (t, n) => t + n);
|
|
625
625
|
}
|
|
626
626
|
function Ra(e, t, n) {
|
|
627
627
|
e[t] || (e[t] = []), e[t].push(n);
|
|
@@ -633,7 +633,7 @@ var di = {};
|
|
|
633
633
|
let n = t % e.length;
|
|
634
634
|
return n < 0 && (n += e.length), e[n];
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function Mt(e, t) {
|
|
637
637
|
Array.prototype.push.apply(e, t);
|
|
638
638
|
}
|
|
639
639
|
function ja(e, t) {
|
|
@@ -695,7 +695,7 @@ var di = {};
|
|
|
695
695
|
function Ja(e, t) {
|
|
696
696
|
return e - (t - 1) / 2;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Gn(e, t) {
|
|
699
699
|
const n = [];
|
|
700
700
|
for (let s = e; s <= t; s++) n.push(s);
|
|
701
701
|
return n;
|
|
@@ -713,13 +713,13 @@ var di = {};
|
|
|
713
713
|
return sr(e).replaceAll("-", "");
|
|
714
714
|
}
|
|
715
715
|
function Xa(e) {
|
|
716
|
-
return
|
|
716
|
+
return Rt(e.replace(/([A-Z])/g, " $1"));
|
|
717
717
|
}
|
|
718
718
|
function eo(e) {
|
|
719
|
-
return e.split("-").map(
|
|
719
|
+
return e.split("-").map(Rt).join(" ");
|
|
720
720
|
}
|
|
721
721
|
function to(e) {
|
|
722
|
-
return
|
|
722
|
+
return Xn(e.split("-").map(Rt).join(""));
|
|
723
723
|
}
|
|
724
724
|
function ro(e, t = ", ", n = " and ") {
|
|
725
725
|
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]}`;
|
|
@@ -730,13 +730,13 @@ var di = {};
|
|
|
730
730
|
function so(e) {
|
|
731
731
|
return sr(e).replace(/-/g, "_").toUpperCase();
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function $t(e, t) {
|
|
734
734
|
if (t.length === 0) return 0;
|
|
735
735
|
const n = e.toLowerCase(), s = t.toLowerCase();
|
|
736
736
|
return e === t ? 1e4 : n.startsWith(s) ? 1e4 - e.length : n.includes(s) ? 5e3 - e.length : new RegExp(".*" + s.split("").join(".*") + ".*").test(n) ? 1e3 - e.length : 0;
|
|
737
737
|
}
|
|
738
738
|
function io(e, t) {
|
|
739
|
-
return e.filter((n) =>
|
|
739
|
+
return e.filter((n) => $t(n, t)).sort((n, s) => $t(s, t) - $t(n, t));
|
|
740
740
|
}
|
|
741
741
|
function ao(e) {
|
|
742
742
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -747,7 +747,7 @@ var di = {};
|
|
|
747
747
|
for (const [n, s] of Object.entries(oo)) t = t.replaceAll(n, s);
|
|
748
748
|
return t;
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Jn(e, t) {
|
|
751
751
|
const n = e.indexOf(t);
|
|
752
752
|
return n === -1 ? null : e.slice(0, n);
|
|
753
753
|
}
|
|
@@ -759,7 +759,7 @@ var di = {};
|
|
|
759
759
|
const n = e.lastIndexOf(t);
|
|
760
760
|
return n === -1 ? null : e.slice(0, n);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Kn(e, t) {
|
|
763
763
|
const n = e.lastIndexOf(t);
|
|
764
764
|
return n === -1 ? null : e.slice(n + t.length);
|
|
765
765
|
}
|
|
@@ -769,13 +769,13 @@ var di = {};
|
|
|
769
769
|
}
|
|
770
770
|
function lo(e, t, n) {
|
|
771
771
|
const s = ir(e, t);
|
|
772
|
-
return s ?
|
|
772
|
+
return s ? Jn(s, n) : null;
|
|
773
773
|
}
|
|
774
774
|
function or(e, t, n = !1) {
|
|
775
775
|
const s = n ? e.lastIndexOf(t) : e.indexOf(t);
|
|
776
776
|
return s === -1 ? n ? [null, e] : [e, null] : [e.slice(0, s), e.slice(s + t.length)];
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function Yn(e, t) {
|
|
779
779
|
let n = [e];
|
|
780
780
|
for (const s of t) n = n.flatMap((o) => o.split(s));
|
|
781
781
|
return n.filter((s) => s);
|
|
@@ -799,23 +799,23 @@ var di = {};
|
|
|
799
799
|
const t = ur(e), n = cr(e);
|
|
800
800
|
return n ? `${t}.${n}` : t;
|
|
801
801
|
}
|
|
802
|
-
function
|
|
802
|
+
function mo(e) {
|
|
803
803
|
const t = ur(e), n = cr(e);
|
|
804
804
|
return { basename: t, extension: n, filename: n ? `${t}.${n}` : t };
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function po(e, t = Math.random) {
|
|
807
807
|
return e.replace(/\{(.+?)\}/g, (n, s) => Yt(s.split("|"), t));
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function Qn(e) {
|
|
810
810
|
const t = /\{(.+?)\}/, n = e.match(t);
|
|
811
811
|
if (!n || !n.index) return [e];
|
|
812
812
|
const s = n[1].split(","), o = e.slice(0, n.index), d = e.slice(n.index + n[0].length);
|
|
813
|
-
let
|
|
813
|
+
let m = [];
|
|
814
814
|
for (const v of s) {
|
|
815
|
-
const
|
|
816
|
-
|
|
815
|
+
const p = Qn(o + v + d);
|
|
816
|
+
m = m.concat(p);
|
|
817
817
|
}
|
|
818
|
-
return
|
|
818
|
+
return m;
|
|
819
819
|
}
|
|
820
820
|
function Je(e) {
|
|
821
821
|
return e.split(
|
|
@@ -824,24 +824,24 @@ var di = {};
|
|
|
824
824
|
).map((t) => t.trim().replace(/\s+/g, " ")).filter((t) => t.length > 0).join(`
|
|
825
825
|
`);
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function Rt(e) {
|
|
828
828
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Xn(e) {
|
|
831
831
|
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function es(e) {
|
|
834
834
|
if (!e) return !1;
|
|
835
835
|
const t = e.charCodeAt(0);
|
|
836
836
|
return t >= 65 && t <= 90 || t >= 97 && t <= 122;
|
|
837
837
|
}
|
|
838
|
-
function
|
|
838
|
+
function ts(e) {
|
|
839
839
|
if (!e) return !1;
|
|
840
840
|
const t = e.charCodeAt(0);
|
|
841
841
|
return t >= 48 && t <= 57;
|
|
842
842
|
}
|
|
843
843
|
function Ke(e) {
|
|
844
|
-
return
|
|
844
|
+
return es(e) || ts(e);
|
|
845
845
|
}
|
|
846
846
|
const go = `
|
|
847
847
|
\r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");
|
|
@@ -854,16 +854,16 @@ var di = {};
|
|
|
854
854
|
function wo(e, t, n, s, o) {
|
|
855
855
|
return e.slice(0, t) + s + e.slice(t, t + n) + o + e.slice(t + n);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function rs(e, t, n = 0) {
|
|
858
858
|
const s = t.exec(e.slice(n));
|
|
859
859
|
return s ? { index: s.index, match: s[0] } : null;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function ns(e, t, n = !0) {
|
|
862
862
|
if (!n) return t.every((o) => o instanceof RegExp ? o.test(e) : e.indexOf(o, 0) !== -1);
|
|
863
863
|
let s = 0;
|
|
864
864
|
for (const o of t)
|
|
865
865
|
if (o instanceof RegExp) {
|
|
866
|
-
const d =
|
|
866
|
+
const d = rs(e, o, s);
|
|
867
867
|
if (!d) return !1;
|
|
868
868
|
s = d.index + d.match.length;
|
|
869
869
|
} else {
|
|
@@ -877,7 +877,7 @@ var di = {};
|
|
|
877
877
|
let s = 0;
|
|
878
878
|
for (const o of t) {
|
|
879
879
|
let d = !1;
|
|
880
|
-
for (; !d && s < e.length; )
|
|
880
|
+
for (; !d && s < e.length; ) ns(e[s], o, n) && (d = !0), s++;
|
|
881
881
|
if (!d) return !1;
|
|
882
882
|
}
|
|
883
883
|
return !0;
|
|
@@ -901,10 +901,10 @@ var di = {};
|
|
|
901
901
|
for (let n = t; n < e.length; n++) if (e[n] === "#" && Ke(e[n + 1])) return n;
|
|
902
902
|
return -1;
|
|
903
903
|
}
|
|
904
|
-
function
|
|
904
|
+
function ss(e, t, n = 0) {
|
|
905
905
|
return e.slice(0, n).lastIndexOf(t);
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function is(e, t = 0, n = "{", s = "}") {
|
|
908
908
|
let o = 1;
|
|
909
909
|
for (let d = t; d < e.length; d++)
|
|
910
910
|
if (e.slice(d, d + s.length) === s) {
|
|
@@ -912,7 +912,7 @@ var di = {};
|
|
|
912
912
|
} else e.slice(d, d + n.length) === n && o++;
|
|
913
913
|
return -1;
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function as(e, t) {
|
|
916
916
|
const n = t.wordBoundary ? $e(
|
|
917
917
|
e,
|
|
918
918
|
[
|
|
@@ -923,7 +923,7 @@ var di = {};
|
|
|
923
923
|
t.start || 0
|
|
924
924
|
) : e.indexOf(t.opening, t.start || 0);
|
|
925
925
|
if (n === -1) return null;
|
|
926
|
-
const s =
|
|
926
|
+
const s = is(e, n + t.opening.length, t.opening, t.closing);
|
|
927
927
|
return s === -1 ? null : t.exclusive ? e.slice(n + t.opening.length, s) : e.slice(n, s + t.closing.length);
|
|
928
928
|
}
|
|
929
929
|
function Eo(e, t) {
|
|
@@ -939,7 +939,7 @@ var di = {};
|
|
|
939
939
|
) : e.indexOf(t.opening, t.start || 0);
|
|
940
940
|
for (; ; ) {
|
|
941
941
|
if (s === -1) return n;
|
|
942
|
-
const o =
|
|
942
|
+
const o = as(e, { ...t, start: s });
|
|
943
943
|
if (!o) return n;
|
|
944
944
|
n.push(o), s = t.wordBoundary ? $e(
|
|
945
945
|
e,
|
|
@@ -1023,37 +1023,37 @@ var di = {};
|
|
|
1023
1023
|
}
|
|
1024
1024
|
return t;
|
|
1025
1025
|
}
|
|
1026
|
-
const
|
|
1026
|
+
const os = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", cs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
1027
1027
|
function Io(e) {
|
|
1028
|
-
return
|
|
1028
|
+
return us(e, os);
|
|
1029
1029
|
}
|
|
1030
1030
|
function Mo(e) {
|
|
1031
|
-
return
|
|
1031
|
+
return ls(e, os);
|
|
1032
1032
|
}
|
|
1033
1033
|
function $o(e) {
|
|
1034
|
-
return
|
|
1034
|
+
return us(e, cs);
|
|
1035
1035
|
}
|
|
1036
1036
|
function Ro(e) {
|
|
1037
|
-
return
|
|
1037
|
+
return ls(e, cs);
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function us(e, t) {
|
|
1040
1040
|
const n = "=", s = t.length;
|
|
1041
1041
|
let o = 0, d = 0;
|
|
1042
|
-
const
|
|
1042
|
+
const m = [];
|
|
1043
1043
|
for (let v = 0; v < e.length; v++) {
|
|
1044
|
-
const
|
|
1045
|
-
if (
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1048
|
-
d = d << Math.log2(s) |
|
|
1044
|
+
const p = e[v];
|
|
1045
|
+
if (p === n) break;
|
|
1046
|
+
const k = t.indexOf(p);
|
|
1047
|
+
if (k === -1) throw new Error(`Invalid character: ${p}`);
|
|
1048
|
+
d = d << Math.log2(s) | k, o += Math.log2(s), o >= 8 && (o -= 8, m.push(d >> o & 255));
|
|
1049
1049
|
}
|
|
1050
|
-
return new Uint8Array(
|
|
1050
|
+
return new Uint8Array(m);
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function ls(e, t) {
|
|
1053
1053
|
const n = t.length;
|
|
1054
1054
|
let s = 0, o = 0, d = "";
|
|
1055
|
-
for (let
|
|
1056
|
-
for (o = o << 8 | e[
|
|
1055
|
+
for (let m = 0; m < e.length; m++)
|
|
1056
|
+
for (o = o << 8 | e[m], s += 8; s >= Math.log2(n); ) s -= Math.log2(n), d += t[o >> s & n - 1];
|
|
1057
1057
|
return s > 0 && (d += t[o << Math.log2(n) - s & n - 1]), d.length % 4 !== 0 && (d += "=".repeat(4 - d.length % 4)), d;
|
|
1058
1058
|
}
|
|
1059
1059
|
function Co(e) {
|
|
@@ -1073,9 +1073,9 @@ var di = {};
|
|
|
1073
1073
|
if (n.length !== s.length) return null;
|
|
1074
1074
|
const o = {};
|
|
1075
1075
|
for (let d = 0; d < n.length; d++) {
|
|
1076
|
-
const
|
|
1077
|
-
if (
|
|
1078
|
-
else if (
|
|
1076
|
+
const m = n[d];
|
|
1077
|
+
if (m.startsWith(":")) o[m.slice(1)] = s[d];
|
|
1078
|
+
else if (m !== s[d]) return null;
|
|
1079
1079
|
}
|
|
1080
1080
|
return o;
|
|
1081
1081
|
}
|
|
@@ -1086,23 +1086,23 @@ var di = {};
|
|
|
1086
1086
|
}
|
|
1087
1087
|
function Do(e, t, n, s = Math.random) {
|
|
1088
1088
|
const o = a.Arrays.shuffle(
|
|
1089
|
-
t.map((
|
|
1089
|
+
t.map((m) => ({
|
|
1090
1090
|
variants: a.Arrays.shuffle(
|
|
1091
|
-
|
|
1091
|
+
m.variants.map((v) => v),
|
|
1092
1092
|
s
|
|
1093
1093
|
),
|
|
1094
|
-
avoid:
|
|
1094
|
+
avoid: m.avoid
|
|
1095
1095
|
})),
|
|
1096
1096
|
s
|
|
1097
1097
|
), d = [];
|
|
1098
|
-
for (const
|
|
1099
|
-
const v =
|
|
1100
|
-
if (
|
|
1098
|
+
for (const m of o) {
|
|
1099
|
+
const v = m.variants.filter((k) => k !== m.avoid), p = v.find((k) => e.includes(k));
|
|
1100
|
+
if (p && (Mt(d, lr(e, p, v)), d.length >= n)) break;
|
|
1101
1101
|
}
|
|
1102
1102
|
if (d.length < n)
|
|
1103
|
-
for (const
|
|
1104
|
-
const v =
|
|
1105
|
-
if (v && (
|
|
1103
|
+
for (const m of o) {
|
|
1104
|
+
const v = m.variants.find((p) => e.includes(p));
|
|
1105
|
+
if (v && (Mt(d, lr(e, v, m.variants)), d.length >= n)) break;
|
|
1106
1106
|
}
|
|
1107
1107
|
return d.slice(0, n);
|
|
1108
1108
|
}
|
|
@@ -1117,7 +1117,7 @@ var di = {};
|
|
|
1117
1117
|
function Zo(e) {
|
|
1118
1118
|
return e.replace(/<[^>]*>/g, "");
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function ds(e) {
|
|
1121
1121
|
const t = e.lastIndexOf(" ");
|
|
1122
1122
|
if (t === -1) return { line: e, rest: "" };
|
|
1123
1123
|
const n = e.slice(0, t), s = e.slice(t + 1);
|
|
@@ -1129,11 +1129,11 @@ var di = {};
|
|
|
1129
1129
|
function Lo(e, t, n = {}) {
|
|
1130
1130
|
const s = [];
|
|
1131
1131
|
let o = "", d = 0;
|
|
1132
|
-
for (let
|
|
1133
|
-
const v = e[
|
|
1134
|
-
if (o += v, d +=
|
|
1135
|
-
const { line:
|
|
1136
|
-
s.push(
|
|
1132
|
+
for (let m = 0; m < e.length; m++) {
|
|
1133
|
+
const v = e[m], p = n[v] || 1;
|
|
1134
|
+
if (o += v, d += p, d > t) {
|
|
1135
|
+
const { line: k, rest: M } = ds(o);
|
|
1136
|
+
s.push(k), o = M, d = M.split("").map((U) => n[U] || 1).reduce((U, je) => U + je, 0);
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
1139
|
return o && s.push(o), s;
|
|
@@ -1164,38 +1164,38 @@ var di = {};
|
|
|
1164
1164
|
}
|
|
1165
1165
|
return t;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function Ct(e, t, n = []) {
|
|
1168
1168
|
let s = "";
|
|
1169
1169
|
for (; t < e.length && (Ke(e[t]) || n.includes(e[t])); ) s += e[t++];
|
|
1170
1170
|
return s;
|
|
1171
1171
|
}
|
|
1172
1172
|
function Wo(e, t, n = "$", s = ":") {
|
|
1173
|
-
for (const o in t) e =
|
|
1174
|
-
return e =
|
|
1173
|
+
for (const o in t) e = fs(e, o, t[o], n, s);
|
|
1174
|
+
return e = hs(e), e;
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function fs(e, t, n, s = "$", o = ":") {
|
|
1177
1177
|
if (n === "") return e;
|
|
1178
1178
|
let d = e.indexOf(`${s}${t}`);
|
|
1179
1179
|
for (; d !== -1; ) {
|
|
1180
1180
|
if (e[d + t.length + 1] === o)
|
|
1181
1181
|
if (e[d + t.length + 2] === o) e = e.replace(`${s}${t}${o}${o}`, n);
|
|
1182
1182
|
else {
|
|
1183
|
-
const
|
|
1184
|
-
e = e.replace(`${s}${t}${o}${
|
|
1183
|
+
const m = Ct(e, d + t.length + 2, ["_"]);
|
|
1184
|
+
e = e.replace(`${s}${t}${o}${m}`, n);
|
|
1185
1185
|
}
|
|
1186
1186
|
else e = e.replace(`${s}${t}`, n);
|
|
1187
1187
|
d = e.indexOf(`${s}${t}`, d + n.length);
|
|
1188
1188
|
}
|
|
1189
1189
|
return e;
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function hs(e, t = "$", n = ":") {
|
|
1192
1192
|
let s = e.indexOf(t);
|
|
1193
1193
|
for (; s !== -1; ) {
|
|
1194
|
-
const o =
|
|
1194
|
+
const o = Ct(e, s + 1);
|
|
1195
1195
|
if (e[s + o.length + 1] === n)
|
|
1196
1196
|
if (e[s + o.length + 2] === n) e = e.replace(`${t}${o}${n}${n}`, "");
|
|
1197
1197
|
else {
|
|
1198
|
-
const d =
|
|
1198
|
+
const d = Ct(e, s + o.length + 2);
|
|
1199
1199
|
e = e.replace(`${t}${o}${n}${d}`, d);
|
|
1200
1200
|
}
|
|
1201
1201
|
s = e.indexOf(t, s + 1);
|
|
@@ -1205,9 +1205,9 @@ var di = {};
|
|
|
1205
1205
|
function Ho(e, t) {
|
|
1206
1206
|
let n = e.indexOf("](");
|
|
1207
1207
|
for (; n !== -1; ) {
|
|
1208
|
-
const s =
|
|
1208
|
+
const s = ss(e, "[", n), o = e.indexOf(")", n);
|
|
1209
1209
|
if (s !== -1 && o !== -1) {
|
|
1210
|
-
const [d,
|
|
1210
|
+
const [d, m] = e.slice(s + 1, o).split("]("), v = t(d, m);
|
|
1211
1211
|
e = e.slice(0, s) + v + e.slice(o + 1);
|
|
1212
1212
|
}
|
|
1213
1213
|
n = e.indexOf("](", n + 1);
|
|
@@ -1232,14 +1232,14 @@ var di = {};
|
|
|
1232
1232
|
function Jo(e, t) {
|
|
1233
1233
|
let n = null, s = -1 / 0;
|
|
1234
1234
|
for (const [o, d] of Object.entries(e)) {
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1235
|
+
const m = t(d);
|
|
1236
|
+
m > s && (s = m, n = o);
|
|
1237
1237
|
}
|
|
1238
1238
|
return n ? [n, e[n]] : null;
|
|
1239
1239
|
}
|
|
1240
1240
|
function Ko(e, t, n, s) {
|
|
1241
|
-
const o = e.find((
|
|
1242
|
-
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((
|
|
1241
|
+
const o = e.find((m) => m[t] === n), d = e.find((m) => m[t] === n + s);
|
|
1242
|
+
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((m, v) => Ot(m[t]) - Ot(v[t])), e.forEach((m, v) => m[t] = v + 1);
|
|
1243
1243
|
}
|
|
1244
1244
|
function Yo(e) {
|
|
1245
1245
|
const t = Object.keys(e);
|
|
@@ -1252,19 +1252,19 @@ var di = {};
|
|
|
1252
1252
|
);
|
|
1253
1253
|
}
|
|
1254
1254
|
function Xo(e, t, n) {
|
|
1255
|
-
return
|
|
1255
|
+
return vs(e, t) + ms(n || {});
|
|
1256
1256
|
}
|
|
1257
1257
|
function ec(e, t = ",", n = '"') {
|
|
1258
1258
|
const s = [];
|
|
1259
1259
|
let o = "", d = !1;
|
|
1260
|
-
const
|
|
1261
|
-
for (const v of
|
|
1260
|
+
const m = e.split("");
|
|
1261
|
+
for (const v of m) v === t && !d ? (s.push(o), o = "") : v === n && (!o && !d || d) ? d = !d : o += v;
|
|
1262
1262
|
return s.push(o), s;
|
|
1263
1263
|
}
|
|
1264
1264
|
function tc(e) {
|
|
1265
|
-
return `[${Math.floor(e.progress * 100)}%] ${
|
|
1265
|
+
return `[${Math.floor(e.progress * 100)}%] ${Nt(e.deltaMs)} out of ${Nt(
|
|
1266
1266
|
e.totalTimeMs
|
|
1267
|
-
)} (${
|
|
1267
|
+
)} (${Nt(e.remainingTimeMs)} left) [${Math.round(e.baseTimeMs)} ms each]`;
|
|
1268
1268
|
}
|
|
1269
1269
|
async function rc(e, t, n) {
|
|
1270
1270
|
for (let s = 0; s < n; s++) {
|
|
@@ -1309,7 +1309,7 @@ var di = {};
|
|
|
1309
1309
|
let s = gr(nr(t), 0, 23), o = gr(nr(n), 0, 59);
|
|
1310
1310
|
return `${K(s)}:${K(o)}`;
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function Nt(e) {
|
|
1313
1313
|
const t = Math.floor(e / 36e5);
|
|
1314
1314
|
e = e % 36e5;
|
|
1315
1315
|
const n = Math.floor(e / 6e4);
|
|
@@ -1339,7 +1339,7 @@ var di = {};
|
|
|
1339
1339
|
const d = hr(o);
|
|
1340
1340
|
return be(n) - be(o) < 7 ? s[d.day]() : s.weeks(Math.round((n.getTime() - o.getTime()) / 6048e5));
|
|
1341
1341
|
}
|
|
1342
|
-
const
|
|
1342
|
+
const ps = {
|
|
1343
1343
|
now: () => "A few seconds",
|
|
1344
1344
|
seconds: (e) => `${e} seconds`,
|
|
1345
1345
|
minutes: (e) => `${e} minutes`,
|
|
@@ -1347,20 +1347,20 @@ var di = {};
|
|
|
1347
1347
|
days: (e) => `${e} days`,
|
|
1348
1348
|
weeks: (e) => `${e} weeks`
|
|
1349
1349
|
};
|
|
1350
|
-
function
|
|
1351
|
-
const n = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) ||
|
|
1350
|
+
function gs(e, t) {
|
|
1351
|
+
const n = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) || ps, o = a.Types.isDate(e) ? e.getTime() : e;
|
|
1352
1352
|
let d = (n - o) / 1e3;
|
|
1353
1353
|
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))))));
|
|
1354
1354
|
}
|
|
1355
|
-
function hc(e, t =
|
|
1356
|
-
return
|
|
1355
|
+
function hc(e, t = ps) {
|
|
1356
|
+
return gs(0, { now: e * 1e3, labels: t });
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1358
|
+
function mc(e, t, n) {
|
|
1359
1359
|
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));
|
|
1360
1360
|
return { cycles: o, remaining: d };
|
|
1361
1361
|
}
|
|
1362
1362
|
const fr = {};
|
|
1363
|
-
function
|
|
1363
|
+
function pc(e, t) {
|
|
1364
1364
|
return !fr[e] || Date.now() > fr[e] ? (fr[e] = Date.now() + t, !0) : !1;
|
|
1365
1365
|
}
|
|
1366
1366
|
const gc = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
@@ -1369,8 +1369,8 @@ var di = {};
|
|
|
1369
1369
|
}
|
|
1370
1370
|
function vc(e, t, n, s) {
|
|
1371
1371
|
s || (s = Date.now());
|
|
1372
|
-
const o = t / n, d = s - e,
|
|
1373
|
-
return { deltaMs: d, progress: o, baseTimeMs:
|
|
1372
|
+
const o = t / n, d = s - e, m = d / t, v = m * n, p = v - d;
|
|
1373
|
+
return { deltaMs: d, progress: o, baseTimeMs: m, totalTimeMs: v, remainingTimeMs: p };
|
|
1374
1374
|
}
|
|
1375
1375
|
const wc = {
|
|
1376
1376
|
0: "sunday",
|
|
@@ -1381,11 +1381,11 @@ var di = {};
|
|
|
1381
1381
|
5: "friday",
|
|
1382
1382
|
6: "saturday"
|
|
1383
1383
|
};
|
|
1384
|
-
function
|
|
1384
|
+
function ys(e) {
|
|
1385
1385
|
return { zeroBasedIndex: e, day: wc[e] };
|
|
1386
1386
|
}
|
|
1387
1387
|
function hr(e) {
|
|
1388
|
-
return
|
|
1388
|
+
return ys(e.getDay());
|
|
1389
1389
|
}
|
|
1390
1390
|
function bc(e) {
|
|
1391
1391
|
return hr(new Date(e));
|
|
@@ -1465,23 +1465,23 @@ var di = {};
|
|
|
1465
1465
|
function Ic(e) {
|
|
1466
1466
|
return e.replace(/ +/g, " ").replace(/^ /gm, "");
|
|
1467
1467
|
}
|
|
1468
|
-
const
|
|
1468
|
+
const mr = {};
|
|
1469
1469
|
async function Mc(e, t, n) {
|
|
1470
|
-
const s = Date.now(), o =
|
|
1470
|
+
const s = Date.now(), o = mr[e];
|
|
1471
1471
|
if (o && o.validUntil > s) return o.value;
|
|
1472
|
-
const d = await n(),
|
|
1473
|
-
return
|
|
1472
|
+
const d = await n(), m = s + t;
|
|
1473
|
+
return mr[e] = { value: d, validUntil: m }, d;
|
|
1474
1474
|
}
|
|
1475
1475
|
function $c(e) {
|
|
1476
|
-
delete
|
|
1476
|
+
delete mr[e];
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function vs(...e) {
|
|
1479
1479
|
return e.filter((t) => t).join("/").replace(new RegExp("(?<!:)\\/+", "g"), "/");
|
|
1480
1480
|
}
|
|
1481
1481
|
function Rc(e, t, n, s, o = !0) {
|
|
1482
|
-
const d = e.indexOf(t),
|
|
1483
|
-
if (d === -1 ||
|
|
1484
|
-
return o ? e.substring(0, d + t.length) + s + e.substring(
|
|
1482
|
+
const d = e.indexOf(t), m = e.indexOf(n, d + t.length);
|
|
1483
|
+
if (d === -1 || m === -1) throw Error("Start or end not found");
|
|
1484
|
+
return o ? e.substring(0, d + t.length) + s + e.substring(m) : e.substring(0, d) + s + e.substring(m + n.length);
|
|
1485
1485
|
}
|
|
1486
1486
|
function Cc(e) {
|
|
1487
1487
|
let t = "p";
|
|
@@ -1502,23 +1502,23 @@ var di = {};
|
|
|
1502
1502
|
for (; e = e.replace(/(\w+)[\s,']+\w+/g, "$1"), e.length !== t; ) t = e.length;
|
|
1503
1503
|
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;
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1505
|
+
function ws(e) {
|
|
1506
1506
|
const t = Object.keys(e).sort((s, o) => s.localeCompare(o)), n = {};
|
|
1507
1507
|
for (const s of t) n[s] = _e(e[s]);
|
|
1508
1508
|
return n;
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1510
|
+
function bs(e) {
|
|
1511
1511
|
const t = [];
|
|
1512
1512
|
return e.sort((n, s) => JSON.stringify(_e(n)).localeCompare(JSON.stringify(_e(s)))).forEach((n) => t.push(_e(n))), t;
|
|
1513
1513
|
}
|
|
1514
1514
|
function _e(e) {
|
|
1515
|
-
return Array.isArray(e) ?
|
|
1515
|
+
return Array.isArray(e) ? bs(e) : ce(e) ? ws(e) : e;
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function _s(e, t) {
|
|
1518
1518
|
return JSON.stringify(_e(e)) === JSON.stringify(_e(t));
|
|
1519
1519
|
}
|
|
1520
1520
|
function Dc(...e) {
|
|
1521
|
-
for (let t = 1; t < e.length; t++) if (!
|
|
1521
|
+
for (let t = 1; t < e.length; t++) if (!_s(e[t - 1], e[t])) return !1;
|
|
1522
1522
|
return !0;
|
|
1523
1523
|
}
|
|
1524
1524
|
function Uc(e) {
|
|
@@ -1545,11 +1545,11 @@ var di = {};
|
|
|
1545
1545
|
}
|
|
1546
1546
|
function Lc(e, t, n, s, o) {
|
|
1547
1547
|
const d = {};
|
|
1548
|
-
for (const
|
|
1548
|
+
for (const m of Object.keys(t)) d[m] = [];
|
|
1549
1549
|
d[s] = [], o && (e = e.sort(o));
|
|
1550
|
-
for (const
|
|
1551
|
-
const v =
|
|
1552
|
-
d[
|
|
1550
|
+
for (const m of e) {
|
|
1551
|
+
const v = m[n], p = t[v] ? v : s;
|
|
1552
|
+
d[p].length >= t[p] ? d[s].push(m) : d[p].push(m);
|
|
1553
1553
|
}
|
|
1554
1554
|
return d;
|
|
1555
1555
|
}
|
|
@@ -1557,12 +1557,12 @@ var di = {};
|
|
|
1557
1557
|
const n = Object.keys(e), s = Object.keys(t);
|
|
1558
1558
|
return { uniqueToA: n.filter((o) => !s.includes(o)), uniqueToB: s.filter((o) => !n.includes(o)) };
|
|
1559
1559
|
}
|
|
1560
|
-
function
|
|
1560
|
+
function xs(e) {
|
|
1561
1561
|
const t = Object.keys(e);
|
|
1562
1562
|
return t[Math.floor(Math.random() * t.length)];
|
|
1563
1563
|
}
|
|
1564
1564
|
function Vc(e, t) {
|
|
1565
|
-
const n =
|
|
1565
|
+
const n = xs(e);
|
|
1566
1566
|
return e[n] = t(e[n]), n;
|
|
1567
1567
|
}
|
|
1568
1568
|
function Fc(e) {
|
|
@@ -1589,7 +1589,7 @@ var di = {};
|
|
|
1589
1589
|
"eth",
|
|
1590
1590
|
"dai",
|
|
1591
1591
|
"decillion"
|
|
1592
|
-
],
|
|
1592
|
+
], ks = ["K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "O", "N", "gwei", "bzz", "eth", "btc", "dai", "D"];
|
|
1593
1593
|
function Hc(e, t, n) {
|
|
1594
1594
|
let s = e.length - t;
|
|
1595
1595
|
if (s <= 0) return "0." + "0".repeat(-s) + e + (n ? " " + n : "");
|
|
@@ -1597,16 +1597,16 @@ var di = {};
|
|
|
1597
1597
|
return o === "" && (o = "0"), o + "." + d + (n ? " " + n : "");
|
|
1598
1598
|
}
|
|
1599
1599
|
function qc(e, t) {
|
|
1600
|
-
const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc :
|
|
1600
|
+
const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc : ks, d = (t == null ? void 0 : t.precision) ?? 1;
|
|
1601
1601
|
if (e < le[0]) return `${e}${s}`;
|
|
1602
|
-
for (let
|
|
1603
|
-
if (e < le[
|
|
1602
|
+
for (let m = 0; m < le.length - 1; m++)
|
|
1603
|
+
if (e < le[m + 1]) return `${(e / le[m]).toFixed(d)}${n ? " " : ""}${o[m]}${s}`;
|
|
1604
1604
|
return `${(e / le[le.length - 1]).toFixed(d)}${n ? " " : ""}${o[le.length - 1]}${s}`;
|
|
1605
1605
|
}
|
|
1606
|
-
function
|
|
1606
|
+
function pr(e) {
|
|
1607
1607
|
const t = parseFloat(e);
|
|
1608
1608
|
if (isNaN(t)) throw Error("makeNumber got NaN for input");
|
|
1609
|
-
const n = e.replace(/^-?[0-9.]+/, "").trim(), s =
|
|
1609
|
+
const n = e.replace(/^-?[0-9.]+/, "").trim(), s = ks.findIndex((o) => o.toLowerCase() === n.toLowerCase());
|
|
1610
1610
|
return s === -1 ? t : t * le[s];
|
|
1611
1611
|
}
|
|
1612
1612
|
function gr(e, t, n) {
|
|
@@ -1628,19 +1628,19 @@ var di = {};
|
|
|
1628
1628
|
}
|
|
1629
1629
|
function Qc(e, t) {
|
|
1630
1630
|
const n = Object.keys(t);
|
|
1631
|
-
for (const s of n) Array.isArray(t[s]) && Array.isArray(e[s]) &&
|
|
1631
|
+
for (const s of n) Array.isArray(t[s]) && Array.isArray(e[s]) && Mt(e[s], t[s]);
|
|
1632
1632
|
}
|
|
1633
1633
|
function Xc(e) {
|
|
1634
1634
|
return e.splice(0, e.length), e;
|
|
1635
1635
|
}
|
|
1636
1636
|
function eu(e) {
|
|
1637
1637
|
for (const t of Object.keys(e))
|
|
1638
|
-
(
|
|
1638
|
+
(Dn(e[t]) || Array.isArray(e[t]) && e[t].every((n) => n == null)) && delete e[t];
|
|
1639
1639
|
return e;
|
|
1640
1640
|
}
|
|
1641
1641
|
function tu(e) {
|
|
1642
1642
|
for (const t of Object.entries(e))
|
|
1643
|
-
(t[1] === null || t[1] === void 0 || F(t[1]) &&
|
|
1643
|
+
(t[1] === null || t[1] === void 0 || F(t[1]) && At(t[1])) && delete e[t[0]];
|
|
1644
1644
|
return e;
|
|
1645
1645
|
}
|
|
1646
1646
|
function ru(e, t) {
|
|
@@ -1684,20 +1684,20 @@ var di = {};
|
|
|
1684
1684
|
return t;
|
|
1685
1685
|
}
|
|
1686
1686
|
function lu(e) {
|
|
1687
|
-
const t = Object.keys(e), n = t.map((v) => e[v].length), s = n.reduce((v,
|
|
1687
|
+
const t = Object.keys(e), n = t.map((v) => e[v].length), s = n.reduce((v, p) => v *= p);
|
|
1688
1688
|
let o = 1;
|
|
1689
1689
|
const d = [1];
|
|
1690
1690
|
for (let v = 0; v < n.length - 1; v++) o *= n[v], d.push(o);
|
|
1691
|
-
const
|
|
1691
|
+
const m = [];
|
|
1692
1692
|
for (let v = 0; v < s; v++) {
|
|
1693
|
-
const
|
|
1694
|
-
for (let
|
|
1695
|
-
const M = e[t[
|
|
1696
|
-
|
|
1693
|
+
const p = {};
|
|
1694
|
+
for (let k = 0; k < t.length; k++) {
|
|
1695
|
+
const M = e[t[k]], U = Math.floor(v / d[k]) % M.length;
|
|
1696
|
+
p[t[k]] = M[U];
|
|
1697
1697
|
}
|
|
1698
|
-
|
|
1698
|
+
m.push(p);
|
|
1699
1699
|
}
|
|
1700
|
-
return
|
|
1700
|
+
return m;
|
|
1701
1701
|
}
|
|
1702
1702
|
function du(e) {
|
|
1703
1703
|
return Object.values(e).filter((t) => t).length;
|
|
@@ -1705,32 +1705,32 @@ var di = {};
|
|
|
1705
1705
|
function fu(e, t, n) {
|
|
1706
1706
|
return e + (n ? "[" + t + "]" : (e.length ? "." : "") + t);
|
|
1707
1707
|
}
|
|
1708
|
-
function
|
|
1708
|
+
function jt(e, t, n, s, o) {
|
|
1709
1709
|
if (!ce(t)) return t;
|
|
1710
|
-
for (const [d,
|
|
1710
|
+
for (const [d, m] of Object.entries(t)) {
|
|
1711
1711
|
const v = fu(n, d, s);
|
|
1712
|
-
Array.isArray(
|
|
1712
|
+
Array.isArray(m) ? o ? jt(e, m, v, !0, o) : e[v] = m.map((p) => jt(Array.isArray(p) ? [] : {}, p, "", !1, o)) : ce(m) ? jt(e, m, v, !1, o) : e[v] = m;
|
|
1713
1713
|
}
|
|
1714
1714
|
return e;
|
|
1715
1715
|
}
|
|
1716
1716
|
function hu(e, t = !1, n) {
|
|
1717
|
-
return
|
|
1717
|
+
return jt({}, e, n || "", !1, t);
|
|
1718
1718
|
}
|
|
1719
|
-
function
|
|
1719
|
+
function Es(e) {
|
|
1720
1720
|
if (!ce(e)) return e;
|
|
1721
1721
|
const t = Array.isArray(e) ? [] : {};
|
|
1722
1722
|
for (const [n, s] of Object.entries(e))
|
|
1723
1723
|
Array.isArray(s) ? ve(
|
|
1724
1724
|
t,
|
|
1725
1725
|
n,
|
|
1726
|
-
s.map((o) =>
|
|
1726
|
+
s.map((o) => Es(o))
|
|
1727
1727
|
) : ve(t, n, s);
|
|
1728
1728
|
return t;
|
|
1729
1729
|
}
|
|
1730
|
-
function
|
|
1730
|
+
function mu(e, t, n) {
|
|
1731
1731
|
return t[e] ? t[e] : n;
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function Ss(e, t) {
|
|
1734
1734
|
const n = {};
|
|
1735
1735
|
for (const s of e) {
|
|
1736
1736
|
const o = t(s);
|
|
@@ -1738,7 +1738,7 @@ var di = {};
|
|
|
1738
1738
|
}
|
|
1739
1739
|
return n;
|
|
1740
1740
|
}
|
|
1741
|
-
function
|
|
1741
|
+
function pu(e, t) {
|
|
1742
1742
|
const n = {};
|
|
1743
1743
|
for (const s of e) {
|
|
1744
1744
|
const o = t(s);
|
|
@@ -1751,37 +1751,37 @@ var di = {};
|
|
|
1751
1751
|
for (let s = 0; s < e.length; s += t) n.push(e.slice(s, s + t));
|
|
1752
1752
|
return n;
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1754
|
+
function Ts(e, t) {
|
|
1755
1755
|
const n = Math.ceil(e.length / t), s = [];
|
|
1756
1756
|
for (let o = 0; o < e.length; o += n) s.push(e.slice(o, o + n));
|
|
1757
1757
|
return s;
|
|
1758
1758
|
}
|
|
1759
|
-
function
|
|
1759
|
+
function As(e, t) {
|
|
1760
1760
|
const n = [], s = Math.ceil(e.length / t);
|
|
1761
1761
|
for (let o = 0; o < s; o++) n.push(e.slice(o * t, o * t + t));
|
|
1762
1762
|
return n;
|
|
1763
1763
|
}
|
|
1764
1764
|
function yu(e, t) {
|
|
1765
1765
|
const n = Math.ceil(e.length / t);
|
|
1766
|
-
return
|
|
1766
|
+
return As(e, n);
|
|
1767
1767
|
}
|
|
1768
1768
|
function vu(e, t) {
|
|
1769
|
-
return Object.values(
|
|
1769
|
+
return Object.values(Ss(e, t));
|
|
1770
1770
|
}
|
|
1771
1771
|
function wu(e, t, n, s, o) {
|
|
1772
|
-
const d = t ? e.map(t) : e,
|
|
1773
|
-
for (const
|
|
1774
|
-
const v = s ?
|
|
1772
|
+
const d = t ? e.map(t) : e, m = {};
|
|
1773
|
+
for (const p of d) m[p] = (m[p] || 0) + 1;
|
|
1774
|
+
const v = s ? Os(m, o ? (p, k) => p[1] - k[1] : (p, k) => k[1] - p[1]) : m;
|
|
1775
1775
|
return n ? Object.keys(v) : v;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1777
|
+
function Os(e, t) {
|
|
1778
1778
|
return Object.fromEntries(Object.entries(e).sort(t));
|
|
1779
1779
|
}
|
|
1780
1780
|
function bu(e) {
|
|
1781
1781
|
const t = [], n = Object.keys(e), s = e[n[0]].length;
|
|
1782
1782
|
for (let o = 0; o < s; o++) {
|
|
1783
1783
|
const d = {};
|
|
1784
|
-
for (const
|
|
1784
|
+
for (const m of n) d[m] = e[m][o];
|
|
1785
1785
|
t.push(d);
|
|
1786
1786
|
}
|
|
1787
1787
|
return t;
|
|
@@ -1805,7 +1805,7 @@ var di = {};
|
|
|
1805
1805
|
function Eu() {
|
|
1806
1806
|
return { map: /* @__PURE__ */ new Map(), keys: [] };
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function Is(e, t, n, s = 100) {
|
|
1809
1809
|
if (e.map.has(t)) {
|
|
1810
1810
|
const o = e.keys.indexOf(t);
|
|
1811
1811
|
e.keys.splice(o, 1);
|
|
@@ -1826,7 +1826,7 @@ var di = {};
|
|
|
1826
1826
|
}
|
|
1827
1827
|
}
|
|
1828
1828
|
function Tu(e, t, n, s, o = 100) {
|
|
1829
|
-
|
|
1829
|
+
Is(e, t, { validUntil: Date.now() + s, data: n }, o);
|
|
1830
1830
|
}
|
|
1831
1831
|
function Au(e, t) {
|
|
1832
1832
|
const n = e.map.get(t);
|
|
@@ -1917,28 +1917,28 @@ var di = {};
|
|
|
1917
1917
|
}
|
|
1918
1918
|
}
|
|
1919
1919
|
function Uu(e, t, n, s, o = !1) {
|
|
1920
|
-
const d = /* @__PURE__ */ new Map(),
|
|
1921
|
-
e.forEach((
|
|
1922
|
-
const
|
|
1923
|
-
d.set(
|
|
1924
|
-
}), e.forEach((
|
|
1925
|
-
const
|
|
1926
|
-
if (!
|
|
1927
|
-
const M =
|
|
1920
|
+
const d = /* @__PURE__ */ new Map(), m = [];
|
|
1921
|
+
e.forEach((p) => {
|
|
1922
|
+
const k = new Du(p);
|
|
1923
|
+
d.set(p[t], k);
|
|
1924
|
+
}), e.forEach((p) => {
|
|
1925
|
+
const k = d.get(p[t]);
|
|
1926
|
+
if (!k) return;
|
|
1927
|
+
const M = p[n];
|
|
1928
1928
|
if (M) {
|
|
1929
1929
|
const U = d.get(M);
|
|
1930
|
-
U && U.children.push(
|
|
1931
|
-
} else
|
|
1930
|
+
U && U.children.push(k);
|
|
1931
|
+
} else m.push(k);
|
|
1932
1932
|
});
|
|
1933
|
-
const v = (
|
|
1934
|
-
|
|
1935
|
-
const U =
|
|
1933
|
+
const v = (p) => {
|
|
1934
|
+
p.children.sort((k, M) => {
|
|
1935
|
+
const U = k.value[s], je = M.value[s];
|
|
1936
1936
|
return o ? je - U : U - je;
|
|
1937
|
-
}),
|
|
1937
|
+
}), p.children.forEach(v);
|
|
1938
1938
|
};
|
|
1939
|
-
return
|
|
1939
|
+
return m.forEach(v), m;
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Ms(e, t) {
|
|
1942
1942
|
if (Math.log2(e.length) % 1 !== 0) throw new Error("Array length must be a power of 2");
|
|
1943
1943
|
let n = [...e];
|
|
1944
1944
|
for (; n.length > 1; ) {
|
|
@@ -1958,17 +1958,17 @@ var di = {};
|
|
|
1958
1958
|
n.set(o, s), s += o.length;
|
|
1959
1959
|
}), n;
|
|
1960
1960
|
}
|
|
1961
|
-
function
|
|
1961
|
+
function $s(e) {
|
|
1962
1962
|
return e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71;
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1964
|
+
function Rs(e) {
|
|
1965
1965
|
return e[0] === 255 && e[1] === 216;
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1967
|
+
function Cs(e) {
|
|
1968
1968
|
return e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80;
|
|
1969
1969
|
}
|
|
1970
1970
|
function Pu(e) {
|
|
1971
|
-
return
|
|
1971
|
+
return $s(e) || Rs(e) || Cs(e);
|
|
1972
1972
|
}
|
|
1973
1973
|
function Zu(e) {
|
|
1974
1974
|
return new Uint8Array([e]);
|
|
@@ -2027,7 +2027,7 @@ var di = {};
|
|
|
2027
2027
|
for (let s = 0; s < e.length; s += t) n.push(e.subarray(s, s + t));
|
|
2028
2028
|
return n;
|
|
2029
2029
|
}
|
|
2030
|
-
const
|
|
2030
|
+
const Ns = [
|
|
2031
2031
|
0,
|
|
2032
2032
|
1,
|
|
2033
2033
|
0,
|
|
@@ -2079,21 +2079,21 @@ var di = {};
|
|
|
2079
2079
|
];
|
|
2080
2080
|
function qu(e) {
|
|
2081
2081
|
for (let t = 0; t < 24; t++) {
|
|
2082
|
-
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],
|
|
2082
|
+
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], m = 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], k = e[7] ^ e[17] ^ e[27] ^ e[37] ^ e[47], M = 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, Il = d << 1 | o >>> 31, Xe = M ^ je, et = U ^ Il, Ml = m << 1 | v >>> 31, $l = v << 1 | m >>> 31, tt = n ^ Ml, rt = s ^ $l, Rl = p << 1 | k >>> 31, Cl = k << 1 | p >>> 31, nt = o ^ Rl, st = d ^ Cl, Nl = M << 1 | U >>> 31, jl = U << 1 | M >>> 31, it = m ^ Nl, at = v ^ jl, Dl = n << 1 | s >>> 31, Ul = s << 1 | n >>> 31, ot = p ^ Dl, ct = k ^ Ul;
|
|
2083
2083
|
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;
|
|
2084
|
-
const Sr = e[0], Tr = e[1], Ar = e[2] << 1 | e[3] >>> 31, Or = e[3] << 1 | e[2] >>> 31, Ir = e[5] << 30 | e[4] >>> 2, Mr = 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, Vr = e[18] << 20 | e[19] >>> 12, Fr = 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,
|
|
2085
|
-
e[0] = Sr ^ ~Ur & Jr, e[1] = Tr ^ ~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 & Tr, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Tr & Pr, e[10] = $r ^ ~Vr & Wr, e[11] = Rr ^ ~Fr & Hr, e[12] = Vr ^ ~Wr & nn, e[13] = Fr ^ ~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 & Vr, e[19] = yn ^ ~Rr & Fr, e[20] = Ar ^ ~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 & Ar, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Ar & 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] = Ir ^ ~Lr & Xr, e[41] = Mr ^ ~zr & en, e[42] = Lr ^ ~Xr & tn, e[43] = zr ^ ~en & rn, e[44] = Xr ^ ~tn &
|
|
2084
|
+
const Sr = e[0], Tr = e[1], Ar = e[2] << 1 | e[3] >>> 31, Or = e[3] << 1 | e[2] >>> 31, Ir = e[5] << 30 | e[4] >>> 2, Mr = 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, Vr = e[18] << 20 | e[19] >>> 12, Fr = 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;
|
|
2085
|
+
e[0] = Sr ^ ~Ur & Jr, e[1] = Tr ^ ~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 & Tr, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Tr & Pr, e[10] = $r ^ ~Vr & Wr, e[11] = Rr ^ ~Fr & Hr, e[12] = Vr ^ ~Wr & nn, e[13] = Fr ^ ~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 & Vr, e[19] = yn ^ ~Rr & Fr, e[20] = Ar ^ ~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 & Ar, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Ar & 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] = Ir ^ ~Lr & Xr, e[41] = Mr ^ ~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 & Ir, e[47] = rn ^ ~pn & Mr, e[48] = mn ^ ~Ir & Lr, e[49] = pn ^ ~Mr & zr, e[0] ^= Ns[t * 2], e[1] ^= Ns[t * 2 + 1];
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function js(e) {
|
|
2089
2089
|
const t = [];
|
|
2090
2090
|
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);
|
|
2091
2091
|
return t;
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2093
|
+
function Ds(e, t) {
|
|
2094
2094
|
if (!e.length) {
|
|
2095
2095
|
const o = new Uint8Array(136);
|
|
2096
|
-
return o[0] = t, o[135] = 128, [
|
|
2096
|
+
return o[0] = t, o[135] = 128, [js(o)];
|
|
2097
2097
|
}
|
|
2098
2098
|
const n = wr(e, 136), s = n[n.length - 1];
|
|
2099
2099
|
if (s.length < 136) {
|
|
@@ -2104,16 +2104,16 @@ var di = {};
|
|
|
2104
2104
|
const o = new Uint8Array(136);
|
|
2105
2105
|
o[0] = t, o[135] = 128, n.push(o);
|
|
2106
2106
|
}
|
|
2107
|
-
return n.map(
|
|
2107
|
+
return n.map(js);
|
|
2108
2108
|
}
|
|
2109
|
-
function
|
|
2109
|
+
function Us(e, t) {
|
|
2110
2110
|
for (const n of t) {
|
|
2111
2111
|
for (let s = 0; s < 34; s += 2) e[s] ^= n[s + 1], e[s + 1] ^= n[s];
|
|
2112
2112
|
qu(e);
|
|
2113
2113
|
}
|
|
2114
2114
|
return e;
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function Ps(e) {
|
|
2117
2117
|
return new Uint8Array([
|
|
2118
2118
|
e[1],
|
|
2119
2119
|
e[1] >> -24,
|
|
@@ -2150,16 +2150,16 @@ var di = {};
|
|
|
2150
2150
|
]);
|
|
2151
2151
|
}
|
|
2152
2152
|
function se(e) {
|
|
2153
|
-
return
|
|
2153
|
+
return Ps(Us(new Array(50).fill(0), Ds(e, 1)));
|
|
2154
2154
|
}
|
|
2155
2155
|
function Gu(e) {
|
|
2156
|
-
return
|
|
2156
|
+
return Ps(Us(new Array(50).fill(0), Ds(e, 6)));
|
|
2157
2157
|
}
|
|
2158
2158
|
function Ju(e, t, n) {
|
|
2159
2159
|
const s = Math.min(e.length, t.length, n / 8 + 1);
|
|
2160
2160
|
for (let o = 0; o < s; o++) {
|
|
2161
2161
|
const d = e[o] ^ t[o];
|
|
2162
|
-
for (let
|
|
2162
|
+
for (let m = 0; m < 8; m++) if (d >> 7 - m & 1) return o * 8 + m;
|
|
2163
2163
|
}
|
|
2164
2164
|
return n;
|
|
2165
2165
|
}
|
|
@@ -2181,23 +2181,23 @@ var di = {};
|
|
|
2181
2181
|
for (let o = 0; o < t.length && e[s + o] === t[o]; o++) if (o === t.length - 1) return s;
|
|
2182
2182
|
return -1;
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2184
|
+
function Zs(e, t, n = 0) {
|
|
2185
2185
|
if (e.length >= t) return e;
|
|
2186
2186
|
const s = new Uint8Array(t);
|
|
2187
2187
|
return s.fill(n), s.set(e, t - e.length), s;
|
|
2188
2188
|
}
|
|
2189
2189
|
function el(e, t, n = 0) {
|
|
2190
2190
|
const s = e.length % t;
|
|
2191
|
-
return s === 0 ? e :
|
|
2191
|
+
return s === 0 ? e : Zs(e, e.length + t - s, n);
|
|
2192
2192
|
}
|
|
2193
|
-
function
|
|
2193
|
+
function Bs(e, t, n = 0) {
|
|
2194
2194
|
if (e.length >= t) return e;
|
|
2195
2195
|
const s = new Uint8Array(t);
|
|
2196
2196
|
return s.fill(n), s.set(e, 0), s;
|
|
2197
2197
|
}
|
|
2198
2198
|
function tl(e, t, n = 0) {
|
|
2199
2199
|
const s = e.length % t;
|
|
2200
|
-
return s === 0 ? e :
|
|
2200
|
+
return s === 0 ? e : Bs(e, e.length + t - s, n);
|
|
2201
2201
|
}
|
|
2202
2202
|
function rl(e, t) {
|
|
2203
2203
|
const n = new Uint8Array(e.length);
|
|
@@ -2216,8 +2216,8 @@ var di = {};
|
|
|
2216
2216
|
e = $(e, t);
|
|
2217
2217
|
let [n, s] = [0n, 1n], [o, d] = [t, e];
|
|
2218
2218
|
for (; d !== 0n; ) {
|
|
2219
|
-
const
|
|
2220
|
-
[n, s] = [s, n -
|
|
2219
|
+
const m = o / d;
|
|
2220
|
+
[n, s] = [s, n - m * s], [o, d] = [d, o - m * d];
|
|
2221
2221
|
}
|
|
2222
2222
|
if (o > 1n) throw new Error("a is not invertible");
|
|
2223
2223
|
return n < 0n && (n += t), n;
|
|
@@ -2227,26 +2227,26 @@ var di = {};
|
|
|
2227
2227
|
for (e = $(e, n); t > 0; ) t % 2n === 1n && (s = $(s * e, n)), e = $(e * e, n), t = t / 2n;
|
|
2228
2228
|
return s;
|
|
2229
2229
|
}
|
|
2230
|
-
function
|
|
2230
|
+
function Ls(e, t) {
|
|
2231
2231
|
return $(e, t) === 0n ? 0n : t % 4n === 3n ? sl(e, (t + 1n) / 4n, t) : null;
|
|
2232
2232
|
}
|
|
2233
|
-
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, D = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,
|
|
2233
|
+
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, D = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n, Dt = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n, Ut = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;
|
|
2234
2234
|
function br(e, t, n) {
|
|
2235
2235
|
if (t === 0n) return [0n, 0n];
|
|
2236
2236
|
const s = $(3n * e * e * Ye(2n * t, n), n), o = $(s * s - 2n * e, n), d = $(s * (e - o) - t, n);
|
|
2237
2237
|
return [o, d];
|
|
2238
2238
|
}
|
|
2239
|
-
function
|
|
2239
|
+
function Pt(e, t, n, s, o) {
|
|
2240
2240
|
if (e === 0n && t === 0n) return [n, s];
|
|
2241
2241
|
if (n === 0n && s === 0n) return [e, t];
|
|
2242
2242
|
if (e === n && t === $(-s, o)) return [0n, 0n];
|
|
2243
2243
|
if (e === n && t === s) return br(e, t, o);
|
|
2244
|
-
const d = $((s - t) * Ye(n - e, o), o),
|
|
2245
|
-
return [
|
|
2244
|
+
const d = $((s - t) * Ye(n - e, o), o), m = $(d * d - e - n, o), v = $(d * (e - m) - t, o);
|
|
2245
|
+
return [m, v];
|
|
2246
2246
|
}
|
|
2247
2247
|
function il(e) {
|
|
2248
2248
|
if (e <= 0n || e >= D) throw new Error("Invalid private key");
|
|
2249
|
-
return xe(
|
|
2249
|
+
return xe(Dt, Ut, e, Z);
|
|
2250
2250
|
}
|
|
2251
2251
|
function al(e) {
|
|
2252
2252
|
const t = e[1] % 2n === 0n ? 2 : 3;
|
|
@@ -2254,7 +2254,7 @@ var di = {};
|
|
|
2254
2254
|
}
|
|
2255
2255
|
function ol(e) {
|
|
2256
2256
|
if (e.length !== 33 || e[0] !== 2 && e[0] !== 3) throw new Error("Invalid compressed public key");
|
|
2257
|
-
const t = Ne(e.slice(1), "BE"), n =
|
|
2257
|
+
const t = Ne(e.slice(1), "BE"), n = Ls($(t ** 3n + 7n, Z), Z);
|
|
2258
2258
|
if (!n) throw Error("Invalid x: does not correspond to a valid curve point");
|
|
2259
2259
|
const s = $(-n, Z), o = n % 2n === 0n;
|
|
2260
2260
|
return [t, e[0] === 2 ? o ? n : s : o ? s : n];
|
|
@@ -2271,15 +2271,15 @@ var di = {};
|
|
|
2271
2271
|
}
|
|
2272
2272
|
function xe(e, t, n, s) {
|
|
2273
2273
|
let o = [0n, 0n], d = [e, t];
|
|
2274
|
-
const
|
|
2275
|
-
for (const v of
|
|
2276
|
-
v === "0" ? (d =
|
|
2274
|
+
const m = n.toString(2);
|
|
2275
|
+
for (const v of m)
|
|
2276
|
+
v === "0" ? (d = Pt(o[0], o[1], d[0], d[1], s), o = br(o[0], o[1], s)) : (o = Pt(o[0], o[1], d[0], d[1], s), d = br(d[0], d[1], s));
|
|
2277
2277
|
return o;
|
|
2278
2278
|
}
|
|
2279
2279
|
function ll(e, t, n) {
|
|
2280
|
-
return
|
|
2280
|
+
return zs(Ne(se(e), "BE"), t, n);
|
|
2281
2281
|
}
|
|
2282
|
-
function
|
|
2282
|
+
function zs(e, t, n) {
|
|
2283
2283
|
if (t <= 0n || t >= D) throw new Error("Invalid private key");
|
|
2284
2284
|
if (n || (n = $(
|
|
2285
2285
|
Ne(
|
|
@@ -2289,23 +2289,23 @@ var di = {};
|
|
|
2289
2289
|
D
|
|
2290
2290
|
)), n <= 0n || n >= D)
|
|
2291
2291
|
throw new Error("Invalid nonce");
|
|
2292
|
-
const s = $(e, D), o = xe(
|
|
2293
|
-
let
|
|
2294
|
-
if (d === 0n ||
|
|
2292
|
+
const s = $(e, D), o = xe(Dt, Ut, n, Z), d = $(o[0], D);
|
|
2293
|
+
let m = $((s + $(d, D) * t) * Ye(n, D), D);
|
|
2294
|
+
if (d === 0n || m === 0n) throw new Error("Invalid r or s value");
|
|
2295
2295
|
let v = o[1] % 2n === 0n ? 27n : 28n;
|
|
2296
|
-
return
|
|
2296
|
+
return m > D / 2n && (m = D - m, v = v === 27n ? 28n : 27n), [d, m, v];
|
|
2297
2297
|
}
|
|
2298
2298
|
function dl(e, t, n, s) {
|
|
2299
|
-
const o =
|
|
2299
|
+
const o = Ls($(t ** 3n + 7n, Z), Z);
|
|
2300
2300
|
if (!o) throw new Error("Invalid r: does not correspond to a valid curve point");
|
|
2301
|
-
const d = s === 27n ? 0n : 1n,
|
|
2301
|
+
const d = s === 27n ? 0n : 1n, m = o % 2n === d ? o : Z - o, v = $(Ne(se(e), "BE"), D), p = xe(t, m, n, Z), k = xe(Dt, Ut, v, Z), M = Pt(p[0], p[1], k[0], $(-k[1], Z), Z);
|
|
2302
2302
|
return xe(M[0], M[1], Ye(t, D), Z);
|
|
2303
2303
|
}
|
|
2304
2304
|
function fl(e, t, n, s) {
|
|
2305
|
-
const o = $(Ne(se(e), "BE"), D), d = Ye(s, D),
|
|
2305
|
+
const o = $(Ne(se(e), "BE"), D), d = Ye(s, D), m = $(o * d, D), v = $(n * d, D), p = xe(Dt, Ut, m, Z), k = xe(t[0], t[1], v, Z), M = Pt(p[0], p[1], k[0], k[1], Z);
|
|
2306
2306
|
return n === $(M[0], D);
|
|
2307
2307
|
}
|
|
2308
|
-
class
|
|
2308
|
+
class Vs {
|
|
2309
2309
|
constructor(t) {
|
|
2310
2310
|
this.cursor = 0, this.buffer = t;
|
|
2311
2311
|
}
|
|
@@ -2317,8 +2317,8 @@ var di = {};
|
|
|
2317
2317
|
return this.buffer.length - this.cursor;
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
|
-
a.Uint8ArrayReader =
|
|
2321
|
-
class
|
|
2320
|
+
a.Uint8ArrayReader = Vs;
|
|
2321
|
+
class Fs {
|
|
2322
2322
|
constructor(t) {
|
|
2323
2323
|
this.buffer = t, this.cursor = 0;
|
|
2324
2324
|
}
|
|
@@ -2330,30 +2330,30 @@ var di = {};
|
|
|
2330
2330
|
return this.buffer.length - this.cursor;
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
|
-
a.Uint8ArrayWriter =
|
|
2334
|
-
class
|
|
2333
|
+
a.Uint8ArrayWriter = Fs;
|
|
2334
|
+
class Zt {
|
|
2335
2335
|
constructor(t, n = 0n) {
|
|
2336
|
-
this.span = n, this.writer = new
|
|
2336
|
+
this.span = n, this.writer = new Fs(new Uint8Array(t));
|
|
2337
2337
|
}
|
|
2338
2338
|
build() {
|
|
2339
2339
|
return Re(vr(this.span, "LE"), this.writer.buffer);
|
|
2340
2340
|
}
|
|
2341
2341
|
hash() {
|
|
2342
|
-
const t =
|
|
2342
|
+
const t = Ms(wr(this.writer.buffer, 32), (n, s) => se(Re(n, s)));
|
|
2343
2343
|
return se(Re(vr(this.span, "LE"), t));
|
|
2344
2344
|
}
|
|
2345
2345
|
}
|
|
2346
|
-
a.Chunk =
|
|
2346
|
+
a.Chunk = Zt;
|
|
2347
2347
|
class _r {
|
|
2348
2348
|
constructor(t, n = 4096) {
|
|
2349
|
-
this.counters = [1], this.capacity = n, this.chunks = [new
|
|
2349
|
+
this.counters = [1], this.capacity = n, this.chunks = [new Zt(n)], this.onChunk = t;
|
|
2350
2350
|
}
|
|
2351
2351
|
static async root(t, n = 4096) {
|
|
2352
2352
|
const s = new r(r.NOOP, n);
|
|
2353
2353
|
return await s.append(t), s.finalize();
|
|
2354
2354
|
}
|
|
2355
2355
|
async append(t, n = 0, s = 0n) {
|
|
2356
|
-
const o = new
|
|
2356
|
+
const o = new Vs(t);
|
|
2357
2357
|
for (; o.max() > 0; ) {
|
|
2358
2358
|
this.chunks[n].writer.max() === 0 && await this.elevate(n);
|
|
2359
2359
|
const d = this.chunks[n].writer.write(o);
|
|
@@ -2361,7 +2361,7 @@ var di = {};
|
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
2363
|
async elevate(t) {
|
|
2364
|
-
this.counters[t] = ++this.counters[t] % (this.capacity / 32), this.chunks[t + 1] || (this.chunks.push(new
|
|
2364
|
+
this.counters[t] = ++this.counters[t] % (this.capacity / 32), this.chunks[t + 1] || (this.chunks.push(new Zt(this.capacity)), this.counters.push(1)), await this.append(this.chunks[t].hash(), t + 1, this.chunks[t].span), await this.onChunk(this.chunks[t]), this.chunks[t] = new Zt(this.capacity);
|
|
2365
2365
|
}
|
|
2366
2366
|
async finalize(t = 0) {
|
|
2367
2367
|
return this.chunks[t + 1] ? this.counters[t] === 1 ? (await this.elevate(t + 1), this.chunks[t + 1] = this.chunks[t], this.finalize(t + 1)) : (await this.elevate(t), this.finalize(t + 1)) : (await this.onChunk(this.chunks[t]), this.chunks[t]);
|
|
@@ -2425,53 +2425,53 @@ var di = {};
|
|
|
2425
2425
|
const t = e[0];
|
|
2426
2426
|
return t.ttlMax ? --t.ttl <= 0 && e.shift() : t.ttlMax = t.ttl, { progress: (t.ttlMax - t.ttl) / t.ttlMax, data: t.data };
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2428
|
+
function Bt(e, t, n, s) {
|
|
2429
2429
|
const o = e.findIndex((v) => v === `--${t}` || v.startsWith(`--${t}=`)), d = e[o];
|
|
2430
2430
|
if (!d) return (n || {})[s || t || ""] || null;
|
|
2431
2431
|
if (d.includes("=")) return d.split("=")[1];
|
|
2432
|
-
const
|
|
2433
|
-
return
|
|
2432
|
+
const m = e[o + 1];
|
|
2433
|
+
return m && !m.startsWith("-") ? m : (n || {})[s || t || ""] || null;
|
|
2434
2434
|
}
|
|
2435
|
-
function
|
|
2436
|
-
const o =
|
|
2435
|
+
function ml(e, t, n, s) {
|
|
2436
|
+
const o = Bt(e, t, n, s);
|
|
2437
2437
|
if (!o) return null;
|
|
2438
2438
|
try {
|
|
2439
|
-
return
|
|
2439
|
+
return pr(o);
|
|
2440
2440
|
} catch {
|
|
2441
2441
|
throw new Error(`Invalid number argument ${t}: ${o}`);
|
|
2442
2442
|
}
|
|
2443
2443
|
}
|
|
2444
|
-
function
|
|
2445
|
-
const o = e.some((
|
|
2444
|
+
function pl(e, t, n, s) {
|
|
2445
|
+
const o = e.some((p) => p.endsWith("-" + t)), d = Bt(e, t, n, s);
|
|
2446
2446
|
if (!d && o) return !0;
|
|
2447
2447
|
if (!d && !o) return null;
|
|
2448
|
-
const
|
|
2449
|
-
if (
|
|
2448
|
+
const m = ["true", "1", "yes", "y", "on"], v = ["false", "0", "no", "n", "off"];
|
|
2449
|
+
if (m.includes(d.toLowerCase())) return !0;
|
|
2450
2450
|
if (v.includes(d.toLowerCase())) return !1;
|
|
2451
2451
|
throw Error(`Invalid boolean argument ${t}: ${d}`);
|
|
2452
2452
|
}
|
|
2453
|
-
function
|
|
2454
|
-
const o =
|
|
2453
|
+
function Ws(e, t, n, s) {
|
|
2454
|
+
const o = Bt(e, t, n, s);
|
|
2455
2455
|
if (!o) throw new Error(`Missing argument ${t}`);
|
|
2456
2456
|
return o;
|
|
2457
2457
|
}
|
|
2458
2458
|
function gl(e, t, n, s) {
|
|
2459
|
-
const o =
|
|
2459
|
+
const o = Ws(e, t, n, s);
|
|
2460
2460
|
try {
|
|
2461
|
-
return
|
|
2461
|
+
return pr(o);
|
|
2462
2462
|
} catch {
|
|
2463
2463
|
throw new Error(`Invalid argument ${t}: ${o}`);
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
|
-
function
|
|
2466
|
+
function Hs(e, t) {
|
|
2467
2467
|
const n = e[t];
|
|
2468
2468
|
e.splice(t, 1), e.unshift(n);
|
|
2469
2469
|
}
|
|
2470
2470
|
function yl(e, t) {
|
|
2471
2471
|
const n = [...e];
|
|
2472
|
-
return
|
|
2472
|
+
return Hs(n, t), n;
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function qs(e, t) {
|
|
2475
2475
|
return { x: e.x + t.x, y: e.y + t.y };
|
|
2476
2476
|
}
|
|
2477
2477
|
function vl(e, t) {
|
|
@@ -2484,10 +2484,10 @@ var di = {};
|
|
|
2484
2484
|
const t = Math.sqrt(e.x * e.x + e.y * e.y);
|
|
2485
2485
|
return { x: e.x / t, y: e.y / t };
|
|
2486
2486
|
}
|
|
2487
|
-
function
|
|
2487
|
+
function Gs(e, t, n) {
|
|
2488
2488
|
return { x: e.x + Math.cos(t) * n, y: e.y + Math.sin(t) * n };
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function Js(e, t) {
|
|
2491
2491
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
2492
2492
|
}
|
|
2493
2493
|
function Qe(e, t, n = "row-first") {
|
|
@@ -2505,24 +2505,24 @@ var di = {};
|
|
|
2505
2505
|
var s, o;
|
|
2506
2506
|
return e[t][n + 1] && e[t][n - 1] && !((s = e[t - 1]) != null && s[n]) && !((o = e[t + 1]) != null && o[n]);
|
|
2507
2507
|
}
|
|
2508
|
-
function
|
|
2508
|
+
function Ks(e, t, n) {
|
|
2509
2509
|
var s;
|
|
2510
2510
|
return !((s = e[t - 1]) != null && s[n]);
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function Ys(e, t, n) {
|
|
2513
2513
|
var s;
|
|
2514
2514
|
return !((s = e[t + 1]) != null && s[n]);
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2516
|
+
function Qs(e, t, n) {
|
|
2517
2517
|
return !e[t][n - 1];
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function Xs(e, t, n) {
|
|
2520
2520
|
return !e[t][n + 1];
|
|
2521
2521
|
}
|
|
2522
2522
|
function xl(e, t, n) {
|
|
2523
|
-
var o, d,
|
|
2523
|
+
var o, d, m, v, p, k, M, U;
|
|
2524
2524
|
const s = [];
|
|
2525
|
-
return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) &&
|
|
2525
|
+
return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) && Ks(e, t, n) && Qs(e, t, n) && s.push({ x: t, y: n }), !((d = e[t + 1]) != null && d[n - 1]) && Ys(e, t, n) && Qs(e, t, n) && s.push({ x: t + 1, y: n }), !((m = e[t - 1]) != null && m[n + 1]) && Ks(e, t, n) && Xs(e, t, n) && s.push({ x: t, y: n + 1 }), !((v = e[t + 1]) != null && v[n + 1]) && Ys(e, t, n) && Xs(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 }), (k = e[t + 1]) != null && k[n] && e[t][n - 1] && s.push({ x: t + 1, y: n }), (M = e[t - 1]) != null && M[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);
|
|
2526
2526
|
}
|
|
2527
2527
|
function kl(e, t, n, s) {
|
|
2528
2528
|
const o = [
|
|
@@ -2532,41 +2532,41 @@ var di = {};
|
|
|
2532
2532
|
{ x: n, y: s }
|
|
2533
2533
|
];
|
|
2534
2534
|
for (let d = 0; d < e.length; d++)
|
|
2535
|
-
for (let
|
|
2536
|
-
const v = xl(e, d,
|
|
2537
|
-
for (const
|
|
2535
|
+
for (let m = 0; m < e[0].length; m++) {
|
|
2536
|
+
const v = xl(e, d, m);
|
|
2537
|
+
for (const p of v) o.some((k) => k.x === p.x && k.y === p.y) || o.push(p);
|
|
2538
2538
|
}
|
|
2539
2539
|
return o.map((d) => ({ x: d.x * t, y: d.y * t }));
|
|
2540
2540
|
}
|
|
2541
2541
|
function El(e, t) {
|
|
2542
|
-
const n = Qe(e, (
|
|
2543
|
-
...
|
|
2542
|
+
const n = Qe(e, (p, k) => e[p][k] === 0 && e[p][k + 1] !== 0, "row-first").map((p) => ({
|
|
2543
|
+
...p,
|
|
2544
2544
|
dx: 1,
|
|
2545
2545
|
dy: 0
|
|
2546
|
-
})), s = Qe(e, (
|
|
2547
|
-
...
|
|
2546
|
+
})), s = Qe(e, (p, k) => e[p][k] === 0 && e[p][k - 1] !== 0, "row-first").map((p) => ({
|
|
2547
|
+
...p,
|
|
2548
2548
|
dx: 1,
|
|
2549
2549
|
dy: 0
|
|
2550
|
-
})), o = Qe(e, (
|
|
2550
|
+
})), o = Qe(e, (p, k) => {
|
|
2551
2551
|
var M;
|
|
2552
|
-
return e[
|
|
2553
|
-
}, "column-first").map((
|
|
2554
|
-
...
|
|
2552
|
+
return e[p][k] === 0 && ((M = e[p - 1]) == null ? void 0 : M[k]) !== 0;
|
|
2553
|
+
}, "column-first").map((p) => ({
|
|
2554
|
+
...p,
|
|
2555
2555
|
dx: 0,
|
|
2556
2556
|
dy: 1
|
|
2557
|
-
})), d = Qe(e, (
|
|
2557
|
+
})), d = Qe(e, (p, k) => {
|
|
2558
2558
|
var M;
|
|
2559
|
-
return e[
|
|
2560
|
-
}, "column-first").map((
|
|
2561
|
-
...
|
|
2559
|
+
return e[p][k] === 0 && ((M = e[p + 1]) == null ? void 0 : M[k]) !== 0;
|
|
2560
|
+
}, "column-first").map((p) => ({
|
|
2561
|
+
...p,
|
|
2562
2562
|
dx: 0,
|
|
2563
2563
|
dy: 1
|
|
2564
2564
|
}));
|
|
2565
|
-
n.forEach((
|
|
2566
|
-
const
|
|
2567
|
-
return [...
|
|
2568
|
-
start: xr(
|
|
2569
|
-
end: xr(
|
|
2565
|
+
n.forEach((p) => p.y++), d.forEach((p) => p.x++);
|
|
2566
|
+
const m = yr([...o, ...d], (p, k) => p.x === k.x && p.y - 1 === k.y), v = yr([...s, ...n], (p, k) => p.y === k.y && p.x - 1 === k.x);
|
|
2567
|
+
return [...m, ...v].map((p) => ({ start: p[0], end: qe(p) })).map((p) => ({
|
|
2568
|
+
start: xr(p.start, t),
|
|
2569
|
+
end: xr(qs(p.end, { x: p.start.dx, y: p.start.dy }), t)
|
|
2570
2570
|
}));
|
|
2571
2571
|
}
|
|
2572
2572
|
function Sl(e, t) {
|
|
@@ -2575,29 +2575,29 @@ var di = {};
|
|
|
2575
2575
|
function Tl(e, t) {
|
|
2576
2576
|
return t.map((n) => Sl(e, n)).sort((n, s) => n - s);
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function ei(e, t, n, s) {
|
|
2579
2579
|
const o = (s.y - n.y) * (t.x - e.x) - (s.x - n.x) * (t.y - e.y);
|
|
2580
2580
|
if (o === 0) return null;
|
|
2581
|
-
let d = e.y - n.y,
|
|
2582
|
-
const v = (s.x - n.x) * d - (s.y - n.y) *
|
|
2583
|
-
return d = v / o,
|
|
2581
|
+
let d = e.y - n.y, m = e.x - n.x;
|
|
2582
|
+
const v = (s.x - n.x) * d - (s.y - n.y) * m, p = (t.x - e.x) * d - (t.y - e.y) * m;
|
|
2583
|
+
return d = v / o, m = p / o, d > 0 && d < 1 && m > 0 && m < 1 ? { x: e.x + d * (t.x - e.x), y: e.y + d * (t.y - e.y) } : null;
|
|
2584
2584
|
}
|
|
2585
2585
|
function kr(e, t, n) {
|
|
2586
|
-
const s = [], o =
|
|
2586
|
+
const s = [], o = Gs(e, n, 1e4);
|
|
2587
2587
|
for (const d of t) {
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2588
|
+
const m = ei(e, o, d.start, d.end);
|
|
2589
|
+
m && s.push(m);
|
|
2590
2590
|
}
|
|
2591
|
-
return s.length ? s.reduce((d,
|
|
2592
|
-
const v =
|
|
2593
|
-
return v <
|
|
2591
|
+
return s.length ? s.reduce((d, m) => {
|
|
2592
|
+
const v = Js(e, m), p = Js(e, d);
|
|
2593
|
+
return v < p ? m : d;
|
|
2594
2594
|
}) : null;
|
|
2595
2595
|
}
|
|
2596
2596
|
function Al(e, t, n) {
|
|
2597
2597
|
const s = Tl(e, n), o = [];
|
|
2598
2598
|
for (const d of s) {
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2599
|
+
const m = kr(e, t, d - 1e-3), v = kr(e, t, d + 1e-3);
|
|
2600
|
+
m && o.push(m), v && o.push(v);
|
|
2601
2601
|
}
|
|
2602
2602
|
return o;
|
|
2603
2603
|
}
|
|
@@ -2658,7 +2658,7 @@ var di = {};
|
|
|
2658
2658
|
uint8ArrayToBase64: Mo,
|
|
2659
2659
|
base32ToUint8Array: $o,
|
|
2660
2660
|
uint8ArrayToBase32: Ro,
|
|
2661
|
-
log2Reduce:
|
|
2661
|
+
log2Reduce: Ms,
|
|
2662
2662
|
partition: wr,
|
|
2663
2663
|
concatBytes: Re,
|
|
2664
2664
|
numberToUint8: Zu,
|
|
@@ -2680,9 +2680,9 @@ var di = {};
|
|
|
2680
2680
|
getBit: Qu,
|
|
2681
2681
|
indexOf: Xu,
|
|
2682
2682
|
equals: nl,
|
|
2683
|
-
padStart:
|
|
2683
|
+
padStart: Zs,
|
|
2684
2684
|
padStartToMultiple: el,
|
|
2685
|
-
padEnd:
|
|
2685
|
+
padEnd: Bs,
|
|
2686
2686
|
padEndToMultiple: tl,
|
|
2687
2687
|
xorCypher: rl
|
|
2688
2688
|
}, a.Elliptic = {
|
|
@@ -2691,14 +2691,14 @@ var di = {};
|
|
|
2691
2691
|
publicKeyFromCompressed: ol,
|
|
2692
2692
|
publicKeyToAddress: cl,
|
|
2693
2693
|
signMessage: ll,
|
|
2694
|
-
signHash:
|
|
2694
|
+
signHash: zs,
|
|
2695
2695
|
verifySignature: fl,
|
|
2696
2696
|
recoverPublicKey: dl,
|
|
2697
2697
|
checksumEncode: ul
|
|
2698
2698
|
}, a.Random = {
|
|
2699
2699
|
intBetween: He,
|
|
2700
|
-
floatBetween:
|
|
2701
|
-
chance:
|
|
2700
|
+
floatBetween: Cn,
|
|
2701
|
+
chance: Nn,
|
|
2702
2702
|
signed: Ti,
|
|
2703
2703
|
makeSeededRng: Kt,
|
|
2704
2704
|
point: Oi,
|
|
@@ -2707,20 +2707,20 @@ var di = {};
|
|
|
2707
2707
|
countUnique: wu,
|
|
2708
2708
|
makeUnique: vu,
|
|
2709
2709
|
splitBySize: gu,
|
|
2710
|
-
splitByCount:
|
|
2711
|
-
index:
|
|
2712
|
-
indexCollection:
|
|
2713
|
-
onlyOrThrow:
|
|
2710
|
+
splitByCount: Ts,
|
|
2711
|
+
index: Ss,
|
|
2712
|
+
indexCollection: pu,
|
|
2713
|
+
onlyOrThrow: h,
|
|
2714
2714
|
onlyOrNull: g,
|
|
2715
|
-
firstOrThrow:
|
|
2715
|
+
firstOrThrow: x,
|
|
2716
2716
|
firstOrNull: y,
|
|
2717
2717
|
shuffle: f,
|
|
2718
2718
|
initialize: N,
|
|
2719
2719
|
initialize2D: ne,
|
|
2720
2720
|
rotate2D: re,
|
|
2721
|
-
containsShape:
|
|
2721
|
+
containsShape: Fe,
|
|
2722
2722
|
glue: Ua,
|
|
2723
|
-
pluck:
|
|
2723
|
+
pluck: We,
|
|
2724
2724
|
pick: Yt,
|
|
2725
2725
|
pickMany: Mi,
|
|
2726
2726
|
pickManyUnique: $i,
|
|
@@ -2728,10 +2728,10 @@ var di = {};
|
|
|
2728
2728
|
pickRandomIndices: Oe,
|
|
2729
2729
|
pickGuaranteed: Ri,
|
|
2730
2730
|
last: qe,
|
|
2731
|
-
pipe:
|
|
2731
|
+
pipe: jn,
|
|
2732
2732
|
makePipe: Ci,
|
|
2733
2733
|
sortWeighted: ji,
|
|
2734
|
-
pushAll:
|
|
2734
|
+
pushAll: Mt,
|
|
2735
2735
|
unshiftAll: ja,
|
|
2736
2736
|
filterAndRemove: nc,
|
|
2737
2737
|
merge: Qc,
|
|
@@ -2743,13 +2743,13 @@ var di = {};
|
|
|
2743
2743
|
createOscillator: Zc,
|
|
2744
2744
|
organiseWithLimits: Lc,
|
|
2745
2745
|
tickPlaybook: hl,
|
|
2746
|
-
getArgument:
|
|
2747
|
-
getBooleanArgument:
|
|
2748
|
-
getNumberArgument:
|
|
2749
|
-
requireStringArgument:
|
|
2746
|
+
getArgument: Bt,
|
|
2747
|
+
getBooleanArgument: pl,
|
|
2748
|
+
getNumberArgument: ml,
|
|
2749
|
+
requireStringArgument: Ws,
|
|
2750
2750
|
requireNumberArgument: gl,
|
|
2751
2751
|
bringToFront: yl,
|
|
2752
|
-
bringToFrontInPlace:
|
|
2752
|
+
bringToFrontInPlace: Hs,
|
|
2753
2753
|
findInstance: Ru,
|
|
2754
2754
|
filterInstances: Cu,
|
|
2755
2755
|
interleave: Nu,
|
|
@@ -2758,13 +2758,13 @@ var di = {};
|
|
|
2758
2758
|
multicall: Mu,
|
|
2759
2759
|
maxBy: $u
|
|
2760
2760
|
}, a.System = { sleepMillis: l, forever: Li, scheduleMany: Fa, waitFor: rc, expandError: Oa, runAndSetInterval: zi }, a.Numbers = {
|
|
2761
|
-
make:
|
|
2761
|
+
make: pr,
|
|
2762
2762
|
sum: Ha,
|
|
2763
2763
|
average: qa,
|
|
2764
2764
|
median: Ga,
|
|
2765
2765
|
getDistanceFromMidpoint: Ja,
|
|
2766
2766
|
clamp: gr,
|
|
2767
|
-
range:
|
|
2767
|
+
range: Gn,
|
|
2768
2768
|
interpolate: Wa,
|
|
2769
2769
|
createSequence: Pc,
|
|
2770
2770
|
increment: Gc,
|
|
@@ -2777,27 +2777,27 @@ var di = {};
|
|
|
2777
2777
|
hexToRgb: Wi,
|
|
2778
2778
|
rgbToHex: Hi,
|
|
2779
2779
|
haversineDistanceToMeters: qi,
|
|
2780
|
-
roundToNearest:
|
|
2780
|
+
roundToNearest: Tt,
|
|
2781
2781
|
formatDistance: Gi,
|
|
2782
2782
|
triangularNumber: Ji,
|
|
2783
2783
|
searchFloat: Ki
|
|
2784
2784
|
}, a.Promises = { raceFulfilled: c, invert: i, runInParallelBatches: u }, a.Dates = {
|
|
2785
2785
|
getTimestamp: fc,
|
|
2786
|
-
getTimeDelta:
|
|
2786
|
+
getTimeDelta: gs,
|
|
2787
2787
|
secondsToHumanTime: hc,
|
|
2788
|
-
countCycles:
|
|
2788
|
+
countCycles: mc,
|
|
2789
2789
|
isoDate: ac,
|
|
2790
|
-
throttle:
|
|
2790
|
+
throttle: pc,
|
|
2791
2791
|
timeSince: yc,
|
|
2792
2792
|
dateTimeSlug: oc,
|
|
2793
2793
|
unixTimestamp: ic,
|
|
2794
2794
|
fromUtcString: cc,
|
|
2795
2795
|
fromMillis: uc,
|
|
2796
2796
|
getProgress: vc,
|
|
2797
|
-
humanizeTime:
|
|
2797
|
+
humanizeTime: Nt,
|
|
2798
2798
|
humanizeProgress: tc,
|
|
2799
2799
|
createTimeDigits: K,
|
|
2800
|
-
mapDayNumber:
|
|
2800
|
+
mapDayNumber: ys,
|
|
2801
2801
|
getDayInfoFromDate: hr,
|
|
2802
2802
|
getDayInfoFromDateTimeString: bc,
|
|
2803
2803
|
seconds: _c,
|
|
@@ -2821,21 +2821,21 @@ var di = {};
|
|
|
2821
2821
|
deepMerge3: Ma,
|
|
2822
2822
|
mapAllAsync: Da,
|
|
2823
2823
|
cloneWithJson: sc,
|
|
2824
|
-
sortObject:
|
|
2825
|
-
sortArray:
|
|
2824
|
+
sortObject: ws,
|
|
2825
|
+
sortArray: bs,
|
|
2826
2826
|
sortAny: _e,
|
|
2827
|
-
deepEquals:
|
|
2827
|
+
deepEquals: _s,
|
|
2828
2828
|
deepEqualsEvery: Dc,
|
|
2829
2829
|
runOn: Kc,
|
|
2830
2830
|
ifPresent: Yc,
|
|
2831
|
-
zip:
|
|
2831
|
+
zip: qn,
|
|
2832
2832
|
zipSum: $a,
|
|
2833
2833
|
removeEmptyArrays: eu,
|
|
2834
2834
|
removeEmptyValues: tu,
|
|
2835
2835
|
flatten: hu,
|
|
2836
|
-
unflatten:
|
|
2837
|
-
match:
|
|
2838
|
-
sort:
|
|
2836
|
+
unflatten: Es,
|
|
2837
|
+
match: mu,
|
|
2838
|
+
sort: Os,
|
|
2839
2839
|
map: su,
|
|
2840
2840
|
mapIterable: iu,
|
|
2841
2841
|
filterKeys: ru,
|
|
@@ -2851,13 +2851,13 @@ var di = {};
|
|
|
2851
2851
|
incrementMulti: _u,
|
|
2852
2852
|
createBidirectionalMap: ku,
|
|
2853
2853
|
createTemporalBidirectionalMap: Eu,
|
|
2854
|
-
pushToBidirectionalMap:
|
|
2854
|
+
pushToBidirectionalMap: Is,
|
|
2855
2855
|
unshiftToBidirectionalMap: Su,
|
|
2856
2856
|
addToTemporalBidirectionalMap: Tu,
|
|
2857
2857
|
getFromTemporalBidirectionalMap: Au,
|
|
2858
2858
|
createStatefulToggle: Bc,
|
|
2859
2859
|
diffKeys: zc,
|
|
2860
|
-
pickRandomKey:
|
|
2860
|
+
pickRandomKey: xs,
|
|
2861
2861
|
mapRandomKey: Vc,
|
|
2862
2862
|
fromObjectString: Fc,
|
|
2863
2863
|
toQueryString: ms,
|
|
@@ -2871,49 +2871,49 @@ var di = {};
|
|
|
2871
2871
|
isFunction: Xt,
|
|
2872
2872
|
isObject: ce,
|
|
2873
2873
|
isStrictlyObject: Ie,
|
|
2874
|
-
isEmptyArray:
|
|
2874
|
+
isEmptyArray: Dn,
|
|
2875
2875
|
isEmptyObject: Yi,
|
|
2876
2876
|
isUndefined: Qt,
|
|
2877
2877
|
isString: F,
|
|
2878
2878
|
isNumber: ue,
|
|
2879
|
-
isBoolean:
|
|
2879
|
+
isBoolean: Un,
|
|
2880
2880
|
isDate: Me,
|
|
2881
|
-
isBlank:
|
|
2881
|
+
isBlank: At,
|
|
2882
2882
|
isId: er,
|
|
2883
|
-
isIntegerString:
|
|
2884
|
-
isHexString:
|
|
2885
|
-
isUrl:
|
|
2883
|
+
isIntegerString: Pn,
|
|
2884
|
+
isHexString: Zn,
|
|
2885
|
+
isUrl: Wn,
|
|
2886
2886
|
isNullable: Ea,
|
|
2887
|
-
asString:
|
|
2887
|
+
asString: Vn,
|
|
2888
2888
|
asHexString: la,
|
|
2889
2889
|
asSafeString: da,
|
|
2890
2890
|
asIntegerString: ua,
|
|
2891
|
-
asNumber:
|
|
2891
|
+
asNumber: Ot,
|
|
2892
2892
|
asFunction: fa,
|
|
2893
2893
|
asInteger: nr,
|
|
2894
2894
|
asBoolean: ha,
|
|
2895
|
-
asDate:
|
|
2896
|
-
asNullableString:
|
|
2895
|
+
asDate: ma,
|
|
2896
|
+
asNullableString: pa,
|
|
2897
2897
|
asEmptiableString: ga,
|
|
2898
2898
|
asId: ya,
|
|
2899
2899
|
asTime: va,
|
|
2900
2900
|
asArray: wa,
|
|
2901
|
-
asObject:
|
|
2901
|
+
asObject: It,
|
|
2902
2902
|
asNullableObject: ba,
|
|
2903
2903
|
asStringMap: _a,
|
|
2904
2904
|
asNumericDictionary: xa,
|
|
2905
2905
|
asUrl: ka,
|
|
2906
2906
|
asNullable: Sa,
|
|
2907
2907
|
asOptional: Ta,
|
|
2908
|
-
enforceObjectShape:
|
|
2908
|
+
enforceObjectShape: Hn,
|
|
2909
2909
|
enforceArrayShape: Aa,
|
|
2910
|
-
isPng:
|
|
2911
|
-
isJpg:
|
|
2912
|
-
isWebp:
|
|
2910
|
+
isPng: $s,
|
|
2911
|
+
isJpg: Rs,
|
|
2912
|
+
isWebp: Cs,
|
|
2913
2913
|
isImage: Pu
|
|
2914
2914
|
}, a.Strings = {
|
|
2915
2915
|
tokenizeByCount: yu,
|
|
2916
|
-
tokenizeByLength:
|
|
2916
|
+
tokenizeByLength: As,
|
|
2917
2917
|
searchHex: aa,
|
|
2918
2918
|
searchSubstring: oa,
|
|
2919
2919
|
randomHex: ca,
|
|
@@ -2928,24 +2928,24 @@ var di = {};
|
|
|
2928
2928
|
escapeHtml: ao,
|
|
2929
2929
|
decodeHtmlEntities: co,
|
|
2930
2930
|
after: ir,
|
|
2931
|
-
afterLast:
|
|
2932
|
-
before:
|
|
2931
|
+
afterLast: Kn,
|
|
2932
|
+
before: Jn,
|
|
2933
2933
|
beforeLast: ar,
|
|
2934
2934
|
betweenWide: uo,
|
|
2935
2935
|
betweenNarrow: lo,
|
|
2936
2936
|
getPreLine: Ic,
|
|
2937
2937
|
containsWord: dr,
|
|
2938
2938
|
containsWords: Vo,
|
|
2939
|
-
joinUrl:
|
|
2940
|
-
getFuzzyMatchScore:
|
|
2939
|
+
joinUrl: vs,
|
|
2940
|
+
getFuzzyMatchScore: $t,
|
|
2941
2941
|
sortByFuzzyScore: io,
|
|
2942
2942
|
splitOnce: or,
|
|
2943
|
-
splitAll:
|
|
2944
|
-
randomize:
|
|
2945
|
-
expand:
|
|
2943
|
+
splitAll: Yn,
|
|
2944
|
+
randomize: po,
|
|
2945
|
+
expand: Qn,
|
|
2946
2946
|
shrinkTrim: Je,
|
|
2947
|
-
capitalize:
|
|
2948
|
-
decapitalize:
|
|
2947
|
+
capitalize: Rt,
|
|
2948
|
+
decapitalize: Xn,
|
|
2949
2949
|
csvEscape: _o,
|
|
2950
2950
|
parseCsv: ec,
|
|
2951
2951
|
surroundInOut: no,
|
|
@@ -2953,29 +2953,29 @@ var di = {};
|
|
|
2953
2953
|
getBasename: ur,
|
|
2954
2954
|
normalizeEmail: fo,
|
|
2955
2955
|
normalizeFilename: ho,
|
|
2956
|
-
parseFilename:
|
|
2956
|
+
parseFilename: mo,
|
|
2957
2957
|
camelToTitle: Xa,
|
|
2958
2958
|
slugToTitle: eo,
|
|
2959
2959
|
slugToCamel: to,
|
|
2960
2960
|
joinHumanly: ro,
|
|
2961
|
-
findWeightedPair:
|
|
2962
|
-
extractBlock:
|
|
2961
|
+
findWeightedPair: is,
|
|
2962
|
+
extractBlock: as,
|
|
2963
2963
|
extractAllBlocks: Eo,
|
|
2964
2964
|
replaceBlocks: So,
|
|
2965
2965
|
indexOfEarliest: $e,
|
|
2966
|
-
lastIndexOfBefore:
|
|
2966
|
+
lastIndexOfBefore: ss,
|
|
2967
2967
|
parseHtmlAttributes: Fo,
|
|
2968
|
-
readNextWord:
|
|
2968
|
+
readNextWord: Ct,
|
|
2969
2969
|
resolveVariables: Wo,
|
|
2970
|
-
resolveVariableWithDefaultSyntax:
|
|
2971
|
-
resolveRemainingVariablesWithDefaults:
|
|
2972
|
-
isLetter:
|
|
2973
|
-
isDigit:
|
|
2970
|
+
resolveVariableWithDefaultSyntax: fs,
|
|
2971
|
+
resolveRemainingVariablesWithDefaults: hs,
|
|
2972
|
+
isLetter: es,
|
|
2973
|
+
isDigit: ts,
|
|
2974
2974
|
isLetterOrDigit: Ke,
|
|
2975
2975
|
isValidObjectPathCharacter: vo,
|
|
2976
2976
|
insert: wo,
|
|
2977
|
-
indexOfRegex:
|
|
2978
|
-
lineMatches:
|
|
2977
|
+
indexOfRegex: rs,
|
|
2978
|
+
lineMatches: ns,
|
|
2979
2979
|
linesMatchInOrder: bo,
|
|
2980
2980
|
represent: Ge,
|
|
2981
2981
|
resolveMarkdownLinks: Ho,
|
|
@@ -2994,25 +2994,25 @@ var di = {};
|
|
|
2994
2994
|
replaceWord: Uo,
|
|
2995
2995
|
replacePascalCaseWords: Po,
|
|
2996
2996
|
stripHtml: Zo,
|
|
2997
|
-
breakLine:
|
|
2997
|
+
breakLine: ds,
|
|
2998
2998
|
measureTextWidth: Bo,
|
|
2999
2999
|
toLines: Lo,
|
|
3000
3000
|
levenshteinDistance: zo
|
|
3001
3001
|
}, a.Assertions = { asEqual: Pa, asTrue: Za, asTruthy: Ba, asFalse: La, asFalsy: za, asEither: Va }, a.Cache = { get: Mc, invalidate: $c }, a.Vector = {
|
|
3002
|
-
addPoint:
|
|
3002
|
+
addPoint: qs,
|
|
3003
3003
|
subtractPoint: vl,
|
|
3004
3004
|
multiplyPoint: xr,
|
|
3005
3005
|
normalizePoint: wl,
|
|
3006
|
-
pushPoint:
|
|
3006
|
+
pushPoint: Gs,
|
|
3007
3007
|
filterCoordinates: Qe,
|
|
3008
3008
|
findCorners: kl,
|
|
3009
3009
|
findLines: El,
|
|
3010
3010
|
raycast: kr,
|
|
3011
3011
|
raycastCircle: Al,
|
|
3012
|
-
getLineIntersectionPoint:
|
|
3012
|
+
getLineIntersectionPoint: ei
|
|
3013
3013
|
};
|
|
3014
|
-
})(
|
|
3015
|
-
const R = /* @__PURE__ */ Gl(
|
|
3014
|
+
})(li);
|
|
3015
|
+
const R = /* @__PURE__ */ Gl(li);
|
|
3016
3016
|
R.Arrays;
|
|
3017
3017
|
R.Assertions;
|
|
3018
3018
|
const B = R.Binary;
|
|
@@ -3038,13 +3038,13 @@ R.AsyncLazy;
|
|
|
3038
3038
|
R.AsyncQueue;
|
|
3039
3039
|
R.Uint8ArrayReader;
|
|
3040
3040
|
R.Uint8ArrayWriter;
|
|
3041
|
-
const Kl = new TextEncoder(),
|
|
3042
|
-
function
|
|
3043
|
-
return r = typeof r == "number" ?
|
|
3041
|
+
const Kl = new TextEncoder(), ri = 1, ni = 4096, En = 4096, Yl = 32;
|
|
3042
|
+
function di(a, r) {
|
|
3043
|
+
return r = typeof r == "number" ? ci.fromBigInt(BigInt(r)) : r, new Lt(B.keccak256(B.concatBytes(a.toUint8Array(), r.toUint8Array())));
|
|
3044
3044
|
}
|
|
3045
3045
|
function Ql(a) {
|
|
3046
|
-
const r = a.slice(0,
|
|
3047
|
-
return new
|
|
3046
|
+
const r = a.slice(0, Be.LENGTH), i = a.slice(Be.LENGTH), c = Xl(i), u = B.keccak256(B.concatBytes(r, c));
|
|
3047
|
+
return new ui(u);
|
|
3048
3048
|
}
|
|
3049
3049
|
function Xl(a) {
|
|
3050
3050
|
if (a.length > En)
|
|
@@ -3055,31 +3055,31 @@ function Xl(a) {
|
|
|
3055
3055
|
const r = new Uint8Array(En);
|
|
3056
3056
|
return r.set(a), B.log2Reduce(B.partition(r, Yl), (i, c) => B.keccak256(B.concatBytes(i, c)));
|
|
3057
3057
|
}
|
|
3058
|
-
function
|
|
3059
|
-
if (a instanceof Uint8Array || (a = Kl.encode(a)), a.length <
|
|
3058
|
+
function si(a) {
|
|
3059
|
+
if (a instanceof Uint8Array || (a = Kl.encode(a)), a.length < ri || a.length > ni)
|
|
3060
3060
|
throw new RangeError(
|
|
3061
|
-
`payload size ${a.length} exceeds limits [${
|
|
3061
|
+
`payload size ${a.length} exceeds limits [${ri}, ${ni}]`
|
|
3062
3062
|
);
|
|
3063
|
-
const r =
|
|
3063
|
+
const r = Be.fromBigInt(BigInt(a.length)), i = B.concatBytes(r.toUint8Array(), a);
|
|
3064
3064
|
return {
|
|
3065
3065
|
data: i,
|
|
3066
3066
|
span: r,
|
|
3067
|
-
payload:
|
|
3067
|
+
payload: Ue.fromSlice(i, Be.LENGTH),
|
|
3068
3068
|
address: Ql(i)
|
|
3069
3069
|
};
|
|
3070
3070
|
}
|
|
3071
3071
|
function ed(a, r) {
|
|
3072
|
-
return new
|
|
3072
|
+
return new ui(B.keccak256(B.concatBytes(a.toUint8Array(), r.toUint8Array())));
|
|
3073
3073
|
}
|
|
3074
|
-
function
|
|
3075
|
-
r = new
|
|
3076
|
-
const c = ed(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), f =
|
|
3074
|
+
function ii(a, r, i) {
|
|
3075
|
+
r = new Lt(r), i = new ke(i);
|
|
3076
|
+
const c = ed(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), f = Be.fromSlice(a.data, 0), h = Ue.fromSlice(a.data, Be.LENGTH);
|
|
3077
3077
|
return {
|
|
3078
3078
|
data: l,
|
|
3079
3079
|
identifier: r,
|
|
3080
3080
|
signature: u,
|
|
3081
3081
|
span: f,
|
|
3082
|
-
payload:
|
|
3082
|
+
payload: h,
|
|
3083
3083
|
address: c,
|
|
3084
3084
|
owner: i.publicKey().address()
|
|
3085
3085
|
};
|
|
@@ -3090,19 +3090,27 @@ function nd(a) {
|
|
|
3090
3090
|
setTimeout(r, a);
|
|
3091
3091
|
});
|
|
3092
3092
|
}
|
|
3093
|
-
function
|
|
3093
|
+
function fi(a) {
|
|
3094
3094
|
return (a.startsWith("0x") ? a.slice(2) : a).toLowerCase();
|
|
3095
3095
|
}
|
|
3096
|
-
async function
|
|
3096
|
+
async function Tn(a, r = 3, i = 250) {
|
|
3097
3097
|
return new Promise((c, u) => {
|
|
3098
3098
|
a().then(c).catch((l) => {
|
|
3099
3099
|
r > 0 ? (td.info(`Retrying... Attempts left: ${r}. Error: ${l.message}`), setTimeout(() => {
|
|
3100
|
-
|
|
3100
|
+
Tn(a, r - 1, i).then(c).catch(u);
|
|
3101
3101
|
}, i)) : (rd.handleError(l, "Utils.retryAwaitableAsync"), u(l));
|
|
3102
3102
|
});
|
|
3103
3103
|
});
|
|
3104
3104
|
}
|
|
3105
|
-
|
|
3105
|
+
async function sd(a, r, i = "Operation timed out") {
|
|
3106
|
+
return Promise.race([
|
|
3107
|
+
a,
|
|
3108
|
+
new Promise(
|
|
3109
|
+
(c, u) => setTimeout(() => u(new Error(i)), r)
|
|
3110
|
+
)
|
|
3111
|
+
]);
|
|
3112
|
+
}
|
|
3113
|
+
class id {
|
|
3106
3114
|
constructor() {
|
|
3107
3115
|
this.events = {}, this.on = this.on.bind(this), this.off = this.off.bind(this), this.cleanAll = this.cleanAll.bind(this), this.emit = this.emit.bind(this);
|
|
3108
3116
|
}
|
|
@@ -3136,9 +3144,9 @@ var I;
|
|
|
3136
3144
|
l[f] = f;
|
|
3137
3145
|
return l;
|
|
3138
3146
|
}, a.getValidEnumValues = (u) => {
|
|
3139
|
-
const l = a.objectKeys(u).filter((
|
|
3140
|
-
for (const
|
|
3141
|
-
f[
|
|
3147
|
+
const l = a.objectKeys(u).filter((h) => typeof u[u[h]] != "number"), f = {};
|
|
3148
|
+
for (const h of l)
|
|
3149
|
+
f[h] = u[h];
|
|
3142
3150
|
return a.objectValues(f);
|
|
3143
3151
|
}, a.objectValues = (u) => a.objectKeys(u).map(function(l) {
|
|
3144
3152
|
return u[l];
|
|
@@ -3157,14 +3165,14 @@ var I;
|
|
|
3157
3165
|
}
|
|
3158
3166
|
a.joinValues = c, a.jsonStringifyReplacer = (u, l) => typeof l == "bigint" ? l.toString() : l;
|
|
3159
3167
|
})(I || (I = {}));
|
|
3160
|
-
var
|
|
3168
|
+
var An;
|
|
3161
3169
|
(function(a) {
|
|
3162
3170
|
a.mergeShapes = (r, i) => ({
|
|
3163
3171
|
...r,
|
|
3164
3172
|
...i
|
|
3165
3173
|
// second overwrites first
|
|
3166
3174
|
});
|
|
3167
|
-
})(
|
|
3175
|
+
})(An || (An = {}));
|
|
3168
3176
|
const _ = I.arrayToEnum([
|
|
3169
3177
|
"string",
|
|
3170
3178
|
"nan",
|
|
@@ -3224,7 +3232,7 @@ const _ = I.arrayToEnum([
|
|
|
3224
3232
|
"invalid_intersection_types",
|
|
3225
3233
|
"not_multiple_of",
|
|
3226
3234
|
"not_finite"
|
|
3227
|
-
]),
|
|
3235
|
+
]), ad = (a) => JSON.stringify(a, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
3228
3236
|
class V extends Error {
|
|
3229
3237
|
get errors() {
|
|
3230
3238
|
return this.issues;
|
|
@@ -3252,10 +3260,10 @@ class V extends Error {
|
|
|
3252
3260
|
else if (f.path.length === 0)
|
|
3253
3261
|
c._errors.push(i(f));
|
|
3254
3262
|
else {
|
|
3255
|
-
let
|
|
3263
|
+
let h = c, g = 0;
|
|
3256
3264
|
for (; g < f.path.length; ) {
|
|
3257
3265
|
const y = f.path[g];
|
|
3258
|
-
g === f.path.length - 1 ? (
|
|
3266
|
+
g === f.path.length - 1 ? (h[y] = h[y] || { _errors: [] }, h[y]._errors.push(i(f))) : h[y] = h[y] || { _errors: [] }, h = h[y], g++;
|
|
3259
3267
|
}
|
|
3260
3268
|
}
|
|
3261
3269
|
};
|
|
@@ -3285,7 +3293,7 @@ class V extends Error {
|
|
|
3285
3293
|
}
|
|
3286
3294
|
}
|
|
3287
3295
|
V.create = (a) => new V(a);
|
|
3288
|
-
const
|
|
3296
|
+
const Le = (a, r) => {
|
|
3289
3297
|
let i;
|
|
3290
3298
|
switch (a.code) {
|
|
3291
3299
|
case w.invalid_type:
|
|
@@ -3341,14 +3349,14 @@ const ze = (a, r) => {
|
|
|
3341
3349
|
}
|
|
3342
3350
|
return { message: i };
|
|
3343
3351
|
};
|
|
3344
|
-
let hi =
|
|
3345
|
-
function
|
|
3352
|
+
let hi = Le;
|
|
3353
|
+
function od(a) {
|
|
3346
3354
|
hi = a;
|
|
3347
3355
|
}
|
|
3348
|
-
function
|
|
3356
|
+
function zt() {
|
|
3349
3357
|
return hi;
|
|
3350
3358
|
}
|
|
3351
|
-
const
|
|
3359
|
+
const Vt = (a) => {
|
|
3352
3360
|
const { data: r, path: i, errorMaps: c, issueData: u } = a, l = [...i, ...u.path || []], f = {
|
|
3353
3361
|
...u,
|
|
3354
3362
|
path: l
|
|
@@ -3359,18 +3367,18 @@ const zt = (a) => {
|
|
|
3359
3367
|
path: l,
|
|
3360
3368
|
message: u.message
|
|
3361
3369
|
};
|
|
3362
|
-
let
|
|
3370
|
+
let h = "";
|
|
3363
3371
|
const g = c.filter((y) => !!y).slice().reverse();
|
|
3364
3372
|
for (const y of g)
|
|
3365
|
-
|
|
3373
|
+
h = y(f, { data: r, defaultError: h }).message;
|
|
3366
3374
|
return {
|
|
3367
3375
|
...u,
|
|
3368
3376
|
path: l,
|
|
3369
|
-
message:
|
|
3377
|
+
message: h
|
|
3370
3378
|
};
|
|
3371
|
-
},
|
|
3379
|
+
}, cd = [];
|
|
3372
3380
|
function b(a, r) {
|
|
3373
|
-
const i =
|
|
3381
|
+
const i = zt(), c = Vt({
|
|
3374
3382
|
issueData: r,
|
|
3375
3383
|
data: a.data,
|
|
3376
3384
|
path: a.path,
|
|
@@ -3381,7 +3389,7 @@ function b(a, r) {
|
|
|
3381
3389
|
// then schema-bound map if available
|
|
3382
3390
|
i,
|
|
3383
3391
|
// then global override map
|
|
3384
|
-
i ===
|
|
3392
|
+
i === Le ? void 0 : Le
|
|
3385
3393
|
// then global default map
|
|
3386
3394
|
].filter((u) => !!u)
|
|
3387
3395
|
});
|
|
@@ -3430,20 +3438,20 @@ class L {
|
|
|
3430
3438
|
}
|
|
3431
3439
|
const T = Object.freeze({
|
|
3432
3440
|
status: "aborted"
|
|
3433
|
-
}),
|
|
3434
|
-
function
|
|
3441
|
+
}), Pe = (a) => ({ status: "dirty", value: a }), z = (a) => ({ status: "valid", value: a }), On = (a) => a.status === "aborted", In = (a) => a.status === "dirty", Se = (a) => a.status === "valid", ft = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
3442
|
+
function Ft(a, r, i, c) {
|
|
3435
3443
|
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");
|
|
3436
3444
|
return r.get(a);
|
|
3437
3445
|
}
|
|
3438
|
-
function
|
|
3446
|
+
function mi(a, r, i, c, u) {
|
|
3439
3447
|
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");
|
|
3440
3448
|
return r.set(a, i), i;
|
|
3441
3449
|
}
|
|
3442
|
-
var
|
|
3450
|
+
var E;
|
|
3443
3451
|
(function(a) {
|
|
3444
3452
|
a.errToObj = (r) => typeof r == "string" ? { message: r } : r || {}, a.toString = (r) => typeof r == "string" ? r : r == null ? void 0 : r.message;
|
|
3445
|
-
})(
|
|
3446
|
-
var
|
|
3453
|
+
})(E || (E = {}));
|
|
3454
|
+
var lt, dt;
|
|
3447
3455
|
class ee {
|
|
3448
3456
|
constructor(r, i, c, u) {
|
|
3449
3457
|
this._cachedPath = [], this.parent = r, this.data = i, this._path = c, this._key = u;
|
|
@@ -3452,7 +3460,7 @@ class ee {
|
|
|
3452
3460
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
3453
3461
|
}
|
|
3454
3462
|
}
|
|
3455
|
-
const
|
|
3463
|
+
const ai = (a, r) => {
|
|
3456
3464
|
if (Se(r))
|
|
3457
3465
|
return { success: !0, data: r.value };
|
|
3458
3466
|
if (!a.common.issues.length)
|
|
@@ -3473,10 +3481,10 @@ function A(a) {
|
|
|
3473
3481
|
const { errorMap: r, invalid_type_error: i, required_error: c, description: u } = a;
|
|
3474
3482
|
if (r && (i || c))
|
|
3475
3483
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
3476
|
-
return r ? { errorMap: r, description: u } : { errorMap: (f,
|
|
3484
|
+
return r ? { errorMap: r, description: u } : { errorMap: (f, h) => {
|
|
3477
3485
|
var g, y;
|
|
3478
|
-
const { message:
|
|
3479
|
-
return f.code === "invalid_enum_value" ? { message:
|
|
3486
|
+
const { message: x } = a;
|
|
3487
|
+
return f.code === "invalid_enum_value" ? { message: x ?? h.defaultError } : typeof h.data > "u" ? { message: (g = x ?? c) !== null && g !== void 0 ? g : h.defaultError } : f.code !== "invalid_type" ? { message: h.defaultError } : { message: (y = x ?? i) !== null && y !== void 0 ? y : h.defaultError };
|
|
3480
3488
|
}, description: u };
|
|
3481
3489
|
}
|
|
3482
3490
|
class O {
|
|
@@ -3511,7 +3519,7 @@ class O {
|
|
|
3511
3519
|
}
|
|
3512
3520
|
_parseSync(r) {
|
|
3513
3521
|
const i = this._parse(r);
|
|
3514
|
-
if (
|
|
3522
|
+
if (ft(i))
|
|
3515
3523
|
throw new Error("Synchronous parse encountered promise.");
|
|
3516
3524
|
return i;
|
|
3517
3525
|
}
|
|
@@ -3539,7 +3547,7 @@ class O {
|
|
|
3539
3547
|
data: r,
|
|
3540
3548
|
parsedType: ae(r)
|
|
3541
3549
|
}, l = this._parseSync({ data: r, path: u.path, parent: u });
|
|
3542
|
-
return
|
|
3550
|
+
return ai(u, l);
|
|
3543
3551
|
}
|
|
3544
3552
|
"~validate"(r) {
|
|
3545
3553
|
var i, c;
|
|
@@ -3592,17 +3600,17 @@ class O {
|
|
|
3592
3600
|
parent: null,
|
|
3593
3601
|
data: r,
|
|
3594
3602
|
parsedType: ae(r)
|
|
3595
|
-
}, u = this._parse({ data: r, path: c.path, parent: c }), l = await (
|
|
3596
|
-
return
|
|
3603
|
+
}, u = this._parse({ data: r, path: c.path, parent: c }), l = await (ft(u) ? u : Promise.resolve(u));
|
|
3604
|
+
return ai(c, l);
|
|
3597
3605
|
}
|
|
3598
3606
|
refine(r, i) {
|
|
3599
3607
|
const c = (u) => typeof i == "string" || typeof i > "u" ? { message: i } : typeof i == "function" ? i(u) : i;
|
|
3600
3608
|
return this._refinement((u, l) => {
|
|
3601
|
-
const f = r(u),
|
|
3609
|
+
const f = r(u), h = () => l.addIssue({
|
|
3602
3610
|
code: w.custom,
|
|
3603
3611
|
...c(u)
|
|
3604
3612
|
});
|
|
3605
|
-
return typeof Promise < "u" && f instanceof Promise ? f.then((g) => g ? !0 : (
|
|
3613
|
+
return typeof Promise < "u" && f instanceof Promise ? f.then((g) => g ? !0 : (h(), !1)) : f ? !0 : (h(), !1);
|
|
3606
3614
|
});
|
|
3607
3615
|
}
|
|
3608
3616
|
refinement(r, i) {
|
|
@@ -3629,7 +3637,7 @@ class O {
|
|
|
3629
3637
|
return X.create(this, this._def);
|
|
3630
3638
|
}
|
|
3631
3639
|
nullable() {
|
|
3632
|
-
return
|
|
3640
|
+
return pe.create(this, this._def);
|
|
3633
3641
|
}
|
|
3634
3642
|
nullish() {
|
|
3635
3643
|
return this.nullable().optional();
|
|
@@ -3638,13 +3646,13 @@ class O {
|
|
|
3638
3646
|
return G.create(this);
|
|
3639
3647
|
}
|
|
3640
3648
|
promise() {
|
|
3641
|
-
return
|
|
3649
|
+
return Ve.create(this, this._def);
|
|
3642
3650
|
}
|
|
3643
3651
|
or(r) {
|
|
3644
|
-
return
|
|
3652
|
+
return gt.create([this, r], this._def);
|
|
3645
3653
|
}
|
|
3646
3654
|
and(r) {
|
|
3647
|
-
return
|
|
3655
|
+
return yt.create(this, r, this._def);
|
|
3648
3656
|
}
|
|
3649
3657
|
transform(r) {
|
|
3650
3658
|
return new J({
|
|
@@ -3656,7 +3664,7 @@ class O {
|
|
|
3656
3664
|
}
|
|
3657
3665
|
default(r) {
|
|
3658
3666
|
const i = typeof r == "function" ? r : () => r;
|
|
3659
|
-
return new
|
|
3667
|
+
return new xt({
|
|
3660
3668
|
...A(this._def),
|
|
3661
3669
|
innerType: this,
|
|
3662
3670
|
defaultValue: i,
|
|
@@ -3664,7 +3672,7 @@ class O {
|
|
|
3664
3672
|
});
|
|
3665
3673
|
}
|
|
3666
3674
|
brand() {
|
|
3667
|
-
return new
|
|
3675
|
+
return new $n({
|
|
3668
3676
|
typeName: S.ZodBranded,
|
|
3669
3677
|
type: this,
|
|
3670
3678
|
...A(this._def)
|
|
@@ -3672,7 +3680,7 @@ class O {
|
|
|
3672
3680
|
}
|
|
3673
3681
|
catch(r) {
|
|
3674
3682
|
const i = typeof r == "function" ? r : () => r;
|
|
3675
|
-
return new
|
|
3683
|
+
return new kt({
|
|
3676
3684
|
...A(this._def),
|
|
3677
3685
|
innerType: this,
|
|
3678
3686
|
catchValue: i,
|
|
@@ -3687,10 +3695,10 @@ class O {
|
|
|
3687
3695
|
});
|
|
3688
3696
|
}
|
|
3689
3697
|
pipe(r) {
|
|
3690
|
-
return
|
|
3698
|
+
return St.create(this, r);
|
|
3691
3699
|
}
|
|
3692
3700
|
readonly() {
|
|
3693
|
-
return
|
|
3701
|
+
return Et.create(this);
|
|
3694
3702
|
}
|
|
3695
3703
|
isOptional() {
|
|
3696
3704
|
return this.safeParse(void 0).success;
|
|
@@ -3699,26 +3707,26 @@ class O {
|
|
|
3699
3707
|
return this.safeParse(null).success;
|
|
3700
3708
|
}
|
|
3701
3709
|
}
|
|
3702
|
-
const
|
|
3710
|
+
const ud = /^c[^\s-]{8,}$/i, ld = /^[0-9a-z]+$/, dd = /^[0-9A-HJKMNP-TV-Z]{26}$/i, fd = /^[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, hd = /^[a-z0-9_-]{21}$/i, md = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pd = /^[-+]?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)?)??$/, gd = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, yd = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
3703
3711
|
let Sn;
|
|
3704
|
-
const
|
|
3712
|
+
const vd = /^(?:(?: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])$/, wd = /^(?:(?: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])$/, bd = /^(([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]))$/, _d = /^(([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])$/, xd = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, kd = /^([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])))", Ed = new RegExp(`^${pi}$`);
|
|
3705
3713
|
function gi(a) {
|
|
3706
3714
|
let r = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
3707
3715
|
return a.precision ? r = `${r}\\.\\d{${a.precision}}` : a.precision == null && (r = `${r}(\\.\\d+)?`), r;
|
|
3708
3716
|
}
|
|
3709
|
-
function
|
|
3717
|
+
function Sd(a) {
|
|
3710
3718
|
return new RegExp(`^${gi(a)}$`);
|
|
3711
3719
|
}
|
|
3712
3720
|
function yi(a) {
|
|
3713
|
-
let r = `${
|
|
3721
|
+
let r = `${pi}T${gi(a)}`;
|
|
3714
3722
|
const i = [];
|
|
3715
3723
|
return i.push(a.local ? "Z?" : "Z"), a.offset && i.push("([+-]\\d{2}:?\\d{2})"), r = `${r}(${i.join("|")})`, new RegExp(`^${r}$`);
|
|
3716
3724
|
}
|
|
3717
|
-
function Sd(a, r) {
|
|
3718
|
-
return !!((r === "v4" || !r) && yd.test(a) || (r === "v6" || !r) && wd.test(a));
|
|
3719
|
-
}
|
|
3720
3725
|
function Td(a, r) {
|
|
3721
|
-
|
|
3726
|
+
return !!((r === "v4" || !r) && vd.test(a) || (r === "v6" || !r) && bd.test(a));
|
|
3727
|
+
}
|
|
3728
|
+
function Ad(a, r) {
|
|
3729
|
+
if (!md.test(a))
|
|
3722
3730
|
return !1;
|
|
3723
3731
|
try {
|
|
3724
3732
|
const [i] = a.split("."), c = i.replace(/-/g, "+").replace(/_/g, "/").padEnd(i.length + (4 - i.length % 4) % 4, "="), u = JSON.parse(atob(c));
|
|
@@ -3727,8 +3735,8 @@ function Td(a, r) {
|
|
|
3727
3735
|
return !1;
|
|
3728
3736
|
}
|
|
3729
3737
|
}
|
|
3730
|
-
function
|
|
3731
|
-
return !!((r === "v4" || !r) &&
|
|
3738
|
+
function Od(a, r) {
|
|
3739
|
+
return !!((r === "v4" || !r) && wd.test(a) || (r === "v6" || !r) && _d.test(a));
|
|
3732
3740
|
}
|
|
3733
3741
|
class q extends O {
|
|
3734
3742
|
_parse(r) {
|
|
@@ -3762,15 +3770,15 @@ class q extends O {
|
|
|
3762
3770
|
message: l.message
|
|
3763
3771
|
}), c.dirty());
|
|
3764
3772
|
else if (l.kind === "length") {
|
|
3765
|
-
const f = r.data.length > l.value,
|
|
3766
|
-
(f ||
|
|
3773
|
+
const f = r.data.length > l.value, h = r.data.length < l.value;
|
|
3774
|
+
(f || h) && (u = this._getOrReturnCtx(r, u), f ? b(u, {
|
|
3767
3775
|
code: w.too_big,
|
|
3768
3776
|
maximum: l.value,
|
|
3769
3777
|
type: "string",
|
|
3770
3778
|
inclusive: !0,
|
|
3771
3779
|
exact: !0,
|
|
3772
3780
|
message: l.message
|
|
3773
|
-
}) :
|
|
3781
|
+
}) : h && b(u, {
|
|
3774
3782
|
code: w.too_small,
|
|
3775
3783
|
minimum: l.value,
|
|
3776
3784
|
type: "string",
|
|
@@ -3779,43 +3787,43 @@ class q extends O {
|
|
|
3779
3787
|
message: l.message
|
|
3780
3788
|
}), c.dirty());
|
|
3781
3789
|
} else if (l.kind === "email")
|
|
3782
|
-
|
|
3790
|
+
gd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3783
3791
|
validation: "email",
|
|
3784
3792
|
code: w.invalid_string,
|
|
3785
3793
|
message: l.message
|
|
3786
3794
|
}), c.dirty());
|
|
3787
3795
|
else if (l.kind === "emoji")
|
|
3788
|
-
Sn || (Sn = new RegExp(
|
|
3796
|
+
Sn || (Sn = new RegExp(yd, "u")), Sn.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3789
3797
|
validation: "emoji",
|
|
3790
3798
|
code: w.invalid_string,
|
|
3791
3799
|
message: l.message
|
|
3792
3800
|
}), c.dirty());
|
|
3793
3801
|
else if (l.kind === "uuid")
|
|
3794
|
-
|
|
3802
|
+
fd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3795
3803
|
validation: "uuid",
|
|
3796
3804
|
code: w.invalid_string,
|
|
3797
3805
|
message: l.message
|
|
3798
3806
|
}), c.dirty());
|
|
3799
3807
|
else if (l.kind === "nanoid")
|
|
3800
|
-
|
|
3808
|
+
hd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3801
3809
|
validation: "nanoid",
|
|
3802
3810
|
code: w.invalid_string,
|
|
3803
3811
|
message: l.message
|
|
3804
3812
|
}), c.dirty());
|
|
3805
3813
|
else if (l.kind === "cuid")
|
|
3806
|
-
|
|
3814
|
+
ud.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3807
3815
|
validation: "cuid",
|
|
3808
3816
|
code: w.invalid_string,
|
|
3809
3817
|
message: l.message
|
|
3810
3818
|
}), c.dirty());
|
|
3811
3819
|
else if (l.kind === "cuid2")
|
|
3812
|
-
|
|
3820
|
+
ld.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3813
3821
|
validation: "cuid2",
|
|
3814
3822
|
code: w.invalid_string,
|
|
3815
3823
|
message: l.message
|
|
3816
3824
|
}), c.dirty());
|
|
3817
3825
|
else if (l.kind === "ulid")
|
|
3818
|
-
|
|
3826
|
+
dd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3819
3827
|
validation: "ulid",
|
|
3820
3828
|
code: w.invalid_string,
|
|
3821
3829
|
message: l.message
|
|
@@ -3850,11 +3858,11 @@ class q extends O {
|
|
|
3850
3858
|
code: w.invalid_string,
|
|
3851
3859
|
validation: "datetime",
|
|
3852
3860
|
message: l.message
|
|
3853
|
-
}), c.dirty()) : l.kind === "date" ?
|
|
3861
|
+
}), c.dirty()) : l.kind === "date" ? Ed.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3854
3862
|
code: w.invalid_string,
|
|
3855
3863
|
validation: "date",
|
|
3856
3864
|
message: l.message
|
|
3857
|
-
}), c.dirty()) : l.kind === "time" ?
|
|
3865
|
+
}), c.dirty()) : l.kind === "time" ? Sd(l).test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3858
3866
|
code: w.invalid_string,
|
|
3859
3867
|
validation: "time",
|
|
3860
3868
|
message: l.message
|
|
@@ -3862,23 +3870,23 @@ class q extends O {
|
|
|
3862
3870
|
validation: "duration",
|
|
3863
3871
|
code: w.invalid_string,
|
|
3864
3872
|
message: l.message
|
|
3865
|
-
}), c.dirty()) : l.kind === "ip" ?
|
|
3873
|
+
}), c.dirty()) : l.kind === "ip" ? Td(r.data, l.version) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3866
3874
|
validation: "ip",
|
|
3867
3875
|
code: w.invalid_string,
|
|
3868
3876
|
message: l.message
|
|
3869
|
-
}), c.dirty()) : l.kind === "jwt" ?
|
|
3877
|
+
}), c.dirty()) : l.kind === "jwt" ? Ad(r.data, l.alg) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3870
3878
|
validation: "jwt",
|
|
3871
3879
|
code: w.invalid_string,
|
|
3872
3880
|
message: l.message
|
|
3873
|
-
}), c.dirty()) : l.kind === "cidr" ?
|
|
3881
|
+
}), c.dirty()) : l.kind === "cidr" ? Od(r.data, l.version) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3874
3882
|
validation: "cidr",
|
|
3875
3883
|
code: w.invalid_string,
|
|
3876
3884
|
message: l.message
|
|
3877
|
-
}), c.dirty()) : l.kind === "base64" ?
|
|
3885
|
+
}), c.dirty()) : l.kind === "base64" ? xd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3878
3886
|
validation: "base64",
|
|
3879
3887
|
code: w.invalid_string,
|
|
3880
3888
|
message: l.message
|
|
3881
|
-
}), c.dirty()) : l.kind === "base64url" ?
|
|
3889
|
+
}), c.dirty()) : l.kind === "base64url" ? kd.test(r.data) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3882
3890
|
validation: "base64url",
|
|
3883
3891
|
code: w.invalid_string,
|
|
3884
3892
|
message: l.message
|
|
@@ -3889,7 +3897,7 @@ class q extends O {
|
|
|
3889
3897
|
return this.refinement((u) => r.test(u), {
|
|
3890
3898
|
validation: i,
|
|
3891
3899
|
code: w.invalid_string,
|
|
3892
|
-
...
|
|
3900
|
+
...E.errToObj(c)
|
|
3893
3901
|
});
|
|
3894
3902
|
}
|
|
3895
3903
|
_addCheck(r) {
|
|
@@ -3899,46 +3907,46 @@ class q extends O {
|
|
|
3899
3907
|
});
|
|
3900
3908
|
}
|
|
3901
3909
|
email(r) {
|
|
3902
|
-
return this._addCheck({ kind: "email", ...
|
|
3910
|
+
return this._addCheck({ kind: "email", ...E.errToObj(r) });
|
|
3903
3911
|
}
|
|
3904
3912
|
url(r) {
|
|
3905
|
-
return this._addCheck({ kind: "url", ...
|
|
3913
|
+
return this._addCheck({ kind: "url", ...E.errToObj(r) });
|
|
3906
3914
|
}
|
|
3907
3915
|
emoji(r) {
|
|
3908
|
-
return this._addCheck({ kind: "emoji", ...
|
|
3916
|
+
return this._addCheck({ kind: "emoji", ...E.errToObj(r) });
|
|
3909
3917
|
}
|
|
3910
3918
|
uuid(r) {
|
|
3911
|
-
return this._addCheck({ kind: "uuid", ...
|
|
3919
|
+
return this._addCheck({ kind: "uuid", ...E.errToObj(r) });
|
|
3912
3920
|
}
|
|
3913
3921
|
nanoid(r) {
|
|
3914
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
3922
|
+
return this._addCheck({ kind: "nanoid", ...E.errToObj(r) });
|
|
3915
3923
|
}
|
|
3916
3924
|
cuid(r) {
|
|
3917
|
-
return this._addCheck({ kind: "cuid", ...
|
|
3925
|
+
return this._addCheck({ kind: "cuid", ...E.errToObj(r) });
|
|
3918
3926
|
}
|
|
3919
3927
|
cuid2(r) {
|
|
3920
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
3928
|
+
return this._addCheck({ kind: "cuid2", ...E.errToObj(r) });
|
|
3921
3929
|
}
|
|
3922
3930
|
ulid(r) {
|
|
3923
|
-
return this._addCheck({ kind: "ulid", ...
|
|
3931
|
+
return this._addCheck({ kind: "ulid", ...E.errToObj(r) });
|
|
3924
3932
|
}
|
|
3925
3933
|
base64(r) {
|
|
3926
|
-
return this._addCheck({ kind: "base64", ...
|
|
3934
|
+
return this._addCheck({ kind: "base64", ...E.errToObj(r) });
|
|
3927
3935
|
}
|
|
3928
3936
|
base64url(r) {
|
|
3929
3937
|
return this._addCheck({
|
|
3930
3938
|
kind: "base64url",
|
|
3931
|
-
...
|
|
3939
|
+
...E.errToObj(r)
|
|
3932
3940
|
});
|
|
3933
3941
|
}
|
|
3934
3942
|
jwt(r) {
|
|
3935
|
-
return this._addCheck({ kind: "jwt", ...
|
|
3943
|
+
return this._addCheck({ kind: "jwt", ...E.errToObj(r) });
|
|
3936
3944
|
}
|
|
3937
3945
|
ip(r) {
|
|
3938
|
-
return this._addCheck({ kind: "ip", ...
|
|
3946
|
+
return this._addCheck({ kind: "ip", ...E.errToObj(r) });
|
|
3939
3947
|
}
|
|
3940
3948
|
cidr(r) {
|
|
3941
|
-
return this._addCheck({ kind: "cidr", ...
|
|
3949
|
+
return this._addCheck({ kind: "cidr", ...E.errToObj(r) });
|
|
3942
3950
|
}
|
|
3943
3951
|
datetime(r) {
|
|
3944
3952
|
var i, c;
|
|
@@ -3953,7 +3961,7 @@ class q extends O {
|
|
|
3953
3961
|
precision: typeof (r == null ? void 0 : r.precision) > "u" ? null : r == null ? void 0 : r.precision,
|
|
3954
3962
|
offset: (i = r == null ? void 0 : r.offset) !== null && i !== void 0 ? i : !1,
|
|
3955
3963
|
local: (c = r == null ? void 0 : r.local) !== null && c !== void 0 ? c : !1,
|
|
3956
|
-
...
|
|
3964
|
+
...E.errToObj(r == null ? void 0 : r.message)
|
|
3957
3965
|
});
|
|
3958
3966
|
}
|
|
3959
3967
|
date(r) {
|
|
@@ -3967,17 +3975,17 @@ class q extends O {
|
|
|
3967
3975
|
}) : this._addCheck({
|
|
3968
3976
|
kind: "time",
|
|
3969
3977
|
precision: typeof (r == null ? void 0 : r.precision) > "u" ? null : r == null ? void 0 : r.precision,
|
|
3970
|
-
...
|
|
3978
|
+
...E.errToObj(r == null ? void 0 : r.message)
|
|
3971
3979
|
});
|
|
3972
3980
|
}
|
|
3973
3981
|
duration(r) {
|
|
3974
|
-
return this._addCheck({ kind: "duration", ...
|
|
3982
|
+
return this._addCheck({ kind: "duration", ...E.errToObj(r) });
|
|
3975
3983
|
}
|
|
3976
3984
|
regex(r, i) {
|
|
3977
3985
|
return this._addCheck({
|
|
3978
3986
|
kind: "regex",
|
|
3979
3987
|
regex: r,
|
|
3980
|
-
...
|
|
3988
|
+
...E.errToObj(i)
|
|
3981
3989
|
});
|
|
3982
3990
|
}
|
|
3983
3991
|
includes(r, i) {
|
|
@@ -3985,49 +3993,49 @@ class q extends O {
|
|
|
3985
3993
|
kind: "includes",
|
|
3986
3994
|
value: r,
|
|
3987
3995
|
position: i == null ? void 0 : i.position,
|
|
3988
|
-
...
|
|
3996
|
+
...E.errToObj(i == null ? void 0 : i.message)
|
|
3989
3997
|
});
|
|
3990
3998
|
}
|
|
3991
3999
|
startsWith(r, i) {
|
|
3992
4000
|
return this._addCheck({
|
|
3993
4001
|
kind: "startsWith",
|
|
3994
4002
|
value: r,
|
|
3995
|
-
...
|
|
4003
|
+
...E.errToObj(i)
|
|
3996
4004
|
});
|
|
3997
4005
|
}
|
|
3998
4006
|
endsWith(r, i) {
|
|
3999
4007
|
return this._addCheck({
|
|
4000
4008
|
kind: "endsWith",
|
|
4001
4009
|
value: r,
|
|
4002
|
-
...
|
|
4010
|
+
...E.errToObj(i)
|
|
4003
4011
|
});
|
|
4004
4012
|
}
|
|
4005
4013
|
min(r, i) {
|
|
4006
4014
|
return this._addCheck({
|
|
4007
4015
|
kind: "min",
|
|
4008
4016
|
value: r,
|
|
4009
|
-
...
|
|
4017
|
+
...E.errToObj(i)
|
|
4010
4018
|
});
|
|
4011
4019
|
}
|
|
4012
4020
|
max(r, i) {
|
|
4013
4021
|
return this._addCheck({
|
|
4014
4022
|
kind: "max",
|
|
4015
4023
|
value: r,
|
|
4016
|
-
...
|
|
4024
|
+
...E.errToObj(i)
|
|
4017
4025
|
});
|
|
4018
4026
|
}
|
|
4019
4027
|
length(r, i) {
|
|
4020
4028
|
return this._addCheck({
|
|
4021
4029
|
kind: "length",
|
|
4022
4030
|
value: r,
|
|
4023
|
-
...
|
|
4031
|
+
...E.errToObj(i)
|
|
4024
4032
|
});
|
|
4025
4033
|
}
|
|
4026
4034
|
/**
|
|
4027
4035
|
* Equivalent to `.min(1)`
|
|
4028
4036
|
*/
|
|
4029
4037
|
nonempty(r) {
|
|
4030
|
-
return this.min(1,
|
|
4038
|
+
return this.min(1, E.errToObj(r));
|
|
4031
4039
|
}
|
|
4032
4040
|
trim() {
|
|
4033
4041
|
return new q({
|
|
@@ -4117,7 +4125,7 @@ q.create = (a) => {
|
|
|
4117
4125
|
...A(a)
|
|
4118
4126
|
});
|
|
4119
4127
|
};
|
|
4120
|
-
function
|
|
4128
|
+
function Id(a, r) {
|
|
4121
4129
|
const i = (a.toString().split(".")[1] || "").length, c = (r.toString().split(".")[1] || "").length, u = i > c ? i : c, l = parseInt(a.toFixed(u).replace(".", "")), f = parseInt(r.toFixed(u).replace(".", ""));
|
|
4122
4130
|
return l % f / Math.pow(10, u);
|
|
4123
4131
|
}
|
|
@@ -4156,7 +4164,7 @@ class fe extends O {
|
|
|
4156
4164
|
inclusive: l.inclusive,
|
|
4157
4165
|
exact: !1,
|
|
4158
4166
|
message: l.message
|
|
4159
|
-
}), u.dirty()) : l.kind === "multipleOf" ?
|
|
4167
|
+
}), u.dirty()) : l.kind === "multipleOf" ? Id(r.data, l.value) !== 0 && (c = this._getOrReturnCtx(r, c), b(c, {
|
|
4160
4168
|
code: w.not_multiple_of,
|
|
4161
4169
|
multipleOf: l.value,
|
|
4162
4170
|
message: l.message
|
|
@@ -4167,16 +4175,16 @@ class fe extends O {
|
|
|
4167
4175
|
return { status: u.value, value: r.data };
|
|
4168
4176
|
}
|
|
4169
4177
|
gte(r, i) {
|
|
4170
|
-
return this.setLimit("min", r, !0,
|
|
4178
|
+
return this.setLimit("min", r, !0, E.toString(i));
|
|
4171
4179
|
}
|
|
4172
4180
|
gt(r, i) {
|
|
4173
|
-
return this.setLimit("min", r, !1,
|
|
4181
|
+
return this.setLimit("min", r, !1, E.toString(i));
|
|
4174
4182
|
}
|
|
4175
4183
|
lte(r, i) {
|
|
4176
|
-
return this.setLimit("max", r, !0,
|
|
4184
|
+
return this.setLimit("max", r, !0, E.toString(i));
|
|
4177
4185
|
}
|
|
4178
4186
|
lt(r, i) {
|
|
4179
|
-
return this.setLimit("max", r, !1,
|
|
4187
|
+
return this.setLimit("max", r, !1, E.toString(i));
|
|
4180
4188
|
}
|
|
4181
4189
|
setLimit(r, i, c, u) {
|
|
4182
4190
|
return new fe({
|
|
@@ -4187,7 +4195,7 @@ class fe extends O {
|
|
|
4187
4195
|
kind: r,
|
|
4188
4196
|
value: i,
|
|
4189
4197
|
inclusive: c,
|
|
4190
|
-
message:
|
|
4198
|
+
message: E.toString(u)
|
|
4191
4199
|
}
|
|
4192
4200
|
]
|
|
4193
4201
|
});
|
|
@@ -4201,7 +4209,7 @@ class fe extends O {
|
|
|
4201
4209
|
int(r) {
|
|
4202
4210
|
return this._addCheck({
|
|
4203
4211
|
kind: "int",
|
|
4204
|
-
message:
|
|
4212
|
+
message: E.toString(r)
|
|
4205
4213
|
});
|
|
4206
4214
|
}
|
|
4207
4215
|
positive(r) {
|
|
@@ -4209,7 +4217,7 @@ class fe extends O {
|
|
|
4209
4217
|
kind: "min",
|
|
4210
4218
|
value: 0,
|
|
4211
4219
|
inclusive: !1,
|
|
4212
|
-
message:
|
|
4220
|
+
message: E.toString(r)
|
|
4213
4221
|
});
|
|
4214
4222
|
}
|
|
4215
4223
|
negative(r) {
|
|
@@ -4217,7 +4225,7 @@ class fe extends O {
|
|
|
4217
4225
|
kind: "max",
|
|
4218
4226
|
value: 0,
|
|
4219
4227
|
inclusive: !1,
|
|
4220
|
-
message:
|
|
4228
|
+
message: E.toString(r)
|
|
4221
4229
|
});
|
|
4222
4230
|
}
|
|
4223
4231
|
nonpositive(r) {
|
|
@@ -4225,7 +4233,7 @@ class fe extends O {
|
|
|
4225
4233
|
kind: "max",
|
|
4226
4234
|
value: 0,
|
|
4227
4235
|
inclusive: !0,
|
|
4228
|
-
message:
|
|
4236
|
+
message: E.toString(r)
|
|
4229
4237
|
});
|
|
4230
4238
|
}
|
|
4231
4239
|
nonnegative(r) {
|
|
@@ -4233,20 +4241,20 @@ class fe extends O {
|
|
|
4233
4241
|
kind: "min",
|
|
4234
4242
|
value: 0,
|
|
4235
4243
|
inclusive: !0,
|
|
4236
|
-
message:
|
|
4244
|
+
message: E.toString(r)
|
|
4237
4245
|
});
|
|
4238
4246
|
}
|
|
4239
4247
|
multipleOf(r, i) {
|
|
4240
4248
|
return this._addCheck({
|
|
4241
4249
|
kind: "multipleOf",
|
|
4242
4250
|
value: r,
|
|
4243
|
-
message:
|
|
4251
|
+
message: E.toString(i)
|
|
4244
4252
|
});
|
|
4245
4253
|
}
|
|
4246
4254
|
finite(r) {
|
|
4247
4255
|
return this._addCheck({
|
|
4248
4256
|
kind: "finite",
|
|
4249
|
-
message:
|
|
4257
|
+
message: E.toString(r)
|
|
4250
4258
|
});
|
|
4251
4259
|
}
|
|
4252
4260
|
safe(r) {
|
|
@@ -4254,12 +4262,12 @@ class fe extends O {
|
|
|
4254
4262
|
kind: "min",
|
|
4255
4263
|
inclusive: !0,
|
|
4256
4264
|
value: Number.MIN_SAFE_INTEGER,
|
|
4257
|
-
message:
|
|
4265
|
+
message: E.toString(r)
|
|
4258
4266
|
})._addCheck({
|
|
4259
4267
|
kind: "max",
|
|
4260
4268
|
inclusive: !0,
|
|
4261
4269
|
value: Number.MAX_SAFE_INTEGER,
|
|
4262
|
-
message:
|
|
4270
|
+
message: E.toString(r)
|
|
4263
4271
|
});
|
|
4264
4272
|
}
|
|
4265
4273
|
get minValue() {
|
|
@@ -4337,16 +4345,16 @@ class he extends O {
|
|
|
4337
4345
|
}), T;
|
|
4338
4346
|
}
|
|
4339
4347
|
gte(r, i) {
|
|
4340
|
-
return this.setLimit("min", r, !0,
|
|
4348
|
+
return this.setLimit("min", r, !0, E.toString(i));
|
|
4341
4349
|
}
|
|
4342
4350
|
gt(r, i) {
|
|
4343
|
-
return this.setLimit("min", r, !1,
|
|
4351
|
+
return this.setLimit("min", r, !1, E.toString(i));
|
|
4344
4352
|
}
|
|
4345
4353
|
lte(r, i) {
|
|
4346
|
-
return this.setLimit("max", r, !0,
|
|
4354
|
+
return this.setLimit("max", r, !0, E.toString(i));
|
|
4347
4355
|
}
|
|
4348
4356
|
lt(r, i) {
|
|
4349
|
-
return this.setLimit("max", r, !1,
|
|
4357
|
+
return this.setLimit("max", r, !1, E.toString(i));
|
|
4350
4358
|
}
|
|
4351
4359
|
setLimit(r, i, c, u) {
|
|
4352
4360
|
return new he({
|
|
@@ -4357,7 +4365,7 @@ class he extends O {
|
|
|
4357
4365
|
kind: r,
|
|
4358
4366
|
value: i,
|
|
4359
4367
|
inclusive: c,
|
|
4360
|
-
message:
|
|
4368
|
+
message: E.toString(u)
|
|
4361
4369
|
}
|
|
4362
4370
|
]
|
|
4363
4371
|
});
|
|
@@ -4373,7 +4381,7 @@ class he extends O {
|
|
|
4373
4381
|
kind: "min",
|
|
4374
4382
|
value: BigInt(0),
|
|
4375
4383
|
inclusive: !1,
|
|
4376
|
-
message:
|
|
4384
|
+
message: E.toString(r)
|
|
4377
4385
|
});
|
|
4378
4386
|
}
|
|
4379
4387
|
negative(r) {
|
|
@@ -4381,7 +4389,7 @@ class he extends O {
|
|
|
4381
4389
|
kind: "max",
|
|
4382
4390
|
value: BigInt(0),
|
|
4383
4391
|
inclusive: !1,
|
|
4384
|
-
message:
|
|
4392
|
+
message: E.toString(r)
|
|
4385
4393
|
});
|
|
4386
4394
|
}
|
|
4387
4395
|
nonpositive(r) {
|
|
@@ -4389,7 +4397,7 @@ class he extends O {
|
|
|
4389
4397
|
kind: "max",
|
|
4390
4398
|
value: BigInt(0),
|
|
4391
4399
|
inclusive: !0,
|
|
4392
|
-
message:
|
|
4400
|
+
message: E.toString(r)
|
|
4393
4401
|
});
|
|
4394
4402
|
}
|
|
4395
4403
|
nonnegative(r) {
|
|
@@ -4397,14 +4405,14 @@ class he extends O {
|
|
|
4397
4405
|
kind: "min",
|
|
4398
4406
|
value: BigInt(0),
|
|
4399
4407
|
inclusive: !0,
|
|
4400
|
-
message:
|
|
4408
|
+
message: E.toString(r)
|
|
4401
4409
|
});
|
|
4402
4410
|
}
|
|
4403
4411
|
multipleOf(r, i) {
|
|
4404
4412
|
return this._addCheck({
|
|
4405
4413
|
kind: "multipleOf",
|
|
4406
4414
|
value: r,
|
|
4407
|
-
message:
|
|
4415
|
+
message: E.toString(i)
|
|
4408
4416
|
});
|
|
4409
4417
|
}
|
|
4410
4418
|
get minValue() {
|
|
@@ -4429,7 +4437,7 @@ he.create = (a) => {
|
|
|
4429
4437
|
...A(a)
|
|
4430
4438
|
});
|
|
4431
4439
|
};
|
|
4432
|
-
class
|
|
4440
|
+
class ht extends O {
|
|
4433
4441
|
_parse(r) {
|
|
4434
4442
|
if (this._def.coerce && (r.data = !!r.data), this._getType(r) !== _.boolean) {
|
|
4435
4443
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4442,7 +4450,7 @@ class ft extends O {
|
|
|
4442
4450
|
return z(r.data);
|
|
4443
4451
|
}
|
|
4444
4452
|
}
|
|
4445
|
-
|
|
4453
|
+
ht.create = (a) => new ht({
|
|
4446
4454
|
typeName: S.ZodBoolean,
|
|
4447
4455
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4448
4456
|
...A(a)
|
|
@@ -4496,14 +4504,14 @@ class Te extends O {
|
|
|
4496
4504
|
return this._addCheck({
|
|
4497
4505
|
kind: "min",
|
|
4498
4506
|
value: r.getTime(),
|
|
4499
|
-
message:
|
|
4507
|
+
message: E.toString(i)
|
|
4500
4508
|
});
|
|
4501
4509
|
}
|
|
4502
4510
|
max(r, i) {
|
|
4503
4511
|
return this._addCheck({
|
|
4504
4512
|
kind: "max",
|
|
4505
4513
|
value: r.getTime(),
|
|
4506
|
-
message:
|
|
4514
|
+
message: E.toString(i)
|
|
4507
4515
|
});
|
|
4508
4516
|
}
|
|
4509
4517
|
get minDate() {
|
|
@@ -4525,7 +4533,7 @@ Te.create = (a) => new Te({
|
|
|
4525
4533
|
typeName: S.ZodDate,
|
|
4526
4534
|
...A(a)
|
|
4527
4535
|
});
|
|
4528
|
-
class
|
|
4536
|
+
class Wt extends O {
|
|
4529
4537
|
_parse(r) {
|
|
4530
4538
|
if (this._getType(r) !== _.symbol) {
|
|
4531
4539
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4538,11 +4546,11 @@ class Ft extends O {
|
|
|
4538
4546
|
return z(r.data);
|
|
4539
4547
|
}
|
|
4540
4548
|
}
|
|
4541
|
-
|
|
4549
|
+
Wt.create = (a) => new Wt({
|
|
4542
4550
|
typeName: S.ZodSymbol,
|
|
4543
4551
|
...A(a)
|
|
4544
4552
|
});
|
|
4545
|
-
class
|
|
4553
|
+
class mt extends O {
|
|
4546
4554
|
_parse(r) {
|
|
4547
4555
|
if (this._getType(r) !== _.undefined) {
|
|
4548
4556
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4555,7 +4563,7 @@ class ht extends O {
|
|
|
4555
4563
|
return z(r.data);
|
|
4556
4564
|
}
|
|
4557
4565
|
}
|
|
4558
|
-
|
|
4566
|
+
mt.create = (a) => new mt({
|
|
4559
4567
|
typeName: S.ZodUndefined,
|
|
4560
4568
|
...A(a)
|
|
4561
4569
|
});
|
|
@@ -4576,7 +4584,7 @@ pt.create = (a) => new pt({
|
|
|
4576
4584
|
typeName: S.ZodNull,
|
|
4577
4585
|
...A(a)
|
|
4578
4586
|
});
|
|
4579
|
-
class
|
|
4587
|
+
class ze extends O {
|
|
4580
4588
|
constructor() {
|
|
4581
4589
|
super(...arguments), this._any = !0;
|
|
4582
4590
|
}
|
|
@@ -4584,7 +4592,7 @@ class Ve extends O {
|
|
|
4584
4592
|
return z(r.data);
|
|
4585
4593
|
}
|
|
4586
4594
|
}
|
|
4587
|
-
|
|
4595
|
+
ze.create = (a) => new ze({
|
|
4588
4596
|
typeName: S.ZodAny,
|
|
4589
4597
|
...A(a)
|
|
4590
4598
|
});
|
|
@@ -4614,7 +4622,7 @@ oe.create = (a) => new oe({
|
|
|
4614
4622
|
typeName: S.ZodNever,
|
|
4615
4623
|
...A(a)
|
|
4616
4624
|
});
|
|
4617
|
-
class
|
|
4625
|
+
class Ht extends O {
|
|
4618
4626
|
_parse(r) {
|
|
4619
4627
|
if (this._getType(r) !== _.undefined) {
|
|
4620
4628
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4627,7 +4635,7 @@ class Wt extends O {
|
|
|
4627
4635
|
return z(r.data);
|
|
4628
4636
|
}
|
|
4629
4637
|
}
|
|
4630
|
-
|
|
4638
|
+
Ht.create = (a) => new Ht({
|
|
4631
4639
|
typeName: S.ZodVoid,
|
|
4632
4640
|
...A(a)
|
|
4633
4641
|
});
|
|
@@ -4641,10 +4649,10 @@ class G extends O {
|
|
|
4641
4649
|
received: i.parsedType
|
|
4642
4650
|
}), T;
|
|
4643
4651
|
if (u.exactLength !== null) {
|
|
4644
|
-
const f = i.data.length > u.exactLength.value,
|
|
4645
|
-
(f ||
|
|
4652
|
+
const f = i.data.length > u.exactLength.value, h = i.data.length < u.exactLength.value;
|
|
4653
|
+
(f || h) && (b(i, {
|
|
4646
4654
|
code: f ? w.too_big : w.too_small,
|
|
4647
|
-
minimum:
|
|
4655
|
+
minimum: h ? u.exactLength.value : void 0,
|
|
4648
4656
|
maximum: f ? u.exactLength.value : void 0,
|
|
4649
4657
|
type: "array",
|
|
4650
4658
|
inclusive: !0,
|
|
@@ -4667,8 +4675,8 @@ class G extends O {
|
|
|
4667
4675
|
exact: !1,
|
|
4668
4676
|
message: u.maxLength.message
|
|
4669
4677
|
}), c.dirty()), i.common.async)
|
|
4670
|
-
return Promise.all([...i.data].map((f,
|
|
4671
|
-
const l = [...i.data].map((f,
|
|
4678
|
+
return Promise.all([...i.data].map((f, h) => u.type._parseAsync(new ee(i, f, i.path, h)))).then((f) => L.mergeArray(c, f));
|
|
4679
|
+
const l = [...i.data].map((f, h) => u.type._parseSync(new ee(i, f, i.path, h)));
|
|
4672
4680
|
return L.mergeArray(c, l);
|
|
4673
4681
|
}
|
|
4674
4682
|
get element() {
|
|
@@ -4677,19 +4685,19 @@ class G extends O {
|
|
|
4677
4685
|
min(r, i) {
|
|
4678
4686
|
return new G({
|
|
4679
4687
|
...this._def,
|
|
4680
|
-
minLength: { value: r, message:
|
|
4688
|
+
minLength: { value: r, message: E.toString(i) }
|
|
4681
4689
|
});
|
|
4682
4690
|
}
|
|
4683
4691
|
max(r, i) {
|
|
4684
4692
|
return new G({
|
|
4685
4693
|
...this._def,
|
|
4686
|
-
maxLength: { value: r, message:
|
|
4694
|
+
maxLength: { value: r, message: E.toString(i) }
|
|
4687
4695
|
});
|
|
4688
4696
|
}
|
|
4689
4697
|
length(r, i) {
|
|
4690
4698
|
return new G({
|
|
4691
4699
|
...this._def,
|
|
4692
|
-
exactLength: { value: r, message:
|
|
4700
|
+
exactLength: { value: r, message: E.toString(i) }
|
|
4693
4701
|
});
|
|
4694
4702
|
}
|
|
4695
4703
|
nonempty(r) {
|
|
@@ -4704,12 +4712,12 @@ G.create = (a, r) => new G({
|
|
|
4704
4712
|
typeName: S.ZodArray,
|
|
4705
4713
|
...A(r)
|
|
4706
4714
|
});
|
|
4707
|
-
function
|
|
4715
|
+
function De(a) {
|
|
4708
4716
|
if (a instanceof C) {
|
|
4709
4717
|
const r = {};
|
|
4710
4718
|
for (const i in a.shape) {
|
|
4711
4719
|
const c = a.shape[i];
|
|
4712
|
-
r[i] = X.create(
|
|
4720
|
+
r[i] = X.create(De(c));
|
|
4713
4721
|
}
|
|
4714
4722
|
return new C({
|
|
4715
4723
|
...a._def,
|
|
@@ -4717,8 +4725,8 @@ function Ue(a) {
|
|
|
4717
4725
|
});
|
|
4718
4726
|
} else return a instanceof G ? new G({
|
|
4719
4727
|
...a._def,
|
|
4720
|
-
type:
|
|
4721
|
-
}) : a instanceof X ? X.create(
|
|
4728
|
+
type: De(a.element)
|
|
4729
|
+
}) : a instanceof X ? X.create(De(a.unwrap())) : a instanceof pe ? pe.create(De(a.unwrap())) : a instanceof te ? te.create(a.items.map((r) => De(r))) : a;
|
|
4722
4730
|
}
|
|
4723
4731
|
class C extends O {
|
|
4724
4732
|
constructor() {
|
|
@@ -4739,55 +4747,55 @@ class C extends O {
|
|
|
4739
4747
|
received: y.parsedType
|
|
4740
4748
|
}), T;
|
|
4741
4749
|
}
|
|
4742
|
-
const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: f } = this._getCached(),
|
|
4750
|
+
const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: f } = this._getCached(), h = [];
|
|
4743
4751
|
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
4744
4752
|
for (const y in u.data)
|
|
4745
|
-
f.includes(y) ||
|
|
4753
|
+
f.includes(y) || h.push(y);
|
|
4746
4754
|
const g = [];
|
|
4747
4755
|
for (const y of f) {
|
|
4748
|
-
const
|
|
4756
|
+
const x = l[y], N = u.data[y];
|
|
4749
4757
|
g.push({
|
|
4750
4758
|
key: { status: "valid", value: y },
|
|
4751
|
-
value:
|
|
4759
|
+
value: x._parse(new ee(u, N, u.path, y)),
|
|
4752
4760
|
alwaysSet: y in u.data
|
|
4753
4761
|
});
|
|
4754
4762
|
}
|
|
4755
4763
|
if (this._def.catchall instanceof oe) {
|
|
4756
4764
|
const y = this._def.unknownKeys;
|
|
4757
4765
|
if (y === "passthrough")
|
|
4758
|
-
for (const
|
|
4766
|
+
for (const x of h)
|
|
4759
4767
|
g.push({
|
|
4760
|
-
key: { status: "valid", value:
|
|
4761
|
-
value: { status: "valid", value: u.data[
|
|
4768
|
+
key: { status: "valid", value: x },
|
|
4769
|
+
value: { status: "valid", value: u.data[x] }
|
|
4762
4770
|
});
|
|
4763
4771
|
else if (y === "strict")
|
|
4764
|
-
|
|
4772
|
+
h.length > 0 && (b(u, {
|
|
4765
4773
|
code: w.unrecognized_keys,
|
|
4766
|
-
keys:
|
|
4774
|
+
keys: h
|
|
4767
4775
|
}), c.dirty());
|
|
4768
4776
|
else if (y !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
4769
4777
|
} else {
|
|
4770
4778
|
const y = this._def.catchall;
|
|
4771
|
-
for (const
|
|
4772
|
-
const N = u.data[
|
|
4779
|
+
for (const x of h) {
|
|
4780
|
+
const N = u.data[x];
|
|
4773
4781
|
g.push({
|
|
4774
|
-
key: { status: "valid", value:
|
|
4782
|
+
key: { status: "valid", value: x },
|
|
4775
4783
|
value: y._parse(
|
|
4776
|
-
new ee(u, N, u.path,
|
|
4784
|
+
new ee(u, N, u.path, x)
|
|
4777
4785
|
//, ctx.child(key), value, getParsedType(value)
|
|
4778
4786
|
),
|
|
4779
|
-
alwaysSet:
|
|
4787
|
+
alwaysSet: x in u.data
|
|
4780
4788
|
});
|
|
4781
4789
|
}
|
|
4782
4790
|
}
|
|
4783
4791
|
return u.common.async ? Promise.resolve().then(async () => {
|
|
4784
4792
|
const y = [];
|
|
4785
|
-
for (const
|
|
4786
|
-
const N = await
|
|
4793
|
+
for (const x of g) {
|
|
4794
|
+
const N = await x.key, re = await x.value;
|
|
4787
4795
|
y.push({
|
|
4788
4796
|
key: N,
|
|
4789
4797
|
value: re,
|
|
4790
|
-
alwaysSet:
|
|
4798
|
+
alwaysSet: x.alwaysSet
|
|
4791
4799
|
});
|
|
4792
4800
|
}
|
|
4793
4801
|
return y;
|
|
@@ -4797,15 +4805,15 @@ class C extends O {
|
|
|
4797
4805
|
return this._def.shape();
|
|
4798
4806
|
}
|
|
4799
4807
|
strict(r) {
|
|
4800
|
-
return
|
|
4808
|
+
return E.errToObj, new C({
|
|
4801
4809
|
...this._def,
|
|
4802
4810
|
unknownKeys: "strict",
|
|
4803
4811
|
...r !== void 0 ? {
|
|
4804
4812
|
errorMap: (i, c) => {
|
|
4805
|
-
var u, l, f,
|
|
4813
|
+
var u, l, f, h;
|
|
4806
4814
|
const g = (f = (l = (u = this._def).errorMap) === null || l === void 0 ? void 0 : l.call(u, i, c).message) !== null && f !== void 0 ? f : c.defaultError;
|
|
4807
4815
|
return i.code === "unrecognized_keys" ? {
|
|
4808
|
-
message: (
|
|
4816
|
+
message: (h = E.errToObj(r).message) !== null && h !== void 0 ? h : g
|
|
4809
4817
|
} : {
|
|
4810
4818
|
message: g
|
|
4811
4819
|
};
|
|
@@ -4954,7 +4962,7 @@ class C extends O {
|
|
|
4954
4962
|
* @deprecated
|
|
4955
4963
|
*/
|
|
4956
4964
|
deepPartial() {
|
|
4957
|
-
return
|
|
4965
|
+
return De(this);
|
|
4958
4966
|
}
|
|
4959
4967
|
partial(r) {
|
|
4960
4968
|
const i = {};
|
|
@@ -5007,17 +5015,17 @@ C.lazycreate = (a, r) => new C({
|
|
|
5007
5015
|
typeName: S.ZodObject,
|
|
5008
5016
|
...A(r)
|
|
5009
5017
|
});
|
|
5010
|
-
class
|
|
5018
|
+
class gt extends O {
|
|
5011
5019
|
_parse(r) {
|
|
5012
5020
|
const { ctx: i } = this._processInputParams(r), c = this._def.options;
|
|
5013
5021
|
function u(l) {
|
|
5014
|
-
for (const
|
|
5015
|
-
if (
|
|
5016
|
-
return
|
|
5017
|
-
for (const
|
|
5018
|
-
if (
|
|
5019
|
-
return i.common.issues.push(...
|
|
5020
|
-
const f = l.map((
|
|
5022
|
+
for (const h of l)
|
|
5023
|
+
if (h.result.status === "valid")
|
|
5024
|
+
return h.result;
|
|
5025
|
+
for (const h of l)
|
|
5026
|
+
if (h.result.status === "dirty")
|
|
5027
|
+
return i.common.issues.push(...h.ctx.common.issues), h.result;
|
|
5028
|
+
const f = l.map((h) => new V(h.ctx.common.issues));
|
|
5021
5029
|
return b(i, {
|
|
5022
5030
|
code: w.invalid_union,
|
|
5023
5031
|
unionErrors: f
|
|
@@ -5053,21 +5061,21 @@ class mt extends O {
|
|
|
5053
5061
|
issues: []
|
|
5054
5062
|
},
|
|
5055
5063
|
parent: null
|
|
5056
|
-
},
|
|
5064
|
+
}, x = g._parseSync({
|
|
5057
5065
|
data: i.data,
|
|
5058
5066
|
path: i.path,
|
|
5059
5067
|
parent: y
|
|
5060
5068
|
});
|
|
5061
|
-
if (
|
|
5062
|
-
return
|
|
5063
|
-
|
|
5069
|
+
if (x.status === "valid")
|
|
5070
|
+
return x;
|
|
5071
|
+
x.status === "dirty" && !l && (l = { result: x, ctx: y }), y.common.issues.length && f.push(y.common.issues);
|
|
5064
5072
|
}
|
|
5065
5073
|
if (l)
|
|
5066
5074
|
return i.common.issues.push(...l.ctx.common.issues), l.result;
|
|
5067
|
-
const
|
|
5075
|
+
const h = f.map((g) => new V(g));
|
|
5068
5076
|
return b(i, {
|
|
5069
5077
|
code: w.invalid_union,
|
|
5070
|
-
unionErrors:
|
|
5078
|
+
unionErrors: h
|
|
5071
5079
|
}), T;
|
|
5072
5080
|
}
|
|
5073
5081
|
}
|
|
@@ -5075,13 +5083,13 @@ class mt extends O {
|
|
|
5075
5083
|
return this._def.options;
|
|
5076
5084
|
}
|
|
5077
5085
|
}
|
|
5078
|
-
|
|
5086
|
+
gt.create = (a, r) => new gt({
|
|
5079
5087
|
options: a,
|
|
5080
5088
|
typeName: S.ZodUnion,
|
|
5081
5089
|
...A(r)
|
|
5082
5090
|
});
|
|
5083
|
-
const ie = (a) => a instanceof
|
|
5084
|
-
class
|
|
5091
|
+
const ie = (a) => a instanceof wt ? ie(a.schema) : a instanceof J ? ie(a.innerType()) : a instanceof bt ? [a.value] : a instanceof me ? a.options : a instanceof _t ? I.objectValues(a.enum) : a instanceof xt ? ie(a._def.innerType) : a instanceof mt ? [void 0] : a instanceof pt ? [null] : a instanceof X ? [void 0, ...ie(a.unwrap())] : a instanceof pe ? [null, ...ie(a.unwrap())] : a instanceof $n || a instanceof Et ? ie(a.unwrap()) : a instanceof kt ? ie(a._def.innerType) : [];
|
|
5092
|
+
class Jt extends O {
|
|
5085
5093
|
_parse(r) {
|
|
5086
5094
|
const { ctx: i } = this._processInputParams(r);
|
|
5087
5095
|
if (i.parsedType !== _.object)
|
|
@@ -5128,13 +5136,13 @@ class Gt extends O {
|
|
|
5128
5136
|
const f = ie(l.shape[r]);
|
|
5129
5137
|
if (!f.length)
|
|
5130
5138
|
throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);
|
|
5131
|
-
for (const
|
|
5132
|
-
if (u.has(
|
|
5133
|
-
throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(
|
|
5134
|
-
u.set(
|
|
5139
|
+
for (const h of f) {
|
|
5140
|
+
if (u.has(h))
|
|
5141
|
+
throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(h)}`);
|
|
5142
|
+
u.set(h, l);
|
|
5135
5143
|
}
|
|
5136
5144
|
}
|
|
5137
|
-
return new
|
|
5145
|
+
return new Jt({
|
|
5138
5146
|
typeName: S.ZodDiscriminatedUnion,
|
|
5139
5147
|
discriminator: r,
|
|
5140
5148
|
options: i,
|
|
@@ -5143,17 +5151,17 @@ class Gt extends O {
|
|
|
5143
5151
|
});
|
|
5144
5152
|
}
|
|
5145
5153
|
}
|
|
5146
|
-
function
|
|
5154
|
+
function Mn(a, r) {
|
|
5147
5155
|
const i = ae(a), c = ae(r);
|
|
5148
5156
|
if (a === r)
|
|
5149
5157
|
return { valid: !0, data: a };
|
|
5150
5158
|
if (i === _.object && c === _.object) {
|
|
5151
|
-
const u = I.objectKeys(r), l = I.objectKeys(a).filter((
|
|
5152
|
-
for (const
|
|
5153
|
-
const g =
|
|
5159
|
+
const u = I.objectKeys(r), l = I.objectKeys(a).filter((h) => u.indexOf(h) !== -1), f = { ...a, ...r };
|
|
5160
|
+
for (const h of l) {
|
|
5161
|
+
const g = Mn(a[h], r[h]);
|
|
5154
5162
|
if (!g.valid)
|
|
5155
5163
|
return { valid: !1 };
|
|
5156
|
-
f[
|
|
5164
|
+
f[h] = g.data;
|
|
5157
5165
|
}
|
|
5158
5166
|
return { valid: !0, data: f };
|
|
5159
5167
|
} else if (i === _.array && c === _.array) {
|
|
@@ -5161,7 +5169,7 @@ function $n(a, r) {
|
|
|
5161
5169
|
return { valid: !1 };
|
|
5162
5170
|
const u = [];
|
|
5163
5171
|
for (let l = 0; l < a.length; l++) {
|
|
5164
|
-
const f = a[l],
|
|
5172
|
+
const f = a[l], h = r[l], g = Mn(f, h);
|
|
5165
5173
|
if (!g.valid)
|
|
5166
5174
|
return { valid: !1 };
|
|
5167
5175
|
u.push(g.data);
|
|
@@ -5169,13 +5177,13 @@ function $n(a, r) {
|
|
|
5169
5177
|
return { valid: !0, data: u };
|
|
5170
5178
|
} else return i === _.date && c === _.date && +a == +r ? { valid: !0, data: a } : { valid: !1 };
|
|
5171
5179
|
}
|
|
5172
|
-
class
|
|
5180
|
+
class yt extends O {
|
|
5173
5181
|
_parse(r) {
|
|
5174
5182
|
const { status: i, ctx: c } = this._processInputParams(r), u = (l, f) => {
|
|
5175
|
-
if (
|
|
5183
|
+
if (On(l) || On(f))
|
|
5176
5184
|
return T;
|
|
5177
|
-
const
|
|
5178
|
-
return
|
|
5185
|
+
const h = Mn(l.value, f.value);
|
|
5186
|
+
return h.valid ? ((In(l) || In(f)) && i.dirty(), { status: i.value, value: h.data }) : (b(c, {
|
|
5179
5187
|
code: w.invalid_intersection_types
|
|
5180
5188
|
}), T);
|
|
5181
5189
|
};
|
|
@@ -5201,7 +5209,7 @@ class gt extends O {
|
|
|
5201
5209
|
}));
|
|
5202
5210
|
}
|
|
5203
5211
|
}
|
|
5204
|
-
|
|
5212
|
+
yt.create = (a, r, i) => new yt({
|
|
5205
5213
|
left: a,
|
|
5206
5214
|
right: r,
|
|
5207
5215
|
typeName: S.ZodIntersection,
|
|
@@ -5231,9 +5239,9 @@ class te extends O {
|
|
|
5231
5239
|
exact: !1,
|
|
5232
5240
|
type: "array"
|
|
5233
5241
|
}), i.dirty());
|
|
5234
|
-
const l = [...c.data].map((f,
|
|
5235
|
-
const g = this._def.items[
|
|
5236
|
-
return g ? g._parse(new ee(c, f, c.path,
|
|
5242
|
+
const l = [...c.data].map((f, h) => {
|
|
5243
|
+
const g = this._def.items[h] || this._def.rest;
|
|
5244
|
+
return g ? g._parse(new ee(c, f, c.path, h)) : null;
|
|
5237
5245
|
}).filter((f) => !!f);
|
|
5238
5246
|
return c.common.async ? Promise.all(l).then((f) => L.mergeArray(i, f)) : L.mergeArray(i, l);
|
|
5239
5247
|
}
|
|
@@ -5257,7 +5265,7 @@ te.create = (a, r) => {
|
|
|
5257
5265
|
...A(r)
|
|
5258
5266
|
});
|
|
5259
5267
|
};
|
|
5260
|
-
class
|
|
5268
|
+
class vt extends O {
|
|
5261
5269
|
get keySchema() {
|
|
5262
5270
|
return this._def.keyType;
|
|
5263
5271
|
}
|
|
@@ -5273,11 +5281,11 @@ class yt extends O {
|
|
|
5273
5281
|
received: c.parsedType
|
|
5274
5282
|
}), T;
|
|
5275
5283
|
const u = [], l = this._def.keyType, f = this._def.valueType;
|
|
5276
|
-
for (const
|
|
5284
|
+
for (const h in c.data)
|
|
5277
5285
|
u.push({
|
|
5278
|
-
key: l._parse(new ee(c,
|
|
5279
|
-
value: f._parse(new ee(c, c.data[
|
|
5280
|
-
alwaysSet:
|
|
5286
|
+
key: l._parse(new ee(c, h, c.path, h)),
|
|
5287
|
+
value: f._parse(new ee(c, c.data[h], c.path, h)),
|
|
5288
|
+
alwaysSet: h in c.data
|
|
5281
5289
|
});
|
|
5282
5290
|
return c.common.async ? L.mergeObjectAsync(i, u) : L.mergeObjectSync(i, u);
|
|
5283
5291
|
}
|
|
@@ -5285,12 +5293,12 @@ class yt extends O {
|
|
|
5285
5293
|
return this._def.valueType;
|
|
5286
5294
|
}
|
|
5287
5295
|
static create(r, i, c) {
|
|
5288
|
-
return i instanceof O ? new
|
|
5296
|
+
return i instanceof O ? new vt({
|
|
5289
5297
|
keyType: r,
|
|
5290
5298
|
valueType: i,
|
|
5291
5299
|
typeName: S.ZodRecord,
|
|
5292
5300
|
...A(c)
|
|
5293
|
-
}) : new
|
|
5301
|
+
}) : new vt({
|
|
5294
5302
|
keyType: q.create(),
|
|
5295
5303
|
valueType: r,
|
|
5296
5304
|
typeName: S.ZodRecord,
|
|
@@ -5298,7 +5306,7 @@ class yt extends O {
|
|
|
5298
5306
|
});
|
|
5299
5307
|
}
|
|
5300
5308
|
}
|
|
5301
|
-
class
|
|
5309
|
+
class qt extends O {
|
|
5302
5310
|
get keySchema() {
|
|
5303
5311
|
return this._def.keyType;
|
|
5304
5312
|
}
|
|
@@ -5313,34 +5321,34 @@ class Ht extends O {
|
|
|
5313
5321
|
expected: _.map,
|
|
5314
5322
|
received: c.parsedType
|
|
5315
5323
|
}), T;
|
|
5316
|
-
const u = this._def.keyType, l = this._def.valueType, f = [...c.data.entries()].map(([
|
|
5317
|
-
key: u._parse(new ee(c,
|
|
5324
|
+
const u = this._def.keyType, l = this._def.valueType, f = [...c.data.entries()].map(([h, g], y) => ({
|
|
5325
|
+
key: u._parse(new ee(c, h, c.path, [y, "key"])),
|
|
5318
5326
|
value: l._parse(new ee(c, g, c.path, [y, "value"]))
|
|
5319
5327
|
}));
|
|
5320
5328
|
if (c.common.async) {
|
|
5321
|
-
const
|
|
5329
|
+
const h = /* @__PURE__ */ new Map();
|
|
5322
5330
|
return Promise.resolve().then(async () => {
|
|
5323
5331
|
for (const g of f) {
|
|
5324
|
-
const y = await g.key,
|
|
5325
|
-
if (y.status === "aborted" ||
|
|
5332
|
+
const y = await g.key, x = await g.value;
|
|
5333
|
+
if (y.status === "aborted" || x.status === "aborted")
|
|
5326
5334
|
return T;
|
|
5327
|
-
(y.status === "dirty" ||
|
|
5335
|
+
(y.status === "dirty" || x.status === "dirty") && i.dirty(), h.set(y.value, x.value);
|
|
5328
5336
|
}
|
|
5329
|
-
return { status: i.value, value:
|
|
5337
|
+
return { status: i.value, value: h };
|
|
5330
5338
|
});
|
|
5331
5339
|
} else {
|
|
5332
|
-
const
|
|
5340
|
+
const h = /* @__PURE__ */ new Map();
|
|
5333
5341
|
for (const g of f) {
|
|
5334
|
-
const y = g.key,
|
|
5335
|
-
if (y.status === "aborted" ||
|
|
5342
|
+
const y = g.key, x = g.value;
|
|
5343
|
+
if (y.status === "aborted" || x.status === "aborted")
|
|
5336
5344
|
return T;
|
|
5337
|
-
(y.status === "dirty" ||
|
|
5345
|
+
(y.status === "dirty" || x.status === "dirty") && i.dirty(), h.set(y.value, x.value);
|
|
5338
5346
|
}
|
|
5339
|
-
return { status: i.value, value:
|
|
5347
|
+
return { status: i.value, value: h };
|
|
5340
5348
|
}
|
|
5341
5349
|
}
|
|
5342
5350
|
}
|
|
5343
|
-
|
|
5351
|
+
qt.create = (a, r, i) => new qt({
|
|
5344
5352
|
valueType: r,
|
|
5345
5353
|
keyType: a,
|
|
5346
5354
|
typeName: S.ZodMap,
|
|
@@ -5374,26 +5382,26 @@ class Ae extends O {
|
|
|
5374
5382
|
const l = this._def.valueType;
|
|
5375
5383
|
function f(g) {
|
|
5376
5384
|
const y = /* @__PURE__ */ new Set();
|
|
5377
|
-
for (const
|
|
5378
|
-
if (
|
|
5385
|
+
for (const x of g) {
|
|
5386
|
+
if (x.status === "aborted")
|
|
5379
5387
|
return T;
|
|
5380
|
-
|
|
5388
|
+
x.status === "dirty" && i.dirty(), y.add(x.value);
|
|
5381
5389
|
}
|
|
5382
5390
|
return { status: i.value, value: y };
|
|
5383
5391
|
}
|
|
5384
|
-
const
|
|
5385
|
-
return c.common.async ? Promise.all(
|
|
5392
|
+
const h = [...c.data.values()].map((g, y) => l._parse(new ee(c, g, c.path, y)));
|
|
5393
|
+
return c.common.async ? Promise.all(h).then((g) => f(g)) : f(h);
|
|
5386
5394
|
}
|
|
5387
5395
|
min(r, i) {
|
|
5388
5396
|
return new Ae({
|
|
5389
5397
|
...this._def,
|
|
5390
|
-
minSize: { value: r, message:
|
|
5398
|
+
minSize: { value: r, message: E.toString(i) }
|
|
5391
5399
|
});
|
|
5392
5400
|
}
|
|
5393
5401
|
max(r, i) {
|
|
5394
5402
|
return new Ae({
|
|
5395
5403
|
...this._def,
|
|
5396
|
-
maxSize: { value: r, message:
|
|
5404
|
+
maxSize: { value: r, message: E.toString(i) }
|
|
5397
5405
|
});
|
|
5398
5406
|
}
|
|
5399
5407
|
size(r, i) {
|
|
@@ -5410,7 +5418,7 @@ Ae.create = (a, r) => new Ae({
|
|
|
5410
5418
|
typeName: S.ZodSet,
|
|
5411
5419
|
...A(r)
|
|
5412
5420
|
});
|
|
5413
|
-
class
|
|
5421
|
+
class Ze extends O {
|
|
5414
5422
|
constructor() {
|
|
5415
5423
|
super(...arguments), this.validate = this.implement;
|
|
5416
5424
|
}
|
|
@@ -5422,15 +5430,15 @@ class Be extends O {
|
|
|
5422
5430
|
expected: _.function,
|
|
5423
5431
|
received: i.parsedType
|
|
5424
5432
|
}), T;
|
|
5425
|
-
function c(
|
|
5426
|
-
return
|
|
5427
|
-
data:
|
|
5433
|
+
function c(h, g) {
|
|
5434
|
+
return Vt({
|
|
5435
|
+
data: h,
|
|
5428
5436
|
path: i.path,
|
|
5429
5437
|
errorMaps: [
|
|
5430
5438
|
i.common.contextualErrorMap,
|
|
5431
5439
|
i.schemaErrorMap,
|
|
5432
|
-
|
|
5433
|
-
|
|
5440
|
+
zt(),
|
|
5441
|
+
Le
|
|
5434
5442
|
].filter((y) => !!y),
|
|
5435
5443
|
issueData: {
|
|
5436
5444
|
code: w.invalid_arguments,
|
|
@@ -5438,15 +5446,15 @@ class Be extends O {
|
|
|
5438
5446
|
}
|
|
5439
5447
|
});
|
|
5440
5448
|
}
|
|
5441
|
-
function u(
|
|
5442
|
-
return
|
|
5443
|
-
data:
|
|
5449
|
+
function u(h, g) {
|
|
5450
|
+
return Vt({
|
|
5451
|
+
data: h,
|
|
5444
5452
|
path: i.path,
|
|
5445
5453
|
errorMaps: [
|
|
5446
5454
|
i.common.contextualErrorMap,
|
|
5447
5455
|
i.schemaErrorMap,
|
|
5448
|
-
|
|
5449
|
-
|
|
5456
|
+
zt(),
|
|
5457
|
+
Le
|
|
5450
5458
|
].filter((y) => !!y),
|
|
5451
5459
|
issueData: {
|
|
5452
5460
|
code: w.invalid_return_type,
|
|
@@ -5455,25 +5463,25 @@ class Be extends O {
|
|
|
5455
5463
|
});
|
|
5456
5464
|
}
|
|
5457
5465
|
const l = { errorMap: i.common.contextualErrorMap }, f = i.data;
|
|
5458
|
-
if (this._def.returns instanceof
|
|
5459
|
-
const
|
|
5466
|
+
if (this._def.returns instanceof Ve) {
|
|
5467
|
+
const h = this;
|
|
5460
5468
|
return z(async function(...g) {
|
|
5461
|
-
const y = new V([]),
|
|
5469
|
+
const y = new V([]), x = await h._def.args.parseAsync(g, l).catch((ne) => {
|
|
5462
5470
|
throw y.addIssue(c(g, ne)), y;
|
|
5463
|
-
}), N = await Reflect.apply(f, this,
|
|
5464
|
-
return await
|
|
5471
|
+
}), N = await Reflect.apply(f, this, x);
|
|
5472
|
+
return await h._def.returns._def.type.parseAsync(N, l).catch((ne) => {
|
|
5465
5473
|
throw y.addIssue(u(N, ne)), y;
|
|
5466
5474
|
});
|
|
5467
5475
|
});
|
|
5468
5476
|
} else {
|
|
5469
|
-
const
|
|
5477
|
+
const h = this;
|
|
5470
5478
|
return z(function(...g) {
|
|
5471
|
-
const y =
|
|
5479
|
+
const y = h._def.args.safeParse(g, l);
|
|
5472
5480
|
if (!y.success)
|
|
5473
5481
|
throw new V([c(g, y.error)]);
|
|
5474
|
-
const
|
|
5482
|
+
const x = Reflect.apply(f, this, y.data), N = h._def.returns.safeParse(x, l);
|
|
5475
5483
|
if (!N.success)
|
|
5476
|
-
throw new V([u(
|
|
5484
|
+
throw new V([u(x, N.error)]);
|
|
5477
5485
|
return N.data;
|
|
5478
5486
|
});
|
|
5479
5487
|
}
|
|
@@ -5485,13 +5493,13 @@ class Be extends O {
|
|
|
5485
5493
|
return this._def.returns;
|
|
5486
5494
|
}
|
|
5487
5495
|
args(...r) {
|
|
5488
|
-
return new
|
|
5496
|
+
return new Ze({
|
|
5489
5497
|
...this._def,
|
|
5490
5498
|
args: te.create(r).rest(Ee.create())
|
|
5491
5499
|
});
|
|
5492
5500
|
}
|
|
5493
5501
|
returns(r) {
|
|
5494
|
-
return new
|
|
5502
|
+
return new Ze({
|
|
5495
5503
|
...this._def,
|
|
5496
5504
|
returns: r
|
|
5497
5505
|
});
|
|
@@ -5503,7 +5511,7 @@ class Be extends O {
|
|
|
5503
5511
|
return this.parse(r);
|
|
5504
5512
|
}
|
|
5505
5513
|
static create(r, i, c) {
|
|
5506
|
-
return new
|
|
5514
|
+
return new Ze({
|
|
5507
5515
|
args: r || te.create([]).rest(Ee.create()),
|
|
5508
5516
|
returns: i || Ee.create(),
|
|
5509
5517
|
typeName: S.ZodFunction,
|
|
@@ -5511,7 +5519,7 @@ class Be extends O {
|
|
|
5511
5519
|
});
|
|
5512
5520
|
}
|
|
5513
5521
|
}
|
|
5514
|
-
class
|
|
5522
|
+
class wt extends O {
|
|
5515
5523
|
get schema() {
|
|
5516
5524
|
return this._def.getter();
|
|
5517
5525
|
}
|
|
@@ -5520,12 +5528,12 @@ class vt extends O {
|
|
|
5520
5528
|
return this._def.getter()._parse({ data: i.data, path: i.path, parent: i });
|
|
5521
5529
|
}
|
|
5522
5530
|
}
|
|
5523
|
-
|
|
5531
|
+
wt.create = (a, r) => new wt({
|
|
5524
5532
|
getter: a,
|
|
5525
5533
|
typeName: S.ZodLazy,
|
|
5526
5534
|
...A(r)
|
|
5527
5535
|
});
|
|
5528
|
-
class
|
|
5536
|
+
class bt extends O {
|
|
5529
5537
|
_parse(r) {
|
|
5530
5538
|
if (r.data !== this._def.value) {
|
|
5531
5539
|
const i = this._getOrReturnCtx(r);
|
|
@@ -5541,21 +5549,21 @@ class wt extends O {
|
|
|
5541
5549
|
return this._def.value;
|
|
5542
5550
|
}
|
|
5543
5551
|
}
|
|
5544
|
-
|
|
5552
|
+
bt.create = (a, r) => new bt({
|
|
5545
5553
|
value: a,
|
|
5546
5554
|
typeName: S.ZodLiteral,
|
|
5547
5555
|
...A(r)
|
|
5548
5556
|
});
|
|
5549
5557
|
function vi(a, r) {
|
|
5550
|
-
return new
|
|
5558
|
+
return new me({
|
|
5551
5559
|
values: a,
|
|
5552
5560
|
typeName: S.ZodEnum,
|
|
5553
5561
|
...A(r)
|
|
5554
5562
|
});
|
|
5555
5563
|
}
|
|
5556
|
-
class
|
|
5564
|
+
class me extends O {
|
|
5557
5565
|
constructor() {
|
|
5558
|
-
super(...arguments),
|
|
5566
|
+
super(...arguments), lt.set(this, void 0);
|
|
5559
5567
|
}
|
|
5560
5568
|
_parse(r) {
|
|
5561
5569
|
if (typeof r.data != "string") {
|
|
@@ -5566,7 +5574,7 @@ class pe extends O {
|
|
|
5566
5574
|
code: w.invalid_type
|
|
5567
5575
|
}), T;
|
|
5568
5576
|
}
|
|
5569
|
-
if (
|
|
5577
|
+
if (Ft(this, lt) || mi(this, lt, new Set(this._def.values)), !Ft(this, lt).has(r.data)) {
|
|
5570
5578
|
const i = this._getOrReturnCtx(r), c = this._def.values;
|
|
5571
5579
|
return b(i, {
|
|
5572
5580
|
received: i.data,
|
|
@@ -5598,23 +5606,23 @@ class pe extends O {
|
|
|
5598
5606
|
return r;
|
|
5599
5607
|
}
|
|
5600
5608
|
extract(r, i = this._def) {
|
|
5601
|
-
return
|
|
5609
|
+
return me.create(r, {
|
|
5602
5610
|
...this._def,
|
|
5603
5611
|
...i
|
|
5604
5612
|
});
|
|
5605
5613
|
}
|
|
5606
5614
|
exclude(r, i = this._def) {
|
|
5607
|
-
return
|
|
5615
|
+
return me.create(this.options.filter((c) => !r.includes(c)), {
|
|
5608
5616
|
...this._def,
|
|
5609
5617
|
...i
|
|
5610
5618
|
});
|
|
5611
5619
|
}
|
|
5612
5620
|
}
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
class
|
|
5621
|
+
lt = /* @__PURE__ */ new WeakMap();
|
|
5622
|
+
me.create = vi;
|
|
5623
|
+
class _t extends O {
|
|
5616
5624
|
constructor() {
|
|
5617
|
-
super(...arguments),
|
|
5625
|
+
super(...arguments), dt.set(this, void 0);
|
|
5618
5626
|
}
|
|
5619
5627
|
_parse(r) {
|
|
5620
5628
|
const i = I.getValidEnumValues(this._def.values), c = this._getOrReturnCtx(r);
|
|
@@ -5626,7 +5634,7 @@ class bt extends O {
|
|
|
5626
5634
|
code: w.invalid_type
|
|
5627
5635
|
}), T;
|
|
5628
5636
|
}
|
|
5629
|
-
if (
|
|
5637
|
+
if (Ft(this, dt) || mi(this, dt, new Set(I.getValidEnumValues(this._def.values))), !Ft(this, dt).has(r.data)) {
|
|
5630
5638
|
const u = I.objectValues(i);
|
|
5631
5639
|
return b(c, {
|
|
5632
5640
|
received: c.data,
|
|
@@ -5640,13 +5648,13 @@ class bt extends O {
|
|
|
5640
5648
|
return this._def.values;
|
|
5641
5649
|
}
|
|
5642
5650
|
}
|
|
5643
|
-
|
|
5644
|
-
|
|
5651
|
+
dt = /* @__PURE__ */ new WeakMap();
|
|
5652
|
+
_t.create = (a, r) => new _t({
|
|
5645
5653
|
values: a,
|
|
5646
5654
|
typeName: S.ZodNativeEnum,
|
|
5647
5655
|
...A(r)
|
|
5648
5656
|
});
|
|
5649
|
-
class
|
|
5657
|
+
class Ve extends O {
|
|
5650
5658
|
unwrap() {
|
|
5651
5659
|
return this._def.type;
|
|
5652
5660
|
}
|
|
@@ -5665,7 +5673,7 @@ class Fe extends O {
|
|
|
5665
5673
|
})));
|
|
5666
5674
|
}
|
|
5667
5675
|
}
|
|
5668
|
-
|
|
5676
|
+
Ve.create = (a, r) => new Ve({
|
|
5669
5677
|
type: a,
|
|
5670
5678
|
typeName: S.ZodPromise,
|
|
5671
5679
|
...A(r)
|
|
@@ -5689,45 +5697,45 @@ class J extends O {
|
|
|
5689
5697
|
if (l.addIssue = l.addIssue.bind(l), u.type === "preprocess") {
|
|
5690
5698
|
const f = u.transform(c.data, l);
|
|
5691
5699
|
if (c.common.async)
|
|
5692
|
-
return Promise.resolve(f).then(async (
|
|
5700
|
+
return Promise.resolve(f).then(async (h) => {
|
|
5693
5701
|
if (i.value === "aborted")
|
|
5694
5702
|
return T;
|
|
5695
5703
|
const g = await this._def.schema._parseAsync({
|
|
5696
|
-
data:
|
|
5704
|
+
data: h,
|
|
5697
5705
|
path: c.path,
|
|
5698
5706
|
parent: c
|
|
5699
5707
|
});
|
|
5700
|
-
return g.status === "aborted" ? T : g.status === "dirty" || i.value === "dirty" ?
|
|
5708
|
+
return g.status === "aborted" ? T : g.status === "dirty" || i.value === "dirty" ? Pe(g.value) : g;
|
|
5701
5709
|
});
|
|
5702
5710
|
{
|
|
5703
5711
|
if (i.value === "aborted")
|
|
5704
5712
|
return T;
|
|
5705
|
-
const
|
|
5713
|
+
const h = this._def.schema._parseSync({
|
|
5706
5714
|
data: f,
|
|
5707
5715
|
path: c.path,
|
|
5708
5716
|
parent: c
|
|
5709
5717
|
});
|
|
5710
|
-
return
|
|
5718
|
+
return h.status === "aborted" ? T : h.status === "dirty" || i.value === "dirty" ? Pe(h.value) : h;
|
|
5711
5719
|
}
|
|
5712
5720
|
}
|
|
5713
5721
|
if (u.type === "refinement") {
|
|
5714
|
-
const f = (
|
|
5715
|
-
const g = u.refinement(
|
|
5722
|
+
const f = (h) => {
|
|
5723
|
+
const g = u.refinement(h, l);
|
|
5716
5724
|
if (c.common.async)
|
|
5717
5725
|
return Promise.resolve(g);
|
|
5718
5726
|
if (g instanceof Promise)
|
|
5719
5727
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5720
|
-
return
|
|
5728
|
+
return h;
|
|
5721
5729
|
};
|
|
5722
5730
|
if (c.common.async === !1) {
|
|
5723
|
-
const
|
|
5731
|
+
const h = this._def.schema._parseSync({
|
|
5724
5732
|
data: c.data,
|
|
5725
5733
|
path: c.path,
|
|
5726
5734
|
parent: c
|
|
5727
5735
|
});
|
|
5728
|
-
return
|
|
5736
|
+
return h.status === "aborted" ? T : (h.status === "dirty" && i.dirty(), f(h.value), { status: i.value, value: h.value });
|
|
5729
5737
|
} else
|
|
5730
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((
|
|
5738
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) => h.status === "aborted" ? T : (h.status === "dirty" && i.dirty(), f(h.value).then(() => ({ status: i.value, value: h.value }))));
|
|
5731
5739
|
}
|
|
5732
5740
|
if (u.type === "transform")
|
|
5733
5741
|
if (c.common.async === !1) {
|
|
@@ -5738,12 +5746,12 @@ class J extends O {
|
|
|
5738
5746
|
});
|
|
5739
5747
|
if (!Se(f))
|
|
5740
5748
|
return f;
|
|
5741
|
-
const
|
|
5742
|
-
if (
|
|
5749
|
+
const h = u.transform(f.value, l);
|
|
5750
|
+
if (h instanceof Promise)
|
|
5743
5751
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5744
|
-
return { status: i.value, value:
|
|
5752
|
+
return { status: i.value, value: h };
|
|
5745
5753
|
} else
|
|
5746
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((f) => Se(f) ? Promise.resolve(u.transform(f.value, l)).then((
|
|
5754
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((f) => Se(f) ? Promise.resolve(u.transform(f.value, l)).then((h) => ({ status: i.value, value: h })) : f);
|
|
5747
5755
|
I.assertNever(u);
|
|
5748
5756
|
}
|
|
5749
5757
|
}
|
|
@@ -5772,7 +5780,7 @@ X.create = (a, r) => new X({
|
|
|
5772
5780
|
typeName: S.ZodOptional,
|
|
5773
5781
|
...A(r)
|
|
5774
5782
|
});
|
|
5775
|
-
class
|
|
5783
|
+
class pe extends O {
|
|
5776
5784
|
_parse(r) {
|
|
5777
5785
|
return this._getType(r) === _.null ? z(null) : this._def.innerType._parse(r);
|
|
5778
5786
|
}
|
|
@@ -5780,12 +5788,12 @@ class me extends O {
|
|
|
5780
5788
|
return this._def.innerType;
|
|
5781
5789
|
}
|
|
5782
5790
|
}
|
|
5783
|
-
|
|
5791
|
+
pe.create = (a, r) => new pe({
|
|
5784
5792
|
innerType: a,
|
|
5785
5793
|
typeName: S.ZodNullable,
|
|
5786
5794
|
...A(r)
|
|
5787
5795
|
});
|
|
5788
|
-
class
|
|
5796
|
+
class xt extends O {
|
|
5789
5797
|
_parse(r) {
|
|
5790
5798
|
const { ctx: i } = this._processInputParams(r);
|
|
5791
5799
|
let c = i.data;
|
|
@@ -5799,13 +5807,13 @@ class _t extends O {
|
|
|
5799
5807
|
return this._def.innerType;
|
|
5800
5808
|
}
|
|
5801
5809
|
}
|
|
5802
|
-
|
|
5810
|
+
xt.create = (a, r) => new xt({
|
|
5803
5811
|
innerType: a,
|
|
5804
5812
|
typeName: S.ZodDefault,
|
|
5805
5813
|
defaultValue: typeof r.default == "function" ? r.default : () => r.default,
|
|
5806
5814
|
...A(r)
|
|
5807
5815
|
});
|
|
5808
|
-
class
|
|
5816
|
+
class kt extends O {
|
|
5809
5817
|
_parse(r) {
|
|
5810
5818
|
const { ctx: i } = this._processInputParams(r), c = {
|
|
5811
5819
|
...i,
|
|
@@ -5820,7 +5828,7 @@ class xt extends O {
|
|
|
5820
5828
|
...c
|
|
5821
5829
|
}
|
|
5822
5830
|
});
|
|
5823
|
-
return
|
|
5831
|
+
return ft(u) ? u.then((l) => ({
|
|
5824
5832
|
status: "valid",
|
|
5825
5833
|
value: l.status === "valid" ? l.value : this._def.catchValue({
|
|
5826
5834
|
get error() {
|
|
@@ -5842,13 +5850,13 @@ class xt extends O {
|
|
|
5842
5850
|
return this._def.innerType;
|
|
5843
5851
|
}
|
|
5844
5852
|
}
|
|
5845
|
-
|
|
5853
|
+
kt.create = (a, r) => new kt({
|
|
5846
5854
|
innerType: a,
|
|
5847
5855
|
typeName: S.ZodCatch,
|
|
5848
5856
|
catchValue: typeof r.catch == "function" ? r.catch : () => r.catch,
|
|
5849
5857
|
...A(r)
|
|
5850
5858
|
});
|
|
5851
|
-
class
|
|
5859
|
+
class Gt extends O {
|
|
5852
5860
|
_parse(r) {
|
|
5853
5861
|
if (this._getType(r) !== _.nan) {
|
|
5854
5862
|
const c = this._getOrReturnCtx(r);
|
|
@@ -5861,12 +5869,12 @@ class qt extends O {
|
|
|
5861
5869
|
return { status: "valid", value: r.data };
|
|
5862
5870
|
}
|
|
5863
5871
|
}
|
|
5864
|
-
|
|
5872
|
+
Gt.create = (a) => new Gt({
|
|
5865
5873
|
typeName: S.ZodNaN,
|
|
5866
5874
|
...A(a)
|
|
5867
5875
|
});
|
|
5868
|
-
const
|
|
5869
|
-
class
|
|
5876
|
+
const Md = Symbol("zod_brand");
|
|
5877
|
+
class $n extends O {
|
|
5870
5878
|
_parse(r) {
|
|
5871
5879
|
const { ctx: i } = this._processInputParams(r), c = i.data;
|
|
5872
5880
|
return this._def.type._parse({
|
|
@@ -5879,7 +5887,7 @@ class Rn extends O {
|
|
|
5879
5887
|
return this._def.type;
|
|
5880
5888
|
}
|
|
5881
5889
|
}
|
|
5882
|
-
class
|
|
5890
|
+
class St extends O {
|
|
5883
5891
|
_parse(r) {
|
|
5884
5892
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5885
5893
|
if (c.common.async)
|
|
@@ -5889,7 +5897,7 @@ class Et extends O {
|
|
|
5889
5897
|
path: c.path,
|
|
5890
5898
|
parent: c
|
|
5891
5899
|
});
|
|
5892
|
-
return l.status === "aborted" ? T : l.status === "dirty" ? (i.dirty(),
|
|
5900
|
+
return l.status === "aborted" ? T : l.status === "dirty" ? (i.dirty(), Pe(l.value)) : this._def.out._parseAsync({
|
|
5893
5901
|
data: l.value,
|
|
5894
5902
|
path: c.path,
|
|
5895
5903
|
parent: c
|
|
@@ -5912,76 +5920,76 @@ class Et extends O {
|
|
|
5912
5920
|
}
|
|
5913
5921
|
}
|
|
5914
5922
|
static create(r, i) {
|
|
5915
|
-
return new
|
|
5923
|
+
return new St({
|
|
5916
5924
|
in: r,
|
|
5917
5925
|
out: i,
|
|
5918
5926
|
typeName: S.ZodPipeline
|
|
5919
5927
|
});
|
|
5920
5928
|
}
|
|
5921
5929
|
}
|
|
5922
|
-
class
|
|
5930
|
+
class Et extends O {
|
|
5923
5931
|
_parse(r) {
|
|
5924
5932
|
const i = this._def.innerType._parse(r), c = (u) => (Se(u) && (u.value = Object.freeze(u.value)), u);
|
|
5925
|
-
return
|
|
5933
|
+
return ft(i) ? i.then((u) => c(u)) : c(i);
|
|
5926
5934
|
}
|
|
5927
5935
|
unwrap() {
|
|
5928
5936
|
return this._def.innerType;
|
|
5929
5937
|
}
|
|
5930
5938
|
}
|
|
5931
|
-
|
|
5939
|
+
Et.create = (a, r) => new Et({
|
|
5932
5940
|
innerType: a,
|
|
5933
5941
|
typeName: S.ZodReadonly,
|
|
5934
5942
|
...A(r)
|
|
5935
5943
|
});
|
|
5936
5944
|
function wi(a, r = {}, i) {
|
|
5937
|
-
return a ?
|
|
5945
|
+
return a ? ze.create().superRefine((c, u) => {
|
|
5938
5946
|
var l, f;
|
|
5939
5947
|
if (!a(c)) {
|
|
5940
|
-
const
|
|
5948
|
+
const h = typeof r == "function" ? r(c) : typeof r == "string" ? { message: r } : r, g = (f = (l = h.fatal) !== null && l !== void 0 ? l : i) !== null && f !== void 0 ? f : !0, y = typeof h == "string" ? { message: h } : h;
|
|
5941
5949
|
u.addIssue({ code: "custom", ...y, fatal: g });
|
|
5942
5950
|
}
|
|
5943
|
-
}) :
|
|
5951
|
+
}) : ze.create();
|
|
5944
5952
|
}
|
|
5945
|
-
const
|
|
5953
|
+
const $d = {
|
|
5946
5954
|
object: C.lazycreate
|
|
5947
5955
|
};
|
|
5948
5956
|
var S;
|
|
5949
5957
|
(function(a) {
|
|
5950
5958
|
a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
|
|
5951
5959
|
})(S || (S = {}));
|
|
5952
|
-
const
|
|
5960
|
+
const Rd = (a, r = {
|
|
5953
5961
|
message: `Input not instance of ${a.name}`
|
|
5954
|
-
}) => wi((i) => i instanceof a, r), bi = q.create, _i = fe.create,
|
|
5962
|
+
}) => wi((i) => i instanceof a, r), bi = q.create, _i = fe.create, Cd = Gt.create, Nd = he.create, xi = ht.create, jd = Te.create, Dd = Wt.create, Ud = mt.create, Pd = pt.create, Zd = ze.create, Bd = Ee.create, Ld = oe.create, zd = Ht.create, Vd = G.create, Fd = C.create, Wd = C.strictCreate, Hd = gt.create, qd = Jt.create, Gd = yt.create, Jd = te.create, Kd = vt.create, Yd = qt.create, Qd = Ae.create, Xd = Ze.create, ef = wt.create, tf = bt.create, rf = me.create, nf = _t.create, sf = Ve.create, oi = J.create, af = X.create, of = pe.create, cf = J.createWithPreprocess, uf = St.create, lf = () => bi().optional(), df = () => _i().optional(), ff = () => xi().optional(), hf = {
|
|
5955
5963
|
string: (a) => q.create({ ...a, coerce: !0 }),
|
|
5956
5964
|
number: (a) => fe.create({ ...a, coerce: !0 }),
|
|
5957
|
-
boolean: (a) =>
|
|
5965
|
+
boolean: (a) => ht.create({
|
|
5958
5966
|
...a,
|
|
5959
5967
|
coerce: !0
|
|
5960
5968
|
}),
|
|
5961
5969
|
bigint: (a) => he.create({ ...a, coerce: !0 }),
|
|
5962
5970
|
date: (a) => Te.create({ ...a, coerce: !0 })
|
|
5963
|
-
},
|
|
5971
|
+
}, mf = T;
|
|
5964
5972
|
var j = /* @__PURE__ */ Object.freeze({
|
|
5965
5973
|
__proto__: null,
|
|
5966
|
-
defaultErrorMap:
|
|
5967
|
-
setErrorMap:
|
|
5968
|
-
getErrorMap:
|
|
5969
|
-
makeIssue:
|
|
5970
|
-
EMPTY_PATH:
|
|
5974
|
+
defaultErrorMap: Le,
|
|
5975
|
+
setErrorMap: od,
|
|
5976
|
+
getErrorMap: zt,
|
|
5977
|
+
makeIssue: Vt,
|
|
5978
|
+
EMPTY_PATH: cd,
|
|
5971
5979
|
addIssueToContext: b,
|
|
5972
5980
|
ParseStatus: L,
|
|
5973
5981
|
INVALID: T,
|
|
5974
|
-
DIRTY:
|
|
5982
|
+
DIRTY: Pe,
|
|
5975
5983
|
OK: z,
|
|
5976
|
-
isAborted:
|
|
5977
|
-
isDirty:
|
|
5984
|
+
isAborted: On,
|
|
5985
|
+
isDirty: In,
|
|
5978
5986
|
isValid: Se,
|
|
5979
|
-
isAsync:
|
|
5987
|
+
isAsync: ft,
|
|
5980
5988
|
get util() {
|
|
5981
5989
|
return I;
|
|
5982
5990
|
},
|
|
5983
5991
|
get objectUtil() {
|
|
5984
|
-
return
|
|
5992
|
+
return An;
|
|
5985
5993
|
},
|
|
5986
5994
|
ZodParsedType: _,
|
|
5987
5995
|
getParsedType: ae,
|
|
@@ -5990,91 +5998,91 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
5990
5998
|
ZodString: q,
|
|
5991
5999
|
ZodNumber: fe,
|
|
5992
6000
|
ZodBigInt: he,
|
|
5993
|
-
ZodBoolean:
|
|
6001
|
+
ZodBoolean: ht,
|
|
5994
6002
|
ZodDate: Te,
|
|
5995
|
-
ZodSymbol:
|
|
5996
|
-
ZodUndefined:
|
|
6003
|
+
ZodSymbol: Wt,
|
|
6004
|
+
ZodUndefined: mt,
|
|
5997
6005
|
ZodNull: pt,
|
|
5998
|
-
ZodAny:
|
|
6006
|
+
ZodAny: ze,
|
|
5999
6007
|
ZodUnknown: Ee,
|
|
6000
6008
|
ZodNever: oe,
|
|
6001
|
-
ZodVoid:
|
|
6009
|
+
ZodVoid: Ht,
|
|
6002
6010
|
ZodArray: G,
|
|
6003
6011
|
ZodObject: C,
|
|
6004
|
-
ZodUnion:
|
|
6005
|
-
ZodDiscriminatedUnion:
|
|
6006
|
-
ZodIntersection:
|
|
6012
|
+
ZodUnion: gt,
|
|
6013
|
+
ZodDiscriminatedUnion: Jt,
|
|
6014
|
+
ZodIntersection: yt,
|
|
6007
6015
|
ZodTuple: te,
|
|
6008
|
-
ZodRecord:
|
|
6009
|
-
ZodMap:
|
|
6016
|
+
ZodRecord: vt,
|
|
6017
|
+
ZodMap: qt,
|
|
6010
6018
|
ZodSet: Ae,
|
|
6011
|
-
ZodFunction:
|
|
6012
|
-
ZodLazy:
|
|
6013
|
-
ZodLiteral:
|
|
6014
|
-
ZodEnum:
|
|
6015
|
-
ZodNativeEnum:
|
|
6016
|
-
ZodPromise:
|
|
6019
|
+
ZodFunction: Ze,
|
|
6020
|
+
ZodLazy: wt,
|
|
6021
|
+
ZodLiteral: bt,
|
|
6022
|
+
ZodEnum: me,
|
|
6023
|
+
ZodNativeEnum: _t,
|
|
6024
|
+
ZodPromise: Ve,
|
|
6017
6025
|
ZodEffects: J,
|
|
6018
6026
|
ZodTransformer: J,
|
|
6019
6027
|
ZodOptional: X,
|
|
6020
|
-
ZodNullable:
|
|
6021
|
-
ZodDefault:
|
|
6022
|
-
ZodCatch:
|
|
6023
|
-
ZodNaN:
|
|
6024
|
-
BRAND:
|
|
6025
|
-
ZodBranded:
|
|
6026
|
-
ZodPipeline:
|
|
6027
|
-
ZodReadonly:
|
|
6028
|
+
ZodNullable: pe,
|
|
6029
|
+
ZodDefault: xt,
|
|
6030
|
+
ZodCatch: kt,
|
|
6031
|
+
ZodNaN: Gt,
|
|
6032
|
+
BRAND: Md,
|
|
6033
|
+
ZodBranded: $n,
|
|
6034
|
+
ZodPipeline: St,
|
|
6035
|
+
ZodReadonly: Et,
|
|
6028
6036
|
custom: wi,
|
|
6029
6037
|
Schema: O,
|
|
6030
6038
|
ZodSchema: O,
|
|
6031
|
-
late:
|
|
6039
|
+
late: $d,
|
|
6032
6040
|
get ZodFirstPartyTypeKind() {
|
|
6033
6041
|
return S;
|
|
6034
6042
|
},
|
|
6035
|
-
coerce:
|
|
6036
|
-
any:
|
|
6037
|
-
array:
|
|
6038
|
-
bigint:
|
|
6043
|
+
coerce: hf,
|
|
6044
|
+
any: Zd,
|
|
6045
|
+
array: Vd,
|
|
6046
|
+
bigint: Nd,
|
|
6039
6047
|
boolean: xi,
|
|
6040
|
-
date:
|
|
6041
|
-
discriminatedUnion:
|
|
6042
|
-
effect:
|
|
6043
|
-
enum:
|
|
6044
|
-
function:
|
|
6045
|
-
instanceof:
|
|
6046
|
-
intersection:
|
|
6047
|
-
lazy:
|
|
6048
|
-
literal:
|
|
6049
|
-
map:
|
|
6050
|
-
nan:
|
|
6051
|
-
nativeEnum:
|
|
6052
|
-
never:
|
|
6053
|
-
null:
|
|
6054
|
-
nullable:
|
|
6048
|
+
date: jd,
|
|
6049
|
+
discriminatedUnion: qd,
|
|
6050
|
+
effect: oi,
|
|
6051
|
+
enum: rf,
|
|
6052
|
+
function: Xd,
|
|
6053
|
+
instanceof: Rd,
|
|
6054
|
+
intersection: Gd,
|
|
6055
|
+
lazy: ef,
|
|
6056
|
+
literal: tf,
|
|
6057
|
+
map: Yd,
|
|
6058
|
+
nan: Cd,
|
|
6059
|
+
nativeEnum: nf,
|
|
6060
|
+
never: Ld,
|
|
6061
|
+
null: Pd,
|
|
6062
|
+
nullable: of,
|
|
6055
6063
|
number: _i,
|
|
6056
|
-
object:
|
|
6057
|
-
oboolean:
|
|
6058
|
-
onumber:
|
|
6059
|
-
optional:
|
|
6060
|
-
ostring:
|
|
6061
|
-
pipeline:
|
|
6062
|
-
preprocess:
|
|
6063
|
-
promise:
|
|
6064
|
-
record:
|
|
6065
|
-
set:
|
|
6066
|
-
strictObject:
|
|
6064
|
+
object: Fd,
|
|
6065
|
+
oboolean: ff,
|
|
6066
|
+
onumber: df,
|
|
6067
|
+
optional: af,
|
|
6068
|
+
ostring: lf,
|
|
6069
|
+
pipeline: uf,
|
|
6070
|
+
preprocess: cf,
|
|
6071
|
+
promise: sf,
|
|
6072
|
+
record: Kd,
|
|
6073
|
+
set: Qd,
|
|
6074
|
+
strictObject: Wd,
|
|
6067
6075
|
string: bi,
|
|
6068
|
-
symbol:
|
|
6069
|
-
transformer:
|
|
6070
|
-
tuple:
|
|
6071
|
-
undefined:
|
|
6072
|
-
union:
|
|
6073
|
-
unknown:
|
|
6074
|
-
void:
|
|
6075
|
-
NEVER:
|
|
6076
|
+
symbol: Dd,
|
|
6077
|
+
transformer: oi,
|
|
6078
|
+
tuple: Jd,
|
|
6079
|
+
undefined: Ud,
|
|
6080
|
+
union: Hd,
|
|
6081
|
+
unknown: Bd,
|
|
6082
|
+
void: zd,
|
|
6083
|
+
NEVER: mf,
|
|
6076
6084
|
ZodIssueCode: w,
|
|
6077
|
-
quotelessJson:
|
|
6085
|
+
quotelessJson: ad,
|
|
6078
6086
|
ZodError: V
|
|
6079
6087
|
}), ki = /* @__PURE__ */ ((a) => (a.TEXT = "text", a.THREAD = "thread", a.REACTION = "reaction", a))(ki || {});
|
|
6080
6088
|
const ge = H.getInstance(), pf = [
|
|
@@ -6090,7 +6098,7 @@ const ge = H.getInstance(), pf = [
|
|
|
6090
6098
|
"chatTopic",
|
|
6091
6099
|
"userTopic",
|
|
6092
6100
|
"additionalProps"
|
|
6093
|
-
],
|
|
6101
|
+
], Rn = j.object({
|
|
6094
6102
|
id: j.string(),
|
|
6095
6103
|
targetMessageId: j.string().optional(),
|
|
6096
6104
|
type: j.nativeEnum(ki),
|
|
@@ -6104,31 +6112,31 @@ const ge = H.getInstance(), pf = [
|
|
|
6104
6112
|
userTopic: j.string(),
|
|
6105
6113
|
additionalProps: j.record(j.any()).optional()
|
|
6106
6114
|
}).refine(
|
|
6107
|
-
(a) => !a.additionalProps || Object.keys(a.additionalProps).length === 0 ? !0 :
|
|
6115
|
+
(a) => !a.additionalProps || Object.keys(a.additionalProps).length === 0 ? !0 : bf(a.additionalProps).isValid,
|
|
6108
6116
|
{
|
|
6109
6117
|
message: "Invalid additional properties in message"
|
|
6110
6118
|
}
|
|
6111
|
-
),
|
|
6119
|
+
), gf = j.object({
|
|
6112
6120
|
reference: j.string(),
|
|
6113
6121
|
timestamp: j.number()
|
|
6114
|
-
}),
|
|
6115
|
-
message:
|
|
6116
|
-
messageStateRefs: j.array(
|
|
6122
|
+
}), yf = j.object({
|
|
6123
|
+
message: Rn,
|
|
6124
|
+
messageStateRefs: j.array(gf).nullable()
|
|
6117
6125
|
});
|
|
6118
6126
|
function Ei(a) {
|
|
6119
|
-
const r =
|
|
6127
|
+
const r = yf.safeParse(a);
|
|
6120
6128
|
return r.success ? Si(a.message) ? !0 : (ge.warn("Invalid main message signature"), !1) : (ge.warn("GSOC message validation failed:", r.error.format()), !1);
|
|
6121
6129
|
}
|
|
6122
|
-
function
|
|
6130
|
+
function vf(a) {
|
|
6123
6131
|
if (!Array.isArray(a))
|
|
6124
6132
|
return ge.warn("Message state must be an array"), !1;
|
|
6125
6133
|
for (const r of a)
|
|
6126
|
-
if (!
|
|
6134
|
+
if (!wf(r))
|
|
6127
6135
|
return ge.warn("Invalid message in message state:", r.id), !1;
|
|
6128
6136
|
return !0;
|
|
6129
6137
|
}
|
|
6130
|
-
function
|
|
6131
|
-
const r =
|
|
6138
|
+
function wf(a) {
|
|
6139
|
+
const r = Rn.safeParse(a);
|
|
6132
6140
|
return r.success ? Si(a) ? !0 : (ge.warn("Invalid message signature"), !1) : (ge.warn("Message data validation failed:", r.error.format()), !1);
|
|
6133
6141
|
}
|
|
6134
6142
|
function Si(a) {
|
|
@@ -6150,7 +6158,7 @@ function Si(a) {
|
|
|
6150
6158
|
return ge.warn("Error in validateUserSignature", r), !1;
|
|
6151
6159
|
}
|
|
6152
6160
|
}
|
|
6153
|
-
function
|
|
6161
|
+
function bf(a) {
|
|
6154
6162
|
const r = [];
|
|
6155
6163
|
if (a == null)
|
|
6156
6164
|
return { isValid: !0, errors: [] };
|
|
@@ -6164,32 +6172,32 @@ function wf(a) {
|
|
|
6164
6172
|
function f(g, y = 0) {
|
|
6165
6173
|
if (y > l) return !1;
|
|
6166
6174
|
if (typeof g == "object" && g !== null && !Array.isArray(g)) {
|
|
6167
|
-
for (const
|
|
6168
|
-
if (!f(
|
|
6175
|
+
for (const x of Object.values(g))
|
|
6176
|
+
if (!f(x, y + 1)) return !1;
|
|
6169
6177
|
}
|
|
6170
6178
|
return !0;
|
|
6171
6179
|
}
|
|
6172
6180
|
f(a) || r.push(`Additional properties nested too deeply (max depth: ${l})`);
|
|
6173
6181
|
for (const [g, y] of Object.entries(a))
|
|
6174
6182
|
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") {
|
|
6175
|
-
const
|
|
6183
|
+
const x = [
|
|
6176
6184
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
6177
6185
|
/javascript:/gi,
|
|
6178
6186
|
/data:text\/html/gi,
|
|
6179
6187
|
/vbscript:/gi,
|
|
6180
6188
|
/on\w+\s*=/gi
|
|
6181
6189
|
];
|
|
6182
|
-
for (const N of
|
|
6190
|
+
for (const N of x)
|
|
6183
6191
|
if (N.test(y)) {
|
|
6184
6192
|
r.push(`Property '${g}' contains potentially dangerous content`);
|
|
6185
6193
|
break;
|
|
6186
6194
|
}
|
|
6187
6195
|
}
|
|
6188
|
-
const
|
|
6189
|
-
return Object.keys(a).length >
|
|
6196
|
+
const h = 20;
|
|
6197
|
+
return Object.keys(a).length > h && r.push(`Too many additional properties: ${Object.keys(a).length} (max: ${h})`), { isValid: r.length === 0, errors: r };
|
|
6190
6198
|
}
|
|
6191
|
-
function
|
|
6192
|
-
const r =
|
|
6199
|
+
function _f(a) {
|
|
6200
|
+
const r = Rn.safeParse(a);
|
|
6193
6201
|
if (!r.success) {
|
|
6194
6202
|
const i = r.error.issues.map(
|
|
6195
6203
|
(c) => c.path.length > 0 ? `${c.path.join(".")}: ${c.message}` : c.message
|
|
@@ -6207,7 +6215,7 @@ const W = {
|
|
|
6207
6215
|
MESSAGE_REQUEST_ERROR: "messageRequestError",
|
|
6208
6216
|
CRITICAL_ERROR: "criticalError"
|
|
6209
6217
|
};
|
|
6210
|
-
class
|
|
6218
|
+
class xf {
|
|
6211
6219
|
constructor(r, i) {
|
|
6212
6220
|
this.utils = r, this.emitter = i, this.logger = H.getInstance(), this.errorHandler = Q.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;
|
|
6213
6221
|
}
|
|
@@ -6222,7 +6230,7 @@ class _f {
|
|
|
6222
6230
|
}
|
|
6223
6231
|
return i;
|
|
6224
6232
|
} catch (r) {
|
|
6225
|
-
return this.errorHandler.handleError(r, "SwarmHistory.init"),
|
|
6233
|
+
return this.errorHandler.handleError(r, "SwarmHistory.init"), ci.fromBigInt(0n);
|
|
6226
6234
|
}
|
|
6227
6235
|
}
|
|
6228
6236
|
async initMessageState(r) {
|
|
@@ -6276,7 +6284,7 @@ class _f {
|
|
|
6276
6284
|
}
|
|
6277
6285
|
async processMessageRef(r) {
|
|
6278
6286
|
const i = await this.utils.downloadObjectFromBee(r);
|
|
6279
|
-
if (!
|
|
6287
|
+
if (!vf(i))
|
|
6280
6288
|
throw new Error(`Invalid message state for ref: ${r}`);
|
|
6281
6289
|
this.processedRefs.add(r), this.refRetryCount.delete(r);
|
|
6282
6290
|
for (const u of i)
|
|
@@ -6299,9 +6307,9 @@ class _f {
|
|
|
6299
6307
|
this.processedRefs.clear(), this.refRetryCount.clear(), this.bannedRefs.clear(), this.latestStatefulMessage = null;
|
|
6300
6308
|
}
|
|
6301
6309
|
}
|
|
6302
|
-
class
|
|
6310
|
+
class kf {
|
|
6303
6311
|
constructor(r, i) {
|
|
6304
|
-
this.userDetails = r, this.swarmSettings = i, this.depth = 26, this.errorHandler = Q.getInstance()
|
|
6312
|
+
this.userDetails = r, this.swarmSettings = i, this.depth = 26, this.errorHandler = Q.getInstance();
|
|
6305
6313
|
}
|
|
6306
6314
|
generateUserOwnedFeedId(r, i) {
|
|
6307
6315
|
return `${r}_EthercastChat_${i}`;
|
|
@@ -6319,17 +6327,17 @@ class xf {
|
|
|
6319
6327
|
throw new Error("Enveloped mode is enabled, but stamp is not provided");
|
|
6320
6328
|
}
|
|
6321
6329
|
async writeOwnFeedDataByIndexOwned(r, i) {
|
|
6322
|
-
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress:
|
|
6330
|
+
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress: h } = this.userDetails, g = this.generateUserOwnedFeedId(l, h), y = ut.fromString(g);
|
|
6323
6331
|
await c.makeFeedWriter(y, new ke(f)).uploadPayload(u, JSON.stringify(i), {
|
|
6324
6332
|
index: r
|
|
6325
6333
|
});
|
|
6326
6334
|
}
|
|
6327
6335
|
// TODO: support for wrapped chunks
|
|
6328
6336
|
async writeOwnFeedDataByIndexEnvelope(r, i) {
|
|
6329
|
-
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress:
|
|
6330
|
-
hash: () =>
|
|
6331
|
-
},
|
|
6332
|
-
return (await Kt(
|
|
6337
|
+
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress: h } = this.userDetails, g = new ke(f), y = xn.fromBlank(f, u, this.depth), x = this.generateUserOwnedFeedId(l, h), N = ut.fromString(x), re = di(N, r), ne = si(i), Fe = ii(ne, re, g), Oe = {
|
|
6338
|
+
hash: () => Fe.address.toUint8Array()
|
|
6339
|
+
}, We = y.stamp(Oe), { upload: Kt } = c.makeSOCWriter(g), He = Ue.fromUtf8(i);
|
|
6340
|
+
return (await Kt(We, re, He.toUint8Array())).reference.toHex();
|
|
6333
6341
|
}
|
|
6334
6342
|
orderMessages(r) {
|
|
6335
6343
|
return r.sort((i, c) => i.timestamp - c.timestamp);
|
|
@@ -6360,11 +6368,11 @@ class xf {
|
|
|
6360
6368
|
}
|
|
6361
6369
|
async uploadObjectToBeeEnvelope(r) {
|
|
6362
6370
|
try {
|
|
6363
|
-
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), f =
|
|
6371
|
+
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), f = Ue.fromUtf8(JSON.stringify(r)), h = new Jl(async (y) => {
|
|
6364
6372
|
await i.uploadChunk(l.stamp(y), y.build());
|
|
6365
6373
|
});
|
|
6366
|
-
await
|
|
6367
|
-
const g = await
|
|
6374
|
+
await h.append(f.toUint8Array());
|
|
6375
|
+
const g = await h.finalize();
|
|
6368
6376
|
return B.uint8ArrayToHex(g.hash());
|
|
6369
6377
|
} catch (i) {
|
|
6370
6378
|
return this.errorHandler.handleError(i, "Utils.uploadObjectToBee"), null;
|
|
@@ -6372,7 +6380,7 @@ class xf {
|
|
|
6372
6380
|
}
|
|
6373
6381
|
async getOwnLatestFeedIndex() {
|
|
6374
6382
|
try {
|
|
6375
|
-
const { bee: r, chatTopic: i } = this.swarmSettings, { ownAddress: c } = this.userDetails, u = this.generateUserOwnedFeedId(i, c), l =
|
|
6383
|
+
const { bee: r, chatTopic: i } = this.swarmSettings, { ownAddress: c } = this.userDetails, u = this.generateUserOwnedFeedId(i, c), l = ut.fromString(u), h = await r.makeFeedReader(l, c).downloadPayload(), g = Number(h.feedIndex.toBigInt()), y = g + 1;
|
|
6376
6384
|
return { latestIndex: g, nextIndex: y };
|
|
6377
6385
|
} catch (r) {
|
|
6378
6386
|
if (this.isNotFoundError(r))
|
|
@@ -6381,14 +6389,10 @@ class xf {
|
|
|
6381
6389
|
}
|
|
6382
6390
|
}
|
|
6383
6391
|
async fetchLatestChatMessage() {
|
|
6384
|
-
const { bee: r, chatTopic: i, chatAddress: c } = this.swarmSettings,
|
|
6385
|
-
timeout:
|
|
6392
|
+
const { bee: r, chatTopic: i, chatAddress: c, feedReadTimeout: u } = this.swarmSettings, f = await r.makeFeedReader(ut.fromString(i), fi(c), {
|
|
6393
|
+
timeout: u
|
|
6386
6394
|
}).downloadPayload();
|
|
6387
|
-
return { data:
|
|
6388
|
-
}
|
|
6389
|
-
async fetchChatMessage(r) {
|
|
6390
|
-
const { bee: i, chatTopic: c, chatAddress: u } = this.swarmSettings;
|
|
6391
|
-
return (await i.makeFeedReader(De.fromString(c), Tn(u)).downloadPayload({ index: r })).payload.toJSON();
|
|
6395
|
+
return { data: f.payload.toJSON(), index: f.feedIndex };
|
|
6392
6396
|
}
|
|
6393
6397
|
async sendMessageToGsoc(r) {
|
|
6394
6398
|
const { enveloped: i, stamp: c } = this.swarmSettings;
|
|
@@ -6400,44 +6404,44 @@ class xf {
|
|
|
6400
6404
|
throw new Error("Enveloped mode is enabled, but stamp is not provided");
|
|
6401
6405
|
}
|
|
6402
6406
|
async rawSocDownload(r, i) {
|
|
6403
|
-
const { beeUrl: c } = this.swarmSettings,
|
|
6407
|
+
const { beeUrl: c, socReadTimeout: u } = this.swarmSettings, l = new AbortController(), f = setTimeout(() => l.abort(), u);
|
|
6404
6408
|
try {
|
|
6405
|
-
const
|
|
6409
|
+
const h = await fetch(`${c}/soc/${r}/${i}`, {
|
|
6406
6410
|
headers: {
|
|
6407
6411
|
"swarm-chunk-retrieval-timeout": "2000ms"
|
|
6408
6412
|
},
|
|
6409
|
-
signal:
|
|
6413
|
+
signal: l.signal
|
|
6410
6414
|
});
|
|
6411
|
-
if (!
|
|
6412
|
-
const
|
|
6413
|
-
throw
|
|
6415
|
+
if (!h.ok) {
|
|
6416
|
+
const g = new Error(`Failed to fetch: ${r}/${i} [${h.status}]`);
|
|
6417
|
+
throw g.status = h.status, g;
|
|
6414
6418
|
}
|
|
6415
|
-
return await
|
|
6416
|
-
} catch (
|
|
6417
|
-
throw
|
|
6419
|
+
return await h.text();
|
|
6420
|
+
} catch (h) {
|
|
6421
|
+
throw h.name === "AbortError" ? new Error(`Request timeout: ${r}/${i}`) : h;
|
|
6418
6422
|
} finally {
|
|
6419
|
-
clearTimeout(
|
|
6423
|
+
clearTimeout(f);
|
|
6420
6424
|
}
|
|
6421
6425
|
}
|
|
6422
6426
|
async sendMessageToGsocOwn(r) {
|
|
6423
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings,
|
|
6424
|
-
timeout:
|
|
6427
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l, gsocWriteTimeout: f } = this.swarmSettings, h = new ke(l), g = Lt.fromString(u), y = Ue.fromUtf8(r), { upload: x } = i.makeSOCWriter(h, {
|
|
6428
|
+
timeout: f
|
|
6425
6429
|
});
|
|
6426
|
-
await
|
|
6430
|
+
await x(c, g, y.toUint8Array());
|
|
6427
6431
|
}
|
|
6428
6432
|
async sendMessageToGsocEnvelope(r) {
|
|
6429
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, { privateKey:
|
|
6430
|
-
hash: () =>
|
|
6431
|
-
},
|
|
6432
|
-
timeout:
|
|
6433
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l, gsocWriteTimeout: f } = this.swarmSettings, { privateKey: h } = this.userDetails, g = xn.fromBlank(h, c, this.depth), y = new ke(l), x = Lt.fromString(u), N = Ue.fromUtf8(r), re = si(N.toUint8Array()), ne = ii(re, x, y), Fe = {
|
|
6434
|
+
hash: () => ne.address.toUint8Array()
|
|
6435
|
+
}, Oe = g.stamp(Fe), { upload: We } = i.makeSOCWriter(y, {
|
|
6436
|
+
timeout: f
|
|
6433
6437
|
});
|
|
6434
|
-
await Oe
|
|
6438
|
+
await We(Oe, x, N.toUint8Array());
|
|
6435
6439
|
}
|
|
6436
6440
|
}
|
|
6437
|
-
class
|
|
6441
|
+
class Sf {
|
|
6438
6442
|
constructor(r, i) {
|
|
6439
6443
|
this.fallbackTransport = null, this.logger = H.getInstance(), this.errorHandler = Q.getInstance(), this.gsocIndex = null;
|
|
6440
|
-
const c = new ke(
|
|
6444
|
+
const c = new ke(fi(r.user.privateKey));
|
|
6441
6445
|
this.userDetails = {
|
|
6442
6446
|
privateKey: r.user.privateKey,
|
|
6443
6447
|
ownAddress: c.publicKey().address().toString(),
|
|
@@ -6452,8 +6456,11 @@ class Ef {
|
|
|
6452
6456
|
gsocTopic: r.infra.gsocTopic,
|
|
6453
6457
|
gsocResourceId: r.infra.gsocResourceId,
|
|
6454
6458
|
chatTopic: r.infra.chatTopic,
|
|
6455
|
-
chatAddress: r.infra.chatAddress
|
|
6456
|
-
|
|
6459
|
+
chatAddress: r.infra.chatAddress,
|
|
6460
|
+
feedReadTimeout: r.infra.feedReadTimeout || 12e3,
|
|
6461
|
+
gsocWriteTimeout: r.infra.gsocWriteTimeout || 2e3,
|
|
6462
|
+
socReadTimeout: r.infra.socReadTimeout || 5e3
|
|
6463
|
+
}, this.emitter = new id(), this.utils = new kf(this.userDetails, this.swarmSettings), this.history = new xf(this.utils, this.emitter);
|
|
6457
6464
|
const u = r.infra.pollingInterval || 1e3;
|
|
6458
6465
|
i ? (this.transport = i, r.infra.enableFallbackPolling && (this.logger.info(`Fallback polling enabled with interval: ${u}ms`), this.fallbackTransport = this.createDefaultPollingTransport(u), this.fallbackTransport.onMessage((l) => {
|
|
6459
6466
|
this.emitter.emit(W.MESSAGE_RECEIVED, l);
|
|
@@ -6467,7 +6474,7 @@ class Ef {
|
|
|
6467
6474
|
try {
|
|
6468
6475
|
if (!this.gsocIndex)
|
|
6469
6476
|
return null;
|
|
6470
|
-
const i =
|
|
6477
|
+
const i = ut.fromString(this.swarmSettings.chatTopic), c = di(i, this.gsocIndex), u = await this.utils.rawSocDownload(this.swarmSettings.chatAddress, c.toString()), l = JSON.parse(u);
|
|
6471
6478
|
return Ei(l) ? (this.gsocIndex = this.gsocIndex.next(), l.message) : (this.logger.warn("Invalid GSOC message during fetching"), null);
|
|
6472
6479
|
} catch (i) {
|
|
6473
6480
|
if (this.utils.isNotFoundError(i))
|
|
@@ -6491,7 +6498,7 @@ class Ef {
|
|
|
6491
6498
|
return this.utils.orderMessages(r);
|
|
6492
6499
|
}
|
|
6493
6500
|
async sendMessage(r, i, c, u, l) {
|
|
6494
|
-
const f = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1,
|
|
6501
|
+
const f = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1, h = {
|
|
6495
6502
|
id: u || Hl(),
|
|
6496
6503
|
username: this.userDetails.nickname,
|
|
6497
6504
|
address: this.userDetails.ownAddress,
|
|
@@ -6504,15 +6511,15 @@ class Ef {
|
|
|
6504
6511
|
targetMessageId: c,
|
|
6505
6512
|
message: r,
|
|
6506
6513
|
additionalProps: l
|
|
6507
|
-
}, g =
|
|
6514
|
+
}, g = _f(h);
|
|
6508
6515
|
if (!g.isValid) {
|
|
6509
6516
|
const y = `Invalid message: ${g.errors.join(", ")}`;
|
|
6510
6517
|
throw this.logger.error(y), new Error(y);
|
|
6511
6518
|
}
|
|
6512
6519
|
try {
|
|
6513
|
-
this.emitter.emit(W.MESSAGE_REQUEST_INITIATED,
|
|
6520
|
+
this.emitter.emit(W.MESSAGE_REQUEST_INITIATED, h), await this.utils.writeOwnFeedDataByIndex(f, JSON.stringify(h)), this.userDetails.ownIndex = f, this.emitter.emit(W.MESSAGE_REQUEST_UPLOADED, h), await this.broadcastUserMessage(h);
|
|
6514
6521
|
} catch (y) {
|
|
6515
|
-
this.emitter.emit(W.MESSAGE_REQUEST_ERROR,
|
|
6522
|
+
this.emitter.emit(W.MESSAGE_REQUEST_ERROR, h), this.errorHandler.handleError(y, "Chat.sendMessage");
|
|
6516
6523
|
}
|
|
6517
6524
|
}
|
|
6518
6525
|
async fetchPreviousMessages() {
|
|
@@ -6532,23 +6539,30 @@ class Ef {
|
|
|
6532
6539
|
await this.broadcastUserMessage(r);
|
|
6533
6540
|
}
|
|
6534
6541
|
async init() {
|
|
6542
|
+
var r;
|
|
6535
6543
|
try {
|
|
6536
6544
|
this.emitter.emit(W.LOADING_INIT, !0);
|
|
6537
|
-
const [
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6545
|
+
const c = this.swarmSettings.feedReadTimeout - 1e3, [u, l] = await sd(
|
|
6546
|
+
Promise.allSettled([this.initOwnIndex(), this.history.init()]),
|
|
6547
|
+
c,
|
|
6548
|
+
"Initialization timed out"
|
|
6549
|
+
);
|
|
6550
|
+
if (u.status === "rejected")
|
|
6551
|
+
throw u.reason;
|
|
6552
|
+
l.status === "fulfilled" && (this.gsocIndex = l.value);
|
|
6553
|
+
} catch (i) {
|
|
6554
|
+
this.errorHandler.handleError(i, "Chat.initSelfState"), (r = i.message) != null && r.includes("timed out") ? this.userDetails.ownIndex === void 0 && (this.userDetails.ownIndex = -1) : this.emitter.emit(W.CRITICAL_ERROR, i);
|
|
6555
|
+
} finally {
|
|
6556
|
+
this.emitter.emit(W.LOADING_INIT, !1);
|
|
6543
6557
|
}
|
|
6544
6558
|
}
|
|
6545
6559
|
async initOwnIndex() {
|
|
6546
|
-
const { latestIndex: c } = await
|
|
6560
|
+
const { latestIndex: c } = await Tn(() => this.utils.getOwnLatestFeedIndex(), 10, 1e3);
|
|
6547
6561
|
this.userDetails.ownIndex = c;
|
|
6548
6562
|
}
|
|
6549
6563
|
async broadcastUserMessage(r) {
|
|
6550
6564
|
try {
|
|
6551
|
-
return
|
|
6565
|
+
return Tn(() => this.utils.sendMessageToGsoc(JSON.stringify(r)));
|
|
6552
6566
|
} catch (i) {
|
|
6553
6567
|
this.errorHandler.handleError(i, "Chat.broadcastUserMessage");
|
|
6554
6568
|
}
|
|
@@ -6565,5 +6579,5 @@ export {
|
|
|
6565
6579
|
W as EVENTS,
|
|
6566
6580
|
ki as MessageType,
|
|
6567
6581
|
ql as PollingTransport,
|
|
6568
|
-
|
|
6582
|
+
Sf as SwarmChat
|
|
6569
6583
|
};
|