@ztimson/utils 0.1.8 → 0.2.0
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/objects.d.ts +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.mjs +162 -151
- package/dist/utils.mjs.map +1 -1
- package/dist/xhr.d.ts +4 -7
- package/package.json +1 -1
package/dist/utils.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (e, n, t) => (
|
|
4
|
-
function
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var Y = (e, n, t) => n in e ? U(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var f = (e, n, t) => (Y(e, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
function P(e, n = !1) {
|
|
5
5
|
if (e == null)
|
|
6
6
|
throw new Error("Cannot clean a NULL value");
|
|
7
7
|
return Array.isArray(e) ? e = e.filter((t) => t != null) : Object.entries(e).forEach(([t, r]) => {
|
|
8
8
|
(n && r === void 0 || !n && r == null) && delete e[t];
|
|
9
9
|
}), e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function tt(e) {
|
|
12
12
|
return JSON.parse(JSON.stringify(e));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function m(e, n, t) {
|
|
15
15
|
if (!(e == null || !n))
|
|
16
|
-
return n.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s,
|
|
16
|
+
return n.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, c) => {
|
|
17
17
|
if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
|
|
18
18
|
if (t == null)
|
|
19
19
|
return;
|
|
20
20
|
r[o] = {};
|
|
21
21
|
}
|
|
22
|
-
return t !== void 0 && s ==
|
|
22
|
+
return t !== void 0 && s == c.length - 1 ? r[o] = t : r[o];
|
|
23
23
|
}, e);
|
|
24
24
|
}
|
|
25
25
|
function q(e, n, t = {}) {
|
|
@@ -31,54 +31,65 @@ function q(e, n, t = {}) {
|
|
|
31
31
|
return t;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function I(e, n, t = !1) {
|
|
35
35
|
if (e == null)
|
|
36
36
|
return t;
|
|
37
37
|
if (Array.isArray(n))
|
|
38
|
-
return n.findIndex((o, s) => !
|
|
38
|
+
return n.findIndex((o, s) => !I(e[s], n[s], t)) == -1;
|
|
39
39
|
const r = typeof n;
|
|
40
|
-
return r != typeof e ? !1 : r == "object" ? Object.keys(n).find((o) => !
|
|
40
|
+
return r != typeof e ? !1 : r == "object" ? Object.keys(n).find((o) => !I(e[o], n[o], t)) == null : r == "function" ? e.toString() == n.toString() : e == n;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function x(e, n) {
|
|
43
43
|
const t = typeof e, r = typeof n;
|
|
44
|
-
return t != "object" || e == null || r != "object" || n == null ? t == "function" && r == "function" ? e.toString() == n.toString() : e === n : Object.keys(e).length != Object.keys(n).length ? !1 : Object.keys(e).every((s) =>
|
|
44
|
+
return t != "object" || e == null || r != "object" || n == null ? t == "function" && r == "function" ? e.toString() == n.toString() : e === n : Object.keys(e).length != Object.keys(n).length ? !1 : Object.keys(e).every((s) => x(e[s], n[s]));
|
|
45
|
+
}
|
|
46
|
+
function et(e, n) {
|
|
47
|
+
n.forEach((t) => {
|
|
48
|
+
Object.getOwnPropertyNames(t.prototype).forEach((r) => {
|
|
49
|
+
Object.defineProperty(
|
|
50
|
+
e.prototype,
|
|
51
|
+
r,
|
|
52
|
+
Object.getOwnPropertyDescriptor(t.prototype, r) || /* @__PURE__ */ Object.create(null)
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
45
56
|
}
|
|
46
57
|
function nt(e, n) {
|
|
47
58
|
return e.indexOf(n) === -1 && e.push(n), e;
|
|
48
59
|
}
|
|
49
60
|
function rt(e, n) {
|
|
50
|
-
return
|
|
51
|
-
...e.filter((t) => !n.includes((r) =>
|
|
52
|
-
...n.filter((t) => !e.includes((r) =>
|
|
61
|
+
return W([
|
|
62
|
+
...e.filter((t) => !n.includes((r) => x(t, r))),
|
|
63
|
+
...n.filter((t) => !e.includes((r) => x(t, r)))
|
|
53
64
|
]);
|
|
54
65
|
}
|
|
55
66
|
function ot(e) {
|
|
56
67
|
return function(n, t) {
|
|
57
|
-
const r =
|
|
68
|
+
const r = m(n, e), o = m(t, e);
|
|
58
69
|
return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
|
|
59
70
|
};
|
|
60
71
|
}
|
|
61
|
-
function
|
|
62
|
-
return e.forEach((t) => Array.isArray(t) ?
|
|
72
|
+
function H(e, n = []) {
|
|
73
|
+
return e.forEach((t) => Array.isArray(t) ? H(t, n) : n.push(t)), n;
|
|
63
74
|
}
|
|
64
75
|
function st(e, n = !1) {
|
|
65
76
|
return function(t, r) {
|
|
66
|
-
const o =
|
|
77
|
+
const o = m(t, e), s = m(r, e);
|
|
67
78
|
return typeof o == "number" && typeof s == "number" ? (n ? -1 : 1) * (o - s) : o > s ? n ? -1 : 1 : o < s ? n ? 1 : -1 : 0;
|
|
68
79
|
};
|
|
69
80
|
}
|
|
70
|
-
function
|
|
71
|
-
return (t) =>
|
|
81
|
+
function ct(e, n) {
|
|
82
|
+
return (t) => x(t[e], n);
|
|
72
83
|
}
|
|
73
|
-
function
|
|
84
|
+
function W(e) {
|
|
74
85
|
for (let n = e.length - 1; n >= 0; n--)
|
|
75
|
-
e.slice(0, n).find((t) =>
|
|
86
|
+
e.slice(0, n).find((t) => x(t, e[n])) && e.splice(n, 1);
|
|
76
87
|
return e;
|
|
77
88
|
}
|
|
78
|
-
function
|
|
89
|
+
function it(e) {
|
|
79
90
|
return Array.isArray(e) ? e : [e];
|
|
80
91
|
}
|
|
81
|
-
class
|
|
92
|
+
class b {
|
|
82
93
|
constructor() {
|
|
83
94
|
f(this, "listeners", {});
|
|
84
95
|
}
|
|
@@ -119,50 +130,49 @@ class N {
|
|
|
119
130
|
});
|
|
120
131
|
}
|
|
121
132
|
}
|
|
122
|
-
f(
|
|
123
|
-
const g = class g
|
|
124
|
-
constructor(
|
|
125
|
-
super();
|
|
133
|
+
f(b, "listeners", {});
|
|
134
|
+
const g = class g {
|
|
135
|
+
constructor(n = {}) {
|
|
126
136
|
f(this, "interceptors", {});
|
|
127
137
|
f(this, "headers", {});
|
|
128
|
-
this.opts =
|
|
138
|
+
this.opts = n, this.headers = n.headers || {}, n.interceptors && n.interceptors.forEach((t) => g.addInterceptor(t));
|
|
129
139
|
}
|
|
130
|
-
static addInterceptor(
|
|
131
|
-
const
|
|
132
|
-
return g.interceptors[
|
|
133
|
-
g.interceptors[
|
|
140
|
+
static addInterceptor(n) {
|
|
141
|
+
const t = Object.keys(g.interceptors).length.toString();
|
|
142
|
+
return g.interceptors[t] = n, () => {
|
|
143
|
+
g.interceptors[t] = null;
|
|
134
144
|
};
|
|
135
145
|
}
|
|
136
|
-
addInterceptor(
|
|
137
|
-
const
|
|
138
|
-
return this.interceptors[
|
|
139
|
-
this.interceptors[
|
|
146
|
+
addInterceptor(n) {
|
|
147
|
+
const t = Object.keys(this.interceptors).length.toString();
|
|
148
|
+
return this.interceptors[t] = n, () => {
|
|
149
|
+
this.interceptors[t] = null;
|
|
140
150
|
};
|
|
141
151
|
}
|
|
142
|
-
async request(
|
|
143
|
-
var
|
|
144
|
-
if (!this.opts.url && !
|
|
152
|
+
async request(n = {}) {
|
|
153
|
+
var s, c;
|
|
154
|
+
if (!this.opts.url && !n.url)
|
|
145
155
|
throw new Error("Momentum server URL needs to be set");
|
|
146
|
-
const
|
|
147
|
-
"Content-Type":
|
|
156
|
+
const t = ((s = n.url) != null && s.startsWith("http") ? n.url : (this.opts.url || "") + n.url).replace(/([^:]\/)\/+/g, "$1"), r = P({
|
|
157
|
+
"Content-Type": n.body && !(n.body instanceof FormData) ? "application/json" : void 0,
|
|
148
158
|
...g.headers,
|
|
149
159
|
...this.headers,
|
|
150
|
-
...
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
...n.headers
|
|
161
|
+
});
|
|
162
|
+
return fetch(t, {
|
|
163
|
+
headers: r,
|
|
164
|
+
method: n.method || (n.body ? "POST" : "GET"),
|
|
165
|
+
body: (c = r["Content-Type"]) != null && c.startsWith("application/json") && n.body ? JSON.stringify(n.body) : n.body
|
|
166
|
+
}).then(async (i) => {
|
|
167
|
+
var p, A;
|
|
168
|
+
for (let R of [...Object.values(g.interceptors), ...Object.values(this.interceptors)])
|
|
169
|
+
await new Promise((j) => R(i, () => j(null)));
|
|
170
|
+
if (!i.ok)
|
|
171
|
+
throw Error(i.statusText);
|
|
172
|
+
return (p = i.headers.get("Content-Type")) != null && p.startsWith("application/json") ? await i.json() : (A = i.headers.get("Content-Type")) != null && A.startsWith("text/plain") ? await i.text() : i;
|
|
173
|
+
}).catch((i) => {
|
|
174
|
+
throw i;
|
|
164
175
|
});
|
|
165
|
-
return this.emit("REQUEST", s, t), s;
|
|
166
176
|
}
|
|
167
177
|
};
|
|
168
178
|
f(g, "interceptors", {}), f(g, "headers", {});
|
|
@@ -170,9 +180,9 @@ let S = g;
|
|
|
170
180
|
S.addInterceptor((e, n) => {
|
|
171
181
|
if (e.status == 200)
|
|
172
182
|
return n();
|
|
173
|
-
throw e.status == 400 ? new
|
|
183
|
+
throw e.status == 400 ? new $(e.statusText) : e.status == 401 ? new D(e.statusText) : e.status == 403 ? new G(e.statusText) : e.status == 404 ? new k(e.statusText) : e.status == 500 ? new M(e.statusText) : new E(e.statusText, e.status);
|
|
174
184
|
});
|
|
175
|
-
class
|
|
185
|
+
class E extends Error {
|
|
176
186
|
constructor(t, r) {
|
|
177
187
|
super(t);
|
|
178
188
|
f(this, "_code");
|
|
@@ -199,8 +209,8 @@ class w extends Error {
|
|
|
199
209
|
return this.message || super.toString();
|
|
200
210
|
}
|
|
201
211
|
}
|
|
202
|
-
f(
|
|
203
|
-
class
|
|
212
|
+
f(E, "code", 500);
|
|
213
|
+
class $ extends E {
|
|
204
214
|
constructor(n = "Bad Request") {
|
|
205
215
|
super(n);
|
|
206
216
|
}
|
|
@@ -208,8 +218,8 @@ class b extends w {
|
|
|
208
218
|
return n.constructor.code == this.code;
|
|
209
219
|
}
|
|
210
220
|
}
|
|
211
|
-
f(
|
|
212
|
-
class D extends
|
|
221
|
+
f($, "code", 400);
|
|
222
|
+
class D extends E {
|
|
213
223
|
constructor(n = "Unauthorized") {
|
|
214
224
|
super(n);
|
|
215
225
|
}
|
|
@@ -218,7 +228,7 @@ class D extends w {
|
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
f(D, "code", 401);
|
|
221
|
-
class G extends
|
|
231
|
+
class G extends E {
|
|
222
232
|
constructor(n = "Forbidden") {
|
|
223
233
|
super(n);
|
|
224
234
|
}
|
|
@@ -227,7 +237,7 @@ class G extends w {
|
|
|
227
237
|
}
|
|
228
238
|
}
|
|
229
239
|
f(G, "code", 403);
|
|
230
|
-
class k extends
|
|
240
|
+
class k extends E {
|
|
231
241
|
constructor(n = "Not Found") {
|
|
232
242
|
super(n);
|
|
233
243
|
}
|
|
@@ -236,7 +246,7 @@ class k extends w {
|
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
248
|
f(k, "code", 404);
|
|
239
|
-
class M extends
|
|
249
|
+
class M extends E {
|
|
240
250
|
constructor(n = "Internal Server Error") {
|
|
241
251
|
super(n);
|
|
242
252
|
}
|
|
@@ -245,7 +255,7 @@ class M extends w {
|
|
|
245
255
|
}
|
|
246
256
|
}
|
|
247
257
|
f(M, "code", 500);
|
|
248
|
-
const
|
|
258
|
+
const w = {
|
|
249
259
|
CLEAR: "\x1B[0m",
|
|
250
260
|
BRIGHT: "\x1B[1m",
|
|
251
261
|
DIM: "\x1B[2m",
|
|
@@ -281,62 +291,62 @@ const x = {
|
|
|
281
291
|
WHITE: "\x1B[47m",
|
|
282
292
|
GREY: "\x1B[100m"
|
|
283
293
|
};
|
|
284
|
-
var
|
|
285
|
-
const
|
|
294
|
+
var v = /* @__PURE__ */ ((e) => (e[e.ERROR = 0] = "ERROR", e[e.WARN = 1] = "WARN", e[e.INFO = 2] = "INFO", e[e.LOG = 3] = "LOG", e[e.DEBUG = 4] = "DEBUG", e))(v || {});
|
|
295
|
+
const y = class y extends b {
|
|
286
296
|
constructor(n) {
|
|
287
297
|
super(), this.namespace = n;
|
|
288
298
|
}
|
|
289
299
|
pad(n, t, r, o = !1) {
|
|
290
|
-
const s = n.toString(),
|
|
291
|
-
if (
|
|
300
|
+
const s = n.toString(), c = t - s.length;
|
|
301
|
+
if (c <= 0)
|
|
292
302
|
return s;
|
|
293
|
-
const
|
|
294
|
-
return o ? s +
|
|
303
|
+
const i = Array(~~(c / r.length)).fill(r).join("");
|
|
304
|
+
return o ? s + i : i + s;
|
|
295
305
|
}
|
|
296
306
|
format(...n) {
|
|
297
307
|
const t = /* @__PURE__ */ new Date();
|
|
298
308
|
return `${`${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()} ${this.pad(t.getHours().toString(), 2, "0")}:${this.pad(t.getMinutes().toString(), 2, "0")}:${this.pad(t.getSeconds().toString(), 2, "0")}.${this.pad(t.getMilliseconds().toString(), 3, "0", !0)}`}${this.namespace ? ` [${this.namespace}]` : ""} ${n.join(" ")}`;
|
|
299
309
|
}
|
|
300
310
|
debug(...n) {
|
|
301
|
-
if (
|
|
311
|
+
if (y.LOG_LEVEL < 4)
|
|
302
312
|
return;
|
|
303
313
|
const t = this.format(...n);
|
|
304
|
-
|
|
314
|
+
y.emit(4, t), console.debug(B.LIGHT_GREY + t + w.CLEAR);
|
|
305
315
|
}
|
|
306
316
|
log(...n) {
|
|
307
|
-
if (
|
|
317
|
+
if (y.LOG_LEVEL < 3)
|
|
308
318
|
return;
|
|
309
319
|
const t = this.format(...n);
|
|
310
|
-
|
|
320
|
+
y.emit(3, t), console.log(w.CLEAR + t);
|
|
311
321
|
}
|
|
312
322
|
info(...n) {
|
|
313
|
-
if (
|
|
323
|
+
if (y.LOG_LEVEL < 2)
|
|
314
324
|
return;
|
|
315
325
|
const t = this.format(...n);
|
|
316
|
-
|
|
326
|
+
y.emit(2, t), console.info(B.BLUE + t + w.CLEAR);
|
|
317
327
|
}
|
|
318
328
|
warn(...n) {
|
|
319
|
-
if (
|
|
329
|
+
if (y.LOG_LEVEL < 1)
|
|
320
330
|
return;
|
|
321
331
|
const t = this.format(...n);
|
|
322
|
-
|
|
332
|
+
y.emit(1, t), console.warn(B.YELLOW + t + w.CLEAR);
|
|
323
333
|
}
|
|
324
334
|
error(...n) {
|
|
325
|
-
if (
|
|
335
|
+
if (y.LOG_LEVEL < 0)
|
|
326
336
|
return;
|
|
327
337
|
const t = this.format(...n);
|
|
328
|
-
|
|
338
|
+
y.emit(0, t), console.error(B.RED + t + w.CLEAR);
|
|
329
339
|
}
|
|
330
340
|
};
|
|
331
|
-
f(
|
|
332
|
-
let
|
|
341
|
+
f(y, "LOG_LEVEL", 4);
|
|
342
|
+
let N = y;
|
|
333
343
|
function at(e, n) {
|
|
334
344
|
return e.length - e.replaceAll(n, "").length;
|
|
335
345
|
}
|
|
336
346
|
function lt(e) {
|
|
337
347
|
return Array(e).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
338
348
|
}
|
|
339
|
-
const C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
349
|
+
const C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", O = "0123456789", L = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", F = C + O + L;
|
|
340
350
|
function ht(e) {
|
|
341
351
|
const n = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(e);
|
|
342
352
|
if (!n)
|
|
@@ -346,32 +356,32 @@ function ht(e) {
|
|
|
346
356
|
function ft(e, n, t) {
|
|
347
357
|
return `${e.slice(0, t)}${n}${e.slice(t + 1)}`;
|
|
348
358
|
}
|
|
349
|
-
function
|
|
359
|
+
function yt(e, n, t, r = !0) {
|
|
350
360
|
const o = e.toString(), s = n - o.length;
|
|
351
361
|
if (s <= 0)
|
|
352
362
|
return o;
|
|
353
|
-
const
|
|
354
|
-
return r ?
|
|
363
|
+
const c = Array(~~(s / t.length)).fill(t).join("");
|
|
364
|
+
return r ? c + o : o + c;
|
|
355
365
|
}
|
|
356
|
-
function gt(e, n =
|
|
366
|
+
function gt(e, n = F) {
|
|
357
367
|
return Array(e).fill(null).map(() => {
|
|
358
368
|
const t = ~~(Math.random() * n.length);
|
|
359
369
|
return n[t];
|
|
360
370
|
}).join("");
|
|
361
371
|
}
|
|
362
|
-
function
|
|
372
|
+
function dt(e, n = !1, t = !1, r = !1) {
|
|
363
373
|
if (!n && !t && !r)
|
|
364
374
|
throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
365
375
|
return Array(e).fill(null).map(() => {
|
|
366
376
|
let o;
|
|
367
377
|
do {
|
|
368
378
|
const s = ~~(Math.random() * 3);
|
|
369
|
-
n && s == 0 ? o = C[~~(Math.random() * C.length)] : t && s == 1 ? o =
|
|
379
|
+
n && s == 0 ? o = C[~~(Math.random() * C.length)] : t && s == 1 ? o = O[~~(Math.random() * O.length)] : r && s == 2 && (o = L[~~(Math.random() * L.length)]);
|
|
370
380
|
} while (!o);
|
|
371
381
|
return o;
|
|
372
382
|
}).join("");
|
|
373
383
|
}
|
|
374
|
-
function
|
|
384
|
+
function Et(e, n) {
|
|
375
385
|
if (typeof n == "string" && (n = new RegExp(n, "g")), !n.global)
|
|
376
386
|
throw new TypeError("Regular expression must be global.");
|
|
377
387
|
let t = [], r;
|
|
@@ -379,89 +389,89 @@ function dt(e, n) {
|
|
|
379
389
|
t.push(r);
|
|
380
390
|
return t;
|
|
381
391
|
}
|
|
382
|
-
function
|
|
383
|
-
var n =
|
|
392
|
+
function z(e) {
|
|
393
|
+
var n = J(V(Z(K(e), 8 * e.length)));
|
|
384
394
|
return n.toLowerCase();
|
|
385
395
|
}
|
|
386
|
-
function
|
|
396
|
+
function J(e) {
|
|
387
397
|
for (var n, t = "0123456789ABCDEF", r = "", o = 0; o < e.length; o++)
|
|
388
398
|
n = e.charCodeAt(o), r += t.charAt(n >>> 4 & 15) + t.charAt(15 & n);
|
|
389
399
|
return r;
|
|
390
400
|
}
|
|
391
|
-
function
|
|
401
|
+
function K(e) {
|
|
392
402
|
for (var n = Array(e.length >> 2), t = 0; t < n.length; t++)
|
|
393
403
|
n[t] = 0;
|
|
394
404
|
for (t = 0; t < 8 * e.length; t += 8)
|
|
395
405
|
n[t >> 5] |= (255 & e.charCodeAt(t / 8)) << t % 32;
|
|
396
406
|
return n;
|
|
397
407
|
}
|
|
398
|
-
function
|
|
408
|
+
function V(e) {
|
|
399
409
|
for (var n = "", t = 0; t < 32 * e.length; t += 8)
|
|
400
410
|
n += String.fromCharCode(e[t >> 5] >>> t % 32 & 255);
|
|
401
411
|
return n;
|
|
402
412
|
}
|
|
403
|
-
function
|
|
413
|
+
function Z(e, n) {
|
|
404
414
|
e[n >> 5] |= 128 << n % 32, e[14 + (n + 64 >>> 9 << 4)] = n;
|
|
405
|
-
for (var t = 1732584193, r = -271733879, o = -1732584194, s = 271733878,
|
|
406
|
-
var
|
|
407
|
-
r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r = a(r = a(r = a(r = a(r = u(r = u(r = u(r = u(r, o = u(o, s = u(s, t = u(t, r, o, s, e[
|
|
415
|
+
for (var t = 1732584193, r = -271733879, o = -1732584194, s = 271733878, c = 0; c < e.length; c += 16) {
|
|
416
|
+
var i = t, p = r, A = o, R = s;
|
|
417
|
+
r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r = a(r = a(r = a(r = a(r = u(r = u(r = u(r = u(r, o = u(o, s = u(s, t = u(t, r, o, s, e[c + 0], 7, -680876936), r, o, e[c + 1], 12, -389564586), t, r, e[c + 2], 17, 606105819), s, t, e[c + 3], 22, -1044525330), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 4], 7, -176418897), r, o, e[c + 5], 12, 1200080426), t, r, e[c + 6], 17, -1473231341), s, t, e[c + 7], 22, -45705983), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 8], 7, 1770035416), r, o, e[c + 9], 12, -1958414417), t, r, e[c + 10], 17, -42063), s, t, e[c + 11], 22, -1990404162), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 12], 7, 1804603682), r, o, e[c + 13], 12, -40341101), t, r, e[c + 14], 17, -1502002290), s, t, e[c + 15], 22, 1236535329), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 1], 5, -165796510), r, o, e[c + 6], 9, -1069501632), t, r, e[c + 11], 14, 643717713), s, t, e[c + 0], 20, -373897302), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 5], 5, -701558691), r, o, e[c + 10], 9, 38016083), t, r, e[c + 15], 14, -660478335), s, t, e[c + 4], 20, -405537848), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 9], 5, 568446438), r, o, e[c + 14], 9, -1019803690), t, r, e[c + 3], 14, -187363961), s, t, e[c + 8], 20, 1163531501), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 13], 5, -1444681467), r, o, e[c + 2], 9, -51403784), t, r, e[c + 7], 14, 1735328473), s, t, e[c + 12], 20, -1926607734), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 5], 4, -378558), r, o, e[c + 8], 11, -2022574463), t, r, e[c + 11], 16, 1839030562), s, t, e[c + 14], 23, -35309556), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 1], 4, -1530992060), r, o, e[c + 4], 11, 1272893353), t, r, e[c + 7], 16, -155497632), s, t, e[c + 10], 23, -1094730640), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 13], 4, 681279174), r, o, e[c + 0], 11, -358537222), t, r, e[c + 3], 16, -722521979), s, t, e[c + 6], 23, 76029189), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 9], 4, -640364487), r, o, e[c + 12], 11, -421815835), t, r, e[c + 15], 16, 530742520), s, t, e[c + 2], 23, -995338651), o = h(o, s = h(s, t = h(t, r, o, s, e[c + 0], 6, -198630844), r, o, e[c + 7], 10, 1126891415), t, r, e[c + 14], 15, -1416354905), s, t, e[c + 5], 21, -57434055), o = h(o, s = h(s, t = h(t, r, o, s, e[c + 12], 6, 1700485571), r, o, e[c + 3], 10, -1894986606), t, r, e[c + 10], 15, -1051523), s, t, e[c + 1], 21, -2054922799), o = h(o, s = h(s, t = h(t, r, o, s, e[c + 8], 6, 1873313359), r, o, e[c + 15], 10, -30611744), t, r, e[c + 6], 15, -1560198380), s, t, e[c + 13], 21, 1309151649), o = h(o, s = h(s, t = h(t, r, o, s, e[c + 4], 6, -145523070), r, o, e[c + 11], 10, -1120210379), t, r, e[c + 2], 15, 718787259), s, t, e[c + 9], 21, -343485551), t = d(t, i), r = d(r, p), o = d(o, A), s = d(s, R);
|
|
408
418
|
}
|
|
409
419
|
return Array(t, r, o, s);
|
|
410
420
|
}
|
|
411
421
|
function T(e, n, t, r, o, s) {
|
|
412
|
-
return d(
|
|
422
|
+
return d(Q(d(d(n, e), d(r, s)), o), t);
|
|
413
423
|
}
|
|
414
|
-
function u(e, n, t, r, o, s,
|
|
415
|
-
return T(n & t | ~n & r, e, n, o, s,
|
|
424
|
+
function u(e, n, t, r, o, s, c) {
|
|
425
|
+
return T(n & t | ~n & r, e, n, o, s, c);
|
|
416
426
|
}
|
|
417
|
-
function a(e, n, t, r, o, s,
|
|
418
|
-
return T(n & r | t & ~r, e, n, o, s,
|
|
427
|
+
function a(e, n, t, r, o, s, c) {
|
|
428
|
+
return T(n & r | t & ~r, e, n, o, s, c);
|
|
419
429
|
}
|
|
420
|
-
function l(e, n, t, r, o, s,
|
|
421
|
-
return T(n ^ t ^ r, e, n, o, s,
|
|
430
|
+
function l(e, n, t, r, o, s, c) {
|
|
431
|
+
return T(n ^ t ^ r, e, n, o, s, c);
|
|
422
432
|
}
|
|
423
|
-
function h(e, n, t, r, o, s,
|
|
424
|
-
return T(t ^ (n | ~r), e, n, o, s,
|
|
433
|
+
function h(e, n, t, r, o, s, c) {
|
|
434
|
+
return T(t ^ (n | ~r), e, n, o, s, c);
|
|
425
435
|
}
|
|
426
436
|
function d(e, n) {
|
|
427
437
|
var t = (65535 & e) + (65535 & n);
|
|
428
438
|
return (e >> 16) + (n >> 16) + (t >> 16) << 16 | 65535 & t;
|
|
429
439
|
}
|
|
430
|
-
function
|
|
440
|
+
function Q(e, n) {
|
|
431
441
|
return e << n | e >>> 32 - n;
|
|
432
442
|
}
|
|
433
|
-
function
|
|
443
|
+
function pt(e) {
|
|
434
444
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(e);
|
|
435
445
|
}
|
|
436
|
-
function
|
|
446
|
+
function wt(e) {
|
|
437
447
|
return Object.entries(e).map(
|
|
438
448
|
([n, t]) => encodeURIComponent(n) + "=" + encodeURIComponent(t)
|
|
439
449
|
).join("&");
|
|
440
450
|
}
|
|
441
|
-
function
|
|
442
|
-
return e ? `https://www.gravatar.com/avatar/${
|
|
451
|
+
function xt(e, n = "mp") {
|
|
452
|
+
return e ? `https://www.gravatar.com/avatar/${z(e)}?d=${n}` : "";
|
|
443
453
|
}
|
|
444
|
-
function
|
|
454
|
+
function At(e) {
|
|
445
455
|
const n = new RegExp(
|
|
446
456
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
447
457
|
"gm"
|
|
448
458
|
).exec(e), t = (n == null ? void 0 : n.groups) ?? {}, r = t.domain.split(".");
|
|
449
459
|
if (t.port != null && (t.port = Number(t.port)), r.length > 2 && (t.domain = r.splice(-2, 2).join("."), t.subdomain = r.join(".")), t.query) {
|
|
450
460
|
const o = t.query.split("&"), s = {};
|
|
451
|
-
o.forEach((
|
|
452
|
-
const [
|
|
453
|
-
s[
|
|
461
|
+
o.forEach((c) => {
|
|
462
|
+
const [i, p] = c.split("=");
|
|
463
|
+
s[i] = p;
|
|
454
464
|
}), t.query = s;
|
|
455
465
|
}
|
|
456
466
|
return t;
|
|
457
467
|
}
|
|
458
|
-
function
|
|
468
|
+
function Bt(e) {
|
|
459
469
|
return (e instanceof Date ? e.getTime() : e) - (/* @__PURE__ */ new Date()).getTime();
|
|
460
470
|
}
|
|
461
|
-
function
|
|
471
|
+
function mt(e) {
|
|
462
472
|
return new Promise((n) => setTimeout(n, e));
|
|
463
473
|
}
|
|
464
|
-
function
|
|
474
|
+
function Tt(e) {
|
|
465
475
|
const n = e instanceof Date ? e : new Date(e);
|
|
466
476
|
return new Intl.DateTimeFormat("en-us", {
|
|
467
477
|
weekday: "long",
|
|
@@ -473,48 +483,49 @@ function Rt(e) {
|
|
|
473
483
|
}).format(n);
|
|
474
484
|
}
|
|
475
485
|
export {
|
|
476
|
-
|
|
486
|
+
$ as BadRequestError,
|
|
477
487
|
ut as CliBackground,
|
|
478
|
-
|
|
488
|
+
w as CliEffects,
|
|
479
489
|
B as CliForeground,
|
|
480
|
-
|
|
490
|
+
E as CustomError,
|
|
481
491
|
G as ForbiddenError,
|
|
482
492
|
M as InternalServerError,
|
|
483
|
-
|
|
484
|
-
|
|
493
|
+
v as LOG_LEVEL,
|
|
494
|
+
N as Logger,
|
|
485
495
|
k as NotFoundError,
|
|
486
|
-
|
|
496
|
+
b as TypedEmitter,
|
|
487
497
|
D as UnauthorizedError,
|
|
488
498
|
S as XHR,
|
|
489
499
|
nt as addUnique,
|
|
490
500
|
rt as arrayDiff,
|
|
491
501
|
ot as caseInsensitiveSort,
|
|
492
|
-
|
|
502
|
+
P as clean,
|
|
493
503
|
at as countChars,
|
|
494
504
|
lt as createHex,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
505
|
+
tt as deepCopy,
|
|
506
|
+
m as dotNotation,
|
|
507
|
+
ct as findByProp,
|
|
508
|
+
H as flattenArr,
|
|
499
509
|
q as flattenObj,
|
|
500
|
-
|
|
501
|
-
|
|
510
|
+
wt as formEncode,
|
|
511
|
+
Tt as formatDate,
|
|
502
512
|
ht as formatPhoneNumber,
|
|
503
|
-
|
|
504
|
-
|
|
513
|
+
xt as gravatar,
|
|
514
|
+
I as includes,
|
|
505
515
|
ft as insertAt,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
516
|
+
x as isEqual,
|
|
517
|
+
it as makeArray,
|
|
518
|
+
W as makeUnique,
|
|
519
|
+
Et as matchAll,
|
|
520
|
+
z as md5,
|
|
521
|
+
et as mixin,
|
|
522
|
+
yt as pad,
|
|
512
523
|
gt as randomString,
|
|
513
|
-
|
|
514
|
-
|
|
524
|
+
dt as randomStringBuilder,
|
|
525
|
+
mt as sleep,
|
|
515
526
|
st as sortByProp,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
527
|
+
Bt as timeUntil,
|
|
528
|
+
At as urlParser,
|
|
529
|
+
pt as validateEmail
|
|
519
530
|
};
|
|
520
531
|
//# sourceMappingURL=utils.mjs.map
|