@byloth/core 2.2.6 → 2.2.8
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/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +398 -340
- package/dist/core.esm.js.map +1 -1
- package/dist/core.global.js +1 -1
- package/dist/core.global.js.map +1 -1
- package/dist/core.umd.cjs +1 -1
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +1 -1
- package/src/models/callbacks/switchable-callback.ts +65 -8
- package/src/utils/random.ts +623 -140
package/dist/core.esm.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
var
|
|
1
|
+
var j = typeof window < "u" && typeof window.document < "u", W = typeof process < "u" && !!process.versions?.node, U = typeof self == "object" && self.constructor?.name === "DedicatedWorkerGlobalScope", m = class M extends Error {
|
|
2
2
|
static FromUnknown(e) {
|
|
3
|
-
if (e instanceof
|
|
3
|
+
if (e instanceof M) return e;
|
|
4
4
|
if (e instanceof Error) {
|
|
5
|
-
const t = new
|
|
5
|
+
const t = new M(e.message);
|
|
6
6
|
return t.stack = e.stack, t.cause = e.cause, t.name = e.name, t;
|
|
7
7
|
}
|
|
8
|
-
return new
|
|
8
|
+
return new M(`${e}`);
|
|
9
9
|
}
|
|
10
10
|
constructor(e, t, n = "Exception") {
|
|
11
11
|
super(e), this.cause = t, this.name = n;
|
|
12
12
|
}
|
|
13
13
|
[Symbol.toStringTag] = "Exception";
|
|
14
|
-
},
|
|
14
|
+
}, E = class extends m {
|
|
15
15
|
constructor(r, e, t = "FatalErrorException") {
|
|
16
16
|
r === void 0 && (r = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team."), super(r, e, t);
|
|
17
17
|
}
|
|
18
18
|
[Symbol.toStringTag] = "FatalErrorException";
|
|
19
|
-
},
|
|
19
|
+
}, B = class extends E {
|
|
20
20
|
constructor(r, e, t = "NotImplementedException") {
|
|
21
21
|
r === void 0 && (r = "This feature isn't implemented yet. Please, try again later."), super(r, e, t);
|
|
22
22
|
}
|
|
23
23
|
[Symbol.toStringTag] = "NotImplementedException";
|
|
24
|
-
},
|
|
24
|
+
}, D = class extends m {
|
|
25
25
|
constructor(r, e, t = "FileException") {
|
|
26
26
|
super(r, e, t);
|
|
27
27
|
}
|
|
28
28
|
[Symbol.toStringTag] = "FileException";
|
|
29
|
-
},
|
|
29
|
+
}, ee = class extends D {
|
|
30
30
|
constructor(r, e, t = "FileExistsException") {
|
|
31
31
|
super(r, e, t);
|
|
32
32
|
}
|
|
33
33
|
[Symbol.toStringTag] = "FileExistsException";
|
|
34
|
-
},
|
|
34
|
+
}, te = class extends D {
|
|
35
35
|
constructor(r, e, t = "FileNotFoundException") {
|
|
36
36
|
super(r, e, t);
|
|
37
37
|
}
|
|
38
38
|
[Symbol.toStringTag] = "FileNotFoundException";
|
|
39
|
-
},
|
|
39
|
+
}, g = class extends m {
|
|
40
40
|
constructor(r, e, t = "KeyException") {
|
|
41
41
|
super(r, e, t);
|
|
42
42
|
}
|
|
43
43
|
[Symbol.toStringTag] = "KeyException";
|
|
44
|
-
},
|
|
44
|
+
}, Y = class extends m {
|
|
45
45
|
constructor(r, e, t = "NetworkException") {
|
|
46
46
|
super(r, e, t);
|
|
47
47
|
}
|
|
48
48
|
[Symbol.toStringTag] = "NetworkException";
|
|
49
|
-
},
|
|
49
|
+
}, ne = class extends Y {
|
|
50
50
|
response;
|
|
51
51
|
constructor(r, e, t = "ResponseException") {
|
|
52
52
|
super(`The request failed with the status code ${r.status} (${r.statusText}).`, e, t), this.response = r;
|
|
53
53
|
}
|
|
54
54
|
[Symbol.toStringTag] = "ResponseException";
|
|
55
|
-
},
|
|
55
|
+
}, re = class extends m {
|
|
56
56
|
constructor(r, e, t = "PermissionException") {
|
|
57
57
|
super(r, e, t);
|
|
58
58
|
}
|
|
59
59
|
[Symbol.toStringTag] = "PermissionException";
|
|
60
|
-
},
|
|
60
|
+
}, A = class extends m {
|
|
61
61
|
constructor(r, e, t = "ReferenceException") {
|
|
62
62
|
super(r, e, t);
|
|
63
63
|
}
|
|
64
64
|
[Symbol.toStringTag] = "ReferenceException";
|
|
65
|
-
},
|
|
65
|
+
}, w = class extends m {
|
|
66
66
|
constructor(r, e, t = "RuntimeException") {
|
|
67
67
|
super(r, e, t);
|
|
68
68
|
}
|
|
69
69
|
[Symbol.toStringTag] = "RuntimeException";
|
|
70
|
-
},
|
|
70
|
+
}, V = class extends w {
|
|
71
71
|
constructor(r, e, t = "EnvironmentException") {
|
|
72
72
|
super(r, e, t);
|
|
73
73
|
}
|
|
74
74
|
[Symbol.toStringTag] = "EnvironmentException";
|
|
75
|
-
},
|
|
75
|
+
}, J = class extends m {
|
|
76
76
|
constructor(r, e, t = "TimeoutException") {
|
|
77
77
|
super(r, e, t);
|
|
78
78
|
}
|
|
79
79
|
[Symbol.toStringTag] = "TimeoutException";
|
|
80
|
-
},
|
|
80
|
+
}, se = class extends m {
|
|
81
81
|
constructor(r, e, t = "TypeException") {
|
|
82
82
|
super(r, e, t);
|
|
83
83
|
}
|
|
84
84
|
[Symbol.toStringTag] = "TypeException";
|
|
85
|
-
},
|
|
85
|
+
}, c = class extends m {
|
|
86
86
|
constructor(r, e, t = "ValueException") {
|
|
87
87
|
super(r, e, t);
|
|
88
88
|
}
|
|
89
89
|
[Symbol.toStringTag] = "ValueException";
|
|
90
|
-
},
|
|
90
|
+
}, k = class extends c {
|
|
91
91
|
constructor(r, e, t = "RangeException") {
|
|
92
92
|
super(r, e, t);
|
|
93
93
|
}
|
|
94
94
|
[Symbol.toStringTag] = "RangeException";
|
|
95
|
-
},
|
|
95
|
+
}, h = class x {
|
|
96
96
|
_iterator;
|
|
97
97
|
constructor(e) {
|
|
98
98
|
e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e;
|
|
@@ -117,7 +117,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
117
117
|
}
|
|
118
118
|
filter(e) {
|
|
119
119
|
const t = this._iterator;
|
|
120
|
-
return new
|
|
120
|
+
return new x(function* () {
|
|
121
121
|
let n = 0;
|
|
122
122
|
for (; ; ) {
|
|
123
123
|
const s = t.next();
|
|
@@ -128,7 +128,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
128
128
|
}
|
|
129
129
|
map(e) {
|
|
130
130
|
const t = this._iterator;
|
|
131
|
-
return new
|
|
131
|
+
return new x(function* () {
|
|
132
132
|
let n = 0;
|
|
133
133
|
for (; ; ) {
|
|
134
134
|
const s = t.next();
|
|
@@ -141,7 +141,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
141
141
|
let n = 0, s = t;
|
|
142
142
|
if (s === void 0) {
|
|
143
143
|
const i = this._iterator.next();
|
|
144
|
-
if (i.done) throw new
|
|
144
|
+
if (i.done) throw new c("Cannot reduce an empty iterator without an initial value.");
|
|
145
145
|
s = i.value, n += 1;
|
|
146
146
|
}
|
|
147
147
|
for (; ; ) {
|
|
@@ -152,7 +152,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
152
152
|
}
|
|
153
153
|
flatMap(e) {
|
|
154
154
|
const t = this._iterator;
|
|
155
|
-
return new
|
|
155
|
+
return new x(function* () {
|
|
156
156
|
let n = 0;
|
|
157
157
|
for (; ; ) {
|
|
158
158
|
const s = t.next();
|
|
@@ -166,7 +166,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
166
166
|
}
|
|
167
167
|
drop(e) {
|
|
168
168
|
const t = this._iterator;
|
|
169
|
-
return new
|
|
169
|
+
return new x(function* () {
|
|
170
170
|
let n = 0;
|
|
171
171
|
for (; n < e; ) {
|
|
172
172
|
if (t.next().done) return;
|
|
@@ -181,7 +181,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
181
181
|
}
|
|
182
182
|
take(e) {
|
|
183
183
|
const t = this._iterator;
|
|
184
|
-
return new
|
|
184
|
+
return new x(function* () {
|
|
185
185
|
let n = 0;
|
|
186
186
|
for (; n < e; ) {
|
|
187
187
|
const s = t.next();
|
|
@@ -204,7 +204,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
204
204
|
}
|
|
205
205
|
unique() {
|
|
206
206
|
const e = this._iterator;
|
|
207
|
-
return new
|
|
207
|
+
return new x(function* () {
|
|
208
208
|
const t = /* @__PURE__ */ new Set();
|
|
209
209
|
for (; ; ) {
|
|
210
210
|
const n = e.next();
|
|
@@ -242,7 +242,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
242
242
|
throw e;
|
|
243
243
|
}
|
|
244
244
|
groupBy(e) {
|
|
245
|
-
return new
|
|
245
|
+
return new F(this.map((t, n) => [e(t, n), t]));
|
|
246
246
|
}
|
|
247
247
|
toArray() {
|
|
248
248
|
return Array.from(this);
|
|
@@ -251,10 +251,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
251
251
|
[Symbol.iterator]() {
|
|
252
252
|
return this;
|
|
253
253
|
}
|
|
254
|
-
},
|
|
254
|
+
}, d = class S {
|
|
255
255
|
_elements;
|
|
256
256
|
constructor(e) {
|
|
257
|
-
this._elements = new
|
|
257
|
+
this._elements = new h(e);
|
|
258
258
|
}
|
|
259
259
|
every(e) {
|
|
260
260
|
for (const [t, [n, s]] of this._elements.enumerate()) if (!e(n, s, t)) return !1;
|
|
@@ -266,13 +266,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
266
266
|
}
|
|
267
267
|
filter(e) {
|
|
268
268
|
const t = this._elements.enumerate();
|
|
269
|
-
return new
|
|
269
|
+
return new S(function* () {
|
|
270
270
|
for (const [n, [s, i]] of t) e(s, i, n) && (yield [s, i]);
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
map(e) {
|
|
274
274
|
const t = this._elements.enumerate();
|
|
275
|
-
return new
|
|
275
|
+
return new S(function* () {
|
|
276
276
|
for (const [n, [s, i]] of t) yield [s, e(s, i, n)];
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -280,7 +280,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
280
280
|
let n = 0, s = t;
|
|
281
281
|
if (s === void 0) {
|
|
282
282
|
const i = this._elements.next();
|
|
283
|
-
if (i.done) throw new
|
|
283
|
+
if (i.done) throw new c("Cannot reduce an empty iterator without an initial value.");
|
|
284
284
|
s = i.value[1], n += 1;
|
|
285
285
|
}
|
|
286
286
|
for (const [i, o] of this._elements)
|
|
@@ -289,23 +289,23 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
289
289
|
}
|
|
290
290
|
flatMap(e) {
|
|
291
291
|
const t = this._elements.enumerate();
|
|
292
|
-
return new
|
|
292
|
+
return new F(function* () {
|
|
293
293
|
for (const [n, [s, i]] of t) {
|
|
294
294
|
const o = e(s, i, n);
|
|
295
|
-
if (o instanceof Array) for (const
|
|
295
|
+
if (o instanceof Array) for (const l of o) yield [s, l];
|
|
296
296
|
else yield [s, o];
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
300
|
drop(e) {
|
|
301
301
|
const t = this._elements.enumerate();
|
|
302
|
-
return new
|
|
302
|
+
return new S(function* () {
|
|
303
303
|
for (const [n, [s, i]] of t) n >= e && (yield [s, i]);
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
take(e) {
|
|
307
307
|
const t = this._elements.enumerate();
|
|
308
|
-
return new
|
|
308
|
+
return new S(function* () {
|
|
309
309
|
for (const [n, [s, i]] of t) {
|
|
310
310
|
if (n >= e) break;
|
|
311
311
|
yield [s, i];
|
|
@@ -320,7 +320,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
320
320
|
}
|
|
321
321
|
unique() {
|
|
322
322
|
const e = this._elements;
|
|
323
|
-
return new
|
|
323
|
+
return new S(function* () {
|
|
324
324
|
const t = /* @__PURE__ */ new Set();
|
|
325
325
|
for (const [n, s] of e)
|
|
326
326
|
t.has(s) || (t.add(s), yield [n, s]);
|
|
@@ -336,13 +336,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
336
336
|
}
|
|
337
337
|
reorganizeBy(e) {
|
|
338
338
|
const t = this._elements.enumerate();
|
|
339
|
-
return new
|
|
339
|
+
return new F(function* () {
|
|
340
340
|
for (const [n, [s, i]] of t) yield [e(s, i, n), i];
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
keys() {
|
|
344
344
|
const e = this._elements;
|
|
345
|
-
return new
|
|
345
|
+
return new h(function* () {
|
|
346
346
|
for (const [t] of e) yield t;
|
|
347
347
|
});
|
|
348
348
|
}
|
|
@@ -351,7 +351,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
351
351
|
}
|
|
352
352
|
values() {
|
|
353
353
|
const e = this._elements;
|
|
354
|
-
return new
|
|
354
|
+
return new h(function* () {
|
|
355
355
|
for (const [t, n] of e) yield n;
|
|
356
356
|
});
|
|
357
357
|
}
|
|
@@ -365,10 +365,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
365
365
|
return Object.fromEntries(this.entries());
|
|
366
366
|
}
|
|
367
367
|
[Symbol.toStringTag] = "ReducedIterator";
|
|
368
|
-
},
|
|
368
|
+
}, L = class p {
|
|
369
369
|
_elements;
|
|
370
370
|
constructor(e) {
|
|
371
|
-
this._elements = new
|
|
371
|
+
this._elements = new R(e);
|
|
372
372
|
}
|
|
373
373
|
async every(e) {
|
|
374
374
|
const t = /* @__PURE__ */ new Map();
|
|
@@ -376,7 +376,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
376
376
|
const [i, o] = t.get(n) ?? [0, !0];
|
|
377
377
|
o && t.set(n, [i + 1, await e(n, s, i)]);
|
|
378
378
|
}
|
|
379
|
-
return new
|
|
379
|
+
return new d(function* () {
|
|
380
380
|
for (const [n, [s, i]] of t) yield [n, i];
|
|
381
381
|
});
|
|
382
382
|
}
|
|
@@ -386,13 +386,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
386
386
|
const [i, o] = t.get(n) ?? [0, !1];
|
|
387
387
|
o || t.set(n, [i + 1, await e(n, s, i)]);
|
|
388
388
|
}
|
|
389
|
-
return new
|
|
389
|
+
return new d(function* () {
|
|
390
390
|
for (const [n, [s, i]] of t) yield [n, i];
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
filter(e) {
|
|
394
394
|
const t = this._elements;
|
|
395
|
-
return new
|
|
395
|
+
return new p(async function* () {
|
|
396
396
|
const n = /* @__PURE__ */ new Map();
|
|
397
397
|
for await (const [s, i] of t) {
|
|
398
398
|
const o = n.get(s) ?? 0;
|
|
@@ -402,7 +402,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
402
402
|
}
|
|
403
403
|
map(e) {
|
|
404
404
|
const t = this._elements;
|
|
405
|
-
return new
|
|
405
|
+
return new p(async function* () {
|
|
406
406
|
const n = /* @__PURE__ */ new Map();
|
|
407
407
|
for await (const [s, i] of t) {
|
|
408
408
|
const o = n.get(s) ?? 0;
|
|
@@ -413,35 +413,35 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
413
413
|
async reduce(e, t) {
|
|
414
414
|
const n = /* @__PURE__ */ new Map();
|
|
415
415
|
for await (const [s, i] of this._elements) {
|
|
416
|
-
let o,
|
|
417
|
-
if (n.has(s)) [o,
|
|
416
|
+
let o, l;
|
|
417
|
+
if (n.has(s)) [o, l] = n.get(s);
|
|
418
418
|
else if (t !== void 0)
|
|
419
|
-
o = 0, t instanceof Function ?
|
|
419
|
+
o = 0, t instanceof Function ? l = await t(s) : l = await t;
|
|
420
420
|
else {
|
|
421
421
|
n.set(s, [0, i]);
|
|
422
422
|
continue;
|
|
423
423
|
}
|
|
424
|
-
n.set(s, [o + 1, await e(s,
|
|
424
|
+
n.set(s, [o + 1, await e(s, l, i, o)]);
|
|
425
425
|
}
|
|
426
|
-
return new
|
|
426
|
+
return new d(function* () {
|
|
427
427
|
for (const [s, [i, o]] of n) yield [s, o];
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
flatMap(e) {
|
|
431
431
|
const t = this._elements;
|
|
432
|
-
return new
|
|
432
|
+
return new p(async function* () {
|
|
433
433
|
const n = /* @__PURE__ */ new Map();
|
|
434
434
|
for await (const [s, i] of t) {
|
|
435
|
-
const o = n.get(s) ?? 0,
|
|
436
|
-
if (
|
|
437
|
-
else yield [s,
|
|
435
|
+
const o = n.get(s) ?? 0, l = await e(s, i, o);
|
|
436
|
+
if (l instanceof Array) for (const a of l) yield [s, a];
|
|
437
|
+
else yield [s, l];
|
|
438
438
|
n.set(s, o + 1);
|
|
439
439
|
}
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
442
|
drop(e) {
|
|
443
443
|
const t = this._elements;
|
|
444
|
-
return new
|
|
444
|
+
return new p(async function* () {
|
|
445
445
|
const n = /* @__PURE__ */ new Map();
|
|
446
446
|
for await (const [s, i] of t) {
|
|
447
447
|
const o = n.get(s) ?? 0;
|
|
@@ -455,7 +455,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
455
455
|
}
|
|
456
456
|
take(e) {
|
|
457
457
|
const t = this._elements;
|
|
458
|
-
return new
|
|
458
|
+
return new p(async function* () {
|
|
459
459
|
const n = /* @__PURE__ */ new Map();
|
|
460
460
|
for await (const [s, i] of t) {
|
|
461
461
|
const o = n.get(s) ?? 0;
|
|
@@ -469,7 +469,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
469
469
|
let [i, o] = t.get(n) ?? [0, void 0];
|
|
470
470
|
o === void 0 && (await e(n, s, i) && (o = s), t.set(n, [i + 1, o]));
|
|
471
471
|
}
|
|
472
|
-
return new
|
|
472
|
+
return new d(function* () {
|
|
473
473
|
for (const [n, [s, i]] of t) yield [n, i];
|
|
474
474
|
});
|
|
475
475
|
}
|
|
@@ -478,7 +478,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
478
478
|
}
|
|
479
479
|
unique() {
|
|
480
480
|
const e = this._elements;
|
|
481
|
-
return new
|
|
481
|
+
return new p(async function* () {
|
|
482
482
|
const t = /* @__PURE__ */ new Map();
|
|
483
483
|
for await (const [n, s] of e) {
|
|
484
484
|
const i = t.get(n) ?? /* @__PURE__ */ new Set();
|
|
@@ -492,7 +492,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
492
492
|
const n = e.get(t) ?? 0;
|
|
493
493
|
e.set(t, n + 1);
|
|
494
494
|
}
|
|
495
|
-
return new
|
|
495
|
+
return new d(function* () {
|
|
496
496
|
for (const [t, n] of e) yield [t, n];
|
|
497
497
|
});
|
|
498
498
|
}
|
|
@@ -505,7 +505,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
505
505
|
}
|
|
506
506
|
reorganizeBy(e) {
|
|
507
507
|
const t = this._elements;
|
|
508
|
-
return new
|
|
508
|
+
return new p(async function* () {
|
|
509
509
|
const n = /* @__PURE__ */ new Map();
|
|
510
510
|
for await (const [s, i] of t) {
|
|
511
511
|
const o = n.get(s) ?? 0;
|
|
@@ -515,7 +515,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
515
515
|
}
|
|
516
516
|
keys() {
|
|
517
517
|
const e = this._elements;
|
|
518
|
-
return new
|
|
518
|
+
return new R(async function* () {
|
|
519
519
|
const t = /* @__PURE__ */ new Set();
|
|
520
520
|
for await (const [n] of e)
|
|
521
521
|
t.has(n) || (t.add(n), yield n);
|
|
@@ -526,7 +526,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
526
526
|
}
|
|
527
527
|
values() {
|
|
528
528
|
const e = this._elements;
|
|
529
|
-
return new
|
|
529
|
+
return new R(async function* () {
|
|
530
530
|
for await (const [t, n] of e) yield n;
|
|
531
531
|
});
|
|
532
532
|
}
|
|
@@ -551,7 +551,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
551
551
|
return e;
|
|
552
552
|
}
|
|
553
553
|
[Symbol.toStringTag] = "AggregatedAsyncIterator";
|
|
554
|
-
},
|
|
554
|
+
}, R = class v {
|
|
555
555
|
_iterator;
|
|
556
556
|
constructor(e) {
|
|
557
557
|
if (e instanceof Function) {
|
|
@@ -603,7 +603,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
603
603
|
}
|
|
604
604
|
filter(e) {
|
|
605
605
|
const t = this._iterator;
|
|
606
|
-
return new
|
|
606
|
+
return new v(async function* () {
|
|
607
607
|
let n = 0;
|
|
608
608
|
for (; ; ) {
|
|
609
609
|
const s = await t.next();
|
|
@@ -614,7 +614,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
614
614
|
}
|
|
615
615
|
map(e) {
|
|
616
616
|
const t = this._iterator;
|
|
617
|
-
return new
|
|
617
|
+
return new v(async function* () {
|
|
618
618
|
let n = 0;
|
|
619
619
|
for (; ; ) {
|
|
620
620
|
const s = await t.next();
|
|
@@ -627,7 +627,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
627
627
|
let n = 0, s = t;
|
|
628
628
|
if (s === void 0) {
|
|
629
629
|
const i = await this._iterator.next();
|
|
630
|
-
if (i.done) throw new
|
|
630
|
+
if (i.done) throw new c("Cannot reduce an empty iterator without an initial value.");
|
|
631
631
|
s = i.value, n += 1;
|
|
632
632
|
}
|
|
633
633
|
for (; ; ) {
|
|
@@ -638,7 +638,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
638
638
|
}
|
|
639
639
|
flatMap(e) {
|
|
640
640
|
const t = this._iterator;
|
|
641
|
-
return new
|
|
641
|
+
return new v(async function* () {
|
|
642
642
|
let n = 0;
|
|
643
643
|
for (; ; ) {
|
|
644
644
|
const s = await t.next();
|
|
@@ -652,7 +652,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
652
652
|
}
|
|
653
653
|
drop(e) {
|
|
654
654
|
const t = this._iterator;
|
|
655
|
-
return new
|
|
655
|
+
return new v(async function* () {
|
|
656
656
|
let n = 0;
|
|
657
657
|
for (; n < e; ) {
|
|
658
658
|
if ((await t.next()).done) return;
|
|
@@ -667,7 +667,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
667
667
|
}
|
|
668
668
|
take(e) {
|
|
669
669
|
const t = this._iterator;
|
|
670
|
-
return new
|
|
670
|
+
return new v(async function* () {
|
|
671
671
|
let n = 0;
|
|
672
672
|
for (; n < e; ) {
|
|
673
673
|
const s = await t.next();
|
|
@@ -690,7 +690,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
690
690
|
}
|
|
691
691
|
unique() {
|
|
692
692
|
const e = this._iterator;
|
|
693
|
-
return new
|
|
693
|
+
return new v(async function* () {
|
|
694
694
|
const t = /* @__PURE__ */ new Set();
|
|
695
695
|
for (; ; ) {
|
|
696
696
|
const n = await e.next();
|
|
@@ -729,7 +729,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
729
729
|
throw e;
|
|
730
730
|
}
|
|
731
731
|
groupBy(e) {
|
|
732
|
-
return new
|
|
732
|
+
return new L(this.map(async (t, n) => [await e(t, n), t]));
|
|
733
733
|
}
|
|
734
734
|
toArray() {
|
|
735
735
|
return Array.fromAsync(this);
|
|
@@ -738,10 +738,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
738
738
|
[Symbol.asyncIterator]() {
|
|
739
739
|
return this;
|
|
740
740
|
}
|
|
741
|
-
},
|
|
741
|
+
}, F = class _ {
|
|
742
742
|
_elements;
|
|
743
743
|
constructor(e) {
|
|
744
|
-
this._elements = new
|
|
744
|
+
this._elements = new h(e);
|
|
745
745
|
}
|
|
746
746
|
every(e) {
|
|
747
747
|
const t = /* @__PURE__ */ new Map();
|
|
@@ -749,7 +749,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
749
749
|
const [i, o] = t.get(n) ?? [0, !0];
|
|
750
750
|
o && t.set(n, [i + 1, e(n, s, i)]);
|
|
751
751
|
}
|
|
752
|
-
return new
|
|
752
|
+
return new d(function* () {
|
|
753
753
|
for (const [n, [s, i]] of t) yield [n, i];
|
|
754
754
|
});
|
|
755
755
|
}
|
|
@@ -759,13 +759,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
759
759
|
const [i, o] = t.get(n) ?? [0, !1];
|
|
760
760
|
o || t.set(n, [i + 1, e(n, s, i)]);
|
|
761
761
|
}
|
|
762
|
-
return new
|
|
762
|
+
return new d(function* () {
|
|
763
763
|
for (const [n, [s, i]] of t) yield [n, i];
|
|
764
764
|
});
|
|
765
765
|
}
|
|
766
766
|
filter(e) {
|
|
767
767
|
const t = this._elements;
|
|
768
|
-
return new
|
|
768
|
+
return new _(function* () {
|
|
769
769
|
const n = /* @__PURE__ */ new Map();
|
|
770
770
|
for (const [s, i] of t) {
|
|
771
771
|
const o = n.get(s) ?? 0;
|
|
@@ -775,7 +775,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
775
775
|
}
|
|
776
776
|
map(e) {
|
|
777
777
|
const t = this._elements;
|
|
778
|
-
return new
|
|
778
|
+
return new _(function* () {
|
|
779
779
|
const n = /* @__PURE__ */ new Map();
|
|
780
780
|
for (const [s, i] of t) {
|
|
781
781
|
const o = n.get(s) ?? 0;
|
|
@@ -786,35 +786,35 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
786
786
|
reduce(e, t) {
|
|
787
787
|
const n = /* @__PURE__ */ new Map();
|
|
788
788
|
for (const [s, i] of this._elements) {
|
|
789
|
-
let o,
|
|
790
|
-
if (n.has(s)) [o,
|
|
789
|
+
let o, l;
|
|
790
|
+
if (n.has(s)) [o, l] = n.get(s);
|
|
791
791
|
else if (t !== void 0)
|
|
792
|
-
o = 0, t instanceof Function ?
|
|
792
|
+
o = 0, t instanceof Function ? l = t(s) : l = t;
|
|
793
793
|
else {
|
|
794
794
|
n.set(s, [0, i]);
|
|
795
795
|
continue;
|
|
796
796
|
}
|
|
797
|
-
n.set(s, [o + 1, e(s,
|
|
797
|
+
n.set(s, [o + 1, e(s, l, i, o)]);
|
|
798
798
|
}
|
|
799
|
-
return new
|
|
799
|
+
return new d(function* () {
|
|
800
800
|
for (const [s, [i, o]] of n) yield [s, o];
|
|
801
801
|
});
|
|
802
802
|
}
|
|
803
803
|
flatMap(e) {
|
|
804
804
|
const t = this._elements;
|
|
805
|
-
return new
|
|
805
|
+
return new _(function* () {
|
|
806
806
|
const n = /* @__PURE__ */ new Map();
|
|
807
807
|
for (const [s, i] of t) {
|
|
808
|
-
const o = n.get(s) ?? 0,
|
|
809
|
-
if (
|
|
810
|
-
else yield [s,
|
|
808
|
+
const o = n.get(s) ?? 0, l = e(s, i, o);
|
|
809
|
+
if (l instanceof Array) for (const a of l) yield [s, a];
|
|
810
|
+
else yield [s, l];
|
|
811
811
|
n.set(s, o + 1);
|
|
812
812
|
}
|
|
813
813
|
});
|
|
814
814
|
}
|
|
815
815
|
drop(e) {
|
|
816
816
|
const t = this._elements;
|
|
817
|
-
return new
|
|
817
|
+
return new _(function* () {
|
|
818
818
|
const n = /* @__PURE__ */ new Map();
|
|
819
819
|
for (const [s, i] of t) {
|
|
820
820
|
const o = n.get(s) ?? 0;
|
|
@@ -828,7 +828,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
828
828
|
}
|
|
829
829
|
take(e) {
|
|
830
830
|
const t = this._elements;
|
|
831
|
-
return new
|
|
831
|
+
return new _(function* () {
|
|
832
832
|
const n = /* @__PURE__ */ new Map();
|
|
833
833
|
for (const [s, i] of t) {
|
|
834
834
|
const o = n.get(s) ?? 0;
|
|
@@ -842,7 +842,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
842
842
|
let [i, o] = t.get(n) ?? [0, void 0];
|
|
843
843
|
o === void 0 && (e(n, s, i) && (o = s), t.set(n, [i + 1, o]));
|
|
844
844
|
}
|
|
845
|
-
return new
|
|
845
|
+
return new d(function* () {
|
|
846
846
|
for (const [n, [s, i]] of t) yield [n, i];
|
|
847
847
|
});
|
|
848
848
|
}
|
|
@@ -851,7 +851,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
851
851
|
}
|
|
852
852
|
unique() {
|
|
853
853
|
const e = this._elements;
|
|
854
|
-
return new
|
|
854
|
+
return new _(function* () {
|
|
855
855
|
const t = /* @__PURE__ */ new Map();
|
|
856
856
|
for (const [n, s] of e) {
|
|
857
857
|
const i = t.get(n) ?? /* @__PURE__ */ new Set();
|
|
@@ -865,7 +865,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
865
865
|
const n = e.get(t) ?? 0;
|
|
866
866
|
e.set(t, n + 1);
|
|
867
867
|
}
|
|
868
|
-
return new
|
|
868
|
+
return new d(function* () {
|
|
869
869
|
for (const [t, n] of e) yield [t, n];
|
|
870
870
|
});
|
|
871
871
|
}
|
|
@@ -878,7 +878,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
878
878
|
}
|
|
879
879
|
reorganizeBy(e) {
|
|
880
880
|
const t = this._elements;
|
|
881
|
-
return new
|
|
881
|
+
return new _(function* () {
|
|
882
882
|
const n = /* @__PURE__ */ new Map();
|
|
883
883
|
for (const [s, i] of t) {
|
|
884
884
|
const o = n.get(s) ?? 0;
|
|
@@ -888,7 +888,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
888
888
|
}
|
|
889
889
|
keys() {
|
|
890
890
|
const e = this._elements;
|
|
891
|
-
return new
|
|
891
|
+
return new h(function* () {
|
|
892
892
|
const t = /* @__PURE__ */ new Set();
|
|
893
893
|
for (const [n] of e)
|
|
894
894
|
t.has(n) || (t.add(n), yield n);
|
|
@@ -899,7 +899,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
899
899
|
}
|
|
900
900
|
values() {
|
|
901
901
|
const e = this._elements;
|
|
902
|
-
return new
|
|
902
|
+
return new h(function* () {
|
|
903
903
|
for (const [t, n] of e) yield n;
|
|
904
904
|
});
|
|
905
905
|
}
|
|
@@ -924,14 +924,14 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
924
924
|
return e;
|
|
925
925
|
}
|
|
926
926
|
[Symbol.toStringTag] = "AggregatedIterator";
|
|
927
|
-
},
|
|
927
|
+
}, G = Function, z = class extends G {
|
|
928
928
|
constructor() {
|
|
929
929
|
super("return this._invoke(...arguments);");
|
|
930
930
|
const r = this.bind(this);
|
|
931
931
|
return Object.setPrototypeOf(this, r), r;
|
|
932
932
|
}
|
|
933
933
|
[Symbol.toStringTag] = "CallableObject";
|
|
934
|
-
},
|
|
934
|
+
}, ie = class extends z {
|
|
935
935
|
_callbacks;
|
|
936
936
|
get size() {
|
|
937
937
|
return this._callbacks.length;
|
|
@@ -955,13 +955,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
955
955
|
this._callbacks.length = 0;
|
|
956
956
|
}
|
|
957
957
|
[Symbol.toStringTag] = "CallbackChain";
|
|
958
|
-
},
|
|
958
|
+
}, I = class N {
|
|
959
959
|
_subscribers;
|
|
960
960
|
constructor() {
|
|
961
961
|
this._subscribers = /* @__PURE__ */ new Map();
|
|
962
962
|
}
|
|
963
963
|
createScope() {
|
|
964
|
-
const e = new
|
|
964
|
+
const e = new N();
|
|
965
965
|
return this.subscribe("__internals__:clear", () => e.clear()), this.subscribe("*", (t, ...n) => {
|
|
966
966
|
e.publish(t, ...n);
|
|
967
967
|
}), e;
|
|
@@ -971,7 +971,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
971
971
|
if (s) {
|
|
972
972
|
const i = s.slice(), o = i.length;
|
|
973
973
|
n = new Array(o);
|
|
974
|
-
for (let
|
|
974
|
+
for (let l = 0; l < o; l += 1) n[l] = i[l](...t);
|
|
975
975
|
} else n = [];
|
|
976
976
|
return e.startsWith("__") || (s = this._subscribers.get("*"), s && s.slice().forEach((i) => i(e, ...t))), n;
|
|
977
977
|
}
|
|
@@ -979,15 +979,15 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
979
979
|
const n = this._subscribers.get(e) ?? [];
|
|
980
980
|
return n.push(t), this._subscribers.set(e, n), () => {
|
|
981
981
|
const s = n.indexOf(t);
|
|
982
|
-
if (s < 0) throw new
|
|
982
|
+
if (s < 0) throw new A("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
|
|
983
983
|
n.splice(s, 1);
|
|
984
984
|
};
|
|
985
985
|
}
|
|
986
986
|
unsubscribe(e, t) {
|
|
987
987
|
const n = this._subscribers.get(e);
|
|
988
|
-
if (!n) throw new
|
|
988
|
+
if (!n) throw new A("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
|
|
989
989
|
const s = n.indexOf(t);
|
|
990
|
-
if (s < 0) throw new
|
|
990
|
+
if (s < 0) throw new A("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
|
|
991
991
|
n.splice(s, 1), n.length === 0 && this._subscribers.delete(e);
|
|
992
992
|
}
|
|
993
993
|
unsubscribeAll(e) {
|
|
@@ -997,8 +997,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
997
997
|
this.publish("__internals__:clear"), this._subscribers.clear();
|
|
998
998
|
}
|
|
999
999
|
[Symbol.toStringTag] = "Publisher";
|
|
1000
|
-
},
|
|
1001
|
-
},
|
|
1000
|
+
}, H = () => {
|
|
1001
|
+
}, P = () => {
|
|
1002
|
+
throw new B("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?");
|
|
1003
|
+
}, oe = class extends z {
|
|
1002
1004
|
_callback;
|
|
1003
1005
|
_callbacks;
|
|
1004
1006
|
_isEnabled;
|
|
@@ -1011,44 +1013,45 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1011
1013
|
}
|
|
1012
1014
|
_invoke;
|
|
1013
1015
|
constructor(r, e = "default") {
|
|
1014
|
-
super(), this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, r ? this._callbacks.set(e, r) : (e = "", r = (
|
|
1015
|
-
throw new O("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?");
|
|
1016
|
-
})), this._key = e, this._callback = r, this._invoke = (...t) => this._callback(...t);
|
|
1016
|
+
super(), this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, r ? this._callbacks.set(e, r) : (e = "", r = P), this._key = e, this._callback = r, this._invoke = (...t) => this._callback(...t);
|
|
1017
1017
|
}
|
|
1018
1018
|
enable(r) {
|
|
1019
1019
|
if (r === void 0) {
|
|
1020
|
-
if (!this._key) throw new
|
|
1020
|
+
if (!this._key) throw new g("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?");
|
|
1021
1021
|
r = this._key;
|
|
1022
1022
|
} else if (r) {
|
|
1023
|
-
if (!this._callbacks.has(r)) throw new
|
|
1024
|
-
} else throw new
|
|
1025
|
-
if (this._isEnabled) throw new
|
|
1023
|
+
if (!this._callbacks.has(r)) throw new g(`The key '${r}' doesn't yet have any associated callback.`);
|
|
1024
|
+
} else throw new g("The key must be a non-empty string.");
|
|
1025
|
+
if (this._isEnabled) throw new w("The `SwitchableCallback` is already enabled.");
|
|
1026
1026
|
this._callback = this._callbacks.get(r), this._isEnabled = !0;
|
|
1027
1027
|
}
|
|
1028
1028
|
disable() {
|
|
1029
|
-
if (!this._isEnabled) throw new
|
|
1030
|
-
this._callback =
|
|
1029
|
+
if (!this._isEnabled) throw new w("The `SwitchableCallback` is already disabled.");
|
|
1030
|
+
this._callback = H, this._isEnabled = !1;
|
|
1031
1031
|
}
|
|
1032
1032
|
register(r, e) {
|
|
1033
1033
|
if (this._callbacks.size === 0)
|
|
1034
1034
|
this._key = r, this._callback = e;
|
|
1035
|
-
else if (this._callbacks.has(r)) throw new
|
|
1035
|
+
else if (this._callbacks.has(r)) throw new g(`The key '${r}' has already been used for another callback.`);
|
|
1036
1036
|
this._callbacks.set(r, e);
|
|
1037
1037
|
}
|
|
1038
1038
|
unregister(r) {
|
|
1039
|
-
if (this._key === r) throw new
|
|
1040
|
-
if (!this._callbacks.has(r)) throw new
|
|
1039
|
+
if (this._key === r) throw new g("Unable to unregister the currently selected callback.");
|
|
1040
|
+
if (!this._callbacks.has(r)) throw new g(`The key '${r}' doesn't yet have any associated callback.`);
|
|
1041
1041
|
this._callbacks.delete(r);
|
|
1042
1042
|
}
|
|
1043
1043
|
switch(r) {
|
|
1044
|
-
if (!this._callbacks.has(r)) throw new
|
|
1044
|
+
if (!this._callbacks.has(r)) throw new g(`The key '${r}' doesn't yet have any associated callback.`);
|
|
1045
1045
|
this._key !== r && (this._key = r, this._isEnabled && (this._callback = this._callbacks.get(r)));
|
|
1046
1046
|
}
|
|
1047
|
+
reset(r, e = "default") {
|
|
1048
|
+
this._callbacks.clear(), this._isEnabled = !0, r ? this._callbacks.set(e, r) : (e = "", r = P), this._key = e, this._callback = r;
|
|
1049
|
+
}
|
|
1047
1050
|
[Symbol.toStringTag] = "SwitchableCallback";
|
|
1048
|
-
},
|
|
1051
|
+
}, ae = class extends Array {
|
|
1049
1052
|
_publisher;
|
|
1050
1053
|
constructor(...r) {
|
|
1051
|
-
super(...r), this._publisher = new
|
|
1054
|
+
super(...r), this._publisher = new I();
|
|
1052
1055
|
}
|
|
1053
1056
|
push(...r) {
|
|
1054
1057
|
const e = this.length, t = super.push(...r);
|
|
@@ -1092,10 +1095,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1092
1095
|
}
|
|
1093
1096
|
[Symbol.toStringTag] = "ArrayView";
|
|
1094
1097
|
static [Symbol.species] = Array;
|
|
1095
|
-
},
|
|
1098
|
+
}, le = class extends Map {
|
|
1096
1099
|
_publisher;
|
|
1097
1100
|
constructor(r) {
|
|
1098
|
-
if (super(), this._publisher = new
|
|
1101
|
+
if (super(), this._publisher = new I(), r) for (const [e, t] of r) super.set(e, t);
|
|
1099
1102
|
}
|
|
1100
1103
|
set(r, e) {
|
|
1101
1104
|
return super.set(r, e), this._publisher.publish("add", r, e), this;
|
|
@@ -1118,10 +1121,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1118
1121
|
return this._publisher.subscribe("clear", r);
|
|
1119
1122
|
}
|
|
1120
1123
|
[Symbol.toStringTag] = "MapView";
|
|
1121
|
-
},
|
|
1124
|
+
}, ue = class extends Set {
|
|
1122
1125
|
_publisher;
|
|
1123
1126
|
constructor(r) {
|
|
1124
|
-
if (super(), this._publisher = new
|
|
1127
|
+
if (super(), this._publisher = new I(), r) for (const e of r) super.add(e);
|
|
1125
1128
|
}
|
|
1126
1129
|
add(r) {
|
|
1127
1130
|
return super.add(r), this._publisher.publish("add", r), this;
|
|
@@ -1144,12 +1147,12 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1144
1147
|
return this._publisher.subscribe("clear", r);
|
|
1145
1148
|
}
|
|
1146
1149
|
[Symbol.toStringTag] = "SetView";
|
|
1147
|
-
},
|
|
1150
|
+
}, ce = class {
|
|
1148
1151
|
_preferPersistence;
|
|
1149
1152
|
_volatile;
|
|
1150
1153
|
_persistent;
|
|
1151
1154
|
constructor(r = !0) {
|
|
1152
|
-
if (!
|
|
1155
|
+
if (!j) throw new V("The `JSONStorage` class can only be instantiated within a browser environment.");
|
|
1153
1156
|
this._preferPersistence = r, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
1154
1157
|
}
|
|
1155
1158
|
_get(r, e, t) {
|
|
@@ -1213,9 +1216,9 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1213
1216
|
this._volatile.removeItem(r), this._persistent.removeItem(r);
|
|
1214
1217
|
}
|
|
1215
1218
|
[Symbol.toStringTag] = "JSONStorage";
|
|
1216
|
-
},
|
|
1219
|
+
}, b = class q {
|
|
1217
1220
|
static FromPromise(e) {
|
|
1218
|
-
return new
|
|
1221
|
+
return new q((t, n) => e.then(t, n));
|
|
1219
1222
|
}
|
|
1220
1223
|
_isPending;
|
|
1221
1224
|
get isPending() {
|
|
@@ -1247,7 +1250,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1247
1250
|
return this._promise.finally(e);
|
|
1248
1251
|
}
|
|
1249
1252
|
[Symbol.toStringTag] = "SmartPromise";
|
|
1250
|
-
},
|
|
1253
|
+
}, O = class extends b {
|
|
1251
1254
|
_resolve;
|
|
1252
1255
|
get resolve() {
|
|
1253
1256
|
return this._resolve;
|
|
@@ -1266,19 +1269,19 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1266
1269
|
return r.then(this.resolve, this.reject), this;
|
|
1267
1270
|
}
|
|
1268
1271
|
[Symbol.toStringTag] = "DeferredPromise";
|
|
1269
|
-
},
|
|
1272
|
+
}, K = class extends b {
|
|
1270
1273
|
constructor(r, e) {
|
|
1271
1274
|
super((t, n) => {
|
|
1272
|
-
const s = (
|
|
1273
|
-
clearTimeout(
|
|
1274
|
-
}, i = (
|
|
1275
|
-
clearTimeout(
|
|
1276
|
-
},
|
|
1275
|
+
const s = (a) => {
|
|
1276
|
+
clearTimeout(l), t(a);
|
|
1277
|
+
}, i = (a) => {
|
|
1278
|
+
clearTimeout(l), n(a);
|
|
1279
|
+
}, l = setTimeout(() => i(new J("The operation has timed out.")), e);
|
|
1277
1280
|
r(s, i);
|
|
1278
1281
|
});
|
|
1279
1282
|
}
|
|
1280
1283
|
[Symbol.toStringTag] = "TimedPromise";
|
|
1281
|
-
},
|
|
1284
|
+
}, he = class extends b {
|
|
1282
1285
|
_count;
|
|
1283
1286
|
get isPending() {
|
|
1284
1287
|
return this._count > 0;
|
|
@@ -1287,13 +1290,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1287
1290
|
return this._count === 0;
|
|
1288
1291
|
}
|
|
1289
1292
|
get isRejected() {
|
|
1290
|
-
throw new
|
|
1293
|
+
throw new c("`PromiseQueue` doesn't support rejection states.");
|
|
1291
1294
|
}
|
|
1292
1295
|
constructor() {
|
|
1293
1296
|
super((r) => r()), this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
|
|
1294
1297
|
}
|
|
1295
1298
|
enqueue(r, e) {
|
|
1296
|
-
if (this._count += 1, r instanceof
|
|
1299
|
+
if (this._count += 1, r instanceof O) {
|
|
1297
1300
|
const n = r;
|
|
1298
1301
|
r = () => (n.resolve(), n);
|
|
1299
1302
|
}
|
|
@@ -1304,38 +1307,38 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1304
1307
|
this._count -= 1, s(i);
|
|
1305
1308
|
});
|
|
1306
1309
|
};
|
|
1307
|
-
return e ? new
|
|
1310
|
+
return e ? new K(t, e) : new b(t);
|
|
1308
1311
|
}
|
|
1309
1312
|
[Symbol.toStringTag] = "PromiseQueue";
|
|
1310
|
-
},
|
|
1311
|
-
return r[r.Millisecond = 1] = "Millisecond", r[r.Second = 1e3] = "Second", r[r.Minute =
|
|
1312
|
-
})({}),
|
|
1313
|
+
}, y = /* @__PURE__ */ (function(r) {
|
|
1314
|
+
return r[r.Millisecond = 1] = "Millisecond", r[r.Second = 1e3] = "Second", r[r.Minute = 60 * r.Second] = "Minute", r[r.Hour = 60 * r.Minute] = "Hour", r[r.Day = 24 * r.Hour] = "Day", r[r.Week = 7 * r.Day] = "Week", r[r.Month = 30 * r.Day] = "Month", r[r.Year = 365 * r.Day] = "Year", r;
|
|
1315
|
+
})({}), Q = /* @__PURE__ */ (function(r) {
|
|
1313
1316
|
return r[r.Sunday = 0] = "Sunday", r[r.Monday = 1] = "Monday", r[r.Tuesday = 2] = "Tuesday", r[r.Wednesday = 3] = "Wednesday", r[r.Thursday = 4] = "Thursday", r[r.Friday = 5] = "Friday", r[r.Saturday = 6] = "Saturday", r;
|
|
1314
1317
|
})({});
|
|
1315
|
-
function
|
|
1318
|
+
function fe(r, e, t = y.Day) {
|
|
1316
1319
|
let n;
|
|
1317
1320
|
return r = new Date(r), e = new Date(e), r < e ? n = Math.floor : n = Math.ceil, n((e.getTime() - r.getTime()) / t);
|
|
1318
1321
|
}
|
|
1319
|
-
function
|
|
1320
|
-
if (r = new Date(r), e = new Date(e), r >= e) throw new
|
|
1321
|
-
return new
|
|
1322
|
+
function de(r, e, t = y.Day) {
|
|
1323
|
+
if (r = new Date(r), e = new Date(e), r >= e) throw new k("The end date must be greater than the start date.");
|
|
1324
|
+
return new h(function* () {
|
|
1322
1325
|
const n = e.getTime();
|
|
1323
1326
|
let s = r.getTime();
|
|
1324
1327
|
for (; s < n; )
|
|
1325
1328
|
yield new Date(s), s += t;
|
|
1326
1329
|
});
|
|
1327
1330
|
}
|
|
1328
|
-
function
|
|
1329
|
-
if (e <=
|
|
1330
|
-
if (e >
|
|
1331
|
+
function X(r, e = y.Day) {
|
|
1332
|
+
if (e <= y.Millisecond) throw new k("Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead.");
|
|
1333
|
+
if (e > y.Day) throw new k("Rounding by more than a day leads to unexpected results. Consider using other methods to round dates by weeks, months or years.");
|
|
1331
1334
|
return r = new Date(r), new Date(Math.floor(r.getTime() / e) * e);
|
|
1332
1335
|
}
|
|
1333
|
-
function
|
|
1336
|
+
function me(r, e = Q.Sunday) {
|
|
1334
1337
|
r = new Date(r);
|
|
1335
|
-
const t = 7 - e, n = (r.getUTCDay() + t) % 7, s = r.getTime() -
|
|
1336
|
-
return
|
|
1338
|
+
const t = 7 - e, n = (r.getUTCDay() + t) % 7, s = r.getTime() - y.Day * n;
|
|
1339
|
+
return X(new Date(s));
|
|
1337
1340
|
}
|
|
1338
|
-
var
|
|
1341
|
+
var $ = class {
|
|
1339
1342
|
_handle;
|
|
1340
1343
|
_startTime;
|
|
1341
1344
|
get startTime() {
|
|
@@ -1352,19 +1355,19 @@ var q = class {
|
|
|
1352
1355
|
_start;
|
|
1353
1356
|
_stop;
|
|
1354
1357
|
constructor(r, e = 40) {
|
|
1355
|
-
this._startTime = 0, this._isRunning = !1,
|
|
1358
|
+
this._startTime = 0, this._isRunning = !1, j ? (this._start = () => {
|
|
1356
1359
|
r(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
1357
1360
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`), this._start = () => {
|
|
1358
1361
|
this._handle = setInterval(() => r(this.elapsedTime), e);
|
|
1359
|
-
}, this._stop = () => clearInterval(this._handle)), this._publisher = new
|
|
1362
|
+
}, this._stop = () => clearInterval(this._handle)), this._publisher = new I();
|
|
1360
1363
|
}
|
|
1361
1364
|
start(r = 0) {
|
|
1362
|
-
if (this._isRunning) throw new
|
|
1365
|
+
if (this._isRunning) throw new w("The game loop has already been started.");
|
|
1363
1366
|
this._startTime = performance.now() - r, this._start(), this._isRunning = !0, this._publisher.publish("start");
|
|
1364
1367
|
}
|
|
1365
1368
|
stop() {
|
|
1366
|
-
if (!this._isRunning) throw new
|
|
1367
|
-
if (!this._handle) throw new
|
|
1369
|
+
if (!this._isRunning) throw new w("The game loop had already stopped or hadn't yet started.");
|
|
1370
|
+
if (!this._handle) throw new E();
|
|
1368
1371
|
this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
|
|
1369
1372
|
}
|
|
1370
1373
|
onStart(r) {
|
|
@@ -1374,21 +1377,21 @@ var q = class {
|
|
|
1374
1377
|
return this._publisher.subscribe("stop", r);
|
|
1375
1378
|
}
|
|
1376
1379
|
[Symbol.toStringTag] = "GameLoop";
|
|
1377
|
-
},
|
|
1378
|
-
constructor(r =
|
|
1380
|
+
}, we = class extends $ {
|
|
1381
|
+
constructor(r = y.Second) {
|
|
1379
1382
|
super((e) => this._publisher.publish("tick", e), r);
|
|
1380
1383
|
}
|
|
1381
1384
|
start(r = 0) {
|
|
1382
|
-
if (this._isRunning) throw new
|
|
1385
|
+
if (this._isRunning) throw new w("The clock has already been started.");
|
|
1383
1386
|
this._startTime = performance.now() - r, this._start(), this._isRunning = !0, this._publisher.publish("start");
|
|
1384
1387
|
}
|
|
1385
1388
|
stop() {
|
|
1386
|
-
if (!this._isRunning) throw new
|
|
1387
|
-
if (!this._handle) throw new
|
|
1389
|
+
if (!this._isRunning) throw new w("The clock had already stopped or hadn't yet started.");
|
|
1390
|
+
if (!this._handle) throw new E();
|
|
1388
1391
|
this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
|
|
1389
1392
|
}
|
|
1390
1393
|
onTick(r, e = 0) {
|
|
1391
|
-
if (e < 0) throw new
|
|
1394
|
+
if (e < 0) throw new k("The tick step must be a non-negative number.");
|
|
1392
1395
|
if (e === 0) return this._publisher.subscribe("tick", r);
|
|
1393
1396
|
let t = 0;
|
|
1394
1397
|
return this._publisher.subscribe("tick", (n) => {
|
|
@@ -1396,7 +1399,7 @@ var q = class {
|
|
|
1396
1399
|
});
|
|
1397
1400
|
}
|
|
1398
1401
|
[Symbol.toStringTag] = "Clock";
|
|
1399
|
-
},
|
|
1402
|
+
}, pe = class extends $ {
|
|
1400
1403
|
_duration;
|
|
1401
1404
|
get duration() {
|
|
1402
1405
|
return this._duration;
|
|
@@ -1405,7 +1408,7 @@ var q = class {
|
|
|
1405
1408
|
return this._duration - this.elapsedTime;
|
|
1406
1409
|
}
|
|
1407
1410
|
_deferrer;
|
|
1408
|
-
constructor(r, e =
|
|
1411
|
+
constructor(r, e = y.Second) {
|
|
1409
1412
|
const t = () => {
|
|
1410
1413
|
const n = this.remainingTime;
|
|
1411
1414
|
n <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", n);
|
|
@@ -1413,20 +1416,20 @@ var q = class {
|
|
|
1413
1416
|
super(t, e), this._duration = r;
|
|
1414
1417
|
}
|
|
1415
1418
|
_deferrerStop(r) {
|
|
1416
|
-
if (!this._isRunning) throw new
|
|
1417
|
-
if (!this._deferrer) throw new
|
|
1419
|
+
if (!this._isRunning) throw new w("The countdown hadn't yet started.");
|
|
1420
|
+
if (!this._deferrer) throw new E();
|
|
1418
1421
|
this._stop(), this._handle = void 0, this._isRunning = !1, r !== void 0 ? this._deferrer.reject(r) : this._deferrer.resolve(), this._deferrer = void 0;
|
|
1419
1422
|
}
|
|
1420
1423
|
start(r = this.duration) {
|
|
1421
|
-
if (this._isRunning) throw new
|
|
1422
|
-
if (this._deferrer) throw new
|
|
1423
|
-
return this._deferrer = new
|
|
1424
|
+
if (this._isRunning) throw new w("The countdown had already stopped or hadn't yet started.");
|
|
1425
|
+
if (this._deferrer) throw new E();
|
|
1426
|
+
return this._deferrer = new O(), super.start(this.duration - r), this._publisher.publish("start"), this._deferrer;
|
|
1424
1427
|
}
|
|
1425
1428
|
stop(r) {
|
|
1426
1429
|
this._deferrerStop(r), this._publisher.publish("stop", r);
|
|
1427
1430
|
}
|
|
1428
1431
|
onTick(r, e = 0) {
|
|
1429
|
-
if (e < 0) throw new
|
|
1432
|
+
if (e < 0) throw new k("The tick step must be a non-negative number.");
|
|
1430
1433
|
if (e === 0) return this._publisher.subscribe("tick", r);
|
|
1431
1434
|
let t = this.remainingTime;
|
|
1432
1435
|
return this._publisher.subscribe("tick", (n) => {
|
|
@@ -1437,144 +1440,199 @@ var q = class {
|
|
|
1437
1440
|
return this._publisher.subscribe("expire", r);
|
|
1438
1441
|
}
|
|
1439
1442
|
[Symbol.toStringTag] = "Countdown";
|
|
1440
|
-
},
|
|
1443
|
+
}, _e = class {
|
|
1441
1444
|
static Linear(r) {
|
|
1442
1445
|
const e = r - 1;
|
|
1443
|
-
return new
|
|
1446
|
+
return new h(function* () {
|
|
1444
1447
|
for (let t = 0; t < r; t += 1) yield t / e;
|
|
1445
1448
|
});
|
|
1446
1449
|
}
|
|
1447
1450
|
static Exponential(r, e = 2) {
|
|
1448
|
-
if (e < 0) throw new
|
|
1451
|
+
if (e < 0) throw new c("The base of the exponential curve cannot be negative.");
|
|
1449
1452
|
const t = r - 1;
|
|
1450
|
-
return new
|
|
1453
|
+
return new h(function* () {
|
|
1451
1454
|
for (let n = 0; n < r; n += 1) yield Math.pow(n / t, e);
|
|
1452
1455
|
});
|
|
1453
1456
|
}
|
|
1454
1457
|
constructor() {
|
|
1455
1458
|
}
|
|
1456
1459
|
[Symbol.toStringTag] = "Curve";
|
|
1457
|
-
},
|
|
1458
|
-
static
|
|
1459
|
-
|
|
1460
|
+
}, ye = class u {
|
|
1461
|
+
static #t(e) {
|
|
1462
|
+
let t = e | 0;
|
|
1463
|
+
return () => {
|
|
1464
|
+
t = t + 1831565813 | 0;
|
|
1465
|
+
let n = t;
|
|
1466
|
+
return n = Math.imul(n ^ n >>> 15, n | 1), n ^= n + Math.imul(n ^ n >>> 7, n | 61), ((n ^ n >>> 14) >>> 0) / 4294967296;
|
|
1467
|
+
};
|
|
1460
1468
|
}
|
|
1461
|
-
static
|
|
1462
|
-
return
|
|
1469
|
+
static _Boolean(e, t) {
|
|
1470
|
+
return e() < t;
|
|
1463
1471
|
}
|
|
1464
|
-
static
|
|
1465
|
-
return
|
|
1472
|
+
static _Integer(e, t, n) {
|
|
1473
|
+
return Math.floor(n === void 0 ? e() * t : e() * (n - t) + t);
|
|
1466
1474
|
}
|
|
1467
|
-
static
|
|
1468
|
-
|
|
1469
|
-
return this.Integer(e.length);
|
|
1475
|
+
static _Decimal(e, t, n) {
|
|
1476
|
+
return t === void 0 ? e() : n === void 0 ? e() * t : e() * (n - t) + t;
|
|
1470
1477
|
}
|
|
1471
|
-
static
|
|
1472
|
-
|
|
1478
|
+
static _Index(e, t) {
|
|
1479
|
+
if (t.length === 0) throw new c("You must provide at least one element.");
|
|
1480
|
+
return u._Integer(e, t.length);
|
|
1473
1481
|
}
|
|
1474
|
-
static
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
if (
|
|
1480
|
-
if (n
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1482
|
+
static _Choice(e, t) {
|
|
1483
|
+
return t[u._Index(e, t)];
|
|
1484
|
+
}
|
|
1485
|
+
static _Sample(e, t, n, s) {
|
|
1486
|
+
const i = t.length;
|
|
1487
|
+
if (i === 0) throw new c("You must provide at least one element.");
|
|
1488
|
+
if (n < 0) throw new c("Count must be non-negative.");
|
|
1489
|
+
if (n > i) throw new c("Count cannot exceed the number of elements.");
|
|
1490
|
+
if (n === 0) return [];
|
|
1491
|
+
if (s === void 0) {
|
|
1492
|
+
const a = Array.from(t), f = new Array(n);
|
|
1493
|
+
for (let T = 0; T < n; T += 1) {
|
|
1494
|
+
const C = u._Integer(e, T, i);
|
|
1495
|
+
f[T] = a[C], a[C] = a[T];
|
|
1485
1496
|
}
|
|
1486
|
-
return
|
|
1497
|
+
return f;
|
|
1487
1498
|
}
|
|
1488
|
-
if (
|
|
1489
|
-
const
|
|
1490
|
-
for (let a = 0; a <
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
1499
|
+
if (s.length !== i) throw new c("Weights array must have the same length as elements array.");
|
|
1500
|
+
const o = new Array(i);
|
|
1501
|
+
for (let a = 0; a < i; a += 1) {
|
|
1502
|
+
if (s[a] <= 0) throw new c(`Weight for element #${a} must be greater than zero.`);
|
|
1503
|
+
o[a] = {
|
|
1493
1504
|
index: a,
|
|
1494
|
-
key: Math.pow(
|
|
1505
|
+
key: Math.pow(e(), 1 / s[a])
|
|
1495
1506
|
};
|
|
1496
1507
|
}
|
|
1497
|
-
|
|
1498
|
-
const
|
|
1499
|
-
for (let a = 0; a <
|
|
1500
|
-
return
|
|
1501
|
-
}
|
|
1502
|
-
static #e(e, t) {
|
|
1503
|
-
const
|
|
1504
|
-
for (let a = 0; a <
|
|
1505
|
-
|
|
1506
|
-
const
|
|
1508
|
+
o.sort((a, f) => f.key - a.key);
|
|
1509
|
+
const l = new Array(n);
|
|
1510
|
+
for (let a = 0; a < n; a += 1) l[a] = t[o[a].index];
|
|
1511
|
+
return l;
|
|
1512
|
+
}
|
|
1513
|
+
static #e(e, t, n) {
|
|
1514
|
+
const s = new Array(n - 1);
|
|
1515
|
+
for (let a = 0; a < s.length; a += 1) s[a] = e() * t;
|
|
1516
|
+
s.sort((a, f) => a - f);
|
|
1517
|
+
const i = [
|
|
1507
1518
|
0,
|
|
1508
|
-
...
|
|
1509
|
-
|
|
1510
|
-
],
|
|
1511
|
-
for (let a = 0; a <
|
|
1512
|
-
let
|
|
1513
|
-
for (;
|
|
1514
|
-
|
|
1515
|
-
return
|
|
1519
|
+
...s,
|
|
1520
|
+
t
|
|
1521
|
+
], o = new Array(n);
|
|
1522
|
+
for (let a = 0; a < n; a += 1) o[a] = Math.floor(i[a + 1] - i[a]);
|
|
1523
|
+
let l = t - o.reduce((a, f) => a + f, 0);
|
|
1524
|
+
for (; l > 0; )
|
|
1525
|
+
o[u._Integer(e, n)] += 1, l -= 1;
|
|
1526
|
+
return o;
|
|
1516
1527
|
}
|
|
1517
|
-
static
|
|
1518
|
-
if (
|
|
1519
|
-
if (typeof
|
|
1520
|
-
if (
|
|
1521
|
-
return
|
|
1528
|
+
static _Split(e, t, n) {
|
|
1529
|
+
if (n < 1) throw new c("The number of splits must be greater than zero.");
|
|
1530
|
+
if (typeof t == "number") {
|
|
1531
|
+
if (t < 0) throw new c("The total must be a non-negative number.");
|
|
1532
|
+
return u.#e(e, t, n);
|
|
1522
1533
|
}
|
|
1523
|
-
const
|
|
1524
|
-
if (
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1534
|
+
const s = Array.from(t), i = s.length;
|
|
1535
|
+
if (i === 0) throw new c("You must provide at least one element.");
|
|
1536
|
+
if (n > i) throw new c("The number of splits cannot exceed the number of elements.");
|
|
1537
|
+
const o = u.#e(e, i, n), l = new Array(n);
|
|
1527
1538
|
let a = 0;
|
|
1528
|
-
for (let
|
|
1529
|
-
|
|
1530
|
-
return
|
|
1539
|
+
for (let f = 0; f < n; f += 1)
|
|
1540
|
+
l[f] = s.slice(a, a + o[f]), a += o[f];
|
|
1541
|
+
return l;
|
|
1531
1542
|
}
|
|
1532
|
-
|
|
1543
|
+
static Boolean(e = 0.5) {
|
|
1544
|
+
return u._Boolean(Math.random, e);
|
|
1545
|
+
}
|
|
1546
|
+
static Integer(e, t) {
|
|
1547
|
+
return u._Integer(Math.random, e, t);
|
|
1548
|
+
}
|
|
1549
|
+
static Decimal(e, t) {
|
|
1550
|
+
return u._Decimal(Math.random, e, t);
|
|
1551
|
+
}
|
|
1552
|
+
static Index(e) {
|
|
1553
|
+
return u._Index(Math.random, e);
|
|
1554
|
+
}
|
|
1555
|
+
static Choice(e) {
|
|
1556
|
+
return u._Choice(Math.random, e);
|
|
1557
|
+
}
|
|
1558
|
+
static Sample(e, t, n) {
|
|
1559
|
+
return u._Sample(Math.random, e, t, n);
|
|
1560
|
+
}
|
|
1561
|
+
static Split(e, t) {
|
|
1562
|
+
return u._Split(Math.random, e, t);
|
|
1563
|
+
}
|
|
1564
|
+
static FromSeed(e) {
|
|
1565
|
+
return new u(e);
|
|
1566
|
+
}
|
|
1567
|
+
_next;
|
|
1568
|
+
constructor(e) {
|
|
1569
|
+
this._next = u.#t(e);
|
|
1570
|
+
}
|
|
1571
|
+
boolean(e = 0.5) {
|
|
1572
|
+
return u._Boolean(this._next, e);
|
|
1573
|
+
}
|
|
1574
|
+
integer(e, t) {
|
|
1575
|
+
return u._Integer(this._next, e, t);
|
|
1576
|
+
}
|
|
1577
|
+
decimal(e, t) {
|
|
1578
|
+
return u._Decimal(this._next, e, t);
|
|
1579
|
+
}
|
|
1580
|
+
index(e) {
|
|
1581
|
+
return u._Index(this._next, e);
|
|
1582
|
+
}
|
|
1583
|
+
choice(e) {
|
|
1584
|
+
return u._Choice(this._next, e);
|
|
1585
|
+
}
|
|
1586
|
+
sample(e, t, n) {
|
|
1587
|
+
return u._Sample(this._next, e, t, n);
|
|
1588
|
+
}
|
|
1589
|
+
split(e, t) {
|
|
1590
|
+
return u._Split(this._next, e, t);
|
|
1533
1591
|
}
|
|
1534
1592
|
[Symbol.toStringTag] = "Random";
|
|
1535
1593
|
};
|
|
1536
|
-
function
|
|
1537
|
-
return new
|
|
1594
|
+
function be(r) {
|
|
1595
|
+
return new b((e) => setTimeout(e, r));
|
|
1538
1596
|
}
|
|
1539
|
-
function
|
|
1540
|
-
return new
|
|
1597
|
+
function ge() {
|
|
1598
|
+
return new b((r) => requestAnimationFrame(() => r()));
|
|
1541
1599
|
}
|
|
1542
|
-
function
|
|
1543
|
-
return new
|
|
1600
|
+
function xe() {
|
|
1601
|
+
return new b((r) => setTimeout(r));
|
|
1544
1602
|
}
|
|
1545
|
-
function
|
|
1546
|
-
return new
|
|
1603
|
+
function ve(r, e = "text/javascript") {
|
|
1604
|
+
return new b((t, n) => {
|
|
1547
1605
|
const s = document.createElement("script");
|
|
1548
1606
|
s.async = !0, s.defer = !0, s.src = r, s.type = e, s.onload = (i) => t(), s.onerror = (i) => n(i), document.body.appendChild(s);
|
|
1549
1607
|
});
|
|
1550
1608
|
}
|
|
1551
|
-
function
|
|
1552
|
-
return new
|
|
1609
|
+
function Se(...r) {
|
|
1610
|
+
return new h(function* () {
|
|
1553
1611
|
for (const e of r) for (const t of e) yield t;
|
|
1554
1612
|
});
|
|
1555
1613
|
}
|
|
1556
|
-
function
|
|
1614
|
+
function ke(r) {
|
|
1557
1615
|
if (r instanceof Array) return r.length;
|
|
1558
1616
|
let e = 0;
|
|
1559
1617
|
for (const t of r) e += 1;
|
|
1560
1618
|
return e;
|
|
1561
1619
|
}
|
|
1562
|
-
function
|
|
1563
|
-
return new
|
|
1620
|
+
function Te(r) {
|
|
1621
|
+
return new h(function* () {
|
|
1564
1622
|
let e = 0;
|
|
1565
1623
|
for (const t of r)
|
|
1566
1624
|
yield [e, t], e += 1;
|
|
1567
1625
|
});
|
|
1568
1626
|
}
|
|
1569
|
-
function
|
|
1570
|
-
if (t <= 0) throw new
|
|
1571
|
-
return e === void 0 && (e = r, r = 0), r > e ? new
|
|
1627
|
+
function Ee(r, e, t = 1) {
|
|
1628
|
+
if (t <= 0) throw new k("Step must be always a positive number, even when generating numbers in reverse order.");
|
|
1629
|
+
return e === void 0 && (e = r, r = 0), r > e ? new h(function* () {
|
|
1572
1630
|
for (let n = r; n > e; n -= t) yield n;
|
|
1573
|
-
}) : new
|
|
1631
|
+
}) : new h(function* () {
|
|
1574
1632
|
for (let n = r; n < e; n += t) yield n;
|
|
1575
1633
|
});
|
|
1576
1634
|
}
|
|
1577
|
-
function
|
|
1635
|
+
function Me(r) {
|
|
1578
1636
|
const e = Array.from(r);
|
|
1579
1637
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
1580
1638
|
const n = Math.floor(Math.random() * (t + 1));
|
|
@@ -1582,16 +1640,16 @@ function Te(r) {
|
|
|
1582
1640
|
}
|
|
1583
1641
|
return e;
|
|
1584
1642
|
}
|
|
1585
|
-
function
|
|
1586
|
-
return new
|
|
1643
|
+
function Ie(r) {
|
|
1644
|
+
return new h(function* () {
|
|
1587
1645
|
const e = /* @__PURE__ */ new Set();
|
|
1588
1646
|
for (const t of r)
|
|
1589
1647
|
e.has(t) || (e.add(t), yield t);
|
|
1590
1648
|
});
|
|
1591
1649
|
}
|
|
1592
|
-
function
|
|
1650
|
+
function Z(r, e) {
|
|
1593
1651
|
const t = r[Symbol.iterator](), n = e[Symbol.iterator]();
|
|
1594
|
-
return new
|
|
1652
|
+
return new h(function* () {
|
|
1595
1653
|
for (; ; ) {
|
|
1596
1654
|
const s = t.next(), i = n.next();
|
|
1597
1655
|
if (s.done || i.done) break;
|
|
@@ -1599,28 +1657,28 @@ function H(r, e) {
|
|
|
1599
1657
|
}
|
|
1600
1658
|
});
|
|
1601
1659
|
}
|
|
1602
|
-
function
|
|
1660
|
+
function Ae(r, e) {
|
|
1603
1661
|
if (e === void 0) {
|
|
1604
1662
|
let i = 0, o = 0;
|
|
1605
|
-
for (const
|
|
1606
|
-
i +=
|
|
1607
|
-
if (o === 0) throw new
|
|
1663
|
+
for (const l of r)
|
|
1664
|
+
i += l, o += 1;
|
|
1665
|
+
if (o === 0) throw new c("You must provide at least one value.");
|
|
1608
1666
|
return i / o;
|
|
1609
1667
|
}
|
|
1610
1668
|
let t = 0, n = 0, s = 0;
|
|
1611
|
-
for (const [i, o] of
|
|
1612
|
-
if (o <= 0) throw new
|
|
1669
|
+
for (const [i, o] of Z(r, e)) {
|
|
1670
|
+
if (o <= 0) throw new c(`The weight for the value #${s} must be greater than zero.`);
|
|
1613
1671
|
t += i * o, n += o, s += 1;
|
|
1614
1672
|
}
|
|
1615
|
-
if (s === 0) throw new
|
|
1616
|
-
if (n <= 0) throw new
|
|
1673
|
+
if (s === 0) throw new c("You must provide at least one value and weight.");
|
|
1674
|
+
if (n <= 0) throw new c("The sum of weights must be greater than zero.");
|
|
1617
1675
|
return t / n;
|
|
1618
1676
|
}
|
|
1619
|
-
function
|
|
1620
|
-
if (e > t) throw new
|
|
1677
|
+
function Re(r, e, t) {
|
|
1678
|
+
if (e > t) throw new c("The minimum bound must be less than or equal to the maximum bound.");
|
|
1621
1679
|
return r < e ? e : r > t ? t : r;
|
|
1622
1680
|
}
|
|
1623
|
-
function
|
|
1681
|
+
function Fe(r) {
|
|
1624
1682
|
let e = 0;
|
|
1625
1683
|
for (let t = 0; t < r.length; t += 1) {
|
|
1626
1684
|
const n = r.charCodeAt(t);
|
|
@@ -1628,81 +1686,81 @@ function Re(r) {
|
|
|
1628
1686
|
}
|
|
1629
1687
|
return e;
|
|
1630
1688
|
}
|
|
1631
|
-
function
|
|
1689
|
+
function Ce(r) {
|
|
1632
1690
|
let e = 0;
|
|
1633
1691
|
for (const t of r) e += t;
|
|
1634
1692
|
return e;
|
|
1635
1693
|
}
|
|
1636
|
-
function
|
|
1694
|
+
function Pe(r) {
|
|
1637
1695
|
return `${r.charAt(0).toUpperCase()}${r.slice(1)}`;
|
|
1638
1696
|
}
|
|
1639
|
-
var
|
|
1697
|
+
var je = "2.2.8";
|
|
1640
1698
|
export {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1699
|
+
L as AggregatedAsyncIterator,
|
|
1700
|
+
F as AggregatedIterator,
|
|
1701
|
+
ae as ArrayView,
|
|
1702
|
+
z as CallableObject,
|
|
1703
|
+
ie as CallbackChain,
|
|
1704
|
+
we as Clock,
|
|
1705
|
+
pe as Countdown,
|
|
1706
|
+
_e as Curve,
|
|
1707
|
+
O as DeferredPromise,
|
|
1708
|
+
V as EnvironmentException,
|
|
1709
|
+
m as Exception,
|
|
1710
|
+
E as FatalErrorException,
|
|
1711
|
+
D as FileException,
|
|
1712
|
+
ee as FileExistsException,
|
|
1713
|
+
te as FileNotFoundException,
|
|
1714
|
+
$ as GameLoop,
|
|
1715
|
+
ce as JSONStorage,
|
|
1716
|
+
g as KeyException,
|
|
1717
|
+
le as MapView,
|
|
1718
|
+
Y as NetworkException,
|
|
1719
|
+
B as NotImplementedException,
|
|
1720
|
+
re as PermissionException,
|
|
1721
|
+
he as PromiseQueue,
|
|
1722
|
+
I as Publisher,
|
|
1723
|
+
ye as Random,
|
|
1724
|
+
k as RangeException,
|
|
1725
|
+
d as ReducedIterator,
|
|
1726
|
+
A as ReferenceException,
|
|
1727
|
+
ne as ResponseException,
|
|
1728
|
+
w as RuntimeException,
|
|
1729
|
+
ue as SetView,
|
|
1730
|
+
R as SmartAsyncIterator,
|
|
1731
|
+
h as SmartIterator,
|
|
1732
|
+
b as SmartPromise,
|
|
1733
|
+
oe as SwitchableCallback,
|
|
1734
|
+
y as TimeUnit,
|
|
1735
|
+
K as TimedPromise,
|
|
1736
|
+
J as TimeoutException,
|
|
1737
|
+
se as TypeException,
|
|
1738
|
+
je as VERSION,
|
|
1739
|
+
c as ValueException,
|
|
1740
|
+
Q as WeekDay,
|
|
1741
|
+
Ae as average,
|
|
1742
|
+
Pe as capitalize,
|
|
1743
|
+
Se as chain,
|
|
1744
|
+
Re as clamp,
|
|
1745
|
+
ke as count,
|
|
1746
|
+
fe as dateDifference,
|
|
1747
|
+
de as dateRange,
|
|
1748
|
+
X as dateRound,
|
|
1749
|
+
be as delay,
|
|
1750
|
+
Te as enumerate,
|
|
1751
|
+
me as getWeek,
|
|
1752
|
+
Fe as hash,
|
|
1753
|
+
j as isBrowser,
|
|
1754
|
+
W as isNode,
|
|
1755
|
+
U as isWorker,
|
|
1756
|
+
ve as loadScript,
|
|
1757
|
+
ge as nextAnimationFrame,
|
|
1758
|
+
Ee as range,
|
|
1759
|
+
Me as shuffle,
|
|
1760
|
+
Ce as sum,
|
|
1761
|
+
Ie as unique,
|
|
1762
|
+
xe as yieldToEventLoop,
|
|
1763
|
+
Z as zip
|
|
1706
1764
|
};
|
|
1707
1765
|
|
|
1708
1766
|
//# sourceMappingURL=core.esm.js.map
|