@ztimson/utils 0.20.12 → 0.21.1
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/README.md +91 -91
- package/dist/aset.d.ts +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +277 -247
- package/dist/index.mjs.map +1 -1
- package/dist/path-events.d.ts +15 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,27 +3,27 @@ var it = (r, t, e) => t in r ? ot(r, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var c = (r, t, e) => it(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
function ct(r, t = !1) {
|
|
5
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,
|
|
7
|
-
(t &&
|
|
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
8
|
}), r;
|
|
9
9
|
}
|
|
10
10
|
function At(r) {
|
|
11
11
|
return structuredClone(r);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function at(r, ...t) {
|
|
14
14
|
return t.forEach((e) => {
|
|
15
|
-
for (const
|
|
16
|
-
e[
|
|
15
|
+
for (const n in e)
|
|
16
|
+
e[n] && typeof e[n] == "object" && !Array.isArray(e[n]) ? (r[n] || (r[n] = {}), at(r[n], e[n])) : r[n] = e[n];
|
|
17
17
|
}), r;
|
|
18
18
|
}
|
|
19
19
|
function B(r, t, e) {
|
|
20
20
|
if (!(r == null || !t))
|
|
21
|
-
return t.split(/[.[\]]/g).filter((
|
|
22
|
-
if ((
|
|
21
|
+
return t.split(/[.[\]]/g).filter((n) => n.length).reduce((n, s, o, i) => {
|
|
22
|
+
if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(n != null && n.hasOwnProperty(s))) {
|
|
23
23
|
if (e == null) return;
|
|
24
|
-
s
|
|
24
|
+
n[s] = {};
|
|
25
25
|
}
|
|
26
|
-
return e !== void 0 && o == i.length - 1 ? s
|
|
26
|
+
return e !== void 0 && o == i.length - 1 ? n[s] = e : n[s];
|
|
27
27
|
}, r);
|
|
28
28
|
}
|
|
29
29
|
function Rt(r) {
|
|
@@ -33,34 +33,34 @@ function Rt(r) {
|
|
|
33
33
|
}
|
|
34
34
|
function K(r, t, e = {}) {
|
|
35
35
|
if (typeof r == "object" && !Array.isArray(r)) {
|
|
36
|
-
for (const
|
|
37
|
-
const
|
|
38
|
-
typeof r[
|
|
36
|
+
for (const n of Object.keys(r)) {
|
|
37
|
+
const s = t ? t + "." + n : n;
|
|
38
|
+
typeof r[n] == "object" ? K(r[n], s, e) : e[s] = r[n];
|
|
39
39
|
}
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function Ot(r) {
|
|
44
44
|
const t = new FormData();
|
|
45
|
-
return Object.entries(r).forEach(([e,
|
|
45
|
+
return Object.entries(r).forEach(([e, n]) => t.append(e, n)), t;
|
|
46
46
|
}
|
|
47
47
|
function q(r, t, e = !1) {
|
|
48
48
|
if (r == null) return e;
|
|
49
|
-
if (Array.isArray(t)) return t.findIndex((
|
|
50
|
-
const
|
|
51
|
-
return
|
|
49
|
+
if (Array.isArray(t)) return t.findIndex((s, o) => !q(r[o], t[o], 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
53
|
function O(r, t) {
|
|
54
|
-
const e = typeof r,
|
|
55
|
-
return e != "object" || r == null ||
|
|
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((o) => O(r[o], t[o]));
|
|
56
56
|
}
|
|
57
57
|
function $t(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
61
|
r.prototype,
|
|
62
|
-
|
|
63
|
-
Object.getOwnPropertyDescriptor(e.prototype,
|
|
62
|
+
n,
|
|
63
|
+
Object.getOwnPropertyDescriptor(e.prototype, n) || /* @__PURE__ */ Object.create(null)
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
@@ -72,29 +72,29 @@ function I(r) {
|
|
|
72
72
|
return r;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function ut(r, t) {
|
|
76
76
|
let e = [];
|
|
77
|
-
return JSON.stringify(r, (
|
|
78
|
-
if (typeof
|
|
79
|
-
if (e.includes(
|
|
80
|
-
e.push(
|
|
77
|
+
return JSON.stringify(r, (n, s) => {
|
|
78
|
+
if (typeof s == "object" && s !== null) {
|
|
79
|
+
if (e.includes(s)) return;
|
|
80
|
+
e.push(s);
|
|
81
81
|
}
|
|
82
|
-
return
|
|
82
|
+
return s;
|
|
83
83
|
}, t);
|
|
84
84
|
}
|
|
85
85
|
function Ct(r, t) {
|
|
86
86
|
return r.indexOf(t) === -1 && r.push(t), r;
|
|
87
87
|
}
|
|
88
88
|
function Lt(r, t) {
|
|
89
|
-
return
|
|
90
|
-
...r.filter((e) => !t.includes((
|
|
91
|
-
...t.filter((e) => !r.includes((
|
|
89
|
+
return ht([
|
|
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
94
|
function Nt(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
100
|
function jt(r, t) {
|
|
@@ -104,20 +104,20 @@ function lt(r, t = []) {
|
|
|
104
104
|
return r.forEach((e) => Array.isArray(e) ? lt(e, t) : t.push(e)), t;
|
|
105
105
|
}
|
|
106
106
|
function Tt(r, t = !1) {
|
|
107
|
-
return function(e,
|
|
108
|
-
const
|
|
109
|
-
return typeof
|
|
107
|
+
return function(e, n) {
|
|
108
|
+
const s = B(e, r), o = B(n, r);
|
|
109
|
+
return typeof s == "number" && typeof o == "number" ? (t ? -1 : 1) * (s - o) : s > o ? t ? -1 : 1 : s < o ? t ? 1 : -1 : 0;
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ht(r) {
|
|
113
113
|
for (let t = r.length - 1; t >= 0; t--)
|
|
114
114
|
r.slice(0, t).find((e) => O(e, r[t])) && r.splice(t, 1);
|
|
115
115
|
return r;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function S(r) {
|
|
118
118
|
return Array.isArray(r) ? r : [r];
|
|
119
119
|
}
|
|
120
|
-
class
|
|
120
|
+
class w extends Array {
|
|
121
121
|
/** Number of elements in set */
|
|
122
122
|
get size() {
|
|
123
123
|
return this.length;
|
|
@@ -134,17 +134,17 @@ class S extends Array {
|
|
|
134
134
|
* @param items
|
|
135
135
|
*/
|
|
136
136
|
add(...t) {
|
|
137
|
-
t.filter((e) => !this.has(e)).forEach((e) => this.push(e));
|
|
137
|
+
return t.filter((e) => !this.has(e)).forEach((e) => this.push(e)), this;
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* Delete elements from set
|
|
141
141
|
* @param items Elements that will be deleted
|
|
142
142
|
*/
|
|
143
143
|
delete(...t) {
|
|
144
|
-
t.forEach((e) => {
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
});
|
|
144
|
+
return t.forEach((e) => {
|
|
145
|
+
const n = this.indexOf(e);
|
|
146
|
+
n != -1 && this.slice(n, 1);
|
|
147
|
+
}), this;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Create list of elements this set has which the comparison set does not
|
|
@@ -152,7 +152,7 @@ class S extends Array {
|
|
|
152
152
|
* @return {ASet<T>} Different elements
|
|
153
153
|
*/
|
|
154
154
|
difference(t) {
|
|
155
|
-
return new
|
|
155
|
+
return new w(this.filter((e) => !t.has(e)));
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Check if set includes element
|
|
@@ -168,7 +168,7 @@ class S extends Array {
|
|
|
168
168
|
* @return {boolean} Set of common elements
|
|
169
169
|
*/
|
|
170
170
|
intersection(t) {
|
|
171
|
-
return new
|
|
171
|
+
return new w(this.filter((e) => t.has(e)));
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* Check if this set has no elements in common with the comparison set
|
|
@@ -200,7 +200,7 @@ class S extends Array {
|
|
|
200
200
|
* @return {ASet<T>} New set of unique elements
|
|
201
201
|
*/
|
|
202
202
|
symmetricDifference(t) {
|
|
203
|
-
return new
|
|
203
|
+
return new w([...this.difference(t), ...t.difference(this)]);
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
206
|
* Create joined list of elements included in this & the comparison set
|
|
@@ -208,7 +208,7 @@ class S extends Array {
|
|
|
208
208
|
* @return {ASet<T>} New set of both previous sets combined
|
|
209
209
|
*/
|
|
210
210
|
union(t) {
|
|
211
|
-
return new
|
|
211
|
+
return new w([...this, ...t]);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
class It {
|
|
@@ -229,16 +229,16 @@ class It {
|
|
|
229
229
|
*/
|
|
230
230
|
c(this, "values", this.all());
|
|
231
231
|
if (this.key = t, this.options = e, e.storageKey && !e.storage && typeof Storage < "u" && (e.storage = localStorage), e.storageKey && e.storage) {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
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, o) => (s in n ? n[s] = o : n.store[s] = o, !0)
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
getKey(t) {
|
|
@@ -261,8 +261,8 @@ class It {
|
|
|
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,7 @@ class It {
|
|
|
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
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Remove all keys from cache
|
|
@@ -327,20 +327,20 @@ class It {
|
|
|
327
327
|
* @param {number | undefined} ttl Override default expiry in seconds
|
|
328
328
|
* @return {this}
|
|
329
329
|
*/
|
|
330
|
-
set(t, e,
|
|
331
|
-
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(() => {
|
|
332
332
|
this.complete = !1, this.delete(t);
|
|
333
|
-
},
|
|
333
|
+
}, n * 1e3), this;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
function Dt(r, t = !0) {
|
|
337
|
-
const e = r.reduce((
|
|
338
|
-
|
|
339
|
-
}),
|
|
337
|
+
const e = r.reduce((n, s) => (Object.keys(t ? K(s) : s).forEach((o) => {
|
|
338
|
+
n.includes(o) || n.push(o);
|
|
339
|
+
}), n), []);
|
|
340
340
|
return [
|
|
341
341
|
e.join(","),
|
|
342
|
-
...r.map((
|
|
343
|
-
const o = B(
|
|
342
|
+
...r.map((n) => e.map((s) => {
|
|
343
|
+
const o = B(n, s), i = typeof o;
|
|
344
344
|
return i == "string" && o.includes(",") ? `"${o}"` : i == "object" ? `"${JSON.stringify(o)}"` : o;
|
|
345
345
|
}).join(","))
|
|
346
346
|
].join(`
|
|
@@ -348,9 +348,9 @@ function Dt(r, t = !0) {
|
|
|
348
348
|
}
|
|
349
349
|
class b extends Promise {
|
|
350
350
|
constructor(e) {
|
|
351
|
-
super((
|
|
352
|
-
(o) => s(o),
|
|
351
|
+
super((n, s) => e(
|
|
353
352
|
(o) => n(o),
|
|
353
|
+
(o) => s(o),
|
|
354
354
|
(o) => this.progress = o
|
|
355
355
|
));
|
|
356
356
|
c(this, "listeners", []);
|
|
@@ -360,21 +360,21 @@ class b extends Promise {
|
|
|
360
360
|
return this._progress;
|
|
361
361
|
}
|
|
362
362
|
set progress(e) {
|
|
363
|
-
e != this._progress && (this._progress = e, this.listeners.forEach((
|
|
363
|
+
e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
|
|
364
364
|
}
|
|
365
365
|
static from(e) {
|
|
366
|
-
return e instanceof b ? e : new b((
|
|
366
|
+
return e instanceof b ? e : new b((n, s) => e.then((...o) => n(...o)).catch((...o) => s(...o)));
|
|
367
367
|
}
|
|
368
368
|
from(e) {
|
|
369
|
-
const
|
|
370
|
-
return this.onProgress((
|
|
369
|
+
const n = b.from(e);
|
|
370
|
+
return this.onProgress((s) => n.progress = s), n;
|
|
371
371
|
}
|
|
372
372
|
onProgress(e) {
|
|
373
373
|
return this.listeners.push(e), this;
|
|
374
374
|
}
|
|
375
|
-
then(e,
|
|
376
|
-
const
|
|
377
|
-
return this.from(
|
|
375
|
+
then(e, n) {
|
|
376
|
+
const s = super.then(e, n);
|
|
377
|
+
return this.from(s);
|
|
378
378
|
}
|
|
379
379
|
catch(e) {
|
|
380
380
|
return this.from(super.catch(e));
|
|
@@ -384,11 +384,11 @@ class b extends Promise {
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
function Mt(r, t) {
|
|
387
|
-
r instanceof Blob || (r = new Blob(
|
|
387
|
+
r instanceof Blob || (r = new Blob(S(r)));
|
|
388
388
|
const e = URL.createObjectURL(r);
|
|
389
|
-
|
|
389
|
+
ft(e, t), URL.revokeObjectURL(e);
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function ft(r, t) {
|
|
392
392
|
const e = document.createElement("a");
|
|
393
393
|
e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
394
394
|
}
|
|
@@ -406,9 +406,9 @@ function Pt(r, t = /* @__PURE__ */ new Date()) {
|
|
|
406
406
|
return r ? r.replace("{{TIMESTAMP}}", e) : e;
|
|
407
407
|
}
|
|
408
408
|
function Gt(r) {
|
|
409
|
-
return new b((t, e,
|
|
410
|
-
const
|
|
411
|
-
r.files.forEach((i) => o.append("file", i)),
|
|
409
|
+
return new b((t, e, n) => {
|
|
410
|
+
const s = new XMLHttpRequest(), o = new FormData();
|
|
411
|
+
r.files.forEach((i) => o.append("file", i)), s.withCredentials = !!r.withCredentials, s.upload.addEventListener("progress", (i) => i.lengthComputable ? n(i.loaded / i.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(([i, u]) => s.setRequestHeader(i, u)), s.send(o);
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
class W {
|
|
@@ -416,48 +416,48 @@ class W {
|
|
|
416
416
|
c(this, "listeners", {});
|
|
417
417
|
}
|
|
418
418
|
static emit(t, ...e) {
|
|
419
|
-
(this.listeners["*"] || []).forEach((
|
|
419
|
+
(this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t.toString()] || []).forEach((n) => n(...e));
|
|
420
420
|
}
|
|
421
421
|
static off(t, e) {
|
|
422
|
-
const
|
|
423
|
-
this.listeners[
|
|
422
|
+
const n = t.toString();
|
|
423
|
+
this.listeners[n] = (this.listeners[n] || []).filter((s) => s === e);
|
|
424
424
|
}
|
|
425
425
|
static on(t, e) {
|
|
426
|
-
var
|
|
427
|
-
const
|
|
428
|
-
return this.listeners[
|
|
426
|
+
var s;
|
|
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);
|
|
429
429
|
}
|
|
430
430
|
static once(t, e) {
|
|
431
|
-
return new Promise((
|
|
432
|
-
const
|
|
433
|
-
|
|
431
|
+
return new Promise((n) => {
|
|
432
|
+
const s = this.on(t, (...o) => {
|
|
433
|
+
n(o.length == 1 ? o[0] : o), e && e(...o), s();
|
|
434
434
|
});
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
437
|
emit(t, ...e) {
|
|
438
|
-
(this.listeners["*"] || []).forEach((
|
|
438
|
+
(this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t] || []).forEach((n) => n(...e));
|
|
439
439
|
}
|
|
440
440
|
off(t, e) {
|
|
441
|
-
this.listeners[t] = (this.listeners[t] || []).filter((
|
|
441
|
+
this.listeners[t] = (this.listeners[t] || []).filter((n) => n === e);
|
|
442
442
|
}
|
|
443
443
|
on(t, e) {
|
|
444
|
-
var
|
|
445
|
-
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);
|
|
446
446
|
}
|
|
447
447
|
once(t, e) {
|
|
448
|
-
return new Promise((
|
|
449
|
-
const
|
|
450
|
-
|
|
448
|
+
return new Promise((n) => {
|
|
449
|
+
const s = this.on(t, (...o) => {
|
|
450
|
+
n(o.length == 1 ? o[0] : o), e && e(...o), s();
|
|
451
451
|
});
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
c(W, "listeners", {});
|
|
456
|
-
class
|
|
457
|
-
constructor(e,
|
|
456
|
+
class m extends Error {
|
|
457
|
+
constructor(e, n) {
|
|
458
458
|
super(e);
|
|
459
459
|
c(this, "_code");
|
|
460
|
-
|
|
460
|
+
n != null && (this._code = n);
|
|
461
461
|
}
|
|
462
462
|
get code() {
|
|
463
463
|
return this._code || this.constructor.code;
|
|
@@ -466,11 +466,11 @@ class g extends Error {
|
|
|
466
466
|
this._code = e;
|
|
467
467
|
}
|
|
468
468
|
static from(e) {
|
|
469
|
-
const
|
|
470
|
-
return Object.assign(
|
|
469
|
+
const n = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
|
|
470
|
+
return Object.assign(s, {
|
|
471
471
|
stack: e.stack,
|
|
472
472
|
...e,
|
|
473
|
-
code:
|
|
473
|
+
code: n ?? void 0
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
static instanceof(e) {
|
|
@@ -480,8 +480,8 @@ class g extends Error {
|
|
|
480
480
|
return this.message || super.toString();
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
c(
|
|
484
|
-
class v extends
|
|
483
|
+
c(m, "code", 500);
|
|
484
|
+
class v extends m {
|
|
485
485
|
constructor(t = "Bad Request") {
|
|
486
486
|
super(t);
|
|
487
487
|
}
|
|
@@ -490,7 +490,7 @@ class v extends g {
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
c(v, "code", 400);
|
|
493
|
-
class J extends
|
|
493
|
+
class J extends m {
|
|
494
494
|
constructor(t = "Unauthorized") {
|
|
495
495
|
super(t);
|
|
496
496
|
}
|
|
@@ -499,7 +499,7 @@ class J extends g {
|
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
c(J, "code", 401);
|
|
502
|
-
class z extends
|
|
502
|
+
class z extends m {
|
|
503
503
|
constructor(t = "Payment Required") {
|
|
504
504
|
super(t);
|
|
505
505
|
}
|
|
@@ -508,7 +508,7 @@ class z extends g {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
c(z, "code", 402);
|
|
511
|
-
class Z extends
|
|
511
|
+
class Z extends m {
|
|
512
512
|
constructor(t = "Forbidden") {
|
|
513
513
|
super(t);
|
|
514
514
|
}
|
|
@@ -517,7 +517,7 @@ class Z extends g {
|
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
c(Z, "code", 403);
|
|
520
|
-
class V extends
|
|
520
|
+
class V extends m {
|
|
521
521
|
constructor(t = "Not Found") {
|
|
522
522
|
super(t);
|
|
523
523
|
}
|
|
@@ -526,7 +526,7 @@ class V extends g {
|
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
c(V, "code", 404);
|
|
529
|
-
class X extends
|
|
529
|
+
class X extends m {
|
|
530
530
|
constructor(t = "Method Not Allowed") {
|
|
531
531
|
super(t);
|
|
532
532
|
}
|
|
@@ -535,7 +535,7 @@ class X extends g {
|
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
c(X, "code", 405);
|
|
538
|
-
class Q extends
|
|
538
|
+
class Q extends m {
|
|
539
539
|
constructor(t = "Not Acceptable") {
|
|
540
540
|
super(t);
|
|
541
541
|
}
|
|
@@ -544,7 +544,7 @@ class Q extends g {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
c(Q, "code", 406);
|
|
547
|
-
class _ extends
|
|
547
|
+
class _ extends m {
|
|
548
548
|
constructor(t = "Internal Server Error") {
|
|
549
549
|
super(t);
|
|
550
550
|
}
|
|
@@ -553,7 +553,7 @@ class _ extends g {
|
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
c(_, "code", 500);
|
|
556
|
-
class tt extends
|
|
556
|
+
class tt extends m {
|
|
557
557
|
constructor(t = "Not Implemented") {
|
|
558
558
|
super(t);
|
|
559
559
|
}
|
|
@@ -562,7 +562,7 @@ class tt extends g {
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
c(tt, "code", 501);
|
|
565
|
-
class et extends
|
|
565
|
+
class et extends m {
|
|
566
566
|
constructor(t = "Bad Gateway") {
|
|
567
567
|
super(t);
|
|
568
568
|
}
|
|
@@ -571,7 +571,7 @@ class et extends g {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
c(et, "code", 502);
|
|
574
|
-
class rt extends
|
|
574
|
+
class rt extends m {
|
|
575
575
|
constructor(t = "Service Unavailable") {
|
|
576
576
|
super(t);
|
|
577
577
|
}
|
|
@@ -580,7 +580,7 @@ class rt extends g {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
c(rt, "code", 503);
|
|
583
|
-
class nt extends
|
|
583
|
+
class nt extends m {
|
|
584
584
|
constructor(t = "Gateway Timeout") {
|
|
585
585
|
super(t);
|
|
586
586
|
}
|
|
@@ -617,7 +617,7 @@ function Ut(r, t) {
|
|
|
617
617
|
case 504:
|
|
618
618
|
return new nt(t);
|
|
619
619
|
default:
|
|
620
|
-
return new
|
|
620
|
+
return new m(t, r);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
const E = class E {
|
|
@@ -640,50 +640,50 @@ const E = class E {
|
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
642
|
request(t = {}) {
|
|
643
|
-
var
|
|
643
|
+
var s;
|
|
644
644
|
if (!this.url && !t.url) throw new Error("URL needs to be set");
|
|
645
|
-
let e = ((
|
|
645
|
+
let e = ((s = t.url) != null && s.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
|
|
646
646
|
if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (o, i) => `#${t.fragment}${i}`) : e += "#" + t.fragment), t.query) {
|
|
647
647
|
const o = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((i) => ({ key: i, value: t.query[i] }));
|
|
648
648
|
e += (e.includes("?") ? "&" : "?") + o.map((i) => `${i.key}=${i.value}`).join("&");
|
|
649
649
|
}
|
|
650
|
-
const
|
|
650
|
+
const n = ct({
|
|
651
651
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
652
652
|
...E.headers,
|
|
653
653
|
...this.headers,
|
|
654
654
|
...t.headers
|
|
655
655
|
});
|
|
656
|
-
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 b((o, i, u) => {
|
|
657
657
|
try {
|
|
658
658
|
fetch(e, {
|
|
659
|
-
headers:
|
|
659
|
+
headers: n,
|
|
660
660
|
method: t.method || (t.body ? "POST" : "GET"),
|
|
661
661
|
body: t.body
|
|
662
|
-
}).then(async (
|
|
662
|
+
}).then(async (a) => {
|
|
663
663
|
var G, U;
|
|
664
664
|
for (let l of [...Object.values(E.interceptors), ...Object.values(this.interceptors)])
|
|
665
|
-
await new Promise((C) => l(
|
|
666
|
-
const $ =
|
|
665
|
+
await new Promise((C) => l(a, () => C()));
|
|
666
|
+
const $ = a.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
|
|
667
667
|
let P = 0;
|
|
668
|
-
const T = (G =
|
|
668
|
+
const T = (G = a.body) == null ? void 0 : G.getReader(), st = new ReadableStream({
|
|
669
669
|
start(l) {
|
|
670
670
|
function C() {
|
|
671
671
|
T == null || T.read().then((A) => {
|
|
672
672
|
if (A.done) return l.close();
|
|
673
|
-
P += A.value.byteLength,
|
|
673
|
+
P += A.value.byteLength, u(P / j), l.enqueue(A.value), C();
|
|
674
674
|
}).catch((A) => l.error(A));
|
|
675
675
|
}
|
|
676
676
|
C();
|
|
677
677
|
}
|
|
678
678
|
});
|
|
679
|
-
if (
|
|
680
|
-
const l = (U =
|
|
681
|
-
l != null && l.includes("form") ?
|
|
679
|
+
if (a.data = new Response(st), t.decode == null || t.decode) {
|
|
680
|
+
const l = (U = a.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
|
|
681
|
+
l != null && l.includes("form") ? a.data = await a.data.formData() : l != null && l.includes("json") ? a.data = await a.data.json() : l != null && l.includes("text") ? a.data = await a.data.text() : l != null && l.includes("application") && (a.data = await a.data.blob());
|
|
682
682
|
}
|
|
683
|
-
|
|
684
|
-
}).catch((
|
|
685
|
-
} catch (
|
|
686
|
-
i(
|
|
683
|
+
a.ok ? o(a) : i(a);
|
|
684
|
+
}).catch((a) => i(a));
|
|
685
|
+
} catch (a) {
|
|
686
|
+
i(a);
|
|
687
687
|
}
|
|
688
688
|
});
|
|
689
689
|
}
|
|
@@ -733,49 +733,49 @@ const R = {
|
|
|
733
733
|
GREY: "\x1B[100m"
|
|
734
734
|
};
|
|
735
735
|
var dt = /* @__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))(dt || {});
|
|
736
|
-
const
|
|
736
|
+
const y = class y extends W {
|
|
737
737
|
constructor(t) {
|
|
738
738
|
super(), this.namespace = t;
|
|
739
739
|
}
|
|
740
740
|
format(...t) {
|
|
741
741
|
const e = /* @__PURE__ */ new Date();
|
|
742
|
-
return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}:${e.getSeconds().toString().padStart(2, "0")}.${e.getMilliseconds().toString().padEnd(3, "0")}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.map((
|
|
742
|
+
return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}:${e.getSeconds().toString().padStart(2, "0")}.${e.getMilliseconds().toString().padEnd(3, "0")}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.map((s) => typeof s == "string" ? s : ut(s, 2)).join(" ")}`;
|
|
743
743
|
}
|
|
744
744
|
debug(...t) {
|
|
745
|
-
if (
|
|
745
|
+
if (y.LOG_LEVEL < 4) return;
|
|
746
746
|
const e = this.format(...t);
|
|
747
|
-
|
|
747
|
+
y.emit(4, e), console.debug(L.LIGHT_GREY + e + R.CLEAR);
|
|
748
748
|
}
|
|
749
749
|
log(...t) {
|
|
750
|
-
if (
|
|
750
|
+
if (y.LOG_LEVEL < 3) return;
|
|
751
751
|
const e = this.format(...t);
|
|
752
|
-
|
|
752
|
+
y.emit(3, e), console.log(R.CLEAR + e);
|
|
753
753
|
}
|
|
754
754
|
info(...t) {
|
|
755
|
-
if (
|
|
755
|
+
if (y.LOG_LEVEL < 2) return;
|
|
756
756
|
const e = this.format(...t);
|
|
757
|
-
|
|
757
|
+
y.emit(2, e), console.info(L.BLUE + e + R.CLEAR);
|
|
758
758
|
}
|
|
759
759
|
warn(...t) {
|
|
760
|
-
if (
|
|
760
|
+
if (y.LOG_LEVEL < 1) return;
|
|
761
761
|
const e = this.format(...t);
|
|
762
|
-
|
|
762
|
+
y.emit(1, e), console.warn(L.YELLOW + e + R.CLEAR);
|
|
763
763
|
}
|
|
764
764
|
error(...t) {
|
|
765
|
-
if (
|
|
765
|
+
if (y.LOG_LEVEL < 0) return;
|
|
766
766
|
const e = this.format(...t);
|
|
767
|
-
|
|
767
|
+
y.emit(0, e), console.error(L.RED + e + R.CLEAR);
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
|
-
c(
|
|
771
|
-
let Y =
|
|
770
|
+
c(y, "LOG_LEVEL", 4);
|
|
771
|
+
let Y = y;
|
|
772
772
|
function Yt(r) {
|
|
773
|
-
const t = (
|
|
774
|
-
let
|
|
775
|
-
const o = t(
|
|
776
|
-
|
|
777
|
-
const i = ~~(
|
|
778
|
-
return
|
|
773
|
+
const t = (u, a) => a < 1e-7 ? u : t(a, ~~(u % a)), e = r.toString().length - 2;
|
|
774
|
+
let n = Math.pow(10, e), s = r * n;
|
|
775
|
+
const o = t(s, n);
|
|
776
|
+
s = ~~(s / o), n = ~~(n / o);
|
|
777
|
+
const i = ~~(s / n);
|
|
778
|
+
return s -= i * n, `${i ? i + " " : ""}${~~s}/${~~n}`;
|
|
779
779
|
}
|
|
780
780
|
function Ht(r) {
|
|
781
781
|
let t = r.split(" ");
|
|
@@ -785,8 +785,8 @@ function Ht(r) {
|
|
|
785
785
|
const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", pt = D + M + k;
|
|
786
786
|
function Kt(r, t = 2) {
|
|
787
787
|
if (r === 0) return "0 Bytes";
|
|
788
|
-
const e = 1024,
|
|
789
|
-
return parseFloat((r / Math.pow(e,
|
|
788
|
+
const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(r) / Math.log(e));
|
|
789
|
+
return parseFloat((r / Math.pow(e, s)).toFixed(t)) + " " + n[s];
|
|
790
790
|
}
|
|
791
791
|
function Wt(r) {
|
|
792
792
|
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(r);
|
|
@@ -796,8 +796,8 @@ function Wt(r) {
|
|
|
796
796
|
function vt(r, t, e) {
|
|
797
797
|
return `${r.slice(0, e)}${t}${r.slice(e + 1)}`;
|
|
798
798
|
}
|
|
799
|
-
function Jt(r, t, e = " ",
|
|
800
|
-
return
|
|
799
|
+
function Jt(r, t, e = " ", n = !0) {
|
|
800
|
+
return n ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
|
|
801
801
|
}
|
|
802
802
|
function zt(r) {
|
|
803
803
|
return Array(r).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
@@ -808,78 +808,78 @@ function Zt(r, t = pt) {
|
|
|
808
808
|
return t[e];
|
|
809
809
|
}).join("");
|
|
810
810
|
}
|
|
811
|
-
function Vt(r, t = !1, e = !1,
|
|
812
|
-
if (!t && !e && !
|
|
811
|
+
function Vt(r, t = !1, e = !1, n = !1) {
|
|
812
|
+
if (!t && !e && !n) throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
813
813
|
return Array(r).fill(null).map(() => {
|
|
814
|
-
let
|
|
814
|
+
let s;
|
|
815
815
|
do {
|
|
816
816
|
const o = ~~(Math.random() * 3);
|
|
817
|
-
t && o == 0 ?
|
|
818
|
-
} while (!
|
|
819
|
-
return
|
|
817
|
+
t && o == 0 ? s = D[~~(Math.random() * D.length)] : e && o == 1 ? s = M[~~(Math.random() * M.length)] : n && o == 2 && (s = k[~~(Math.random() * k.length)]);
|
|
818
|
+
} while (!s);
|
|
819
|
+
return s;
|
|
820
820
|
}).join("");
|
|
821
821
|
}
|
|
822
822
|
function Xt(r, t) {
|
|
823
823
|
if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
|
|
824
824
|
throw new TypeError("Regular expression must be global.");
|
|
825
|
-
let e = [],
|
|
826
|
-
for (; (
|
|
827
|
-
e.push(
|
|
825
|
+
let e = [], n;
|
|
826
|
+
for (; (n = t.exec(r)) !== null; )
|
|
827
|
+
e.push(n);
|
|
828
828
|
return e;
|
|
829
829
|
}
|
|
830
830
|
function Qt(r) {
|
|
831
831
|
const t = new RegExp(
|
|
832
832
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
833
833
|
"gm"
|
|
834
|
-
).exec(r), e = (t == null ? void 0 : t.groups) ?? {},
|
|
835
|
-
if (e.port != null && (e.port = Number(e.port)),
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
const [
|
|
839
|
-
o[
|
|
834
|
+
).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, n = e.domain.split(".");
|
|
835
|
+
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
|
+
const s = e.query.split("&"), o = {};
|
|
837
|
+
s.forEach((i) => {
|
|
838
|
+
const [u, a] = i.split("=");
|
|
839
|
+
o[u] = a;
|
|
840
840
|
}), e.query = o;
|
|
841
841
|
}
|
|
842
842
|
return e;
|
|
843
843
|
}
|
|
844
|
-
function
|
|
845
|
-
var t =
|
|
844
|
+
function gt(r) {
|
|
845
|
+
var t = mt(wt(Et(yt(r), 8 * r.length)));
|
|
846
846
|
return t.toLowerCase();
|
|
847
847
|
}
|
|
848
|
-
function
|
|
849
|
-
for (var t, e = "0123456789ABCDEF",
|
|
850
|
-
return
|
|
848
|
+
function mt(r) {
|
|
849
|
+
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);
|
|
850
|
+
return n;
|
|
851
851
|
}
|
|
852
|
-
function
|
|
852
|
+
function yt(r) {
|
|
853
853
|
for (var t = Array(r.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
|
|
854
854
|
for (e = 0; e < 8 * r.length; e += 8) t[e >> 5] |= (255 & r.charCodeAt(e / 8)) << e % 32;
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function wt(r) {
|
|
858
858
|
for (var t = "", e = 0; e < 32 * r.length; e += 8) t += String.fromCharCode(r[e >> 5] >>> e % 32 & 255);
|
|
859
859
|
return t;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function Et(r, t) {
|
|
862
862
|
r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t;
|
|
863
|
-
for (var e = 1732584193,
|
|
864
|
-
var
|
|
865
|
-
|
|
863
|
+
for (var e = 1732584193, n = -271733879, s = -1732584194, o = 271733878, i = 0; i < r.length; i += 16) {
|
|
864
|
+
var u = e, a = n, $ = s, j = o;
|
|
865
|
+
n = p(n = p(n = p(n = p(n = d(n = d(n = d(n = d(n = f(n = f(n = f(n = f(n = h(n = h(n = h(n = h(n, s = h(s, o = h(o, e = h(e, n, s, o, r[i + 0], 7, -680876936), n, s, r[i + 1], 12, -389564586), e, n, r[i + 2], 17, 606105819), o, e, r[i + 3], 22, -1044525330), s = h(s, o = h(o, e = h(e, n, s, o, r[i + 4], 7, -176418897), n, s, r[i + 5], 12, 1200080426), e, n, r[i + 6], 17, -1473231341), o, e, r[i + 7], 22, -45705983), s = h(s, o = h(o, e = h(e, n, s, o, r[i + 8], 7, 1770035416), n, s, r[i + 9], 12, -1958414417), e, n, r[i + 10], 17, -42063), o, e, r[i + 11], 22, -1990404162), s = h(s, o = h(o, e = h(e, n, s, o, r[i + 12], 7, 1804603682), n, s, r[i + 13], 12, -40341101), e, n, r[i + 14], 17, -1502002290), o, e, r[i + 15], 22, 1236535329), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 1], 5, -165796510), n, s, r[i + 6], 9, -1069501632), e, n, r[i + 11], 14, 643717713), o, e, r[i + 0], 20, -373897302), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 5], 5, -701558691), n, s, r[i + 10], 9, 38016083), e, n, r[i + 15], 14, -660478335), o, e, r[i + 4], 20, -405537848), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 9], 5, 568446438), n, s, r[i + 14], 9, -1019803690), e, n, r[i + 3], 14, -187363961), o, e, r[i + 8], 20, 1163531501), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 13], 5, -1444681467), n, s, r[i + 2], 9, -51403784), e, n, r[i + 7], 14, 1735328473), o, e, r[i + 12], 20, -1926607734), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 5], 4, -378558), n, s, r[i + 8], 11, -2022574463), e, n, r[i + 11], 16, 1839030562), o, e, r[i + 14], 23, -35309556), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 1], 4, -1530992060), n, s, r[i + 4], 11, 1272893353), e, n, r[i + 7], 16, -155497632), o, e, r[i + 10], 23, -1094730640), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 13], 4, 681279174), n, s, r[i + 0], 11, -358537222), e, n, r[i + 3], 16, -722521979), o, e, r[i + 6], 23, 76029189), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 9], 4, -640364487), n, s, r[i + 12], 11, -421815835), e, n, r[i + 15], 16, 530742520), o, e, r[i + 2], 23, -995338651), s = p(s, o = p(o, e = p(e, n, s, o, r[i + 0], 6, -198630844), n, s, r[i + 7], 10, 1126891415), e, n, r[i + 14], 15, -1416354905), o, e, r[i + 5], 21, -57434055), s = p(s, o = p(o, e = p(e, n, s, o, r[i + 12], 6, 1700485571), n, s, r[i + 3], 10, -1894986606), e, n, r[i + 10], 15, -1051523), o, e, r[i + 1], 21, -2054922799), s = p(s, o = p(o, e = p(e, n, s, o, r[i + 8], 6, 1873313359), n, s, r[i + 15], 10, -30611744), e, n, r[i + 6], 15, -1560198380), o, e, r[i + 13], 21, 1309151649), s = p(s, o = p(o, e = p(e, n, s, o, r[i + 4], 6, -145523070), n, s, r[i + 11], 10, -1120210379), e, n, r[i + 2], 15, 718787259), o, e, r[i + 9], 21, -343485551), e = x(e, u), n = x(n, a), s = x(s, $), o = x(o, j);
|
|
866
866
|
}
|
|
867
|
-
return Array(e,
|
|
867
|
+
return Array(e, n, s, o);
|
|
868
868
|
}
|
|
869
|
-
function N(r, t, e,
|
|
870
|
-
return x(St(x(x(t, r), x(
|
|
869
|
+
function N(r, t, e, n, s, o) {
|
|
870
|
+
return x(St(x(x(t, r), x(n, o)), s), e);
|
|
871
871
|
}
|
|
872
|
-
function
|
|
873
|
-
return N(t & e | ~t &
|
|
872
|
+
function h(r, t, e, n, s, o, i) {
|
|
873
|
+
return N(t & e | ~t & n, r, t, s, o, i);
|
|
874
874
|
}
|
|
875
|
-
function
|
|
876
|
-
return N(t &
|
|
875
|
+
function f(r, t, e, n, s, o, i) {
|
|
876
|
+
return N(t & n | e & ~n, r, t, s, o, i);
|
|
877
877
|
}
|
|
878
|
-
function d(r, t, e,
|
|
879
|
-
return N(t ^ e ^
|
|
878
|
+
function d(r, t, e, n, s, o, i) {
|
|
879
|
+
return N(t ^ e ^ n, r, t, s, o, i);
|
|
880
880
|
}
|
|
881
|
-
function p(r, t, e,
|
|
882
|
-
return N(e ^ (t | ~
|
|
881
|
+
function p(r, t, e, n, s, o, i) {
|
|
882
|
+
return N(e ^ (t | ~n), r, t, s, o, i);
|
|
883
883
|
}
|
|
884
884
|
function x(r, t) {
|
|
885
885
|
var e = (65535 & r) + (65535 & t);
|
|
@@ -892,27 +892,27 @@ function _t(r) {
|
|
|
892
892
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(r);
|
|
893
893
|
}
|
|
894
894
|
function te(r, t = "mp") {
|
|
895
|
-
return r ? `https://www.gravatar.com/avatar/${
|
|
895
|
+
return r ? `https://www.gravatar.com/avatar/${gt(r)}?d=${t}` : "";
|
|
896
896
|
}
|
|
897
897
|
function ee(r) {
|
|
898
898
|
return r.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
|
|
899
899
|
}
|
|
900
900
|
function re(r, ...t) {
|
|
901
901
|
const e = [];
|
|
902
|
-
for (let
|
|
903
|
-
r[
|
|
904
|
-
return new
|
|
902
|
+
for (let n = 0; n < r.length || n < t.length; n++)
|
|
903
|
+
r[n] && e.push(r[n]), t[n] && e.push(t[n]);
|
|
904
|
+
return new g(e.join(""));
|
|
905
905
|
}
|
|
906
906
|
function xt(r, ...t) {
|
|
907
907
|
let e = [];
|
|
908
908
|
for (let o = 0; o < r.length || o < t.length; o++)
|
|
909
909
|
r[o] && e.push(r[o]), t[o] && e.push(t[o]);
|
|
910
|
-
const [
|
|
911
|
-
return
|
|
910
|
+
const [n, s] = e.join("").split(":");
|
|
911
|
+
return g.toString(n, s == null ? void 0 : s.split(""));
|
|
912
912
|
}
|
|
913
913
|
class H extends Error {
|
|
914
914
|
}
|
|
915
|
-
class
|
|
915
|
+
class g {
|
|
916
916
|
constructor(t) {
|
|
917
917
|
/** First directory in path */
|
|
918
918
|
c(this, "module");
|
|
@@ -924,24 +924,54 @@ class y {
|
|
|
924
924
|
c(this, "name");
|
|
925
925
|
/** List of methods */
|
|
926
926
|
c(this, "methods");
|
|
927
|
-
/** All/Wildcard specified */
|
|
928
|
-
c(this, "all");
|
|
929
|
-
/** None specified */
|
|
930
|
-
c(this, "none");
|
|
931
|
-
/** Create method specified */
|
|
932
|
-
c(this, "create");
|
|
933
|
-
/** Read method specified */
|
|
934
|
-
c(this, "read");
|
|
935
|
-
/** Update method specified */
|
|
936
|
-
c(this, "update");
|
|
937
|
-
/** Delete method specified */
|
|
938
|
-
c(this, "delete");
|
|
939
927
|
var i;
|
|
940
928
|
if (typeof t == "object") return Object.assign(this, t);
|
|
941
|
-
let [e,
|
|
942
|
-
|
|
943
|
-
let o = e.split("/").filter((
|
|
944
|
-
this.module = ((i = o.splice(0, 1)[0]) == null ? void 0 : i.toLowerCase()) || "", this.fullPath = e, this.path = o.join("/"), this.name = o.pop() || "", this.methods =
|
|
929
|
+
let [e, n, s] = t.split(":");
|
|
930
|
+
s || (s = n || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
|
|
931
|
+
let o = e.split("/").filter((u) => !!u);
|
|
932
|
+
this.module = ((i = o.splice(0, 1)[0]) == null ? void 0 : i.toLowerCase()) || "", this.fullPath = e, this.path = o.join("/"), this.name = o.pop() || "", this.methods = new w(s.split(""));
|
|
933
|
+
}
|
|
934
|
+
/** All/Wildcard specified */
|
|
935
|
+
get all() {
|
|
936
|
+
return this.methods.has("*");
|
|
937
|
+
}
|
|
938
|
+
set all(t) {
|
|
939
|
+
t ? new w(["*"]) : this.methods.delete("*");
|
|
940
|
+
}
|
|
941
|
+
/** None specified */
|
|
942
|
+
get none() {
|
|
943
|
+
return this.methods.has("n");
|
|
944
|
+
}
|
|
945
|
+
set none(t) {
|
|
946
|
+
t ? this.methods = new w(["n"]) : this.methods.delete("n");
|
|
947
|
+
}
|
|
948
|
+
/** Create method specified */
|
|
949
|
+
get create() {
|
|
950
|
+
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("c"));
|
|
951
|
+
}
|
|
952
|
+
set create(t) {
|
|
953
|
+
t ? this.methods.delete("n").add("c") : this.methods.delete("c");
|
|
954
|
+
}
|
|
955
|
+
/** Read method specified */
|
|
956
|
+
get read() {
|
|
957
|
+
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("r"));
|
|
958
|
+
}
|
|
959
|
+
set read(t) {
|
|
960
|
+
t ? this.methods.delete("n").add("r") : this.methods.delete("r");
|
|
961
|
+
}
|
|
962
|
+
/** Update method specified */
|
|
963
|
+
get update() {
|
|
964
|
+
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("u"));
|
|
965
|
+
}
|
|
966
|
+
set update(t) {
|
|
967
|
+
t ? this.methods.delete("n").add("u") : this.methods.delete("u");
|
|
968
|
+
}
|
|
969
|
+
/** Delete method specified */
|
|
970
|
+
get delete() {
|
|
971
|
+
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("d"));
|
|
972
|
+
}
|
|
973
|
+
set delete(t) {
|
|
974
|
+
t ? this.methods.delete("n").add("d") : this.methods.delete("d");
|
|
945
975
|
}
|
|
946
976
|
/**
|
|
947
977
|
* Combine multiple events into one parsed object. Longest path takes precedent, but all subsequent methods are
|
|
@@ -952,11 +982,11 @@ class y {
|
|
|
952
982
|
*/
|
|
953
983
|
static combine(t) {
|
|
954
984
|
let e = !1;
|
|
955
|
-
const
|
|
956
|
-
const i =
|
|
957
|
-
return i <
|
|
958
|
-
}).reduce((
|
|
959
|
-
return
|
|
985
|
+
const n = t.map((s) => new g(s)).toSorted((s, o) => {
|
|
986
|
+
const i = s.fullPath.length, u = o.fullPath.length;
|
|
987
|
+
return i < u ? 1 : i > u ? -1 : 0;
|
|
988
|
+
}).reduce((s, o) => (o.none && (e = !0), s ? (e || (o.all && (s.all = !0), (o.all || o.create) && (s.create = !0), (o.all || o.read) && (s.read = !0), (o.all || o.update) && (s.update = !0), (o.all || o.delete) && (s.delete = !0), s.methods = [...s.methods, ...o.methods]), s) : o), null);
|
|
989
|
+
return n.all && (n.methods = ["*"]), n.none && (n.methods = ["n"]), n.methods = new w(n.methods), n.raw = xt`${n.fullPath}:${n.methods}`, n;
|
|
960
990
|
}
|
|
961
991
|
/**
|
|
962
992
|
* Squash 2 sets of paths & return true if any overlap is found
|
|
@@ -966,13 +996,13 @@ class y {
|
|
|
966
996
|
* @return {boolean} Whether there is any overlap
|
|
967
997
|
*/
|
|
968
998
|
static has(t, ...e) {
|
|
969
|
-
const
|
|
970
|
-
return !!
|
|
999
|
+
const n = S(e).map((o) => new g(o)), s = S(t).map((o) => new g(o));
|
|
1000
|
+
return !!n.find((o) => {
|
|
971
1001
|
if (!o.fullPath && o.all) return !0;
|
|
972
|
-
const i =
|
|
1002
|
+
const i = s.filter((a) => o.fullPath.startsWith(a.fullPath));
|
|
973
1003
|
if (!i.length) return !1;
|
|
974
|
-
const
|
|
975
|
-
return !
|
|
1004
|
+
const u = g.combine(i);
|
|
1005
|
+
return !u.none && (u.all || new w(u.methods).intersection(new w(o.methods)).length);
|
|
976
1006
|
});
|
|
977
1007
|
}
|
|
978
1008
|
/**
|
|
@@ -983,7 +1013,7 @@ class y {
|
|
|
983
1013
|
* @return {boolean} Whether there is any overlap
|
|
984
1014
|
*/
|
|
985
1015
|
static hasAll(t, ...e) {
|
|
986
|
-
return e.filter((
|
|
1016
|
+
return e.filter((n) => g.has(t, n)).length == e.length;
|
|
987
1017
|
}
|
|
988
1018
|
/**
|
|
989
1019
|
* Same as `has` but raises an error if there is no overlap
|
|
@@ -992,7 +1022,7 @@ class y {
|
|
|
992
1022
|
* @param has Target must have at least one of these path
|
|
993
1023
|
*/
|
|
994
1024
|
static hasFatal(t, ...e) {
|
|
995
|
-
if (!
|
|
1025
|
+
if (!g.has(t, ...e)) throw new H(`Requires one of: ${S(e).join(", ")}`);
|
|
996
1026
|
}
|
|
997
1027
|
/**
|
|
998
1028
|
* Same as `hasAll` but raises an error if the target is missing any paths
|
|
@@ -1001,7 +1031,7 @@ class y {
|
|
|
1001
1031
|
* @param has Target must have all these paths
|
|
1002
1032
|
*/
|
|
1003
1033
|
static hasAllFatal(t, ...e) {
|
|
1004
|
-
if (!
|
|
1034
|
+
if (!g.hasAll(t, ...e)) throw new H(`Requires all: ${S(e).join(", ")}`);
|
|
1005
1035
|
}
|
|
1006
1036
|
/**
|
|
1007
1037
|
* Create event string from its components
|
|
@@ -1011,8 +1041,8 @@ class y {
|
|
|
1011
1041
|
* @return {string} String representation of Event
|
|
1012
1042
|
*/
|
|
1013
1043
|
static toString(t, e) {
|
|
1014
|
-
let
|
|
1015
|
-
return e != null && e.length && (
|
|
1044
|
+
let n = S(t).filter((s) => s != null).join("/");
|
|
1045
|
+
return e != null && e.length && (n += `:${S(e).map((s) => s.toLowerCase()).join("")}`), n == null ? void 0 : n.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
1016
1046
|
}
|
|
1017
1047
|
/**
|
|
1018
1048
|
* Create event string from its components
|
|
@@ -1020,7 +1050,7 @@ class y {
|
|
|
1020
1050
|
* @return {string} String representation of Event
|
|
1021
1051
|
*/
|
|
1022
1052
|
toString() {
|
|
1023
|
-
return
|
|
1053
|
+
return g.toString(this.fullPath, this.methods);
|
|
1024
1054
|
}
|
|
1025
1055
|
}
|
|
1026
1056
|
class ne {
|
|
@@ -1028,24 +1058,24 @@ class ne {
|
|
|
1028
1058
|
c(this, "listeners", []);
|
|
1029
1059
|
}
|
|
1030
1060
|
emit(t, ...e) {
|
|
1031
|
-
const
|
|
1032
|
-
this.listeners.filter((
|
|
1061
|
+
const n = new g(t);
|
|
1062
|
+
this.listeners.filter((s) => g.has(s[0], t)).forEach(async (s) => s[1](n, ...e));
|
|
1033
1063
|
}
|
|
1034
1064
|
off(t) {
|
|
1035
1065
|
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
1036
1066
|
}
|
|
1037
1067
|
on(t, e) {
|
|
1038
|
-
return
|
|
1068
|
+
return S(t).forEach((n) => this.listeners.push([new g(n), e])), () => this.off(e);
|
|
1039
1069
|
}
|
|
1040
1070
|
once(t, e) {
|
|
1041
|
-
return new Promise((
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1071
|
+
return new Promise((n) => {
|
|
1072
|
+
const s = this.on(t, (o, ...i) => {
|
|
1073
|
+
n(i.length < 2 ? i[0] : i), e && e(o, ...i), s();
|
|
1044
1074
|
});
|
|
1045
1075
|
});
|
|
1046
1076
|
}
|
|
1047
1077
|
relayEvents(t) {
|
|
1048
|
-
t.on("*", (e, ...
|
|
1078
|
+
t.on("*", (e, ...n) => this.emit(e, ...n));
|
|
1049
1079
|
}
|
|
1050
1080
|
}
|
|
1051
1081
|
function se(r) {
|
|
@@ -1066,20 +1096,20 @@ function ce() {
|
|
|
1066
1096
|
return Object.keys({});
|
|
1067
1097
|
}
|
|
1068
1098
|
export {
|
|
1069
|
-
|
|
1099
|
+
w as ASet,
|
|
1070
1100
|
et as BadGatewayError,
|
|
1071
1101
|
v as BadRequestError,
|
|
1072
1102
|
It as Cache,
|
|
1073
1103
|
Ft as CliBackground,
|
|
1074
1104
|
R as CliEffects,
|
|
1075
1105
|
L as CliForeground,
|
|
1076
|
-
|
|
1106
|
+
m as CustomError,
|
|
1077
1107
|
Z as ForbiddenError,
|
|
1078
1108
|
nt as GatewayTimeoutError,
|
|
1079
1109
|
F as Http,
|
|
1080
1110
|
_ as InternalServerError,
|
|
1081
1111
|
I as JSONAttemptParse,
|
|
1082
|
-
|
|
1112
|
+
ut as JSONSanitize,
|
|
1083
1113
|
dt as LOG_LEVEL,
|
|
1084
1114
|
Y as Logger,
|
|
1085
1115
|
X as MethodNotAllowedError,
|
|
@@ -1089,7 +1119,7 @@ export {
|
|
|
1089
1119
|
re as PE,
|
|
1090
1120
|
xt as PES,
|
|
1091
1121
|
H as PathError,
|
|
1092
|
-
|
|
1122
|
+
g as PathEvent,
|
|
1093
1123
|
ne as PathEventEmitter,
|
|
1094
1124
|
z as PaymentRequiredError,
|
|
1095
1125
|
b as PromiseProgress,
|
|
@@ -1103,10 +1133,10 @@ export {
|
|
|
1103
1133
|
Dt as csv,
|
|
1104
1134
|
Yt as dec2Frac,
|
|
1105
1135
|
At as deepCopy,
|
|
1106
|
-
|
|
1136
|
+
at as deepMerge,
|
|
1107
1137
|
B as dotNotation,
|
|
1108
1138
|
Mt as downloadFile,
|
|
1109
|
-
|
|
1139
|
+
ft as downloadUrl,
|
|
1110
1140
|
Rt as encodeQuery,
|
|
1111
1141
|
Ut as errorFromCode,
|
|
1112
1142
|
ee as escapeRegex,
|
|
@@ -1124,10 +1154,10 @@ export {
|
|
|
1124
1154
|
vt as insertAt,
|
|
1125
1155
|
O as isEqual,
|
|
1126
1156
|
qt as jwtDecode,
|
|
1127
|
-
|
|
1128
|
-
|
|
1157
|
+
S as makeArray,
|
|
1158
|
+
ht as makeUnique,
|
|
1129
1159
|
Xt as matchAll,
|
|
1130
|
-
|
|
1160
|
+
gt as md5,
|
|
1131
1161
|
$t as mixin,
|
|
1132
1162
|
Jt as pad,
|
|
1133
1163
|
Qt as parseUrl,
|