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