@byloth/core 2.2.6 → 2.2.7
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 +382 -327
- 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/utils/random.ts +623 -140
package/dist/core.esm.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P = typeof window < "u" && typeof window.document < "u", Z = typeof process < "u" && !!process.versions?.node, W = 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
|
+
}, $ = 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
|
+
}, j = 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
|
+
}, U = class extends j {
|
|
30
30
|
constructor(r, e, t = "FileExistsException") {
|
|
31
31
|
super(r, e, t);
|
|
32
32
|
}
|
|
33
33
|
[Symbol.toStringTag] = "FileExistsException";
|
|
34
|
-
},
|
|
34
|
+
}, ee = class extends j {
|
|
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
|
+
}, B = 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
|
+
}, te = class extends B {
|
|
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
|
+
}, ne = 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
|
-
}, Y = class extends
|
|
70
|
+
}, Y = 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
|
+
}, V = 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
|
+
}, re = 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
|
+
}, J = 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 J(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
|
+
}, L = Function, D = class extends L {
|
|
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
|
+
}, se = class extends D {
|
|
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 z {
|
|
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 z();
|
|
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,8 @@ 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
|
+
}, G = () => {
|
|
1001
|
+
}, ie = class extends D {
|
|
1002
1002
|
_callback;
|
|
1003
1003
|
_callbacks;
|
|
1004
1004
|
_isEnabled;
|
|
@@ -1012,43 +1012,43 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1012
1012
|
_invoke;
|
|
1013
1013
|
constructor(r, e = "default") {
|
|
1014
1014
|
super(), this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, r ? this._callbacks.set(e, r) : (e = "", r = (() => {
|
|
1015
|
-
throw new
|
|
1015
|
+
throw new $("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?");
|
|
1016
1016
|
})), 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 = G, 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
1047
|
[Symbol.toStringTag] = "SwitchableCallback";
|
|
1048
|
-
},
|
|
1048
|
+
}, oe = class extends Array {
|
|
1049
1049
|
_publisher;
|
|
1050
1050
|
constructor(...r) {
|
|
1051
|
-
super(...r), this._publisher = new
|
|
1051
|
+
super(...r), this._publisher = new I();
|
|
1052
1052
|
}
|
|
1053
1053
|
push(...r) {
|
|
1054
1054
|
const e = this.length, t = super.push(...r);
|
|
@@ -1092,10 +1092,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1092
1092
|
}
|
|
1093
1093
|
[Symbol.toStringTag] = "ArrayView";
|
|
1094
1094
|
static [Symbol.species] = Array;
|
|
1095
|
-
},
|
|
1095
|
+
}, ae = class extends Map {
|
|
1096
1096
|
_publisher;
|
|
1097
1097
|
constructor(r) {
|
|
1098
|
-
if (super(), this._publisher = new
|
|
1098
|
+
if (super(), this._publisher = new I(), r) for (const [e, t] of r) super.set(e, t);
|
|
1099
1099
|
}
|
|
1100
1100
|
set(r, e) {
|
|
1101
1101
|
return super.set(r, e), this._publisher.publish("add", r, e), this;
|
|
@@ -1118,10 +1118,10 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1118
1118
|
return this._publisher.subscribe("clear", r);
|
|
1119
1119
|
}
|
|
1120
1120
|
[Symbol.toStringTag] = "MapView";
|
|
1121
|
-
},
|
|
1121
|
+
}, le = class extends Set {
|
|
1122
1122
|
_publisher;
|
|
1123
1123
|
constructor(r) {
|
|
1124
|
-
if (super(), this._publisher = new
|
|
1124
|
+
if (super(), this._publisher = new I(), r) for (const e of r) super.add(e);
|
|
1125
1125
|
}
|
|
1126
1126
|
add(r) {
|
|
1127
1127
|
return super.add(r), this._publisher.publish("add", r), this;
|
|
@@ -1144,12 +1144,12 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1144
1144
|
return this._publisher.subscribe("clear", r);
|
|
1145
1145
|
}
|
|
1146
1146
|
[Symbol.toStringTag] = "SetView";
|
|
1147
|
-
},
|
|
1147
|
+
}, ue = class {
|
|
1148
1148
|
_preferPersistence;
|
|
1149
1149
|
_volatile;
|
|
1150
1150
|
_persistent;
|
|
1151
1151
|
constructor(r = !0) {
|
|
1152
|
-
if (!
|
|
1152
|
+
if (!P) throw new Y("The `JSONStorage` class can only be instantiated within a browser environment.");
|
|
1153
1153
|
this._preferPersistence = r, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
1154
1154
|
}
|
|
1155
1155
|
_get(r, e, t) {
|
|
@@ -1213,9 +1213,9 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1213
1213
|
this._volatile.removeItem(r), this._persistent.removeItem(r);
|
|
1214
1214
|
}
|
|
1215
1215
|
[Symbol.toStringTag] = "JSONStorage";
|
|
1216
|
-
},
|
|
1216
|
+
}, b = class N {
|
|
1217
1217
|
static FromPromise(e) {
|
|
1218
|
-
return new
|
|
1218
|
+
return new N((t, n) => e.then(t, n));
|
|
1219
1219
|
}
|
|
1220
1220
|
_isPending;
|
|
1221
1221
|
get isPending() {
|
|
@@ -1247,7 +1247,7 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1247
1247
|
return this._promise.finally(e);
|
|
1248
1248
|
}
|
|
1249
1249
|
[Symbol.toStringTag] = "SmartPromise";
|
|
1250
|
-
},
|
|
1250
|
+
}, q = class extends b {
|
|
1251
1251
|
_resolve;
|
|
1252
1252
|
get resolve() {
|
|
1253
1253
|
return this._resolve;
|
|
@@ -1266,19 +1266,19 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1266
1266
|
return r.then(this.resolve, this.reject), this;
|
|
1267
1267
|
}
|
|
1268
1268
|
[Symbol.toStringTag] = "DeferredPromise";
|
|
1269
|
-
},
|
|
1269
|
+
}, H = class extends b {
|
|
1270
1270
|
constructor(r, e) {
|
|
1271
1271
|
super((t, n) => {
|
|
1272
|
-
const s = (
|
|
1273
|
-
clearTimeout(
|
|
1274
|
-
}, i = (
|
|
1275
|
-
clearTimeout(
|
|
1276
|
-
},
|
|
1272
|
+
const s = (a) => {
|
|
1273
|
+
clearTimeout(l), t(a);
|
|
1274
|
+
}, i = (a) => {
|
|
1275
|
+
clearTimeout(l), n(a);
|
|
1276
|
+
}, l = setTimeout(() => i(new V("The operation has timed out.")), e);
|
|
1277
1277
|
r(s, i);
|
|
1278
1278
|
});
|
|
1279
1279
|
}
|
|
1280
1280
|
[Symbol.toStringTag] = "TimedPromise";
|
|
1281
|
-
},
|
|
1281
|
+
}, ce = class extends b {
|
|
1282
1282
|
_count;
|
|
1283
1283
|
get isPending() {
|
|
1284
1284
|
return this._count > 0;
|
|
@@ -1287,13 +1287,13 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1287
1287
|
return this._count === 0;
|
|
1288
1288
|
}
|
|
1289
1289
|
get isRejected() {
|
|
1290
|
-
throw new
|
|
1290
|
+
throw new c("`PromiseQueue` doesn't support rejection states.");
|
|
1291
1291
|
}
|
|
1292
1292
|
constructor() {
|
|
1293
1293
|
super((r) => r()), this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
|
|
1294
1294
|
}
|
|
1295
1295
|
enqueue(r, e) {
|
|
1296
|
-
if (this._count += 1, r instanceof
|
|
1296
|
+
if (this._count += 1, r instanceof q) {
|
|
1297
1297
|
const n = r;
|
|
1298
1298
|
r = () => (n.resolve(), n);
|
|
1299
1299
|
}
|
|
@@ -1304,38 +1304,38 @@ var F = typeof window < "u" && typeof window.document < "u", X = typeof process
|
|
|
1304
1304
|
this._count -= 1, s(i);
|
|
1305
1305
|
});
|
|
1306
1306
|
};
|
|
1307
|
-
return e ? new
|
|
1307
|
+
return e ? new H(t, e) : new b(t);
|
|
1308
1308
|
}
|
|
1309
1309
|
[Symbol.toStringTag] = "PromiseQueue";
|
|
1310
|
-
},
|
|
1311
|
-
return r[r.Millisecond = 1] = "Millisecond", r[r.Second = 1e3] = "Second", r[r.Minute =
|
|
1310
|
+
}, y = /* @__PURE__ */ (function(r) {
|
|
1311
|
+
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;
|
|
1312
1312
|
})({}), K = /* @__PURE__ */ (function(r) {
|
|
1313
1313
|
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
1314
|
})({});
|
|
1315
|
-
function
|
|
1315
|
+
function he(r, e, t = y.Day) {
|
|
1316
1316
|
let n;
|
|
1317
1317
|
return r = new Date(r), e = new Date(e), r < e ? n = Math.floor : n = Math.ceil, n((e.getTime() - r.getTime()) / t);
|
|
1318
1318
|
}
|
|
1319
|
-
function
|
|
1320
|
-
if (r = new Date(r), e = new Date(e), r >= e) throw new
|
|
1321
|
-
return new
|
|
1319
|
+
function fe(r, e, t = y.Day) {
|
|
1320
|
+
if (r = new Date(r), e = new Date(e), r >= e) throw new k("The end date must be greater than the start date.");
|
|
1321
|
+
return new h(function* () {
|
|
1322
1322
|
const n = e.getTime();
|
|
1323
1323
|
let s = r.getTime();
|
|
1324
1324
|
for (; s < n; )
|
|
1325
1325
|
yield new Date(s), s += t;
|
|
1326
1326
|
});
|
|
1327
1327
|
}
|
|
1328
|
-
function Q(r, e =
|
|
1329
|
-
if (e <=
|
|
1330
|
-
if (e >
|
|
1328
|
+
function Q(r, e = y.Day) {
|
|
1329
|
+
if (e <= y.Millisecond) throw new k("Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead.");
|
|
1330
|
+
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
1331
|
return r = new Date(r), new Date(Math.floor(r.getTime() / e) * e);
|
|
1332
1332
|
}
|
|
1333
|
-
function
|
|
1333
|
+
function de(r, e = K.Sunday) {
|
|
1334
1334
|
r = new Date(r);
|
|
1335
|
-
const t = 7 - e, n = (r.getUTCDay() + t) % 7, s = r.getTime() -
|
|
1335
|
+
const t = 7 - e, n = (r.getUTCDay() + t) % 7, s = r.getTime() - y.Day * n;
|
|
1336
1336
|
return Q(new Date(s));
|
|
1337
1337
|
}
|
|
1338
|
-
var
|
|
1338
|
+
var O = class {
|
|
1339
1339
|
_handle;
|
|
1340
1340
|
_startTime;
|
|
1341
1341
|
get startTime() {
|
|
@@ -1352,19 +1352,19 @@ var q = class {
|
|
|
1352
1352
|
_start;
|
|
1353
1353
|
_stop;
|
|
1354
1354
|
constructor(r, e = 40) {
|
|
1355
|
-
this._startTime = 0, this._isRunning = !1,
|
|
1355
|
+
this._startTime = 0, this._isRunning = !1, P ? (this._start = () => {
|
|
1356
1356
|
r(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
1357
1357
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`), this._start = () => {
|
|
1358
1358
|
this._handle = setInterval(() => r(this.elapsedTime), e);
|
|
1359
|
-
}, this._stop = () => clearInterval(this._handle)), this._publisher = new
|
|
1359
|
+
}, this._stop = () => clearInterval(this._handle)), this._publisher = new I();
|
|
1360
1360
|
}
|
|
1361
1361
|
start(r = 0) {
|
|
1362
|
-
if (this._isRunning) throw new
|
|
1362
|
+
if (this._isRunning) throw new w("The game loop has already been started.");
|
|
1363
1363
|
this._startTime = performance.now() - r, this._start(), this._isRunning = !0, this._publisher.publish("start");
|
|
1364
1364
|
}
|
|
1365
1365
|
stop() {
|
|
1366
|
-
if (!this._isRunning) throw new
|
|
1367
|
-
if (!this._handle) throw new
|
|
1366
|
+
if (!this._isRunning) throw new w("The game loop had already stopped or hadn't yet started.");
|
|
1367
|
+
if (!this._handle) throw new E();
|
|
1368
1368
|
this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
|
|
1369
1369
|
}
|
|
1370
1370
|
onStart(r) {
|
|
@@ -1374,21 +1374,21 @@ var q = class {
|
|
|
1374
1374
|
return this._publisher.subscribe("stop", r);
|
|
1375
1375
|
}
|
|
1376
1376
|
[Symbol.toStringTag] = "GameLoop";
|
|
1377
|
-
},
|
|
1378
|
-
constructor(r =
|
|
1377
|
+
}, me = class extends O {
|
|
1378
|
+
constructor(r = y.Second) {
|
|
1379
1379
|
super((e) => this._publisher.publish("tick", e), r);
|
|
1380
1380
|
}
|
|
1381
1381
|
start(r = 0) {
|
|
1382
|
-
if (this._isRunning) throw new
|
|
1382
|
+
if (this._isRunning) throw new w("The clock has already been started.");
|
|
1383
1383
|
this._startTime = performance.now() - r, this._start(), this._isRunning = !0, this._publisher.publish("start");
|
|
1384
1384
|
}
|
|
1385
1385
|
stop() {
|
|
1386
|
-
if (!this._isRunning) throw new
|
|
1387
|
-
if (!this._handle) throw new
|
|
1386
|
+
if (!this._isRunning) throw new w("The clock had already stopped or hadn't yet started.");
|
|
1387
|
+
if (!this._handle) throw new E();
|
|
1388
1388
|
this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
|
|
1389
1389
|
}
|
|
1390
1390
|
onTick(r, e = 0) {
|
|
1391
|
-
if (e < 0) throw new
|
|
1391
|
+
if (e < 0) throw new k("The tick step must be a non-negative number.");
|
|
1392
1392
|
if (e === 0) return this._publisher.subscribe("tick", r);
|
|
1393
1393
|
let t = 0;
|
|
1394
1394
|
return this._publisher.subscribe("tick", (n) => {
|
|
@@ -1396,7 +1396,7 @@ var q = class {
|
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
1398
|
[Symbol.toStringTag] = "Clock";
|
|
1399
|
-
},
|
|
1399
|
+
}, we = class extends O {
|
|
1400
1400
|
_duration;
|
|
1401
1401
|
get duration() {
|
|
1402
1402
|
return this._duration;
|
|
@@ -1405,7 +1405,7 @@ var q = class {
|
|
|
1405
1405
|
return this._duration - this.elapsedTime;
|
|
1406
1406
|
}
|
|
1407
1407
|
_deferrer;
|
|
1408
|
-
constructor(r, e =
|
|
1408
|
+
constructor(r, e = y.Second) {
|
|
1409
1409
|
const t = () => {
|
|
1410
1410
|
const n = this.remainingTime;
|
|
1411
1411
|
n <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", n);
|
|
@@ -1413,20 +1413,20 @@ var q = class {
|
|
|
1413
1413
|
super(t, e), this._duration = r;
|
|
1414
1414
|
}
|
|
1415
1415
|
_deferrerStop(r) {
|
|
1416
|
-
if (!this._isRunning) throw new
|
|
1417
|
-
if (!this._deferrer) throw new
|
|
1416
|
+
if (!this._isRunning) throw new w("The countdown hadn't yet started.");
|
|
1417
|
+
if (!this._deferrer) throw new E();
|
|
1418
1418
|
this._stop(), this._handle = void 0, this._isRunning = !1, r !== void 0 ? this._deferrer.reject(r) : this._deferrer.resolve(), this._deferrer = void 0;
|
|
1419
1419
|
}
|
|
1420
1420
|
start(r = this.duration) {
|
|
1421
|
-
if (this._isRunning) throw new
|
|
1422
|
-
if (this._deferrer) throw new
|
|
1423
|
-
return this._deferrer = new
|
|
1421
|
+
if (this._isRunning) throw new w("The countdown had already stopped or hadn't yet started.");
|
|
1422
|
+
if (this._deferrer) throw new E();
|
|
1423
|
+
return this._deferrer = new q(), super.start(this.duration - r), this._publisher.publish("start"), this._deferrer;
|
|
1424
1424
|
}
|
|
1425
1425
|
stop(r) {
|
|
1426
1426
|
this._deferrerStop(r), this._publisher.publish("stop", r);
|
|
1427
1427
|
}
|
|
1428
1428
|
onTick(r, e = 0) {
|
|
1429
|
-
if (e < 0) throw new
|
|
1429
|
+
if (e < 0) throw new k("The tick step must be a non-negative number.");
|
|
1430
1430
|
if (e === 0) return this._publisher.subscribe("tick", r);
|
|
1431
1431
|
let t = this.remainingTime;
|
|
1432
1432
|
return this._publisher.subscribe("tick", (n) => {
|
|
@@ -1437,144 +1437,199 @@ var q = class {
|
|
|
1437
1437
|
return this._publisher.subscribe("expire", r);
|
|
1438
1438
|
}
|
|
1439
1439
|
[Symbol.toStringTag] = "Countdown";
|
|
1440
|
-
},
|
|
1440
|
+
}, pe = class {
|
|
1441
1441
|
static Linear(r) {
|
|
1442
1442
|
const e = r - 1;
|
|
1443
|
-
return new
|
|
1443
|
+
return new h(function* () {
|
|
1444
1444
|
for (let t = 0; t < r; t += 1) yield t / e;
|
|
1445
1445
|
});
|
|
1446
1446
|
}
|
|
1447
1447
|
static Exponential(r, e = 2) {
|
|
1448
|
-
if (e < 0) throw new
|
|
1448
|
+
if (e < 0) throw new c("The base of the exponential curve cannot be negative.");
|
|
1449
1449
|
const t = r - 1;
|
|
1450
|
-
return new
|
|
1450
|
+
return new h(function* () {
|
|
1451
1451
|
for (let n = 0; n < r; n += 1) yield Math.pow(n / t, e);
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
1454
1454
|
constructor() {
|
|
1455
1455
|
}
|
|
1456
1456
|
[Symbol.toStringTag] = "Curve";
|
|
1457
|
-
},
|
|
1458
|
-
static
|
|
1459
|
-
|
|
1457
|
+
}, _e = class u {
|
|
1458
|
+
static #t(e) {
|
|
1459
|
+
let t = e | 0;
|
|
1460
|
+
return () => {
|
|
1461
|
+
t = t + 1831565813 | 0;
|
|
1462
|
+
let n = t;
|
|
1463
|
+
return n = Math.imul(n ^ n >>> 15, n | 1), n ^= n + Math.imul(n ^ n >>> 7, n | 61), ((n ^ n >>> 14) >>> 0) / 4294967296;
|
|
1464
|
+
};
|
|
1460
1465
|
}
|
|
1461
|
-
static
|
|
1462
|
-
return
|
|
1466
|
+
static _Boolean(e, t) {
|
|
1467
|
+
return e() < t;
|
|
1463
1468
|
}
|
|
1464
|
-
static
|
|
1465
|
-
return
|
|
1469
|
+
static _Integer(e, t, n) {
|
|
1470
|
+
return Math.floor(n === void 0 ? e() * t : e() * (n - t) + t);
|
|
1466
1471
|
}
|
|
1467
|
-
static
|
|
1468
|
-
|
|
1469
|
-
return this.Integer(e.length);
|
|
1472
|
+
static _Decimal(e, t, n) {
|
|
1473
|
+
return t === void 0 ? e() : n === void 0 ? e() * t : e() * (n - t) + t;
|
|
1470
1474
|
}
|
|
1471
|
-
static
|
|
1472
|
-
|
|
1475
|
+
static _Index(e, t) {
|
|
1476
|
+
if (t.length === 0) throw new c("You must provide at least one element.");
|
|
1477
|
+
return u._Integer(e, t.length);
|
|
1473
1478
|
}
|
|
1474
|
-
static
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
if (
|
|
1480
|
-
if (n
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1479
|
+
static _Choice(e, t) {
|
|
1480
|
+
return t[u._Index(e, t)];
|
|
1481
|
+
}
|
|
1482
|
+
static _Sample(e, t, n, s) {
|
|
1483
|
+
const i = t.length;
|
|
1484
|
+
if (i === 0) throw new c("You must provide at least one element.");
|
|
1485
|
+
if (n < 0) throw new c("Count must be non-negative.");
|
|
1486
|
+
if (n > i) throw new c("Count cannot exceed the number of elements.");
|
|
1487
|
+
if (n === 0) return [];
|
|
1488
|
+
if (s === void 0) {
|
|
1489
|
+
const a = Array.from(t), f = new Array(n);
|
|
1490
|
+
for (let T = 0; T < n; T += 1) {
|
|
1491
|
+
const C = u._Integer(e, T, i);
|
|
1492
|
+
f[T] = a[C], a[C] = a[T];
|
|
1485
1493
|
}
|
|
1486
|
-
return
|
|
1494
|
+
return f;
|
|
1487
1495
|
}
|
|
1488
|
-
if (
|
|
1489
|
-
const
|
|
1490
|
-
for (let a = 0; a <
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
1496
|
+
if (s.length !== i) throw new c("Weights array must have the same length as elements array.");
|
|
1497
|
+
const o = new Array(i);
|
|
1498
|
+
for (let a = 0; a < i; a += 1) {
|
|
1499
|
+
if (s[a] <= 0) throw new c(`Weight for element #${a} must be greater than zero.`);
|
|
1500
|
+
o[a] = {
|
|
1493
1501
|
index: a,
|
|
1494
|
-
key: Math.pow(
|
|
1502
|
+
key: Math.pow(e(), 1 / s[a])
|
|
1495
1503
|
};
|
|
1496
1504
|
}
|
|
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
|
|
1505
|
+
o.sort((a, f) => f.key - a.key);
|
|
1506
|
+
const l = new Array(n);
|
|
1507
|
+
for (let a = 0; a < n; a += 1) l[a] = t[o[a].index];
|
|
1508
|
+
return l;
|
|
1509
|
+
}
|
|
1510
|
+
static #e(e, t, n) {
|
|
1511
|
+
const s = new Array(n - 1);
|
|
1512
|
+
for (let a = 0; a < s.length; a += 1) s[a] = e() * t;
|
|
1513
|
+
s.sort((a, f) => a - f);
|
|
1514
|
+
const i = [
|
|
1507
1515
|
0,
|
|
1508
|
-
...
|
|
1509
|
-
|
|
1510
|
-
],
|
|
1511
|
-
for (let a = 0; a <
|
|
1512
|
-
let
|
|
1513
|
-
for (;
|
|
1514
|
-
|
|
1515
|
-
return
|
|
1516
|
+
...s,
|
|
1517
|
+
t
|
|
1518
|
+
], o = new Array(n);
|
|
1519
|
+
for (let a = 0; a < n; a += 1) o[a] = Math.floor(i[a + 1] - i[a]);
|
|
1520
|
+
let l = t - o.reduce((a, f) => a + f, 0);
|
|
1521
|
+
for (; l > 0; )
|
|
1522
|
+
o[u._Integer(e, n)] += 1, l -= 1;
|
|
1523
|
+
return o;
|
|
1516
1524
|
}
|
|
1517
|
-
static
|
|
1518
|
-
if (
|
|
1519
|
-
if (typeof
|
|
1520
|
-
if (
|
|
1521
|
-
return
|
|
1525
|
+
static _Split(e, t, n) {
|
|
1526
|
+
if (n < 1) throw new c("The number of splits must be greater than zero.");
|
|
1527
|
+
if (typeof t == "number") {
|
|
1528
|
+
if (t < 0) throw new c("The total must be a non-negative number.");
|
|
1529
|
+
return u.#e(e, t, n);
|
|
1522
1530
|
}
|
|
1523
|
-
const
|
|
1524
|
-
if (
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1531
|
+
const s = Array.from(t), i = s.length;
|
|
1532
|
+
if (i === 0) throw new c("You must provide at least one element.");
|
|
1533
|
+
if (n > i) throw new c("The number of splits cannot exceed the number of elements.");
|
|
1534
|
+
const o = u.#e(e, i, n), l = new Array(n);
|
|
1527
1535
|
let a = 0;
|
|
1528
|
-
for (let
|
|
1529
|
-
|
|
1530
|
-
return
|
|
1536
|
+
for (let f = 0; f < n; f += 1)
|
|
1537
|
+
l[f] = s.slice(a, a + o[f]), a += o[f];
|
|
1538
|
+
return l;
|
|
1531
1539
|
}
|
|
1532
|
-
|
|
1540
|
+
static Boolean(e = 0.5) {
|
|
1541
|
+
return u._Boolean(Math.random, e);
|
|
1542
|
+
}
|
|
1543
|
+
static Integer(e, t) {
|
|
1544
|
+
return u._Integer(Math.random, e, t);
|
|
1545
|
+
}
|
|
1546
|
+
static Decimal(e, t) {
|
|
1547
|
+
return u._Decimal(Math.random, e, t);
|
|
1548
|
+
}
|
|
1549
|
+
static Index(e) {
|
|
1550
|
+
return u._Index(Math.random, e);
|
|
1551
|
+
}
|
|
1552
|
+
static Choice(e) {
|
|
1553
|
+
return u._Choice(Math.random, e);
|
|
1554
|
+
}
|
|
1555
|
+
static Sample(e, t, n) {
|
|
1556
|
+
return u._Sample(Math.random, e, t, n);
|
|
1557
|
+
}
|
|
1558
|
+
static Split(e, t) {
|
|
1559
|
+
return u._Split(Math.random, e, t);
|
|
1560
|
+
}
|
|
1561
|
+
static FromSeed(e) {
|
|
1562
|
+
return new u(e);
|
|
1563
|
+
}
|
|
1564
|
+
_next;
|
|
1565
|
+
constructor(e) {
|
|
1566
|
+
this._next = u.#t(e);
|
|
1567
|
+
}
|
|
1568
|
+
boolean(e = 0.5) {
|
|
1569
|
+
return u._Boolean(this._next, e);
|
|
1570
|
+
}
|
|
1571
|
+
integer(e, t) {
|
|
1572
|
+
return u._Integer(this._next, e, t);
|
|
1573
|
+
}
|
|
1574
|
+
decimal(e, t) {
|
|
1575
|
+
return u._Decimal(this._next, e, t);
|
|
1576
|
+
}
|
|
1577
|
+
index(e) {
|
|
1578
|
+
return u._Index(this._next, e);
|
|
1579
|
+
}
|
|
1580
|
+
choice(e) {
|
|
1581
|
+
return u._Choice(this._next, e);
|
|
1582
|
+
}
|
|
1583
|
+
sample(e, t, n) {
|
|
1584
|
+
return u._Sample(this._next, e, t, n);
|
|
1585
|
+
}
|
|
1586
|
+
split(e, t) {
|
|
1587
|
+
return u._Split(this._next, e, t);
|
|
1533
1588
|
}
|
|
1534
1589
|
[Symbol.toStringTag] = "Random";
|
|
1535
1590
|
};
|
|
1536
|
-
function
|
|
1537
|
-
return new
|
|
1538
|
-
}
|
|
1539
|
-
function ye() {
|
|
1540
|
-
return new _((r) => requestAnimationFrame(() => r()));
|
|
1591
|
+
function ye(r) {
|
|
1592
|
+
return new b((e) => setTimeout(e, r));
|
|
1541
1593
|
}
|
|
1542
1594
|
function be() {
|
|
1543
|
-
return new
|
|
1595
|
+
return new b((r) => requestAnimationFrame(() => r()));
|
|
1544
1596
|
}
|
|
1545
|
-
function ge(
|
|
1546
|
-
return new
|
|
1597
|
+
function ge() {
|
|
1598
|
+
return new b((r) => setTimeout(r));
|
|
1599
|
+
}
|
|
1600
|
+
function xe(r, e = "text/javascript") {
|
|
1601
|
+
return new b((t, n) => {
|
|
1547
1602
|
const s = document.createElement("script");
|
|
1548
1603
|
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
1604
|
});
|
|
1550
1605
|
}
|
|
1551
1606
|
function ve(...r) {
|
|
1552
|
-
return new
|
|
1607
|
+
return new h(function* () {
|
|
1553
1608
|
for (const e of r) for (const t of e) yield t;
|
|
1554
1609
|
});
|
|
1555
1610
|
}
|
|
1556
|
-
function
|
|
1611
|
+
function Se(r) {
|
|
1557
1612
|
if (r instanceof Array) return r.length;
|
|
1558
1613
|
let e = 0;
|
|
1559
1614
|
for (const t of r) e += 1;
|
|
1560
1615
|
return e;
|
|
1561
1616
|
}
|
|
1562
|
-
function
|
|
1563
|
-
return new
|
|
1617
|
+
function ke(r) {
|
|
1618
|
+
return new h(function* () {
|
|
1564
1619
|
let e = 0;
|
|
1565
1620
|
for (const t of r)
|
|
1566
1621
|
yield [e, t], e += 1;
|
|
1567
1622
|
});
|
|
1568
1623
|
}
|
|
1569
|
-
function
|
|
1570
|
-
if (t <= 0) throw new
|
|
1571
|
-
return e === void 0 && (e = r, r = 0), r > e ? new
|
|
1624
|
+
function Te(r, e, t = 1) {
|
|
1625
|
+
if (t <= 0) throw new k("Step must be always a positive number, even when generating numbers in reverse order.");
|
|
1626
|
+
return e === void 0 && (e = r, r = 0), r > e ? new h(function* () {
|
|
1572
1627
|
for (let n = r; n > e; n -= t) yield n;
|
|
1573
|
-
}) : new
|
|
1628
|
+
}) : new h(function* () {
|
|
1574
1629
|
for (let n = r; n < e; n += t) yield n;
|
|
1575
1630
|
});
|
|
1576
1631
|
}
|
|
1577
|
-
function
|
|
1632
|
+
function Ee(r) {
|
|
1578
1633
|
const e = Array.from(r);
|
|
1579
1634
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
1580
1635
|
const n = Math.floor(Math.random() * (t + 1));
|
|
@@ -1582,16 +1637,16 @@ function Te(r) {
|
|
|
1582
1637
|
}
|
|
1583
1638
|
return e;
|
|
1584
1639
|
}
|
|
1585
|
-
function
|
|
1586
|
-
return new
|
|
1640
|
+
function Me(r) {
|
|
1641
|
+
return new h(function* () {
|
|
1587
1642
|
const e = /* @__PURE__ */ new Set();
|
|
1588
1643
|
for (const t of r)
|
|
1589
1644
|
e.has(t) || (e.add(t), yield t);
|
|
1590
1645
|
});
|
|
1591
1646
|
}
|
|
1592
|
-
function
|
|
1647
|
+
function X(r, e) {
|
|
1593
1648
|
const t = r[Symbol.iterator](), n = e[Symbol.iterator]();
|
|
1594
|
-
return new
|
|
1649
|
+
return new h(function* () {
|
|
1595
1650
|
for (; ; ) {
|
|
1596
1651
|
const s = t.next(), i = n.next();
|
|
1597
1652
|
if (s.done || i.done) break;
|
|
@@ -1599,25 +1654,25 @@ function H(r, e) {
|
|
|
1599
1654
|
}
|
|
1600
1655
|
});
|
|
1601
1656
|
}
|
|
1602
|
-
function
|
|
1657
|
+
function Ie(r, e) {
|
|
1603
1658
|
if (e === void 0) {
|
|
1604
1659
|
let i = 0, o = 0;
|
|
1605
|
-
for (const
|
|
1606
|
-
i +=
|
|
1607
|
-
if (o === 0) throw new
|
|
1660
|
+
for (const l of r)
|
|
1661
|
+
i += l, o += 1;
|
|
1662
|
+
if (o === 0) throw new c("You must provide at least one value.");
|
|
1608
1663
|
return i / o;
|
|
1609
1664
|
}
|
|
1610
1665
|
let t = 0, n = 0, s = 0;
|
|
1611
|
-
for (const [i, o] of
|
|
1612
|
-
if (o <= 0) throw new
|
|
1666
|
+
for (const [i, o] of X(r, e)) {
|
|
1667
|
+
if (o <= 0) throw new c(`The weight for the value #${s} must be greater than zero.`);
|
|
1613
1668
|
t += i * o, n += o, s += 1;
|
|
1614
1669
|
}
|
|
1615
|
-
if (s === 0) throw new
|
|
1616
|
-
if (n <= 0) throw new
|
|
1670
|
+
if (s === 0) throw new c("You must provide at least one value and weight.");
|
|
1671
|
+
if (n <= 0) throw new c("The sum of weights must be greater than zero.");
|
|
1617
1672
|
return t / n;
|
|
1618
1673
|
}
|
|
1619
1674
|
function Ae(r, e, t) {
|
|
1620
|
-
if (e > t) throw new
|
|
1675
|
+
if (e > t) throw new c("The minimum bound must be less than or equal to the maximum bound.");
|
|
1621
1676
|
return r < e ? e : r > t ? t : r;
|
|
1622
1677
|
}
|
|
1623
1678
|
function Re(r) {
|
|
@@ -1628,81 +1683,81 @@ function Re(r) {
|
|
|
1628
1683
|
}
|
|
1629
1684
|
return e;
|
|
1630
1685
|
}
|
|
1631
|
-
function
|
|
1686
|
+
function Fe(r) {
|
|
1632
1687
|
let e = 0;
|
|
1633
1688
|
for (const t of r) e += t;
|
|
1634
1689
|
return e;
|
|
1635
1690
|
}
|
|
1636
|
-
function
|
|
1691
|
+
function Ce(r) {
|
|
1637
1692
|
return `${r.charAt(0).toUpperCase()}${r.slice(1)}`;
|
|
1638
1693
|
}
|
|
1639
|
-
var
|
|
1694
|
+
var Pe = "2.2.7";
|
|
1640
1695
|
export {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1696
|
+
J as AggregatedAsyncIterator,
|
|
1697
|
+
F as AggregatedIterator,
|
|
1698
|
+
oe as ArrayView,
|
|
1699
|
+
D as CallableObject,
|
|
1700
|
+
se as CallbackChain,
|
|
1701
|
+
me as Clock,
|
|
1702
|
+
we as Countdown,
|
|
1703
|
+
pe as Curve,
|
|
1704
|
+
q as DeferredPromise,
|
|
1650
1705
|
Y as EnvironmentException,
|
|
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
|
-
|
|
1706
|
+
m as Exception,
|
|
1707
|
+
E as FatalErrorException,
|
|
1708
|
+
j as FileException,
|
|
1709
|
+
U as FileExistsException,
|
|
1710
|
+
ee as FileNotFoundException,
|
|
1711
|
+
O as GameLoop,
|
|
1712
|
+
ue as JSONStorage,
|
|
1713
|
+
g as KeyException,
|
|
1714
|
+
ae as MapView,
|
|
1715
|
+
B as NetworkException,
|
|
1716
|
+
$ as NotImplementedException,
|
|
1717
|
+
ne as PermissionException,
|
|
1718
|
+
ce as PromiseQueue,
|
|
1719
|
+
I as Publisher,
|
|
1720
|
+
_e as Random,
|
|
1721
|
+
k as RangeException,
|
|
1722
|
+
d as ReducedIterator,
|
|
1723
|
+
A as ReferenceException,
|
|
1724
|
+
te as ResponseException,
|
|
1725
|
+
w as RuntimeException,
|
|
1726
|
+
le as SetView,
|
|
1727
|
+
R as SmartAsyncIterator,
|
|
1728
|
+
h as SmartIterator,
|
|
1729
|
+
b as SmartPromise,
|
|
1730
|
+
ie as SwitchableCallback,
|
|
1731
|
+
y as TimeUnit,
|
|
1732
|
+
H as TimedPromise,
|
|
1733
|
+
V as TimeoutException,
|
|
1734
|
+
re as TypeException,
|
|
1735
|
+
Pe as VERSION,
|
|
1736
|
+
c as ValueException,
|
|
1682
1737
|
K as WeekDay,
|
|
1683
|
-
|
|
1684
|
-
|
|
1738
|
+
Ie as average,
|
|
1739
|
+
Ce as capitalize,
|
|
1685
1740
|
ve as chain,
|
|
1686
1741
|
Ae as clamp,
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1742
|
+
Se as count,
|
|
1743
|
+
he as dateDifference,
|
|
1744
|
+
fe as dateRange,
|
|
1690
1745
|
Q as dateRound,
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1746
|
+
ye as delay,
|
|
1747
|
+
ke as enumerate,
|
|
1748
|
+
de as getWeek,
|
|
1694
1749
|
Re as hash,
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1750
|
+
P as isBrowser,
|
|
1751
|
+
Z as isNode,
|
|
1752
|
+
W as isWorker,
|
|
1753
|
+
xe as loadScript,
|
|
1754
|
+
be as nextAnimationFrame,
|
|
1755
|
+
Te as range,
|
|
1756
|
+
Ee as shuffle,
|
|
1757
|
+
Fe as sum,
|
|
1758
|
+
Me as unique,
|
|
1759
|
+
ge as yieldToEventLoop,
|
|
1760
|
+
X as zip
|
|
1706
1761
|
};
|
|
1707
1762
|
|
|
1708
1763
|
//# sourceMappingURL=core.esm.js.map
|