zeed 0.7.131 → 0.7.134

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.
@@ -7,7 +7,7 @@ import {
7
7
  getTimestamp,
8
8
  useLevelFilter,
9
9
  useNamespaceFilter
10
- } from "./chunk-MEBROCAQ.js";
10
+ } from "./chunk-BYNB5A2G.js";
11
11
 
12
12
  // src/common/data/bin.ts
13
13
  var log = Logger("bin");
@@ -20,7 +20,6 @@ function _encodeUtf8Polyfill(str) {
20
20
  }
21
21
  return buf;
22
22
  }
23
- __name(_encodeUtf8Polyfill, "_encodeUtf8Polyfill");
24
23
  function _decodeUtf8Polyfill(buf) {
25
24
  let remainingLen = buf.length;
26
25
  let encodedString = "";
@@ -34,7 +33,6 @@ function _decodeUtf8Polyfill(buf) {
34
33
  }
35
34
  return decodeURIComponent(escape(encodedString));
36
35
  }
37
- __name(_decodeUtf8Polyfill, "_decodeUtf8Polyfill");
38
36
  var _textEncoder;
39
37
  function stringToUInt8Array(text) {
40
38
  if (_textEncoder == null) {
@@ -46,7 +44,6 @@ function stringToUInt8Array(text) {
46
44
  }
47
45
  return _textEncoder(text.normalize("NFC"));
48
46
  }
49
- __name(stringToUInt8Array, "stringToUInt8Array");
50
47
  var _textDecoder;
51
48
  function Uint8ArrayToString(bin) {
52
49
  if (_textDecoder == null) {
@@ -58,7 +55,6 @@ function Uint8ArrayToString(bin) {
58
55
  }
59
56
  return _textDecoder(bin).normalize("NFC");
60
57
  }
61
- __name(Uint8ArrayToString, "Uint8ArrayToString");
62
58
  function toUint8Array(data) {
63
59
  if (data instanceof ArrayBuffer)
64
60
  return new Uint8Array(data);
@@ -68,7 +64,6 @@ function toUint8Array(data) {
68
64
  return new Uint8Array(data);
69
65
  return data;
70
66
  }
71
- __name(toUint8Array, "toUint8Array");
72
67
  function toHex(bin) {
73
68
  if (typeof Buffer !== "undefined") {
74
69
  return Buffer.from(toUint8Array(bin)).toString("hex");
@@ -80,7 +75,6 @@ function toHex(bin) {
80
75
  }
81
76
  return s;
82
77
  }
83
- __name(toHex, "toHex");
84
78
  function toBase64(bin) {
85
79
  const bytes = toUint8Array(bin);
86
80
  if (typeof Buffer !== "undefined") {
@@ -92,7 +86,6 @@ function toBase64(bin) {
92
86
  }
93
87
  return btoa(s);
94
88
  }
95
- __name(toBase64, "toBase64");
96
89
  function toBase64Url(bin) {
97
90
  const bytes = toUint8Array(bin);
98
91
  if (typeof Buffer !== "undefined") {
@@ -104,7 +97,6 @@ function toBase64Url(bin) {
104
97
  }
105
98
  return btoa(s).replace(/\+/g, "-").replace(/\//g, "_");
106
99
  }
107
- __name(toBase64Url, "toBase64Url");
108
100
  function fromBase64(s) {
109
101
  if (typeof Buffer !== "undefined") {
110
102
  const buf = Buffer.from(s, "base64");
@@ -117,7 +109,6 @@ function fromBase64(s) {
117
109
  }
118
110
  return bytes;
119
111
  }
120
- __name(fromBase64, "fromBase64");
121
112
  function equalBinary(a, b) {
122
113
  if (a.byteLength !== b.byteLength)
123
114
  return false;
@@ -130,7 +121,6 @@ function equalBinary(a, b) {
130
121
  }
131
122
  return true;
132
123
  }
133
- __name(equalBinary, "equalBinary");
134
124
  function jsonToUint8Array(json) {
135
125
  try {
136
126
  return stringToUInt8Array(JSON.stringify(json));
@@ -139,7 +129,6 @@ function jsonToUint8Array(json) {
139
129
  throw err;
140
130
  }
141
131
  }
142
- __name(jsonToUint8Array, "jsonToUint8Array");
143
132
  function Uint8ArrayToJson(data) {
144
133
  try {
145
134
  return JSON.parse(Uint8ArrayToString(data));
@@ -148,7 +137,6 @@ function Uint8ArrayToJson(data) {
148
137
  throw err;
149
138
  }
150
139
  }
151
- __name(Uint8ArrayToJson, "Uint8ArrayToJson");
152
140
 
153
141
  // src/common/crypto.ts
154
142
  function randomUint8Array(length = 16) {
@@ -162,14 +150,12 @@ function randomUint8Array(length = 16) {
162
150
  }
163
151
  return randomBytes;
164
152
  }
165
- __name(randomUint8Array, "randomUint8Array");
166
153
  var DEFAULT_HASH_ALG = "SHA-256";
167
154
  var DEFAULT_CRYPTO_ALG = "AES-GCM";
168
155
  var DEFAULT_DERIVE_ALG = "PBKDF2";
169
156
  async function digest(message, algorithm = DEFAULT_HASH_ALG) {
170
157
  return toUint8Array(await crypto.subtle.digest(algorithm, toUint8Array(message)));
171
158
  }
172
- __name(digest, "digest");
173
159
  async function deriveKeyPbkdf2(secret, opt = {}) {
174
160
  var _a;
175
161
  const secretBuffer = toUint8Array(secret);
@@ -184,7 +170,6 @@ async function deriveKeyPbkdf2(secret, opt = {}) {
184
170
  length: 256
185
171
  }, true, ["encrypt", "decrypt"]);
186
172
  }
187
- __name(deriveKeyPbkdf2, "deriveKeyPbkdf2");
188
173
  var MAGIC_ID = new Uint8Array([1, 1]);
189
174
  async function encrypt(data, key) {
190
175
  const iv = randomUint8Array(12);
@@ -200,7 +185,6 @@ async function encrypt(data, key) {
200
185
  buffer.set(binCypher, pos);
201
186
  return buffer;
202
187
  }
203
- __name(encrypt, "encrypt");
204
188
  async function decrypt(data, key) {
205
189
  let magic = data.subarray(0, 2);
206
190
  if (!equalBinary(magic, MAGIC_ID)) {
@@ -211,7 +195,6 @@ async function decrypt(data, key) {
211
195
  const plain = await crypto.subtle.decrypt({ name: DEFAULT_CRYPTO_ALG, iv }, key, cipher);
212
196
  return new Uint8Array(plain);
213
197
  }
214
- __name(decrypt, "decrypt");
215
198
 
216
199
  // src/common/csv.ts
217
200
  var separator = ",";
@@ -223,7 +206,6 @@ function filterFloat(value) {
223
206
  }
224
207
  return NaN;
225
208
  }
226
- __name(filterFloat, "filterFloat");
227
209
  function escape2(field) {
228
210
  if (ignoreNullOrUndefined && field == void 0) {
229
211
  return "";
@@ -247,41 +229,33 @@ function csv(data, headerRow) {
247
229
  }
248
230
  return body;
249
231
  }
250
- __name(csv, "csv");
251
232
 
252
233
  // src/common/data/math.ts
253
234
  function getSecureRandom() {
254
235
  return crypto.getRandomValues(new Uint32Array(1))[0] / 4294967295;
255
236
  }
256
- __name(getSecureRandom, "getSecureRandom");
257
237
  function getSecureRandomIfPossible() {
258
238
  return typeof crypto !== "undefined" ? getSecureRandom() : Math.random();
259
239
  }
260
- __name(getSecureRandomIfPossible, "getSecureRandomIfPossible");
261
240
  function randomBoolean(bias = 0.25) {
262
241
  return getSecureRandomIfPossible() < bias;
263
242
  }
264
- __name(randomBoolean, "randomBoolean");
265
243
  function randomInt(max = 100, min = 0) {
266
244
  return min + Math.floor(getSecureRandomIfPossible() * (max - min));
267
245
  }
268
- __name(randomInt, "randomInt");
269
246
  function randomFloat(max = 100, min = 0) {
270
247
  return min + getSecureRandomIfPossible() * (max - min);
271
248
  }
272
- __name(randomFloat, "randomFloat");
273
249
  function between(min, value, max) {
274
250
  return Math.max(min, Math.min(max, value));
275
251
  }
276
- __name(between, "between");
277
252
  function sum(array) {
278
253
  return array.reduce((acc, value) => acc + value, 0);
279
254
  }
280
- __name(sum, "sum");
281
255
  function avg(array) {
282
256
  return sum(array) / array.length;
283
257
  }
284
- __name(avg, "avg");
258
+ var isPrimeRX = (val) => !/^1?$|^(11+?)\1+$/.test("1".repeat(val));
285
259
 
286
260
  // src/common/data/orderby.ts
287
261
  function parseOrderby(value = "") {
@@ -294,17 +268,14 @@ function parseOrderby(value = "") {
294
268
  desc: orderby === "desc"
295
269
  };
296
270
  }
297
- __name(parseOrderby, "parseOrderby");
298
271
  function composeOrderby(field, asc = true) {
299
272
  return `${field} ${asc ? "asc" : "desc"}`;
300
273
  }
301
- __name(composeOrderby, "composeOrderby");
302
274
  function cmp(a, b, asc = true) {
303
275
  const aa = a || 0;
304
276
  const bb = b || 0;
305
277
  return aa > bb ? asc ? 1 : -1 : aa < bb ? asc ? -1 : 1 : 0;
306
278
  }
307
- __name(cmp, "cmp");
308
279
  function sortedOrderby(values, ...orderby) {
309
280
  if (orderby.length > 0) {
310
281
  let orderByList = orderby.map(parseOrderby);
@@ -321,33 +292,26 @@ function sortedOrderby(values, ...orderby) {
321
292
  }
322
293
  return values;
323
294
  }
324
- __name(sortedOrderby, "sortedOrderby");
325
295
 
326
296
  // src/common/data/array.ts
327
297
  function arrayUnique(x) {
328
298
  return x.filter((n, index) => x.indexOf(n) === index);
329
299
  }
330
- __name(arrayUnique, "arrayUnique");
331
300
  function arrayMinus(x, y) {
332
301
  return arrayUnique(x.filter((n) => !y.includes(n)));
333
302
  }
334
- __name(arrayMinus, "arrayMinus");
335
303
  function arrayUnion(...a) {
336
304
  return arrayUnique(a.reduce((acc = [], value) => acc.concat(value), []));
337
305
  }
338
- __name(arrayUnion, "arrayUnion");
339
306
  function arrayFlatten(...list) {
340
307
  return list.flat(Infinity);
341
308
  }
342
- __name(arrayFlatten, "arrayFlatten");
343
309
  function arrayIntersection(x, y) {
344
310
  return arrayUnique(x).filter((n) => y.includes(n));
345
311
  }
346
- __name(arrayIntersection, "arrayIntersection");
347
312
  function arraySymmetricDifference(x, y) {
348
313
  return arrayMinus(arrayUnion(x, y), arrayIntersection(x, y));
349
314
  }
350
- __name(arraySymmetricDifference, "arraySymmetricDifference");
351
315
  function arrayRemoveElement(arr, el) {
352
316
  if (arr && Array.isArray(arr)) {
353
317
  let index;
@@ -358,18 +322,15 @@ function arrayRemoveElement(arr, el) {
358
322
  }
359
323
  return [];
360
324
  }
361
- __name(arrayRemoveElement, "arrayRemoveElement");
362
325
  function arraySetElement(arr, el) {
363
326
  if (!arr.includes(el))
364
327
  arr.push(el);
365
328
  return arr;
366
329
  }
367
- __name(arraySetElement, "arraySetElement");
368
330
  function arrayFilterInPlace(array, fn) {
369
331
  array.splice(0, array.length, ...array.filter(fn));
370
332
  return array;
371
333
  }
372
- __name(arrayFilterInPlace, "arrayFilterInPlace");
373
334
  function arrayToggleInPlace(array, el) {
374
335
  const index = array.findIndex((e) => e === el);
375
336
  if (index >= 0)
@@ -378,33 +339,26 @@ function arrayToggleInPlace(array, el) {
378
339
  array.push(el);
379
340
  return array;
380
341
  }
381
- __name(arrayToggleInPlace, "arrayToggleInPlace");
382
342
  function arrayEmptyInPlace(array) {
383
343
  array.splice(0, array.length);
384
344
  return array;
385
345
  }
386
- __name(arrayEmptyInPlace, "arrayEmptyInPlace");
387
346
  function arraySorted(arr, cond = cmp) {
388
347
  return Array.from(arr).sort(cond);
389
348
  }
390
- __name(arraySorted, "arraySorted");
391
349
  function arraySortedNumbers(arr) {
392
350
  return arraySorted(arr, (l, r) => l - r);
393
351
  }
394
- __name(arraySortedNumbers, "arraySortedNumbers");
395
352
  function arrayIsEqual(array1, array2) {
396
353
  return array1.length === array2.length && array1.every((value, index) => value === array2[index]);
397
354
  }
398
- __name(arrayIsEqual, "arrayIsEqual");
399
355
  function arrayShuffleInPlace(array) {
400
356
  array.sort(() => getSecureRandomIfPossible() > 0.5 ? 1 : -1);
401
357
  return array;
402
358
  }
403
- __name(arrayShuffleInPlace, "arrayShuffleInPlace");
404
359
  function arrayShuffle(array) {
405
360
  return arrayShuffleInPlace(Array.from(array));
406
361
  }
407
- __name(arrayShuffle, "arrayShuffle");
408
362
  function arrayShuffleForce(array) {
409
363
  while (array.length > 1) {
410
364
  const copy = Array.from(array);
@@ -414,28 +368,22 @@ function arrayShuffleForce(array) {
414
368
  }
415
369
  return array;
416
370
  }
417
- __name(arrayShuffleForce, "arrayShuffleForce");
418
371
  function arrayRandomElement(array) {
419
372
  return array[Math.floor(getSecureRandomIfPossible() * array.length)];
420
373
  }
421
- __name(arrayRandomElement, "arrayRandomElement");
422
374
  function arrayMax(...array) {
423
375
  return arrayFlatten(array).reduce((acc, value) => acc != null ? value > acc ? value : acc : value, void 0);
424
376
  }
425
- __name(arrayMax, "arrayMax");
426
377
  function arrayMin(...array) {
427
378
  return arrayFlatten(array).reduce((acc, value) => acc != null ? value < acc ? value : acc : value, void 0);
428
379
  }
429
- __name(arrayMin, "arrayMin");
430
380
  function arraySum(...array) {
431
381
  return arrayFlatten(array).reduce((acc, value) => acc + value, 0);
432
382
  }
433
- __name(arraySum, "arraySum");
434
383
  function arrayAvg(...array) {
435
384
  let flatArray = arrayFlatten(array);
436
385
  return flatArray.reduce((acc, value) => acc + value, 0) / flatArray.length;
437
386
  }
438
- __name(arrayAvg, "arrayAvg");
439
387
  function arrayBatches(array, chunckLength) {
440
388
  let chunks = [];
441
389
  let i = 0;
@@ -445,7 +393,6 @@ function arrayBatches(array, chunckLength) {
445
393
  }
446
394
  return chunks;
447
395
  }
448
- __name(arrayBatches, "arrayBatches");
449
396
  function createArray(size2 = 0, item) {
450
397
  if (size2 <= 0)
451
398
  return [];
@@ -455,7 +402,6 @@ function createArray(size2 = 0, item) {
455
402
  }
456
403
  return arr;
457
404
  }
458
- __name(createArray, "createArray");
459
405
 
460
406
  // src/common/data/basex.ts
461
407
  var log2 = Logger("zeed:basex");
@@ -540,7 +486,6 @@ function useBase(alphaOrBase) {
540
486
  }
541
487
  return str;
542
488
  }
543
- __name(encode, "encode");
544
489
  function decode(source, padToLength = -1) {
545
490
  if (typeof source !== "string")
546
491
  throw new TypeError("Expected String");
@@ -581,13 +526,11 @@ function useBase(alphaOrBase) {
581
526
  }
582
527
  return dataDecoded.slice(it4);
583
528
  }
584
- __name(decode, "decode");
585
529
  return {
586
530
  encode,
587
531
  decode
588
532
  };
589
533
  }
590
- __name(useBase, "useBase");
591
534
  var { encode: encodeBase16, decode: decodeBase16 } = useBase(16);
592
535
  var { encode: encodeBase32, decode: decodeBase32 } = useBase(32);
593
536
  var { encode: encodeBase58, decode: decodeBase58 } = useBase(58);
@@ -595,7 +538,7 @@ var { encode: encodeBase62, decode: decodeBase62 } = useBase(62);
595
538
  var { encode: encodeBase64, decode: decodeBase64 } = useBase(62);
596
539
 
597
540
  // src/common/data/camelcase.ts
598
- var toCamelCase = /* @__PURE__ */ __name((s) => {
541
+ var toCamelCase = (s) => {
599
542
  if (s.length > 0) {
600
543
  if (/^[A-Z0-9_\-\ ]*$/g.test(s)) {
601
544
  s = s.toLowerCase();
@@ -604,20 +547,17 @@ var toCamelCase = /* @__PURE__ */ __name((s) => {
604
547
  s = s[0].toLowerCase() + s.substring(1);
605
548
  }
606
549
  return s;
607
- }, "toCamelCase");
550
+ };
608
551
  function toCapitalize(s) {
609
552
  return s.charAt(0).toUpperCase() + s.toLowerCase().slice(1);
610
553
  }
611
- __name(toCapitalize, "toCapitalize");
612
554
  function toCapitalizeWords(s) {
613
555
  return s.replace(/\w\S*/g, toCapitalize);
614
556
  }
615
- __name(toCapitalizeWords, "toCapitalizeWords");
616
557
  function fromCamelCase(str, separator2 = "-") {
617
558
  separator2 = typeof separator2 === "undefined" ? "_" : separator2;
618
559
  return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator2 + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator2 + "$2").toLowerCase();
619
560
  }
620
- __name(fromCamelCase, "fromCamelCase");
621
561
 
622
562
  // src/common/data/json.ts
623
563
  function serializer(replacer, cycleReplacer) {
@@ -640,11 +580,9 @@ function serializer(replacer, cycleReplacer) {
640
580
  return replacer == null ? value : replacer.call(this, key, value);
641
581
  };
642
582
  }
643
- __name(serializer, "serializer");
644
583
  function jsonStringify(obj, replacer, spaces, cycleReplacer) {
645
584
  return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
646
585
  }
647
- __name(jsonStringify, "jsonStringify");
648
586
 
649
587
  // src/common/data/convert.ts
650
588
  var TRUE_VALUES_LIST = ["1", "true", "yes", "y", "on"];
@@ -653,21 +591,18 @@ function stringToBoolean(value, defaultValue = false) {
653
591
  return defaultValue;
654
592
  return TRUE_VALUES_LIST.includes(String(value).trim().toLowerCase());
655
593
  }
656
- __name(stringToBoolean, "stringToBoolean");
657
594
  function stringToInteger(value, defaultValue = 0) {
658
595
  var _a;
659
596
  if (value == null || typeof value !== "string")
660
597
  return defaultValue;
661
598
  return (_a = parseInt(value.trim(), 10)) != null ? _a : defaultValue;
662
599
  }
663
- __name(stringToInteger, "stringToInteger");
664
600
  function stringToFloat(value, defaultValue = 0) {
665
601
  var _a;
666
602
  if (value == null || typeof value !== "string")
667
603
  return defaultValue;
668
604
  return (_a = parseFloat(value.trim())) != null ? _a : defaultValue;
669
605
  }
670
- __name(stringToFloat, "stringToFloat");
671
606
  function valueToBoolean(value, defaultValue = false) {
672
607
  if (value == null)
673
608
  return defaultValue;
@@ -677,7 +612,6 @@ function valueToBoolean(value, defaultValue = false) {
677
612
  return value !== 0;
678
613
  return TRUE_VALUES_LIST.includes(String(value).trim().toLowerCase());
679
614
  }
680
- __name(valueToBoolean, "valueToBoolean");
681
615
  function valueToInteger(value, defaultValue = 0) {
682
616
  var _a;
683
617
  if (value == null)
@@ -688,7 +622,6 @@ function valueToInteger(value, defaultValue = 0) {
688
622
  return Math.floor(value);
689
623
  return (_a = parseInt(String(value).trim(), 10)) != null ? _a : defaultValue;
690
624
  }
691
- __name(valueToInteger, "valueToInteger");
692
625
  function valueToFloat(value, defaultValue = 0) {
693
626
  var _a;
694
627
  if (value == null)
@@ -699,14 +632,12 @@ function valueToFloat(value, defaultValue = 0) {
699
632
  return Math.floor(value);
700
633
  return (_a = parseFloat(String(value).trim())) != null ? _a : defaultValue;
701
634
  }
702
- __name(valueToFloat, "valueToFloat");
703
635
  function valueToString(value, defaultValue = "") {
704
636
  var _a;
705
637
  if (value == null)
706
638
  return defaultValue;
707
639
  return (_a = String(value)) != null ? _a : defaultValue;
708
640
  }
709
- __name(valueToString, "valueToString");
710
641
  var toFloat = valueToFloat;
711
642
  var toInt = valueToInteger;
712
643
  var toString = valueToString;
@@ -727,11 +658,9 @@ ${obj.stack}`;
727
658
  return String(obj);
728
659
  });
729
660
  }
730
- __name(formatMessages, "formatMessages");
731
661
  function renderMessages(messages2, opt = {}) {
732
662
  return formatMessages(messages2, opt).join(" ");
733
663
  }
734
- __name(renderMessages, "renderMessages");
735
664
  function fixBrokenUth8String(brokenString) {
736
665
  try {
737
666
  return decodeURIComponent(escape(brokenString));
@@ -739,7 +668,6 @@ function fixBrokenUth8String(brokenString) {
739
668
  }
740
669
  return brokenString;
741
670
  }
742
- __name(fixBrokenUth8String, "fixBrokenUth8String");
743
671
 
744
672
  // src/common/data/currency.ts
745
673
  var defaults = {
@@ -753,15 +681,14 @@ var defaults = {
753
681
  format,
754
682
  fromCents: false
755
683
  };
756
- var round = /* @__PURE__ */ __name((v) => Math.round(v), "round");
757
- var pow = /* @__PURE__ */ __name((p) => Math.pow(10, p), "pow");
758
- var rounding = /* @__PURE__ */ __name((value, increment) => round(value / increment) * increment, "rounding");
684
+ var round = (v) => Math.round(v);
685
+ var pow = (p) => Math.pow(10, p);
686
+ var rounding = (value, increment) => round(value / increment) * increment;
759
687
  var groupRegex = /(\d)(?=(\d{3})+\b)/g;
760
688
  var vedicRegex = /(\d)(?=(\d\d)+\d\b)/g;
761
689
  function currency(value, opts = {}) {
762
690
  return new Currency(value, opts);
763
691
  }
764
- __name(currency, "currency");
765
692
  var _Currency = class {
766
693
  constructor(value, opts = {}) {
767
694
  var _a;
@@ -834,7 +761,6 @@ var _Currency = class {
834
761
  }
835
762
  };
836
763
  var Currency = _Currency;
837
- __name(Currency, "Currency");
838
764
  Currency.zero = new _Currency(0);
839
765
  Currency.one = new _Currency(1);
840
766
  Currency.hundred = new _Currency(100);
@@ -861,36 +787,34 @@ function parse(value, opts, useRounding = true) {
861
787
  }
862
788
  return useRounding ? round(v) : v;
863
789
  }
864
- __name(parse, "parse");
865
790
  function format(currency2, settings) {
866
791
  let { pattern: pattern2, negativePattern, symbol, separator: separator2, decimal, groups } = settings, split = ("" + currency2).replace(/^-/, "").split("."), dollars = split[0], cents = split[1];
867
792
  return (currency2.value >= 0 ? pattern2 : negativePattern).replace("!", symbol).replace("#", dollars.replace(groups, "$1" + separator2) + (cents ? decimal + cents : ""));
868
793
  }
869
- __name(format, "format");
870
- var isHalf = /* @__PURE__ */ __name((value) => Math.abs(value) % 1 === 0.5, "isHalf");
871
- var isEven = /* @__PURE__ */ __name((value) => value % 2 === 0, "isEven");
872
- var roundUp = /* @__PURE__ */ __name((value) => Math.ceil(value), "roundUp");
873
- var roundDown = /* @__PURE__ */ __name((value) => Math.floor(value), "roundDown");
874
- var roundHalfUp = /* @__PURE__ */ __name((value) => Math.round(value), "roundHalfUp");
875
- var roundHalfOdd = /* @__PURE__ */ __name((value) => {
794
+ var isHalf = (value) => Math.abs(value) % 1 === 0.5;
795
+ var isEven = (value) => value % 2 === 0;
796
+ var roundUp = (value) => Math.ceil(value);
797
+ var roundDown = (value) => Math.floor(value);
798
+ var roundHalfUp = (value) => Math.round(value);
799
+ var roundHalfOdd = (value) => {
876
800
  const rounded = Math.round(value);
877
801
  if (!isHalf(value)) {
878
802
  return rounded;
879
803
  }
880
804
  return isEven(rounded) ? rounded - 1 : rounded;
881
- }, "roundHalfOdd");
882
- var roundHalfAwayFromZero = /* @__PURE__ */ __name((value) => {
805
+ };
806
+ var roundHalfAwayFromZero = (value) => {
883
807
  return isHalf(value) ? Math.sign(value) * Math.ceil(Math.abs(value)) : Math.round(value);
884
- }, "roundHalfAwayFromZero");
885
- var roundHalfDown = /* @__PURE__ */ __name((value) => isHalf(value) ? Math.floor(value) : Math.round(value), "roundHalfDown");
886
- var roundHalfEven = /* @__PURE__ */ __name((value) => {
808
+ };
809
+ var roundHalfDown = (value) => isHalf(value) ? Math.floor(value) : Math.round(value);
810
+ var roundHalfEven = (value) => {
887
811
  const rounded = Math.round(value);
888
812
  if (!isHalf(value)) {
889
813
  return rounded;
890
814
  }
891
815
  return isEven(rounded) ? rounded : rounded - 1;
892
- }, "roundHalfEven");
893
- var roundHalfTowardsZero = /* @__PURE__ */ __name((value) => isHalf(value) ? Math.sign(value) * Math.floor(Math.abs(value)) : Math.round(value), "roundHalfTowardsZero");
816
+ };
817
+ var roundHalfTowardsZero = (value) => isHalf(value) ? Math.sign(value) * Math.floor(Math.abs(value)) : Math.round(value);
894
818
 
895
819
  // src/common/exec/promise.ts
896
820
  var { warn } = Logger("zeed:promise");
@@ -902,15 +826,12 @@ function createPromise() {
902
826
  });
903
827
  return [promise, resolve, reject];
904
828
  }
905
- __name(createPromise, "createPromise");
906
829
  async function sleep(milliSeconds) {
907
830
  return new Promise((resolve) => setTimeout(resolve, milliSeconds));
908
831
  }
909
- __name(sleep, "sleep");
910
832
  async function immediate() {
911
833
  return new Promise((resolve) => setTimeout(resolve, 0));
912
834
  }
913
- __name(immediate, "immediate");
914
835
  var timeoutReached = Symbol("timeout");
915
836
  async function timeout(promise, milliSeconds, timeoutValue = timeoutReached) {
916
837
  return new Promise(async (resolve, reject) => {
@@ -931,12 +852,10 @@ async function timeout(promise, milliSeconds, timeoutValue = timeoutReached) {
931
852
  }
932
853
  });
933
854
  }
934
- __name(timeout, "timeout");
935
855
  var timoutError = new Error("Timeout reached");
936
856
  function isTimeout(value) {
937
857
  return value === timeoutReached || value === timoutError;
938
858
  }
939
- __name(isTimeout, "isTimeout");
940
859
  async function tryTimeout(promise, milliSeconds) {
941
860
  if (milliSeconds <= 0) {
942
861
  return await promise;
@@ -959,17 +878,16 @@ async function tryTimeout(promise, milliSeconds) {
959
878
  }
960
879
  });
961
880
  }
962
- __name(tryTimeout, "tryTimeout");
963
881
  function waitOn(obj, event, timeoutMS = 1e3) {
964
882
  return new Promise((resolve, reject) => {
965
- let fn = /* @__PURE__ */ __name((value) => {
883
+ let fn = (value) => {
966
884
  if (timer) {
967
885
  clearTimeout(timer);
968
886
  done();
969
887
  resolve(value);
970
888
  }
971
- }, "fn");
972
- let done = /* @__PURE__ */ __name(() => {
889
+ };
890
+ let done = () => {
973
891
  timer = null;
974
892
  if (obj.off) {
975
893
  obj.off(event, fn);
@@ -978,7 +896,7 @@ function waitOn(obj, event, timeoutMS = 1e3) {
978
896
  } else {
979
897
  warn("No remove listener method found for", obj, event);
980
898
  }
981
- }, "done");
899
+ };
982
900
  let timer = setTimeout(() => {
983
901
  done();
984
902
  reject(new Error(`Did not response in time`));
@@ -992,15 +910,12 @@ function waitOn(obj, event, timeoutMS = 1e3) {
992
910
  }
993
911
  });
994
912
  }
995
- __name(waitOn, "waitOn");
996
913
  function isPromise(value) {
997
914
  return Boolean(value && (value instanceof Promise || typeof value.then === "function"));
998
915
  }
999
- __name(isPromise, "isPromise");
1000
916
  function promisify(value) {
1001
917
  return Promise.resolve(value);
1002
918
  }
1003
- __name(promisify, "promisify");
1004
919
 
1005
920
  // src/common/data/day.ts
1006
921
  var DAY_MS = 1e3 * 60 * 60 * 24;
@@ -1098,7 +1013,6 @@ var Day = class {
1098
1013
  return this.dayOffset(1);
1099
1014
  }
1100
1015
  };
1101
- __name(Day, "Day");
1102
1016
  async function forEachDay(from, to, handler) {
1103
1017
  let start = Day.from(from);
1104
1018
  let end = Day.from(to);
@@ -1110,19 +1024,16 @@ async function forEachDay(from, to, handler) {
1110
1024
  start = start.dayOffset(1);
1111
1025
  }
1112
1026
  }
1113
- __name(forEachDay, "forEachDay");
1114
1027
  function today() {
1115
1028
  return new Day();
1116
1029
  }
1117
- __name(today, "today");
1118
1030
  function day(days) {
1119
1031
  return new Day(days);
1120
1032
  }
1121
- __name(day, "day");
1122
1033
 
1123
1034
  // src/common/data/html.ts
1124
- var escapeHTML = /* @__PURE__ */ __name((s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&apos;").replace(/"/g, "&quot;"), "escapeHTML");
1125
- var unescapeHTML = /* @__PURE__ */ __name((s) => s.replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&apos;/gi, "'").replace(/&amp;/gi, "&"), "unescapeHTML");
1035
+ var escapeHTML = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&apos;").replace(/"/g, "&quot;");
1036
+ var unescapeHTML = (s) => s.replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&apos;/gi, "'").replace(/&amp;/gi, "&");
1126
1037
 
1127
1038
  // src/common/data/path.ts
1128
1039
  var MAX_FILENAME_LENGTH = 100;
@@ -1132,11 +1043,9 @@ var reTrailingPeriods = /\.+$/;
1132
1043
  function filenameReservedRegex() {
1133
1044
  return /[<>:"/\\|?*\u0000-\u001F]/g;
1134
1045
  }
1135
- __name(filenameReservedRegex, "filenameReservedRegex");
1136
1046
  function windowsReservedNameRegex() {
1137
1047
  return /^(con|prn|aux|nul|com\d|lpt\d)$/i;
1138
1048
  }
1139
- __name(windowsReservedNameRegex, "windowsReservedNameRegex");
1140
1049
  function toValidFilename(string) {
1141
1050
  if (typeof string !== "string") {
1142
1051
  throw new TypeError("Expected a string");
@@ -1149,7 +1058,6 @@ function toValidFilename(string) {
1149
1058
  string = windowsReservedNameRegex().test(string) ? string + replacement : string;
1150
1059
  return string.slice(0, MAX_FILENAME_LENGTH);
1151
1060
  }
1152
- __name(toValidFilename, "toValidFilename");
1153
1061
 
1154
1062
  // src/common/data/regexp.ts
1155
1063
  var rxEscape = /[\\\-\[\]\/{}()*+?.^$|]/g;
@@ -1161,17 +1069,14 @@ function escapeRegExp(value) {
1161
1069
  }
1162
1070
  return value.replace(rxEscape, "\\$&");
1163
1071
  }
1164
- __name(escapeRegExp, "escapeRegExp");
1165
1072
 
1166
1073
  // src/common/data/sortable.ts
1167
1074
  function startSortWeight(items) {
1168
1075
  return items.reduce((acc, item) => Math.min(acc, item.sort_weight || 0), 0) - 1 - getSecureRandomIfPossible();
1169
1076
  }
1170
- __name(startSortWeight, "startSortWeight");
1171
1077
  function endSortWeight(items) {
1172
1078
  return items.reduce((acc, item) => Math.max(acc, item.sort_weight || 0), 0) + 1 + getSecureRandomIfPossible();
1173
1079
  }
1174
- __name(endSortWeight, "endSortWeight");
1175
1080
  function moveSortWeight(newIndex, oldIndex, items) {
1176
1081
  let count = items.length;
1177
1082
  const moveLower = newIndex < oldIndex;
@@ -1196,12 +1101,10 @@ function moveSortWeight(newIndex, oldIndex, items) {
1196
1101
  const fuzzy = distance * 0.01 * (getSecureRandomIfPossible() - 0.5);
1197
1102
  return middle + fuzzy;
1198
1103
  }
1199
- __name(moveSortWeight, "moveSortWeight");
1200
1104
  function sortedItems(items) {
1201
1105
  items.sort((a, b) => (a.sort_weight || 0) - (b.sort_weight || 0));
1202
1106
  return items;
1203
1107
  }
1204
- __name(sortedItems, "sortedItems");
1205
1108
 
1206
1109
  // src/common/data/url.ts
1207
1110
  var findURL = /((?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?)/gim;
@@ -1211,11 +1114,9 @@ function linkifyPlainText(text) {
1211
1114
  return i % 2 ? `<a target="_blank" href="${escapedPart}">${toHumanReadableUrl(escapedPart)}</a>` : escapedPart;
1212
1115
  }).join("");
1213
1116
  }
1214
- __name(linkifyPlainText, "linkifyPlainText");
1215
1117
  function toHumanReadableUrl(url) {
1216
1118
  return url.replace(/^https?:\/\/(www\.)?/, "").replace(/\/$/, "");
1217
1119
  }
1218
- __name(toHumanReadableUrl, "toHumanReadableUrl");
1219
1120
  function encodeQuery(data) {
1220
1121
  let pairs = [];
1221
1122
  for (let [key, value] of Object.entries(data)) {
@@ -1232,7 +1133,6 @@ function encodeQuery(data) {
1232
1133
  }
1233
1134
  return pairs.join("&");
1234
1135
  }
1235
- __name(encodeQuery, "encodeQuery");
1236
1136
  function parseQuery(queryString) {
1237
1137
  let query = {};
1238
1138
  let pairs = (queryString[0] === "?" ? queryString.substr(1) : queryString).split("&");
@@ -1251,7 +1151,6 @@ function parseQuery(queryString) {
1251
1151
  }
1252
1152
  return query;
1253
1153
  }
1254
- __name(parseQuery, "parseQuery");
1255
1154
 
1256
1155
  // src/common/data/utils.ts
1257
1156
  function ensureKey(obj, key, createFn) {
@@ -1262,7 +1161,6 @@ function ensureKey(obj, key, createFn) {
1262
1161
  }
1263
1162
  return value;
1264
1163
  }
1265
- __name(ensureKey, "ensureKey");
1266
1164
  async function ensureKeyAsync(obj, key, createFn) {
1267
1165
  let value = obj[key];
1268
1166
  if (value === void 0) {
@@ -1271,7 +1169,6 @@ async function ensureKeyAsync(obj, key, createFn) {
1271
1169
  }
1272
1170
  return value;
1273
1171
  }
1274
- __name(ensureKeyAsync, "ensureKeyAsync");
1275
1172
  function size(obj) {
1276
1173
  if (obj != null) {
1277
1174
  if (obj.size != null) {
@@ -1284,11 +1181,9 @@ function size(obj) {
1284
1181
  }
1285
1182
  return 0;
1286
1183
  }
1287
- __name(size, "size");
1288
1184
  function last(array) {
1289
1185
  return array != null && array.length > 0 ? array[array.length - 1] : void 0;
1290
1186
  }
1291
- __name(last, "last");
1292
1187
  function empty(value) {
1293
1188
  try {
1294
1189
  if (value != null) {
@@ -1307,19 +1202,16 @@ function empty(value) {
1307
1202
  }
1308
1203
  return true;
1309
1204
  }
1310
- __name(empty, "empty");
1311
1205
  function cloneObject(obj) {
1312
1206
  if (Object(obj) !== obj)
1313
1207
  return obj;
1314
1208
  return JSON.parse(JSON.stringify(obj));
1315
1209
  }
1316
- __name(cloneObject, "cloneObject");
1317
1210
  function cloneJsonObject(obj) {
1318
1211
  if (Object(obj) !== obj)
1319
1212
  return obj;
1320
1213
  return JSON.parse(JSON.stringify(obj));
1321
1214
  }
1322
- __name(cloneJsonObject, "cloneJsonObject");
1323
1215
  function memoize(fn) {
1324
1216
  let cache = /* @__PURE__ */ new Map();
1325
1217
  return (n) => {
@@ -1331,13 +1223,11 @@ function memoize(fn) {
1331
1223
  return result;
1332
1224
  };
1333
1225
  }
1334
- __name(memoize, "memoize");
1335
1226
  function forTimes(count, fn) {
1336
1227
  for (let i = 0; i < count; i++) {
1337
1228
  fn(i, count);
1338
1229
  }
1339
1230
  }
1340
- __name(forTimes, "forTimes");
1341
1231
 
1342
1232
  // src/common/data/xrx.ts
1343
1233
  var RX_WHITESPACE = /\\\s|\s+|#[^\n]*\n?/gm;
@@ -1347,11 +1237,9 @@ var log3 = Logger("xrx");
1347
1237
  function regExpString(rx) {
1348
1238
  return typeof rx === "string" ? rx : rx.source || "";
1349
1239
  }
1350
- __name(regExpString, "regExpString");
1351
1240
  function regExpEscape(str) {
1352
1241
  return str.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1353
1242
  }
1354
- __name(regExpEscape, "regExpEscape");
1355
1243
  var XRX = class {
1356
1244
  constructor(pattern2, flags) {
1357
1245
  this.namedGroups = {};
@@ -1448,7 +1336,6 @@ var XRX = class {
1448
1336
  });
1449
1337
  }
1450
1338
  };
1451
- __name(XRX, "XRX");
1452
1339
 
1453
1340
  // src/common/dispose-defer.ts
1454
1341
  var log4 = Logger("dispose");
@@ -1467,27 +1354,26 @@ async function callDisposer(disposable) {
1467
1354
  await disposable.cleanup;
1468
1355
  }
1469
1356
  }
1470
- __name(callDisposer, "callDisposer");
1471
1357
  function useDispose(config) {
1472
1358
  const { name } = typeof config === "string" ? { name: config } : config != null ? config : {};
1473
1359
  let tracked = [];
1474
- const untrack = /* @__PURE__ */ __name(async (disposable) => {
1360
+ const untrack = async (disposable) => {
1475
1361
  if (tracked.includes(disposable)) {
1476
1362
  arrayFilterInPlace(tracked, (el) => el !== disposable);
1477
1363
  await callDisposer(disposable);
1478
1364
  }
1479
- }, "untrack");
1480
- const dispose = /* @__PURE__ */ __name(async () => {
1365
+ };
1366
+ const dispose = async () => {
1481
1367
  if (name)
1482
1368
  log4.debug(`dispose ${name}: ${tracked.length} entries`);
1483
1369
  while (tracked.length > 0) {
1484
1370
  await untrack(tracked[0]);
1485
1371
  }
1486
- }, "dispose");
1487
- const track = /* @__PURE__ */ __name((obj) => {
1372
+ };
1373
+ const track = (obj) => {
1488
1374
  tracked.unshift(obj);
1489
1375
  return () => untrack(obj);
1490
- }, "track");
1376
+ };
1491
1377
  return Object.assign(dispose, {
1492
1378
  track,
1493
1379
  add: track,
@@ -1499,12 +1385,11 @@ function useDispose(config) {
1499
1385
  }
1500
1386
  });
1501
1387
  }
1502
- __name(useDispose, "useDispose");
1503
1388
  var useDisposer = useDispose;
1504
1389
  function useDefer(config = {}) {
1505
1390
  const { mode = "fifo" } = config;
1506
1391
  let steps = [];
1507
- const exec = /* @__PURE__ */ __name(async (expectSync = false) => {
1392
+ const exec = async (expectSync = false) => {
1508
1393
  while (steps.length > 0) {
1509
1394
  let step = steps[0];
1510
1395
  arrayFilterInPlace(steps, (el) => el !== step);
@@ -1523,14 +1408,14 @@ function useDefer(config = {}) {
1523
1408
  throw new Error(`Unhandled disposable: ${step}`);
1524
1409
  }
1525
1410
  }
1526
- }, "exec");
1527
- const add = /* @__PURE__ */ __name((obj) => {
1411
+ };
1412
+ const add = (obj) => {
1528
1413
  if (mode === "lifo") {
1529
1414
  steps.unshift(obj);
1530
1415
  } else {
1531
1416
  steps.push(obj);
1532
1417
  }
1533
- }, "add");
1418
+ };
1534
1419
  return Object.assign(exec, {
1535
1420
  add,
1536
1421
  exec,
@@ -1539,7 +1424,6 @@ function useDefer(config = {}) {
1539
1424
  }
1540
1425
  });
1541
1426
  }
1542
- __name(useDefer, "useDefer");
1543
1427
  function useTimeout(fn, timeout2 = 0) {
1544
1428
  let timeoutHandle = setTimeout(fn, timeout2);
1545
1429
  return () => {
@@ -1549,7 +1433,6 @@ function useTimeout(fn, timeout2 = 0) {
1549
1433
  }
1550
1434
  };
1551
1435
  }
1552
- __name(useTimeout, "useTimeout");
1553
1436
  function useInterval(fn, interval) {
1554
1437
  let intervalHandle = setInterval(fn, interval);
1555
1438
  return () => {
@@ -1559,7 +1442,6 @@ function useInterval(fn, interval) {
1559
1442
  }
1560
1443
  };
1561
1444
  }
1562
- __name(useInterval, "useInterval");
1563
1445
  function useEventListener(emitter, eventName, fn, ...args) {
1564
1446
  if (emitter == null)
1565
1447
  return () => {
@@ -1577,7 +1459,6 @@ function useEventListener(emitter, eventName, fn, ...args) {
1577
1459
  }
1578
1460
  };
1579
1461
  }
1580
- __name(useEventListener, "useEventListener");
1581
1462
 
1582
1463
  // src/common/exec/mutex.ts
1583
1464
  function useMutex() {
@@ -1598,7 +1479,6 @@ function useMutex() {
1598
1479
  return executed;
1599
1480
  };
1600
1481
  }
1601
- __name(useMutex, "useMutex");
1602
1482
  function useAsyncMutex() {
1603
1483
  let token = true;
1604
1484
  return async (fn, elseFn) => {
@@ -1621,7 +1501,6 @@ function useAsyncMutex() {
1621
1501
  return executed;
1622
1502
  };
1623
1503
  }
1624
- __name(useAsyncMutex, "useAsyncMutex");
1625
1504
 
1626
1505
  // src/common/msg/emitter.ts
1627
1506
  var log5 = Logger("zeed:emitter");
@@ -1671,10 +1550,10 @@ var Emitter = class {
1671
1550
  }
1672
1551
  }
1673
1552
  once(event, listener) {
1674
- const onceListener = /* @__PURE__ */ __name(async (...args) => {
1553
+ const onceListener = async (...args) => {
1675
1554
  this.off(event, onceListener);
1676
1555
  return await promisify(listener(...args));
1677
- }, "onceListener");
1556
+ };
1678
1557
  this.on(event, onceListener);
1679
1558
  return () => {
1680
1559
  this.off(event, listener);
@@ -1693,7 +1572,6 @@ var Emitter = class {
1693
1572
  this.subscribersOnAny = [];
1694
1573
  }
1695
1574
  };
1696
- __name(Emitter, "Emitter");
1697
1575
  function getGlobalEmitter() {
1698
1576
  let emitter = getGlobalContext().emitter;
1699
1577
  if (!emitter) {
@@ -1702,17 +1580,16 @@ function getGlobalEmitter() {
1702
1580
  }
1703
1581
  return emitter;
1704
1582
  }
1705
- __name(getGlobalEmitter, "getGlobalEmitter");
1706
1583
  var messages = new Emitter();
1707
1584
  function lazyListener(emitter, listenerKey) {
1708
1585
  const name = Math.round(getSecureRandomIfPossible() * 100);
1709
1586
  var events = [];
1710
1587
  var lazyResolve;
1711
- const incoming = /* @__PURE__ */ __name((key, obj) => {
1588
+ const incoming = (key, obj) => {
1712
1589
  let ev = { key, obj };
1713
1590
  events.push(ev);
1714
1591
  lazyResolve && lazyResolve();
1715
- }, "incoming");
1592
+ };
1716
1593
  if (listenerKey) {
1717
1594
  if (emitter.on) {
1718
1595
  emitter.on(listenerKey, (obj) => {
@@ -1734,7 +1611,7 @@ function lazyListener(emitter, listenerKey) {
1734
1611
  log5.error(name, "cannot listen to all for", emitter);
1735
1612
  }
1736
1613
  }
1737
- let on = /* @__PURE__ */ __name((key, skipUnmatched = true) => {
1614
+ let on = (key, skipUnmatched = true) => {
1738
1615
  return new Promise((resolve, reject) => {
1739
1616
  if (!key) {
1740
1617
  key = listenerKey;
@@ -1763,10 +1640,9 @@ function lazyListener(emitter, listenerKey) {
1763
1640
  }, "lazyResolve");
1764
1641
  lazyResolve();
1765
1642
  });
1766
- }, "on");
1643
+ };
1767
1644
  return on;
1768
1645
  }
1769
- __name(lazyListener, "lazyListener");
1770
1646
 
1771
1647
  // src/common/uuid.ts
1772
1648
  var { encode: encode62, decode: decode62 } = useBase(62);
@@ -1774,32 +1650,25 @@ var { encode: encode32, decode: decode32 } = useBase(32);
1774
1650
  function uuidBytes() {
1775
1651
  return randomUint8Array(16);
1776
1652
  }
1777
- __name(uuidBytes, "uuidBytes");
1778
- var uuid32bit = /* @__PURE__ */ __name(() => new Uint32Array(randomUint8Array(4))[0], "uuid32bit");
1653
+ var uuid32bit = () => new Uint32Array(randomUint8Array(4))[0];
1779
1654
  function uuid() {
1780
1655
  return encode62(uuidBytes(), 22);
1781
1656
  }
1782
- __name(uuid, "uuid");
1783
1657
  function uuidEncode(bytes) {
1784
1658
  return encode62(bytes, 22);
1785
1659
  }
1786
- __name(uuidEncode, "uuidEncode");
1787
1660
  function uuidDecode(uuid2) {
1788
1661
  return decode62(uuid2, 16);
1789
1662
  }
1790
- __name(uuidDecode, "uuidDecode");
1791
1663
  function uuidB32() {
1792
1664
  return encode32(uuidBytes(), 26);
1793
1665
  }
1794
- __name(uuidB32, "uuidB32");
1795
1666
  function uuid32Encode(bytes) {
1796
1667
  return encode32(bytes, 26);
1797
1668
  }
1798
- __name(uuid32Encode, "uuid32Encode");
1799
1669
  function uuid32Decode(uuid2) {
1800
1670
  return decode32(uuid2, 16);
1801
1671
  }
1802
- __name(uuid32Decode, "uuid32Decode");
1803
1672
  var _unameCounters = {};
1804
1673
  function uname(name = "id") {
1805
1674
  if (_unameCounters[name] == null) {
@@ -1807,14 +1676,12 @@ function uname(name = "id") {
1807
1676
  }
1808
1677
  return `${name}-${_unameCounters[name]++}`;
1809
1678
  }
1810
- __name(uname, "uname");
1811
1679
  var _qid = 0;
1812
1680
  function qid() {
1813
1681
  return `id-${_qid++}`;
1814
1682
  }
1815
- __name(qid, "qid");
1816
1683
  var pattern = "10000000-1000-4000-8000-100000000000";
1817
- var uuidv4 = /* @__PURE__ */ __name(() => pattern.replace(/[018]/g, (c) => (c ^ randomUint8Array(1)[0] & 15 >> c / 4).toString(16)), "uuidv4");
1684
+ var uuidv4 = () => pattern.replace(/[018]/g, (c) => (c ^ randomUint8Array(1)[0] & 15 >> c / 4).toString(16));
1818
1685
  var ReferenceDateInMS = 16e11;
1819
1686
  function longToByteArray(long) {
1820
1687
  var byteArray = new Uint8Array([0, 0, 0, 0, 0, 0]);
@@ -1826,26 +1693,21 @@ function longToByteArray(long) {
1826
1693
  }
1827
1694
  return byteArray;
1828
1695
  }
1829
- __name(longToByteArray, "longToByteArray");
1830
1696
  function suidBytes() {
1831
1697
  const ms = getTimestamp() - ReferenceDateInMS;
1832
1698
  return new Uint8Array([...longToByteArray(ms), ...randomUint8Array(10)]);
1833
1699
  }
1834
- __name(suidBytes, "suidBytes");
1835
1700
  function suid() {
1836
1701
  return encode62(suidBytes(), 22);
1837
1702
  }
1838
- __name(suid, "suid");
1839
1703
  function suidDate(id) {
1840
1704
  return suidBytesDate(decode62(id, 16));
1841
1705
  }
1842
- __name(suidDate, "suidDate");
1843
1706
  function suidBytesDate(id) {
1844
1707
  return new Date(ReferenceDateInMS + id.slice(0, 6).reduce((acc, byte) => {
1845
1708
  return acc * 256 + byte;
1846
1709
  }, 0));
1847
1710
  }
1848
- __name(suidBytesDate, "suidBytesDate");
1849
1711
 
1850
1712
  // src/common/exec/pool.ts
1851
1713
  var PoolTaskState = /* @__PURE__ */ ((PoolTaskState2) => {
@@ -1854,6 +1716,12 @@ var PoolTaskState = /* @__PURE__ */ ((PoolTaskState2) => {
1854
1716
  PoolTaskState2[PoolTaskState2["finished"] = 2] = "finished";
1855
1717
  return PoolTaskState2;
1856
1718
  })(PoolTaskState || {});
1719
+ var PoolTaskIdConflictResolution = /* @__PURE__ */ ((PoolTaskIdConflictResolution2) => {
1720
+ PoolTaskIdConflictResolution2[PoolTaskIdConflictResolution2["replace"] = 0] = "replace";
1721
+ PoolTaskIdConflictResolution2[PoolTaskIdConflictResolution2["memoize"] = 1] = "memoize";
1722
+ PoolTaskIdConflictResolution2[PoolTaskIdConflictResolution2["error"] = 2] = "error";
1723
+ return PoolTaskIdConflictResolution2;
1724
+ })(PoolTaskIdConflictResolution || {});
1857
1725
  function usePool(config = {}) {
1858
1726
  const { maxParallel = 3 } = config;
1859
1727
  const events = new Emitter();
@@ -1869,13 +1737,11 @@ function usePool(config = {}) {
1869
1737
  return promise;
1870
1738
  }
1871
1739
  }
1872
- __name(waitFinishAll, "waitFinishAll");
1873
1740
  function didFinish() {
1874
1741
  events.emit("didFinish");
1875
1742
  countMax = 0;
1876
1743
  countResolved = 0;
1877
1744
  }
1878
- __name(didFinish, "didFinish");
1879
1745
  function didUpdate() {
1880
1746
  let presentMax = 0;
1881
1747
  let presentResolved = 0;
@@ -1885,7 +1751,6 @@ function usePool(config = {}) {
1885
1751
  }
1886
1752
  events.emit("didUpdate", countMax, countResolved, presentMax, presentResolved);
1887
1753
  }
1888
- __name(didUpdate, "didUpdate");
1889
1754
  function performNext() {
1890
1755
  didUpdate();
1891
1756
  if (countMax > 0 && countMax === countResolved)
@@ -1906,19 +1771,20 @@ function usePool(config = {}) {
1906
1771
  taskInfo.state = 1 /* running */;
1907
1772
  ++currentParallel;
1908
1773
  events.emit("didStart", id);
1909
- const taskFinished = /* @__PURE__ */ __name(() => {
1774
+ const taskFinished = (result) => {
1910
1775
  if (taskInfo) {
1776
+ taskInfo.result = result;
1911
1777
  taskInfo.state = 2 /* finished */;
1912
1778
  taskInfo.resolved = taskInfo.max;
1913
1779
  }
1914
1780
  --currentParallel;
1915
1781
  ++countResolved;
1916
1782
  performNext();
1917
- }, "taskFinished");
1783
+ };
1918
1784
  taskInfo.task(taskInfo).then((r) => {
1919
1785
  done(r);
1920
1786
  events.emit("didResolve", id, r);
1921
- taskFinished();
1787
+ taskFinished(r);
1922
1788
  }).catch((err) => {
1923
1789
  done();
1924
1790
  events.emit("didReject", id, err);
@@ -1927,7 +1793,6 @@ function usePool(config = {}) {
1927
1793
  }
1928
1794
  }
1929
1795
  }
1930
- __name(performNext, "performNext");
1931
1796
  function cancel(id) {
1932
1797
  let taskInfo = tasks[id];
1933
1798
  if (taskInfo && taskInfo.state === 0 /* waiting */) {
@@ -1937,41 +1802,57 @@ function usePool(config = {}) {
1937
1802
  didUpdate();
1938
1803
  }
1939
1804
  }
1940
- __name(cancel, "cancel");
1941
1805
  function cancelAll() {
1942
1806
  Object.keys(tasks).forEach(cancel);
1943
1807
  }
1944
- __name(cancelAll, "cancelAll");
1945
1808
  function enqueue(task, config2 = {}) {
1946
- var _a, _b, _c;
1809
+ var _a, _b, _c, _d;
1947
1810
  let done;
1948
1811
  let promise = new Promise((resolve) => done = resolve);
1949
1812
  let id = (_a = config2.id) != null ? _a : uuid();
1950
- if (tasks[id] == null) {
1951
- tasks[id] = {
1952
- id,
1953
- task,
1954
- priority: ++priority,
1955
- state: 0 /* waiting */,
1956
- max: (_b = config2.max) != null ? _b : 1,
1957
- resolved: (_c = config2.resolved) != null ? _c : 0,
1958
- done,
1959
- setMax(max) {
1960
- tasks[id].max = max;
1961
- didUpdate();
1962
- },
1963
- setResolved(max) {
1964
- tasks[id].resolved = max;
1965
- didUpdate();
1966
- },
1967
- incResolved(inc = 1) {
1968
- tasks[id].resolved += inc;
1969
- didUpdate();
1970
- }
1971
- };
1972
- ++countMax;
1973
- performNext();
1813
+ if (tasks[id] != null) {
1814
+ const resolution = (_b = config2.idConflictResolution) != null ? _b : 1 /* memoize */;
1815
+ if (resolution === 0 /* replace */) {
1816
+ cancel(id);
1817
+ } else if (resolution === 1 /* memoize */) {
1818
+ let runningTask = tasks[id];
1819
+ return {
1820
+ id,
1821
+ promise: (async () => {
1822
+ if (runningTask.state === 2 /* finished */) {
1823
+ return tasks[id].result;
1824
+ }
1825
+ })(),
1826
+ dispose: () => cancel(id),
1827
+ cancel: () => cancel(id)
1828
+ };
1829
+ } else {
1830
+ throw new Error(`Pool task with id=${id} already exists!`);
1831
+ }
1974
1832
  }
1833
+ tasks[id] = {
1834
+ id,
1835
+ task,
1836
+ priority: ++priority,
1837
+ state: 0 /* waiting */,
1838
+ max: (_c = config2.max) != null ? _c : 1,
1839
+ resolved: (_d = config2.resolved) != null ? _d : 0,
1840
+ done,
1841
+ setMax(max) {
1842
+ tasks[id].max = max;
1843
+ didUpdate();
1844
+ },
1845
+ setResolved(max) {
1846
+ tasks[id].resolved = max;
1847
+ didUpdate();
1848
+ },
1849
+ incResolved(inc = 1) {
1850
+ tasks[id].resolved += inc;
1851
+ didUpdate();
1852
+ }
1853
+ };
1854
+ ++countMax;
1855
+ performNext();
1975
1856
  return {
1976
1857
  id,
1977
1858
  promise,
@@ -1979,7 +1860,6 @@ function usePool(config = {}) {
1979
1860
  cancel: () => cancel(id)
1980
1861
  };
1981
1862
  }
1982
- __name(enqueue, "enqueue");
1983
1863
  return {
1984
1864
  events,
1985
1865
  cancel,
@@ -1989,7 +1869,6 @@ function usePool(config = {}) {
1989
1869
  waitFinishAll
1990
1870
  };
1991
1871
  }
1992
- __name(usePool, "usePool");
1993
1872
 
1994
1873
  // src/common/exec/queue.ts
1995
1874
  var log6 = Logger("zeed:queue");
@@ -2107,7 +1986,6 @@ var SerialQueue = class extends Emitter {
2107
1986
  return this.queue.length !== 0;
2108
1987
  }
2109
1988
  };
2110
- __name(SerialQueue, "SerialQueue");
2111
1989
 
2112
1990
  // src/common/exec/throttle-debounce.ts
2113
1991
  var DEBUG = false;
@@ -2126,7 +2004,6 @@ function throttle(callback, opt = {}) {
2126
2004
  timeoutID = void 0;
2127
2005
  }
2128
2006
  }
2129
- __name(clearExistingTimeout, "clearExistingTimeout");
2130
2007
  function wrapper(...args) {
2131
2008
  const now = Date.now();
2132
2009
  let self2 = this;
@@ -2135,13 +2012,11 @@ function throttle(callback, opt = {}) {
2135
2012
  const dnow = Date.now();
2136
2013
  return `total ${(dnow - debugCheckpoint).toFixed(1)}ms - elapsed ${(dnow - checkpoint).toFixed(1)}ms - visited ${visited}x`;
2137
2014
  }
2138
- __name(debugElapsed, "debugElapsed");
2139
2015
  function exec() {
2140
2016
  visited = 0;
2141
2017
  checkpoint = Date.now();
2142
2018
  callback.apply(self2, args);
2143
2019
  }
2144
- __name(exec, "exec");
2145
2020
  trailingExec = exec;
2146
2021
  if (elapsed > delay || !timeoutID) {
2147
2022
  DEBUG && log7("elapsed", debugElapsed());
@@ -2170,12 +2045,10 @@ function throttle(callback, opt = {}) {
2170
2045
  DEBUG && log7("visited", debugElapsed());
2171
2046
  }
2172
2047
  }
2173
- __name(wrapper, "wrapper");
2174
2048
  wrapper.cancel = clearExistingTimeout;
2175
2049
  wrapper.dispose = clearExistingTimeout;
2176
2050
  return wrapper;
2177
2051
  }
2178
- __name(throttle, "throttle");
2179
2052
  function debounce(callback, opt = {}) {
2180
2053
  const { delay = 100 } = opt;
2181
2054
  let timeoutID = 0;
@@ -2185,7 +2058,6 @@ function debounce(callback, opt = {}) {
2185
2058
  timeoutID = 0;
2186
2059
  }
2187
2060
  }
2188
- __name(clearExistingTimeout, "clearExistingTimeout");
2189
2061
  function wrapper(...arguments_) {
2190
2062
  let self2 = this;
2191
2063
  clearExistingTimeout();
@@ -2194,18 +2066,15 @@ function debounce(callback, opt = {}) {
2194
2066
  callback.apply(self2, arguments_);
2195
2067
  }, delay);
2196
2068
  }
2197
- __name(wrapper, "wrapper");
2198
2069
  wrapper.cancel = clearExistingTimeout;
2199
2070
  wrapper.dispose = clearExistingTimeout;
2200
2071
  return wrapper;
2201
2072
  }
2202
- __name(debounce, "debounce");
2203
2073
 
2204
2074
  // src/common/localhost.ts
2205
2075
  function isLocalHost(hostname = ((_b) => (_b = ((_a) => (_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.hostname)()) != null ? _b : "")()) {
2206
2076
  return ["localhost", "127.0.0.1", "", "::1", "::"].includes(hostname) || hostname.startsWith("192.168.") || hostname.startsWith("10.0.") || hostname.endsWith(".local");
2207
2077
  }
2208
- __name(isLocalHost, "isLocalHost");
2209
2078
 
2210
2079
  // src/common/log-memory.ts
2211
2080
  function LoggerMemoryHandler(opt) {
@@ -2220,7 +2089,6 @@ function LoggerMemoryHandler(opt) {
2220
2089
  messages2.push(msg);
2221
2090
  };
2222
2091
  }
2223
- __name(LoggerMemoryHandler, "LoggerMemoryHandler");
2224
2092
 
2225
2093
  // src/common/msg/channel.ts
2226
2094
  var Channel = class extends Emitter {
@@ -2231,7 +2099,6 @@ var Channel = class extends Emitter {
2231
2099
  close() {
2232
2100
  }
2233
2101
  };
2234
- __name(Channel, "Channel");
2235
2102
  var LocalChannel = class extends Channel {
2236
2103
  constructor() {
2237
2104
  super(...arguments);
@@ -2246,7 +2113,6 @@ var LocalChannel = class extends Channel {
2246
2113
  });
2247
2114
  }
2248
2115
  };
2249
- __name(LocalChannel, "LocalChannel");
2250
2116
  function fakeWorkerPair() {
2251
2117
  let w1 = new LocalChannel();
2252
2118
  let w2 = new LocalChannel();
@@ -2254,7 +2120,6 @@ function fakeWorkerPair() {
2254
2120
  w2.other = w1;
2255
2121
  return [w1, w2];
2256
2122
  }
2257
- __name(fakeWorkerPair, "fakeWorkerPair");
2258
2123
 
2259
2124
  // src/common/msg/encoder.ts
2260
2125
  var NoopEncoder = class {
@@ -2265,7 +2130,6 @@ var NoopEncoder = class {
2265
2130
  return data;
2266
2131
  }
2267
2132
  };
2268
- __name(NoopEncoder, "NoopEncoder");
2269
2133
  var JsonEncoder = class {
2270
2134
  async encode(data) {
2271
2135
  return jsonToUint8Array(data);
@@ -2274,7 +2138,6 @@ var JsonEncoder = class {
2274
2138
  return Uint8ArrayToJson(data);
2275
2139
  }
2276
2140
  };
2277
- __name(JsonEncoder, "JsonEncoder");
2278
2141
  var CryptoEncoder = class {
2279
2142
  constructor(key) {
2280
2143
  this.key = key;
@@ -2288,16 +2151,15 @@ var CryptoEncoder = class {
2288
2151
  return Uint8ArrayToJson(plain);
2289
2152
  }
2290
2153
  };
2291
- __name(CryptoEncoder, "CryptoEncoder");
2292
2154
 
2293
2155
  // src/common/msg/messages.ts
2294
- var createPromiseProxy = /* @__PURE__ */ __name((fn, opt, predefinedMethods = {}) => new Proxy(predefinedMethods, {
2156
+ var createPromiseProxy = (fn, opt, predefinedMethods = {}) => new Proxy(predefinedMethods, {
2295
2157
  get: (target, name) => {
2296
2158
  if (name in target)
2297
2159
  return target[name];
2298
2160
  return (...args) => fn(name, args, opt);
2299
2161
  }
2300
- }), "createPromiseProxy");
2162
+ });
2301
2163
  function useMessageHub(opt = {}) {
2302
2164
  let {
2303
2165
  name = uname("hub"),
@@ -2311,10 +2173,10 @@ function useMessageHub(opt = {}) {
2311
2173
  let queue = [];
2312
2174
  let queueRetryTimer;
2313
2175
  let waitingForResponse = {};
2314
- const dispose = /* @__PURE__ */ __name(() => {
2176
+ const dispose = () => {
2315
2177
  clearTimeout(queueRetryTimer);
2316
- }, "dispose");
2317
- const postNext = /* @__PURE__ */ __name(async () => {
2178
+ };
2179
+ const postNext = async () => {
2318
2180
  clearTimeout(queueRetryTimer);
2319
2181
  if (channel) {
2320
2182
  if (channel.isConnected) {
@@ -2333,13 +2195,13 @@ function useMessageHub(opt = {}) {
2333
2195
  queueRetryTimer = setTimeout(postNext, retryAfter);
2334
2196
  }
2335
2197
  }
2336
- }, "postNext");
2337
- const postMessage = /* @__PURE__ */ __name(async (message) => {
2198
+ };
2199
+ const postMessage = async (message) => {
2338
2200
  log10("enqueue postMessage", message);
2339
2201
  queue.push(message);
2340
2202
  await postNext();
2341
- }, "postMessage");
2342
- const connect = /* @__PURE__ */ __name(async (newChannel) => {
2203
+ };
2204
+ const connect = async (newChannel) => {
2343
2205
  channel = newChannel;
2344
2206
  channel.on("connect", postNext);
2345
2207
  channel.on("message", async (msg) => {
@@ -2399,8 +2261,8 @@ function useMessageHub(opt = {}) {
2399
2261
  }
2400
2262
  });
2401
2263
  postNext();
2402
- }, "connect");
2403
- const fetchMessage = /* @__PURE__ */ __name(async (name2, args, opt2 = {}) => {
2264
+ };
2265
+ const fetchMessage = async (name2, args, opt2 = {}) => {
2404
2266
  const { timeout: timeout2 = 5e3 } = opt2;
2405
2267
  const id = uuid();
2406
2268
  postMessage({
@@ -2409,7 +2271,7 @@ function useMessageHub(opt = {}) {
2409
2271
  id
2410
2272
  });
2411
2273
  return tryTimeout(new Promise((resolve, reject) => waitingForResponse[id] = [resolve, reject]), timeout2);
2412
- }, "fetchMessage");
2274
+ };
2413
2275
  if (opt.channel) {
2414
2276
  connect(opt.channel);
2415
2277
  }
@@ -2428,7 +2290,6 @@ function useMessageHub(opt = {}) {
2428
2290
  }
2429
2291
  };
2430
2292
  }
2431
- __name(useMessageHub, "useMessageHub");
2432
2293
 
2433
2294
  // src/common/msg/pubsub.ts
2434
2295
  var PubSub = class extends Emitter {
@@ -2488,11 +2349,9 @@ var PubSub = class extends Emitter {
2488
2349
  return false;
2489
2350
  }
2490
2351
  };
2491
- __name(PubSub, "PubSub");
2492
2352
  function usePubSub(opt) {
2493
2353
  return new PubSub(opt);
2494
2354
  }
2495
- __name(usePubSub, "usePubSub");
2496
2355
 
2497
2356
  // src/common/msg/rpc.ts
2498
2357
  var rpcCounter = 1;
@@ -2533,26 +2392,25 @@ function useRPC(functions, options) {
2533
2392
  });
2534
2393
  return new Proxy({}, {
2535
2394
  get(_, method) {
2536
- const sendEvent = /* @__PURE__ */ __name((...args) => {
2395
+ const sendEvent = (...args) => {
2537
2396
  post(serialize([2 /* event */, args, null, method]));
2538
- }, "sendEvent");
2397
+ };
2539
2398
  if (options.onlyEvents || eventNames.includes(method)) {
2540
2399
  sendEvent.asEvent = sendEvent;
2541
2400
  return sendEvent;
2542
2401
  }
2543
- const sendCall = /* @__PURE__ */ __name((...args) => {
2402
+ const sendCall = (...args) => {
2544
2403
  return new Promise((resolve, reject) => {
2545
2404
  const id = rpcCounter++;
2546
2405
  rpcPromiseMap.set(id, { resolve, reject });
2547
2406
  post(serialize([1 /* request */, args, id, method]));
2548
2407
  });
2549
- }, "sendCall");
2408
+ };
2550
2409
  sendCall.asEvent = sendEvent;
2551
2410
  return sendCall;
2552
2411
  }
2553
2412
  });
2554
2413
  }
2555
- __name(useRPC, "useRPC");
2556
2414
 
2557
2415
  // src/common/network.ts
2558
2416
  var log8 = Logger("network");
@@ -2576,7 +2434,6 @@ async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
2576
2434
  log8.error("fetchBasic", err);
2577
2435
  }
2578
2436
  }
2579
- __name(fetchBasic, "fetchBasic");
2580
2437
  async function fetchJson(url, opts = {}, fetchFn = fetch) {
2581
2438
  try {
2582
2439
  let res = await fetchBasic(url, __spreadValues(__spreadProps(__spreadValues({
@@ -2591,7 +2448,6 @@ async function fetchJson(url, opts = {}, fetchFn = fetch) {
2591
2448
  log8.error("fetchJSON error:", err);
2592
2449
  }
2593
2450
  }
2594
- __name(fetchJson, "fetchJson");
2595
2451
  function fetchOptionsFormURLEncoded(data, method = "POST") {
2596
2452
  return __spreadProps(__spreadValues({
2597
2453
  method
@@ -2602,7 +2458,6 @@ function fetchOptionsFormURLEncoded(data, method = "POST") {
2602
2458
  body: encodeQuery(data)
2603
2459
  });
2604
2460
  }
2605
- __name(fetchOptionsFormURLEncoded, "fetchOptionsFormURLEncoded");
2606
2461
  function fetchOptionsJson(data, method = "POST") {
2607
2462
  return __spreadProps(__spreadValues({
2608
2463
  method
@@ -2614,7 +2469,6 @@ function fetchOptionsJson(data, method = "POST") {
2614
2469
  body: JSON.stringify(data)
2615
2470
  });
2616
2471
  }
2617
- __name(fetchOptionsJson, "fetchOptionsJson");
2618
2472
  async function fetchText(url, opts = {}, fetchFn = fetch) {
2619
2473
  try {
2620
2474
  let res = await fetchBasic(url, __spreadValues(__spreadProps(__spreadValues({
@@ -2629,24 +2483,20 @@ async function fetchText(url, opts = {}, fetchFn = fetch) {
2629
2483
  log8.error("fetchHTML error:", err);
2630
2484
  }
2631
2485
  }
2632
- __name(fetchText, "fetchText");
2633
2486
 
2634
2487
  // src/common/platform.ts
2635
2488
  function getWindow() {
2636
2489
  if (typeof window !== "undefined")
2637
2490
  return window;
2638
2491
  }
2639
- __name(getWindow, "getWindow");
2640
2492
  function getNavigator() {
2641
2493
  if (typeof navigator !== "undefined")
2642
2494
  return navigator;
2643
2495
  }
2644
- __name(getNavigator, "getNavigator");
2645
2496
  function getGlobal() {
2646
2497
  var _a;
2647
2498
  return ((_a = getWindow()) != null ? _a : typeof WorkerGlobalScope !== "undefined") ? self : typeof global !== "undefined" ? global : Function("return this;")();
2648
2499
  }
2649
- __name(getGlobal, "getGlobal");
2650
2500
  var _navigator = getNavigator();
2651
2501
  var _window = getWindow();
2652
2502
  function detect(info = {
@@ -2688,8 +2538,7 @@ function detect(info = {
2688
2538
  info.touch = _window && "ontouchstart" in _window || ((_navigator == null ? void 0 : _navigator.maxTouchPoints) || 0) > 1 || (_navigator == null ? void 0 : _navigator.msPointerEnabled) && (_window == null ? void 0 : _window.MSGesture) || (_window == null ? void 0 : _window.DocumentTouch) && document instanceof DocumentTouch;
2689
2539
  return info;
2690
2540
  }
2691
- __name(detect, "detect");
2692
- var isBrowser = /* @__PURE__ */ __name(() => typeof window !== "undefined" && globalThis === window, "isBrowser");
2541
+ var isBrowser = () => typeof window !== "undefined" && globalThis === window;
2693
2542
  var platform = detect();
2694
2543
  function useExitHandler(handler) {
2695
2544
  if (isBrowser()) {
@@ -2698,7 +2547,6 @@ function useExitHandler(handler) {
2698
2547
  process.on("exit", () => handler);
2699
2548
  }
2700
2549
  }
2701
- __name(useExitHandler, "useExitHandler");
2702
2550
 
2703
2551
  // src/common/storage/memstorage.ts
2704
2552
  var log9 = Logger("zeed:memstorage");
@@ -2724,7 +2572,6 @@ var MemStorage = class {
2724
2572
  return Object.keys(this.store);
2725
2573
  }
2726
2574
  };
2727
- __name(MemStorage, "MemStorage");
2728
2575
 
2729
2576
  export {
2730
2577
  _encodeUtf8Polyfill,
@@ -2753,6 +2600,7 @@ export {
2753
2600
  between,
2754
2601
  sum,
2755
2602
  avg,
2603
+ isPrimeRX,
2756
2604
  parseOrderby,
2757
2605
  composeOrderby,
2758
2606
  cmp,
@@ -2891,6 +2739,7 @@ export {
2891
2739
  suidDate,
2892
2740
  suidBytesDate,
2893
2741
  PoolTaskState,
2742
+ PoolTaskIdConflictResolution,
2894
2743
  usePool,
2895
2744
  SerialQueue,
2896
2745
  throttle,
@@ -2922,4 +2771,4 @@ export {
2922
2771
  useExitHandler,
2923
2772
  MemStorage
2924
2773
  };
2925
- //# sourceMappingURL=chunk-RKCEGSPB.js.map
2774
+ //# sourceMappingURL=chunk-AA43JNUH.js.map