@flemist/simple-utils 1.0.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.
Files changed (79) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +19 -0
  3. package/build/browser/index.cjs +1 -0
  4. package/build/browser/index.d.ts +1 -0
  5. package/build/browser/index.mjs +53 -0
  6. package/build/common/async/abort/index.d.ts +2 -0
  7. package/build/common/async/abort/timeout.d.ts +3 -0
  8. package/build/common/async/abort/timeoutAbortController.d.ts +8 -0
  9. package/build/common/async/index.d.ts +2 -0
  10. package/build/common/async/lazy.d.ts +31 -0
  11. package/build/common/crypto/index.d.ts +2 -0
  12. package/build/common/crypto/sha256.d.ts +10 -0
  13. package/build/common/crypto/sha256Node.d.ts +2 -0
  14. package/build/common/crypto/toHex.d.ts +8 -0
  15. package/build/common/debug/console/alertReplace.d.ts +2 -0
  16. package/build/common/debug/console/consoleReplace.d.ts +13 -0
  17. package/build/common/debug/console/index.d.ts +2 -0
  18. package/build/common/debug/index.d.ts +2 -0
  19. package/build/common/debug/stack-trace/fixStackTrace.d.ts +1 -0
  20. package/build/common/debug/stack-trace/getCallerStackFrame.d.ts +2 -0
  21. package/build/common/debug/stack-trace/getStackTrace.d.ts +1 -0
  22. package/build/common/debug/stack-trace/index.d.ts +2 -0
  23. package/build/common/debug/stack-trace/parseStackTrace.d.ts +8 -0
  24. package/build/common/index.cjs +1 -0
  25. package/build/common/index.d.ts +10 -0
  26. package/build/common/index.mjs +53 -0
  27. package/build/common/number/floatAsInt.d.ts +7 -0
  28. package/build/common/number/index.d.ts +2 -0
  29. package/build/common/number/minMax.d.ts +10 -0
  30. package/build/common/number/numberMod.d.ts +2 -0
  31. package/build/common/number/prime.d.ts +3 -0
  32. package/build/common/number/round.d.ts +19 -0
  33. package/build/common/object/deepCloneJsonLike.d.ts +6 -0
  34. package/build/common/object/deepEqualJsonLike.d.ts +6 -0
  35. package/build/common/object/deepEqualJsonLikeMap.d.ts +5 -0
  36. package/build/common/object/equalArray.d.ts +2 -0
  37. package/build/common/object/getNormalizedObject.d.ts +1 -0
  38. package/build/common/object/index.d.ts +5 -0
  39. package/build/common/random/Random.d.ts +16 -0
  40. package/build/common/random/createUniquePseudoRandom.d.ts +6 -0
  41. package/build/common/random/helpers.d.ts +9 -0
  42. package/build/common/random/index.d.ts +3 -0
  43. package/build/common/string/color/rgbaToHex.d.ts +2 -0
  44. package/build/common/string/escape/escapeHtml.d.ts +2 -0
  45. package/build/common/string/escape/escapeRegExp.d.ts +2 -0
  46. package/build/common/string/escape/index.d.ts +2 -0
  47. package/build/common/string/format/formatAny.d.ts +9 -0
  48. package/build/common/string/format/formatDate.d.ts +4 -0
  49. package/build/common/string/format/formatDateFileName.d.ts +4 -0
  50. package/build/common/string/format/getObjectId.d.ts +2 -0
  51. package/build/common/string/format/index.d.ts +3 -0
  52. package/build/common/string/index.d.ts +2 -0
  53. package/build/common/time/dateNowUnique.d.ts +5 -0
  54. package/build/common/time/dateToString.d.ts +2 -0
  55. package/build/common/time/getDateInet.d.ts +8 -0
  56. package/build/common/time/index.d.ts +3 -0
  57. package/build/common/time/timeZone.d.ts +2 -0
  58. package/build/common/types/common.d.ts +21 -0
  59. package/build/common/types/index.d.ts +1 -0
  60. package/build/common/url/index.d.ts +1 -0
  61. package/build/common/url/urlGet.d.ts +8 -0
  62. package/build/node/fs/fileLock.d.ts +6 -0
  63. package/build/node/fs/glob/createMatchPath.d.ts +28 -0
  64. package/build/node/fs/glob/globGitIgnoreToPicomatch.d.ts +1 -0
  65. package/build/node/fs/glob/globToRelative.d.ts +6 -0
  66. package/build/node/fs/glob/index.d.ts +4 -0
  67. package/build/node/fs/glob/loadGlobs.d.ts +19 -0
  68. package/build/node/fs/index.d.ts +5 -0
  69. package/build/node/fs/pathNormalize.d.ts +2 -0
  70. package/build/node/fs/pools.d.ts +2 -0
  71. package/build/node/fs/walk/helpers.d.ts +4 -0
  72. package/build/node/fs/walk/index.d.ts +2 -0
  73. package/build/node/fs/walk/walkPaths.d.ts +52 -0
  74. package/build/node/index.cjs +2 -0
  75. package/build/node/index.d.ts +2 -0
  76. package/build/node/index.mjs +348 -0
  77. package/build/urlGet-B8-MSnoY.mjs +764 -0
  78. package/build/urlGet-CZFNBQ4G.js +11 -0
  79. package/package.json +137 -0
@@ -0,0 +1,764 @@
1
+ import { AbortControllerFast as j, toAbortSignal as lt, AbortError as at } from "@flemist/abort-controller-fast";
2
+ import { isPromiseLike as J } from "@flemist/async-utils";
3
+ import { timeControllerDefault as ct } from "@flemist/time-controller";
4
+ let P = null;
5
+ function ft() {
6
+ if (!P) {
7
+ P = new Array(256);
8
+ for (let t = 0; t < 256; t++)
9
+ P[t] = t.toString(16).padStart(2, "0");
10
+ }
11
+ return P;
12
+ }
13
+ function ht(t) {
14
+ const e = ft(), r = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
15
+ let n = "";
16
+ for (let o = 0, s = r.length; o < s; o++)
17
+ n += e[r[o]];
18
+ return n;
19
+ }
20
+ let G = null, tt = null, L = null, et = null;
21
+ function pt() {
22
+ G || (G = new Uint32Array([
23
+ 1116352408,
24
+ 1899447441,
25
+ 3049323471,
26
+ 3921009573,
27
+ 961987163,
28
+ 1508970993,
29
+ 2453635748,
30
+ 2870763221,
31
+ 3624381080,
32
+ 310598401,
33
+ 607225278,
34
+ 1426881987,
35
+ 1925078388,
36
+ 2162078206,
37
+ 2614888103,
38
+ 3248222580,
39
+ 3835390401,
40
+ 4022224774,
41
+ 264347078,
42
+ 604807628,
43
+ 770255983,
44
+ 1249150122,
45
+ 1555081692,
46
+ 1996064986,
47
+ 2554220882,
48
+ 2821834349,
49
+ 2952996808,
50
+ 3210313671,
51
+ 3336571891,
52
+ 3584528711,
53
+ 113926993,
54
+ 338241895,
55
+ 666307205,
56
+ 773529912,
57
+ 1294757372,
58
+ 1396182291,
59
+ 1695183700,
60
+ 1986661051,
61
+ 2177026350,
62
+ 2456956037,
63
+ 2730485921,
64
+ 2820302411,
65
+ 3259730800,
66
+ 3345764771,
67
+ 3516065817,
68
+ 3600352804,
69
+ 4094571909,
70
+ 275423344,
71
+ 430227734,
72
+ 506948616,
73
+ 659060556,
74
+ 883997877,
75
+ 958139571,
76
+ 1322822218,
77
+ 1537002063,
78
+ 1747873779,
79
+ 1955562222,
80
+ 2024104815,
81
+ 2227730452,
82
+ 2361852424,
83
+ 2428436474,
84
+ 2756734187,
85
+ 3204031479,
86
+ 3329325298
87
+ ]), tt = new Uint32Array(64), et = new TextEncoder(), L = new Uint8Array(65536));
88
+ }
89
+ function mt(t) {
90
+ if (t == null)
91
+ return null;
92
+ pt();
93
+ const e = G, r = tt, n = et;
94
+ let o = L, s;
95
+ if (typeof t == "string") {
96
+ const p = t.length * 3;
97
+ o.length < p + 128 && (o = L = new Uint8Array(p + 128));
98
+ const f = n.encodeInto(t, o);
99
+ s = o.subarray(0, f.written);
100
+ } else if (t instanceof Uint8Array)
101
+ s = t;
102
+ else if (ArrayBuffer.isView(t))
103
+ s = new Uint8Array(
104
+ t.buffer,
105
+ t.byteOffset,
106
+ t.byteLength
107
+ );
108
+ else
109
+ throw new Error(
110
+ `[sha256Buffer] Unsupported content type: ${typeof t}`
111
+ );
112
+ const c = s.length, a = c + 72 >>> 6 << 6;
113
+ o.length < a && (o = L = new Uint8Array(a)), s !== o && o.set(s), o[c] = 128;
114
+ for (let p = c + 1; p < a; p++)
115
+ o[p] = 0;
116
+ const A = c * 8, x = A / 4294967296 | 0, T = A | 0;
117
+ o[a - 8] = x >>> 24, o[a - 7] = x >>> 16, o[a - 6] = x >>> 8, o[a - 5] = x, o[a - 4] = T >>> 24, o[a - 3] = T >>> 16, o[a - 2] = T >>> 8, o[a - 1] = T;
118
+ let y = 1779033703, i = -1150833019, u = 1013904242, l = -1521486534, m = 1359893119, d = -1694144372, g = 528734635, O = 1541459225;
119
+ for (let p = 0; p < a; p += 64) {
120
+ for (let h = 0; h < 16; h++) {
121
+ const w = p + (h << 2);
122
+ r[h] = o[w] << 24 | o[w + 1] << 16 | o[w + 2] << 8 | o[w + 3];
123
+ }
124
+ for (let h = 16; h < 64; h++) {
125
+ const w = r[h - 15], U = r[h - 2], F = (w >>> 7 | w << 25) ^ (w >>> 18 | w << 14) ^ w >>> 3, D = (U >>> 17 | U << 15) ^ (U >>> 19 | U << 13) ^ U >>> 10;
126
+ r[h] = r[h - 16] + F + r[h - 7] + D | 0;
127
+ }
128
+ let f = y, S = i, k = u, B = l, _ = m, N = d, R = g, z = O;
129
+ for (let h = 0; h < 64; h += 4)
130
+ for (let w = 0; w < 4; w++) {
131
+ const U = h + w, F = (_ >>> 6 | _ << 26) ^ (_ >>> 11 | _ << 21) ^ (_ >>> 25 | _ << 7), D = z + F + (R ^ _ & (N ^ R)) + e[U] + r[U] | 0, ut = ((f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10)) + (f & S ^ k & (f ^ S)) | 0;
132
+ z = R, R = N, N = _, _ = B + D | 0, B = k, k = S, S = f, f = D + ut | 0;
133
+ }
134
+ y = y + f | 0, i = i + S | 0, u = u + k | 0, l = l + B | 0, m = m + _ | 0, d = d + N | 0, g = g + R | 0, O = O + z | 0;
135
+ }
136
+ const E = new Uint8Array(32), q = [y, i, u, l, m, d, g, O];
137
+ for (let p = 0; p < 8; p++) {
138
+ const f = q[p], S = p << 2;
139
+ E[S] = f >>> 24, E[S + 1] = f >>> 16 & 255, E[S + 2] = f >>> 8 & 255, E[S + 3] = f & 255;
140
+ }
141
+ return E;
142
+ }
143
+ function Pt(t) {
144
+ const e = mt(t);
145
+ return e ? ht(e) : null;
146
+ }
147
+ function dt(t, e) {
148
+ return t == null ? e : e == null ? t : Math.min(t, e);
149
+ }
150
+ function wt(t, e) {
151
+ return t == null ? e : e == null ? t : Math.max(t, e);
152
+ }
153
+ function Lt(t, e, r) {
154
+ return wt(dt(t, e), r);
155
+ }
156
+ function Vt(t, e) {
157
+ return (t % e + e) % e;
158
+ }
159
+ function yt(t) {
160
+ return function() {
161
+ let r = t += 1831565813;
162
+ return r = Math.imul(r ^ r >>> 15, r | 1), r ^= r + Math.imul(r ^ r >>> 7, r | 61), (r ^ r >>> 14) / 4294967296 + 0.5;
163
+ };
164
+ }
165
+ function gt() {
166
+ return Math.random();
167
+ }
168
+ function qt() {
169
+ return Math.random() * 2 ** 32 >>> 0;
170
+ }
171
+ function St(t) {
172
+ return t != null ? yt(t) : gt;
173
+ }
174
+ class b {
175
+ _seed;
176
+ _rnd;
177
+ constructor(e) {
178
+ this._seed = e, this._rnd = St(e);
179
+ }
180
+ get seed() {
181
+ return this._seed;
182
+ }
183
+ nextSeed() {
184
+ return this.next() * 2 ** 32 >>> 0;
185
+ }
186
+ nextRandom() {
187
+ return new b(this.nextSeed());
188
+ }
189
+ next() {
190
+ return this._rnd();
191
+ }
192
+ clone() {
193
+ return new b(this._seed);
194
+ }
195
+ }
196
+ function rt(t, e, r) {
197
+ if (r == null && (r = e, e = 0), r <= e)
198
+ throw new Error(
199
+ `[random][randomFloat] toExclusive (${r}) must be greater than from (${e})`
200
+ );
201
+ return t.next() * (r - e) + e;
202
+ }
203
+ function _t(t, e, r) {
204
+ return Math.floor(rt(t, e, r));
205
+ }
206
+ function Bt(t, e) {
207
+ return t.next() < (e ?? 0.5);
208
+ }
209
+ function zt(t, e, r) {
210
+ if (Array.isArray(e)) {
211
+ const s = e;
212
+ e = s.length, r = (c) => s[c];
213
+ }
214
+ if (!r)
215
+ throw new Error("[random][randomIndexWeighted] getWeight is required");
216
+ let n = 0;
217
+ for (let s = 0; s < e; s++)
218
+ n += r(s);
219
+ if (n === 0)
220
+ return -1;
221
+ let o = rt(t, n);
222
+ for (let s = 0; s < e; s++)
223
+ if (o -= r(s), o < 0)
224
+ return s;
225
+ return e - 1;
226
+ }
227
+ function nt(t, e) {
228
+ if (e.length === 0)
229
+ throw new Error("[random][randomItem] items is empty");
230
+ const r = _t(t, e.length);
231
+ return e[r];
232
+ }
233
+ function Ft(t, e, r) {
234
+ if (e.length === 0)
235
+ throw new Error("[random][randomItems] items is empty");
236
+ const n = [];
237
+ for (let o = 0; o < r; o++)
238
+ n.push(nt(t, e));
239
+ return n;
240
+ }
241
+ function Ht(t, e, r) {
242
+ let n = Object.values(e);
243
+ return r && (n = n.filter(r)), nt(t, n);
244
+ }
245
+ const ot = 1073741789, H = (ot >> 2) - 1;
246
+ function Wt(t = H, e) {
247
+ if (t <= 0)
248
+ throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);
249
+ if (t > H)
250
+ throw new Error(
251
+ `[random][PseudoRandom] count(${t}) must be <= ${H}`
252
+ );
253
+ if (e == null && (e = Math.floor(Math.random() * t)), e >= t)
254
+ throw new Error(
255
+ `[random][PseudoRandom] startFrom(${e}) must be < count(${t})`
256
+ );
257
+ let r = e;
258
+ return function() {
259
+ return r = (r + ot) % t, r;
260
+ };
261
+ }
262
+ let I = null;
263
+ function Gt() {
264
+ const t = Date.now();
265
+ return I == null || t > I ? (I = t, t) : (I++, I);
266
+ }
267
+ async function bt({
268
+ url: t,
269
+ timeout: e
270
+ } = {}) {
271
+ t || (t = typeof window < "u" ? "/" : "https://google.com");
272
+ let r;
273
+ try {
274
+ const n = new j();
275
+ r = e ? setTimeout(() => {
276
+ n.abort();
277
+ }, e) : null;
278
+ const o = await fetch(t, {
279
+ method: "HEAD",
280
+ signal: lt(n.signal)
281
+ }), s = o.headers.get("date");
282
+ if (!s)
283
+ throw new Error(
284
+ `[Now][getDateInet] No date header in response: ${o.status} ${t}`
285
+ );
286
+ return new Date(s).getTime();
287
+ } finally {
288
+ r && clearTimeout(r);
289
+ }
290
+ }
291
+ function st(t, e, r) {
292
+ const n = e == null ? t : new Date(
293
+ t.toLocaleString("en-US", {
294
+ timeZone: e
295
+ })
296
+ ), o = r == null ? t : new Date(
297
+ t.toLocaleString("en-US", {
298
+ timeZone: r
299
+ })
300
+ );
301
+ return new Date(
302
+ t.getTime() + o.getTime() - n.getTime()
303
+ );
304
+ }
305
+ function Ot(t, e) {
306
+ t = st(t, "UTC", e);
307
+ const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), c = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
308
+ return `${r}-${n}-${o} ${s}:${c}:${a}`;
309
+ }
310
+ let $t = 0;
311
+ const W = /* @__PURE__ */ new WeakMap();
312
+ function $(t) {
313
+ if (W.has(t))
314
+ return W.get(t);
315
+ const e = $t++;
316
+ return W.set(t, e), e;
317
+ }
318
+ function Ut(t, e) {
319
+ try {
320
+ return t[e];
321
+ } catch (r) {
322
+ return "Error: " + (r?.message || String(r));
323
+ }
324
+ }
325
+ function M(t, e = {}, r = [], n = /* @__PURE__ */ new Set()) {
326
+ const {
327
+ pretty: o,
328
+ filter: s,
329
+ maxDepth: c,
330
+ maxItems: a,
331
+ showObjectId: A,
332
+ showArrayIndex: x,
333
+ customToString: T
334
+ } = e;
335
+ if (T) {
336
+ const i = T(t, (u) => M(u, e, r, n));
337
+ if (i != null)
338
+ return i;
339
+ }
340
+ const y = r.length;
341
+ if (typeof t == "string")
342
+ return JSON.stringify(t);
343
+ if (t == null || typeof t != "object")
344
+ return String(t);
345
+ if (typeof t.byteLength == "number")
346
+ return `${t.constructor.name}#${$(t)}[${t.byteLength}]`;
347
+ if (t instanceof RegExp)
348
+ return String(t);
349
+ if (t instanceof Date)
350
+ return Ot(t);
351
+ if (Array.isArray(t)) {
352
+ if (n.has(t) || c != null && y >= c)
353
+ return `#${$(t)}`;
354
+ const i = o ? " ".repeat(y) : "";
355
+ let u = "";
356
+ A && (u += `#${$(t)} `), u += "[";
357
+ const l = a != null ? Math.min(t.length, a) : t.length;
358
+ l > 0 && o && (u += `
359
+ `);
360
+ for (let m = 0; m < l; m++) {
361
+ const d = [...r, String(m)];
362
+ if (s != null && !s(d, t[m]))
363
+ continue;
364
+ const g = t[m], O = M(g, e, d);
365
+ m > 0 && (u += ",", o && (u += `
366
+ `)), o && (u += `${i} `), x && (u += `${m}: `), u += `${O}`;
367
+ }
368
+ return l > 0 && o && (u += `
369
+ `), t.length > l && (l > 0 && (u += ","), u += o ? `${i} ...
370
+ ` : "..."), l > 0 && o && (u += i), u += "]", u;
371
+ }
372
+ if (t instanceof Map) {
373
+ if (n.has(t) || c != null && y >= c)
374
+ return `#${$(t)}`;
375
+ let i = "";
376
+ return A && (i += `#${$(t)} `), i += "Map", i += M(Array.from(t.entries()), e, r, n), i;
377
+ }
378
+ if (t instanceof Set) {
379
+ if (n.has(t) || c != null && y >= c)
380
+ return `#${$(t)}`;
381
+ let i = "";
382
+ return A && (i += `#${$(t)} `), i += "Set", i += M(Array.from(t.values()), e, r, n), i;
383
+ }
384
+ {
385
+ const i = t.prototype?.constructor === Object ? "" : t.prototype?.constructor.name;
386
+ if (n.has(t) || c != null && y >= c)
387
+ return `${i}#${$(t)}`;
388
+ const u = o ? " ".repeat(y) : "";
389
+ let l = i ? `${i} ` : "";
390
+ A && (l += `#${$(t)} `), l += "{";
391
+ const m = a != null ? Math.min(t.length, a) : t.length;
392
+ let d = 0;
393
+ for (const g in t) {
394
+ if (d === 0 && o && (l += `
395
+ `), d >= m) {
396
+ d > 0 && (l += ","), l += o ? `${u} ...
397
+ ` : "...";
398
+ break;
399
+ }
400
+ const O = [...r, g];
401
+ if (s != null && !s(O, t[g]))
402
+ continue;
403
+ const E = Ut(t, g), q = M(E, e, O);
404
+ d > 0 && (l += ",", o && (l += `
405
+ `)), o && (l += `${u} `), l += `${g}: ${q}`, d++;
406
+ }
407
+ return d > 0 && o && (l += `
408
+ ${u}`), l += "}", l;
409
+ }
410
+ }
411
+ function Jt(t, e) {
412
+ t = st(t, "UTC", e);
413
+ const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), c = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
414
+ return `${r}-${n}-${o}_${s}-${c}-${a}`;
415
+ }
416
+ function Xt(t) {
417
+ return t == null ? null : t.replace(/[&<>"']/g, (e) => {
418
+ switch (e) {
419
+ case "&":
420
+ return "&amp;";
421
+ case "<":
422
+ return "&lt;";
423
+ case ">":
424
+ return "&rt;";
425
+ case '"':
426
+ return "&quot;";
427
+ default:
428
+ return "&#039;";
429
+ }
430
+ });
431
+ }
432
+ function Yt(t) {
433
+ return t == null ? null : t?.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
434
+ }
435
+ function Y(t) {
436
+ if (t == null)
437
+ return null;
438
+ if (Array.isArray(t)) {
439
+ const e = t.length, r = [];
440
+ for (let n = 0; n < e; n++)
441
+ r.push(Y(t[n]));
442
+ return r;
443
+ }
444
+ if (typeof t == "object") {
445
+ if (t.constructor && t.constructor !== Object)
446
+ throw new Error(
447
+ `[deepCloneJsonLike] unexpected behavior: value.constructor (${t.constructor}) !== Object`
448
+ );
449
+ const e = {};
450
+ for (const r in t)
451
+ Object.prototype.hasOwnProperty.call(t, r) && (e[r] = Y(t[r]));
452
+ return e;
453
+ }
454
+ return t;
455
+ }
456
+ function V(t, e) {
457
+ if (t === e)
458
+ return !0;
459
+ if (t == null)
460
+ return e == null;
461
+ if (e == null)
462
+ return !1;
463
+ if (Array.isArray(t)) {
464
+ if (!Array.isArray(e))
465
+ return !1;
466
+ const r = t.length;
467
+ if (r !== e.length)
468
+ return !1;
469
+ for (let n = 0; n < r; n++)
470
+ if (!V(t[n], e[n]))
471
+ return !1;
472
+ return !0;
473
+ }
474
+ if (typeof t == "object") {
475
+ if (typeof e != "object")
476
+ return !1;
477
+ if (t.constructor && t.constructor !== Object)
478
+ throw new Error(
479
+ `[deepEqual] unexpected behavior: a.constructor (${t.constructor}) !== Object`
480
+ );
481
+ if (e.constructor && e.constructor !== Object)
482
+ throw new Error(
483
+ `[deepEqual] unexpected behavior: b.constructor (${e.constructor}) !== Object`
484
+ );
485
+ for (const r in t)
486
+ if (Object.prototype.hasOwnProperty.call(t, r) && !V(
487
+ t[r],
488
+ Object.prototype.hasOwnProperty.call(e, r) ? e[r] : null
489
+ ))
490
+ return !1;
491
+ for (const r in e)
492
+ if (Object.prototype.hasOwnProperty.call(e, r) && !Object.prototype.hasOwnProperty.call(t, r) && !V(e[r], null))
493
+ return !1;
494
+ return !0;
495
+ }
496
+ return !1;
497
+ }
498
+ function Kt(t, e) {
499
+ if (t == null || e == null)
500
+ return t == null == (e == null);
501
+ if (t.size !== e.size)
502
+ return !1;
503
+ for (const [r, n] of t)
504
+ if (!V(n, e.get(r)))
505
+ return !1;
506
+ return !0;
507
+ }
508
+ function Qt(t, e) {
509
+ const r = t.length;
510
+ if (r !== e.length)
511
+ return !1;
512
+ for (let n = 0; n < r; n++)
513
+ if (t[n] !== e[n])
514
+ return !1;
515
+ return !0;
516
+ }
517
+ function K(t) {
518
+ return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(K) : t && Object.keys(t).sort().reduce((e, r) => {
519
+ const n = K(t[r]);
520
+ return n != null && (e[r] = n), e;
521
+ }, {});
522
+ }
523
+ function Zt(t) {
524
+ const e = alert;
525
+ return window.alert = (r) => t(e, r), () => {
526
+ window.alert = e;
527
+ };
528
+ }
529
+ var it = /* @__PURE__ */ ((t) => (t.log = "log", t.warn = "warn", t.error = "error", t.info = "info", t.debug = "debug", t.trace = "trace", t.assert = "assert", t))(it || {});
530
+ const Q = Object.values(it);
531
+ function C(t) {
532
+ return function() {
533
+ t.apply(console, arguments);
534
+ };
535
+ }
536
+ const Z = {
537
+ log: C(console.log),
538
+ warn: C(console.warn),
539
+ error: C(console.error),
540
+ info: C(console.info),
541
+ debug: C(console.debug),
542
+ trace: C(console.trace),
543
+ assert: C(console.assert)
544
+ };
545
+ function At(t) {
546
+ return Q.forEach((e) => {
547
+ console[e] = (...r) => {
548
+ t(Z, e, r);
549
+ };
550
+ }), () => {
551
+ Q.forEach((e) => {
552
+ console[e] = Z[e];
553
+ });
554
+ };
555
+ }
556
+ function vt(t) {
557
+ return function(r) {
558
+ const n = At(t);
559
+ try {
560
+ const o = r();
561
+ return J(o) ? o.then(
562
+ (s) => (n(), s),
563
+ (s) => {
564
+ throw n(), s;
565
+ }
566
+ ) : o;
567
+ } finally {
568
+ n();
569
+ }
570
+ };
571
+ }
572
+ function Tt() {
573
+ let t = new Error().stack;
574
+ if (t != null) {
575
+ const e = t.indexOf(`
576
+ `);
577
+ e != null && e >= 0 && (t = t.substring(e + 1));
578
+ }
579
+ return t ?? "";
580
+ }
581
+ function jt(t) {
582
+ return function(...e) {
583
+ const r = Tt();
584
+ try {
585
+ return t.apply(this, e);
586
+ } catch (n) {
587
+ throw n instanceof Error || (n = new Error(String(n))), n.stack = n.stack ? n.stack + `
588
+ ` + r : r, n;
589
+ }
590
+ };
591
+ }
592
+ function Et(t) {
593
+ if (!t || t.timeout == null)
594
+ return null;
595
+ const e = new j(), r = t.timeController ?? ct;
596
+ if (t.timeout) {
597
+ const n = r.setTimeout(() => {
598
+ e.abort(
599
+ new at(
600
+ `[timeoutAbortController] Timeout error: ${t.timeout}ms`
601
+ )
602
+ );
603
+ }, t.timeout);
604
+ e.signal.subscribe(() => {
605
+ clearTimeout(n);
606
+ });
607
+ }
608
+ return t.abortSignal?.subscribe((n) => {
609
+ e.abort(n);
610
+ }), e;
611
+ }
612
+ async function te(t, e) {
613
+ const r = Et(e);
614
+ try {
615
+ return await t(r?.signal ?? e?.abortSignal ?? null);
616
+ } finally {
617
+ r?.abort();
618
+ }
619
+ }
620
+ class ee {
621
+ _options;
622
+ _hasValue = !1;
623
+ _promiseOrValue = null;
624
+ constructor(e) {
625
+ this._options = e;
626
+ }
627
+ run() {
628
+ if (!this._hasValue) {
629
+ let e = this._options.func();
630
+ const r = (o) => (this._options.persist ? this._promiseOrValue = o : (this._promiseOrValue = null, this._hasValue = !1), o), n = (o) => {
631
+ throw this._options.persist || (this._promiseOrValue = null, this._hasValue = !1), o;
632
+ };
633
+ if (J(e))
634
+ e = e.then(r, n);
635
+ else if (!this._options.persist)
636
+ return e;
637
+ this._promiseOrValue = e, this._hasValue = !0;
638
+ }
639
+ return this._promiseOrValue;
640
+ }
641
+ set(e) {
642
+ if (!this._options.persist)
643
+ throw new Error("[Lazy][set] Cannot set value when persist is false");
644
+ this._hasValue = !0, this._promiseOrValue = e;
645
+ }
646
+ }
647
+ class re {
648
+ _options;
649
+ _promiseOrValues = /* @__PURE__ */ new Map();
650
+ constructor(e) {
651
+ this._options = e;
652
+ }
653
+ run(e) {
654
+ if (this._promiseOrValues.has(e))
655
+ return this._promiseOrValues.get(e);
656
+ let r = this._options.func(e);
657
+ const n = (s) => (this._options.persist ? this._promiseOrValues.set(e, s) : this._promiseOrValues.delete(e), s), o = (s) => {
658
+ throw this._options.persist || this._promiseOrValues.delete(e), s;
659
+ };
660
+ if (J(r))
661
+ r = r.then(n, o);
662
+ else if (!this._options.persist)
663
+ return r;
664
+ return this._promiseOrValues.set(e, r), r;
665
+ }
666
+ set(e, r) {
667
+ if (!this._options.persist)
668
+ throw new Error(
669
+ "[LazyWithId][set] Cannot set value when persist is false"
670
+ );
671
+ this._promiseOrValues.set(e, r);
672
+ }
673
+ }
674
+ function v(t) {
675
+ return t.replace(/\W/g, "").toLowerCase();
676
+ }
677
+ function Ct(t) {
678
+ return t instanceof URL ? t.searchParams : t instanceof URLSearchParams ? t : typeof t == "string" ? new URL(t).searchParams : typeof window < "u" ? new URL(window.location.href).searchParams : new URLSearchParams();
679
+ }
680
+ function xt(t) {
681
+ return t == null ? null : (t = t.toLowerCase().trim(), t === "true" || t === "1" || t === "yes" ? !0 : t === "false" || t === "0" || t === "no" ? !1 : null);
682
+ }
683
+ function Rt(t) {
684
+ if (t == null)
685
+ return null;
686
+ t = t.trim();
687
+ const e = parseInt(t, 10);
688
+ return isNaN(e) ? null : e;
689
+ }
690
+ function It(t) {
691
+ if (t == null)
692
+ return null;
693
+ t = t.trim();
694
+ const e = parseFloat(t);
695
+ return isNaN(e) ? null : e;
696
+ }
697
+ function X(t, e) {
698
+ const r = Ct(e), n = v(t);
699
+ for (const [o, s] of r.entries())
700
+ if (v(o) === n)
701
+ return s;
702
+ return null;
703
+ }
704
+ function ne(t, e) {
705
+ return xt(X(t, e));
706
+ }
707
+ function oe(t, e) {
708
+ return Rt(X(t, e));
709
+ }
710
+ function se(t, e) {
711
+ return It(X(t, e));
712
+ }
713
+ export {
714
+ V as A,
715
+ Kt as B,
716
+ Qt as C,
717
+ K as D,
718
+ Zt as E,
719
+ it as F,
720
+ At as G,
721
+ vt as H,
722
+ jt as I,
723
+ Tt as J,
724
+ Et as K,
725
+ te as L,
726
+ ee as M,
727
+ re as N,
728
+ Ct as O,
729
+ xt as P,
730
+ Rt as Q,
731
+ b as R,
732
+ It as S,
733
+ X as T,
734
+ H as U,
735
+ ne as V,
736
+ oe as W,
737
+ se as X,
738
+ Pt as a,
739
+ wt as b,
740
+ Lt as c,
741
+ St as d,
742
+ _t as e,
743
+ Bt as f,
744
+ qt as g,
745
+ zt as h,
746
+ nt as i,
747
+ Ft as j,
748
+ Ht as k,
749
+ Wt as l,
750
+ dt as m,
751
+ Vt as n,
752
+ Gt as o,
753
+ bt as p,
754
+ st as q,
755
+ rt as r,
756
+ mt as s,
757
+ ht as t,
758
+ M as u,
759
+ Ot as v,
760
+ Jt as w,
761
+ Xt as x,
762
+ Yt as y,
763
+ Y as z
764
+ };