@hairy/utils 1.45.0 → 1.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  (() => {
3
3
  // src/browser/file.ts
4
- function showOpenFilePicker(option = {}) {
4
+ function openFilePicker(option = {}) {
5
5
  const { multiple = true, accept } = option;
6
6
  return new Promise((resolve, reject) => {
7
7
  const inputElement = document.createElement("input");
@@ -19,11 +19,13 @@
19
19
  });
20
20
  });
21
21
  }
22
- function showOpenImagePicker(options = {}) {
22
+ var showOpenFilePicker = openFilePicker;
23
+ function openImagePicker(options = {}) {
23
24
  const { multiple = true } = options;
24
- return showOpenFilePicker({ multiple, accept: "image/jpeg,image/x-png,image/gif" });
25
+ return openFilePicker({ multiple, accept: "image/jpeg,image/x-png,image/gif" });
25
26
  }
26
- var selectImages = showOpenImagePicker;
27
+ var selectImages = openImagePicker;
28
+ var showOpenImagePicker = openImagePicker;
27
29
  function downloadBlobFile(data, name) {
28
30
  const blob = new Blob([data]);
29
31
  const link = document.createElement("a");
@@ -32,12 +34,13 @@
32
34
  link.download = name;
33
35
  link.click();
34
36
  }
35
- function downloadNetworkFile(url, name) {
37
+ function downloadUrlFile(url, name) {
36
38
  const a = document.createElement("a");
37
39
  name && (a.download = name);
38
40
  a.href = url;
39
41
  a.click();
40
42
  }
43
+ var downloadNetworkFile = downloadUrlFile;
41
44
  function readFileReader(formType, file) {
42
45
  return new Promise((resolve, reject) => {
43
46
  if (typeof FileReader === "undefined") {
@@ -1053,9 +1056,9 @@
1053
1056
 
1054
1057
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js
1055
1058
  function mapCacheSet(key, value) {
1056
- var data = getMapData_default(this, key), size = data.size;
1059
+ var data = getMapData_default(this, key), size2 = data.size;
1057
1060
  data.set(key, value);
1058
- this.size += data.size == size ? 0 : 1;
1061
+ this.size += data.size == size2 ? 0 : 1;
1059
1062
  return this;
1060
1063
  }
1061
1064
  var mapCacheSet_default = mapCacheSet;
@@ -1208,6 +1211,19 @@
1208
1211
  }
1209
1212
  var baseFlatten_default = baseFlatten;
1210
1213
 
1214
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/flatten.js
1215
+ function flatten(array) {
1216
+ var length = array == null ? 0 : array.length;
1217
+ return length ? baseFlatten_default(array, 1) : [];
1218
+ }
1219
+ var flatten_default = flatten;
1220
+
1221
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_flatRest.js
1222
+ function flatRest(func) {
1223
+ return setToString_default(overRest_default(func, void 0, flatten_default), func + "");
1224
+ }
1225
+ var flatRest_default = flatRest;
1226
+
1211
1227
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getPrototype.js
1212
1228
  var getPrototype = overArg_default(Object.getPrototypeOf, Object);
1213
1229
  var getPrototype_default = getPrototype;
@@ -1244,6 +1260,26 @@
1244
1260
  }
1245
1261
  var isError_default = isError;
1246
1262
 
1263
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/before.js
1264
+ var FUNC_ERROR_TEXT2 = "Expected a function";
1265
+ function before(n, func) {
1266
+ var result;
1267
+ if (typeof func != "function") {
1268
+ throw new TypeError(FUNC_ERROR_TEXT2);
1269
+ }
1270
+ n = toInteger_default(n);
1271
+ return function() {
1272
+ if (--n > 0) {
1273
+ result = func.apply(this, arguments);
1274
+ }
1275
+ if (n <= 1) {
1276
+ func = void 0;
1277
+ }
1278
+ return result;
1279
+ };
1280
+ }
1281
+ var before_default = before;
1282
+
1247
1283
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSlice.js
1248
1284
  function baseSlice(array, start, end) {
1249
1285
  var index = -1, length = array.length;
@@ -1324,6 +1360,27 @@
1324
1360
  }
1325
1361
  var stringToArray_default = stringToArray;
1326
1362
 
1363
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/chunk.js
1364
+ var nativeCeil = Math.ceil;
1365
+ var nativeMax2 = Math.max;
1366
+ function chunk(array, size2, guard) {
1367
+ if (guard ? isIterateeCall_default(array, size2, guard) : size2 === void 0) {
1368
+ size2 = 1;
1369
+ } else {
1370
+ size2 = nativeMax2(toInteger_default(size2), 0);
1371
+ }
1372
+ var length = array == null ? 0 : array.length;
1373
+ if (!length || size2 < 1) {
1374
+ return [];
1375
+ }
1376
+ var index = 0, resIndex = 0, result = Array(nativeCeil(length / size2));
1377
+ while (index < length) {
1378
+ result[resIndex++] = baseSlice_default(array, index, index += size2);
1379
+ }
1380
+ return result;
1381
+ }
1382
+ var chunk_default = chunk;
1383
+
1327
1384
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js
1328
1385
  function stackClear() {
1329
1386
  this.__data__ = new ListCache_default();
@@ -2335,19 +2392,19 @@
2335
2392
  var now_default = now;
2336
2393
 
2337
2394
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js
2338
- var FUNC_ERROR_TEXT2 = "Expected a function";
2339
- var nativeMax2 = Math.max;
2395
+ var FUNC_ERROR_TEXT3 = "Expected a function";
2396
+ var nativeMax3 = Math.max;
2340
2397
  var nativeMin = Math.min;
2341
2398
  function debounce(func, wait, options) {
2342
2399
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
2343
2400
  if (typeof func != "function") {
2344
- throw new TypeError(FUNC_ERROR_TEXT2);
2401
+ throw new TypeError(FUNC_ERROR_TEXT3);
2345
2402
  }
2346
2403
  wait = toNumber_default(wait) || 0;
2347
2404
  if (isObject_default(options)) {
2348
2405
  leading = !!options.leading;
2349
2406
  maxing = "maxWait" in options;
2350
- maxWait = maxing ? nativeMax2(toNumber_default(options.maxWait) || 0, wait) : maxWait;
2407
+ maxWait = maxing ? nativeMax3(toNumber_default(options.maxWait) || 0, wait) : maxWait;
2351
2408
  trailing = "trailing" in options ? !!options.trailing : trailing;
2352
2409
  }
2353
2410
  function invokeFunc(time) {
@@ -2537,6 +2594,13 @@
2537
2594
  }
2538
2595
  var arrayIncludesWith_default = arrayIncludesWith;
2539
2596
 
2597
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/last.js
2598
+ function last(array) {
2599
+ var length = array == null ? 0 : array.length;
2600
+ return length ? array[length - 1] : void 0;
2601
+ }
2602
+ var last_default = last;
2603
+
2540
2604
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createFind.js
2541
2605
  function createFind(findIndexFunc) {
2542
2606
  return function(collection, predicate, fromIndex) {
@@ -2555,7 +2619,7 @@
2555
2619
  var createFind_default = createFind;
2556
2620
 
2557
2621
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/findIndex.js
2558
- var nativeMax3 = Math.max;
2622
+ var nativeMax4 = Math.max;
2559
2623
  function findIndex(array, predicate, fromIndex) {
2560
2624
  var length = array == null ? 0 : array.length;
2561
2625
  if (!length) {
@@ -2563,7 +2627,7 @@
2563
2627
  }
2564
2628
  var index = fromIndex == null ? 0 : toInteger_default(fromIndex);
2565
2629
  if (index < 0) {
2566
- index = nativeMax3(length + index, 0);
2630
+ index = nativeMax4(length + index, 0);
2567
2631
  }
2568
2632
  return baseFindIndex_default(array, baseIteratee_default(predicate, 3), index);
2569
2633
  }
@@ -2585,6 +2649,12 @@
2585
2649
  });
2586
2650
  var groupBy_default = groupBy;
2587
2651
 
2652
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGt.js
2653
+ function baseGt(value, other) {
2654
+ return value > other;
2655
+ }
2656
+ var baseGt_default = baseGt;
2657
+
2588
2658
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isString.js
2589
2659
  var stringTag5 = "[object String]";
2590
2660
  function isString(value) {
@@ -2606,6 +2676,12 @@
2606
2676
  }
2607
2677
  var values_default = values;
2608
2678
 
2679
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_parent.js
2680
+ function parent(object, path) {
2681
+ return path.length < 2 ? object : baseGet_default(object, baseSlice_default(path, 0, -1));
2682
+ }
2683
+ var parent_default = parent;
2684
+
2609
2685
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArrayBuffer.js
2610
2686
  var arrayBufferTag5 = "[object ArrayBuffer]";
2611
2687
  function baseIsArrayBuffer(value) {
@@ -2783,12 +2859,119 @@
2783
2859
  });
2784
2860
  var keyBy_default = keyBy;
2785
2861
 
2862
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseLt.js
2863
+ function baseLt(value, other) {
2864
+ return value < other;
2865
+ }
2866
+ var baseLt_default = baseLt;
2867
+
2868
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseExtremum.js
2869
+ function baseExtremum(array, iteratee, comparator) {
2870
+ var index = -1, length = array.length;
2871
+ while (++index < length) {
2872
+ var value = array[index], current = iteratee(value);
2873
+ if (current != null && (computed === void 0 ? current === current && !isSymbol_default(current) : comparator(current, computed))) {
2874
+ var computed = current, result = value;
2875
+ }
2876
+ }
2877
+ return result;
2878
+ }
2879
+ var baseExtremum_default = baseExtremum;
2880
+
2881
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/max.js
2882
+ function max(array) {
2883
+ return array && array.length ? baseExtremum_default(array, identity_default, baseGt_default) : void 0;
2884
+ }
2885
+ var max_default = max;
2886
+
2887
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/maxBy.js
2888
+ function maxBy(array, iteratee) {
2889
+ return array && array.length ? baseExtremum_default(array, baseIteratee_default(iteratee, 2), baseGt_default) : void 0;
2890
+ }
2891
+ var maxBy_default = maxBy;
2892
+
2786
2893
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge.js
2787
2894
  var merge = createAssigner_default(function(object, source, srcIndex) {
2788
2895
  baseMerge_default(object, source, srcIndex);
2789
2896
  });
2790
2897
  var merge_default = merge;
2791
2898
 
2899
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/min.js
2900
+ function min(array) {
2901
+ return array && array.length ? baseExtremum_default(array, identity_default, baseLt_default) : void 0;
2902
+ }
2903
+ var min_default = min;
2904
+
2905
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/minBy.js
2906
+ function minBy(array, iteratee) {
2907
+ return array && array.length ? baseExtremum_default(array, baseIteratee_default(iteratee, 2), baseLt_default) : void 0;
2908
+ }
2909
+ var minBy_default = minBy;
2910
+
2911
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/negate.js
2912
+ var FUNC_ERROR_TEXT4 = "Expected a function";
2913
+ function negate(predicate) {
2914
+ if (typeof predicate != "function") {
2915
+ throw new TypeError(FUNC_ERROR_TEXT4);
2916
+ }
2917
+ return function() {
2918
+ var args = arguments;
2919
+ switch (args.length) {
2920
+ case 0:
2921
+ return !predicate.call(this);
2922
+ case 1:
2923
+ return !predicate.call(this, args[0]);
2924
+ case 2:
2925
+ return !predicate.call(this, args[0], args[1]);
2926
+ case 3:
2927
+ return !predicate.call(this, args[0], args[1], args[2]);
2928
+ }
2929
+ return !predicate.apply(this, args);
2930
+ };
2931
+ }
2932
+ var negate_default = negate;
2933
+
2934
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnset.js
2935
+ function baseUnset(object, path) {
2936
+ path = castPath_default(path, object);
2937
+ object = parent_default(object, path);
2938
+ return object == null || delete object[toKey_default(last_default(path))];
2939
+ }
2940
+ var baseUnset_default = baseUnset;
2941
+
2942
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_customOmitClone.js
2943
+ function customOmitClone(value) {
2944
+ return isPlainObject_default(value) ? void 0 : value;
2945
+ }
2946
+ var customOmitClone_default = customOmitClone;
2947
+
2948
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/omit.js
2949
+ var CLONE_DEEP_FLAG4 = 1;
2950
+ var CLONE_FLAT_FLAG2 = 2;
2951
+ var CLONE_SYMBOLS_FLAG6 = 4;
2952
+ var omit = flatRest_default(function(object, paths) {
2953
+ var result = {};
2954
+ if (object == null) {
2955
+ return result;
2956
+ }
2957
+ var isDeep = false;
2958
+ paths = arrayMap_default(paths, function(path) {
2959
+ path = castPath_default(path, object);
2960
+ isDeep || (isDeep = path.length > 1);
2961
+ return path;
2962
+ });
2963
+ copyObject_default(object, getAllKeysIn_default(object), result);
2964
+ if (isDeep) {
2965
+ result = baseClone_default(result, CLONE_DEEP_FLAG4 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG6, customOmitClone_default);
2966
+ }
2967
+ var length = paths.length;
2968
+ while (length--) {
2969
+ baseUnset_default(result, paths[length]);
2970
+ }
2971
+ return result;
2972
+ });
2973
+ var omit_default = omit;
2974
+
2792
2975
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSet.js
2793
2976
  function baseSet(object, path, value, customizer) {
2794
2977
  if (!isObject_default(object)) {
@@ -2815,6 +2998,46 @@
2815
2998
  }
2816
2999
  var baseSet_default = baseSet;
2817
3000
 
3001
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_basePickBy.js
3002
+ function basePickBy(object, paths, predicate) {
3003
+ var index = -1, length = paths.length, result = {};
3004
+ while (++index < length) {
3005
+ var path = paths[index], value = baseGet_default(object, path);
3006
+ if (predicate(value, path)) {
3007
+ baseSet_default(result, castPath_default(path, object), value);
3008
+ }
3009
+ }
3010
+ return result;
3011
+ }
3012
+ var basePickBy_default = basePickBy;
3013
+
3014
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/pickBy.js
3015
+ function pickBy(object, predicate) {
3016
+ if (object == null) {
3017
+ return {};
3018
+ }
3019
+ var props = arrayMap_default(getAllKeysIn_default(object), function(prop) {
3020
+ return [prop];
3021
+ });
3022
+ predicate = baseIteratee_default(predicate);
3023
+ return basePickBy_default(object, props, function(value, path) {
3024
+ return predicate(value, path[0]);
3025
+ });
3026
+ }
3027
+ var pickBy_default = pickBy;
3028
+
3029
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/omitBy.js
3030
+ function omitBy(object, predicate) {
3031
+ return pickBy_default(object, negate_default(baseIteratee_default(predicate)));
3032
+ }
3033
+ var omitBy_default = omitBy;
3034
+
3035
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/once.js
3036
+ function once(func) {
3037
+ return before_default(2, func);
3038
+ }
3039
+ var once_default = once;
3040
+
2818
3041
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiSize.js
2819
3042
  var asciiSize = baseProperty_default("length");
2820
3043
  var asciiSize_default = asciiSize;
@@ -2855,6 +3078,56 @@
2855
3078
  }
2856
3079
  var stringSize_default = stringSize;
2857
3080
 
3081
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_basePick.js
3082
+ function basePick(object, paths) {
3083
+ return basePickBy_default(object, paths, function(value, path) {
3084
+ return hasIn_default(object, path);
3085
+ });
3086
+ }
3087
+ var basePick_default = basePick;
3088
+
3089
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/pick.js
3090
+ var pick = flatRest_default(function(object, paths) {
3091
+ return object == null ? {} : basePick_default(object, paths);
3092
+ });
3093
+ var pick_default = pick;
3094
+
3095
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRange.js
3096
+ var nativeCeil2 = Math.ceil;
3097
+ var nativeMax5 = Math.max;
3098
+ function baseRange(start, end, step, fromRight) {
3099
+ var index = -1, length = nativeMax5(nativeCeil2((end - start) / (step || 1)), 0), result = Array(length);
3100
+ while (length--) {
3101
+ result[fromRight ? length : ++index] = start;
3102
+ start += step;
3103
+ }
3104
+ return result;
3105
+ }
3106
+ var baseRange_default = baseRange;
3107
+
3108
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createRange.js
3109
+ function createRange(fromRight) {
3110
+ return function(start, end, step) {
3111
+ if (step && typeof step != "number" && isIterateeCall_default(start, end, step)) {
3112
+ end = step = void 0;
3113
+ }
3114
+ start = toFinite_default(start);
3115
+ if (end === void 0) {
3116
+ end = start;
3117
+ start = 0;
3118
+ } else {
3119
+ end = toFinite_default(end);
3120
+ }
3121
+ step = step === void 0 ? start < end ? 1 : -1 : toFinite_default(step);
3122
+ return baseRange_default(start, end, step, fromRight);
3123
+ };
3124
+ }
3125
+ var createRange_default = createRange;
3126
+
3127
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/range.js
3128
+ var range = createRange_default();
3129
+ var range_default = range;
3130
+
2858
3131
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.js
2859
3132
  function set(object, path, value) {
2860
3133
  return object == null ? object : baseSet_default(object, path, value);
@@ -4452,9 +4725,9 @@
4452
4725
  for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
4453
4726
  return k == l ? 0 : k > l ^ a ? 1 : -1;
4454
4727
  }
4455
- function intCheck(n, min, max, name) {
4456
- if (n < min || n > max || n !== mathfloor(n)) {
4457
- throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
4728
+ function intCheck(n, min2, max2, name) {
4729
+ if (n < min2 || n > max2 || n !== mathfloor(n)) {
4730
+ throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min2 || n > max2 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
4458
4731
  }
4459
4732
  }
4460
4733
  function isOdd(n) {
@@ -4502,33 +4775,6 @@
4502
4775
  }
4503
4776
  compose.promise = pCompose;
4504
4777
 
4505
- // src/util/converts.ts
4506
- function formdataToObject(formData) {
4507
- return Object.fromEntries(formData.entries());
4508
- }
4509
- function objectToFormdata(object) {
4510
- const formdata = new FormData();
4511
- for (const [key, value] of Object.entries(object))
4512
- formdata.set(key, value);
4513
- return formdata;
4514
- }
4515
- function nonnanable(value) {
4516
- return Number.isNaN(Number(value)) ? void 0 : value;
4517
- }
4518
- function numberify(value) {
4519
- return Number.isNaN(Number(value)) ? 0 : Number(value);
4520
- }
4521
- function stringify(value) {
4522
- return String(value);
4523
- }
4524
- function numberish(value) {
4525
- if (value === void 0 || value === null)
4526
- return "0";
4527
- if (Number.isNaN(Number(value)))
4528
- return "0";
4529
- return value.toString();
4530
- }
4531
-
4532
4778
  // src/util/noop.ts
4533
4779
  var noop2 = () => {
4534
4780
  };
@@ -4561,7 +4807,7 @@
4561
4807
  }
4562
4808
 
4563
4809
  // src/util/json.ts
4564
- function jsonTryParse(text) {
4810
+ function tryParseJson(text) {
4565
4811
  try {
4566
4812
  return JSON.parse(text || "");
4567
4813
  } catch {
@@ -4617,6 +4863,10 @@
4617
4863
  let target = initObject || { proxyUpdated: false };
4618
4864
  const proxy2 = new Proxy({}, {
4619
4865
  get: (_, p) => {
4866
+ if (p === "proxy")
4867
+ return { update, original };
4868
+ if (!Reflect.get(target, "proxyUpdated"))
4869
+ throw new Error(`Proxy not updated. Call object.proxy.update() to update the proxy.`);
4620
4870
  return typeof target?.[p] === "function" ? target?.[p].bind(target) : target?.[p];
4621
4871
  },
4622
4872
  set: (_, p, v) => {
@@ -4632,32 +4882,56 @@
4632
4882
  Reflect.set(object, "proxyUpdated", true);
4633
4883
  target = object;
4634
4884
  }
4635
- return {
4636
- proxy: proxy2,
4637
- update
4638
- };
4885
+ function original() {
4886
+ return Reflect.get(target, "proxyUpdated") ? target : void 0;
4887
+ }
4888
+ return proxy2;
4639
4889
  }
4640
- proxy.resolve = (target) => {
4641
- return Reflect.get(target, "proxyUpdated") ? target : void 0;
4642
- };
4643
4890
 
4644
4891
  // src/util/random.ts
4645
- function randomArray(array) {
4892
+ function randomItem(array) {
4646
4893
  return array[Math.floor(Math.random() * array.length)];
4647
4894
  }
4648
- function randomNumber(min, max) {
4649
- return Math.random() * (max - min) + min;
4895
+ function randomNumber(min2, max2) {
4896
+ return Math.random() * (max2 - min2) + min2;
4650
4897
  }
4651
4898
  var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
4652
- function randomString(size, chars = urlAlphabet) {
4899
+ function randomString(size2 = 10, chars = urlAlphabet) {
4653
4900
  let id = "";
4654
- let i = size;
4901
+ let i = size2;
4655
4902
  const len = chars.length;
4656
4903
  while (i--)
4657
4904
  id += chars[Math.random() * len | 0];
4658
4905
  return id;
4659
4906
  }
4660
4907
 
4908
+ // src/util/serialized.ts
4909
+ function formdataToObject(formData) {
4910
+ return Object.fromEntries(formData.entries());
4911
+ }
4912
+ function objectToFormdata(object) {
4913
+ const formdata = new FormData();
4914
+ for (const [key, value] of Object.entries(object))
4915
+ formdata.set(key, value);
4916
+ return formdata;
4917
+ }
4918
+ function nonnanable(value) {
4919
+ return Number.isNaN(Number(value)) ? void 0 : value;
4920
+ }
4921
+ function numberify(value) {
4922
+ return Number.isNaN(Number(value)) ? 0 : Number(value);
4923
+ }
4924
+ function stringify(value) {
4925
+ return String(value);
4926
+ }
4927
+ function numberish(value) {
4928
+ if (value === void 0 || value === null)
4929
+ return "0";
4930
+ if (Number.isNaN(Number(value)))
4931
+ return "0";
4932
+ return value.toString();
4933
+ }
4934
+
4661
4935
  // src/util/to.ts
4662
4936
  async function to(promise, error) {
4663
4937
  return (isFunction_default(promise) ? promise() : promise).then((data) => [null, data]).catch((err) => {
@@ -4670,27 +4944,41 @@
4670
4944
  }
4671
4945
 
4672
4946
  // src/util/to-array.ts
4673
- function toArray(value) {
4947
+ function toArray(value, required = false) {
4674
4948
  if (!value)
4675
- return void 0;
4949
+ return required === false ? void 0 : [];
4676
4950
  return Array.isArray(value) ? value : [value];
4677
4951
  }
4678
4952
 
4953
+ // src/util/unit.ts
4954
+ function unit(value, unit2 = "px") {
4955
+ if (!(isString_default(value) || isNumber_default(value)))
4956
+ return "";
4957
+ value = String(value);
4958
+ return /\D/.test(value) ? value : value + unit2;
4959
+ }
4960
+ var _unit = (value, _unit2) => unit(value, _unit2);
4961
+ function size(dimension, unit2) {
4962
+ const format = (value) => _unit(value, unit2);
4963
+ if (typeof dimension === "string" || typeof dimension === "number")
4964
+ return { width: format(dimension), height: format(dimension) };
4965
+ if (Array.isArray(dimension))
4966
+ return { width: format(dimension[0]), height: format(dimension[1]) };
4967
+ if (typeof dimension === "object")
4968
+ return { width: format(dimension.width), height: format(dimension.height) };
4969
+ return { width: "", height: "" };
4970
+ }
4971
+
4679
4972
  // src/util/util.ts
4680
- function arange(x1, x2, stp = 1, z = [], z0 = z.length) {
4681
- if (!x2)
4682
- x1 -= x2 = x1;
4683
- for (let z1 = z0 + Math.max(Math.ceil((++x2 - x1) / stp), 0); z0 < z1; x1 += stp)
4684
- z[z0++] = x1;
4685
- return z;
4686
- }
4687
- function riposte(...args) {
4973
+ var arange = range_default;
4974
+ function select(...args) {
4688
4975
  for (const [cond, value] of args) {
4689
4976
  if (cond)
4690
4977
  return value;
4691
4978
  }
4692
4979
  return void 0;
4693
4980
  }
4981
+ var riposte = select;
4694
4982
  function unwrap(value) {
4695
4983
  return typeof value === "function" ? value() : value;
4696
4984
  }
@@ -4826,24 +5114,6 @@
4826
5114
  return `${number}${config.n}`;
4827
5115
  }
4828
5116
 
4829
- // src/size/index.ts
4830
- function formatUnit(value, unit = "px") {
4831
- if (!(isString_default(value) || isNumber_default(value)))
4832
- return "";
4833
- value = String(value);
4834
- return /\D/.test(value) ? value : value + unit;
4835
- }
4836
- function formatSize(dimension, unit) {
4837
- const _formatUnit = (value) => formatUnit(value, unit);
4838
- if (typeof dimension === "string" || typeof dimension === "number")
4839
- return { width: _formatUnit(dimension), height: _formatUnit(dimension) };
4840
- if (Array.isArray(dimension))
4841
- return { width: _formatUnit(dimension[0]), height: _formatUnit(dimension[1]) };
4842
- if (typeof dimension === "object")
4843
- return { width: _formatUnit(dimension.width), height: _formatUnit(dimension.height) };
4844
- return { width: "", height: "" };
4845
- }
4846
-
4847
5117
  // src/string/index.ts
4848
5118
  function cover(value, mode, symbol = "*") {
4849
5119
  return value.slice(0, mode[0]) + symbol.repeat(mode[1]) + value.slice(-mode[2]);
@@ -4879,11 +5149,11 @@
4879
5149
  function unindent(str) {
4880
5150
  const lines = (typeof str === "string" ? str : str[0]).split("\n");
4881
5151
  const whitespaceLines = lines.map((line) => _reFullWs.test(line));
4882
- const commonIndent = lines.reduce((min, line, idx) => {
5152
+ const commonIndent = lines.reduce((min2, line, idx) => {
4883
5153
  if (whitespaceLines[idx])
4884
- return min;
5154
+ return min2;
4885
5155
  const indent = line.match(/^\s*/)?.[0].length;
4886
- return indent === void 0 ? min : Math.min(min, indent);
5156
+ return indent === void 0 ? min2 : Math.min(min2, indent);
4887
5157
  }, Number.POSITIVE_INFINITY);
4888
5158
  let emptyLinesHead = 0;
4889
5159
  while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])
@@ -4893,15 +5163,6 @@
4893
5163
  emptyLinesTail++;
4894
5164
  return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join("\n");
4895
5165
  }
4896
-
4897
- // src/typeof/index.ts
4898
- function getTypeof(target) {
4899
- const value = Object.prototype.toString.call(target).slice(8, -1).toLocaleLowerCase();
4900
- return value;
4901
- }
4902
- function isTypeof(target, type) {
4903
- return getTypeof(target) === type;
4904
- }
4905
5166
  })();
4906
5167
  /*! Bundled license information:
4907
5168