@yh-kit/utils 1.9.0 → 1.11.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.
package/dist/utils.js CHANGED
@@ -1,22 +1,22 @@
1
- const y = (t) => {
2
- if (!t || !t.length) return {};
1
+ const w = (e) => {
2
+ if (!e || !e.length) return {};
3
3
  const n = {};
4
- return t.forEach((e) => {
5
- const r = Object.assign({ label: e.label, text: e.label }, e);
6
- n[e?.value] = r;
4
+ return e.forEach((t) => {
5
+ const r = Object.assign({ label: t.label, text: t.label }, t);
6
+ n[t?.value] = r;
7
7
  }), n;
8
- }, m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8
+ }, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9
9
  __proto__: null,
10
- toEnumObj: y
11
- }, Symbol.toStringTag, { value: "Module" })), w = Object.assign(
10
+ toEnumObj: w
11
+ }, Symbol.toStringTag, { value: "Module" })), b = Object.assign(
12
12
  {
13
13
  /**
14
14
  * 数组去重
15
15
  * @param arr 数组
16
16
  * @returns 去重后的数组
17
17
  */
18
- unique(t) {
19
- return t ? Array.from(new Set(t)) : [];
18
+ unique(e) {
19
+ return e ? Array.from(new Set(e)) : [];
20
20
  },
21
21
  /**
22
22
  * 判断某元素是否在数组中
@@ -24,8 +24,8 @@ const y = (t) => {
24
24
  * @param element 查询元素
25
25
  * @returns 是否存在。true 存在;false 不存在
26
26
  */
27
- isExist(t, n) {
28
- return !t || !n ? !1 : t.indexOf(n) !== -1;
27
+ isExist(e, n) {
28
+ return !e || !n ? !1 : e.indexOf(n) !== -1;
29
29
  },
30
30
  /**
31
31
  * 统计数组中某元素出现的次数:对于大型数组,手动循环的性能略优于 filter 和 reduce。
@@ -33,11 +33,11 @@ const y = (t) => {
33
33
  * @param target 目标元素
34
34
  * @returns 出现次数
35
35
  */
36
- countOfAppear(t, n) {
37
- let e = 0;
38
- for (const r of t)
39
- r === n && e++;
40
- return e;
36
+ countOfAppear(e, n) {
37
+ let t = 0;
38
+ for (const r of e)
39
+ r === n && t++;
40
+ return t;
41
41
  },
42
42
  /**
43
43
  * 查找某个元素在数组中重复出现的位置
@@ -45,12 +45,12 @@ const y = (t) => {
45
45
  * @param element 元素
46
46
  * @returns 位置数组
47
47
  */
48
- indexsOfAppear(t, n) {
49
- let e = -1;
48
+ indexsOfAppear(e, n) {
49
+ let t = -1;
50
50
  const r = [];
51
51
  do
52
- e = t.indexOf(n, e + 1), e !== -1 && r.push(e);
53
- while (e !== -1);
52
+ t = e.indexOf(n, t + 1), t !== -1 && r.push(t);
53
+ while (t !== -1);
54
54
  return r;
55
55
  },
56
56
  /**
@@ -59,8 +59,8 @@ const y = (t) => {
59
59
  * @param order 排序方式:asc 升序;desc 降序
60
60
  * @returns 排序后的数组
61
61
  */
62
- sort(t, n = "asc") {
63
- return t ? t.sort((e, r) => n === "asc" ? e > r ? 1 : -1 : e < r ? 1 : -1) : [];
62
+ sort(e, n = "asc") {
63
+ return e ? e.sort((t, r) => n === "asc" ? t > r ? 1 : -1 : t < r ? 1 : -1) : [];
64
64
  },
65
65
  /**
66
66
  * 数组乱序(洗牌算法)
@@ -73,47 +73,47 @@ const y = (t) => {
73
73
  * @param arr 数组
74
74
  * @returns
75
75
  */
76
- shuffle(t) {
77
- if (!t)
76
+ shuffle(e) {
77
+ if (!e)
78
78
  return [];
79
- for (let n = t.length - 1; n > 0; n--) {
80
- const e = Math.floor(Math.random() * (n + 1));
81
- [t[n], t[e]] = [t[e], t[n]];
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
82
  }
83
- return t;
83
+ return e;
84
84
  },
85
85
  /**
86
86
  * 获取数组中的最大值
87
87
  * @param arr 数组
88
88
  * @returns 最大值
89
89
  */
90
- getMaxValue(t) {
91
- return t ? Math.max(...t) : 0;
90
+ getMaxValue(e) {
91
+ return e ? Math.max(...e) : 0;
92
92
  },
93
93
  /**
94
94
  * 获取数组中的最小值
95
95
  * @param arr 数组
96
96
  * @returns 最小值
97
97
  */
98
- getMinValue(t) {
99
- return t ? Math.min(...t) : 0;
98
+ getMinValue(e) {
99
+ return e ? Math.min(...e) : 0;
100
100
  },
101
101
  /**
102
102
  * 获取数组中的最小值和索引
103
103
  * @param array 数组
104
104
  * @returns 最小值和索引
105
105
  */
106
- getMinValueAndIndex(t) {
107
- if (t.length === 0) return { value: 0, index: 0 };
106
+ getMinValueAndIndex(e) {
107
+ if (e.length === 0) return { value: 0, index: 0 };
108
108
  const n = {
109
109
  /** 最小值 */
110
- value: t[0],
110
+ value: e[0],
111
111
  /** 最小值索引 */
112
112
  index: 0
113
113
  };
114
- for (let e = 1, r = t.length; e < r; e++) {
115
- const o = t[e];
116
- n.value > o && (n.value = o, n.index = e);
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
117
  }
118
118
  return n;
119
119
  },
@@ -122,18 +122,18 @@ const y = (t) => {
122
122
  * @param arr 数组
123
123
  * @returns 最大值和索引
124
124
  */
125
- getMaxValueAndIndex(t) {
126
- return t.length === 0 ? { value: 0, index: 0 } : t.reduce(
127
- (n, e, r) => e < n.value ? { value: e, index: r } : n,
128
- { value: t[0], index: 0 }
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
129
  );
130
130
  }
131
131
  },
132
132
  {
133
- ...m
133
+ ...A
134
134
  }
135
135
  );
136
- class _ {
136
+ class T {
137
137
  /** Base64 编码表 */
138
138
  static BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
139
139
  /**
@@ -145,18 +145,18 @@ class _ {
145
145
  * @param sliceSize 可选参数,表示分片大小,默认为512字节。用于控制每次处理的Base64字符串长度,以优化大文件的处理。
146
146
  * @returns 返回转换后的Blob对象,如果转换失败,则返回null。
147
147
  */
148
- static toBlob(n, e = "", r = 512) {
149
- const s = (n.split(",")[1] || n).replace(/-/g, "+").replace(/_/g, "/"), c = "=".repeat((4 - s.length % 4) % 4), l = s + c;
148
+ static toBlob(n, t = "", r = 512) {
149
+ const s = (n.split(",")[1] || n).replace(/-/g, "+").replace(/_/g, "/"), a = "=".repeat((4 - s.length % 4) % 4), u = s + a;
150
150
  try {
151
- const i = atob(l), d = [];
152
- for (let a = 0; a < i.length; a += r) {
153
- const u = i.slice(a, a + r), h = new Array(u.length);
154
- for (let f = 0; f < u.length; f++)
155
- h[f] = u.charCodeAt(f);
156
- const g = new Uint8Array(h);
157
- d.push(g);
151
+ const i = atob(u), d = [];
152
+ for (let c = 0; c < i.length; c += r) {
153
+ const l = i.slice(c, c + r), h = new Array(l.length);
154
+ for (let f = 0; f < l.length; f++)
155
+ h[f] = l.charCodeAt(f);
156
+ const p = new Uint8Array(h);
157
+ d.push(p);
158
158
  }
159
- return new Blob(d, { type: e });
159
+ return new Blob(d, { type: t });
160
160
  } catch (i) {
161
161
  return console.error("Failed to convert base64 to blob:", i), null;
162
162
  }
@@ -171,16 +171,16 @@ class _ {
171
171
  * @param mimeType MIME类型,默认为"text/plain"。
172
172
  * @returns 返回一个File对象,包含解码后的数据。
173
173
  */
174
- static toFile(n, e = "file.txt", r = "text/plain") {
175
- const s = n.replace(/^data:.+;base64,/, "").replace(/-/g, "+").replace(/_/g, "/"), c = "=".repeat((4 - s.length % 4) % 4), l = s + c, i = atob(l), d = [];
176
- for (let u = 0; u < i.length; u += 512) {
177
- const h = i.slice(u, u + 512), g = new Array(h.length);
174
+ static toFile(n, t = "file.txt", r = "text/plain") {
175
+ const s = n.replace(/^data:.+;base64,/, "").replace(/-/g, "+").replace(/_/g, "/"), a = "=".repeat((4 - s.length % 4) % 4), u = s + a, i = atob(u), d = [];
176
+ for (let l = 0; l < i.length; l += 512) {
177
+ const h = i.slice(l, l + 512), p = new Array(h.length);
178
178
  for (let f = 0; f < h.length; f++)
179
- g[f] = h.charCodeAt(f);
180
- d.push(new Uint8Array(g));
179
+ p[f] = h.charCodeAt(f);
180
+ d.push(new Uint8Array(p));
181
181
  }
182
- const a = new Blob(d, { type: r });
183
- return new File([a], e, { type: r });
182
+ const c = new Blob(d, { type: r });
183
+ return new File([c], t, { type: r });
184
184
  }
185
185
  /**
186
186
  * base64加密 -- 普通字符串转 Base64 编码
@@ -189,8 +189,8 @@ class _ {
189
189
  */
190
190
  static encode(n) {
191
191
  if (!n) return "";
192
- const e = this._stringToUtf8Bytes(n);
193
- return this._bytesToBase64(e);
192
+ const t = this._stringToUtf8Bytes(n);
193
+ return this._bytesToBase64(t);
194
194
  }
195
195
  /**
196
196
  * base64解密 -- Base64 编码转普通字符串
@@ -200,149 +200,149 @@ class _ {
200
200
  static decode(n) {
201
201
  if (!n) return "";
202
202
  n = n.replace(/\s/g, "");
203
- const e = this._base64ToBytes(n);
204
- return this._utf8BytesToString(e);
203
+ const t = this._base64ToBytes(n);
204
+ return this._utf8BytesToString(t);
205
205
  }
206
206
  /**
207
207
  * 字符串转 UTF-8 字节数组
208
208
  */
209
209
  static _stringToUtf8Bytes(n) {
210
- const e = [];
210
+ const t = [];
211
211
  for (let r = 0; r < n.length; r++) {
212
212
  let o = n.charCodeAt(r);
213
213
  if (o < 128)
214
- e.push(o);
214
+ t.push(o);
215
215
  else if (o < 2048)
216
- e.push(192 | o >> 6), e.push(128 | o & 63);
216
+ t.push(192 | o >> 6), t.push(128 | o & 63);
217
217
  else if (o < 55296 || o >= 57344)
218
- e.push(224 | o >> 12), e.push(128 | o >> 6 & 63), e.push(128 | o & 63);
218
+ t.push(224 | o >> 12), t.push(128 | o >> 6 & 63), t.push(128 | o & 63);
219
219
  else {
220
220
  r++;
221
- const s = o, c = n.charCodeAt(r);
222
- if (isNaN(c))
221
+ const s = o, a = n.charCodeAt(r);
222
+ if (isNaN(a))
223
223
  throw new Error("代理对不完整");
224
- o = 65536 + ((s & 1023) << 10) + (c & 1023), e.push(240 | o >> 18), e.push(128 | o >> 12 & 63), e.push(128 | o >> 6 & 63), e.push(128 | o & 63);
224
+ o = 65536 + ((s & 1023) << 10) + (a & 1023), t.push(240 | o >> 18), t.push(128 | o >> 12 & 63), t.push(128 | o >> 6 & 63), t.push(128 | o & 63);
225
225
  }
226
226
  }
227
- return e;
227
+ return t;
228
228
  }
229
229
  /**
230
230
  * UTF-8 字节数组转字符串
231
231
  */
232
232
  static _utf8BytesToString(n) {
233
- let e = "", r = 0;
233
+ let t = "", r = 0;
234
234
  for (; r < n.length; ) {
235
235
  const o = n[r++];
236
236
  if (o < 128)
237
- e += String.fromCharCode(o);
237
+ t += String.fromCharCode(o);
238
238
  else if (o >= 192 && o < 224) {
239
239
  const s = n[r++] & 63;
240
- e += String.fromCharCode((o & 31) << 6 | s);
240
+ t += String.fromCharCode((o & 31) << 6 | s);
241
241
  } else if (o >= 224 && o < 240) {
242
- const s = n[r++] & 63, c = n[r++] & 63;
243
- e += String.fromCharCode((o & 15) << 12 | s << 6 | c);
242
+ const s = n[r++] & 63, a = n[r++] & 63;
243
+ t += String.fromCharCode((o & 15) << 12 | s << 6 | a);
244
244
  } else if (o >= 240 && o < 248) {
245
- const s = n[r++] & 63, c = n[r++] & 63, l = n[r++] & 63, i = (o & 7) << 18 | s << 12 | c << 6 | l, d = Math.floor((i - 65536) / 1024) + 55296, a = (i - 65536) % 1024 + 56320;
246
- e += String.fromCharCode(d, a);
245
+ const s = n[r++] & 63, a = n[r++] & 63, u = n[r++] & 63, i = (o & 7) << 18 | s << 12 | a << 6 | u, d = Math.floor((i - 65536) / 1024) + 55296, c = (i - 65536) % 1024 + 56320;
246
+ t += String.fromCharCode(d, c);
247
247
  } else
248
- e += "�";
248
+ t += "�";
249
249
  }
250
- return e;
250
+ return t;
251
251
  }
252
252
  /**
253
253
  * 字节数组转 Base64 编码
254
254
  */
255
255
  static _bytesToBase64(n) {
256
- let e = "", r = 0;
256
+ let t = "", r = 0;
257
257
  for (; r < n.length; ) {
258
- const o = n[r++], s = r < n.length, c = s ? n[r++] : 0, l = r < n.length, i = l ? n[r++] : 0, d = o >> 2, a = (o & 3) << 4 | c >> 4, u = (c & 15) << 2 | i >> 6, h = i & 63;
259
- s ? l ? e += this.BASE64_CHARS.charAt(d) + this.BASE64_CHARS.charAt(a) + this.BASE64_CHARS.charAt(u) + this.BASE64_CHARS.charAt(h) : e += this.BASE64_CHARS.charAt(d) + this.BASE64_CHARS.charAt(a) + this.BASE64_CHARS.charAt(u) + "=" : e += this.BASE64_CHARS.charAt(d) + this.BASE64_CHARS.charAt(a) + "==";
258
+ const o = n[r++], s = r < n.length, a = s ? n[r++] : 0, u = r < n.length, i = u ? n[r++] : 0, d = o >> 2, c = (o & 3) << 4 | a >> 4, l = (a & 15) << 2 | i >> 6, h = i & 63;
259
+ s ? u ? t += this.BASE64_CHARS.charAt(d) + this.BASE64_CHARS.charAt(c) + this.BASE64_CHARS.charAt(l) + this.BASE64_CHARS.charAt(h) : t += this.BASE64_CHARS.charAt(d) + this.BASE64_CHARS.charAt(c) + this.BASE64_CHARS.charAt(l) + "=" : t += this.BASE64_CHARS.charAt(d) + this.BASE64_CHARS.charAt(c) + "==";
260
260
  }
261
- return e;
261
+ return t;
262
262
  }
263
263
  /**
264
264
  * Base64 编码转字节数组
265
265
  */
266
266
  static _base64ToBytes(n) {
267
- const e = n.length;
267
+ const t = n.length;
268
268
  let r = 0;
269
- e >= 2 && (n[e - 1] === "=" && r++, n[e - 2] === "=" && r++);
270
- const o = Math.floor(e * 3 / 4) - r, s = new Array(o), c = new Array(256).fill(-1);
269
+ t >= 2 && (n[t - 1] === "=" && r++, n[t - 2] === "=" && r++);
270
+ const o = Math.floor(t * 3 / 4) - r, s = new Array(o), a = new Array(256).fill(-1);
271
271
  for (let d = 0; d < this.BASE64_CHARS.length; d++)
272
- c[this.BASE64_CHARS.charCodeAt(d)] = d;
273
- let l = 0, i = 0;
274
- for (; i < e; ) {
275
- const d = c[n.charCodeAt(i++)], a = c[n.charCodeAt(i++)], u = i < e ? c[n.charCodeAt(i++)] : -1, h = i < e ? c[n.charCodeAt(i++)] : -1;
276
- if (d === -1 || a === -1)
272
+ a[this.BASE64_CHARS.charCodeAt(d)] = d;
273
+ let u = 0, i = 0;
274
+ for (; i < t; ) {
275
+ const d = a[n.charCodeAt(i++)], c = a[n.charCodeAt(i++)], l = i < t ? a[n.charCodeAt(i++)] : -1, h = i < t ? a[n.charCodeAt(i++)] : -1;
276
+ if (d === -1 || c === -1)
277
277
  throw new Error("无效的 Base64 字符");
278
- const g = d << 2 | a >> 4;
279
- if (s[l++] = g, u !== -1) {
280
- const f = (a & 15) << 4 | u >> 2;
281
- if (s[l++] = f, h !== -1) {
282
- const p = (u & 3) << 6 | h;
283
- s[l++] = p;
278
+ const p = d << 2 | c >> 4;
279
+ if (s[u++] = p, l !== -1) {
280
+ const f = (c & 15) << 4 | l >> 2;
281
+ if (s[u++] = f, h !== -1) {
282
+ const g = (l & 3) << 6 | h;
283
+ s[u++] = g;
284
284
  }
285
285
  }
286
286
  }
287
287
  return s;
288
288
  }
289
289
  }
290
- const b = {
290
+ const S = {
291
291
  /**
292
292
  * 检查是否为空字符串
293
293
  * @param str 要检查的字符串
294
294
  * @returns 如果字符串为空,则返回 true,否则返回 false
295
295
  */
296
- isEmptyString(t) {
297
- return typeof t == "string" && t.trim() === "";
296
+ isEmptyString(e) {
297
+ return typeof e == "string" && e.trim() === "";
298
298
  },
299
299
  /**
300
300
  * 判断是否为数字
301
301
  * @param val 要检查的值
302
302
  * @returns 如果值是数字,则返回 true,否则返回 false
303
303
  */
304
- isNumber(t) {
305
- return typeof t == "number" && !isNaN(t);
304
+ isNumber(e) {
305
+ return typeof e == "number" && !isNaN(e);
306
306
  },
307
307
  /**
308
308
  * 判断是否为对象
309
309
  * @param val 要检查的值
310
310
  * @returns 如果值是对象,则返回 true,否则返回 false
311
311
  */
312
- isObject(t) {
313
- return t !== null && typeof t == "object" && !Array.isArray(t);
312
+ isObject(e) {
313
+ return e !== null && typeof e == "object" && !Array.isArray(e);
314
314
  },
315
315
  /**
316
316
  * 判断对象是否为空
317
317
  * @param obj 要检查的对象
318
318
  * @returns 如果对象为空,则返回 true,否则返回 false
319
319
  */
320
- isEmptyObject(t) {
321
- return t ? Object.keys(t).length === 0 && t.constructor === Object : !0;
320
+ isEmptyObject(e) {
321
+ return e ? Object.keys(e).length === 0 && e.constructor === Object : !0;
322
322
  },
323
323
  /**
324
324
  * 判断是否为布尔值
325
325
  * @param val 要检查的值
326
326
  * @returns 如果值是布尔值,则返回 true,否则返回 false
327
327
  */
328
- isBoolean(t) {
329
- return typeof t == "boolean";
328
+ isBoolean(e) {
329
+ return typeof e == "boolean";
330
330
  },
331
331
  /**
332
332
  * 判断是否为数组
333
333
  * @param val 要检查的值
334
334
  * @returns 如果值是数组,则返回 true,否则返回 false
335
335
  */
336
- isArray(t) {
337
- return Array.isArray(t);
336
+ isArray(e) {
337
+ return Array.isArray(e);
338
338
  },
339
339
  /**
340
340
  * 判断是否为函数
341
341
  * @param val 要检查的值
342
342
  * @returns
343
343
  */
344
- isFunction(t) {
345
- return typeof t == "function";
344
+ isFunction(e) {
345
+ return typeof e == "function";
346
346
  },
347
347
  /**
348
348
  * 判断是否为 Promise 对象
@@ -350,41 +350,41 @@ const b = {
350
350
  * @returns 如果对象是 Promise 对象,则返回 true,否则返回 false
351
351
  */
352
352
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
353
- isPromise(t) {
354
- return !!t && (typeof t == "object" || typeof t == "function") && typeof t.then == "function";
353
+ isPromise(e) {
354
+ return !!e && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
355
355
  },
356
356
  /**
357
357
  * 判断是否为 DOM 元素
358
358
  * @param obj 要检查的对象
359
359
  * @returns 如果对象是 DOM 元素,则返回 true,否则返回 false
360
360
  */
361
- isElement(t) {
362
- return t instanceof Element;
361
+ isElement(e) {
362
+ return e instanceof Element;
363
363
  },
364
364
  /**
365
365
  * 判断手机号格式(中国)
366
366
  * @param str 手机号字符串
367
367
  * @returns true 表示手机号格式正确,false 表示手机号格式错误
368
368
  */
369
- isPhone(t) {
370
- return /^1[3-9]\d{9}$/.test(t);
369
+ isPhone(e) {
370
+ return /^1[3-9]\d{9}$/.test(e);
371
371
  },
372
372
  /**
373
373
  * 判断邮箱格式
374
374
  * @param str 邮箱字符串
375
375
  * @returns true 表示邮箱格式正确,false 表示邮箱格式错误
376
376
  */
377
- isEmail(t) {
378
- return /^[\w.-]+@[\w.-]+\.\w+$/.test(t);
377
+ isEmail(e) {
378
+ return /^[\w.-]+@[\w.-]+\.\w+$/.test(e);
379
379
  },
380
380
  /**
381
381
  * 判断字符串是否为 JSON
382
382
  * @param str 字符串
383
383
  * @returns true 表示是 JSON,false 表示不是 JSON
384
384
  */
385
- isJSON(t) {
385
+ isJSON(e) {
386
386
  try {
387
- return JSON.parse(t), !0;
387
+ return JSON.parse(e), !0;
388
388
  } catch {
389
389
  return !1;
390
390
  }
@@ -397,16 +397,16 @@ const b = {
397
397
  * const img = new Image();
398
398
  * img.src = "URL_ADDRESS * img.src = "https://example.com/image.jpg";
399
399
  */
400
- isImageLoaded(t) {
401
- return t.complete && t.naturalWidth !== 0;
400
+ isImageLoaded(e) {
401
+ return e.complete && e.naturalWidth !== 0;
402
402
  },
403
403
  /**
404
404
  * 判断元素是否在可视区域内
405
405
  * @param el 元素对象
406
406
  * @returns true 表示元素在可视区域内,false 表示元素不在可视区域内
407
407
  */
408
- isInViewport(t) {
409
- const n = t.getBoundingClientRect();
408
+ isInViewport(e) {
409
+ const n = e.getBoundingClientRect();
410
410
  return n.top >= 0 && n.left >= 0 && n.bottom <= window.innerHeight && n.right <= window.innerWidth;
411
411
  },
412
412
  /**
@@ -421,8 +421,8 @@ const b = {
421
421
  * isLeapYear(2025); // false
422
422
  * isLeapYear(2024); // true
423
423
  */
424
- isLeapYear(t) {
425
- return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0;
424
+ isLeapYear(e) {
425
+ return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0;
426
426
  },
427
427
  /**
428
428
  * 判断是否为移动端
@@ -437,9 +437,9 @@ const b = {
437
437
  * @param name cookie的name
438
438
  * @returns cookie的值
439
439
  */
440
- getCookie(t) {
441
- if (!t) return;
442
- const n = document.cookie.match(new RegExp("(^| )" + t + "=([^;]+)"));
440
+ getCookie(e) {
441
+ if (!e) return;
442
+ const n = document.cookie.match(new RegExp("(^| )" + e + "=([^;]+)"));
443
443
  return n ? decodeURIComponent(n[2]) : null;
444
444
  },
445
445
  /**
@@ -449,27 +449,27 @@ const b = {
449
449
  * @param days cookie的过期时间,默认7天。如果为0,则表示cookie在会话结束时过期。如果为负数,则表示cookie已过期。
450
450
  * @returns void
451
451
  */
452
- setCookie(t, n, e = 7) {
452
+ setCookie(e, n, t = 7) {
453
453
  const r = /* @__PURE__ */ new Date();
454
- r.setTime(r.getTime() + e * 24 * 60 * 60 * 1e3), document.cookie = `${t}=${encodeURIComponent(n)};expires=${r.toUTCString()};path=/`;
454
+ r.setTime(r.getTime() + t * 24 * 60 * 60 * 1e3), document.cookie = `${e}=${encodeURIComponent(n)};expires=${r.toUTCString()};path=/`;
455
455
  },
456
456
  /**
457
457
  * 删除cookie
458
458
  * @param name cookie的name
459
459
  * @returns void
460
460
  */
461
- deleteCookie(t) {
462
- this.setCookie(t, "", -1);
461
+ deleteCookie(e) {
462
+ this.setCookie(e, "", -1);
463
463
  }
464
- }, R = {
464
+ }, U = {
465
465
  /**
466
466
  * 获取当前时间字符串
467
467
  * @param locales 区域设置。如:'zh-CN','en-US',"chinese"。默认'zh-CN'。
468
468
  * @param hour12 是否使用12小时制。默认false,使用24小时制。
469
469
  * @returns 当前时间的字符串。如:'2025/5/27 16:54:45'
470
470
  */
471
- getTimeString(t, n = !1) {
472
- return n ? (/* @__PURE__ */ new Date()).toLocaleString(t, { hour12: !0 }) : (/* @__PURE__ */ new Date()).toLocaleString("chinese", { hour12: !1 });
471
+ getTimeString(e, n = !1) {
472
+ return n ? (/* @__PURE__ */ new Date()).toLocaleString(e, { hour12: !0 }) : (/* @__PURE__ */ new Date()).toLocaleString("chinese", { hour12: !1 });
473
473
  },
474
474
  /**
475
475
  * 计算两个日期相差天数
@@ -477,9 +477,9 @@ const b = {
477
477
  * @param date2 日期2
478
478
  * @returns 相差天数
479
479
  */
480
- diffDays(t, n) {
481
- const e = new Date(t).getTime(), r = new Date(n).getTime();
482
- return e > r ? Math.abs(Math.floor((e - r) / (24 * 3600 * 1e3))) : Math.abs(Math.floor((r - e) / (24 * 3600 * 1e3)));
480
+ diffDays(e, n) {
481
+ const t = new Date(e).getTime(), r = new Date(n).getTime();
482
+ return t > r ? Math.abs(Math.floor((t - r) / (24 * 3600 * 1e3))) : Math.abs(Math.floor((r - t) / (24 * 3600 * 1e3)));
483
483
  },
484
484
  /**
485
485
  * 生成唯一ID(时间戳+随机数)
@@ -495,8 +495,8 @@ const b = {
495
495
  * @param day 日期
496
496
  * @returns 当年的第几天
497
497
  */
498
- getWhichDays(t, n, e) {
499
- let r = e;
498
+ getWhichDays(e, n, t) {
499
+ let r = t;
500
500
  for (let o = 1; o < n; o++)
501
501
  switch (o) {
502
502
  case 1:
@@ -509,31 +509,90 @@ const b = {
509
509
  r += 31;
510
510
  break;
511
511
  case 2:
512
- b.isLeapYear(t) ? r += 29 : r += 28;
512
+ S.isLeapYear(e) ? r += 29 : r += 28;
513
513
  break;
514
514
  default:
515
515
  r += 30;
516
516
  break;
517
517
  }
518
518
  return r;
519
+ },
520
+ /**
521
+ * 获取时间字符串(自动短化)
522
+ * @param timestamp 时间戳
523
+ * @param mustIncludeTime 是否必须包含时间
524
+ * @returns 时间字符串
525
+ */
526
+ getTimeStringAutoShort2(e, n) {
527
+ const t = /* @__PURE__ */ new Date(), r = new Date(e), o = t.getFullYear(), s = t.getMonth() + 1, a = t.getDate(), u = r.getFullYear(), i = r.getMonth() + 1, d = r.getDate();
528
+ let c = "";
529
+ const l = n ? " " + this.formatDate(r, "hh:mm") : "";
530
+ if (o === u) {
531
+ const f = t.getTime() - e;
532
+ if (s === i && a === d)
533
+ f < 60 * 1e3 ? c = "刚刚" : c = this.formatDate(r, "hh:mm");
534
+ else {
535
+ const g = /* @__PURE__ */ new Date();
536
+ g.setDate(g.getDate() - 1);
537
+ const m = /* @__PURE__ */ new Date();
538
+ if (m.setDate(m.getDate() - 2), i === g.getMonth() + 1 && d === g.getDate())
539
+ c = "昨天" + l;
540
+ else if (i === m.getMonth() + 1 && d === m.getDate())
541
+ c = "前天" + l;
542
+ else if (f / 36e5 <= 7 * 24) {
543
+ const y = new Array(7);
544
+ y[0] = "星期日", y[1] = "星期一", y[2] = "星期二", y[3] = "星期三", y[4] = "星期四", y[5] = "星期五", y[6] = "星期六", c = y[r.getDay()] + l;
545
+ } else c = this.formatDate(r, "yyyy/M/d") + l;
546
+ }
547
+ } else
548
+ c = this.formatDate(r, "yyyy/M/d") + l;
549
+ return c;
550
+ },
551
+ /**
552
+ * 格式化日期
553
+ * @param date 日期对象
554
+ * @param fmt 格式化字符串
555
+ * @returns 格式化后的日期字符串
556
+ */
557
+ formatDate(e, n) {
558
+ const t = {
559
+ "M+": e.getMonth() + 1,
560
+ //月份
561
+ "d+": e.getDate(),
562
+ //日
563
+ "h+": e.getHours(),
564
+ //小时
565
+ "m+": e.getMinutes(),
566
+ //分
567
+ "s+": e.getSeconds(),
568
+ //秒
569
+ "q+": Math.floor((e.getMonth() + 3) / 3),
570
+ //季度
571
+ S: e.getMilliseconds()
572
+ //毫秒
573
+ };
574
+ /(y+)/.test(n) && (n = n.replace(RegExp.$1, (e.getFullYear() + "").substr(4 - RegExp.$1.length)));
575
+ for (const r in t)
576
+ new RegExp("(" + r + ")").test(n) && (n = n.replace(RegExp.$1, RegExp.$1.length === 1 ? t[r] : ("00" + t[r]).substr(("" + t[r]).length)));
577
+ return n;
519
578
  }
520
- }, v = {
579
+ }, L = {
521
580
  /**
522
581
  * 获取元素相对于文档顶部的偏移量(距离)
523
582
  * 处理了SVG元素的特殊情况。
524
583
  * @param el 元素
525
584
  * @returns 偏移量(距离值)
526
585
  */
527
- getOffsetTop(t) {
528
- if (!t)
586
+ getOffsetTop(e) {
587
+ if (!e)
529
588
  throw new Error("Element is not provided");
530
- if (t instanceof SVGElement) {
531
- const e = t.getBoundingClientRect(), r = window.pageYOffset || document.documentElement.scrollTop;
532
- return e.top + r;
589
+ if (e instanceof SVGElement) {
590
+ const t = e.getBoundingClientRect(), r = window.pageYOffset || document.documentElement.scrollTop;
591
+ return t.top + r;
533
592
  }
534
593
  let n = 0;
535
- for (; t; )
536
- n += t.offsetTop, t = t.offsetParent;
594
+ for (; e; )
595
+ n += e.offsetTop, e = e.offsetParent;
537
596
  return n;
538
597
  },
539
598
  /**
@@ -541,11 +600,11 @@ const b = {
541
600
  * @returns 包含滚动值的对象 { scrollLeft: 水平滚动值, scrollTop: 垂直滚动值 }
542
601
  */
543
602
  getScrollValue() {
544
- const t = {
603
+ const e = {
545
604
  scrollLeft: 0,
546
605
  scrollTop: 0
547
606
  };
548
- return t.scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft, t.scrollTop = document.body.scrollTop || document.documentElement.scrollTop, t;
607
+ return e.scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft, e.scrollTop = document.body.scrollTop || document.documentElement.scrollTop, e;
549
608
  },
550
609
  /**
551
610
  * 获取鼠标事件的页面坐标
@@ -555,12 +614,12 @@ const b = {
555
614
  * @param e 鼠标事件
556
615
  * @returns 包含页面坐标的对象 { pageX: 水平页面坐标, pageY: 垂直页面坐标 }
557
616
  */
558
- getPageValue(t) {
559
- t = t || window.event;
560
- const n = t.pageX || t.clientX + this.getScrollValue().scrollLeft, e = t.pageY || t.clientY + this.getScrollValue().scrollTop;
617
+ getPageValue(e) {
618
+ e = e || window.event;
619
+ const n = e.pageX || e.clientX + this.getScrollValue().scrollLeft, t = e.pageY || e.clientY + this.getScrollValue().scrollTop;
561
620
  return {
562
621
  pageX: n,
563
- pageY: e
622
+ pageY: t
564
623
  };
565
624
  },
566
625
  /**
@@ -571,8 +630,8 @@ const b = {
571
630
  * @param fn 事件处理函数
572
631
  */
573
632
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
574
- addEventListener(t, n, e) {
575
- t.addEventListener ? t.addEventListener(n, e) : t.attachEvent ? t.attachEvent("on" + n, e) : t["on" + n] = e;
633
+ addEventListener(e, n, t) {
634
+ e.addEventListener ? e.addEventListener(n, t) : e.attachEvent ? e.attachEvent("on" + n, t) : e["on" + n] = t;
576
635
  },
577
636
  /**
578
637
  * 获取视口宽度
@@ -588,29 +647,61 @@ const b = {
588
647
  getViewportHeight() {
589
648
  return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
590
649
  }
591
- }, U = {
650
+ }, I = {
592
651
  /**
593
652
  * 将blob对象转化成文件并导出到本地
594
653
  * @param blob blob对象
595
654
  * @param filename 文件名
596
655
  */
597
- saveAsBlob(t, n) {
598
- const e = document.createElement("a"), r = window.URL.createObjectURL(t);
599
- e.href = r, e.download = n, document.body.appendChild(e), e.click(), URL.revokeObjectURL(r), document.body.removeChild(e);
656
+ saveAsBlob(e, n) {
657
+ const t = document.createElement("a"), r = window.URL.createObjectURL(e);
658
+ t.href = r, t.download = n, document.body.appendChild(t), t.click(), URL.revokeObjectURL(r), document.body.removeChild(t);
600
659
  }
601
- }, L = {
660
+ }, H = {
661
+ /**
662
+ * echarts动画函数
663
+ * @param option echarts配置
664
+ * @param myChart echarts实例
665
+ */
666
+ animate(e, n) {
667
+ let t = -1;
668
+ const r = e.series[0].data.length;
669
+ let o;
670
+ o = setInterval(() => {
671
+ n.dispatchAction({
672
+ type: "downplay",
673
+ seriesIndex: 0,
674
+ dataIndex: t
675
+ }), t = (t + 1) % r, n.dispatchAction({
676
+ type: "highlight",
677
+ seriesIndex: 0,
678
+ dataIndex: t
679
+ }), n.dispatchAction({
680
+ type: "showTip",
681
+ seriesIndex: 0,
682
+ dataIndex: t
683
+ }), t > r && (t = 0);
684
+ }, 2e3), n.on("mouseover", () => {
685
+ clearInterval(o), n.dispatchAction({
686
+ type: "downplay",
687
+ seriesIndex: 0,
688
+ dataIndex: t
689
+ });
690
+ });
691
+ }
692
+ }, j = {
602
693
  /**
603
694
  * 将选中的字母数组从A-Z排序:用于试题选择答案的排序实例
604
695
  * @param arr 字母数组
605
696
  * @returns
606
697
  */
607
- sortFromA2Z(t) {
608
- return t?.length ? t.sort((e, r) => {
609
- const o = e.toUpperCase(), s = r.toUpperCase();
698
+ sortFromA2Z(e) {
699
+ return e?.length ? e.sort((t, r) => {
700
+ const o = t.toUpperCase(), s = r.toUpperCase();
610
701
  return o < s ? -1 : o > s ? 1 : 0;
611
702
  }) : void 0;
612
703
  }
613
- }, T = {
704
+ }, k = {
614
705
  /**
615
706
  * 角度(度数)转弧度
616
707
  * 在数学和编程里,角度有两种常用单位,分别是度(°)和弧度(rad)。
@@ -619,8 +710,8 @@ const b = {
619
710
  * @param degrees 度数。单位:°
620
711
  * @returns 弧度值
621
712
  */
622
- degrees2Radians(t) {
623
- return t * Math.PI / 180;
713
+ degrees2Radians(e) {
714
+ return e * Math.PI / 180;
624
715
  },
625
716
  /**
626
717
  * 根据经纬度计算距离【弃用】
@@ -630,11 +721,11 @@ const b = {
630
721
  * @param targetLng 目标经度
631
722
  * @returns 距离值 单位:km
632
723
  */
633
- getDistance(t, n, e, r) {
634
- const o = this.degrees2Radians(t), s = this.degrees2Radians(e), c = o - s, l = this.degrees2Radians(n) - this.degrees2Radians(r);
724
+ getDistance(e, n, t, r) {
725
+ const o = this.degrees2Radians(e), s = this.degrees2Radians(t), a = o - s, u = this.degrees2Radians(n) - this.degrees2Radians(r);
635
726
  let i = 2 * Math.asin(
636
727
  Math.sqrt(
637
- Math.pow(Math.sin(c / 2), 2) + Math.cos(o) * Math.cos(s) * Math.pow(Math.sin(l / 2), 2)
728
+ Math.pow(Math.sin(a / 2), 2) + Math.cos(o) * Math.cos(s) * Math.pow(Math.sin(u / 2), 2)
638
729
  )
639
730
  );
640
731
  return i = i * 6378.137, i = Math.round(i * 1e4) / 1e4, i = +i.toFixed(2), console.log("经纬度计算的距离为:" + i), i;
@@ -654,23 +745,23 @@ const b = {
654
745
  * @param unit 距离单位,默认单位为千米。可选值:km(千米)、m(米)、mi(英里)、nmi(海里)
655
746
  * @returns 距离值
656
747
  */
657
- calculateDistanceByHaversine(t, n, e = "km") {
658
- const r = this, o = t.longitude ?? t.lng, s = t.latitude ?? t.lat, c = n.longitude ?? n.lng, l = n.latitude ?? n.lat;
659
- if (o === void 0 || s === void 0 || c === void 0 || l === void 0)
748
+ calculateDistanceByHaversine(e, n, t = "km") {
749
+ const r = this, o = e.longitude ?? e.lng, s = e.latitude ?? e.lat, a = n.longitude ?? n.lng, u = n.latitude ?? n.lat;
750
+ if (o === void 0 || s === void 0 || a === void 0 || u === void 0)
660
751
  throw new Error("无效的坐标格式,缺少经纬度信息");
661
- const i = 6371, d = r.degrees2Radians(s), a = r.degrees2Radians(l), u = r.degrees2Radians(l - s), h = r.degrees2Radians(c - o), g = Math.sin(u / 2) * Math.sin(u / 2) + Math.cos(d) * Math.cos(a) * Math.sin(h / 2) * Math.sin(h / 2), f = 2 * Math.atan2(Math.sqrt(g), Math.sqrt(1 - g)), p = i * f;
662
- switch (e) {
752
+ const i = 6371, d = r.degrees2Radians(s), c = r.degrees2Radians(u), l = r.degrees2Radians(u - s), h = r.degrees2Radians(a - o), p = Math.sin(l / 2) * Math.sin(l / 2) + Math.cos(d) * Math.cos(c) * Math.sin(h / 2) * Math.sin(h / 2), f = 2 * Math.atan2(Math.sqrt(p), Math.sqrt(1 - p)), g = i * f;
753
+ switch (t) {
663
754
  case "m":
664
- return p * 1e3;
755
+ return g * 1e3;
665
756
  // 米
666
757
  case "mi":
667
- return p * 0.621371;
758
+ return g * 0.621371;
668
759
  // 英里
669
760
  case "nmi":
670
- return p * 0.539957;
761
+ return g * 0.539957;
671
762
  // 海里
672
763
  default:
673
- return p;
764
+ return g;
674
765
  }
675
766
  },
676
767
  /**
@@ -680,23 +771,23 @@ const b = {
680
771
  * @param closed 是否闭合路径,默认不闭合
681
772
  * @returns 距离结果对象。包含每个距离段的数组(segments)和总距离(total)。
682
773
  */
683
- calculateDistancesByHaversine(t, n = "km", e = !1) {
684
- if (t.length < 2)
774
+ calculateDistancesByHaversine(e, n = "km", t = !1) {
775
+ if (e.length < 2)
685
776
  return { segments: [], total: 0 };
686
777
  const r = [];
687
778
  let o = 0;
688
- for (let s = 0; s < t.length - 1; s++) {
689
- const c = this.calculateDistanceByHaversine(t[s], t[s + 1], n);
690
- r.push(c), o += c;
779
+ for (let s = 0; s < e.length - 1; s++) {
780
+ const a = this.calculateDistanceByHaversine(e[s], e[s + 1], n);
781
+ r.push(a), o += a;
691
782
  }
692
- if (e && t.length > 2) {
693
- const s = this.calculateDistanceByHaversine(t[t.length - 1], t[0], n);
783
+ if (t && e.length > 2) {
784
+ const s = this.calculateDistanceByHaversine(e[e.length - 1], e[0], n);
694
785
  r.push(s), o += s;
695
786
  }
696
787
  return { segments: r, total: o };
697
788
  }
698
789
  };
699
- class j {
790
+ class $ {
700
791
  /**
701
792
  * 转换为标准金额格式(带千分位和两位小数)
702
793
  * @param num 要转换的数字
@@ -704,14 +795,14 @@ class j {
704
795
  */
705
796
  static toStandardFormat(n) {
706
797
  try {
707
- const e = typeof n == "string" ? parseFloat(n) : n;
708
- if (isNaN(e))
798
+ const t = typeof n == "string" ? parseFloat(n) : n;
799
+ if (isNaN(t))
709
800
  throw new Error("输入不是有效的数字");
710
- if (!isFinite(e))
801
+ if (!isFinite(t))
711
802
  throw new Error("输入是无穷大");
712
- return e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
713
- } catch (e) {
714
- return console.error("格式化失败:", e), "格式错误";
803
+ return t.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
804
+ } catch (t) {
805
+ return console.error("格式化失败:", t), "格式错误";
715
806
  }
716
807
  }
717
808
  /**
@@ -721,61 +812,61 @@ class j {
721
812
  */
722
813
  static toChineseFormat(n) {
723
814
  try {
724
- const e = typeof n == "string" ? parseFloat(n) : n;
725
- if (isNaN(e))
815
+ const t = typeof n == "string" ? parseFloat(n) : n;
816
+ if (isNaN(t))
726
817
  throw new Error("输入不是有效的数字");
727
- if (e > 9999999999999e-2 || e < -9999999999999e-2)
818
+ if (t > 9999999999999e-2 || t < -9999999999999e-2)
728
819
  throw new Error("输入数字超出范围");
729
- const r = e < 0, o = Math.abs(e), s = Math.floor(o), c = Math.round((o - s) * 100), l = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], i = ["", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟"], d = ["角", "分"];
730
- let a = "", u = s;
731
- if (u === 0)
732
- a = l[0];
820
+ const r = t < 0, o = Math.abs(t), s = Math.floor(o), a = Math.round((o - s) * 100), u = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], i = ["", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟"], d = ["角", "分"];
821
+ let c = "", l = s;
822
+ if (l === 0)
823
+ c = u[0];
733
824
  else {
734
825
  let f = 0;
735
- for (; u > 0; ) {
736
- const p = u % 10;
737
- p !== 0 ? a = l[p] + i[f] + a : a.charAt(0) !== l[0] && (a = l[p] + a), u = Math.floor(u / 10), f++;
826
+ for (; l > 0; ) {
827
+ const g = l % 10;
828
+ g !== 0 ? c = u[g] + i[f] + c : c.charAt(0) !== u[0] && (c = u[g] + c), l = Math.floor(l / 10), f++;
738
829
  }
739
- a = a.replace(/零+/g, "零"), a = a.replace(/零+$/, "");
830
+ c = c.replace(/零+/g, "零"), c = c.replace(/零+$/, "");
740
831
  }
741
832
  let h = "";
742
- if (c > 0) {
743
- const f = Math.floor(c / 10), p = c % 10;
744
- f > 0 && (h += l[f] + d[0]), p > 0 && (h += l[p] + d[1]);
833
+ if (a > 0) {
834
+ const f = Math.floor(a / 10), g = a % 10;
835
+ f > 0 && (h += u[f] + d[0]), g > 0 && (h += u[g] + d[1]);
745
836
  } else
746
837
  h = "整";
747
- let g = (r ? "负" : "") + a + "圆" + h;
748
- return g === "零圆整" && (g = "零圆"), g;
749
- } catch (e) {
750
- return console.error("转换失败:", e), "格式错误";
838
+ let p = (r ? "负" : "") + c + "圆" + h;
839
+ return p === "零圆整" && (p = "零圆"), p;
840
+ } catch (t) {
841
+ return console.error("转换失败:", t), "格式错误";
751
842
  }
752
843
  }
753
844
  }
754
- const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
845
+ const M = (e) => e > 25 || e < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e], x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
755
846
  __proto__: null,
756
- toLetter: A
757
- }, Symbol.toStringTag, { value: "Module" })), M = (t) => t.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
847
+ toLetter: M
848
+ }, Symbol.toStringTag, { value: "Module" })), E = (e) => e.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
758
849
  __proto__: null,
759
- toMoney: M
760
- }, Symbol.toStringTag, { value: "Module" })), H = {
761
- ...S,
762
- ...C,
850
+ toMoney: E
851
+ }, Symbol.toStringTag, { value: "Module" })), N = {
852
+ ...x,
853
+ ...B,
763
854
  /**
764
855
  * 判断是否为数字
765
856
  * @param val 待判断的值
766
857
  * @returns 是否为数字。true 是;false 否
767
858
  */
768
- isNumber(t) {
769
- return typeof t == "number" && !isNaN(t);
859
+ isNumber(e) {
860
+ return typeof e == "number" && !isNaN(e);
770
861
  }
771
- }, k = {
862
+ }, P = {
772
863
  /**
773
864
  * 判断对象是否为空
774
865
  * @param obj 对象
775
866
  * @returns 是否为空。true 为空;false 不为空
776
867
  */
777
- isEmptyObject(t) {
778
- return t ? Object.keys(t).length === 0 && t.constructor === Object : !0;
868
+ isEmptyObject(e) {
869
+ return e ? Object.keys(e).length === 0 && e.constructor === Object : !0;
779
870
  },
780
871
  /**
781
872
  * 复制对象【对象的浅拷贝 把obj1的成员,复制给obj2】
@@ -783,9 +874,9 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
783
874
  * @param obj2 目标对象
784
875
  */
785
876
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
786
- copy(t, n) {
787
- for (const e in t)
788
- n[e] = t[e];
877
+ copy(e, n) {
878
+ for (const t in e)
879
+ n[t] = e[t];
789
880
  },
790
881
  /**
791
882
  * 对象的深拷贝 把o1 的成员,复制给o2
@@ -793,22 +884,22 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
793
884
  * @param o2
794
885
  */
795
886
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
796
- deepCopy(t, n) {
797
- for (const e in t) {
798
- const r = t[e];
799
- r instanceof Object ? (n[e] = {}, this.deepCopy(r, n[e])) : r instanceof Array ? (n[e] = [], this.deepCopy(r, n[e])) : n[e] = t[e];
887
+ deepCopy(e, n) {
888
+ for (const t in e) {
889
+ const r = e[t];
890
+ r instanceof Object ? (n[t] = {}, this.deepCopy(r, n[t])) : r instanceof Array ? (n[t] = [], this.deepCopy(r, n[t])) : n[t] = e[t];
800
891
  }
801
892
  }
802
- }, I = {
893
+ }, F = {
803
894
  /**
804
895
  * 脱敏
805
896
  * @param phone 电话号码/手机号码
806
897
  * @returns 脱敏后的电话号码/手机号码
807
898
  */
808
- desensitize(t) {
809
- return t ? t.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2") || t.slice(0, 3) + "****" + t.slice(7) : "";
899
+ desensitize(e) {
900
+ return e ? e.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2") || e.slice(0, 3) + "****" + e.slice(7) : "";
810
901
  }
811
- }, N = {
902
+ }, V = {
812
903
  /**
813
904
  * 生成随机颜色
814
905
  * @returns 随机颜色值
@@ -822,8 +913,8 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
822
913
  * @param max 最大值
823
914
  * @returns 随机数
824
915
  */
825
- int(t, n) {
826
- return Math.floor(Math.random() * (n - t + 1)) + t;
916
+ int(e, n) {
917
+ return Math.floor(Math.random() * (n - e + 1)) + e;
827
918
  },
828
919
  /**
829
920
  * 生成唯一ID(时间戳+随机数)
@@ -832,7 +923,7 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
832
923
  uniqueId() {
833
924
  return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
834
925
  }
835
- }, P = {
926
+ }, W = {
836
927
  /**
837
928
  * 验证手机号
838
929
  */
@@ -869,65 +960,65 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
869
960
  * 验证0.01~0.99正则:最多两位小数。0.1、0.10、0.9、0.90
870
961
  */
871
962
  decimal: /^0\.(0[1-9]|[1-9][0-9]*)$/
872
- }, $ = {
963
+ }, Y = {
873
964
  /**
874
965
  * 通过key值获取 localStorage 中存储的某个值
875
966
  * @param key 获取的key
876
967
  * @returns 获取的值
877
968
  */
878
- getLocal(t) {
879
- return localStorage.getItem(t);
969
+ getLocal(e) {
970
+ return localStorage.getItem(e);
880
971
  },
881
972
  /**
882
973
  * 设置localStorage中的某个值
883
974
  * @param key 设置的key
884
975
  * @param value 设置的value
885
976
  */
886
- setLocal(t, n) {
887
- localStorage.setItem(t, n);
977
+ setLocal(e, n) {
978
+ localStorage.setItem(e, n);
888
979
  },
889
980
  /**
890
981
  * 删除localStorage中的某个值
891
982
  * @param key 删除的key
892
983
  */
893
- removeLocal(t) {
894
- localStorage.removeItem(t);
984
+ removeLocal(e) {
985
+ localStorage.removeItem(e);
895
986
  },
896
987
  /**
897
988
  * 通过key值获取 sessionStorage 中存储的某个值
898
989
  * @param key 获取的key
899
990
  * @returns 获取的值
900
991
  */
901
- getSession(t) {
902
- return sessionStorage.getItem(t);
992
+ getSession(e) {
993
+ return sessionStorage.getItem(e);
903
994
  },
904
995
  /**
905
996
  * 设置sessionStorage中的某个值
906
997
  * @param key 设置的key
907
998
  * @param value 设置的value
908
999
  */
909
- setSession(t, n) {
910
- sessionStorage.setItem(t, n);
1000
+ setSession(e, n) {
1001
+ sessionStorage.setItem(e, n);
911
1002
  },
912
1003
  /**
913
1004
  * 删除sessionStorage中的某个值
914
1005
  * @param key 删除的key
915
1006
  */
916
- removeSession(t) {
917
- sessionStorage.removeItem(t);
1007
+ removeSession(e) {
1008
+ sessionStorage.removeItem(e);
918
1009
  }
919
- }, D = {
1010
+ }, z = {
920
1011
  /**
921
1012
  * 判断某元素是否在字符串中-比includes()方法更兼容,includes为ES6新增方法,IE不支持。小程序也不支持
922
1013
  * @param str 字符串
923
1014
  * @param element 查询元素
924
1015
  * @returns 是否存在。true 存在;false 不存在
925
1016
  */
926
- isExist(t, n) {
927
- if (!t || !n)
1017
+ isExist(e, n) {
1018
+ if (!e || !n)
928
1019
  return !1;
929
- const e = t.split(",");
930
- return console.log("判断某元素是否在字符串中", e.indexOf(n) === -1), e.indexOf(n) !== -1;
1020
+ const t = e.split(",");
1021
+ return console.log("判断某元素是否在字符串中", t.indexOf(n) === -1), t.indexOf(n) !== -1;
931
1022
  },
932
1023
  /**
933
1024
  * 判断某元素是否在字符串中-比isExist()方法更高效。
@@ -935,17 +1026,17 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
935
1026
  * @param element 查询元素
936
1027
  * @returns 是否存在。true 存在;false 不存在
937
1028
  */
938
- includes(t, n) {
939
- return !t || !n ? !1 : t.includes(n);
1029
+ includes(e, n) {
1030
+ return !e || !n ? !1 : e.includes(n);
940
1031
  },
941
1032
  /**
942
1033
  * 判断字符串是否为 JSON
943
1034
  * @param str 字符串
944
1035
  * @returns
945
1036
  */
946
- isJSON(t) {
1037
+ isJSON(e) {
947
1038
  try {
948
- return JSON.parse(t), !0;
1039
+ return JSON.parse(e), !0;
949
1040
  } catch {
950
1041
  return !1;
951
1042
  }
@@ -956,12 +1047,12 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
956
1047
  * @param element 元素
957
1048
  * @returns 位置数组
958
1049
  */
959
- indexsOfAppear(t, n) {
960
- let e = -1;
1050
+ indexsOfAppear(e, n) {
1051
+ let t = -1;
961
1052
  const r = [];
962
1053
  do
963
- e = t.indexOf(n, e + 1), e !== -1 && r.push(e);
964
- while (e !== -1);
1054
+ t = e.indexOf(n, t + 1), t !== -1 && r.push(t);
1055
+ while (t !== -1);
965
1056
  return r;
966
1057
  },
967
1058
  /**
@@ -969,33 +1060,33 @@ const A = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], S = /*
969
1060
  * @param string 字符串
970
1061
  * @returns 数组,第一个元素为出现次数,第二个元素为出现次数最多的字符
971
1062
  */
972
- getMaxTimesAndVal(t) {
973
- const n = [0, ""], e = {};
974
- for (let s = 0; s < t.length; s++) {
975
- const c = t.charAt(s);
976
- e[c] ? e[c]++ : e[c] = 1;
1063
+ getMaxTimesAndVal(e) {
1064
+ const n = [0, ""], t = {};
1065
+ for (let s = 0; s < e.length; s++) {
1066
+ const a = e.charAt(s);
1067
+ t[a] ? t[a]++ : t[a] = 1;
977
1068
  }
978
1069
  let r = 1;
979
- for (const s in e)
980
- r < e[s] && (r = e[s]);
1070
+ for (const s in t)
1071
+ r < t[s] && (r = t[s]);
981
1072
  const o = [];
982
- for (const s in e)
983
- r == e[s] && o.push(s);
1073
+ for (const s in t)
1074
+ r == t[s] && o.push(s);
984
1075
  return n[0] = r, n[1] = o.join(), n;
985
1076
  }
986
- }, B = (t) => {
987
- const e = new RegExp("[?&]" + t + "=([^&#]*)", "i").exec(window.location.href);
988
- return e ? decodeURIComponent(e[1]) : null;
1077
+ }, C = (e) => {
1078
+ const t = new RegExp("[?&]" + e + "=([^&#]*)", "i").exec(window.location.href);
1079
+ return t ? decodeURIComponent(t[1]) : null;
989
1080
  };
990
- function E(t) {
991
- return new URLSearchParams(window.location.search).get(t);
1081
+ function D(e) {
1082
+ return new URLSearchParams(window.location.search).get(e);
992
1083
  }
993
- const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1084
+ const R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
994
1085
  __proto__: null,
995
- getQueryInfoByName: B,
996
- getQueryParam: E
997
- }, Symbol.toStringTag, { value: "Module" })), F = {
998
- ...x,
1086
+ getQueryInfoByName: C,
1087
+ getQueryParam: D
1088
+ }, Symbol.toStringTag, { value: "Module" })), q = {
1089
+ ...R,
999
1090
  /**
1000
1091
  * 获取当前域名
1001
1092
  * @returns 当前url链接的host信息
@@ -1010,22 +1101,22 @@ const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1010
1101
  getPath() {
1011
1102
  return window.location.pathname;
1012
1103
  }
1013
- }, V = {
1104
+ }, Z = {
1014
1105
  /**
1015
1106
  * 处理瀑布流数据,使其竖向瀑布流布局呈现横向瀑布流的展现形式。适用于 column-gap: 20rpx; column-count: 2; 布局的瀑布流
1016
1107
  * @param list 瀑布流数据-数组
1017
1108
  * @param columnsNum 需要展示的列数
1018
1109
  * @returns 适合瀑布流布局的数组
1019
1110
  */
1020
- toList(t, n = 2) {
1021
- console.log(t, n);
1022
- const e = {};
1111
+ toList(e, n = 2) {
1112
+ console.log(e, n);
1113
+ const t = {};
1023
1114
  for (let o = 0; o < n; o++)
1024
- e[o] = [];
1025
- t.forEach((o, s) => e[s % n].push(o));
1115
+ t[o] = [];
1116
+ e.forEach((o, s) => t[s % n].push(o));
1026
1117
  const r = [];
1027
- for (const o in e)
1028
- r.push(...e[o]);
1118
+ for (const o in t)
1119
+ r.push(...t[o]);
1029
1120
  return r;
1030
1121
  },
1031
1122
  /**
@@ -1034,37 +1125,38 @@ const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1034
1125
  * @param items 瀑布流元素
1035
1126
  * @param step 间距
1036
1127
  */
1037
- jsLayout(t, n, e) {
1038
- const r = t.offsetWidth, o = n[0].offsetWidth, s = parseInt((r / o).toString()), c = (r - o * s) / (s - 1), l = [];
1128
+ jsLayout(e, n, t) {
1129
+ const r = e.offsetWidth, o = n[0].offsetWidth, s = parseInt((r / o).toString()), a = (r - o * s) / (s - 1), u = [];
1039
1130
  for (let i = 0, d = n.length; i < d; i++) {
1040
- const a = n[i];
1131
+ const c = n[i];
1041
1132
  if (i < s)
1042
- a.style.left = (o + c) * i + "px", l[i] = a.offsetHeight;
1133
+ c.style.left = (o + a) * i + "px", u[i] = c.offsetHeight;
1043
1134
  else {
1044
- const { index: u, value: h } = w.getMinValueAndIndex(l);
1045
- a.style.left = (o + c) * u + "px", a.style.top = h + e + "px", l[u] = a.offsetHeight + e + h;
1135
+ const { index: l, value: h } = b.getMinValueAndIndex(u);
1136
+ c.style.left = (o + a) * l + "px", c.style.top = h + t + "px", u[l] = c.offsetHeight + t + h;
1046
1137
  }
1047
1138
  }
1048
1139
  }
1049
1140
  };
1050
1141
  export {
1051
- _ as Base64Utils,
1052
- j as MoneyFormatter,
1053
- w as arrayUtils,
1054
- b as booleanUtils,
1142
+ T as Base64Utils,
1143
+ $ as MoneyFormatter,
1144
+ b as arrayUtils,
1145
+ S as booleanUtils,
1055
1146
  O as cookieUtils,
1056
- R as dateUtils,
1057
- v as documentUtils,
1058
- U as downloadUtils,
1059
- L as letterUtils,
1060
- T as mapUtils,
1061
- H as numberUtils,
1062
- k as objectUtils,
1063
- I as phoneUtils,
1064
- N as randomUtils,
1065
- P as regexpUtils,
1066
- $ as storageUtils,
1067
- D as stringUtils,
1068
- F as urlUtils,
1069
- V as waterfallUtils
1147
+ U as dateUtils,
1148
+ L as documentUtils,
1149
+ I as downloadUtils,
1150
+ H as echartsUtils,
1151
+ j as letterUtils,
1152
+ k as mapUtils,
1153
+ N as numberUtils,
1154
+ P as objectUtils,
1155
+ F as phoneUtils,
1156
+ V as randomUtils,
1157
+ W as regexpUtils,
1158
+ Y as storageUtils,
1159
+ z as stringUtils,
1160
+ q as urlUtils,
1161
+ Z as waterfallUtils
1070
1162
  };