@byloth/core 1.5.0-rc.1 → 1.5.0-rc.3
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.js +260 -247
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -2
- package/src/models/exceptions/index.ts +9 -0
- package/src/models/index.ts +1 -1
- package/src/models/promises/deferred-promise.ts +65 -76
- package/src/models/promises/smart-promise.ts +22 -45
- package/src/models/promises/timed-promise.ts +28 -51
- package/src/utils/math.ts +11 -3
package/dist/core.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var w = (r, e, t) => e in r ? y(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var l = (r, e, t) => (w(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
class c {
|
|
5
5
|
constructor(e) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
l(this, "_iterator");
|
|
7
|
+
l(this, "return");
|
|
8
|
+
l(this, "throw");
|
|
9
9
|
e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e, this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
|
|
10
10
|
}
|
|
11
11
|
every(e) {
|
|
@@ -32,41 +32,41 @@ class u {
|
|
|
32
32
|
}
|
|
33
33
|
filter(e) {
|
|
34
34
|
const t = this._iterator;
|
|
35
|
-
return new
|
|
35
|
+
return new c(function* () {
|
|
36
36
|
let n = 0;
|
|
37
37
|
for (; ; ) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
41
|
-
e(
|
|
38
|
+
const s = t.next();
|
|
39
|
+
if (s.done)
|
|
40
|
+
return s.value;
|
|
41
|
+
e(s.value, n) && (yield s.value), n += 1;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
map(e) {
|
|
46
46
|
const t = this._iterator;
|
|
47
|
-
return new
|
|
47
|
+
return new c(function* () {
|
|
48
48
|
let n = 0;
|
|
49
49
|
for (; ; ) {
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
53
|
-
yield e(
|
|
50
|
+
const s = t.next();
|
|
51
|
+
if (s.done)
|
|
52
|
+
return s.value;
|
|
53
|
+
yield e(s.value, n), n += 1;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
reduce(e, t) {
|
|
58
|
-
let n = 0,
|
|
59
|
-
if (
|
|
58
|
+
let n = 0, s = t;
|
|
59
|
+
if (s === void 0) {
|
|
60
60
|
const i = this._iterator.next();
|
|
61
61
|
if (i.done)
|
|
62
62
|
throw new TypeError("Reduce of empty iterator with no initial value");
|
|
63
|
-
|
|
63
|
+
s = i.value, n += 1;
|
|
64
64
|
}
|
|
65
65
|
for (; ; ) {
|
|
66
66
|
const i = this._iterator.next();
|
|
67
67
|
if (i.done)
|
|
68
|
-
return
|
|
69
|
-
|
|
68
|
+
return s;
|
|
69
|
+
s = e(s, i.value, n), n += 1;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
enumerate() {
|
|
@@ -74,7 +74,7 @@ class u {
|
|
|
74
74
|
}
|
|
75
75
|
unique() {
|
|
76
76
|
const e = this._iterator;
|
|
77
|
-
return new
|
|
77
|
+
return new c(function* () {
|
|
78
78
|
const t = /* @__PURE__ */ new Set();
|
|
79
79
|
for (; ; ) {
|
|
80
80
|
const n = e.next();
|
|
@@ -114,28 +114,28 @@ class u {
|
|
|
114
114
|
return this;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
class
|
|
117
|
+
class a {
|
|
118
118
|
constructor(e) {
|
|
119
|
-
|
|
120
|
-
this._elements = new
|
|
119
|
+
l(this, "_elements");
|
|
120
|
+
this._elements = new c(e);
|
|
121
121
|
}
|
|
122
122
|
filter(e) {
|
|
123
123
|
const t = this._elements;
|
|
124
|
-
return new
|
|
125
|
-
for (const [n, [
|
|
126
|
-
e(
|
|
124
|
+
return new a(function* () {
|
|
125
|
+
for (const [n, [s, i]] of t.enumerate())
|
|
126
|
+
e(s, i, n) && (yield [s, i]);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
map(e) {
|
|
130
130
|
const t = this._elements;
|
|
131
|
-
return new
|
|
132
|
-
for (const [n, [
|
|
133
|
-
yield [
|
|
131
|
+
return new a(function* () {
|
|
132
|
+
for (const [n, [s, i]] of t.enumerate())
|
|
133
|
+
yield [s, e(s, i, n)];
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
keys() {
|
|
137
137
|
const e = this._elements;
|
|
138
|
-
return new
|
|
138
|
+
return new c(function* () {
|
|
139
139
|
for (const [t] of e)
|
|
140
140
|
yield t;
|
|
141
141
|
});
|
|
@@ -145,7 +145,7 @@ class f {
|
|
|
145
145
|
}
|
|
146
146
|
values() {
|
|
147
147
|
const e = this._elements;
|
|
148
|
-
return new
|
|
148
|
+
return new c(function* () {
|
|
149
149
|
for (const [t, n] of e)
|
|
150
150
|
yield n;
|
|
151
151
|
});
|
|
@@ -163,79 +163,79 @@ class f {
|
|
|
163
163
|
return "ReducedIterator";
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
class
|
|
166
|
+
class h {
|
|
167
167
|
constructor(e) {
|
|
168
|
-
|
|
169
|
-
this._elements = new
|
|
168
|
+
l(this, "_elements");
|
|
169
|
+
this._elements = new c(e);
|
|
170
170
|
}
|
|
171
171
|
every(e) {
|
|
172
172
|
const t = /* @__PURE__ */ new Map();
|
|
173
|
-
for (const [n,
|
|
174
|
-
const [i,
|
|
175
|
-
|
|
173
|
+
for (const [n, s] of this._elements) {
|
|
174
|
+
const [i, o] = t.get(n) ?? [0, !0];
|
|
175
|
+
o && t.set(n, [i + 1, e(n, s, i)]);
|
|
176
176
|
}
|
|
177
|
-
return new
|
|
178
|
-
for (const [n, [
|
|
177
|
+
return new a(function* () {
|
|
178
|
+
for (const [n, [s, i]] of t)
|
|
179
179
|
yield [n, i];
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
some(e) {
|
|
183
183
|
const t = /* @__PURE__ */ new Map();
|
|
184
|
-
for (const [n,
|
|
185
|
-
const [i,
|
|
186
|
-
|
|
184
|
+
for (const [n, s] of this._elements) {
|
|
185
|
+
const [i, o] = t.get(n) ?? [0, !1];
|
|
186
|
+
o || t.set(n, [i + 1, e(n, s, i)]);
|
|
187
187
|
}
|
|
188
|
-
return new
|
|
189
|
-
for (const [n, [
|
|
188
|
+
return new a(function* () {
|
|
189
|
+
for (const [n, [s, i]] of t)
|
|
190
190
|
yield [n, i];
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
filter(e) {
|
|
194
194
|
const t = this._elements;
|
|
195
|
-
return new
|
|
195
|
+
return new h(function* () {
|
|
196
196
|
const n = /* @__PURE__ */ new Map();
|
|
197
|
-
for (const [
|
|
198
|
-
const
|
|
199
|
-
n.set(
|
|
197
|
+
for (const [s, i] of t) {
|
|
198
|
+
const o = n.get(s) ?? 0;
|
|
199
|
+
n.set(s, o + 1), e(s, i, o) && (yield [s, i]);
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
map(e) {
|
|
204
204
|
const t = this._elements;
|
|
205
|
-
return new
|
|
205
|
+
return new h(function* () {
|
|
206
206
|
const n = /* @__PURE__ */ new Map();
|
|
207
|
-
for (const [
|
|
208
|
-
const
|
|
209
|
-
n.set(
|
|
207
|
+
for (const [s, i] of t) {
|
|
208
|
+
const o = n.get(s) ?? 0;
|
|
209
|
+
n.set(s, o + 1), yield [s, e(s, i, o)];
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
reduce(e, t) {
|
|
214
214
|
const n = /* @__PURE__ */ new Map();
|
|
215
|
-
for (const [
|
|
216
|
-
let
|
|
217
|
-
if (n.has(
|
|
218
|
-
[
|
|
215
|
+
for (const [s, i] of this._elements) {
|
|
216
|
+
let o, u;
|
|
217
|
+
if (n.has(s))
|
|
218
|
+
[o, u] = n.get(s), o += 1;
|
|
219
219
|
else if (t !== void 0)
|
|
220
|
-
|
|
220
|
+
o = 0, u = t(s);
|
|
221
221
|
else {
|
|
222
|
-
n.set(
|
|
222
|
+
n.set(s, [0, i]);
|
|
223
223
|
continue;
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
u = e(s, u, i, o), n.set(s, [o, u]);
|
|
226
226
|
}
|
|
227
|
-
return new
|
|
228
|
-
for (const [
|
|
229
|
-
yield [
|
|
227
|
+
return new a(function* () {
|
|
228
|
+
for (const [s, [i, o]] of n)
|
|
229
|
+
yield [s, o];
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
unique() {
|
|
233
233
|
const e = this._elements;
|
|
234
|
-
return new
|
|
234
|
+
return new h(function* () {
|
|
235
235
|
const t = /* @__PURE__ */ new Map();
|
|
236
|
-
for (const [n,
|
|
236
|
+
for (const [n, s] of e) {
|
|
237
237
|
const i = t.get(n) ?? /* @__PURE__ */ new Set();
|
|
238
|
-
i.has(
|
|
238
|
+
i.has(s) || (i.add(s), t.set(n, i), yield [n, s]);
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
}
|
|
@@ -245,7 +245,7 @@ class d {
|
|
|
245
245
|
const n = e.get(t) ?? 0;
|
|
246
246
|
e.set(t, n + 1);
|
|
247
247
|
}
|
|
248
|
-
return new
|
|
248
|
+
return new a(function* () {
|
|
249
249
|
for (const [t, n] of e)
|
|
250
250
|
yield [t, n];
|
|
251
251
|
});
|
|
@@ -254,7 +254,7 @@ class d {
|
|
|
254
254
|
const e = /* @__PURE__ */ new Map();
|
|
255
255
|
for (const [t, n] of this._elements)
|
|
256
256
|
e.has(t) || e.set(t, n);
|
|
257
|
-
return new
|
|
257
|
+
return new a(function* () {
|
|
258
258
|
for (const [t, n] of e)
|
|
259
259
|
yield [t, n];
|
|
260
260
|
});
|
|
@@ -263,14 +263,14 @@ class d {
|
|
|
263
263
|
const e = /* @__PURE__ */ new Map();
|
|
264
264
|
for (const [t, n] of this._elements)
|
|
265
265
|
e.set(t, n);
|
|
266
|
-
return new
|
|
266
|
+
return new a(function* () {
|
|
267
267
|
for (const [t, n] of e)
|
|
268
268
|
yield [t, n];
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
keys() {
|
|
272
272
|
const e = this._elements;
|
|
273
|
-
return new
|
|
273
|
+
return new c(function* () {
|
|
274
274
|
for (const [t] of e)
|
|
275
275
|
yield t;
|
|
276
276
|
});
|
|
@@ -280,7 +280,7 @@ class d {
|
|
|
280
280
|
}
|
|
281
281
|
values() {
|
|
282
282
|
const e = this._elements;
|
|
283
|
-
return new
|
|
283
|
+
return new c(function* () {
|
|
284
284
|
for (const [t, n] of e)
|
|
285
285
|
yield n;
|
|
286
286
|
});
|
|
@@ -291,16 +291,16 @@ class d {
|
|
|
291
291
|
toMap() {
|
|
292
292
|
const e = /* @__PURE__ */ new Map();
|
|
293
293
|
for (const [t, n] of this._elements) {
|
|
294
|
-
const
|
|
295
|
-
|
|
294
|
+
const s = e.get(t) ?? [];
|
|
295
|
+
s.push(n), e.set(t, s);
|
|
296
296
|
}
|
|
297
297
|
return e;
|
|
298
298
|
}
|
|
299
299
|
toObject() {
|
|
300
300
|
const e = {};
|
|
301
301
|
for (const [t, n] of this._elements) {
|
|
302
|
-
const
|
|
303
|
-
|
|
302
|
+
const s = e[t] ?? [];
|
|
303
|
+
s.push(n), e[t] = s;
|
|
304
304
|
}
|
|
305
305
|
return e;
|
|
306
306
|
}
|
|
@@ -310,8 +310,8 @@ class d {
|
|
|
310
310
|
}
|
|
311
311
|
class m {
|
|
312
312
|
constructor(e) {
|
|
313
|
-
|
|
314
|
-
this._elements = new
|
|
313
|
+
l(this, "_elements");
|
|
314
|
+
this._elements = new c(e);
|
|
315
315
|
}
|
|
316
316
|
filter(e) {
|
|
317
317
|
return new m(this._elements.filter(e));
|
|
@@ -323,21 +323,21 @@ class m {
|
|
|
323
323
|
return new m(this._elements.unique());
|
|
324
324
|
}
|
|
325
325
|
groupBy(e) {
|
|
326
|
-
return new
|
|
326
|
+
return new h(this._elements.map((t, n) => [e(t, n), t]));
|
|
327
327
|
}
|
|
328
328
|
get [Symbol.toStringTag]() {
|
|
329
329
|
return "Aggregator";
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
class
|
|
332
|
+
class f extends Error {
|
|
333
333
|
static FromUnknown(e) {
|
|
334
|
-
if (e instanceof
|
|
334
|
+
if (e instanceof f)
|
|
335
335
|
return e;
|
|
336
336
|
if (e instanceof Error) {
|
|
337
|
-
const t = new
|
|
337
|
+
const t = new f(e.message);
|
|
338
338
|
return t.stack = e.stack, t.name = e.name, t;
|
|
339
339
|
}
|
|
340
|
-
return new
|
|
340
|
+
return new f(`${e}`);
|
|
341
341
|
}
|
|
342
342
|
constructor(e, t, n = "Exception") {
|
|
343
343
|
super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
|
|
@@ -350,7 +350,7 @@ Caused by ${t}`);
|
|
|
350
350
|
return "Exception";
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
class
|
|
353
|
+
class v extends f {
|
|
354
354
|
constructor(e, t, n = "ReferenceException") {
|
|
355
355
|
super(e, t, n);
|
|
356
356
|
}
|
|
@@ -358,7 +358,7 @@ class y extends h {
|
|
|
358
358
|
return "ReferenceException";
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class p extends f {
|
|
362
362
|
constructor(e, t, n = "TimeoutException") {
|
|
363
363
|
super(e, t, n);
|
|
364
364
|
}
|
|
@@ -366,32 +366,40 @@ class w extends h {
|
|
|
366
366
|
return "TimeoutException";
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
class
|
|
369
|
+
class g extends f {
|
|
370
|
+
constructor(e, t, n = "ValueException") {
|
|
371
|
+
super(e, t, n);
|
|
372
|
+
}
|
|
373
|
+
get [Symbol.toStringTag]() {
|
|
374
|
+
return "ValueException";
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class k {
|
|
370
378
|
constructor(e = !0) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
379
|
+
l(this, "_preferPersistence");
|
|
380
|
+
l(this, "_volatile");
|
|
381
|
+
l(this, "_persistent");
|
|
374
382
|
this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
375
383
|
}
|
|
376
384
|
_get(e, t, n) {
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
385
|
+
const s = e.getItem(t);
|
|
386
|
+
if (s)
|
|
379
387
|
try {
|
|
380
|
-
return JSON.parse(
|
|
388
|
+
return JSON.parse(s);
|
|
381
389
|
} catch {
|
|
382
390
|
console.warn(
|
|
383
|
-
`The "${
|
|
391
|
+
`The "${s}" value for "${t}" property cannot be parsed. Clearing the storage...`
|
|
384
392
|
), e.removeItem(t);
|
|
385
393
|
}
|
|
386
394
|
return n;
|
|
387
395
|
}
|
|
388
396
|
_set(e, t, n) {
|
|
389
|
-
const
|
|
390
|
-
|
|
397
|
+
const s = JSON.stringify(n);
|
|
398
|
+
s ? e.setItem(t, s) : e.removeItem(t);
|
|
391
399
|
}
|
|
392
400
|
get(e, t, n = this._preferPersistence) {
|
|
393
|
-
const
|
|
394
|
-
return this._get(
|
|
401
|
+
const s = n ? this._persistent : this._volatile;
|
|
402
|
+
return this._get(s, e, t);
|
|
395
403
|
}
|
|
396
404
|
recall(e, t) {
|
|
397
405
|
return this._get(this._volatile, e, t);
|
|
@@ -453,8 +461,8 @@ class b {
|
|
|
453
461
|
* @param persistent Whether to use the persistent `localStorage` or the volatile `sessionStorage`.
|
|
454
462
|
*/
|
|
455
463
|
set(e, t, n = this._preferPersistence) {
|
|
456
|
-
const
|
|
457
|
-
this._set(
|
|
464
|
+
const s = n ? this._persistent : this._volatile;
|
|
465
|
+
this._set(s, e, t);
|
|
458
466
|
}
|
|
459
467
|
/**
|
|
460
468
|
* Sets the value with the specified name in the volatile `sessionStorage`.
|
|
@@ -504,9 +512,9 @@ class b {
|
|
|
504
512
|
return "JsonStorage";
|
|
505
513
|
}
|
|
506
514
|
}
|
|
507
|
-
class
|
|
515
|
+
class P {
|
|
508
516
|
constructor() {
|
|
509
|
-
|
|
517
|
+
l(this, "_subscribers");
|
|
510
518
|
this._subscribers = [];
|
|
511
519
|
}
|
|
512
520
|
add(e) {
|
|
@@ -515,7 +523,7 @@ class S {
|
|
|
515
523
|
remove(e) {
|
|
516
524
|
const t = this._subscribers.indexOf(e);
|
|
517
525
|
if (t < 0)
|
|
518
|
-
throw new
|
|
526
|
+
throw new v("Unable to remove the requested subscriber. It was not found.");
|
|
519
527
|
this._subscribers.splice(t, 1);
|
|
520
528
|
}
|
|
521
529
|
call(...e) {
|
|
@@ -525,21 +533,37 @@ class S {
|
|
|
525
533
|
return "Subscribers";
|
|
526
534
|
}
|
|
527
535
|
}
|
|
528
|
-
class
|
|
529
|
-
constructor(
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
+
class T extends Promise {
|
|
537
|
+
constructor(t, n) {
|
|
538
|
+
super((s, i) => {
|
|
539
|
+
t ? this._resolve = async (o) => {
|
|
540
|
+
this._isPending = !1, this._isFulfilled = !0;
|
|
541
|
+
try {
|
|
542
|
+
const u = await o, d = t(u);
|
|
543
|
+
s(d);
|
|
544
|
+
} catch (u) {
|
|
545
|
+
this._reject(u);
|
|
546
|
+
}
|
|
547
|
+
} : this._resolve = (o) => {
|
|
548
|
+
this._isPending = !1, this._isFulfilled = !0, s(o);
|
|
549
|
+
}, n ? this._reject = (o) => {
|
|
550
|
+
this._isPending = !1, this._isRejected = !0;
|
|
551
|
+
try {
|
|
552
|
+
const u = n(o);
|
|
553
|
+
s(u);
|
|
554
|
+
} catch (u) {
|
|
555
|
+
i(u);
|
|
556
|
+
}
|
|
557
|
+
} : this._reject = (o) => {
|
|
558
|
+
this._isPending = !1, this._isRejected = !0, i(o);
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
l(this, "_isPending");
|
|
562
|
+
l(this, "_isFulfilled");
|
|
563
|
+
l(this, "_isRejected");
|
|
564
|
+
l(this, "_resolve");
|
|
565
|
+
l(this, "_reject");
|
|
536
566
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
537
|
-
let n;
|
|
538
|
-
e ? n = (a) => (this._isPending = !1, this._isFulfilled = !0, e(a)) : n = (a) => (this._isPending = !1, this._isFulfilled = !0, a);
|
|
539
|
-
let r;
|
|
540
|
-
t ? r = (a) => (this._isPending = !1, this._isRejected = !0, t(a)) : r = (a) => (this._isPending = !1, this._isRejected = !0, a);
|
|
541
|
-
const { promise: i, resolve: l, reject: c } = Promise.withResolvers();
|
|
542
|
-
this._promise = i.then(n, r), this._resolve = l, this._reject = c;
|
|
543
567
|
}
|
|
544
568
|
get isPending() {
|
|
545
569
|
return this._isPending;
|
|
@@ -556,31 +580,26 @@ class P {
|
|
|
556
580
|
get reject() {
|
|
557
581
|
return this._reject;
|
|
558
582
|
}
|
|
559
|
-
|
|
560
|
-
return
|
|
561
|
-
}
|
|
562
|
-
catch(e) {
|
|
563
|
-
return this._promise.catch(e);
|
|
564
|
-
}
|
|
565
|
-
finally(e) {
|
|
566
|
-
return this._promise.finally(e);
|
|
567
|
-
}
|
|
568
|
-
watch(e) {
|
|
569
|
-
return e.then(this.resolve, this.reject), this;
|
|
583
|
+
watch(t) {
|
|
584
|
+
return t.then(this.resolve, this.reject), this;
|
|
570
585
|
}
|
|
571
586
|
get [Symbol.toStringTag]() {
|
|
572
587
|
return "DeferredPromise";
|
|
573
588
|
}
|
|
574
589
|
}
|
|
575
|
-
class
|
|
576
|
-
constructor(
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
590
|
+
class j extends Promise {
|
|
591
|
+
constructor(t) {
|
|
592
|
+
super((n, s) => {
|
|
593
|
+
t((u) => {
|
|
594
|
+
this._isPending = !1, this._isFulfilled = !0, n(u);
|
|
595
|
+
}, (u) => {
|
|
596
|
+
this._isPending = !1, this._isRejected = !0, s(u);
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
l(this, "_isPending");
|
|
600
|
+
l(this, "_isFulfilled");
|
|
601
|
+
l(this, "_isRejected");
|
|
581
602
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
582
|
-
const t = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => (this._isPending = !1, this._isRejected = !0, r);
|
|
583
|
-
this._promise = new Promise(e).then(t, n);
|
|
584
603
|
}
|
|
585
604
|
get isPending() {
|
|
586
605
|
return this._isPending;
|
|
@@ -591,30 +610,26 @@ class k {
|
|
|
591
610
|
get isRejected() {
|
|
592
611
|
return this._isRejected;
|
|
593
612
|
}
|
|
594
|
-
then(e, t) {
|
|
595
|
-
return this._promise.then(e, t);
|
|
596
|
-
}
|
|
597
|
-
catch(e) {
|
|
598
|
-
return this._promise.catch(e);
|
|
599
|
-
}
|
|
600
|
-
finally(e) {
|
|
601
|
-
return this._promise.finally(e);
|
|
602
|
-
}
|
|
603
613
|
get [Symbol.toStringTag]() {
|
|
604
614
|
return "SmartPromise";
|
|
605
615
|
}
|
|
606
616
|
}
|
|
607
|
-
class
|
|
608
|
-
constructor(
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
617
|
+
class M extends Promise {
|
|
618
|
+
constructor(t, n) {
|
|
619
|
+
super((s, i) => {
|
|
620
|
+
const o = (_) => {
|
|
621
|
+
this._isPending = !1, this._isFulfilled = !0, clearTimeout(d), s(_);
|
|
622
|
+
}, u = (_) => {
|
|
623
|
+
this._isPending = !1, this._isRejected = !0, clearTimeout(d), i(_);
|
|
624
|
+
}, d = setTimeout(() => {
|
|
625
|
+
u(new p("The operation has timed out."));
|
|
626
|
+
}, n);
|
|
627
|
+
t(o, u);
|
|
628
|
+
});
|
|
629
|
+
l(this, "_isPending");
|
|
630
|
+
l(this, "_isFulfilled");
|
|
631
|
+
l(this, "_isRejected");
|
|
613
632
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
614
|
-
const n = (c) => (this._isPending = !1, this._isFulfilled = !0, c), r = (c) => (this._isPending = !1, this._isRejected = !0, c), i = new Promise(e), l = new Promise((c, a) => setTimeout(() => {
|
|
615
|
-
a(new w("The operation has timed out."));
|
|
616
|
-
}, t));
|
|
617
|
-
this._promise = Promise.race([i, l]).then(n, r);
|
|
618
633
|
}
|
|
619
634
|
get isPending() {
|
|
620
635
|
return this._isPending;
|
|
@@ -625,20 +640,11 @@ class j {
|
|
|
625
640
|
get isRejected() {
|
|
626
641
|
return this._isRejected;
|
|
627
642
|
}
|
|
628
|
-
then(e, t) {
|
|
629
|
-
return this._promise.then(e, t);
|
|
630
|
-
}
|
|
631
|
-
catch(e) {
|
|
632
|
-
return this._promise.catch(e);
|
|
633
|
-
}
|
|
634
|
-
finally(e) {
|
|
635
|
-
return this._promise.finally(e);
|
|
636
|
-
}
|
|
637
643
|
get [Symbol.toStringTag]() {
|
|
638
644
|
return "TimedPromise";
|
|
639
645
|
}
|
|
640
646
|
}
|
|
641
|
-
class
|
|
647
|
+
class R {
|
|
642
648
|
static Boolean(e = 0.5) {
|
|
643
649
|
return Math.random() < e;
|
|
644
650
|
}
|
|
@@ -655,134 +661,141 @@ class M {
|
|
|
655
661
|
constructor() {
|
|
656
662
|
}
|
|
657
663
|
}
|
|
658
|
-
async function
|
|
659
|
-
return new Promise((e, t) => setTimeout(e,
|
|
664
|
+
async function F(r) {
|
|
665
|
+
return new Promise((e, t) => setTimeout(e, r));
|
|
660
666
|
}
|
|
661
|
-
async function
|
|
662
|
-
return new Promise((
|
|
667
|
+
async function E() {
|
|
668
|
+
return new Promise((r, e) => requestAnimationFrame(() => r()));
|
|
663
669
|
}
|
|
664
|
-
var
|
|
665
|
-
function
|
|
666
|
-
return Math.floor((e.getTime() -
|
|
670
|
+
var x = /* @__PURE__ */ ((r) => (r[r.Second = 1e3] = "Second", r[r.Minute = 6e4] = "Minute", r[r.Hour = 36e5] = "Hour", r[r.Day = 864e5] = "Day", r[r.Week = 6048e5] = "Week", r[r.Month = 2592e6] = "Month", r[r.Year = 31536e6] = "Year", r))(x || {});
|
|
671
|
+
function I(r, e, t = 864e5) {
|
|
672
|
+
return Math.floor((e.getTime() - r.getTime()) / t);
|
|
667
673
|
}
|
|
668
|
-
function
|
|
669
|
-
return new
|
|
674
|
+
function A(r, e, t = 864e5) {
|
|
675
|
+
return new c(function* () {
|
|
670
676
|
const n = e.getTime();
|
|
671
|
-
let
|
|
672
|
-
for (;
|
|
673
|
-
yield new Date(
|
|
677
|
+
let s = r.getTime();
|
|
678
|
+
for (; s < n; )
|
|
679
|
+
yield new Date(s), s += t;
|
|
674
680
|
});
|
|
675
681
|
}
|
|
676
|
-
function
|
|
677
|
-
return new Date(Math.floor(
|
|
682
|
+
function q(r, e = 864e5) {
|
|
683
|
+
return new Date(Math.floor(r.getTime() / e) * e);
|
|
678
684
|
}
|
|
679
|
-
async function
|
|
685
|
+
async function C(r, e = "text/javascript") {
|
|
680
686
|
return new Promise((t, n) => {
|
|
681
|
-
const
|
|
682
|
-
|
|
687
|
+
const s = document.createElement("script");
|
|
688
|
+
s.async = !0, s.defer = !0, s.src = r, s.type = e, s.onload = () => t(), s.onerror = () => n(), document.body.appendChild(s);
|
|
683
689
|
});
|
|
684
690
|
}
|
|
685
|
-
function
|
|
686
|
-
if (Array.isArray(
|
|
687
|
-
return
|
|
691
|
+
function O(r) {
|
|
692
|
+
if (Array.isArray(r))
|
|
693
|
+
return r.length;
|
|
688
694
|
let e = 0;
|
|
689
|
-
for (const t of
|
|
695
|
+
for (const t of r)
|
|
690
696
|
e += 1;
|
|
691
697
|
return e;
|
|
692
698
|
}
|
|
693
|
-
function
|
|
694
|
-
return new
|
|
695
|
-
e === void 0 && (e =
|
|
696
|
-
for (let n =
|
|
699
|
+
function $(r, e, t = 1) {
|
|
700
|
+
return new c(function* () {
|
|
701
|
+
e === void 0 && (e = r, r = 0), r > e && (t = t ?? -1);
|
|
702
|
+
for (let n = r; n < e; n += t)
|
|
697
703
|
yield n;
|
|
698
704
|
});
|
|
699
705
|
}
|
|
700
|
-
function
|
|
701
|
-
const e = Array.from(
|
|
706
|
+
function V(r) {
|
|
707
|
+
const e = Array.from(r);
|
|
702
708
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
703
709
|
const n = Math.floor(Math.random() * (t + 1));
|
|
704
710
|
[e[t], e[n]] = [e[n], e[t]];
|
|
705
711
|
}
|
|
706
712
|
return e;
|
|
707
713
|
}
|
|
708
|
-
function
|
|
709
|
-
return new
|
|
714
|
+
function J(r) {
|
|
715
|
+
return new c(function* () {
|
|
710
716
|
const e = /* @__PURE__ */ new Set();
|
|
711
|
-
for (const t of
|
|
717
|
+
for (const t of r)
|
|
712
718
|
e.has(t) || (e.add(t), yield t);
|
|
713
719
|
});
|
|
714
720
|
}
|
|
715
|
-
function
|
|
716
|
-
return new
|
|
717
|
-
const t =
|
|
721
|
+
function b(r, e) {
|
|
722
|
+
return new c(function* () {
|
|
723
|
+
const t = r[Symbol.iterator](), n = e[Symbol.iterator]();
|
|
718
724
|
for (; ; ) {
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
725
|
+
const s = t.next(), i = n.next();
|
|
726
|
+
if (s.done || i.done)
|
|
721
727
|
break;
|
|
722
|
-
yield [
|
|
728
|
+
yield [s.value, i.value];
|
|
723
729
|
}
|
|
724
730
|
});
|
|
725
731
|
}
|
|
726
|
-
function
|
|
732
|
+
function Y(r, e) {
|
|
727
733
|
if (e === void 0) {
|
|
728
|
-
let
|
|
729
|
-
for (const
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
734
|
+
let i = 0, o = 0;
|
|
735
|
+
for (const u of r)
|
|
736
|
+
i += u, o += 1;
|
|
737
|
+
if (o === 0)
|
|
738
|
+
throw new g("You must provide at least one value.");
|
|
739
|
+
return i / o;
|
|
740
|
+
}
|
|
741
|
+
let t = 0, n = 0, s = 0;
|
|
742
|
+
for (const [i, o] of b(r, e))
|
|
743
|
+
t += i * o, n += o, s += 1;
|
|
744
|
+
if (s === 0)
|
|
745
|
+
throw new g("You must provide at least one value and weight.");
|
|
746
|
+
if (n === 0)
|
|
747
|
+
throw new g("The sum of weights must be greater than zero.");
|
|
736
748
|
return t / n;
|
|
737
749
|
}
|
|
738
|
-
function
|
|
750
|
+
function z(r) {
|
|
739
751
|
let e = 0;
|
|
740
|
-
for (let t = 0; t <
|
|
741
|
-
const n =
|
|
752
|
+
for (let t = 0; t < r.length; t += 1) {
|
|
753
|
+
const n = r.charCodeAt(t);
|
|
742
754
|
e = (e << 5) - e + n, e |= 0;
|
|
743
755
|
}
|
|
744
756
|
return e;
|
|
745
757
|
}
|
|
746
|
-
function
|
|
758
|
+
function B(r) {
|
|
747
759
|
let e = 0;
|
|
748
|
-
for (const t of
|
|
760
|
+
for (const t of r)
|
|
749
761
|
e += t;
|
|
750
762
|
return e;
|
|
751
763
|
}
|
|
752
|
-
function
|
|
753
|
-
return `${
|
|
764
|
+
function H(r) {
|
|
765
|
+
return `${r.charAt(0).toUpperCase()}${r.slice(1)}`;
|
|
754
766
|
}
|
|
755
|
-
const
|
|
767
|
+
const W = "1.5.0-rc.3";
|
|
756
768
|
export {
|
|
757
|
-
|
|
769
|
+
h as AggregatedIterator,
|
|
758
770
|
m as Aggregator,
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
I as
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
771
|
+
x as DateUnit,
|
|
772
|
+
T as DeferredPromise,
|
|
773
|
+
f as Exception,
|
|
774
|
+
k as JsonStorage,
|
|
775
|
+
R as Random,
|
|
776
|
+
a as ReducedIterator,
|
|
777
|
+
v as ReferenceException,
|
|
778
|
+
c as SmartIterator,
|
|
779
|
+
j as SmartPromise,
|
|
780
|
+
P as Subscribers,
|
|
781
|
+
M as TimedPromise,
|
|
782
|
+
p as TimeoutException,
|
|
783
|
+
W as VERSION,
|
|
784
|
+
g as ValueException,
|
|
785
|
+
Y as average,
|
|
786
|
+
H as capitalize,
|
|
787
|
+
O as count,
|
|
788
|
+
I as dateDifference,
|
|
789
|
+
A as dateRange,
|
|
790
|
+
q as dateRound,
|
|
791
|
+
F as delay,
|
|
792
|
+
z as hash,
|
|
793
|
+
C as loadScript,
|
|
794
|
+
E as nextAnimationFrame,
|
|
795
|
+
$ as range,
|
|
796
|
+
V as shuffle,
|
|
797
|
+
B as sum,
|
|
798
|
+
J as unique,
|
|
799
|
+
b as zip
|
|
787
800
|
};
|
|
788
801
|
//# sourceMappingURL=core.js.map
|