zeed 0.7.167 → 0.8.2

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 (35) hide show
  1. package/dist/{chunk-WQRLPDXE.js → chunk-3LN7HI45.js} +192 -328
  2. package/dist/chunk-3LN7HI45.js.map +1 -0
  3. package/dist/{chunk-F6ZPROGL.js → chunk-AM7QCF4I.js} +19 -33
  4. package/dist/chunk-AM7QCF4I.js.map +1 -0
  5. package/dist/{chunk-UX6IDOAX.js → chunk-HI3XD4NV.js} +111 -111
  6. package/dist/chunk-HI3XD4NV.js.map +1 -0
  7. package/dist/{chunk-D42UTWJ7.js → chunk-IFNHRAHG.js} +4 -30
  8. package/dist/chunk-IFNHRAHG.js.map +1 -0
  9. package/dist/{chunk-7FVNJHQY.js → chunk-OJCXV4BY.js} +17 -18
  10. package/dist/chunk-OJCXV4BY.js.map +1 -0
  11. package/dist/index.all.cjs +321 -420
  12. package/dist/index.all.cjs.map +1 -1
  13. package/dist/index.all.d.ts +1 -1
  14. package/dist/index.all.js +5 -574
  15. package/dist/index.all.js.map +1 -1
  16. package/dist/index.browser.cjs +222 -365
  17. package/dist/index.browser.cjs.map +1 -1
  18. package/dist/index.browser.js +4 -530
  19. package/dist/index.browser.js.map +1 -1
  20. package/dist/index.log.cjs +33 -13
  21. package/dist/index.log.cjs.map +1 -1
  22. package/dist/index.log.js +2 -14
  23. package/dist/index.log.js.map +1 -1
  24. package/dist/index.node.cjs +307 -403
  25. package/dist/index.node.cjs.map +1 -1
  26. package/dist/index.node.d.ts +1 -1
  27. package/dist/index.node.js +3 -552
  28. package/dist/index.node.js.map +1 -1
  29. package/dist/{log-util-6f64500b.d.ts → log-util-f17f30b5.d.ts} +11 -1
  30. package/package.json +9 -8
  31. package/dist/chunk-7FVNJHQY.js.map +0 -1
  32. package/dist/chunk-D42UTWJ7.js.map +0 -1
  33. package/dist/chunk-F6ZPROGL.js.map +0 -1
  34. package/dist/chunk-UX6IDOAX.js.map +0 -1
  35. package/dist/chunk-WQRLPDXE.js.map +0 -1
@@ -1,13 +1,4 @@
1
- import {
2
- Logger,
3
- __name,
4
- deepMerge,
5
- getGlobalContext,
6
- getTimestamp,
7
- isArray,
8
- useLevelFilter,
9
- useNamespaceFilter
10
- } from "./chunk-F6ZPROGL.js";
1
+ import { Logger, __name, getGlobalContext, getTimestamp, useNamespaceFilter, useLevelFilter, isArray, deepMerge } from './chunk-AM7QCF4I.js';
11
2
 
12
3
  // src/common/data/bin.ts
13
4
  var log = Logger("bin");
@@ -166,9 +157,11 @@ function Uint8ArrayToJson(data) {
166
157
  }
167
158
  __name(Uint8ArrayToJson, "Uint8ArrayToJson");
168
159
  function Uint8ArrayToHexDump(buffer, blockSize) {
169
- if (typeof buffer === "string") {
170
- } else if (buffer instanceof ArrayBuffer && buffer.byteLength !== void 0) {
171
- buffer = String.fromCharCode.apply(String, [].slice.call(new Uint8Array(buffer)));
160
+ if (typeof buffer === "string") ; else if (buffer instanceof ArrayBuffer && buffer.byteLength !== void 0) {
161
+ buffer = String.fromCharCode.apply(
162
+ String,
163
+ [].slice.call(new Uint8Array(buffer))
164
+ );
172
165
  } else if (Array.isArray(buffer)) {
173
166
  buffer = String.fromCharCode.apply(String, buffer);
174
167
  } else if (buffer.constructor === Uint8Array) {
@@ -212,27 +205,45 @@ var DEFAULT_HASH_ALG = "SHA-256";
212
205
  var DEFAULT_CRYPTO_ALG = "AES-GCM";
213
206
  var DEFAULT_DERIVE_ALG = "PBKDF2";
214
207
  async function digest(message, algorithm = DEFAULT_HASH_ALG) {
215
- return toUint8Array(await crypto.subtle.digest(algorithm, toUint8Array(message)));
208
+ return toUint8Array(
209
+ await crypto.subtle.digest(algorithm, toUint8Array(message))
210
+ );
216
211
  }
217
212
  __name(digest, "digest");
218
213
  async function deriveKeyPbkdf2(secret, opt = {}) {
219
214
  const secretBuffer = toUint8Array(secret);
220
- const keyMaterial = await crypto.subtle.importKey("raw", secretBuffer, DEFAULT_DERIVE_ALG, false, ["deriveKey"]);
221
- return await crypto.subtle.deriveKey({
222
- name: DEFAULT_DERIVE_ALG,
223
- salt: opt.salt ? toUint8Array(opt.salt) : new Uint8Array(0),
224
- iterations: opt.iterations ?? 1e5,
225
- hash: DEFAULT_HASH_ALG
226
- }, keyMaterial, {
227
- name: DEFAULT_CRYPTO_ALG,
228
- length: 256
229
- }, true, ["encrypt", "decrypt"]);
215
+ const keyMaterial = await crypto.subtle.importKey(
216
+ "raw",
217
+ secretBuffer,
218
+ DEFAULT_DERIVE_ALG,
219
+ false,
220
+ ["deriveKey"]
221
+ );
222
+ return await crypto.subtle.deriveKey(
223
+ {
224
+ name: DEFAULT_DERIVE_ALG,
225
+ salt: opt.salt ? toUint8Array(opt.salt) : new Uint8Array(0),
226
+ iterations: opt.iterations ?? 1e5,
227
+ hash: DEFAULT_HASH_ALG
228
+ },
229
+ keyMaterial,
230
+ {
231
+ name: DEFAULT_CRYPTO_ALG,
232
+ length: 256
233
+ },
234
+ true,
235
+ ["encrypt", "decrypt"]
236
+ );
230
237
  }
231
238
  __name(deriveKeyPbkdf2, "deriveKeyPbkdf2");
232
239
  var MAGIC_ID = new Uint8Array([1, 1]);
233
240
  async function encrypt(data, key) {
234
241
  const iv = randomUint8Array(12);
235
- const cipher = await crypto.subtle.encrypt({ name: DEFAULT_CRYPTO_ALG, iv }, key, data);
242
+ const cipher = await crypto.subtle.encrypt(
243
+ { name: DEFAULT_CRYPTO_ALG, iv },
244
+ key,
245
+ data
246
+ );
236
247
  const binCypher = new Uint8Array(cipher);
237
248
  const bufferLength = MAGIC_ID.length + iv.length + binCypher.length;
238
249
  const buffer = new Uint8Array(bufferLength);
@@ -252,15 +263,17 @@ async function decrypt(data, key) {
252
263
  }
253
264
  let iv = data.subarray(2, 2 + 12);
254
265
  let cipher = data.subarray(2 + 12, data.length);
255
- const plain = await crypto.subtle.decrypt({ name: DEFAULT_CRYPTO_ALG, iv }, key, cipher);
266
+ const plain = await crypto.subtle.decrypt(
267
+ { name: DEFAULT_CRYPTO_ALG, iv },
268
+ key,
269
+ cipher
270
+ );
256
271
  return new Uint8Array(plain);
257
272
  }
258
273
  __name(decrypt, "decrypt");
259
274
 
260
275
  // src/common/csv.ts
261
276
  var separator = ",";
262
- var preventCast = false;
263
- var ignoreNullOrUndefined = true;
264
277
  function filterFloat(value) {
265
278
  if (/^([-+])?([0-9]+(\.[0-9]+)?|Infinity)$/.test(value)) {
266
279
  return Number(value);
@@ -269,12 +282,9 @@ function filterFloat(value) {
269
282
  }
270
283
  __name(filterFloat, "filterFloat");
271
284
  function escape2(field) {
272
- if (ignoreNullOrUndefined && field == void 0) {
285
+ if (field == void 0) {
273
286
  return "";
274
287
  }
275
- if (preventCast) {
276
- return '="' + String(field).replace(/"/g, '""') + '"';
277
- }
278
288
  if (!isNaN(filterFloat(field)) && isFinite(field)) {
279
289
  return parseFloat(field);
280
290
  }
@@ -475,11 +485,17 @@ function arrayRandomElement(array) {
475
485
  }
476
486
  __name(arrayRandomElement, "arrayRandomElement");
477
487
  function arrayMax(...array) {
478
- return arrayFlatten(array).reduce((acc, value) => acc != null ? value > acc ? value : acc : value, void 0);
488
+ return arrayFlatten(array).reduce(
489
+ (acc, value) => acc != null ? value > acc ? value : acc : value,
490
+ void 0
491
+ );
479
492
  }
480
493
  __name(arrayMax, "arrayMax");
481
494
  function arrayMin(...array) {
482
- return arrayFlatten(array).reduce((acc, value) => acc != null ? value < acc ? value : acc : value, void 0);
495
+ return arrayFlatten(array).reduce(
496
+ (acc, value) => acc != null ? value < acc ? value : acc : value,
497
+ void 0
498
+ );
483
499
  }
484
500
  __name(arrayMin, "arrayMin");
485
501
  function arraySum(...array) {
@@ -833,15 +849,24 @@ var _Currency = class {
833
849
  }
834
850
  add(number) {
835
851
  let { intValue, _settings, _precision } = this;
836
- return currency((intValue += parse(number, _settings)) / (_settings.fromCents ? 1 : _precision), _settings);
852
+ return currency(
853
+ (intValue += parse(number, _settings)) / (_settings.fromCents ? 1 : _precision),
854
+ _settings
855
+ );
837
856
  }
838
857
  subtract(number) {
839
858
  let { intValue, _settings, _precision } = this;
840
- return currency((intValue -= parse(number, _settings)) / (_settings.fromCents ? 1 : _precision), _settings);
859
+ return currency(
860
+ (intValue -= parse(number, _settings)) / (_settings.fromCents ? 1 : _precision),
861
+ _settings
862
+ );
841
863
  }
842
864
  multiply(number) {
843
865
  let { intValue, _settings, _precision } = this;
844
- return currency((intValue *= number) / (_settings.fromCents ? 1 : pow(_precision)), _settings);
866
+ return currency(
867
+ (intValue *= number) / (_settings.fromCents ? 1 : pow(_precision)),
868
+ _settings
869
+ );
845
870
  }
846
871
  divide(number) {
847
872
  let { intValue, _settings } = this;
@@ -872,13 +897,18 @@ var _Currency = class {
872
897
  }
873
898
  toString() {
874
899
  let { intValue, _precision, _settings } = this;
875
- return rounding(intValue / _precision, _settings.increment).toFixed(_settings.precision);
900
+ return rounding(intValue / _precision, _settings.increment).toFixed(
901
+ _settings.precision
902
+ );
876
903
  }
877
904
  toJSON() {
878
905
  return this.value;
879
906
  }
880
907
  static sum(...array) {
881
- return arrayFlatten(array).reduce((acc, value) => currency(acc).add(value), this.zero);
908
+ return arrayFlatten(array).reduce(
909
+ (acc, value) => currency(acc).add(value),
910
+ this.zero
911
+ );
882
912
  }
883
913
  static avg(...array) {
884
914
  let arr = arrayFlatten(array);
@@ -916,7 +946,10 @@ function parse(value, opts, useRounding = true) {
916
946
  __name(parse, "parse");
917
947
  function format(currency2, settings) {
918
948
  let { pattern: pattern2, negativePattern, symbol, separator: separator2, decimal: decimal2, groups } = settings, split = ("" + currency2).replace(/^-/, "").split("."), dollars = split[0], cents = split[1];
919
- return (currency2.value >= 0 ? pattern2 : negativePattern).replace("!", symbol).replace("#", dollars.replace(groups, "$1" + separator2) + (cents ? decimal2 + cents : ""));
949
+ return (currency2.value >= 0 ? pattern2 : negativePattern).replace("!", symbol).replace(
950
+ "#",
951
+ dollars.replace(groups, "$1" + separator2) + (cents ? decimal2 + cents : "")
952
+ );
920
953
  }
921
954
  __name(format, "format");
922
955
 
@@ -939,7 +972,11 @@ function dayToParts(day2) {
939
972
  }
940
973
  __name(dayToParts, "dayToParts");
941
974
  function dayToDate(day2, gmt = false) {
942
- return gmt ? new Date(`${dayToString(day2)}T00:00:00.000Z`) : new Date(day2 / 1e4, day2 / 100 % 100 - 1, day2 % 100);
975
+ return gmt ? new Date(`${dayToString(day2)}T00:00:00.000Z`) : new Date(
976
+ day2 / 1e4,
977
+ day2 / 100 % 100 - 1,
978
+ day2 % 100
979
+ );
943
980
  }
944
981
  __name(dayToDate, "dayToDate");
945
982
  function dayFromToday() {
@@ -1127,7 +1164,9 @@ function waitOn(obj, event, timeoutMS = 1e3) {
1127
1164
  }
1128
1165
  __name(waitOn, "waitOn");
1129
1166
  function isPromise(value) {
1130
- return Boolean(value && (value instanceof Promise || typeof value.then === "function"));
1167
+ return Boolean(
1168
+ value && (value instanceof Promise || typeof value.then === "function")
1169
+ );
1131
1170
  }
1132
1171
  __name(isPromise, "isPromise");
1133
1172
  function promisify(value) {
@@ -1163,7 +1202,9 @@ var Day = class {
1163
1202
  return Day.from(+dateString.replace(/[^0-9]/g, "").slice(0, 8));
1164
1203
  }
1165
1204
  static fromDate(date, gmt = false) {
1166
- return gmt ? Day.fromString(date.toISOString().substr(0, 10)) : Day.from(date.getFullYear() * 1e4 + (date.getMonth() + 1) * 100 + date.getDate());
1205
+ return gmt ? Day.fromString(date.toISOString().substr(0, 10)) : Day.from(
1206
+ date.getFullYear() * 1e4 + (date.getMonth() + 1) * 100 + date.getDate()
1207
+ );
1167
1208
  }
1168
1209
  static fromDateGMT(date) {
1169
1210
  return Day.fromDate(date, true);
@@ -1197,7 +1238,11 @@ var Day = class {
1197
1238
  return baseString.slice(0, 4) + sep + baseString.slice(4, 6) + sep + baseString.slice(6, 8);
1198
1239
  }
1199
1240
  toDate(gmt = false) {
1200
- return gmt ? new Date(`${this.toString()}T00:00:00.000Z`) : new Date(this.days / 1e4, this.days / 100 % 100 - 1, this.days % 100);
1241
+ return gmt ? new Date(`${this.toString()}T00:00:00.000Z`) : new Date(
1242
+ this.days / 1e4,
1243
+ this.days / 100 % 100 - 1,
1244
+ this.days % 100
1245
+ );
1201
1246
  }
1202
1247
  toDateGMT() {
1203
1248
  return this.toDate(true);
@@ -1212,7 +1257,9 @@ var Day = class {
1212
1257
  return Math.floor(this.days % 100);
1213
1258
  }
1214
1259
  dayOffset(offset) {
1215
- return Day.fromDateGMT(new Date(this.toDateGMT().getTime() + offset * DAY_MS));
1260
+ return Day.fromDateGMT(
1261
+ new Date(this.toDateGMT().getTime() + offset * DAY_MS)
1262
+ );
1216
1263
  }
1217
1264
  monthStart() {
1218
1265
  return Day.from([this.year, this.month, 1]);
@@ -1230,7 +1277,9 @@ var Day = class {
1230
1277
  }
1231
1278
  daysUntil(otherDay) {
1232
1279
  var _a;
1233
- return Math.round((((_a = new Day(otherDay)) == null ? void 0 : _a.toDateGMT().getTime()) - this.toDateGMT().getTime()) / DAY_MS);
1280
+ return Math.round(
1281
+ (((_a = new Day(otherDay)) == null ? void 0 : _a.toDateGMT().getTime()) - this.toDateGMT().getTime()) / DAY_MS
1282
+ );
1234
1283
  }
1235
1284
  yesterday() {
1236
1285
  return this.dayOffset(-1);
@@ -1306,7 +1355,9 @@ function toValidFilename(string) {
1306
1355
  }
1307
1356
  const replacement = "_";
1308
1357
  if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) {
1309
- throw new Error("Replacement string cannot contain reserved filename characters");
1358
+ throw new Error(
1359
+ "Replacement string cannot contain reserved filename characters"
1360
+ );
1310
1361
  }
1311
1362
  string = string.replace(filenameReservedRegex(), replacement).replace(reControlChars, replacement).replace(reRelativePath, replacement).replace(reTrailingPeriods, "");
1312
1363
  string = windowsReservedNameRegex().test(string) ? string + replacement : string;
@@ -1397,7 +1448,9 @@ var findURL = /((?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?
1397
1448
  function linkifyPlainText(text) {
1398
1449
  return text.split(findURL).map((part, i) => {
1399
1450
  const escapedPart = escapeHTML(part);
1400
- return i % 2 ? `<a target="_blank" href="${escapedPart}">${toHumanReadableUrl(escapedPart)}</a>` : escapedPart;
1451
+ return i % 2 ? `<a target="_blank" href="${escapedPart}">${toHumanReadableUrl(
1452
+ escapedPart
1453
+ )}</a>` : escapedPart;
1401
1454
  }).join("");
1402
1455
  }
1403
1456
  __name(linkifyPlainText, "linkifyPlainText");
@@ -1414,7 +1467,9 @@ function encodeQuery(data) {
1414
1467
  }
1415
1468
  for (let v of value) {
1416
1469
  if (v != null) {
1417
- pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(String(v)));
1470
+ pairs.push(
1471
+ encodeURIComponent(key) + "=" + encodeURIComponent(String(v))
1472
+ );
1418
1473
  }
1419
1474
  }
1420
1475
  }
@@ -1705,12 +1760,16 @@ function useDefer(config = {}) {
1705
1760
  let result = step();
1706
1761
  if (isPromise(result)) {
1707
1762
  if (expectSync)
1708
- throw new Error(`Expected sync only function, but found async: ${step}`);
1763
+ throw new Error(
1764
+ `Expected sync only function, but found async: ${step}`
1765
+ );
1709
1766
  await result;
1710
1767
  }
1711
1768
  } else if (isPromise(step)) {
1712
1769
  if (expectSync)
1713
- throw new Error(`Expected sync only function, but found async: ${step}`);
1770
+ throw new Error(
1771
+ `Expected sync only function, but found async: ${step}`
1772
+ );
1714
1773
  await step;
1715
1774
  } else {
1716
1775
  throw new Error(`Unhandled disposable: ${step}`);
@@ -1879,7 +1938,9 @@ var Emitter = class {
1879
1938
  };
1880
1939
  }
1881
1940
  off(event, listener) {
1882
- this.subscribers[event] = (this.subscribers[event] || []).filter((f) => listener && f !== listener);
1941
+ this.subscribers[event] = (this.subscribers[event] || []).filter(
1942
+ (f) => listener && f !== listener
1943
+ );
1883
1944
  return this;
1884
1945
  }
1885
1946
  removeAllListeners() {
@@ -2008,7 +2069,10 @@ function qid() {
2008
2069
  }
2009
2070
  __name(qid, "qid");
2010
2071
  var pattern = "10000000-1000-4000-8000-100000000000";
2011
- var uuidv4 = typeof crypto !== "undefined" && crypto.randomUUID != null ? crypto.randomUUID : () => pattern.replace(/[018]/g, (c) => (c ^ randomUint8Array(1)[0] & 15 >> c / 4).toString(16));
2072
+ var uuidv4 = typeof crypto !== "undefined" && crypto.randomUUID != null ? crypto.randomUUID : () => pattern.replace(
2073
+ /[018]/g,
2074
+ (c) => (c ^ randomUint8Array(1)[0] & 15 >> c / 4).toString(16)
2075
+ );
2012
2076
  var ReferenceDateInMS = 16e11;
2013
2077
  function longToByteArray(long) {
2014
2078
  var byteArray = new Uint8Array([0, 0, 0, 0, 0, 0]);
@@ -2035,9 +2099,11 @@ function suidDate(id) {
2035
2099
  }
2036
2100
  __name(suidDate, "suidDate");
2037
2101
  function suidBytesDate(id) {
2038
- return new Date(ReferenceDateInMS + id.slice(0, 6).reduce((acc, byte) => {
2039
- return acc * 256 + byte;
2040
- }, 0));
2102
+ return new Date(
2103
+ ReferenceDateInMS + id.slice(0, 6).reduce((acc, byte) => {
2104
+ return acc * 256 + byte;
2105
+ }, 0)
2106
+ );
2041
2107
  }
2042
2108
  __name(suidBytesDate, "suidBytesDate");
2043
2109
 
@@ -2083,7 +2149,13 @@ function usePool(config = {}) {
2083
2149
  presentMax += max;
2084
2150
  presentResolved += state === 2 /* finished */ ? max : Math.min(max, resolved);
2085
2151
  }
2086
- events.emit("didUpdate", countMax, countResolved, presentMax, presentResolved);
2152
+ events.emit(
2153
+ "didUpdate",
2154
+ countMax,
2155
+ countResolved,
2156
+ presentMax,
2157
+ presentResolved
2158
+ );
2087
2159
  }
2088
2160
  __name(didUpdate, "didUpdate");
2089
2161
  function performNext() {
@@ -2092,7 +2164,9 @@ function usePool(config = {}) {
2092
2164
  didFinish();
2093
2165
  if (currentParallel >= maxParallel)
2094
2166
  return;
2095
- let waitingTasks = Object.values(tasks).filter((t) => t.state === 0 /* waiting */);
2167
+ let waitingTasks = Object.values(tasks).filter(
2168
+ (t) => t.state === 0 /* waiting */
2169
+ );
2096
2170
  if (waitingTasks.length > 0) {
2097
2171
  let taskInfo;
2098
2172
  for (let t of waitingTasks) {
@@ -2325,10 +2399,7 @@ var SerialQueue = class extends Emitter {
2325
2399
  }
2326
2400
  };
2327
2401
  __name(SerialQueue, "SerialQueue");
2328
-
2329
- // src/common/exec/throttle-debounce.ts
2330
- var DEBUG = false;
2331
- var log6 = DEBUG ? Logger("zeed:throttle") : () => {
2402
+ var log6 = () => {
2332
2403
  };
2333
2404
  function throttle(callback, opt = {}) {
2334
2405
  const { delay = 100, trailing = true, leading = true } = opt;
@@ -2361,10 +2432,8 @@ function throttle(callback, opt = {}) {
2361
2432
  __name(exec, "exec");
2362
2433
  trailingExec = exec;
2363
2434
  if (elapsed > delay || !timeoutID) {
2364
- DEBUG && log6("elapsed", debugElapsed());
2365
2435
  if (leading) {
2366
2436
  if (elapsed > delay) {
2367
- DEBUG && log6("\u{1F680} leading", debugElapsed());
2368
2437
  exec();
2369
2438
  } else {
2370
2439
  ++visited;
@@ -2375,16 +2444,13 @@ function throttle(callback, opt = {}) {
2375
2444
  clearExistingTimeout();
2376
2445
  checkpoint = now;
2377
2446
  timeoutID = setTimeout(() => {
2378
- DEBUG && log6("\u23F1 reached timeout", debugElapsed());
2379
2447
  timeoutID = 0;
2380
2448
  if (trailing && (!leading || visited > 0)) {
2381
- DEBUG && log6("\u{1F680} trailing", debugElapsed());
2382
2449
  trailingExec == null ? void 0 : trailingExec();
2383
2450
  }
2384
2451
  }, timeout2);
2385
2452
  } else {
2386
2453
  ++visited;
2387
- DEBUG && log6("visited", debugElapsed());
2388
2454
  }
2389
2455
  }
2390
2456
  __name(wrapper, "wrapper");
@@ -2420,7 +2486,9 @@ __name(debounce, "debounce");
2420
2486
 
2421
2487
  // src/common/localhost.ts
2422
2488
  function isLocalHost(hostname = ((_a) => (_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.hostname)() ?? "") {
2423
- return ["::ffff:127.0.0.1", "localhost", "127.0.0.1", "", "::1", "::"].includes(hostname) || hostname.startsWith("192.168.") || hostname.startsWith("10.0.") || hostname.endsWith(".local");
2489
+ return ["::ffff:127.0.0.1", "localhost", "127.0.0.1", "", "::1", "::"].includes(
2490
+ hostname
2491
+ ) || hostname.startsWith("192.168.") || hostname.startsWith("10.0.") || hostname.endsWith(".local");
2424
2492
  }
2425
2493
  __name(isLocalHost, "isLocalHost");
2426
2494
 
@@ -2627,7 +2695,12 @@ function useMessageHub(opt = {}) {
2627
2695
  args,
2628
2696
  id
2629
2697
  });
2630
- return tryTimeout(new Promise((resolve, reject) => waitingForResponse[id] = [resolve, reject]), timeout2);
2698
+ return tryTimeout(
2699
+ new Promise(
2700
+ (resolve, reject) => waitingForResponse[id] = [resolve, reject]
2701
+ ),
2702
+ timeout2
2703
+ );
2631
2704
  }, "fetchMessage");
2632
2705
  if (opt.channel) {
2633
2706
  connect(opt.channel);
@@ -2757,26 +2830,29 @@ function useRPC(functions, options) {
2757
2830
  rpcPromiseMap.delete(id);
2758
2831
  }
2759
2832
  });
2760
- return new Proxy({}, {
2761
- get(_, method) {
2762
- const sendEvent = /* @__PURE__ */ __name((...args) => {
2763
- post(serialize([2 /* event */, args, null, method]));
2764
- }, "sendEvent");
2765
- if (options.onlyEvents || eventNames.includes(method)) {
2766
- sendEvent.asEvent = sendEvent;
2767
- return sendEvent;
2833
+ return new Proxy(
2834
+ {},
2835
+ {
2836
+ get(_, method) {
2837
+ const sendEvent = /* @__PURE__ */ __name((...args) => {
2838
+ post(serialize([2 /* event */, args, null, method]));
2839
+ }, "sendEvent");
2840
+ if (options.onlyEvents || eventNames.includes(method)) {
2841
+ sendEvent.asEvent = sendEvent;
2842
+ return sendEvent;
2843
+ }
2844
+ const sendCall = /* @__PURE__ */ __name((...args) => {
2845
+ return new Promise((resolve, reject) => {
2846
+ const id = rpcCounter++;
2847
+ rpcPromiseMap.set(id, { resolve, reject });
2848
+ post(serialize([1 /* request */, args, id, method]));
2849
+ });
2850
+ }, "sendCall");
2851
+ sendCall.asEvent = sendEvent;
2852
+ return sendCall;
2768
2853
  }
2769
- const sendCall = /* @__PURE__ */ __name((...args) => {
2770
- return new Promise((resolve, reject) => {
2771
- const id = rpcCounter++;
2772
- rpcPromiseMap.set(id, { resolve, reject });
2773
- post(serialize([1 /* request */, args, id, method]));
2774
- });
2775
- }, "sendCall");
2776
- sendCall.asEvent = sendEvent;
2777
- return sendCall;
2778
2854
  }
2779
- });
2855
+ );
2780
2856
  }
2781
2857
  __name(useRPC, "useRPC");
2782
2858
 
@@ -2807,7 +2883,11 @@ async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
2807
2883
  let auth = parseBasicAuth(String(url));
2808
2884
  if (auth) {
2809
2885
  url = auth.url;
2810
- fetchOptions = deepMerge({}, fetchOptions, fetchOptionsBasicAuth(auth.username, auth.password));
2886
+ fetchOptions = deepMerge(
2887
+ {},
2888
+ fetchOptions,
2889
+ fetchOptionsBasicAuth(auth.username, auth.password)
2890
+ );
2811
2891
  }
2812
2892
  if (fetchOptions.headers != null && !(fetchOptions.headers instanceof Headers)) {
2813
2893
  fetchOptions.headers = new Headers(fetchOptions.headers);
@@ -2818,7 +2898,9 @@ async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
2818
2898
  return response;
2819
2899
  }
2820
2900
  try {
2821
- log7.warn(`Fetch of ${url} with ${fetchOptions} returned status=${response.status}`);
2901
+ log7.warn(
2902
+ `Fetch of ${url} with ${fetchOptions} returned status=${response.status}`
2903
+ );
2822
2904
  log7.warn(`Response: ${await response.text()}`);
2823
2905
  } catch (err) {
2824
2906
  log7.error("Exception:", err);
@@ -2830,15 +2912,19 @@ async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
2830
2912
  __name(fetchBasic, "fetchBasic");
2831
2913
  async function fetchJson(url, fetchOptions = {}, fetchFn = fetch) {
2832
2914
  try {
2833
- let res = await fetchBasic(url, [
2834
- {
2835
- method: "GET",
2836
- headers: {
2837
- Accept: "application/json"
2838
- }
2839
- },
2840
- fetchOptions
2841
- ], fetchFn);
2915
+ let res = await fetchBasic(
2916
+ url,
2917
+ [
2918
+ {
2919
+ method: "GET",
2920
+ headers: {
2921
+ Accept: "application/json"
2922
+ }
2923
+ },
2924
+ fetchOptions
2925
+ ],
2926
+ fetchFn
2927
+ );
2842
2928
  if (res) {
2843
2929
  return await res.json();
2844
2930
  }
@@ -2849,7 +2935,11 @@ async function fetchJson(url, fetchOptions = {}, fetchFn = fetch) {
2849
2935
  __name(fetchJson, "fetchJson");
2850
2936
  async function fetchText(url, fetchOptions = {}, fetchFn = fetch) {
2851
2937
  try {
2852
- let res = await fetchBasic(url, [defaultOptions, { method: "GET" }, fetchOptions], fetchFn);
2938
+ let res = await fetchBasic(
2939
+ url,
2940
+ [defaultOptions, { method: "GET" }, fetchOptions],
2941
+ fetchFn
2942
+ );
2853
2943
  if (res) {
2854
2944
  return await res.text();
2855
2945
  }
@@ -2958,7 +3048,7 @@ function useExitHandler(handler) {
2958
3048
  __name(useExitHandler, "useExitHandler");
2959
3049
 
2960
3050
  // src/common/storage/memstorage.ts
2961
- var log8 = Logger("zeed:memstorage");
3051
+ Logger("zeed:memstorage");
2962
3052
  var MemStorage = class {
2963
3053
  constructor(opt = {}) {
2964
3054
  this.store = {};
@@ -2983,231 +3073,5 @@ var MemStorage = class {
2983
3073
  };
2984
3074
  __name(MemStorage, "MemStorage");
2985
3075
 
2986
- export {
2987
- _encodeUtf8Polyfill,
2988
- _decodeUtf8Polyfill,
2989
- stringToUInt8Array,
2990
- Uint8ArrayToString,
2991
- toUint8Array,
2992
- joinToUint8Array,
2993
- toHex,
2994
- toBase64,
2995
- toBase64Url,
2996
- fromBase64,
2997
- equalBinary,
2998
- jsonToUint8Array,
2999
- Uint8ArrayToJson,
3000
- Uint8ArrayToHexDump,
3001
- randomUint8Array,
3002
- digest,
3003
- deriveKeyPbkdf2,
3004
- encrypt,
3005
- decrypt,
3006
- csv,
3007
- getSecureRandom,
3008
- getSecureRandomIfPossible,
3009
- randomBoolean,
3010
- randomInt,
3011
- randomFloat,
3012
- between,
3013
- sum,
3014
- avg,
3015
- isPrimeRX,
3016
- isPrime,
3017
- parseOrderby,
3018
- composeOrderby,
3019
- cmp,
3020
- sortedOrderby,
3021
- arrayUnique,
3022
- arrayMinus,
3023
- arrayUnion,
3024
- arrayFlatten,
3025
- arrayIntersection,
3026
- arraySymmetricDifference,
3027
- arrayRemoveElement,
3028
- arraySetElement,
3029
- arrayFilterInPlace,
3030
- arrayToggleInPlace,
3031
- arrayEmptyInPlace,
3032
- arraySorted,
3033
- arraySortedNumbers,
3034
- arrayIsEqual,
3035
- arrayShuffleInPlace,
3036
- arrayShuffle,
3037
- arrayShuffleForce,
3038
- arrayRandomElement,
3039
- arrayMax,
3040
- arrayMin,
3041
- arraySum,
3042
- arrayAvg,
3043
- arrayBatches,
3044
- createArray,
3045
- useBase,
3046
- encodeBase16,
3047
- decodeBase16,
3048
- encodeBase32,
3049
- decodeBase32,
3050
- encodeBase58,
3051
- decodeBase58,
3052
- encodeBase62,
3053
- decodeBase62,
3054
- encodeBase64,
3055
- decodeBase64,
3056
- toCamelCase,
3057
- toCapitalize,
3058
- toCapitalizeWords,
3059
- fromCamelCase,
3060
- jsonStringify,
3061
- stringToBoolean,
3062
- stringToInteger,
3063
- stringToFloat,
3064
- valueToBoolean,
3065
- valueToInteger,
3066
- valueToFloat,
3067
- valueToString,
3068
- toFloat,
3069
- toInt,
3070
- toString,
3071
- toBool,
3072
- formatMessages,
3073
- renderMessages,
3074
- fixBrokenUth8String,
3075
- currency,
3076
- Currency,
3077
- DAY_MS,
3078
- dayYear,
3079
- dayMonth,
3080
- dayDay,
3081
- dayToParts,
3082
- dayToDate,
3083
- dayFromToday,
3084
- dayFromAny,
3085
- dayToDateGMT,
3086
- dayFromDate,
3087
- dayFromDateGMT,
3088
- dayToTimestamp,
3089
- dayFromTimestamp,
3090
- dayToString,
3091
- dayFromParts,
3092
- dayFromString,
3093
- dayMonthStart,
3094
- dayYearStart,
3095
- dayOffset,
3096
- dayDiff,
3097
- createPromise,
3098
- sleep,
3099
- immediate,
3100
- timeoutReached,
3101
- timeout,
3102
- timoutError,
3103
- isTimeout,
3104
- tryTimeout,
3105
- waitOn,
3106
- isPromise,
3107
- promisify,
3108
- Day,
3109
- forEachDay,
3110
- today,
3111
- day,
3112
- dateStringToDays,
3113
- decimal,
3114
- decimalFromCents,
3115
- decimalToCents,
3116
- decimalCentsPart,
3117
- escapeHTML,
3118
- unescapeHTML,
3119
- toValidFilename,
3120
- escapeRegExp,
3121
- isHalf,
3122
- isEven,
3123
- roundUp,
3124
- roundDown,
3125
- roundHalfUp,
3126
- roundHalfOdd,
3127
- roundHalfAwayFromZero,
3128
- roundHalfDown,
3129
- roundHalfEven,
3130
- roundHalfTowardsZero,
3131
- startSortWeight,
3132
- endSortWeight,
3133
- moveSortWeight,
3134
- sortedItems,
3135
- linkifyPlainText,
3136
- toHumanReadableUrl,
3137
- encodeQuery,
3138
- parseQuery,
3139
- ensureKey,
3140
- ensureKeyAsync,
3141
- size,
3142
- last,
3143
- empty,
3144
- cloneObject,
3145
- cloneJsonObject,
3146
- memoize,
3147
- forTimes,
3148
- regExpString,
3149
- regExpEscape,
3150
- XRX,
3151
- useDispose,
3152
- useDisposer,
3153
- useDefer,
3154
- useTimeout,
3155
- useInterval,
3156
- useEventListener,
3157
- useMutex,
3158
- useAsyncMutex,
3159
- Emitter,
3160
- getGlobalEmitter,
3161
- messages,
3162
- lazyListener,
3163
- uuidBytes,
3164
- uuid32bit,
3165
- uuid,
3166
- uuidEncode,
3167
- uuidDecode,
3168
- uuidB32,
3169
- uuid32Encode,
3170
- uuid32Decode,
3171
- uname,
3172
- qid,
3173
- uuidv4,
3174
- suidBytes,
3175
- suid,
3176
- suidDate,
3177
- suidBytesDate,
3178
- PoolTaskState,
3179
- PoolTaskIdConflictResolution,
3180
- usePool,
3181
- SerialQueue,
3182
- throttle,
3183
- debounce,
3184
- isLocalHost,
3185
- LoggerMemoryHandler,
3186
- Channel,
3187
- LocalChannel,
3188
- createLocalChannelPair,
3189
- NoopEncoder,
3190
- JsonEncoder,
3191
- CryptoEncoder,
3192
- createPromiseProxy,
3193
- useMessageHub,
3194
- PubSub,
3195
- usePubSub,
3196
- useRPC,
3197
- parseBasicAuth,
3198
- fetchBasic,
3199
- fetchJson,
3200
- fetchText,
3201
- fetchOptionsFormURLEncoded,
3202
- fetchOptionsJson,
3203
- fetchOptionsBasicAuth,
3204
- getWindow,
3205
- getNavigator,
3206
- getGlobal,
3207
- detect,
3208
- isBrowser,
3209
- platform,
3210
- useExitHandler,
3211
- MemStorage
3212
- };
3213
- //# sourceMappingURL=chunk-WQRLPDXE.js.map
3076
+ export { Channel, CryptoEncoder, Currency, DAY_MS, Day, Emitter, JsonEncoder, LocalChannel, LoggerMemoryHandler, MemStorage, NoopEncoder, PoolTaskIdConflictResolution, PoolTaskState, PubSub, SerialQueue, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, XRX, _decodeUtf8Polyfill, _encodeUtf8Polyfill, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, avg, between, cloneJsonObject, cloneObject, cmp, composeOrderby, createArray, createLocalChannelPair, createPromise, createPromiseProxy, csv, currency, dateStringToDays, day, dayDay, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromParts, dayFromString, dayFromTimestamp, dayFromToday, dayMonth, dayMonthStart, dayOffset, dayToDate, dayToDateGMT, dayToParts, dayToString, dayToTimestamp, dayYear, dayYearStart, debounce, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeBase64, decrypt, deriveKeyPbkdf2, detect, digest, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeBase64, encodeQuery, encrypt, endSortWeight, ensureKey, ensureKeyAsync, equalBinary, escapeHTML, escapeRegExp, fetchBasic, fetchJson, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchText, fixBrokenUth8String, forEachDay, forTimes, formatMessages, fromBase64, fromCamelCase, getGlobal, getGlobalEmitter, getNavigator, getSecureRandom, getSecureRandomIfPossible, getWindow, immediate, isBrowser, isEven, isHalf, isLocalHost, isPrime, isPrimeRX, isPromise, isTimeout, joinToUint8Array, jsonStringify, jsonToUint8Array, last, lazyListener, linkifyPlainText, memoize, messages, moveSortWeight, parseBasicAuth, parseOrderby, parseQuery, platform, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, regExpEscape, regExpString, renderMessages, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, size, sleep, sortedItems, sortedOrderby, startSortWeight, stringToBoolean, stringToFloat, stringToInteger, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, throttle, timeout, timeoutReached, timoutError, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableUrl, toInt, toString, toUint8Array, toValidFilename, today, tryTimeout, uname, unescapeHTML, useAsyncMutex, useBase, useDefer, useDispose, useDisposer, useEventListener, useExitHandler, useInterval, useMessageHub, useMutex, usePool, usePubSub, useRPC, useTimeout, uuid, uuid32Decode, uuid32Encode, uuid32bit, uuidB32, uuidBytes, uuidDecode, uuidEncode, uuidv4, valueToBoolean, valueToFloat, valueToInteger, valueToString, waitOn };
3077
+ //# sourceMappingURL=chunk-3LN7HI45.js.map