@ztimson/utils 0.20.2 → 0.20.4
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/cache.d.ts +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +283 -277
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
1
|
var st = Object.defineProperty;
|
|
2
|
-
var it = (
|
|
3
|
-
var c = (
|
|
4
|
-
function ot(
|
|
5
|
-
if (
|
|
6
|
-
return Array.isArray(
|
|
7
|
-
(t &&
|
|
8
|
-
}),
|
|
9
|
-
}
|
|
10
|
-
function xt(
|
|
11
|
-
return structuredClone(
|
|
12
|
-
}
|
|
13
|
-
function ct(
|
|
2
|
+
var it = (r, t, e) => t in r ? st(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var c = (r, t, e) => it(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
function ot(r, t = !1) {
|
|
5
|
+
if (r == null) throw new Error("Cannot clean a NULL value");
|
|
6
|
+
return Array.isArray(r) ? r = r.filter((e) => e != null) : Object.entries(r).forEach(([e, n]) => {
|
|
7
|
+
(t && n === void 0 || !t && n == null) && delete r[e];
|
|
8
|
+
}), r;
|
|
9
|
+
}
|
|
10
|
+
function xt(r) {
|
|
11
|
+
return structuredClone(r);
|
|
12
|
+
}
|
|
13
|
+
function ct(r, ...t) {
|
|
14
14
|
return t.forEach((e) => {
|
|
15
|
-
for (const
|
|
16
|
-
e[
|
|
17
|
-
}),
|
|
18
|
-
}
|
|
19
|
-
function B(
|
|
20
|
-
if (!(
|
|
21
|
-
return t.split(/[.[\]]/g).filter((
|
|
22
|
-
if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(
|
|
15
|
+
for (const n in e)
|
|
16
|
+
e[n] && typeof e[n] == "object" && !Array.isArray(e[n]) ? (r[n] || (r[n] = {}), ct(r[n], e[n])) : r[n] = e[n];
|
|
17
|
+
}), r;
|
|
18
|
+
}
|
|
19
|
+
function B(r, t, e) {
|
|
20
|
+
if (!(r == null || !t))
|
|
21
|
+
return t.split(/[.[\]]/g).filter((n) => n.length).reduce((n, s, i, o) => {
|
|
22
|
+
if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(n != null && n.hasOwnProperty(s))) {
|
|
23
23
|
if (e == null) return;
|
|
24
|
-
|
|
24
|
+
n[s] = {};
|
|
25
25
|
}
|
|
26
|
-
return e !== void 0 && i == o.length - 1 ?
|
|
27
|
-
},
|
|
26
|
+
return e !== void 0 && i == o.length - 1 ? n[s] = e : n[s];
|
|
27
|
+
}, r);
|
|
28
28
|
}
|
|
29
|
-
function Bt(
|
|
30
|
-
return Object.entries(
|
|
29
|
+
function Bt(r) {
|
|
30
|
+
return Object.entries(r).map(
|
|
31
31
|
([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
|
|
32
32
|
).join("&");
|
|
33
33
|
}
|
|
34
|
-
function H(
|
|
35
|
-
if (typeof
|
|
36
|
-
for (const
|
|
37
|
-
const s = t ? t + "." +
|
|
38
|
-
typeof n
|
|
34
|
+
function H(r, t, e = {}) {
|
|
35
|
+
if (typeof r == "object" && !Array.isArray(r)) {
|
|
36
|
+
for (const n of Object.keys(r)) {
|
|
37
|
+
const s = t ? t + "." + n : n;
|
|
38
|
+
typeof r[n] == "object" ? H(r[n], s, e) : e[s] = r[n];
|
|
39
39
|
}
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function At(
|
|
43
|
+
function At(r) {
|
|
44
44
|
const t = new FormData();
|
|
45
|
-
return Object.entries(
|
|
45
|
+
return Object.entries(r).forEach(([e, n]) => t.append(e, n)), t;
|
|
46
46
|
}
|
|
47
|
-
function q(
|
|
48
|
-
if (
|
|
49
|
-
if (Array.isArray(t)) return t.findIndex((s, i) => !q(
|
|
50
|
-
const
|
|
51
|
-
return
|
|
47
|
+
function q(r, t, e = !1) {
|
|
48
|
+
if (r == null) return e;
|
|
49
|
+
if (Array.isArray(t)) return t.findIndex((s, i) => !q(r[i], t[i], e)) == -1;
|
|
50
|
+
const n = typeof t;
|
|
51
|
+
return n != typeof r ? !1 : n == "object" ? Object.keys(t).find((s) => !q(r[s], t[s], e)) == null : n == "function" ? r.toString() == t.toString() : r == t;
|
|
52
52
|
}
|
|
53
|
-
function O(
|
|
54
|
-
const e = typeof
|
|
55
|
-
return e != "object" ||
|
|
53
|
+
function O(r, t) {
|
|
54
|
+
const e = typeof r, n = typeof t;
|
|
55
|
+
return e != "object" || r == null || n != "object" || t == null ? e == "function" && n == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? !1 : Object.keys(r).every((i) => O(r[i], t[i]));
|
|
56
56
|
}
|
|
57
|
-
function Rt(
|
|
57
|
+
function Rt(r, t) {
|
|
58
58
|
t.forEach((e) => {
|
|
59
|
-
Object.getOwnPropertyNames(e.prototype).forEach((
|
|
59
|
+
Object.getOwnPropertyNames(e.prototype).forEach((n) => {
|
|
60
60
|
Object.defineProperty(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Object.getOwnPropertyDescriptor(e.prototype,
|
|
61
|
+
r.prototype,
|
|
62
|
+
n,
|
|
63
|
+
Object.getOwnPropertyDescriptor(e.prototype, n) || /* @__PURE__ */ Object.create(null)
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function I(
|
|
68
|
+
function I(r) {
|
|
69
69
|
try {
|
|
70
|
-
return JSON.parse(
|
|
70
|
+
return JSON.parse(r);
|
|
71
71
|
} catch {
|
|
72
|
-
return
|
|
72
|
+
return r;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
function Ot(
|
|
75
|
+
function Ot(r, t) {
|
|
76
76
|
let e = [];
|
|
77
|
-
return JSON.stringify(
|
|
77
|
+
return JSON.stringify(r, (n, s) => {
|
|
78
78
|
if (typeof s == "object" && s !== null) {
|
|
79
79
|
if (e.includes(s)) return;
|
|
80
80
|
e.push(s);
|
|
@@ -82,40 +82,40 @@ function Ot(n, t) {
|
|
|
82
82
|
return s;
|
|
83
83
|
}, t);
|
|
84
84
|
}
|
|
85
|
-
function $t(
|
|
86
|
-
return
|
|
85
|
+
function $t(r, t) {
|
|
86
|
+
return r.indexOf(t) === -1 && r.push(t), r;
|
|
87
87
|
}
|
|
88
|
-
function Ct(
|
|
88
|
+
function Ct(r, t) {
|
|
89
89
|
return at([
|
|
90
|
-
...
|
|
91
|
-
...t.filter((e) => !
|
|
90
|
+
...r.filter((e) => !t.includes((n) => O(e, n))),
|
|
91
|
+
...t.filter((e) => !r.includes((n) => O(e, n)))
|
|
92
92
|
]);
|
|
93
93
|
}
|
|
94
|
-
function Lt(
|
|
94
|
+
function Lt(r) {
|
|
95
95
|
return function(t, e) {
|
|
96
|
-
const
|
|
97
|
-
return typeof
|
|
96
|
+
const n = B(t, r), s = B(e, r);
|
|
97
|
+
return typeof n != "string" || typeof s != "string" ? 1 : n.toLowerCase().localeCompare(s.toLowerCase());
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function Nt(
|
|
101
|
-
return (e) => O(B(e,
|
|
100
|
+
function Nt(r, t) {
|
|
101
|
+
return (e) => O(B(e, r), t);
|
|
102
102
|
}
|
|
103
|
-
function ut(
|
|
104
|
-
return
|
|
103
|
+
function ut(r, t = []) {
|
|
104
|
+
return r.forEach((e) => Array.isArray(e) ? ut(e, t) : t.push(e)), t;
|
|
105
105
|
}
|
|
106
|
-
function jt(
|
|
107
|
-
return function(e,
|
|
108
|
-
const s = B(e,
|
|
106
|
+
function jt(r, t = !1) {
|
|
107
|
+
return function(e, n) {
|
|
108
|
+
const s = B(e, r), i = B(n, r);
|
|
109
109
|
return typeof s == "number" && typeof i == "number" ? (t ? -1 : 1) * (s - i) : s > i ? t ? -1 : 1 : s < i ? t ? 1 : -1 : 0;
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function at(
|
|
113
|
-
for (let t =
|
|
114
|
-
|
|
115
|
-
return
|
|
112
|
+
function at(r) {
|
|
113
|
+
for (let t = r.length - 1; t >= 0; t--)
|
|
114
|
+
r.slice(0, t).find((e) => O(e, r[t])) && r.splice(t, 1);
|
|
115
|
+
return r;
|
|
116
116
|
}
|
|
117
|
-
function m(
|
|
118
|
-
return Array.isArray(
|
|
117
|
+
function m(r) {
|
|
118
|
+
return Array.isArray(r) ? r : [r];
|
|
119
119
|
}
|
|
120
120
|
class S extends Array {
|
|
121
121
|
/** Number of elements in set */
|
|
@@ -142,8 +142,8 @@ class S extends Array {
|
|
|
142
142
|
*/
|
|
143
143
|
delete(...t) {
|
|
144
144
|
t.forEach((e) => {
|
|
145
|
-
const
|
|
146
|
-
|
|
145
|
+
const n = this.indexOf(e);
|
|
146
|
+
n != -1 && this.slice(n, 1);
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -228,17 +228,17 @@ class Tt {
|
|
|
228
228
|
* @return {T[]} Array of items
|
|
229
229
|
*/
|
|
230
230
|
c(this, "values", this.all());
|
|
231
|
-
if (this.key = t, this.options = e, e.storageKey && !e.storage && (e.storage = localStorage), e.storageKey && e.storage) {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
231
|
+
if (this.key = t, this.options = e, e.storageKey && !e.storage && localStorage && (e.storage = localStorage), e.storageKey && e.storage) {
|
|
232
|
+
const n = e.storage.getItem(e.storageKey);
|
|
233
|
+
if (n)
|
|
234
234
|
try {
|
|
235
|
-
Object.assign(this.store, JSON.parse(
|
|
235
|
+
Object.assign(this.store, JSON.parse(n));
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
return new Proxy(this, {
|
|
240
|
-
get: (
|
|
241
|
-
set: (
|
|
240
|
+
get: (n, s) => s in n ? n[s] : n.store[s],
|
|
241
|
+
set: (n, s, i) => (s in n ? n[s] = i : n.store[s] = i, !0)
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
getKey(t) {
|
|
@@ -261,8 +261,8 @@ class Tt {
|
|
|
261
261
|
* @return {this}
|
|
262
262
|
*/
|
|
263
263
|
add(t, e = this.ttl) {
|
|
264
|
-
const
|
|
265
|
-
return this.set(
|
|
264
|
+
const n = this.getKey(t);
|
|
265
|
+
return this.set(n, t, e), this;
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Add several rows to the cache
|
|
@@ -272,7 +272,13 @@ class Tt {
|
|
|
272
272
|
* @return {this}
|
|
273
273
|
*/
|
|
274
274
|
addAll(t, e = !0) {
|
|
275
|
-
return t.forEach((
|
|
275
|
+
return t.forEach((n) => this.add(n)), this.complete = e, this;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Remove all keys from cache
|
|
279
|
+
*/
|
|
280
|
+
clear() {
|
|
281
|
+
this.store = {};
|
|
276
282
|
}
|
|
277
283
|
/**
|
|
278
284
|
* Delete an item from the cache
|
|
@@ -321,20 +327,20 @@ class Tt {
|
|
|
321
327
|
* @param {number | undefined} ttl Override default expiry in seconds
|
|
322
328
|
* @return {this}
|
|
323
329
|
*/
|
|
324
|
-
set(t, e,
|
|
325
|
-
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)),
|
|
330
|
+
set(t, e, n = this.options.ttl) {
|
|
331
|
+
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)), n && setTimeout(() => {
|
|
326
332
|
this.complete = !1, this.delete(t);
|
|
327
|
-
},
|
|
333
|
+
}, n * 1e3), this;
|
|
328
334
|
}
|
|
329
335
|
}
|
|
330
|
-
function It(
|
|
331
|
-
const e =
|
|
332
|
-
|
|
333
|
-
}),
|
|
336
|
+
function It(r, t = !0) {
|
|
337
|
+
const e = r.reduce((n, s) => (Object.keys(t ? H(s) : s).forEach((i) => {
|
|
338
|
+
n.includes(i) || n.push(i);
|
|
339
|
+
}), n), []);
|
|
334
340
|
return [
|
|
335
341
|
e.join(","),
|
|
336
|
-
...
|
|
337
|
-
const i = B(
|
|
342
|
+
...r.map((n) => e.map((s) => {
|
|
343
|
+
const i = B(n, s), o = typeof i;
|
|
338
344
|
return o == "string" && i.includes(",") ? `"${i}"` : o == "object" ? `"${JSON.stringify(i)}"` : i;
|
|
339
345
|
}).join(","))
|
|
340
346
|
].join(`
|
|
@@ -342,8 +348,8 @@ function It(n, t = !0) {
|
|
|
342
348
|
}
|
|
343
349
|
class x extends Promise {
|
|
344
350
|
constructor(e) {
|
|
345
|
-
super((
|
|
346
|
-
(i) =>
|
|
351
|
+
super((n, s) => e(
|
|
352
|
+
(i) => n(i),
|
|
347
353
|
(i) => s(i),
|
|
348
354
|
(i) => this.progress = i
|
|
349
355
|
));
|
|
@@ -354,20 +360,20 @@ class x extends Promise {
|
|
|
354
360
|
return this._progress;
|
|
355
361
|
}
|
|
356
362
|
set progress(e) {
|
|
357
|
-
e != this._progress && (this._progress = e, this.listeners.forEach((
|
|
363
|
+
e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
|
|
358
364
|
}
|
|
359
365
|
static from(e) {
|
|
360
|
-
return e instanceof x ? e : new x((
|
|
366
|
+
return e instanceof x ? e : new x((n, s) => e.then((...i) => n(...i)).catch((...i) => s(...i)));
|
|
361
367
|
}
|
|
362
368
|
from(e) {
|
|
363
|
-
const
|
|
364
|
-
return this.onProgress((s) =>
|
|
369
|
+
const n = x.from(e);
|
|
370
|
+
return this.onProgress((s) => n.progress = s), n;
|
|
365
371
|
}
|
|
366
372
|
onProgress(e) {
|
|
367
373
|
return this.listeners.push(e), this;
|
|
368
374
|
}
|
|
369
|
-
then(e,
|
|
370
|
-
const s = super.then(e,
|
|
375
|
+
then(e, n) {
|
|
376
|
+
const s = super.then(e, n);
|
|
371
377
|
return this.from(s);
|
|
372
378
|
}
|
|
373
379
|
catch(e) {
|
|
@@ -377,32 +383,32 @@ class x extends Promise {
|
|
|
377
383
|
return this.from(super.finally(e));
|
|
378
384
|
}
|
|
379
385
|
}
|
|
380
|
-
function Dt(
|
|
381
|
-
|
|
382
|
-
const e = URL.createObjectURL(
|
|
386
|
+
function Dt(r, t) {
|
|
387
|
+
r instanceof Blob || (r = new Blob(m(r)));
|
|
388
|
+
const e = URL.createObjectURL(r);
|
|
383
389
|
lt(e, t), URL.revokeObjectURL(e);
|
|
384
390
|
}
|
|
385
|
-
function lt(
|
|
391
|
+
function lt(r, t) {
|
|
386
392
|
const e = document.createElement("a");
|
|
387
|
-
e.href =
|
|
393
|
+
e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
388
394
|
}
|
|
389
|
-
function Mt(
|
|
395
|
+
function Mt(r = {}) {
|
|
390
396
|
return new Promise((t) => {
|
|
391
397
|
const e = document.createElement("input");
|
|
392
|
-
e.type = "file", e.accept =
|
|
398
|
+
e.type = "file", e.accept = r.accept || "*", e.style.display = "none", e.multiple = !!r.multiple, e.onblur = e.onchange = async () => {
|
|
393
399
|
t(Array.from(e.files)), e.remove();
|
|
394
400
|
}, document.body.appendChild(e), e.click();
|
|
395
401
|
});
|
|
396
402
|
}
|
|
397
|
-
function kt(
|
|
403
|
+
function kt(r, t = /* @__PURE__ */ new Date()) {
|
|
398
404
|
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
399
405
|
const e = `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${t.getDate().toString().padStart(2, "0")}_${t.getHours().toString().padStart(2, "0")}-${t.getMinutes().toString().padStart(2, "0")}-${t.getSeconds().toString().padStart(2, "0")}`;
|
|
400
|
-
return
|
|
406
|
+
return r ? r.replace("{{TIMESTAMP}}", e) : e;
|
|
401
407
|
}
|
|
402
|
-
function Pt(
|
|
403
|
-
return new x((t, e,
|
|
408
|
+
function Pt(r) {
|
|
409
|
+
return new x((t, e, n) => {
|
|
404
410
|
const s = new XMLHttpRequest(), i = new FormData();
|
|
405
|
-
|
|
411
|
+
r.files.forEach((o) => i.append("file", o)), s.withCredentials = !!r.withCredentials, s.upload.addEventListener("progress", (o) => o.lengthComputable ? n(o.loaded / o.total) : null), s.addEventListener("loadend", () => t(I(s.responseText))), s.addEventListener("error", () => e(I(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", r.url), Object.entries(r.headers || {}).forEach(([o, a]) => s.setRequestHeader(o, a)), s.send(i);
|
|
406
412
|
});
|
|
407
413
|
}
|
|
408
414
|
class K {
|
|
@@ -410,48 +416,48 @@ class K {
|
|
|
410
416
|
c(this, "listeners", {});
|
|
411
417
|
}
|
|
412
418
|
static emit(t, ...e) {
|
|
413
|
-
(this.listeners["*"] || []).forEach((
|
|
419
|
+
(this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t.toString()] || []).forEach((n) => n(...e));
|
|
414
420
|
}
|
|
415
421
|
static off(t, e) {
|
|
416
|
-
const
|
|
417
|
-
this.listeners[
|
|
422
|
+
const n = t.toString();
|
|
423
|
+
this.listeners[n] = (this.listeners[n] || []).filter((s) => s === e);
|
|
418
424
|
}
|
|
419
425
|
static on(t, e) {
|
|
420
426
|
var s;
|
|
421
|
-
const
|
|
422
|
-
return this.listeners[
|
|
427
|
+
const n = t.toString();
|
|
428
|
+
return this.listeners[n] || (this.listeners[n] = []), (s = this.listeners[n]) == null || s.push(e), () => this.off(t, e);
|
|
423
429
|
}
|
|
424
430
|
static once(t, e) {
|
|
425
|
-
return new Promise((
|
|
431
|
+
return new Promise((n) => {
|
|
426
432
|
const s = this.on(t, (...i) => {
|
|
427
|
-
|
|
433
|
+
n(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
428
434
|
});
|
|
429
435
|
});
|
|
430
436
|
}
|
|
431
437
|
emit(t, ...e) {
|
|
432
|
-
(this.listeners["*"] || []).forEach((
|
|
438
|
+
(this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t] || []).forEach((n) => n(...e));
|
|
433
439
|
}
|
|
434
440
|
off(t, e) {
|
|
435
|
-
this.listeners[t] = (this.listeners[t] || []).filter((
|
|
441
|
+
this.listeners[t] = (this.listeners[t] || []).filter((n) => n === e);
|
|
436
442
|
}
|
|
437
443
|
on(t, e) {
|
|
438
|
-
var
|
|
439
|
-
return this.listeners[t] || (this.listeners[t] = []), (
|
|
444
|
+
var n;
|
|
445
|
+
return this.listeners[t] || (this.listeners[t] = []), (n = this.listeners[t]) == null || n.push(e), () => this.off(t, e);
|
|
440
446
|
}
|
|
441
447
|
once(t, e) {
|
|
442
|
-
return new Promise((
|
|
448
|
+
return new Promise((n) => {
|
|
443
449
|
const s = this.on(t, (...i) => {
|
|
444
|
-
|
|
450
|
+
n(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
445
451
|
});
|
|
446
452
|
});
|
|
447
453
|
}
|
|
448
454
|
}
|
|
449
455
|
c(K, "listeners", {});
|
|
450
|
-
class
|
|
451
|
-
constructor(e,
|
|
456
|
+
class y extends Error {
|
|
457
|
+
constructor(e, n) {
|
|
452
458
|
super(e);
|
|
453
459
|
c(this, "_code");
|
|
454
|
-
|
|
460
|
+
n != null && (this._code = n);
|
|
455
461
|
}
|
|
456
462
|
get code() {
|
|
457
463
|
return this._code || this.constructor.code;
|
|
@@ -460,11 +466,11 @@ class g extends Error {
|
|
|
460
466
|
this._code = e;
|
|
461
467
|
}
|
|
462
468
|
static from(e) {
|
|
463
|
-
const
|
|
469
|
+
const n = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
|
|
464
470
|
return Object.assign(s, {
|
|
465
471
|
stack: e.stack,
|
|
466
472
|
...e,
|
|
467
|
-
code:
|
|
473
|
+
code: n ?? void 0
|
|
468
474
|
});
|
|
469
475
|
}
|
|
470
476
|
static instanceof(e) {
|
|
@@ -474,8 +480,8 @@ class g extends Error {
|
|
|
474
480
|
return this.message || super.toString();
|
|
475
481
|
}
|
|
476
482
|
}
|
|
477
|
-
c(
|
|
478
|
-
class W extends
|
|
483
|
+
c(y, "code", 500);
|
|
484
|
+
class W extends y {
|
|
479
485
|
constructor(t = "Bad Request") {
|
|
480
486
|
super(t);
|
|
481
487
|
}
|
|
@@ -484,7 +490,7 @@ class W extends g {
|
|
|
484
490
|
}
|
|
485
491
|
}
|
|
486
492
|
c(W, "code", 400);
|
|
487
|
-
class v extends
|
|
493
|
+
class v extends y {
|
|
488
494
|
constructor(t = "Unauthorized") {
|
|
489
495
|
super(t);
|
|
490
496
|
}
|
|
@@ -493,7 +499,7 @@ class v extends g {
|
|
|
493
499
|
}
|
|
494
500
|
}
|
|
495
501
|
c(v, "code", 401);
|
|
496
|
-
class J extends
|
|
502
|
+
class J extends y {
|
|
497
503
|
constructor(t = "Payment Required") {
|
|
498
504
|
super(t);
|
|
499
505
|
}
|
|
@@ -502,7 +508,7 @@ class J extends g {
|
|
|
502
508
|
}
|
|
503
509
|
}
|
|
504
510
|
c(J, "code", 402);
|
|
505
|
-
class z extends
|
|
511
|
+
class z extends y {
|
|
506
512
|
constructor(t = "Forbidden") {
|
|
507
513
|
super(t);
|
|
508
514
|
}
|
|
@@ -511,7 +517,7 @@ class z extends g {
|
|
|
511
517
|
}
|
|
512
518
|
}
|
|
513
519
|
c(z, "code", 403);
|
|
514
|
-
class Z extends
|
|
520
|
+
class Z extends y {
|
|
515
521
|
constructor(t = "Not Found") {
|
|
516
522
|
super(t);
|
|
517
523
|
}
|
|
@@ -520,7 +526,7 @@ class Z extends g {
|
|
|
520
526
|
}
|
|
521
527
|
}
|
|
522
528
|
c(Z, "code", 404);
|
|
523
|
-
class V extends
|
|
529
|
+
class V extends y {
|
|
524
530
|
constructor(t = "Method Not Allowed") {
|
|
525
531
|
super(t);
|
|
526
532
|
}
|
|
@@ -529,7 +535,7 @@ class V extends g {
|
|
|
529
535
|
}
|
|
530
536
|
}
|
|
531
537
|
c(V, "code", 405);
|
|
532
|
-
class X extends
|
|
538
|
+
class X extends y {
|
|
533
539
|
constructor(t = "Not Acceptable") {
|
|
534
540
|
super(t);
|
|
535
541
|
}
|
|
@@ -538,7 +544,7 @@ class X extends g {
|
|
|
538
544
|
}
|
|
539
545
|
}
|
|
540
546
|
c(X, "code", 406);
|
|
541
|
-
class Q extends
|
|
547
|
+
class Q extends y {
|
|
542
548
|
constructor(t = "Internal Server Error") {
|
|
543
549
|
super(t);
|
|
544
550
|
}
|
|
@@ -547,7 +553,7 @@ class Q extends g {
|
|
|
547
553
|
}
|
|
548
554
|
}
|
|
549
555
|
c(Q, "code", 500);
|
|
550
|
-
class _ extends
|
|
556
|
+
class _ extends y {
|
|
551
557
|
constructor(t = "Not Implemented") {
|
|
552
558
|
super(t);
|
|
553
559
|
}
|
|
@@ -556,7 +562,7 @@ class _ extends g {
|
|
|
556
562
|
}
|
|
557
563
|
}
|
|
558
564
|
c(_, "code", 501);
|
|
559
|
-
class tt extends
|
|
565
|
+
class tt extends y {
|
|
560
566
|
constructor(t = "Bad Gateway") {
|
|
561
567
|
super(t);
|
|
562
568
|
}
|
|
@@ -565,7 +571,7 @@ class tt extends g {
|
|
|
565
571
|
}
|
|
566
572
|
}
|
|
567
573
|
c(tt, "code", 502);
|
|
568
|
-
class et extends
|
|
574
|
+
class et extends y {
|
|
569
575
|
constructor(t = "Service Unavailable") {
|
|
570
576
|
super(t);
|
|
571
577
|
}
|
|
@@ -574,7 +580,7 @@ class et extends g {
|
|
|
574
580
|
}
|
|
575
581
|
}
|
|
576
582
|
c(et, "code", 503);
|
|
577
|
-
class
|
|
583
|
+
class rt extends y {
|
|
578
584
|
constructor(t = "Gateway Timeout") {
|
|
579
585
|
super(t);
|
|
580
586
|
}
|
|
@@ -582,10 +588,10 @@ class nt extends g {
|
|
|
582
588
|
return t.constructor.code == this.code;
|
|
583
589
|
}
|
|
584
590
|
}
|
|
585
|
-
c(
|
|
586
|
-
function Gt(
|
|
587
|
-
if (
|
|
588
|
-
switch (
|
|
591
|
+
c(rt, "code", 504);
|
|
592
|
+
function Gt(r, t) {
|
|
593
|
+
if (r >= 200 && r < 300) return null;
|
|
594
|
+
switch (r) {
|
|
589
595
|
case 400:
|
|
590
596
|
return new W(t);
|
|
591
597
|
case 401:
|
|
@@ -609,9 +615,9 @@ function Gt(n, t) {
|
|
|
609
615
|
case 503:
|
|
610
616
|
return new et(t);
|
|
611
617
|
case 504:
|
|
612
|
-
return new
|
|
618
|
+
return new rt(t);
|
|
613
619
|
default:
|
|
614
|
-
return new
|
|
620
|
+
return new y(t, r);
|
|
615
621
|
}
|
|
616
622
|
}
|
|
617
623
|
const E = class E {
|
|
@@ -641,16 +647,16 @@ const E = class E {
|
|
|
641
647
|
const i = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((o) => ({ key: o, value: t.query[o] }));
|
|
642
648
|
e += (e.includes("?") ? "&" : "?") + i.map((o) => `${o.key}=${o.value}`).join("&");
|
|
643
649
|
}
|
|
644
|
-
const
|
|
650
|
+
const n = ot({
|
|
645
651
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
646
652
|
...E.headers,
|
|
647
653
|
...this.headers,
|
|
648
654
|
...t.headers
|
|
649
655
|
});
|
|
650
|
-
return typeof t.body == "object" && t.body != null &&
|
|
656
|
+
return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new x((i, o, a) => {
|
|
651
657
|
try {
|
|
652
658
|
fetch(e, {
|
|
653
|
-
headers:
|
|
659
|
+
headers: n,
|
|
654
660
|
method: t.method || (t.body ? "POST" : "GET"),
|
|
655
661
|
body: t.body
|
|
656
662
|
}).then(async (u) => {
|
|
@@ -659,7 +665,7 @@ const E = class E {
|
|
|
659
665
|
await new Promise((C) => l(u, () => C()));
|
|
660
666
|
const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
|
|
661
667
|
let P = 0;
|
|
662
|
-
const T = (G = u.body) == null ? void 0 : G.getReader(),
|
|
668
|
+
const T = (G = u.body) == null ? void 0 : G.getReader(), nt = new ReadableStream({
|
|
663
669
|
start(l) {
|
|
664
670
|
function C() {
|
|
665
671
|
T == null || T.read().then((A) => {
|
|
@@ -670,7 +676,7 @@ const E = class E {
|
|
|
670
676
|
C();
|
|
671
677
|
}
|
|
672
678
|
});
|
|
673
|
-
if (u.data = new Response(
|
|
679
|
+
if (u.data = new Response(nt), t.decode == null || t.decode) {
|
|
674
680
|
const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
|
|
675
681
|
l != null && l.includes("form") ? u.data = await u.data.formData() : l != null && l.includes("json") ? u.data = await u.data.json() : l != null && l.includes("text") ? u.data = await u.data.text() : l != null && l.includes("application") && (u.data = await u.data.blob());
|
|
676
682
|
}
|
|
@@ -684,8 +690,8 @@ const E = class E {
|
|
|
684
690
|
};
|
|
685
691
|
c(E, "interceptors", {}), c(E, "headers", {});
|
|
686
692
|
let F = E;
|
|
687
|
-
function Ut(
|
|
688
|
-
const t =
|
|
693
|
+
function Ut(r) {
|
|
694
|
+
const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
689
695
|
return I(decodeURIComponent(atob(t).split("").map(function(e) {
|
|
690
696
|
return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
|
|
691
697
|
}).join("")));
|
|
@@ -726,15 +732,15 @@ const R = {
|
|
|
726
732
|
WHITE: "\x1B[47m",
|
|
727
733
|
GREY: "\x1B[100m"
|
|
728
734
|
};
|
|
729
|
-
var ft = /* @__PURE__ */ ((
|
|
735
|
+
var ft = /* @__PURE__ */ ((r) => (r[r.ERROR = 0] = "ERROR", r[r.WARN = 1] = "WARN", r[r.INFO = 2] = "INFO", r[r.LOG = 3] = "LOG", r[r.DEBUG = 4] = "DEBUG", r))(ft || {});
|
|
730
736
|
const w = class w extends K {
|
|
731
737
|
constructor(t) {
|
|
732
738
|
super(), this.namespace = t;
|
|
733
739
|
}
|
|
734
|
-
pad(t, e,
|
|
740
|
+
pad(t, e, n, s = !1) {
|
|
735
741
|
const i = t.toString(), o = e - i.length;
|
|
736
742
|
if (o <= 0) return i;
|
|
737
|
-
const a = Array(~~(o /
|
|
743
|
+
const a = Array(~~(o / n.length)).fill(n).join("");
|
|
738
744
|
return s ? i + a : a + i;
|
|
739
745
|
}
|
|
740
746
|
format(...t) {
|
|
@@ -769,70 +775,70 @@ const w = class w extends K {
|
|
|
769
775
|
};
|
|
770
776
|
c(w, "LOG_LEVEL", 4);
|
|
771
777
|
let Y = w;
|
|
772
|
-
function Ft(
|
|
773
|
-
const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e =
|
|
774
|
-
let
|
|
775
|
-
const i = t(s,
|
|
776
|
-
s = ~~(s / i),
|
|
777
|
-
const o = ~~(s /
|
|
778
|
-
return s -= o *
|
|
779
|
-
}
|
|
780
|
-
function Yt(
|
|
781
|
-
let t =
|
|
778
|
+
function Ft(r) {
|
|
779
|
+
const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e = r.toString().length - 2;
|
|
780
|
+
let n = Math.pow(10, e), s = r * n;
|
|
781
|
+
const i = t(s, n);
|
|
782
|
+
s = ~~(s / i), n = ~~(n / i);
|
|
783
|
+
const o = ~~(s / n);
|
|
784
|
+
return s -= o * n, `${o ? o + " " : ""}${~~s}/${~~n}`;
|
|
785
|
+
}
|
|
786
|
+
function Yt(r) {
|
|
787
|
+
let t = r.split(" ");
|
|
782
788
|
const e = t.length == 2 ? Number(t[0]) : 0;
|
|
783
789
|
return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
|
|
784
790
|
}
|
|
785
791
|
const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ht = D + M + k;
|
|
786
|
-
function Ht(
|
|
787
|
-
if (
|
|
788
|
-
const e = 1024,
|
|
789
|
-
return parseFloat((
|
|
790
|
-
}
|
|
791
|
-
function Kt(
|
|
792
|
-
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(
|
|
793
|
-
if (!t) throw new Error(`Number cannot be parsed: ${
|
|
792
|
+
function Ht(r, t = 2) {
|
|
793
|
+
if (r === 0) return "0 Bytes";
|
|
794
|
+
const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(r) / Math.log(e));
|
|
795
|
+
return parseFloat((r / Math.pow(e, s)).toFixed(t)) + " " + n[s];
|
|
796
|
+
}
|
|
797
|
+
function Kt(r) {
|
|
798
|
+
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(r);
|
|
799
|
+
if (!t) throw new Error(`Number cannot be parsed: ${r}`);
|
|
794
800
|
return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
|
|
795
801
|
}
|
|
796
|
-
function Wt(
|
|
797
|
-
return `${
|
|
802
|
+
function Wt(r, t, e) {
|
|
803
|
+
return `${r.slice(0, e)}${t}${r.slice(e + 1)}`;
|
|
798
804
|
}
|
|
799
|
-
function vt(
|
|
800
|
-
return
|
|
805
|
+
function vt(r, t, e = " ", n = !0) {
|
|
806
|
+
return n ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
|
|
801
807
|
}
|
|
802
|
-
function Jt(
|
|
803
|
-
return Array(
|
|
808
|
+
function Jt(r) {
|
|
809
|
+
return Array(r).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
804
810
|
}
|
|
805
|
-
function zt(
|
|
806
|
-
return Array(
|
|
811
|
+
function zt(r, t = ht) {
|
|
812
|
+
return Array(r).fill(null).map(() => {
|
|
807
813
|
const e = ~~(Math.random() * t.length);
|
|
808
814
|
return t[e];
|
|
809
815
|
}).join("");
|
|
810
816
|
}
|
|
811
|
-
function Zt(
|
|
812
|
-
if (!t && !e && !
|
|
813
|
-
return Array(
|
|
817
|
+
function Zt(r, t = !1, e = !1, n = !1) {
|
|
818
|
+
if (!t && !e && !n) throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
819
|
+
return Array(r).fill(null).map(() => {
|
|
814
820
|
let s;
|
|
815
821
|
do {
|
|
816
822
|
const i = ~~(Math.random() * 3);
|
|
817
|
-
t && i == 0 ? s = D[~~(Math.random() * D.length)] : e && i == 1 ? s = M[~~(Math.random() * M.length)] :
|
|
823
|
+
t && i == 0 ? s = D[~~(Math.random() * D.length)] : e && i == 1 ? s = M[~~(Math.random() * M.length)] : n && i == 2 && (s = k[~~(Math.random() * k.length)]);
|
|
818
824
|
} while (!s);
|
|
819
825
|
return s;
|
|
820
826
|
}).join("");
|
|
821
827
|
}
|
|
822
|
-
function Vt(
|
|
828
|
+
function Vt(r, t) {
|
|
823
829
|
if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
|
|
824
830
|
throw new TypeError("Regular expression must be global.");
|
|
825
|
-
let e = [],
|
|
826
|
-
for (; (
|
|
827
|
-
e.push(
|
|
831
|
+
let e = [], n;
|
|
832
|
+
for (; (n = t.exec(r)) !== null; )
|
|
833
|
+
e.push(n);
|
|
828
834
|
return e;
|
|
829
835
|
}
|
|
830
|
-
function Xt(
|
|
836
|
+
function Xt(r) {
|
|
831
837
|
const t = new RegExp(
|
|
832
838
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
833
839
|
"gm"
|
|
834
|
-
).exec(
|
|
835
|
-
if (e.port != null && (e.port = Number(e.port)),
|
|
840
|
+
).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, n = e.domain.split(".");
|
|
841
|
+
if (e.port != null && (e.port = Number(e.port)), n.length > 2 && (e.domain = n.splice(-2, 2).join("."), e.subdomain = n.join(".")), e.query) {
|
|
836
842
|
const s = e.query.split("&"), i = {};
|
|
837
843
|
s.forEach((o) => {
|
|
838
844
|
const [a, u] = o.split("=");
|
|
@@ -841,76 +847,76 @@ function Xt(n) {
|
|
|
841
847
|
}
|
|
842
848
|
return e;
|
|
843
849
|
}
|
|
844
|
-
function dt(
|
|
845
|
-
var t = pt(
|
|
850
|
+
function dt(r) {
|
|
851
|
+
var t = pt(yt(wt(gt(r), 8 * r.length)));
|
|
846
852
|
return t.toLowerCase();
|
|
847
853
|
}
|
|
848
|
-
function pt(
|
|
849
|
-
for (var t, e = "0123456789ABCDEF",
|
|
850
|
-
return
|
|
854
|
+
function pt(r) {
|
|
855
|
+
for (var t, e = "0123456789ABCDEF", n = "", s = 0; s < r.length; s++) t = r.charCodeAt(s), n += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
856
|
+
return n;
|
|
851
857
|
}
|
|
852
|
-
function
|
|
853
|
-
for (var t = Array(
|
|
854
|
-
for (e = 0; e < 8 *
|
|
858
|
+
function gt(r) {
|
|
859
|
+
for (var t = Array(r.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
|
|
860
|
+
for (e = 0; e < 8 * r.length; e += 8) t[e >> 5] |= (255 & r.charCodeAt(e / 8)) << e % 32;
|
|
855
861
|
return t;
|
|
856
862
|
}
|
|
857
|
-
function
|
|
858
|
-
for (var t = "", e = 0; e < 32 *
|
|
863
|
+
function yt(r) {
|
|
864
|
+
for (var t = "", e = 0; e < 32 * r.length; e += 8) t += String.fromCharCode(r[e >> 5] >>> e % 32 & 255);
|
|
859
865
|
return t;
|
|
860
866
|
}
|
|
861
|
-
function wt(
|
|
862
|
-
|
|
863
|
-
for (var e = 1732584193,
|
|
864
|
-
var a = e, u =
|
|
865
|
-
|
|
867
|
+
function wt(r, t) {
|
|
868
|
+
r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t;
|
|
869
|
+
for (var e = 1732584193, n = -271733879, s = -1732584194, i = 271733878, o = 0; o < r.length; o += 16) {
|
|
870
|
+
var a = e, u = n, $ = s, j = i;
|
|
871
|
+
n = p(n = p(n = p(n = p(n = d(n = d(n = d(n = d(n = h(n = h(n = h(n = h(n = f(n = f(n = f(n = f(n, s = f(s, i = f(i, e = f(e, n, s, i, r[o + 0], 7, -680876936), n, s, r[o + 1], 12, -389564586), e, n, r[o + 2], 17, 606105819), i, e, r[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, n, s, i, r[o + 4], 7, -176418897), n, s, r[o + 5], 12, 1200080426), e, n, r[o + 6], 17, -1473231341), i, e, r[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, n, s, i, r[o + 8], 7, 1770035416), n, s, r[o + 9], 12, -1958414417), e, n, r[o + 10], 17, -42063), i, e, r[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, n, s, i, r[o + 12], 7, 1804603682), n, s, r[o + 13], 12, -40341101), e, n, r[o + 14], 17, -1502002290), i, e, r[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 1], 5, -165796510), n, s, r[o + 6], 9, -1069501632), e, n, r[o + 11], 14, 643717713), i, e, r[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 5], 5, -701558691), n, s, r[o + 10], 9, 38016083), e, n, r[o + 15], 14, -660478335), i, e, r[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 9], 5, 568446438), n, s, r[o + 14], 9, -1019803690), e, n, r[o + 3], 14, -187363961), i, e, r[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 13], 5, -1444681467), n, s, r[o + 2], 9, -51403784), e, n, r[o + 7], 14, 1735328473), i, e, r[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 5], 4, -378558), n, s, r[o + 8], 11, -2022574463), e, n, r[o + 11], 16, 1839030562), i, e, r[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 1], 4, -1530992060), n, s, r[o + 4], 11, 1272893353), e, n, r[o + 7], 16, -155497632), i, e, r[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 13], 4, 681279174), n, s, r[o + 0], 11, -358537222), e, n, r[o + 3], 16, -722521979), i, e, r[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 9], 4, -640364487), n, s, r[o + 12], 11, -421815835), e, n, r[o + 15], 16, 530742520), i, e, r[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 0], 6, -198630844), n, s, r[o + 7], 10, 1126891415), e, n, r[o + 14], 15, -1416354905), i, e, r[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 12], 6, 1700485571), n, s, r[o + 3], 10, -1894986606), e, n, r[o + 10], 15, -1051523), i, e, r[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 8], 6, 1873313359), n, s, r[o + 15], 10, -30611744), e, n, r[o + 6], 15, -1560198380), i, e, r[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 4], 6, -145523070), n, s, r[o + 11], 10, -1120210379), e, n, r[o + 2], 15, 718787259), i, e, r[o + 9], 21, -343485551), e = b(e, a), n = b(n, u), s = b(s, $), i = b(i, j);
|
|
866
872
|
}
|
|
867
|
-
return Array(e,
|
|
873
|
+
return Array(e, n, s, i);
|
|
868
874
|
}
|
|
869
|
-
function N(
|
|
870
|
-
return b(Et(b(b(t,
|
|
875
|
+
function N(r, t, e, n, s, i) {
|
|
876
|
+
return b(Et(b(b(t, r), b(n, i)), s), e);
|
|
871
877
|
}
|
|
872
|
-
function f(
|
|
873
|
-
return N(t & e | ~t &
|
|
878
|
+
function f(r, t, e, n, s, i, o) {
|
|
879
|
+
return N(t & e | ~t & n, r, t, s, i, o);
|
|
874
880
|
}
|
|
875
|
-
function h(
|
|
876
|
-
return N(t &
|
|
881
|
+
function h(r, t, e, n, s, i, o) {
|
|
882
|
+
return N(t & n | e & ~n, r, t, s, i, o);
|
|
877
883
|
}
|
|
878
|
-
function d(
|
|
879
|
-
return N(t ^ e ^
|
|
884
|
+
function d(r, t, e, n, s, i, o) {
|
|
885
|
+
return N(t ^ e ^ n, r, t, s, i, o);
|
|
880
886
|
}
|
|
881
|
-
function p(
|
|
882
|
-
return N(e ^ (t | ~
|
|
887
|
+
function p(r, t, e, n, s, i, o) {
|
|
888
|
+
return N(e ^ (t | ~n), r, t, s, i, o);
|
|
883
889
|
}
|
|
884
|
-
function b(
|
|
885
|
-
var e = (65535 &
|
|
886
|
-
return (
|
|
890
|
+
function b(r, t) {
|
|
891
|
+
var e = (65535 & r) + (65535 & t);
|
|
892
|
+
return (r >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
|
|
887
893
|
}
|
|
888
|
-
function Et(
|
|
889
|
-
return
|
|
894
|
+
function Et(r, t) {
|
|
895
|
+
return r << t | r >>> 32 - t;
|
|
890
896
|
}
|
|
891
|
-
function Qt(
|
|
892
|
-
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
897
|
+
function Qt(r) {
|
|
898
|
+
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(r);
|
|
893
899
|
}
|
|
894
|
-
function _t(
|
|
895
|
-
return
|
|
900
|
+
function _t(r, t = "mp") {
|
|
901
|
+
return r ? `https://www.gravatar.com/avatar/${dt(r)}?d=${t}` : "";
|
|
896
902
|
}
|
|
897
|
-
function te(
|
|
898
|
-
return
|
|
903
|
+
function te(r) {
|
|
904
|
+
return r.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
|
|
899
905
|
}
|
|
900
|
-
function ee(
|
|
906
|
+
function ee(r, ...t) {
|
|
901
907
|
const e = [];
|
|
902
|
-
for (let
|
|
903
|
-
n
|
|
904
|
-
return new
|
|
908
|
+
for (let n = 0; n < r.length || n < t.length; n++)
|
|
909
|
+
r[n] && e.push(r[n]), t[n] && e.push(t[n]);
|
|
910
|
+
return new g(e.join(""));
|
|
905
911
|
}
|
|
906
|
-
function mt(
|
|
912
|
+
function mt(r, ...t) {
|
|
907
913
|
let e = [];
|
|
908
|
-
for (let i = 0; i <
|
|
909
|
-
|
|
910
|
-
const [
|
|
911
|
-
return
|
|
914
|
+
for (let i = 0; i < r.length || i < t.length; i++)
|
|
915
|
+
r[i] && e.push(r[i]), t[i] && e.push(t[i]);
|
|
916
|
+
const [n, s] = e.join("").split(":");
|
|
917
|
+
return g.toString(n, s == null ? void 0 : s.split(""));
|
|
912
918
|
}
|
|
913
|
-
class
|
|
919
|
+
class g {
|
|
914
920
|
constructor(t) {
|
|
915
921
|
/** First directory in path */
|
|
916
922
|
c(this, "module");
|
|
@@ -936,8 +942,8 @@ class y {
|
|
|
936
942
|
c(this, "delete");
|
|
937
943
|
var o;
|
|
938
944
|
if (typeof t == "object") return Object.assign(this, t);
|
|
939
|
-
let [e,
|
|
940
|
-
s || (s =
|
|
945
|
+
let [e, n, s] = t.split(":");
|
|
946
|
+
s || (s = n || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
|
|
941
947
|
let i = e.split("/").filter((a) => !!a);
|
|
942
948
|
this.module = ((o = i.splice(0, 1)[0]) == null ? void 0 : o.toLowerCase()) || "", this.fullPath = e, this.path = i.join("/"), this.name = i.pop() || "", this.methods = s.split(""), this.all = s == null ? void 0 : s.includes("*"), this.none = s == null ? void 0 : s.includes("n"), this.create = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("c"))), this.read = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("r"))), this.update = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("u"))), this.delete = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("d")));
|
|
943
949
|
}
|
|
@@ -950,11 +956,11 @@ class y {
|
|
|
950
956
|
*/
|
|
951
957
|
static combine(t) {
|
|
952
958
|
let e = !1;
|
|
953
|
-
const
|
|
959
|
+
const n = t.map((s) => new g(s)).toSorted((s, i) => {
|
|
954
960
|
const o = s.fullPath.length, a = i.fullPath.length;
|
|
955
961
|
return o < a ? 1 : o > a ? -1 : 0;
|
|
956
962
|
}).reduce((s, i) => (i.none && (e = !0), s ? (e || (i.all && (s.all = !0), (i.all || i.create) && (s.create = !0), (i.all || i.read) && (s.read = !0), (i.all || i.update) && (s.update = !0), (i.all || i.delete) && (s.delete = !0), s.methods = [...s.methods, ...i.methods]), s) : i), null);
|
|
957
|
-
return
|
|
963
|
+
return n.all && (n.methods = ["*"]), n.none && (n.methods = ["n"]), n.methods = new S(n.methods), n.raw = mt`${n.fullPath}:${n.methods}`, n;
|
|
958
964
|
}
|
|
959
965
|
/**
|
|
960
966
|
* Squash 2 sets of paths & return true if any overlap is found
|
|
@@ -964,12 +970,12 @@ class y {
|
|
|
964
970
|
* @return {boolean} Whether there is any overlap
|
|
965
971
|
*/
|
|
966
972
|
static has(t, ...e) {
|
|
967
|
-
const
|
|
968
|
-
return !!
|
|
973
|
+
const n = m(e).map((i) => new g(i)), s = m(t).map((i) => new g(i));
|
|
974
|
+
return !!n.find((i) => {
|
|
969
975
|
if (!i.fullPath && i.all) return !0;
|
|
970
976
|
const o = s.filter((u) => i.fullPath.startsWith(u.fullPath));
|
|
971
977
|
if (!o.length) return !1;
|
|
972
|
-
const a =
|
|
978
|
+
const a = g.combine(o);
|
|
973
979
|
return !a.none && (a.all || new S(a.methods).intersection(new S(i.methods)).length);
|
|
974
980
|
});
|
|
975
981
|
}
|
|
@@ -981,7 +987,7 @@ class y {
|
|
|
981
987
|
* @return {boolean} Whether there is any overlap
|
|
982
988
|
*/
|
|
983
989
|
static hasAll(t, ...e) {
|
|
984
|
-
return e.filter((
|
|
990
|
+
return e.filter((n) => g.has(t, n)).length == e.length;
|
|
985
991
|
}
|
|
986
992
|
/**
|
|
987
993
|
* Same as `has` but raises an error if there is no overlap
|
|
@@ -990,7 +996,7 @@ class y {
|
|
|
990
996
|
* @param has Target must have at least one of these path
|
|
991
997
|
*/
|
|
992
998
|
static hasFatal(t, ...e) {
|
|
993
|
-
if (!
|
|
999
|
+
if (!g.has(t, ...e)) throw new Error(`Requires one of: ${m(e).join(", ")}`);
|
|
994
1000
|
}
|
|
995
1001
|
/**
|
|
996
1002
|
* Same as `hasAll` but raises an error if the target is missing any paths
|
|
@@ -999,7 +1005,7 @@ class y {
|
|
|
999
1005
|
* @param has Target must have all these paths
|
|
1000
1006
|
*/
|
|
1001
1007
|
static hasAllFatal(t, ...e) {
|
|
1002
|
-
if (!
|
|
1008
|
+
if (!g.hasAll(t, ...e)) throw new Error(`Requires all: ${m(e).join(", ")}`);
|
|
1003
1009
|
}
|
|
1004
1010
|
/**
|
|
1005
1011
|
* Create event string from its components
|
|
@@ -1009,8 +1015,8 @@ class y {
|
|
|
1009
1015
|
* @return {string} String representation of Event
|
|
1010
1016
|
*/
|
|
1011
1017
|
static toString(t, e) {
|
|
1012
|
-
let
|
|
1013
|
-
return e != null && e.length && (
|
|
1018
|
+
let n = m(t).filter((s) => s != null).join("/");
|
|
1019
|
+
return e != null && e.length && (n += `:${m(e).map((s) => s.toLowerCase()).join("")}`), n == null ? void 0 : n.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
1014
1020
|
}
|
|
1015
1021
|
/**
|
|
1016
1022
|
* Create event string from its components
|
|
@@ -1018,47 +1024,47 @@ class y {
|
|
|
1018
1024
|
* @return {string} String representation of Event
|
|
1019
1025
|
*/
|
|
1020
1026
|
toString() {
|
|
1021
|
-
return
|
|
1027
|
+
return g.toString(this.fullPath, this.methods);
|
|
1022
1028
|
}
|
|
1023
1029
|
}
|
|
1024
|
-
class
|
|
1030
|
+
class re {
|
|
1025
1031
|
constructor() {
|
|
1026
1032
|
c(this, "listeners", []);
|
|
1027
1033
|
}
|
|
1028
1034
|
emit(t, ...e) {
|
|
1029
|
-
const
|
|
1030
|
-
this.listeners.filter((s) =>
|
|
1035
|
+
const n = new g(t);
|
|
1036
|
+
this.listeners.filter((s) => g.has(s[0], t)).forEach(async (s) => s[1](n, ...e));
|
|
1031
1037
|
}
|
|
1032
1038
|
off(t) {
|
|
1033
1039
|
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
1034
1040
|
}
|
|
1035
1041
|
on(t, e) {
|
|
1036
|
-
return m(t).forEach((
|
|
1042
|
+
return m(t).forEach((n) => this.listeners.push([new g(n), e])), () => this.off(e);
|
|
1037
1043
|
}
|
|
1038
1044
|
once(t, e) {
|
|
1039
|
-
return new Promise((
|
|
1045
|
+
return new Promise((n) => {
|
|
1040
1046
|
const s = this.on(t, (i, ...o) => {
|
|
1041
|
-
|
|
1047
|
+
n(o.length < 2 ? o[0] : o), e && e(i, ...o), s();
|
|
1042
1048
|
});
|
|
1043
1049
|
});
|
|
1044
1050
|
}
|
|
1045
1051
|
relayEvents(t) {
|
|
1046
|
-
t.on("*", (e, ...
|
|
1052
|
+
t.on("*", (e, ...n) => this.emit(e, ...n));
|
|
1047
1053
|
}
|
|
1048
1054
|
}
|
|
1049
|
-
function
|
|
1050
|
-
(typeof
|
|
1051
|
-
let t =
|
|
1052
|
-
return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${
|
|
1055
|
+
function ne(r) {
|
|
1056
|
+
(typeof r == "number" || typeof r == "string") && (r = new Date(r));
|
|
1057
|
+
let t = r.getHours(), e = "AM";
|
|
1058
|
+
return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${r.getFullYear()}-${(r.getMonth() + 1).toString().padStart(2, "0")}-${r.getDate().toString().padStart(2, "0")}, ${t}:${r.getMinutes().toString().padStart(2, "0")} ${e}`;
|
|
1053
1059
|
}
|
|
1054
|
-
function St(
|
|
1055
|
-
return new Promise((t) => setTimeout(t,
|
|
1060
|
+
function St(r) {
|
|
1061
|
+
return new Promise((t) => setTimeout(t, r));
|
|
1056
1062
|
}
|
|
1057
|
-
async function se(
|
|
1058
|
-
for (; await
|
|
1063
|
+
async function se(r, t = 100) {
|
|
1064
|
+
for (; await r(); ) await St(t);
|
|
1059
1065
|
}
|
|
1060
|
-
function ie(
|
|
1061
|
-
return (
|
|
1066
|
+
function ie(r) {
|
|
1067
|
+
return (r instanceof Date ? r.getTime() : r) - (/* @__PURE__ */ new Date()).getTime();
|
|
1062
1068
|
}
|
|
1063
1069
|
function oe() {
|
|
1064
1070
|
return Object.keys({});
|
|
@@ -1071,9 +1077,9 @@ export {
|
|
|
1071
1077
|
qt as CliBackground,
|
|
1072
1078
|
R as CliEffects,
|
|
1073
1079
|
L as CliForeground,
|
|
1074
|
-
|
|
1080
|
+
y as CustomError,
|
|
1075
1081
|
z as ForbiddenError,
|
|
1076
|
-
|
|
1082
|
+
rt as GatewayTimeoutError,
|
|
1077
1083
|
F as Http,
|
|
1078
1084
|
Q as InternalServerError,
|
|
1079
1085
|
I as JSONAttemptParse,
|
|
@@ -1086,8 +1092,8 @@ export {
|
|
|
1086
1092
|
_ as NotImplementedError,
|
|
1087
1093
|
ee as PE,
|
|
1088
1094
|
mt as PES,
|
|
1089
|
-
|
|
1090
|
-
|
|
1095
|
+
g as PathEvent,
|
|
1096
|
+
re as PathEventEmitter,
|
|
1091
1097
|
J as PaymentRequiredError,
|
|
1092
1098
|
x as PromiseProgress,
|
|
1093
1099
|
et as ServiceUnavailableError,
|
|
@@ -1113,7 +1119,7 @@ export {
|
|
|
1113
1119
|
H as flattenObj,
|
|
1114
1120
|
At as formData,
|
|
1115
1121
|
Ht as formatBytes,
|
|
1116
|
-
|
|
1122
|
+
ne as formatDate,
|
|
1117
1123
|
Kt as formatPhoneNumber,
|
|
1118
1124
|
Yt as fracToDec,
|
|
1119
1125
|
_t as gravatar,
|