@yh-kit/utils 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/utils.js +356 -193
  2. package/dist/utils.umd.cjs +1 -1
  3. package/package.json +1 -1
  4. package/types/array/appear.d.ts +17 -0
  5. package/types/array/array2obj.d.ts +12 -0
  6. package/types/array/base.d.ts +2 -0
  7. package/types/array/exist.d.ts +17 -0
  8. package/types/array/extreme-value.d.ts +33 -0
  9. package/types/array/fisher-yates.d.ts +20 -0
  10. package/types/array/index.d.ts +31 -0
  11. package/types/array/orderby.d.ts +10 -0
  12. package/types/array/unique.d.ts +89 -0
  13. package/types/{utils/lib/url → url}/index.d.ts +5 -4
  14. package/types/typings/src/enum-obj.d.ts +0 -14
  15. package/types/typings/src/index.d.ts +0 -2
  16. package/types/typings/src/option.d.ts +0 -13
  17. package/types/utils/lib/array/array2obj.d.ts +0 -8
  18. package/types/utils/lib/array/index.d.ts +0 -83
  19. /package/types/{utils/lib/base64 → base64}/index.d.ts +0 -0
  20. /package/types/{utils/lib/boolean → boolean}/index.d.ts +0 -0
  21. /package/types/{utils/lib/common → common}/index.d.ts +0 -0
  22. /package/types/{utils/lib/cookie → cookie}/index.d.ts +0 -0
  23. /package/types/{utils/lib/date → date}/index.d.ts +0 -0
  24. /package/types/{utils/lib/document → document}/index.d.ts +0 -0
  25. /package/types/{utils/lib/download → download}/index.d.ts +0 -0
  26. /package/types/{utils/lib/echarts → echarts}/index.d.ts +0 -0
  27. /package/types/{utils/lib/index.d.ts → index.d.ts} +0 -0
  28. /package/types/{utils/lib/letter → letter}/index.d.ts +0 -0
  29. /package/types/{utils/lib/map → map}/index.d.ts +0 -0
  30. /package/types/{utils/lib/money → money}/index.d.ts +0 -0
  31. /package/types/{utils/lib/name → name}/index.d.ts +0 -0
  32. /package/types/{utils/lib/name → name}/typing.d.ts +0 -0
  33. /package/types/{utils/lib/number → number}/index.d.ts +0 -0
  34. /package/types/{utils/lib/number → number}/letter.d.ts +0 -0
  35. /package/types/{utils/lib/number → number}/money.d.ts +0 -0
  36. /package/types/{utils/lib/object → object}/index.d.ts +0 -0
  37. /package/types/{utils/lib/phone → phone}/index.d.ts +0 -0
  38. /package/types/{utils/lib/random → random}/index.d.ts +0 -0
  39. /package/types/{utils/lib/regexp → regexp}/index.d.ts +0 -0
  40. /package/types/{utils/lib/storage → storage}/index.d.ts +0 -0
  41. /package/types/{utils/lib/string → string}/index.d.ts +0 -0
  42. /package/types/{utils/lib/url → url}/query.d.ts +0 -0
  43. /package/types/{utils/lib/waterfall → waterfall}/index.d.ts +0 -0
package/dist/utils.js CHANGED
@@ -1,139 +1,302 @@
1
- const w = (e, n = "value") => {
2
- if (!e || !e.length) return {};
3
- const t = {};
4
- return e.forEach((r) => {
5
- const o = Object.assign({ label: r.label, text: r.label }, r);
6
- t[r[n]] = o;
7
- }), t;
8
- }, b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9
- __proto__: null,
10
- toEnumObj: w
11
- }, Symbol.toStringTag, { value: "Module" })), A = Object.assign(
12
- {
13
- /**
14
- * 数组去重
15
- * @param arr 数组
16
- * @returns 去重后的数组
17
- */
18
- unique(e) {
19
- return e ? Array.from(new Set(e)) : [];
20
- },
21
- /**
22
- * 判断某元素是否在数组中
23
- * @param arr 数组
24
- * @param element 查询元素
25
- * @returns 是否存在。true 存在;false 不存在
26
- */
27
- isExist(e, n) {
28
- return !e || !n ? !1 : e.indexOf(n) !== -1;
29
- },
30
- /**
31
- * 统计数组中某元素出现的次数:对于大型数组,手动循环的性能略优于 filter 和 reduce。
32
- * @param arr 数组
33
- * @param target 目标元素
34
- * @returns 出现次数
35
- */
36
- countOfAppear(e, n) {
37
- let t = 0;
38
- for (const r of e)
39
- r === n && t++;
40
- return t;
41
- },
42
- /**
43
- * 查找某个元素在数组中重复出现的位置
44
- * @param array 数组
45
- * @param element 元素
46
- * @returns 位置数组
47
- */
48
- indexsOfAppear(e, n) {
49
- let t = -1;
50
- const r = [];
51
- do
52
- t = e.indexOf(n, t + 1), t !== -1 && r.push(t);
53
- while (t !== -1);
54
- return r;
55
- },
56
- /**
57
- * 数组排序-默认升序
58
- * @param arr 数组
59
- * @param order 排序方式:asc 升序;desc 降序
60
- * @returns 排序后的数组
61
- */
62
- sort(e, n = "asc") {
63
- return e ? e.sort((t, r) => n === "asc" ? t > r ? 1 : -1 : t < r ? 1 : -1) : [];
64
- },
65
- /**
66
- * 数组乱序(洗牌算法)
67
- * 1. 从数组的最后一个元素开始,将其与随机位置的元素交换位置。
68
- * 2. 然后,从倒数第二个元素开始,将其与随机位置的元素交换位置。
69
- * 3. 以此类推,直到第一个元素。
70
- * 4. 这样,数组中的元素就会被随机打乱顺序。
71
- * 5. 注意,这个算法会改变原数组。如果不想改变原数组,可以先复制一份再进行操作。
72
- * 6. 时间复杂度:O(n)
73
- * @param arr 数组
74
- * @returns
75
- */
76
- shuffle(e) {
77
- if (!e)
78
- return [];
79
- for (let n = e.length - 1; n > 0; n--) {
80
- const t = Math.floor(Math.random() * (n + 1));
81
- [e[n], e[t]] = [e[t], e[n]];
82
- }
83
- return e;
84
- },
85
- /**
86
- * 获取数组中的最大值
87
- * @param arr 数组
88
- * @returns 最大值
89
- */
90
- getMaxValue(e) {
91
- return e ? Math.max(...e) : 0;
92
- },
93
- /**
94
- * 获取数组中的最小值
95
- * @param arr 数组
96
- * @returns 最小值
97
- */
98
- getMinValue(e) {
99
- return e ? Math.min(...e) : 0;
100
- },
101
- /**
102
- * 获取数组中的最小值和索引
103
- * @param array 数组
104
- * @returns 最小值和索引
105
- */
106
- getMinValueAndIndex(e) {
107
- if (e.length === 0) return { value: 0, index: 0 };
108
- const n = {
109
- /** 最小值 */
110
- value: e[0],
111
- /** 最小值索引 */
112
- index: 0
113
- };
114
- for (let t = 1, r = e.length; t < r; t++) {
115
- const o = e[t];
116
- n.value > o && (n.value = o, n.index = t);
117
- }
118
- return n;
119
- },
120
- /**
121
- * 获取数组中的最大值和索引
122
- * @param arr 数组
123
- * @returns 最大值和索引
124
- */
125
- getMaxValueAndIndex(e) {
126
- return e.length === 0 ? { value: 0, index: 0 } : e.reduce(
127
- (n, t, r) => t < n.value ? { value: t, index: r } : n,
128
- { value: e[0], index: 0 }
129
- );
1
+ const m = {
2
+ /**
3
+ * 统计数组中某元素出现的次数:对于大型数组,手动循环的性能略优于 filter 和 reduce。
4
+ * @param arr 数组
5
+ * @param target 目标元素
6
+ * @returns 出现次数
7
+ */
8
+ countOfAppear(e, n) {
9
+ let t = 0;
10
+ for (const r of e)
11
+ r === n && t++;
12
+ return t;
13
+ },
14
+ /**
15
+ * 查找某个元素在数组中重复出现的位置
16
+ * @param array 数组
17
+ * @param element 元素
18
+ * @returns 位置数组
19
+ */
20
+ indexsOfAppear(e, n) {
21
+ let t = -1;
22
+ const r = [];
23
+ do
24
+ t = e.indexOf(n, t + 1), t !== -1 && r.push(t);
25
+ while (t !== -1);
26
+ return r;
27
+ }
28
+ }, A = {
29
+ // toEnumObj: handleArrTansferEnumObj,
30
+ /**
31
+ * 数组转枚举对象
32
+ * @param arr 数组
33
+ * @param valueKey 值键名。不传,默认值为"value"。
34
+ * @returns 枚举对象。键为数组元素的valueKey值,值为数组元素。
35
+ */
36
+ toEnumObj(e, n = "value") {
37
+ if (!e || !e.length) return {};
38
+ const t = {};
39
+ return e.forEach((r) => {
40
+ const o = Object.assign({ label: r.label, text: r.label }, r);
41
+ t[r[n]] = o;
42
+ }), t;
43
+ }
44
+ }, b = {
45
+ /**
46
+ * 判断某元素是否在存在于数组中(indexOf方法)
47
+ * @param arr 数组
48
+ * @param element 查询元素
49
+ * @returns 是否存在。true 存在;false 不存在
50
+ */
51
+ isExistByIndexOf(e, n) {
52
+ return !e || !n ? !1 : e.indexOf(n) !== -1;
53
+ },
54
+ /**
55
+ * 判断某元素是否在存在于数组中(includes方法)
56
+ * @param arr 数组
57
+ * @param element 查询元素
58
+ * @returns 是否存在。true 存在;false 不存在
59
+ */
60
+ isExistByIncludes(e, n) {
61
+ return !e || !n ? !1 : e.includes(n);
62
+ }
63
+ }, S = {
64
+ /**
65
+ * 获取数组中的最大值
66
+ * @param arr 数组
67
+ * @returns 最大值
68
+ */
69
+ getMaxValue(e) {
70
+ return e ? Math.max(...e) : 0;
71
+ },
72
+ /**
73
+ * 获取数组中的最小值
74
+ * @param arr 数组
75
+ * @returns 最小值
76
+ */
77
+ getMinValue(e) {
78
+ return e ? Math.min(...e) : 0;
79
+ },
80
+ /**
81
+ * 获取数组中的最小值和索引
82
+ * @param array 数组
83
+ * @returns 最小值和索引
84
+ */
85
+ getMinValueAndIndex(e) {
86
+ if (e.length === 0) return { value: 0, index: 0 };
87
+ const n = {
88
+ /** 最小值 */
89
+ value: e[0],
90
+ /** 最小值索引 */
91
+ index: 0
92
+ };
93
+ for (let t = 1, r = e.length; t < r; t++) {
94
+ const o = e[t];
95
+ n.value > o && (n.value = o, n.index = t);
96
+ }
97
+ return n;
98
+ },
99
+ /**
100
+ * 获取数组中的最大值和索引
101
+ * @param arr 数组
102
+ * @returns 最大值和索引
103
+ */
104
+ getMaxValueAndIndex(e) {
105
+ return e.length === 0 ? { value: 0, index: 0 } : e.reduce(
106
+ (n, t, r) => t < n.value ? { value: t, index: r } : n,
107
+ { value: e[0], index: 0 }
108
+ );
109
+ }
110
+ }, M = {
111
+ /**
112
+ * 数组随机打乱-Fisher-Yates算法
113
+ * @param arr 数组
114
+ * @returns 随机打乱后的数组
115
+ *
116
+ * 注意,这个算法会改变原数组。如果不想改变原数组,可以先复制一份再进行操作。
117
+ * 时间复杂度:O(n)
118
+ * 空间复杂度:O(1)
119
+ */
120
+ shuffle(e) {
121
+ if (!e)
122
+ return [];
123
+ const n = [...e];
124
+ for (let t = n.length - 1; t > 0; t--) {
125
+ const r = Math.floor(Math.random() * (t + 1));
126
+ [n[t], n[r]] = [n[r], n[t]];
127
+ }
128
+ return n;
129
+ },
130
+ /**
131
+ * 数组随机抽样-Fisher-Yates算法前k次迭代,再取前k个元素
132
+ * @param arr 数组
133
+ * @param k 抽样次数
134
+ * @returns 抽样后的数组
135
+ */
136
+ sample(e, n) {
137
+ if (!e)
138
+ return [];
139
+ if (n <= 0 || n > e.length)
140
+ throw new Error("抽样次数必须在1次到数组长度之间");
141
+ const t = [...e];
142
+ for (let r = 0; r < n; r++) {
143
+ const o = Math.floor(Math.random() * (e.length - r));
144
+ [t[r], t[o]] = [t[o], t[r]];
130
145
  }
146
+ return t.slice(0, n);
147
+ }
148
+ }, E = {
149
+ /**
150
+ * 数组排序-默认升序
151
+ * @param arr 数组
152
+ * @param order 排序方式:asc 升序;desc 降序
153
+ * @returns 排序后的数组
154
+ */
155
+ sort(e, n = "asc") {
156
+ return e ? e.sort((t, r) => n === "asc" ? t > r ? 1 : -1 : t < r ? 1 : -1) : [];
157
+ }
158
+ }, x = {
159
+ /**
160
+ * 数组去重:针对简单类型数据s
161
+ * 性能 O(n)
162
+ * @param arr 数组
163
+ * @returns 去重后的数组
164
+ */
165
+ uniqueBySet(e) {
166
+ if (!e)
167
+ throw new Error("数组不能为空");
168
+ const n = e;
169
+ return Array.from(new Set(n));
170
+ },
171
+ /**
172
+ * 双重循环之 filter + indexOf 数组去重:
173
+ * 此方法不能去重 NaN 值,也不能去重对象类型数据。
174
+ * 性能 O(n²),每次 indexOf 都是 O(n) 操作
175
+ * @param arr 数组
176
+ * @returns 去重后的数组
177
+ */
178
+ uniqueByFilter(e) {
179
+ if (!e)
180
+ throw new Error("数组不能为空");
181
+ return e.filter((t, r, o) => r === o.indexOf(t));
182
+ },
183
+ /**
184
+ * 双重循环之 reduce + includes 数组去重:
185
+ * 适用于基本类型数据(string、number、boolean),能去重 NaN 值,但不能去重对象类型数据。
186
+ * 性能 O(n²),每次 includes 都是 O(n) 操作
187
+ * @param arr 数组
188
+ * @returns 去重后的数组
189
+ */
190
+ uniqueByReduce(e) {
191
+ if (!e)
192
+ throw new Error("数组不能为空");
193
+ return e.reduce((t, r) => (t.includes(r) || t.push(r), t), []);
131
194
  },
132
- {
133
- ...b
195
+ /**
196
+ * 双重循环之 forEach + includes 数组去重:
197
+ * 适用于基本类型数据(string、number、boolean),能去重 NaN 值,但不能去重对象类型数据。
198
+ * 性能 O(n²),每次 includes 都是 O(n) 操作
199
+ * @param arr 数组
200
+ * @returns 去重后的数组
201
+ */
202
+ uniqueByIncludes(e) {
203
+ if (!e)
204
+ throw new Error("数组不能为空");
205
+ const n = e, t = [];
206
+ return n.forEach((r) => {
207
+ t.includes(r) || t.push(r);
208
+ }), t;
209
+ },
210
+ /**
211
+ * 双重循环之 for + includes 数组去重:
212
+ * 适用于基本类型数据(string、number、boolean),能去重 NaN 值,但不能去重对象类型数据。
213
+ * 性能 O(n²),每次 includes 都是 O(n) 操作
214
+ * @param arr 数组
215
+ * @returns 去重后的数组
216
+ */
217
+ uniqueByFor(e) {
218
+ if (!e)
219
+ throw new Error("数组不能为空");
220
+ const n = e, t = [];
221
+ for (let r = 0; r < n.length; r++)
222
+ t.includes(n[r]) || t.push(n[r]);
223
+ return t;
224
+ },
225
+ /**
226
+ * Map + 根据指定键去重
227
+ * 适用类型 对象数组(通过指定键进行去重)
228
+ * 键值类型 支持 string、number、boolean、Symbol
229
+ * NaN 处理 ✅ 支持(Map 支持 NaN 作为键)
230
+ * 性能 O(n),Map 的 has 和 set 操作都是 O(1)
231
+ * @param arr 数组
232
+ * @param key 对象的键名
233
+ * @returns 去重后的数组
234
+ */
235
+ uniqueByKey(e, n) {
236
+ if (!e || !n)
237
+ throw new Error("数组不能为空或键名不能为空");
238
+ const t = e, r = /* @__PURE__ */ new Map();
239
+ return t.filter((o) => r.has(o[n]) ? !1 : (r.set(o[n], !0), !0));
240
+ },
241
+ /**
242
+ * 通用数组去重函数 - 根据选项自动选择去重策略
243
+ *
244
+ * @template T - 数组元素类型
245
+ * @param {T[]} _arr - 待去重的数组
246
+ * @param {TUniqueOptions<T>} [options={}] - 去重选项
247
+ * @param {(keyof T)[]} [options.keys] - 按指定键组合去重(适用于对象数组)
248
+ * @param {(a: T, b: T) => boolean} [options.compareFn] - 自定义比较函数
249
+ * @returns {T[]} 去重后的数组
250
+ *
251
+ * @example
252
+ * // 基本类型数组(默认使用 Set 去重)
253
+ * unique([1, 2, 2, 3, 1]); // [1, 2, 3]
254
+ *
255
+ * @example
256
+ * // 对象数组按多个键去重
257
+ * const users = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }, { id: 1, name: 'Alice' }];
258
+ * unique(users, { keys: ['id', 'name'] }); // [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]
259
+ *
260
+ * @example
261
+ * // 使用自定义比较函数
262
+ * unique(arr, { compareFn: (a, b) => a.x === b.x && a.y === b.y });
263
+ *
264
+ * @throws {Error} 当输入数组为空时抛出错误
265
+ */
266
+ unique(e, n = {}) {
267
+ const { keys: t, compareFn: r } = n;
268
+ if (!e)
269
+ throw new Error("数组不能为空");
270
+ const o = e;
271
+ if (!t && !r)
272
+ return this.uniqueBySet(o);
273
+ if (t) {
274
+ const s = /* @__PURE__ */ new Map();
275
+ return o.filter((c) => {
276
+ const l = t.map((i) => c[i]).join("|");
277
+ return s.has(l) ? !1 : (s.set(l, !0), !0);
278
+ });
279
+ }
280
+ if (r)
281
+ return o.filter((s, c, l) => c === l.findIndex((i) => r(s, i)));
134
282
  }
135
- );
136
- class _ {
283
+ }, B = {
284
+ // 数组转对象
285
+ ...A,
286
+ // 数组去重
287
+ ...x,
288
+ // 判断元素是否存在
289
+ ...b,
290
+ // 数组排序
291
+ ...E,
292
+ // 获取极值
293
+ ...S,
294
+ // 统计出现次数
295
+ ...m,
296
+ // 数组随机打乱-Fisher-Yates算法
297
+ ...M
298
+ };
299
+ class k {
137
300
  /** Base64 编码表 */
138
301
  static BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
139
302
  /**
@@ -287,7 +450,7 @@ class _ {
287
450
  return s;
288
451
  }
289
452
  }
290
- const S = {
453
+ const C = {
291
454
  /**
292
455
  * 检查是否为空字符串
293
456
  * @param str 要检查的字符串
@@ -431,7 +594,7 @@ const S = {
431
594
  isMobile() {
432
595
  return /Mobi|Android|iPhone/i.test(navigator.userAgent);
433
596
  }
434
- }, O = {
597
+ }, H = {
435
598
  /**
436
599
  * 获取变量的类型
437
600
  * @param val 任意变量
@@ -440,7 +603,7 @@ const S = {
440
603
  getType(e) {
441
604
  return Object.prototype.toString.call(e).replace(/\[object\s(\w+)\]/, "$1");
442
605
  }
443
- }, T = {
606
+ }, $ = {
444
607
  /**
445
608
  * 通过传入的name获取cookie的值
446
609
  * @param name cookie的name
@@ -470,7 +633,7 @@ const S = {
470
633
  deleteCookie(e) {
471
634
  this.setCookie(e, "", -1);
472
635
  }
473
- }, L = {
636
+ }, j = {
474
637
  /**
475
638
  * 获取当前时间字符串
476
639
  * @param locales 区域设置。如:'zh-CN','en-US',"chinese"。默认'zh-CN'。
@@ -518,7 +681,7 @@ const S = {
518
681
  r += 31;
519
682
  break;
520
683
  case 2:
521
- S.isLeapYear(e) ? r += 29 : r += 28;
684
+ C.isLeapYear(e) ? r += 29 : r += 28;
522
685
  break;
523
686
  default:
524
687
  r += 30;
@@ -543,10 +706,10 @@ const S = {
543
706
  else {
544
707
  const g = /* @__PURE__ */ new Date();
545
708
  g.setDate(g.getDate() - 1);
546
- const m = /* @__PURE__ */ new Date();
547
- if (m.setDate(m.getDate() - 2), i === g.getMonth() + 1 && h === g.getDate())
709
+ const w = /* @__PURE__ */ new Date();
710
+ if (w.setDate(w.getDate() - 2), i === g.getMonth() + 1 && h === g.getDate())
548
711
  a = "昨天" + u;
549
- else if (i === m.getMonth() + 1 && h === m.getDate())
712
+ else if (i === w.getMonth() + 1 && h === w.getDate())
550
713
  a = "前天" + u;
551
714
  else if (f / 36e5 <= 7 * 24) {
552
715
  const y = new Array(7);
@@ -585,7 +748,7 @@ const S = {
585
748
  new RegExp("(" + r + ")").test(n) && (n = n.replace(RegExp.$1, RegExp.$1.length === 1 ? t[r] : ("00" + t[r]).substr(("" + t[r]).length)));
586
749
  return n;
587
750
  }
588
- }, I = {
751
+ }, F = {
589
752
  /**
590
753
  * 获取元素相对于文档顶部的偏移量(距离)
591
754
  * 处理了SVG元素的特殊情况。
@@ -656,7 +819,7 @@ const S = {
656
819
  getViewportHeight() {
657
820
  return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
658
821
  }
659
- }, k = {
822
+ }, N = {
660
823
  /**
661
824
  * 将blob对象转化成文件并导出到本地
662
825
  * @param blob blob对象
@@ -675,7 +838,7 @@ const S = {
675
838
  const t = document.createElement("a");
676
839
  t.href = e, t.download = n, document.body.appendChild(t), t.click(), URL.revokeObjectURL(e), document.body.removeChild(t);
677
840
  }
678
- }, j = {
841
+ }, P = {
679
842
  /**
680
843
  * echarts动画函数
681
844
  * @param option echarts配置
@@ -707,7 +870,7 @@ const S = {
707
870
  });
708
871
  });
709
872
  }
710
- }, H = {
873
+ }, q = {
711
874
  /**
712
875
  * 将选中的字母数组从A-Z排序:用于试题选择答案的排序实例
713
876
  * @param arr 字母数组
@@ -719,7 +882,7 @@ const S = {
719
882
  return o < s ? -1 : o > s ? 1 : 0;
720
883
  }) : void 0;
721
884
  }
722
- }, $ = {
885
+ }, V = {
723
886
  /**
724
887
  * 角度(度数)转弧度
725
888
  * 在数学和编程里,角度有两种常用单位,分别是度(°)和弧度(rad)。
@@ -805,7 +968,7 @@ const S = {
805
968
  return { segments: r, total: o };
806
969
  }
807
970
  };
808
- class N {
971
+ class W {
809
972
  /**
810
973
  * 转换为标准金额格式(带千分位和两位小数)
811
974
  * @param num 要转换的数字
@@ -860,7 +1023,7 @@ class N {
860
1023
  }
861
1024
  }
862
1025
  }
863
- const P = {
1026
+ const Y = {
864
1027
  /**
865
1028
  * 中文姓名脱敏
866
1029
  * @param name 姓名
@@ -903,15 +1066,15 @@ const P = {
903
1066
  }
904
1067
  return `${e.slice(0, c)}${"*".repeat(e.length - c)}`;
905
1068
  }
906
- }, M = (e) => e > 25 || e < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e], x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1069
+ }, D = (e) => e > 25 || e < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e], R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
907
1070
  __proto__: null,
908
- toLetter: M
909
- }, Symbol.toStringTag, { value: "Module" })), E = (e) => e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1071
+ toLetter: D
1072
+ }, Symbol.toStringTag, { value: "Module" })), U = (e) => e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
910
1073
  __proto__: null,
911
- toMoney: E
912
- }, Symbol.toStringTag, { value: "Module" })), F = {
913
- ...x,
914
- ...C,
1074
+ toMoney: U
1075
+ }, Symbol.toStringTag, { value: "Module" })), z = {
1076
+ ...R,
1077
+ ...v,
915
1078
  /**
916
1079
  * 判断是否为数字
917
1080
  * @param val 待判断的值
@@ -920,7 +1083,7 @@ const P = {
920
1083
  isNumber(e) {
921
1084
  return typeof e == "number" && !isNaN(e);
922
1085
  }
923
- }, V = {
1086
+ }, Z = {
924
1087
  /**
925
1088
  * 判断对象是否为空
926
1089
  * @param obj 对象
@@ -951,7 +1114,7 @@ const P = {
951
1114
  r instanceof Object ? (n[t] = {}, this.deepCopy(r, n[t])) : r instanceof Array ? (n[t] = [], this.deepCopy(r, n[t])) : n[t] = e[t];
952
1115
  }
953
1116
  }
954
- }, W = {
1117
+ }, J = {
955
1118
  /**
956
1119
  * 脱敏
957
1120
  * @param phone 电话号码/手机号码
@@ -960,7 +1123,7 @@ const P = {
960
1123
  desensitize(e) {
961
1124
  return e ? e.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2") || e.slice(0, 3) + "****" + e.slice(7) : "";
962
1125
  }
963
- }, Y = {
1126
+ }, X = {
964
1127
  /**
965
1128
  * 生成随机颜色
966
1129
  * @returns 随机颜色值
@@ -984,7 +1147,7 @@ const P = {
984
1147
  uniqueId() {
985
1148
  return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
986
1149
  }
987
- }, z = {
1150
+ }, G = {
988
1151
  /**
989
1152
  * 验证手机号
990
1153
  */
@@ -1021,7 +1184,7 @@ const P = {
1021
1184
  * 验证0.01~0.99正则:最多两位小数。0.1、0.10、0.9、0.90
1022
1185
  */
1023
1186
  decimal: /^0\.(0[1-9]|[1-9][0-9]*)$/
1024
- }, q = {
1187
+ }, K = {
1025
1188
  /**
1026
1189
  * 通过key值获取 localStorage 中存储的某个值
1027
1190
  * @param key 获取的key
@@ -1068,7 +1231,7 @@ const P = {
1068
1231
  removeSession(e) {
1069
1232
  sessionStorage.removeItem(e);
1070
1233
  }
1071
- }, Z = {
1234
+ }, Q = {
1072
1235
  /**
1073
1236
  * 判断某元素是否在字符串中-比includes()方法更兼容,includes为ES6新增方法,IE不支持。小程序也不支持
1074
1237
  * @param str 字符串
@@ -1151,19 +1314,19 @@ const P = {
1151
1314
  throw new Error("开始位置小于0或结束位置超出字符串长度或开始位置大于结束位置");
1152
1315
  return e.slice(0, n) + "*".repeat(t - n + 1) + e.slice(t);
1153
1316
  }
1154
- }, B = (e) => {
1155
- const t = new RegExp("[?&]" + e + "=([^&#]*)", "i").exec(window.location.href);
1317
+ }, O = (e) => {
1318
+ const t = new RegExp("[?&]" + e + "=([^&#]*)", "gi").exec(window.location.href);
1156
1319
  return t ? decodeURIComponent(t[1]) : null;
1157
1320
  };
1158
- function D(e) {
1321
+ function L(e) {
1159
1322
  return new URLSearchParams(window.location.search).get(e);
1160
1323
  }
1161
- const R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1324
+ const T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1162
1325
  __proto__: null,
1163
- getQueryInfoByName: B,
1164
- getQueryParam: D
1165
- }, Symbol.toStringTag, { value: "Module" })), J = {
1166
- ...R,
1326
+ getQueryInfoByName: O,
1327
+ getQueryParam: L
1328
+ }, Symbol.toStringTag, { value: "Module" })), ee = {
1329
+ ...T,
1167
1330
  /**
1168
1331
  * 获取当前域名
1169
1332
  * @returns 当前url链接的host信息
@@ -1178,7 +1341,7 @@ const R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1178
1341
  getPath() {
1179
1342
  return window.location.pathname;
1180
1343
  }
1181
- }, X = {
1344
+ }, te = {
1182
1345
  /**
1183
1346
  * 处理瀑布流数据,使其竖向瀑布流布局呈现横向瀑布流的展现形式。适用于 column-gap: 20rpx; column-count: 2; 布局的瀑布流
1184
1347
  * @param list 瀑布流数据-数组
@@ -1209,33 +1372,33 @@ const R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1209
1372
  if (i < s)
1210
1373
  a.style.left = (o + c) * i + "px", l[i] = a.offsetHeight;
1211
1374
  else {
1212
- const { index: u, value: d } = A.getMinValueAndIndex(l);
1375
+ const { index: u, value: d } = B.getMinValueAndIndex(l);
1213
1376
  a.style.left = (o + c) * u + "px", a.style.top = d + t + "px", l[u] = a.offsetHeight + t + d;
1214
1377
  }
1215
1378
  }
1216
1379
  }
1217
1380
  };
1218
1381
  export {
1219
- _ as Base64Utils,
1220
- N as MoneyFormatter,
1221
- A as arrayUtils,
1222
- S as booleanUtils,
1223
- O as commonUtils,
1224
- T as cookieUtils,
1225
- L as dateUtils,
1226
- I as documentUtils,
1227
- k as downloadUtils,
1228
- j as echartsUtils,
1229
- H as letterUtils,
1230
- $ as mapUtils,
1231
- P as nameUtils,
1232
- F as numberUtils,
1233
- V as objectUtils,
1234
- W as phoneUtils,
1235
- Y as randomUtils,
1236
- z as regexpUtils,
1237
- q as storageUtils,
1238
- Z as stringUtils,
1239
- J as urlUtils,
1240
- X as waterfallUtils
1382
+ k as Base64Utils,
1383
+ W as MoneyFormatter,
1384
+ B as arrayUtils,
1385
+ C as booleanUtils,
1386
+ H as commonUtils,
1387
+ $ as cookieUtils,
1388
+ j as dateUtils,
1389
+ F as documentUtils,
1390
+ N as downloadUtils,
1391
+ P as echartsUtils,
1392
+ q as letterUtils,
1393
+ V as mapUtils,
1394
+ Y as nameUtils,
1395
+ z as numberUtils,
1396
+ Z as objectUtils,
1397
+ J as phoneUtils,
1398
+ X as randomUtils,
1399
+ G as regexpUtils,
1400
+ K as storageUtils,
1401
+ Q as stringUtils,
1402
+ ee as urlUtils,
1403
+ te as waterfallUtils
1241
1404
  };