gis-common 3.1.12 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- var z = Object.defineProperty;
2
- var H = (e, t, n) => t in e ? z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var f = (e, t, n) => H(e, typeof t != "symbol" ? t + "" : t, n);
4
- const b = {
1
+ var x = Object.defineProperty;
2
+ var S = (t, e, n) => e in t ? x(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var f = (t, e, n) => S(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const M = {
5
5
  MAP_RENDER: "mapRender",
6
6
  MAP_READY: "mapReady",
7
7
  MOUSE_CLICK: "click",
@@ -23,7 +23,7 @@ const b = {
23
23
  WEB_SOCKET_ERROR: "webSocketError",
24
24
  WEB_SOCKET_MESSAGE: "webSocketMessage",
25
25
  WEB_SOCKET_CLOSE: "webSocketClose"
26
- }, p = {
26
+ }, D = {
27
27
  LOGIN_EXPIRED: "登录信息过期,请重新登录",
28
28
  CROSS_ERROR: "跨域访问",
29
29
  UNEXIST_RESOURCE: "资源不存在",
@@ -44,7 +44,7 @@ const b = {
44
44
  PARAMETER_ERROR_OBJECT: "格式类型验证失败:必须是对象",
45
45
  PARAMETER_ERROR_LACK: "参数缺失",
46
46
  STRING_CHECK_LOSS: "字符缺少关键字"
47
- }, Q = {
47
+ }, C = {
48
48
  SUPER_MAP_IMAGES: "SuperMapImages",
49
49
  // 超图影像服务 栅格数据
50
50
  SUPER_MAP_DATA: "SuperMapData",
@@ -58,7 +58,7 @@ const b = {
58
58
  // addS3MGroupLayer(url, options, index) 添加S3M分组图层。
59
59
  TERRAIN_LAYER: "TerrainFileLayer"
60
60
  // 地形图层, 需要单独处理
61
- }, V = {
61
+ }, I = {
62
62
  POINT: "point",
63
63
  POLYLINE: "polyline",
64
64
  POLYGON: "polygon",
@@ -68,23 +68,23 @@ const b = {
68
68
  LABEL: "label",
69
69
  MODEL: "model",
70
70
  WALL: "wall"
71
- }, X = {
71
+ }, _ = {
72
72
  DISTANCE: "distance",
73
73
  AREA: "area",
74
74
  HEIGHT: "height"
75
- }, Z = {
75
+ }, T = {
76
76
  ADD: "add",
77
77
  REMOVE: "remove",
78
78
  INIT: "init"
79
79
  };
80
- class tt {
81
- constructor(t) {
80
+ class v {
81
+ constructor(e) {
82
82
  /**
83
83
  * Creates an instance of AudioPlayer.
84
84
  * @param {*} url
85
85
  */
86
86
  f(this, "audio");
87
- this.audio = new Audio(), this.audio.src = t;
87
+ this.audio = new Audio(), this.audio.src = e;
88
88
  }
89
89
  play() {
90
90
  !this.muted && this.audio.play();
@@ -98,59 +98,44 @@ class tt {
98
98
  /**
99
99
  * @description 设置静音状态,如果静音,autoplay属性将失效
100
100
  */
101
- set muted(t) {
102
- this.audio.muted = t;
101
+ set muted(e) {
102
+ this.audio.muted = e;
103
103
  }
104
104
  }
105
- const E = {
105
+ const y = {
106
106
  /**
107
107
  * 获取数据类型
108
108
  *
109
109
  * @param data 待判断的数据
110
110
  * @returns 返回数据类型字符串
111
111
  */
112
- getDataType(e) {
113
- return Object.prototype.toString.call(e).slice(8, -1);
112
+ getDataType(t) {
113
+ return Object.prototype.toString.call(t).slice(8, -1);
114
114
  },
115
- isEmpty(e) {
116
- if (e == null)
115
+ isEmpty(t) {
116
+ if (t == null)
117
117
  return !0;
118
- switch (this.getDataType(e)) {
118
+ switch (this.getDataType(t)) {
119
119
  case "String":
120
- return e.trim() === "";
120
+ return t.trim() === "";
121
121
  case "Array":
122
- return !e.length;
122
+ return !t.length;
123
123
  case "Object":
124
- return !Object.keys(e).length;
124
+ return !Object.keys(t).length;
125
125
  case "Boolean":
126
- return !e;
126
+ return !t;
127
127
  default:
128
128
  return !1;
129
129
  }
130
130
  },
131
- isNotEmpty(e) {
132
- return !this.isEmpty(e);
131
+ isNotEmpty(t) {
132
+ return !this.isEmpty(t);
133
133
  },
134
- json2form(e) {
135
- const t = new FormData();
136
- return Object.keys(e).forEach((n) => {
137
- t.append(n, e[n] instanceof Object ? JSON.stringify(e[n]) : e[n]);
138
- }), t;
139
- },
140
- /**
141
- * 将json对象转换为查询字符串
142
- *
143
- * @param json 待转换的json对象
144
- * @returns 转换后的查询字符串
145
- */
146
- json2Query(e) {
147
- var t = [];
148
- for (var n in e) {
149
- var s = n, i = e[n];
150
- t.push(s + "=" + i);
151
- }
152
- var r = t.join("&");
153
- return r;
134
+ json2form(t) {
135
+ const e = new FormData();
136
+ return Object.keys(t).forEach((n) => {
137
+ e.append(n, t[n] instanceof Object ? JSON.stringify(t[n]) : t[n]);
138
+ }), e;
154
139
  },
155
140
  /**
156
141
  * 生成GUID
@@ -158,10 +143,10 @@ const E = {
158
143
  * @returns 返回一个由8个16进制数组成的GUID字符串
159
144
  */
160
145
  generateGuid() {
161
- const e = function() {
146
+ const t = function() {
162
147
  return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
163
148
  };
164
- return e() + e() + e() + e() + e() + e() + e() + e();
149
+ return t() + t() + t() + t() + t() + t() + t() + t();
165
150
  },
166
151
  /**
167
152
  * 将参数进行解码并返回解码后的字符串
@@ -169,18 +154,18 @@ const E = {
169
154
  * @param args 参数
170
155
  * @returns 解码后的字符串
171
156
  */
172
- decodeDict(...e) {
173
- let t = "";
174
- if (e.length > 1) {
175
- const n = e.slice(1, e.length % 2 === 0 ? e.length - 1 : e.length);
157
+ decodeDict(...t) {
158
+ let e = "";
159
+ if (t.length > 1) {
160
+ const n = t.slice(1, t.length % 2 === 0 ? t.length - 1 : t.length);
176
161
  for (let s = 0; s < n.length; s = s + 2) {
177
- const i = n[s];
178
- e[0] === i && (t = n[s + 1]);
162
+ const r = n[s];
163
+ t[0] === r && (e = n[s + 1]);
179
164
  }
180
- !t && e.length % 2 === 0 && (t = e[e.length - 1]);
165
+ !e && t.length % 2 === 0 && (e = t[t.length - 1]);
181
166
  } else
182
- t = e[0];
183
- return t;
167
+ e = t[0];
168
+ return e;
184
169
  },
185
170
  /**
186
171
  * 将一个或多个对象的所有可枚举属性复制到目标对象。
@@ -189,23 +174,13 @@ const E = {
189
174
  * @param args 一个或多个源对象,用于提供要复制的属性。
190
175
  * @returns 返回目标对象,包含所有复制的属性。
191
176
  */
192
- extend(e, ...t) {
193
- let n, s, i, r;
194
- for (s = 0, i = t.length; s < i; s++) {
195
- r = t[s];
196
- for (n in r)
197
- e[n] = r[n];
177
+ extend(t, ...e) {
178
+ let n, s, r, i;
179
+ for (s = 0, r = e.length; s < r; s++) {
180
+ i = e[s];
181
+ for (n in i)
182
+ t[n] = i[n];
198
183
  }
199
- return e;
200
- },
201
- /**
202
- * 将RGB颜色值转换为十六进制颜色值
203
- *
204
- * @param rgb RGB颜色值数组,包含三个0-255之间的整数
205
- * @returns 转换后的十六进制颜色值,以#开头
206
- */
207
- rgb2hex(e) {
208
- var t = "#" + (16777216 + (e[0] << 16) + (e[1] << 8) + e[2]).toString(16).slice(1);
209
184
  return t;
210
185
  },
211
186
  /**
@@ -217,31 +192,31 @@ const E = {
217
192
  * @param childrenPropertyName 树形结构中标识子节点的字段名,默认为'children'
218
193
  * @returns 转换后的树形结构数组
219
194
  */
220
- convertToTree2(e, t = "id", n = "parentId", s = "children") {
221
- const i = [];
222
- function r(a) {
223
- const o = e.filter((c) => c[n] === a[t]).map((c) => (i.some((l) => l[t] === c[t]) || r(c), c));
195
+ convertToTree2(t, e = "id", n = "parentId", s = "children") {
196
+ const r = [];
197
+ function i(a) {
198
+ const o = t.filter((c) => c[n] === a[e]).map((c) => (r.some((l) => l[e] === c[e]) || i(c), c));
224
199
  o.length > 0 && (a[s] = o);
225
200
  }
226
- return e.forEach((a) => {
227
- e.some((o) => o[n] === a[t]) || (r(a), i.push(a));
228
- }), i;
201
+ return t.forEach((a) => {
202
+ t.some((o) => o[n] === a[e]) || (i(a), r.push(a));
203
+ }), r;
229
204
  },
230
205
  /**
231
206
  * 异步加载script
232
207
  *
233
208
  * @param {*} url
234
209
  */
235
- asyncLoadScript(e) {
236
- return new Promise((t, n) => {
210
+ asyncLoadScript(t) {
211
+ return new Promise((e, n) => {
237
212
  try {
238
213
  const s = document.createElement("script");
239
- s.type = "text/javascript", s.src = e, "readyState" in s ? s.onreadystatechange = function() {
240
- (s.readyState === "complete" || s.readyState === "loaded") && t(s);
214
+ s.type = "text/javascript", s.src = t, "readyState" in s ? s.onreadystatechange = function() {
215
+ (s.readyState === "complete" || s.readyState === "loaded") && e(s);
241
216
  } : (s.onload = function() {
242
- t(s);
217
+ e(s);
243
218
  }, s.onerror = function() {
244
- n(new Error("Script failed to load for URL: " + e));
219
+ n(new Error("Script failed to load for URL: " + t));
245
220
  }), document.body.appendChild(s);
246
221
  } catch (s) {
247
222
  n(s);
@@ -254,11 +229,11 @@ const E = {
254
229
  * @param urls 样式文件URL数组
255
230
  * @returns 无返回值
256
231
  */
257
- loadStyle(e) {
258
- e.forEach((t) => {
232
+ loadStyle(t) {
233
+ t.forEach((e) => {
259
234
  const n = document.createElement("link");
260
- n.href = t, n.rel = "stylesheet", n.type = "text/css", n.onerror = function() {
261
- console.error(`Style loading failed for URL: ${t}`);
235
+ n.href = e, n.rel = "stylesheet", n.type = "text/css", n.onerror = function() {
236
+ console.error(`Style loading failed for URL: ${e}`);
262
237
  }, document.head.appendChild(n);
263
238
  });
264
239
  },
@@ -270,13 +245,13 @@ const E = {
270
245
  * @returns 替换后的字符串
271
246
  * @throws 当对象中没有找到与占位符对应的值时,抛出错误
272
247
  */
273
- template(e, t) {
248
+ template(t, e) {
274
249
  const n = /\{ *([\w_-]+) *\}/g;
275
- return e.replace(n, (s, i) => {
276
- const r = t[i];
277
- if (r === void 0)
278
- throw new Error(`${p.JSON_VALUE_ERROR}: ${s}`);
279
- return typeof r == "function" ? r(t) : r;
250
+ return t.replace(n, (s, r) => {
251
+ const i = e[r];
252
+ if (i === void 0)
253
+ throw new Error(`${D.JSON_VALUE_ERROR}: ${s}`);
254
+ return typeof i == "function" ? i(e) : i;
280
255
  });
281
256
  },
282
257
  /**
@@ -285,18 +260,18 @@ const E = {
285
260
  * @param data 待处理的对象
286
261
  * @returns 返回处理后的对象
287
262
  */
288
- deleteEmptyProperty(e) {
263
+ deleteEmptyProperty(t) {
289
264
  return Object.fromEntries(
290
- Object.keys(e).filter((t) => !this.isEmpty(e[t])).map((t) => [t, e[t]])
265
+ Object.keys(t).filter((e) => !this.isEmpty(t[e])).map((e) => [e, t[e]])
291
266
  );
292
267
  },
293
- deepAssign(e, ...t) {
294
- (typeof e != "object" || e === null) && (e = {});
295
- for (const n of t)
268
+ deepAssign(t, ...e) {
269
+ (typeof t != "object" || t === null) && (t = {});
270
+ for (const n of e)
296
271
  if (typeof n == "object" && n !== null)
297
272
  for (const s in n)
298
- Object.prototype.hasOwnProperty.call(n, s) && (typeof n[s] == "object" && n[s] !== null ? (e[s] || (e[s] = Array.isArray(n[s]) ? [] : {}), this.deepAssign(e[s], n[s])) : e[s] = n[s]);
299
- return e;
273
+ Object.prototype.hasOwnProperty.call(n, s) && (typeof n[s] == "object" && n[s] !== null ? (t[s] || (t[s] = Array.isArray(n[s]) ? [] : {}), this.deepAssign(t[s], n[s])) : t[s] = n[s]);
274
+ return t;
300
275
  },
301
276
  /**
302
277
  * 复制文本到剪贴板
@@ -304,30 +279,39 @@ const E = {
304
279
  * @param text 要复制的文本
305
280
  * @returns 返回一个Promise,表示复制操作的结果
306
281
  */
307
- handleCopyValue(e) {
282
+ handleCopyValue(t) {
308
283
  if (navigator.clipboard && window.isSecureContext)
309
- return navigator.clipboard.writeText(e);
284
+ return navigator.clipboard.writeText(t);
310
285
  {
311
- const t = document.createElement("textarea");
312
- return t.style.position = "fixed", t.style.top = t.style.left = "-100vh", t.style.opacity = "0", t.value = e, document.body.appendChild(t), t.focus(), t.select(), new Promise((n, s) => {
286
+ const e = document.createElement("textarea");
287
+ return e.style.position = "fixed", e.style.top = e.style.left = "-100vh", e.style.opacity = "0", e.value = t, document.body.appendChild(e), e.focus(), e.select(), new Promise((n, s) => {
313
288
  try {
314
289
  document.execCommand("copy"), n();
315
290
  } catch {
316
291
  s(new Error("copy failed"));
317
292
  } finally {
318
- t.remove();
293
+ e.remove();
319
294
  }
320
295
  });
321
296
  }
297
+ },
298
+ isArray(t) {
299
+ return Array.isArray(t);
300
+ },
301
+ isObject(t) {
302
+ return Object.prototype.toString.call(t).indexOf("Object") > -1;
303
+ },
304
+ isNil(t) {
305
+ return typeof t > "u" || t === null;
322
306
  }
323
- }, g = {
307
+ }, m = {
324
308
  DEG2RAD: Math.PI / 180,
325
309
  RAD2DEG: 180 / Math.PI,
326
- randInt(e, t) {
327
- return e + Math.floor(Math.random() * (t - e + 1));
310
+ randInt(t, e) {
311
+ return t + Math.floor(Math.random() * (e - t + 1));
328
312
  },
329
- randFloat(e, t) {
330
- return e + Math.random() * (t - e);
313
+ randFloat(t, e) {
314
+ return t + Math.random() * (e - t);
331
315
  },
332
316
  /**
333
317
  * 角度转弧度
@@ -335,8 +319,8 @@ const E = {
335
319
  * @param {*} degrees
336
320
  * @returns {*}
337
321
  */
338
- degreesToRadians(e) {
339
- return e * this.DEG2RAD;
322
+ degreesToRadians(t) {
323
+ return t * this.DEG2RAD;
340
324
  },
341
325
  /**
342
326
  * 角度转弧度
@@ -344,8 +328,8 @@ const E = {
344
328
  * @param {*} degrees
345
329
  * @returns {*}
346
330
  */
347
- toRadians(e) {
348
- return e * this.DEG2RAD;
331
+ toRadians(t) {
332
+ return t * this.DEG2RAD;
349
333
  },
350
334
  /**
351
335
  * 弧度转角度
@@ -353,8 +337,8 @@ const E = {
353
337
  * @param {*} radians
354
338
  * @returns {*}
355
339
  */
356
- radiansToDegrees(e) {
357
- return e * this.RAD2DEG;
340
+ radiansToDegrees(t) {
341
+ return t * this.RAD2DEG;
358
342
  },
359
343
  /**
360
344
  * 弧度转角度
@@ -362,21 +346,21 @@ const E = {
362
346
  * @param {*} radians
363
347
  * @returns {*}
364
348
  */
365
- toDegrees(e) {
366
- return e * this.RAD2DEG;
349
+ toDegrees(t) {
350
+ return t * this.RAD2DEG;
367
351
  },
368
- formatFloat(e, t = 2) {
369
- return Math.round(e * Math.pow(10, t)) / Math.pow(10, t);
352
+ formatFloat(t, e = 2) {
353
+ return Math.round(t * Math.pow(10, e)) / Math.pow(10, e);
370
354
  }
371
355
  };
372
- class et {
373
- constructor(t) {
374
- E.getDataType(t) === "String" && (t = document.querySelector("#" + t)), this.ctx = t.getContext("2d");
356
+ class P {
357
+ constructor(e) {
358
+ y.getDataType(e) === "String" && (e = document.querySelector("#" + e)), this.ctx = e.getContext("2d");
375
359
  }
376
- drawLine(t, n, s, i, r = {}) {
360
+ drawLine(e, n, s, r, i = {}) {
377
361
  this.cxt.beginPath();
378
- const a = r.width || 1, o = r.color || "#000";
379
- this.cxt.lineWidth = a, this.cxt.fillStyle = o, this.cxt.moveTo(t, n), this.cxt.lineTo(s, i), this.cxt.closePath(), this.cxt.fill();
362
+ const a = i.width || 1, o = i.color || "#000";
363
+ this.cxt.lineWidth = a, this.cxt.fillStyle = o, this.cxt.moveTo(e, n), this.cxt.lineTo(s, r), this.cxt.closePath(), this.cxt.fill();
380
364
  }
381
365
  /**
382
366
  * 绘制圆弧
@@ -391,18 +375,18 @@ class et {
391
375
  * @param {*} bgColor 圆弧的颜色
392
376
  * @memberof CanvasDrawer
393
377
  */
394
- drawArc(t, n, s, i, r, a, o, c) {
395
- o ? (this.cxt.fillStyle = c, this.cxt.beginPath(), this.cxt.arc(t, n, s, g.degreesToRadians(i), g.degreesToRadians(r), a), this.cxt.closePath(), this.cxt.fill()) : (this.cxt.strokeStyle = c, this.cxt.beginPath(), this.cxt.arc(t, n, s, g.degreesToRadians(i), g.degreesToRadians(r), a), this.cxt.stroke());
378
+ drawArc(e, n, s, r, i, a, o, c) {
379
+ o ? (this.cxt.fillStyle = c, this.cxt.beginPath(), this.cxt.arc(e, n, s, m.degreesToRadians(r), m.degreesToRadians(i), a), this.cxt.closePath(), this.cxt.fill()) : (this.cxt.strokeStyle = c, this.cxt.beginPath(), this.cxt.arc(e, n, s, m.degreesToRadians(r), m.degreesToRadians(i), a), this.cxt.stroke());
396
380
  }
397
381
  }
398
- class nt {
399
- constructor(t = 1) {
400
- this.magnification = t;
382
+ class L {
383
+ constructor(e = 1) {
384
+ this.magnification = e;
401
385
  }
402
386
  // 获取系统类型
403
387
  _getSystem() {
404
- var t = navigator.userAgent.toLowerCase();
405
- if (t.indexOf("windows") >= 0)
388
+ var e = navigator.userAgent.toLowerCase();
389
+ if (e.indexOf("windows") >= 0)
406
390
  return !0;
407
391
  }
408
392
  // 获取页面缩放比例
@@ -410,17 +394,17 @@ class nt {
410
394
  // let t = this;
411
395
  // }
412
396
  // 监听方法兼容写法
413
- _addHandler(t, n, s) {
414
- t.addEventListener ? t.addEventListener(n, s, !1) : t.attachEvent ? t.attachEvent("on" + n, s) : t["on" + n] = s;
397
+ _addHandler(e, n, s) {
398
+ e.addEventListener ? e.addEventListener(n, s, !1) : e.attachEvent ? e.attachEvent("on" + n, s) : e["on" + n] = s;
415
399
  }
416
400
  // 校正浏览器缩放比例
417
401
  _correct() {
418
- let t = window.innerWidth;
419
- if (typeof t != "number" && (document.compatMode == "CSS1Compat" ? t = document.documentElement.clientWidth : t = document.body.clientWidth), t <= 750) {
420
- const s = document.documentElement.clientWidth / t;
402
+ let e = window.innerWidth;
403
+ if (typeof e != "number" && (document.compatMode == "CSS1Compat" ? e = document.documentElement.clientWidth : e = document.body.clientWidth), e <= 750) {
404
+ const s = document.documentElement.clientWidth / e;
421
405
  document.documentElement.style.fontSize = this.magnification * 75 * Math.min(s, 2) + "px";
422
- } else if (t > 750 && t <= 1200) {
423
- const s = document.documentElement.clientWidth / t;
406
+ } else if (e > 750 && e <= 1200) {
407
+ const s = document.documentElement.clientWidth / e;
424
408
  document.documentElement.style.fontSize = this.magnification * 85 * Math.min(s, 2) + "px";
425
409
  } else {
426
410
  const s = document.documentElement.clientWidth / 1920;
@@ -429,67 +413,67 @@ class nt {
429
413
  }
430
414
  // 监听页面缩放
431
415
  _watch() {
432
- let t = this;
433
- t._addHandler(window, "resize", function() {
434
- t._correct();
416
+ let e = this;
417
+ e._addHandler(window, "resize", function() {
418
+ e._correct();
435
419
  });
436
420
  }
437
421
  // 初始化页面比例
438
422
  init() {
439
- let t = this;
440
- t._getSystem() && (t._correct(), t._watch());
423
+ let e = this;
424
+ e._getSystem() && (e._correct(), e._watch());
441
425
  }
442
426
  }
443
- class q {
427
+ class A {
444
428
  constructor() {
445
429
  f(this, "_listeners");
446
430
  f(this, "_mutex", {});
447
431
  f(this, "_context");
448
432
  }
449
- addEventListener(t, n, s, i = !1) {
433
+ addEventListener(e, n, s, r = !1) {
450
434
  this._listeners === void 0 && (this._listeners = {}), this._context = s;
451
- const r = this._mutex, a = this._listeners;
452
- return a[t] === void 0 && (a[t] = []), a[t].indexOf(n) === -1 && (i && (r[t] = n), a[t].push(n)), this;
435
+ const i = this._mutex, a = this._listeners;
436
+ return a[e] === void 0 && (a[e] = []), a[e].indexOf(n) === -1 && (r && (i[e] = n), a[e].push(n)), this;
453
437
  }
454
- hasEventListener(t, n) {
438
+ hasEventListener(e, n) {
455
439
  if (this._listeners === null || this._listeners === void 0) return !1;
456
440
  const s = this._listeners;
457
- return s[t] !== void 0 && s[t].indexOf(n) !== -1;
441
+ return s[e] !== void 0 && s[e].indexOf(n) !== -1;
458
442
  }
459
- removeEventListener(t, n) {
443
+ removeEventListener(e, n) {
460
444
  if (this._listeners === void 0) return;
461
- const i = this._listeners[t];
462
- if (this._mutex[t] === n && (this._mutex[t] = null), i !== void 0) {
463
- const r = i.map((a) => a.toString()).indexOf(n.toString());
464
- r !== -1 && i.splice(r, 1);
445
+ const r = this._listeners[e];
446
+ if (this._mutex[e] === n && (this._mutex[e] = null), r !== void 0) {
447
+ const i = r.map((a) => a.toString()).indexOf(n.toString());
448
+ i !== -1 && r.splice(i, 1);
465
449
  }
466
450
  }
467
- dispatchEvent(t) {
451
+ dispatchEvent(e) {
468
452
  if (this._listeners === void 0) return;
469
- const s = this._listeners[t.type];
453
+ const s = this._listeners[e.type];
470
454
  if (s !== void 0) {
471
- t.target = this;
472
- const i = s.slice(0);
473
- if (this._mutex[t.type] !== void 0) {
474
- const r = i.find((a) => a === this._mutex[t.type]);
475
- if (r) {
476
- r.call(this._context || this, t);
455
+ e.target = this;
456
+ const r = s.slice(0);
457
+ if (this._mutex[e.type] !== void 0) {
458
+ const i = r.find((a) => a === this._mutex[e.type]);
459
+ if (i) {
460
+ i.call(this._context || this, e);
477
461
  return;
478
462
  }
479
463
  }
480
- for (let r = 0, a = i.length; r < a; r++) {
481
- const o = i[r];
482
- typeof o == "function" && o.call(this._context || this, t);
464
+ for (let i = 0, a = r.length; i < a; i++) {
465
+ const o = r[i];
466
+ typeof o == "function" && o.call(this._context || this, e);
483
467
  }
484
468
  }
485
469
  }
486
470
  removeAllListener() {
487
471
  this._mutex = {};
488
- for (const t in this._listeners)
489
- this._listeners[t] = [];
472
+ for (const e in this._listeners)
473
+ this._listeners[e] = [];
490
474
  }
491
475
  }
492
- class U extends Map {
476
+ class E extends Map {
493
477
  isEmpty() {
494
478
  return this.size === 0;
495
479
  }
@@ -505,13 +489,13 @@ class U extends Map {
505
489
  fromEntries() {
506
490
  }
507
491
  }
508
- U.prototype.fromEntries = function(e = []) {
509
- const t = new U();
510
- return e.forEach((n) => {
511
- Array.isArray(n) && n.length === 2 && t.set(n[0], n[1]);
512
- }), t;
492
+ E.prototype.fromEntries = function(t = []) {
493
+ const e = new E();
494
+ return t.forEach((n) => {
495
+ Array.isArray(n) && n.length === 2 && e.set(n[0], n[1]);
496
+ }), e;
513
497
  };
514
- class st extends q {
498
+ class k extends A {
515
499
  constructor(n = "ws://127.0.0.1:10088") {
516
500
  super();
517
501
  f(this, "maxCheckTimes", 10);
@@ -528,22 +512,22 @@ class st extends q {
528
512
  const n = this;
529
513
  this.client.onopen = function(s) {
530
514
  n.dispatchEvent({
531
- type: b.WEB_SOCKET_CONNECT,
515
+ type: M.WEB_SOCKET_CONNECT,
532
516
  message: s
533
517
  });
534
518
  }, this.client.onmessage = function(s) {
535
519
  n.connectStatus = !0, n.dispatchEvent({
536
- type: b.WEB_SOCKET_MESSAGE,
520
+ type: M.WEB_SOCKET_MESSAGE,
537
521
  message: s
538
522
  });
539
523
  }, this.client.onclose = function(s) {
540
524
  n.dispatchEvent({
541
- type: b.WEB_SOCKET_CLOSE,
525
+ type: M.WEB_SOCKET_CLOSE,
542
526
  message: s
543
527
  });
544
528
  }, this.checkTimes === this.maxCheckTimes && (this.client.onerror = function(s) {
545
529
  n.dispatchEvent({
546
- type: b.WEB_SOCKET_ERROR,
530
+ type: M.WEB_SOCKET_ERROR,
547
531
  message: s
548
532
  });
549
533
  });
@@ -574,107 +558,19 @@ class st extends q {
574
558
  }, 1e3);
575
559
  }
576
560
  }
577
- class rt {
578
- constructor(t = 1) {
579
- f(this, "cacheType");
580
- f(this, "storage");
581
- if (this.cacheType = t, t === 1)
582
- this.storage = window.localStorage;
583
- else if (t === 2)
584
- this.storage = window.sessionStorage;
585
- else
586
- throw new Error(p.PARAMETER_ERROR);
587
- }
588
- /**
589
- * 设置带过期时间的LocalStorage
590
- * @param key 缓存关键字
591
- * @param value 缓存对象,可以是任意类型
592
- * @param expired 以秒为单位,默认为1小时
593
- * @returns {Object}
594
- */
595
- setItem(t, n, s) {
596
- const i = { key: t, value: n };
597
- if (this.cacheType === 1) {
598
- const r = Date.now();
599
- s && (i.expired = r + s * 1e3);
600
- }
601
- return this.storage[t] = JSON.stringify(i), i;
602
- }
603
- /***
604
- * 获取带过期时间的缓存
605
- * @param key
606
- * @returns {null|*}
607
- */
608
- getItem(t) {
609
- const n = this.storage.getItem(t);
610
- if (n === null)
611
- return null;
612
- const s = JSON.parse(n) || {};
613
- if (this.cacheType === 1) {
614
- const i = s.expired ? new Date(s.expired).getTime() : Date.now();
615
- if (Date.now() > i)
616
- return this.remove(t), null;
617
- }
618
- return s.value;
619
- }
620
- /**
621
- * 移除指定缓存
622
- * @param keys
623
- */
624
- remove(t) {
625
- t && (t.indexOf(",") > -1 ? t.split(",").forEach((n) => {
626
- this.storage.removeItem(n);
627
- }) : this.storage.removeItem(t));
628
- }
629
- /**
630
- * 移出全部缓存
631
- */
632
- clear() {
633
- this.storage.clear();
634
- }
635
- }
636
- const it = {
637
- /**
638
- * 多属性的动画函数
639
- * @param {*} ele 需要运动的节点
640
- * @param {*} attr_options 传入的是一个需要运动的属性包括运动的目标值,操作的节点属性
641
- * @param {*} timefn 运动的形式,默认是缓冲运动
642
- * @param {*} speed 运动的速度
643
- */
644
- animate(e, t, n, s = "swing", i = 5) {
645
- for (var r in t)
646
- t[r] = {
647
- target: r === "opacity" ? parseInt(t[r] * 100) : t[r],
648
- // 需要计算得到
649
- iNow: parseInt(r === "opacity" ? getComputedStyle(e)[r] * 100 : getComputedStyle(e)[r])
650
- };
651
- s === "liner" && (i = t[r].iNow < t[r].target ? Math.abs(i) : -Math.abs(i)), clearInterval(e.timer), e.timer = setInterval(function() {
652
- for (var a in t) {
653
- var o = t[a].target, c = t[a].iNow;
654
- if (s === "swing" && (i = (o - c) / 20, i = i > 0 ? Math.ceil(i) : Math.floor(i)), Math.abs(o - c) <= Math.abs(i)) {
655
- a === "opacity" ? e.style[a] = o / 100 : e.style[a] = o + "px", delete t[a];
656
- for (var l in t)
657
- return !1;
658
- clearInterval(e.timer), typeof n == "function" && n();
659
- } else
660
- t[a].iNow += i, a === "opacity" ? e.style[a] = t[a].iNow / 100 : e.style[a] = t[a].iNow + "px";
661
- }
662
- }, 30);
663
- }
664
- };
665
- Array.prototype.groupBy = function(e) {
666
- var t = {};
561
+ Array.prototype.groupBy = function(t) {
562
+ var e = {};
667
563
  return this.forEach(function(n) {
668
- var s = JSON.stringify(e(n));
669
- t[s] = t[s] || [], t[s].push(n);
670
- }), Object.keys(t).map((n) => t[n]);
564
+ var s = JSON.stringify(t(n));
565
+ e[s] = e[s] || [], e[s].push(n);
566
+ }), Object.keys(e).map((n) => e[n]);
671
567
  };
672
- Array.prototype.distinct = function(e = (t) => t) {
673
- const t = [], n = {};
568
+ Array.prototype.distinct = function(t = (e) => e) {
569
+ const e = [], n = {};
674
570
  return this.forEach((s) => {
675
- const i = e(s), r = String(i);
676
- n[r] || (n[r] = !0, t.push(s));
677
- }), t;
571
+ const r = t(s), i = String(r);
572
+ n[i] || (n[i] = !0, e.push(s));
573
+ }), e;
678
574
  };
679
575
  Array.prototype.max = function() {
680
576
  return Math.max.apply({}, this);
@@ -683,78 +579,78 @@ Array.prototype.min = function() {
683
579
  return Math.min.apply({}, this);
684
580
  };
685
581
  Array.prototype.sum = function() {
686
- return this.length > 0 ? this.reduce((e = 0, t = 0) => e + t) : 0;
582
+ return this.length > 0 ? this.reduce((t = 0, e = 0) => t + e) : 0;
687
583
  };
688
584
  Array.prototype.avg = function() {
689
585
  return this.length ? this.sum() / this.length : 0;
690
586
  };
691
- Array.prototype.desc = function(e = (t) => t) {
692
- return this.sort((t, n) => e(n) - e(t));
587
+ Array.prototype.desc = function(t = (e) => e) {
588
+ return this.sort((e, n) => t(n) - t(e));
693
589
  };
694
- Array.prototype.asc = function(e = (t) => t) {
695
- return this.sort((t, n) => e(t) - e(n));
590
+ Array.prototype.asc = function(t = (e) => e) {
591
+ return this.sort((e, n) => t(e) - t(n));
696
592
  };
697
593
  Array.prototype.clear = function() {
698
594
  return this.length = 0, this;
699
595
  };
700
- const at = {
701
- asArray(e) {
702
- return E.isEmpty(e) ? [] : Array.isArray(e) ? e : [e];
703
- },
704
- generateArray(e) {
705
- return [...new Array(e).keys()];
706
- },
707
- union(...e) {
708
- let t = [];
709
- return e.forEach((n) => {
710
- Array.isArray(n) && (t = t.concat(n.filter((s) => !t.includes(s))));
711
- }), t;
712
- },
713
- intersection(...e) {
714
- let t = e[0] || [];
715
- return e.forEach((n) => {
716
- Array.isArray(n) && (t = t.filter((s) => n.includes(s)));
717
- }), t;
718
- },
719
- unionAll(...e) {
720
- return [...e].flat().filter((t) => !!t);
721
- },
722
- difference(...e) {
723
- return this.union(...e).filter((t) => !this.intersection(...e).includes(t));
724
- }
725
- }, ot = {
596
+ const U = {
597
+ asArray(t) {
598
+ return y.isEmpty(t) ? [] : Array.isArray(t) ? t : [t];
599
+ },
600
+ generateArray(t) {
601
+ return [...new Array(t).keys()];
602
+ },
726
603
  /**
727
- * 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
604
+ * 合并多个数组,并去重
728
605
  *
729
- * @param href 需要解析的 URL 链接,默认为当前窗口的 URL
730
- * @param needDecode 是否需要解码参数值,默认为 true
731
- * @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
606
+ * @param args 需要合并的数组
607
+ * @returns 合并后的去重数组
732
608
  */
733
- getUrlParams(e = window.location.href, t = !0) {
734
- const n = /([^&=]+)=([\w\W]*?)(&|$|#)/g, { search: s, hash: i } = new URL(e), r = [s, i];
735
- let a = {};
736
- for (let o = 0; o < r.length; o++) {
737
- const c = r[o];
738
- if (c) {
739
- const h = c.replace(/#|\//g, "").split("?");
740
- if (h.length > 1)
741
- for (let u = 1; u < h.length; u++) {
742
- let d;
743
- for (; d = n.exec(h[u]); )
744
- a[d[1]] = t ? decodeURIComponent(d[2]) : d[2];
745
- }
746
- }
747
- }
748
- return a;
609
+ union(...t) {
610
+ let e = [];
611
+ return t.forEach((n) => {
612
+ Array.isArray(n) && (e = e.concat(n.filter((s) => !e.includes(s))));
613
+ }), e;
614
+ },
615
+ /**
616
+ * 求多个数组的交集
617
+ *
618
+ * @param args 多个需要求交集的数组
619
+ * @returns 返回多个数组的交集数组
620
+ */
621
+ intersection(...t) {
622
+ let e = t[0] || [];
623
+ return t.forEach((n) => {
624
+ Array.isArray(n) && (e = e.filter((s) => n.includes(s)));
625
+ }), e;
749
626
  },
627
+ /**
628
+ * 将多个数组拼接为一个数组,并去除其中的空值。
629
+ *
630
+ * @param args 需要拼接的数组列表。
631
+ * @returns 拼接并去空后的数组。
632
+ */
633
+ unionAll(...t) {
634
+ return [...t].flat().filter((e) => !!e);
635
+ },
636
+ /**
637
+ * 求差集
638
+ *
639
+ * @param args 任意个集合
640
+ * @returns 返回差集结果
641
+ */
642
+ difference(...t) {
643
+ return this.union(...t).filter((e) => !this.intersection(...t).includes(e));
644
+ }
645
+ }, N = {
750
646
  /**
751
647
  * 获取浏览器类型
752
648
  *
753
649
  * @returns 返回浏览器类型字符串,可能的值为 'IE'、'Firefox'、'Chrome'、'Opera'、'Safari' 或 'Unknown'
754
650
  */
755
651
  getExplorer() {
756
- var e = window.navigator.userAgent;
757
- return e.indexOf("MSIE") >= 0 || /Trident\//.test(e) ? "IE" : e.indexOf("Firefox") >= 0 ? "Firefox" : e.indexOf("Chrome") >= 0 ? "Chrome" : e.indexOf("Opera") >= 0 ? "Opera" : e.indexOf("Safari") >= 0 && e.indexOf("Chrome") === -1 ? "Safari" : "Unknown";
652
+ var t = window.navigator.userAgent;
653
+ return t.indexOf("MSIE") >= 0 || /Trident\//.test(t) ? "IE" : t.indexOf("Firefox") >= 0 ? "Firefox" : t.indexOf("Chrome") >= 0 ? "Chrome" : t.indexOf("Opera") >= 0 ? "Opera" : t.indexOf("Safari") >= 0 && t.indexOf("Chrome") === -1 ? "Safari" : "Unknown";
758
654
  },
759
655
  /**
760
656
  * 检测操作系统类型
@@ -762,19 +658,19 @@ const at = {
762
658
  * @returns 返回操作系统类型字符串,可能的值有:'MS Windows'、'Apple mac'、'Linux'、'Unix'
763
659
  */
764
660
  detectOS() {
765
- let e = "";
766
- const t = navigator.userAgent.indexOf("Windows", 0) != -1 ? 1 : 0, n = navigator.userAgent.indexOf("mac", 0) != -1 ? 1 : 0, s = navigator.userAgent.indexOf("Linux", 0) != -1 ? 1 : 0, i = navigator.userAgent.indexOf("X11", 0) != -1 ? 1 : 0;
767
- return t ? e = "MS Windows" : n ? e = "Apple mac" : s ? e = "Linux" : i && (e = "Unix"), e;
661
+ let t = "";
662
+ const e = navigator.userAgent.indexOf("Windows", 0) != -1 ? 1 : 0, n = navigator.userAgent.indexOf("mac", 0) != -1 ? 1 : 0, s = navigator.userAgent.indexOf("Linux", 0) != -1 ? 1 : 0, r = navigator.userAgent.indexOf("X11", 0) != -1 ? 1 : 0;
663
+ return e ? t = "MS Windows" : n ? t = "Apple mac" : s ? t = "Linux" : r && (t = "Unix"), t;
768
664
  },
769
665
  /**
770
666
  * 切换全屏状态
771
667
  *
772
668
  * @param status 是否全屏
773
669
  */
774
- switchFullScreen(e) {
775
- if (e) {
776
- const t = document.documentElement;
777
- t.requestFullscreen ? t.requestFullscreen() : "msRequestFullscreen" in t ? t.msRequestFullscreen() : "mozRequestFullScreen" in t ? t.mozRequestFullScreen() : "webkitRequestFullscreen" in t && t.webkitRequestFullscreen();
670
+ switchFullScreen(t) {
671
+ if (t) {
672
+ const e = document.documentElement;
673
+ e.requestFullscreen ? e.requestFullscreen() : "msRequestFullscreen" in e ? e.msRequestFullscreen() : "mozRequestFullScreen" in e ? e.mozRequestFullScreen() : "webkitRequestFullscreen" in e && e.webkitRequestFullscreen();
778
674
  } else
779
675
  document.exitFullscreen ? document.exitFullscreen() : "msExitFullscreen" in document ? document.msExitFullscreen() : "mozCancelFullScreen" in document ? document.mozCancelFullScreen() : "webkitExitFullscreen" in document && document.webkitExitFullscreen();
780
676
  },
@@ -784,11 +680,11 @@ const at = {
784
680
  * @returns 无返回值
785
681
  */
786
682
  refreshScale() {
787
- const e = document.documentElement.clientWidth || 0, t = document.documentElement.clientHeight || 0, n = document.getElementById("app");
683
+ const t = document.documentElement.clientWidth || 0, e = document.documentElement.clientHeight || 0, n = document.getElementById("app");
788
684
  if (!n) return;
789
- const s = n.style, i = e / t, r = 16 / 9;
790
- let a = e / 1920;
791
- i > r && (a = t / 1080), s.transformOrigin = "left top", s.transform = `scale(${a}) translateX(-49.99%)`, s.width = `${e / a}px`;
685
+ const s = n.style, r = t / e, i = 16 / 9;
686
+ let a = t / 1920;
687
+ r > i && (a = e / 1080), s.transformOrigin = "left top", s.transform = `scale(${a}) translateX(-49.99%)`, s.width = `${t / a}px`;
792
688
  },
793
689
  /**
794
690
  * 获取HTML字体大小
@@ -796,110 +692,177 @@ const at = {
796
692
  * @returns 无返回值,该函数会直接修改HTML元素的字体大小
797
693
  */
798
694
  getHtmlFontSize() {
799
- const e = document.documentElement.clientWidth || document.body.clientWidth, t = document.querySelector("html");
800
- t && (t.style.fontSize = e / 192 + "px");
695
+ const t = document.documentElement.clientWidth || document.body.clientWidth, e = document.querySelector("html");
696
+ e && (e.style.fontSize = t / 192 + "px");
801
697
  }
802
- }, ct = {
803
- set: function(e, t, n = 30) {
698
+ }, F = {
699
+ set: function(t, e, n = 30) {
804
700
  var s = /* @__PURE__ */ new Date();
805
- s.setTime(s.getTime() + n * 24 * 60 * 60 * 1e3), document.cookie = e + "=" + escape(t) + ";expires=" + s.toUTCString();
701
+ s.setTime(s.getTime() + n * 24 * 60 * 60 * 1e3), document.cookie = t + "=" + escape(e) + ";expires=" + s.toUTCString();
806
702
  },
807
- remove: function(e) {
808
- var t = /* @__PURE__ */ new Date();
809
- t.setTime(t.getTime() - 1);
810
- var n = this.get(e);
811
- n != null && (document.cookie = e + "=" + n + ";expires=" + t.toUTCString());
703
+ remove: function(t) {
704
+ var e = /* @__PURE__ */ new Date();
705
+ e.setTime(e.getTime() - 1);
706
+ var n = this.get(t);
707
+ n != null && (document.cookie = t + "=" + n + ";expires=" + e.toUTCString());
812
708
  },
813
- get: function(e) {
814
- var t = document.cookie.match(new RegExp("(^| )" + e + "=([^;]*)(;|$)"));
815
- return t != null ? t[2] : "";
709
+ get: function(t) {
710
+ var e = document.cookie.match(new RegExp("(^| )" + t + "=([^;]*)(;|$)"));
711
+ return e != null ? e[2] : "";
816
712
  }
817
- }, lt = {
713
+ }, $ = {
818
714
  PI: 3.141592653589793,
819
715
  XPI: 3.141592653589793 * 3e3 / 180,
820
- delta(e, t) {
716
+ delta(t, e) {
821
717
  const s = 0.006693421622965943;
822
- let i = this.transformLat(t - 105, e - 35), r = this.transformLon(t - 105, e - 35);
823
- const a = e / 180 * this.PI;
718
+ let r = this.transformLat(e - 105, t - 35), i = this.transformLon(e - 105, t - 35);
719
+ const a = t / 180 * this.PI;
824
720
  let o = Math.sin(a);
825
721
  o = 1 - s * o * o;
826
722
  const c = Math.sqrt(o);
827
- return i = i * 180 / (6378245 * (1 - s) / (o * c) * this.PI), r = r * 180 / (6378245 / c * Math.cos(a) * this.PI), { lat: i, lng: r };
723
+ return r = r * 180 / (6378245 * (1 - s) / (o * c) * this.PI), i = i * 180 / (6378245 / c * Math.cos(a) * this.PI), { lat: r, lng: i };
828
724
  },
829
725
  // WGS-84 to GCJ-02
830
- gcjEncrypt(e, t) {
831
- if (this.outOfChina(e, t))
832
- return { lat: e, lng: t };
833
- const n = this.delta(e, t);
834
- return { lat: e + n.lat, lng: t + n.lng };
726
+ gcjEncrypt(t, e) {
727
+ if (this.outOfChina(t, e))
728
+ return { lat: t, lng: e };
729
+ const n = this.delta(t, e);
730
+ return { lat: t + n.lat, lng: e + n.lng };
835
731
  },
836
732
  // GCJ-02 to WGS-84
837
- gcjDecrypt(e, t) {
838
- if (this.outOfChina(e, t))
839
- return { lat: e, lng: t };
840
- const n = this.delta(e, t);
841
- return { lat: e - n.lat, lng: t - n.lng };
733
+ gcjDecrypt(t, e) {
734
+ if (this.outOfChina(t, e))
735
+ return { lat: t, lng: e };
736
+ const n = this.delta(t, e);
737
+ return { lat: t - n.lat, lng: e - n.lng };
842
738
  },
843
739
  // GCJ-02 to WGS-84 exactly
844
- gcjDecryptExact(e, t) {
845
- let i = 0.01, r = 0.01, a = e - i, o = t - r, c = e + i, l = t + r, h = 0, u = 0, d = 0;
740
+ gcjDecryptExact(t, e) {
741
+ let r = 0.01, i = 0.01, a = t - r, o = e - i, c = t + r, l = e + i, h = 0, u = 0, d = 0;
846
742
  for (; ; ) {
847
743
  h = (a + c) / 2, u = (o + l) / 2;
848
- const R = this.gcjEncrypt(h, u);
849
- if (i = R.lat - e, r = R.lng - t, Math.abs(i) < 1e-9 && Math.abs(r) < 1e-9 || (i > 0 ? c = h : a = h, r > 0 ? l = u : o = u, ++d > 1e4)) break;
744
+ const g = this.gcjEncrypt(h, u);
745
+ if (r = g.lat - t, i = g.lng - e, Math.abs(r) < 1e-9 && Math.abs(i) < 1e-9 || (r > 0 ? c = h : a = h, i > 0 ? l = u : o = u, ++d > 1e4)) break;
850
746
  }
851
747
  return { lat: h, lng: u };
852
748
  },
853
749
  // GCJ-02 to BD-09
854
- bdEncrypt(e, t) {
855
- const n = t, s = e, i = Math.sqrt(n * n + s * s) + 2e-5 * Math.sin(s * this.XPI), r = Math.atan2(s, n) + 3e-6 * Math.cos(n * this.XPI), a = i * Math.cos(r) + 65e-4;
856
- return { lat: i * Math.sin(r) + 6e-3, lng: a };
750
+ bdEncrypt(t, e) {
751
+ const n = e, s = t, r = Math.sqrt(n * n + s * s) + 2e-5 * Math.sin(s * this.XPI), i = Math.atan2(s, n) + 3e-6 * Math.cos(n * this.XPI), a = r * Math.cos(i) + 65e-4;
752
+ return { lat: r * Math.sin(i) + 6e-3, lng: a };
857
753
  },
858
754
  // BD-09 to GCJ-02
859
- bdDecrypt(e, t) {
860
- const n = t - 65e-4, s = e - 6e-3, i = Math.sqrt(n * n + s * s) - 2e-5 * Math.sin(s * this.XPI), r = Math.atan2(s, n) - 3e-6 * Math.cos(n * this.XPI), a = i * Math.cos(r);
861
- return { lat: i * Math.sin(r), lng: a };
755
+ bdDecrypt(t, e) {
756
+ const n = e - 65e-4, s = t - 6e-3, r = Math.sqrt(n * n + s * s) - 2e-5 * Math.sin(s * this.XPI), i = Math.atan2(s, n) - 3e-6 * Math.cos(n * this.XPI), a = r * Math.cos(i);
757
+ return { lat: r * Math.sin(i), lng: a };
862
758
  },
863
759
  // WGS-84 to Web mercator
864
760
  // mercatorLat -> y mercatorLon -> x
865
- mercatorEncrypt(e, t) {
866
- const n = t * 2003750834e-2 / 180;
867
- let s = Math.log(Math.tan((90 + e) * this.PI / 360)) / (this.PI / 180);
761
+ mercatorEncrypt(t, e) {
762
+ const n = e * 2003750834e-2 / 180;
763
+ let s = Math.log(Math.tan((90 + t) * this.PI / 360)) / (this.PI / 180);
868
764
  return s = s * 2003750834e-2 / 180, { lat: s, lng: n };
869
765
  },
870
766
  // Web mercator to WGS-84
871
767
  // mercatorLat -> y mercatorLon -> x
872
- mercatorDecrypt(e, t) {
873
- const n = t / 2003750834e-2 * 180;
874
- let s = e / 2003750834e-2 * 180;
768
+ mercatorDecrypt(t, e) {
769
+ const n = e / 2003750834e-2 * 180;
770
+ let s = t / 2003750834e-2 * 180;
875
771
  return s = 180 / this.PI * (2 * Math.atan(Math.exp(s * this.PI / 180)) - this.PI / 2), { lat: s, lng: n };
876
772
  },
877
- // two point's distance
878
- distance(e, t, n, s) {
879
- const r = Math.cos(e * this.PI / 180) * Math.cos(n * this.PI / 180) * Math.cos((t - s) * this.PI / 180), a = Math.sin(e * this.PI / 180) * Math.sin(n * this.PI / 180);
880
- let o = r + a;
881
- return o > 1 && (o = 1), o < -1 && (o = -1), Math.acos(o) * 6371e3;
773
+ transformLat(t, e) {
774
+ let n = -100 + 2 * t + 3 * e + 0.2 * e * e + 0.1 * t * e + 0.2 * Math.sqrt(Math.abs(t));
775
+ return n += (20 * Math.sin(6 * t * this.PI) + 20 * Math.sin(2 * t * this.PI)) * 2 / 3, n += (20 * Math.sin(e * this.PI) + 40 * Math.sin(e / 3 * this.PI)) * 2 / 3, n += (160 * Math.sin(e / 12 * this.PI) + 320 * Math.sin(e * this.PI / 30)) * 2 / 3, n;
882
776
  },
883
- outOfChina(e, t) {
884
- return t < 72.004 || t > 137.8347 || e < 0.8293 || e > 55.8271;
885
- },
886
- transformLat(e, t) {
887
- let n = -100 + 2 * e + 3 * t + 0.2 * t * t + 0.1 * e * t + 0.2 * Math.sqrt(Math.abs(e));
888
- return n += (20 * Math.sin(6 * e * this.PI) + 20 * Math.sin(2 * e * this.PI)) * 2 / 3, n += (20 * Math.sin(t * this.PI) + 40 * Math.sin(t / 3 * this.PI)) * 2 / 3, n += (160 * Math.sin(t / 12 * this.PI) + 320 * Math.sin(t * this.PI / 30)) * 2 / 3, n;
777
+ transformLon(t, e) {
778
+ let n = 300 + t + 2 * e + 0.1 * t * t + 0.1 * t * e + 0.1 * Math.sqrt(Math.abs(t));
779
+ return n += (20 * Math.sin(6 * t * this.PI) + 20 * Math.sin(2 * t * this.PI)) * 2 / 3, n += (20 * Math.sin(t * this.PI) + 40 * Math.sin(t / 3 * this.PI)) * 2 / 3, n += (150 * Math.sin(t / 12 * this.PI) + 300 * Math.sin(t / 30 * this.PI)) * 2 / 3, n;
889
780
  },
890
- transformLon(e, t) {
891
- let n = 300 + e + 2 * t + 0.1 * e * e + 0.1 * e * t + 0.1 * Math.sqrt(Math.abs(e));
892
- return n += (20 * Math.sin(6 * e * this.PI) + 20 * Math.sin(2 * e * this.PI)) * 2 / 3, n += (20 * Math.sin(e * this.PI) + 40 * Math.sin(e / 3 * this.PI)) * 2 / 3, n += (150 * Math.sin(e / 12 * this.PI) + 300 * Math.sin(e / 30 * this.PI)) * 2 / 3, n;
893
- },
894
- randomCoordinate(e, t, n, s) {
781
+ randomCoordinate(t, e, n, s) {
895
782
  return {
896
- lat: Math.random() * (s - t) + t,
897
- lng: Math.random() * (n - e) + e
783
+ lat: Math.random() * (s - e) + e,
784
+ lng: Math.random() * (n - t) + t
898
785
  };
899
786
  }
787
+ }, B = {
788
+ /**
789
+ * 将RGB颜色值转换为十六进制颜色值
790
+ *
791
+ * @param rgb RGB颜色值数组,包含三个0-255之间的整数
792
+ * @returns 转换后的十六进制颜色值,以#开头
793
+ */
794
+ rgb2hex(t) {
795
+ var e = "#" + (16777216 + (t[0] << 16) + (t[1] << 8) + t[2]).toString(16).slice(1);
796
+ return e;
797
+ },
798
+ /**
799
+ * 将RGB颜色值转换为RGBA颜色值,并返回转换后的颜色值。
800
+ *
801
+ * @param rgbValue RGB颜色值,格式为"rgb(r, g, b)"。
802
+ * @returns 转换后的RGBA颜色值,格式为"rgba(r, g, b, 1)"。如果输入值不符合RGB格式,则返回原值。
803
+ */
804
+ rgbToRgba(t) {
805
+ const e = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);
806
+ return e ? `rgba(${e[1]}, 1)` : t;
807
+ },
808
+ /**
809
+ * 将十六进制颜色值转换为rgba格式的颜色值
810
+ *
811
+ * @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
812
+ * @returns 返回rgba格式的颜色值,格式为rgba(r,g,b,1)
813
+ */
814
+ hexToRgba(t) {
815
+ const e = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, n = t.replace(e, (c, l, h, u) => l + l + h + h + u + u), r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);
816
+ if (!r)
817
+ return t;
818
+ const i = parseInt(r[1], 16), a = parseInt(r[2], 16), o = parseInt(r[3], 16);
819
+ return `rgba(${i},${a},${o},1)`;
820
+ },
821
+ /**
822
+ * 将 HSL 颜色值转换为 RGBA 颜色值
823
+ *
824
+ * @param hslValue HSL 颜色值字符串,格式为 "hsl(h, s%, l%)" 或 "hsla(h, s%, l%, a)",其中 h 为色相,s 为饱和度,l 为亮度,a 为透明度(可选)。
825
+ * @returns 转换后的 RGBA 颜色值字符串,格式为 "rgba(r, g, b, a)",其中 r、g、b 为红绿蓝分量,a 为透明度。若输入为空或无效,则返回 null。
826
+ */
827
+ hslToRgba(t) {
828
+ if (!t)
829
+ return null;
830
+ const e = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);
831
+ if (!e)
832
+ return null;
833
+ const n = parseInt(e[1], 10) / 360, s = parseInt(e[2], 10) / 100, r = parseInt(e[3], 10) / 100, i = e[4] ? parseFloat(e[4]) : 1;
834
+ function a(h, u, d) {
835
+ return d < 0 && (d += 1), d > 1 && (d -= 1), d < 1 / 6 ? h + (u - h) * 6 * d : d < 1 / 2 ? u : d < 2 / 3 ? h + (u - h) * (2 / 3 - d) * 6 : h;
836
+ }
837
+ let o, c, l;
838
+ if (s === 0)
839
+ o = c = l = r;
840
+ else {
841
+ const h = r < 0.5 ? r * (1 + s) : r + s - r * s, u = 2 * r - h;
842
+ o = a(u, h, n + 1 / 3), c = a(u, h, n), l = a(u, h, n - 1 / 3);
843
+ }
844
+ return `rgba(${Math.round(o * 255)},${Math.round(c * 255)},${Math.round(l * 255)},${i})`;
845
+ },
846
+ isHex(t) {
847
+ return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);
848
+ },
849
+ isRgb(t) {
850
+ return /^rgb/.test(t);
851
+ },
852
+ isHsl(t) {
853
+ return /^hsl/.test(t);
854
+ },
855
+ isColor(t) {
856
+ return this.isHex(t) || this.isRgb(t) || this.isHsl(t);
857
+ },
858
+ colorToRgb(t) {
859
+ if (this.isRgb(t)) return this.rgbToRgba(t);
860
+ if (this.isHex(t)) return this.hexToRgba(t);
861
+ if (this.isHsl(t)) return this.hslToRgba(t);
862
+ }
900
863
  };
901
- Date.prototype.format = function(e) {
902
- const t = {
864
+ Date.prototype.format = function(t) {
865
+ const e = {
903
866
  "M+": this.getMonth() + 1,
904
867
  // 月份
905
868
  "d+": this.getDate(),
@@ -917,48 +880,48 @@ Date.prototype.format = function(e) {
917
880
  S: this.getMilliseconds()
918
881
  // 毫秒
919
882
  };
920
- /(y+)/.test(e) && (e = e.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)));
921
- for (const n in t)
922
- if (new RegExp("(" + n + ")").test(e)) {
883
+ /(y+)/.test(t) && (t = t.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)));
884
+ for (const n in e)
885
+ if (new RegExp("(" + n + ")").test(t)) {
923
886
  const s = n.length === 1 ? 1 : Number(n.slice(1));
924
- e = e.replace(RegExp.$1, ("00" + t[n]).substr(("" + t[n]).length + s - (t[n] + "").length));
887
+ t = t.replace(RegExp.$1, ("00" + e[n]).substr(("" + e[n]).length + s - (e[n] + "").length));
925
888
  }
926
- return e;
889
+ return t;
927
890
  };
928
- Date.prototype.addDate = function(e, t) {
891
+ Date.prototype.addDate = function(t, e) {
929
892
  const n = new Date(this);
930
- switch (e) {
893
+ switch (t) {
931
894
  case "y":
932
- n.setFullYear(this.getFullYear() + t);
895
+ n.setFullYear(this.getFullYear() + e);
933
896
  break;
934
897
  case "q":
935
- n.setMonth(this.getMonth() + t * 3);
898
+ n.setMonth(this.getMonth() + e * 3);
936
899
  break;
937
900
  case "M":
938
- n.setMonth(this.getMonth() + t);
901
+ n.setMonth(this.getMonth() + e);
939
902
  break;
940
903
  case "w":
941
- n.setDate(this.getDate() + t * 7);
904
+ n.setDate(this.getDate() + e * 7);
942
905
  break;
943
906
  case "d":
944
- n.setDate(this.getDate() + t);
907
+ n.setDate(this.getDate() + e);
945
908
  break;
946
909
  case "h":
947
- n.setHours(this.getHours() + t);
910
+ n.setHours(this.getHours() + e);
948
911
  break;
949
912
  case "m":
950
- n.setMinutes(this.getMinutes() + t);
913
+ n.setMinutes(this.getMinutes() + e);
951
914
  break;
952
915
  case "s":
953
- n.setSeconds(this.getSeconds() + t);
916
+ n.setSeconds(this.getSeconds() + e);
954
917
  break;
955
918
  default:
956
- n.setDate(this.getDate() + t);
919
+ n.setDate(this.getDate() + e);
957
920
  break;
958
921
  }
959
922
  return n;
960
923
  };
961
- const ht = {
924
+ const W = {
962
925
  lastMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1),
963
926
  thisMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
964
927
  nextMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1),
@@ -968,28 +931,28 @@ const ht = {
968
931
  lastDayDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() - 1),
969
932
  thisDayDate: new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)),
970
933
  nextDayDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1),
971
- parseDate(e) {
972
- if (typeof e == "string") {
973
- var t = e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
974
- if (t && t.length > 3) return new Date(parseInt(t[1]), parseInt(t[2]) - 1, parseInt(t[3]));
975
- if (t = e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/), t && t.length > 6)
934
+ parseDate(t) {
935
+ if (typeof t == "string") {
936
+ var e = t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
937
+ if (e && e.length > 3) return new Date(parseInt(e[1]), parseInt(e[2]) - 1, parseInt(e[3]));
938
+ if (e = t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/), e && e.length > 6)
976
939
  return new Date(
977
- parseInt(t[1]),
978
- parseInt(t[2]) - 1,
979
- parseInt(t[3]),
980
- parseInt(t[4]),
981
- parseInt(t[5]),
982
- parseInt(t[6])
940
+ parseInt(e[1]),
941
+ parseInt(e[2]) - 1,
942
+ parseInt(e[3]),
943
+ parseInt(e[4]),
944
+ parseInt(e[5]),
945
+ parseInt(e[6])
983
946
  );
984
- if (t = e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/), t && t.length > 7)
947
+ if (e = t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/), e && e.length > 7)
985
948
  return new Date(
986
- parseInt(t[1]),
987
- parseInt(t[2]) - 1,
988
- parseInt(t[3]),
989
- parseInt(t[4]),
990
- parseInt(t[5]),
991
- parseInt(t[6]),
992
- parseInt(t[7])
949
+ parseInt(e[1]),
950
+ parseInt(e[2]) - 1,
951
+ parseInt(e[3]),
952
+ parseInt(e[4]),
953
+ parseInt(e[5]),
954
+ parseInt(e[6]),
955
+ parseInt(e[7])
993
956
  );
994
957
  }
995
958
  return null;
@@ -1001,27 +964,27 @@ const ht = {
1001
964
  * @param {*} endTime
1002
965
  * @returns {*}
1003
966
  */
1004
- formatDateInterval(e, t) {
1005
- const n = new Date(e), i = new Date(t).getTime() - n.getTime(), r = Math.floor(i / (24 * 3600 * 1e3)), a = i % (24 * 3600 * 1e3), o = Math.floor(a / (3600 * 1e3)), c = a % (3600 * 1e3), l = Math.floor(c / (60 * 1e3)), h = c % (60 * 1e3), u = Math.round(h / 1e3);
967
+ formatDateInterval(t, e) {
968
+ const n = new Date(t), r = new Date(e).getTime() - n.getTime(), i = Math.floor(r / (24 * 3600 * 1e3)), a = r % (24 * 3600 * 1e3), o = Math.floor(a / (3600 * 1e3)), c = a % (3600 * 1e3), l = Math.floor(c / (60 * 1e3)), h = c % (60 * 1e3), u = Math.round(h / 1e3);
1006
969
  let d = "";
1007
- return r > 0 && (d += r + "天"), o > 0 && (d += o + "时"), l > 0 && (d += l + "分"), u > 0 && (d += u + "秒"), r === 0 && o === 0 && l === 0 && u === 0 && (d = "少于1秒"), d;
970
+ return i > 0 && (d += i + "天"), o > 0 && (d += o + "时"), l > 0 && (d += l + "分"), u > 0 && (d += u + "秒"), i === 0 && o === 0 && l === 0 && u === 0 && (d = "少于1秒"), d;
1008
971
  },
1009
- formatterCounter(e) {
1010
- const t = function(o) {
972
+ formatterCounter(t) {
973
+ const e = function(o) {
1011
974
  return (o > 10 ? "" : "0") + (o || 0);
1012
- }, n = t(Math.floor(e / 3600)), s = e % 3600, i = t(Math.floor(s / 60)), r = s % 60, a = t(Math.round(r));
1013
- return `${n}:${i}:${a}`;
975
+ }, n = e(Math.floor(t / 3600)), s = t % 3600, r = e(Math.floor(s / 60)), i = s % 60, a = e(Math.round(i));
976
+ return `${n}:${r}:${a}`;
1014
977
  },
1015
- sleep(e) {
978
+ sleep(t) {
1016
979
  }
1017
980
  };
1018
- function Y(e) {
1019
- return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "");
981
+ function O(t) {
982
+ return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
1020
983
  }
1021
- function F(e) {
1022
- return Y(e).split(/\s+/);
984
+ function R(t) {
985
+ return O(t).split(/\s+/);
1023
986
  }
1024
- const ut = {
987
+ const q = {
1025
988
  /**
1026
989
  * 获取元素的样式值
1027
990
  *
@@ -1029,12 +992,12 @@ const ut = {
1029
992
  * @param style 样式属性名称
1030
993
  * @returns 元素的样式值,如果获取不到则返回 null
1031
994
  */
1032
- getStyle(e, t) {
995
+ getStyle(t, e) {
1033
996
  var s;
1034
- let n = e.style[t];
997
+ let n = t.style[e];
1035
998
  if (!n || n === "auto") {
1036
- const i = (s = document.defaultView) == null ? void 0 : s.getComputedStyle(e, null);
1037
- n = i ? i[t] : null, n === "auto" && (n = null);
999
+ const r = (s = document.defaultView) == null ? void 0 : s.getComputedStyle(t, null);
1000
+ n = r ? r[e] : null, n === "auto" && (n = null);
1038
1001
  }
1039
1002
  return n;
1040
1003
  },
@@ -1046,45 +1009,45 @@ const ut = {
1046
1009
  * @param container 父容器,若传入,则新创建的元素会被添加到该容器中
1047
1010
  * @returns 返回新创建的HTML元素
1048
1011
  */
1049
- create(e, t, n) {
1050
- const s = document.createElement(e);
1051
- return s.className = t || "", n && n.appendChild(s), s;
1012
+ create(t, e, n) {
1013
+ const s = document.createElement(t);
1014
+ return s.className = e || "", n && n.appendChild(s), s;
1052
1015
  },
1053
1016
  /**
1054
1017
  * 从父节点中移除指定元素。
1055
1018
  *
1056
1019
  * @param el 要移除的元素对象,必须包含parentNode属性。
1057
1020
  */
1058
- remove(e) {
1059
- const t = e.parentNode;
1060
- t && t.removeChild(e);
1021
+ remove(t) {
1022
+ const e = t.parentNode;
1023
+ e && e.removeChild(t);
1061
1024
  },
1062
1025
  /**
1063
1026
  * 清空给定元素的子节点
1064
1027
  *
1065
1028
  * @param el 要清空子节点的元素,包含firstChild和removeChild属性
1066
1029
  */
1067
- empty(e) {
1068
- for (; e.firstChild; )
1069
- e.removeChild(e.firstChild);
1030
+ empty(t) {
1031
+ for (; t.firstChild; )
1032
+ t.removeChild(t.firstChild);
1070
1033
  },
1071
1034
  /**
1072
1035
  * 将元素移到父节点的最前面
1073
1036
  *
1074
1037
  * @param el 要移动的元素,需要包含 parentNode 属性
1075
1038
  */
1076
- toFront(e) {
1077
- const t = e.parentNode;
1078
- t && t.lastChild !== e && t.appendChild(e);
1039
+ toFront(t) {
1040
+ const e = t.parentNode;
1041
+ e && e.lastChild !== t && e.appendChild(t);
1079
1042
  },
1080
1043
  /**
1081
1044
  * 将元素移动到其父节点的最前面
1082
1045
  *
1083
1046
  * @param el 要移动的元素,需要包含parentNode属性
1084
1047
  */
1085
- toBack(e) {
1086
- const t = e.parentNode;
1087
- t && t.firstChild !== e && t.insertBefore(e, t.firstChild);
1048
+ toBack(t) {
1049
+ const e = t.parentNode;
1050
+ e && e.firstChild !== t && e.insertBefore(t, e.firstChild);
1088
1051
  },
1089
1052
  /**
1090
1053
  * 获取元素的类名
@@ -1095,8 +1058,8 @@ const ut = {
1095
1058
  * @param el.className.baseVal 类名字符串
1096
1059
  * @returns 返回元素的类名字符串
1097
1060
  */
1098
- getClass(e) {
1099
- return ((e == null ? void 0 : e.host) || e).className.toString();
1061
+ getClass(t) {
1062
+ return ((t == null ? void 0 : t.host) || t).className.toString();
1100
1063
  },
1101
1064
  /**
1102
1065
  * 判断元素是否包含指定类名
@@ -1105,12 +1068,12 @@ const ut = {
1105
1068
  * @param name 要判断的类名
1106
1069
  * @returns 返回一个布尔值,表示元素是否包含指定类名
1107
1070
  */
1108
- hasClass(e, t) {
1071
+ hasClass(t, e) {
1109
1072
  var s;
1110
- if ((s = e.classList) != null && s.contains(t))
1073
+ if ((s = t.classList) != null && s.contains(e))
1111
1074
  return !0;
1112
- const n = this.getClass(e);
1113
- return n.length > 0 && new RegExp(`(^|\\s)${t}(\\s|$)`).test(n);
1075
+ const n = this.getClass(t);
1076
+ return n.length > 0 && new RegExp(`(^|\\s)${e}(\\s|$)`).test(n);
1114
1077
  },
1115
1078
  /**
1116
1079
  * 给指定的 HTML 元素添加类名
@@ -1118,14 +1081,14 @@ const ut = {
1118
1081
  * @param el 要添加类名的 HTML 元素
1119
1082
  * @param name 要添加的类名,多个类名之间用空格分隔
1120
1083
  */
1121
- addClass(e, t) {
1122
- if (e.classList !== void 0) {
1123
- const n = F(t);
1124
- for (let s = 0, i = n.length; s < i; s++)
1125
- e.classList.add(n[s]);
1126
- } else if (!this.hasClass(e, t)) {
1127
- const n = this.getClass(e);
1128
- this.setClass(e, (n ? n + " " : "") + t);
1084
+ addClass(t, e) {
1085
+ if (t.classList !== void 0) {
1086
+ const n = R(e);
1087
+ for (let s = 0, r = n.length; s < r; s++)
1088
+ t.classList.add(n[s]);
1089
+ } else if (!this.hasClass(t, e)) {
1090
+ const n = this.getClass(t);
1091
+ this.setClass(t, (n ? n + " " : "") + e);
1129
1092
  }
1130
1093
  },
1131
1094
  /**
@@ -1134,8 +1097,8 @@ const ut = {
1134
1097
  * @param el 要移除类名的元素
1135
1098
  * @param name 要移除的类名,多个类名用空格分隔
1136
1099
  */
1137
- removeClass(e, t) {
1138
- e.classList !== void 0 ? F(t).forEach((s) => e.classList.remove(s)) : this.setClass(e, (" " + this.getClass(e) + " ").replace(" " + t + " ", " ").trim());
1100
+ removeClass(t, e) {
1101
+ t.classList !== void 0 ? R(e).forEach((s) => t.classList.remove(s)) : this.setClass(t, (" " + this.getClass(t) + " ").replace(" " + e + " ", " ").trim());
1139
1102
  },
1140
1103
  /**
1141
1104
  * 设置元素的 CSS 类名
@@ -1143,8 +1106,8 @@ const ut = {
1143
1106
  * @param el HTML 或 SVG 元素
1144
1107
  * @param name 要设置的类名,多个类名之间用空格分隔
1145
1108
  */
1146
- setClass(e, t) {
1147
- "classList" in e && (e.classList.value = "", t.split(" ").forEach((n) => e.classList.add(n)));
1109
+ setClass(t, e) {
1110
+ "classList" in t && (t.classList.value = "", e.split(" ").forEach((n) => t.classList.add(n)));
1148
1111
  },
1149
1112
  /**
1150
1113
  * 从字符串中解析XML文档,并返回根节点
@@ -1152,10 +1115,10 @@ const ut = {
1152
1115
  * @param str 要解析的XML字符串
1153
1116
  * @returns 解析后的XML文档的根节点
1154
1117
  */
1155
- parseFromString(e) {
1156
- return new DOMParser().parseFromString(e, "text/xml").children[0];
1118
+ parseFromString(t) {
1119
+ return new DOMParser().parseFromString(t, "text/xml").children[0];
1157
1120
  }
1158
- }, j = {
1121
+ }, G = {
1159
1122
  toRadian: Math.PI / 180,
1160
1123
  R: 6371393,
1161
1124
  /**
@@ -1165,8 +1128,40 @@ const ut = {
1165
1128
  * @param lat 纬度值
1166
1129
  * @returns 如果经纬度合法,返回true;否则返回false
1167
1130
  */
1168
- isLnglat(e, t) {
1169
- return !isNaN(e) && !isNaN(t) && +t > -90 && +t < 90 && +e > -180 && +e < 180;
1131
+ isLnglat(t, e) {
1132
+ return !isNaN(t) && !isNaN(e) && +e > -90 && +e < 90 && +t > -180 && +t < 180;
1133
+ },
1134
+ /**
1135
+ * 判断经纬度是否不在中国境内
1136
+ *
1137
+ * @param lng 经度
1138
+ * @param lat 纬度
1139
+ * @returns 如果经纬度不在中国境内则返回true,否则返回false
1140
+ */
1141
+ outOfChina({ lng: t, lat: e }) {
1142
+ return t < 72.004 || t > 137.8347 || e < 0.8293 || e > 55.8271;
1143
+ },
1144
+ /**
1145
+ * 计算两哥平面坐标点间的距离
1146
+ *
1147
+ * @param p1 坐标点1,包含x和y属性
1148
+ * @param p2 坐标点2,包含x和y属性
1149
+ * @returns 返回两点间的欧几里得距离
1150
+ */
1151
+ distance(t, e) {
1152
+ return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
1153
+ },
1154
+ /**
1155
+ * 计算两个经纬度点之间的距离
1156
+ *
1157
+ * @param A 经纬度点A,包含lng(经度)和lat(纬度)两个属性
1158
+ * @param B 经纬度点B,包含lng(经度)和lat(纬度)两个属性
1159
+ * @returns 返回两点之间的距离,单位为米
1160
+ */
1161
+ distanceByPoints(t, e) {
1162
+ const { lng: n, lat: s } = t, { lng: r, lat: i } = e, a = 6371e3, o = Math.cos(s * Math.PI / 180) * Math.cos(i * Math.PI / 180) * Math.cos((n - r) * Math.PI / 180), c = Math.sin(s * Math.PI / 180) * Math.sin(i * Math.PI / 180);
1163
+ let l = o + c;
1164
+ return l > 1 && (l = 1), l < -1 && (l = -1), Math.acos(l) * a;
1170
1165
  },
1171
1166
  /**
1172
1167
  * 格式化经纬度为度分秒格式
@@ -1175,13 +1170,13 @@ const ut = {
1175
1170
  * @param lat 纬度
1176
1171
  * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
1177
1172
  */
1178
- formatLnglat(e, t) {
1173
+ formatLnglat(t, e) {
1179
1174
  let n = "";
1180
- function s(i) {
1181
- const r = Math.floor(i), a = Math.floor((i - r) * 60), o = (i - r) * 3600 - a * 60;
1182
- return `${r}°${a}′${o.toFixed(2)}″`;
1175
+ function s(r) {
1176
+ const i = Math.floor(r), a = Math.floor((r - i) * 60), o = (r - i) * 3600 - a * 60;
1177
+ return `${i}°${a}′${o.toFixed(2)}″`;
1183
1178
  }
1184
- return this.isLnglat(e, t) ? n = s(e) + "," + s(t) : isNaN(e) ? isNaN(t) || (n = s(t)) : n = s(e), n;
1179
+ return this.isLnglat(t, e) ? n = s(t) + "," + s(e) : isNaN(t) ? isNaN(e) || (n = s(e)) : n = s(t), n;
1185
1180
  },
1186
1181
  /**
1187
1182
  * 将经纬度字符串转换为度
@@ -1190,19 +1185,19 @@ const ut = {
1190
1185
  * @param lat 纬度字符串
1191
1186
  * @returns 转换后的经纬度对象
1192
1187
  */
1193
- transformLnglat(e, t) {
1188
+ transformLnglat(t, e) {
1194
1189
  function n(s) {
1195
- let r = /[sw]/i.test(s) ? -1 : 1;
1190
+ let i = /[sw]/i.test(s) ? -1 : 1;
1196
1191
  const a = s.match(/[\d.]+/g) || [];
1197
1192
  let o = 0;
1198
1193
  for (let c = 0; c < a.length; c++)
1199
- o += parseFloat(a[c]) / r, r *= 60;
1194
+ o += parseFloat(a[c]) / i, i *= 60;
1200
1195
  return o;
1201
1196
  }
1202
- if (e && t)
1197
+ if (t && e)
1203
1198
  return {
1204
- lng: n(e),
1205
- lat: n(t)
1199
+ lng: n(t),
1200
+ lat: n(e)
1206
1201
  };
1207
1202
  },
1208
1203
  /**
@@ -1212,50 +1207,19 @@ const ut = {
1212
1207
  * @param poly 多边形顶点数组,可以是字符串数组或对象数组
1213
1208
  * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
1214
1209
  */
1215
- rayCasting(e, t) {
1216
- for (var n = e.x, s = e.y, i = !1, r = 0, a = t.length, o = a - 1; r < a; o = r, r++) {
1217
- var c = t[r].x, l = t[r].y, h = t[o].x, u = t[o].y;
1210
+ rayCasting(t, e) {
1211
+ for (var n = t.x, s = t.y, r = !1, i = 0, a = e.length, o = a - 1; i < a; o = i, i++) {
1212
+ var c = e[i].x, l = e[i].y, h = e[o].x, u = e[o].y;
1218
1213
  if (c === n && l === s || h === n && u === s)
1219
1214
  return "on";
1220
1215
  if (l < s && u >= s || l >= s && u < s) {
1221
1216
  var d = c + (s - l) * (h - c) / (u - l);
1222
1217
  if (d === n)
1223
1218
  return "on";
1224
- d > n && (i = !i);
1219
+ d > n && (r = !r);
1225
1220
  }
1226
1221
  }
1227
- return i ? "in" : "out";
1228
- },
1229
- /**
1230
- * 计算两个WGS-84坐标点之间的距离
1231
- *
1232
- * @param fromPoint 起始点坐标
1233
- * @param toPoint 目标点坐标
1234
- * @returns 返回两个坐标点之间的距离,单位为米
1235
- */
1236
- wgs84PointsDistance(e, t) {
1237
- var n = Math.PI;
1238
- function s(G) {
1239
- return G * n / 180;
1240
- }
1241
- if (arguments.length != 2)
1242
- return 0;
1243
- const i = e.x, r = e.y, a = t.x, o = t.y;
1244
- var c = 6378137, l = 63567523142e-4, h = 1 / 298.257223563, u = s(a - i), d = Math.atan((1 - h) * Math.tan(s(r))), R = Math.atan((1 - h) * Math.tan(s(o))), O = Math.sin(d), v = Math.cos(d), A = Math.sin(R), w = Math.cos(R), D = u, L, N = 100;
1245
- do {
1246
- var T = Math.sin(D), I = Math.cos(D), y = Math.sqrt(
1247
- w * T * (w * T) + (v * A - O * w * I) * (v * A - O * w * I)
1248
- );
1249
- if (y == 0) return 0;
1250
- var S = O * A + v * w * I, k = Math.atan2(y, S), C = v * w * T / y, x = 1 - C * C, m = S - 2 * O * A / x;
1251
- isNaN(m) && (m = 0);
1252
- var _ = h / 16 * x * (4 + h * (4 - 3 * x));
1253
- L = D, D = u + (1 - _) * h * C * (k + _ * y * (m + _ * S * (-1 + 2 * m * m)));
1254
- } while (Math.abs(D - L) > 1e-12 && --N > 0);
1255
- if (N == 0)
1256
- return NaN;
1257
- var M = x * (c * c - l * l) / (l * l), $ = 1 + M / 16384 * (4096 + M * (-768 + M * (320 - 175 * M))), P = M / 1024 * (256 + M * (-128 + M * (74 - 47 * M))), B = P * y * (m + P / 4 * (S * (-1 + 2 * m * m) - P / 6 * m * (-3 + 4 * y * y) * (-3 + 4 * m * m))), W = l * $ * (k - B);
1258
- return W;
1222
+ return r ? "in" : "out";
1259
1223
  },
1260
1224
  /**
1261
1225
  * 旋转点
@@ -1265,9 +1229,9 @@ const ut = {
1265
1229
  * @param θ 旋转角度(顺时针旋转为正)
1266
1230
  * @returns 旋转后点坐标
1267
1231
  */
1268
- rotatePoint(e, t, n) {
1269
- const s = (e.x - t.x) * Math.cos(Math.PI / 180 * -n) - (e.y - t.y) * Math.sin(Math.PI / 180 * -n) + t.x, i = (e.x - t.x) * Math.sin(Math.PI / 180 * -n) + (e.y - t.y) * Math.cos(Math.PI / 180 * -n) + t.y;
1270
- return { x: s, y: i };
1232
+ rotatePoint(t, e, n) {
1233
+ const s = (t.x - e.x) * Math.cos(Math.PI / 180 * -n) - (t.y - e.y) * Math.sin(Math.PI / 180 * -n) + e.x, r = (t.x - e.x) * Math.sin(Math.PI / 180 * -n) + (t.y - e.y) * Math.cos(Math.PI / 180 * -n) + e.y;
1234
+ return { x: s, y: r };
1271
1235
  },
1272
1236
  /**
1273
1237
  * 根据两个平面坐标点计算方位角和距离
@@ -1276,8 +1240,8 @@ const ut = {
1276
1240
  * @param p2 第二个点的坐标对象
1277
1241
  * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
1278
1242
  */
1279
- calcBearAndDis(e, t) {
1280
- const { x: n, y: s } = e, { x: i, y: r } = t, a = i - n, o = r - s, c = Math.sqrt(a * a + o * o);
1243
+ calcBearAndDis(t, e) {
1244
+ const { x: n, y: s } = t, { x: r, y: i } = e, a = r - n, o = i - s, c = Math.sqrt(a * a + o * o);
1281
1245
  return { angle: (Math.atan2(o, a) * (180 / Math.PI) + 360 + 90) % 360, distance: c };
1282
1246
  },
1283
1247
  /**
@@ -1287,13 +1251,31 @@ const ut = {
1287
1251
  * @param latlng2 第二个经纬度点
1288
1252
  * @returns 包含方位角和距离的对象
1289
1253
  */
1290
- calcBearAndDisByPoints(e, t) {
1291
- var n = e.lat * 1, s = e.lng * 1, i = t.lat * 1, r = t.lng * 1, a = Math.sin((r - s) * this.toRadian) * Math.cos(i * this.toRadian), o = Math.cos(n * this.toRadian) * Math.sin(i * this.toRadian) - Math.sin(n * this.toRadian) * Math.cos(i * this.toRadian) * Math.cos((r - s) * this.toRadian), c = Math.atan2(a, o) * (180 / Math.PI), l = (i - n) * this.toRadian, h = (r - s) * this.toRadian, u = Math.sin(l / 2) * Math.sin(l / 2) + Math.cos(n * this.toRadian) * Math.cos(i * this.toRadian) * Math.sin(h / 2) * Math.sin(h / 2), d = 2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u)), R = this.R * d;
1254
+ calcBearAndDisByPoints(t, e) {
1255
+ var n = t.lat * 1, s = t.lng * 1, r = e.lat * 1, i = e.lng * 1, a = Math.sin((i - s) * this.toRadian) * Math.cos(r * this.toRadian), o = Math.cos(n * this.toRadian) * Math.sin(r * this.toRadian) - Math.sin(n * this.toRadian) * Math.cos(r * this.toRadian) * Math.cos((i - s) * this.toRadian), c = Math.atan2(a, o) * (180 / Math.PI), l = (r - n) * this.toRadian, h = (i - s) * this.toRadian, u = Math.sin(l / 2) * Math.sin(l / 2) + Math.cos(n * this.toRadian) * Math.cos(r * this.toRadian) * Math.sin(h / 2) * Math.sin(h / 2), d = 2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u)), g = this.R * d;
1292
1256
  return {
1293
1257
  angle: c,
1294
- distance: R
1258
+ distance: g
1295
1259
  };
1296
1260
  },
1261
+ /**
1262
+ * 计算点P到线段P1P2的最短距离
1263
+ *
1264
+ * @param p 点P的坐标
1265
+ * @param p1 线段起点P1的坐标
1266
+ * @param p2 线段终点P2的坐标
1267
+ * @returns 点P到线段P1P2的最短距离
1268
+ */
1269
+ distanceToSegment(t, e, n) {
1270
+ const s = t.x, r = t.y, i = e.x, a = e.y, o = n.x, c = n.y, l = (o - i) * (s - i) + (c - a) * (r - a);
1271
+ if (l <= 0)
1272
+ return Math.sqrt((s - i) * (s - i) + (r - a) * (r - a));
1273
+ const h = (o - i) * (o - i) + (c - a) * (c - a);
1274
+ if (l >= h)
1275
+ return Math.sqrt((s - o) * (s - o) + (r - c) * (r - c));
1276
+ const u = l / h, d = i + (o - i) * u, g = a + (c - a) * u;
1277
+ return Math.sqrt((s - d) * (s - d) + (r - g) * (r - g));
1278
+ },
1297
1279
  /**
1298
1280
  * 根据给定的经纬度、角度和距离计算新的经纬度点
1299
1281
  *
@@ -1302,13 +1284,13 @@ const ut = {
1302
1284
  * @param distance 距离值,单位为米,表示从当前点出发的距离
1303
1285
  * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
1304
1286
  */
1305
- calcPointByBearAndDis(e, t, n) {
1306
- const s = g.toRadians(e.lat * 1), i = g.toRadians(e.lng * 1), r = n / this.R;
1307
- t = g.toRadians(t);
1308
- const a = Math.asin(Math.sin(s) * Math.cos(r) + Math.cos(s) * Math.sin(r) * Math.cos(t)), o = i + Math.atan2(Math.sin(t) * Math.sin(r) * Math.cos(s), Math.cos(r) - Math.sin(s) * Math.sin(a));
1287
+ calcPointByBearAndDis(t, e, n) {
1288
+ const s = m.toRadians(t.lat * 1), r = m.toRadians(t.lng * 1), i = n / this.R;
1289
+ e = m.toRadians(e);
1290
+ const a = Math.asin(Math.sin(s) * Math.cos(i) + Math.cos(s) * Math.sin(i) * Math.cos(e)), o = r + Math.atan2(Math.sin(e) * Math.sin(i) * Math.cos(s), Math.cos(i) - Math.sin(s) * Math.sin(a));
1309
1291
  return {
1310
- lat: g.toDegrees(a),
1311
- lng: g.toDegrees(o)
1292
+ lat: m.toDegrees(a),
1293
+ lng: m.toDegrees(o)
1312
1294
  };
1313
1295
  },
1314
1296
  /**
@@ -1318,11 +1300,11 @@ const ut = {
1318
1300
  * @param y 墨卡托坐标的y值
1319
1301
  * @returns 返回包含转换后的经度lng和纬度lat的对象
1320
1302
  */
1321
- mercatorTolonlat(e, t) {
1322
- const n = e / 2003750834e-2 * 180;
1323
- var s = t / 2003750834e-2 * 180;
1324
- const i = 180 / Math.PI * (2 * Math.atan(Math.exp(s * Math.PI / 180)) - Math.PI / 2);
1325
- return { lng: n, lat: i };
1303
+ mercatorTolonlat(t, e) {
1304
+ const n = t / 2003750834e-2 * 180;
1305
+ var s = e / 2003750834e-2 * 180;
1306
+ const r = 180 / Math.PI * (2 * Math.atan(Math.exp(s * Math.PI / 180)) - Math.PI / 2);
1307
+ return { lng: n, lat: r };
1326
1308
  },
1327
1309
  /**
1328
1310
  * 将经纬度坐标转换为墨卡托坐标
@@ -1331,26 +1313,33 @@ const ut = {
1331
1313
  * @param lat 纬度值
1332
1314
  * @returns 墨卡托坐标对象,包含x和y属性
1333
1315
  */
1334
- lonlatToMercator(e, t) {
1316
+ lonlatToMercator(t, e) {
1335
1317
  var n = 6378137;
1336
- const s = e * Math.PI / 180 * n;
1337
- var i = t * Math.PI / 180;
1338
- const r = n / 2 * Math.log((1 + Math.sin(i)) / (1 - Math.sin(i)));
1339
- return { x: s, y: r };
1318
+ const s = t * Math.PI / 180 * n;
1319
+ var r = e * Math.PI / 180;
1320
+ const i = n / 2 * Math.log((1 + Math.sin(r)) / (1 - Math.sin(r)));
1321
+ return { x: s, y: i };
1340
1322
  }
1341
- }, dt = {
1323
+ }, H = {
1324
+ deepClone(t) {
1325
+ return structuredClone(t);
1326
+ },
1327
+ isEqual(t, e) {
1328
+ return JSON.stringify(t) === JSON.stringify(e);
1329
+ }
1330
+ }, z = {
1342
1331
  /**
1343
1332
  * 将Base64编码的字符串转换为Blob对象
1344
1333
  *
1345
1334
  * @param data Base64编码的字符串
1346
1335
  * @returns 转换后的Blob对象
1347
1336
  */
1348
- convertBase64ToBlob(e) {
1349
- const t = e.split(",")[0].split(":")[1].split(";")[0], n = atob(e.split(",")[1]), s = new Array(n.length);
1337
+ convertBase64ToBlob(t) {
1338
+ const e = t.split(",")[0].split(":")[1].split(";")[0], n = atob(t.split(",")[1]), s = new Array(n.length);
1350
1339
  for (let a = 0; a < n.length; a++)
1351
1340
  s[a] = n.charCodeAt(a);
1352
- const i = new Uint8Array(s);
1353
- return new Blob([i], { type: t });
1341
+ const r = new Uint8Array(s);
1342
+ return new Blob([r], { type: e });
1354
1343
  },
1355
1344
  /**
1356
1345
  * 将图片的URL转换为Base64编码
@@ -1360,25 +1349,25 @@ const ut = {
1360
1349
  * @param height 图片的高度,默认为图片原始高度
1361
1350
  * @returns 返回Promise对象,解析后得到包含Base64编码数据的对象
1362
1351
  */
1363
- convertUrlToBase64(e, t, n) {
1364
- return new Promise((s, i) => {
1365
- var r = new Image();
1366
- r.crossOrigin = "Anonymous", r.src = e, r.onload = function() {
1352
+ convertUrlToBase64(t, e, n) {
1353
+ return new Promise((s, r) => {
1354
+ var i = new Image();
1355
+ i.crossOrigin = "Anonymous", i.src = t, i.onload = function() {
1367
1356
  var a = document.createElement("canvas");
1368
- a.width = t || r.width, a.height = n || r.height;
1357
+ a.width = e || i.width, a.height = n || i.height;
1369
1358
  var o = a.getContext("2d");
1370
1359
  if (!o) {
1371
- i(new Error("Failed to get canvas context"));
1360
+ r(new Error("Failed to get canvas context"));
1372
1361
  return;
1373
1362
  }
1374
- o.drawImage(r, 0, 0, r.width, r.height);
1375
- var c = r.src.substring(r.src.lastIndexOf(".") + 1).toLowerCase(), l = a.toDataURL("image/" + c), h = {
1363
+ o.drawImage(i, 0, 0, i.width, i.height);
1364
+ var c = i.src.substring(i.src.lastIndexOf(".") + 1).toLowerCase(), l = a.toDataURL("image/" + c), h = {
1376
1365
  dataURL: l,
1377
1366
  type: "image/" + c,
1378
1367
  ext: c
1379
1368
  };
1380
1369
  s(h);
1381
- }, r.onerror = i;
1370
+ }, i.onerror = r;
1382
1371
  });
1383
1372
  },
1384
1373
  /**
@@ -1388,64 +1377,89 @@ const ut = {
1388
1377
  * @param filename 文件的名称
1389
1378
  * @returns 返回文件对象
1390
1379
  */
1391
- convertBase64ToFile(e, t) {
1392
- const n = e.split(","), s = n[0].match(/:(.*?);/), i = s ? s[1] : "image/png", r = atob(n[1]), a = new Uint8Array(r.length);
1393
- for (let c = 0; c < r.length; c++)
1394
- a[c] = r.charCodeAt(c);
1395
- return new File([a], t, { type: i });
1380
+ convertBase64ToFile(t, e) {
1381
+ const n = t.split(","), s = n[0].match(/:(.*?);/), r = s ? s[1] : "image/png", i = atob(n[1]), a = new Uint8Array(i.length);
1382
+ for (let c = 0; c < i.length; c++)
1383
+ a[c] = i.charCodeAt(c);
1384
+ return new File([a], e, { type: r });
1396
1385
  },
1397
1386
  /**
1398
- * 直接下载文件,支持blob类型和url类型
1387
+ * 从文件下载数据
1399
1388
  *
1400
- * @param {*} data
1401
- * @param {*} saveName
1389
+ * @param data 要下载的数据,可以是字符串数组、BlobPart 或 MediaSource
1390
+ * @param saveName 下载后文件的保存名称
1402
1391
  */
1403
- downloadFromFile(e, t) {
1404
- if (typeof e == "object")
1405
- if (e instanceof Blob)
1406
- e = URL.createObjectURL(e);
1392
+ downloadFromFile(t, e) {
1393
+ if (typeof t == "object")
1394
+ if (t instanceof Blob)
1395
+ t = URL.createObjectURL(t);
1407
1396
  else {
1408
- const s = JSON.stringify(e), i = new Blob([s], { type: "text/json" });
1409
- e = window.URL.createObjectURL(i);
1397
+ const s = JSON.stringify(t), r = new Blob([s], { type: "text/json" });
1398
+ t = window.URL.createObjectURL(r);
1410
1399
  }
1411
- else if (typeof e == "string" && e.indexOf("http") === -1) {
1412
- const s = new Blob([e], { type: "text/json" });
1413
- e = window.URL.createObjectURL(s);
1400
+ else if (typeof t == "string" && t.indexOf("http") === -1) {
1401
+ const s = new Blob([t], { type: "text/json" });
1402
+ t = window.URL.createObjectURL(s);
1414
1403
  }
1415
1404
  var n = document.createElement("a");
1416
- n.href = e, n.download = t || "", n.click(), window.URL.revokeObjectURL(n.href);
1405
+ n.href = t, n.download = e || "", n.click(), window.URL.revokeObjectURL(n.href);
1417
1406
  }
1418
- }, ft = {
1407
+ }, K = {
1419
1408
  /**
1420
- * 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。
1409
+ * 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。适用于像搜索输入框这种需要用户停止输入后才调用的场景
1421
1410
  *
1422
1411
  * @param func 需要防抖的函数。
1423
1412
  * @param wait 等待时间,单位毫秒。
1424
1413
  * @param immediate 是否立即执行函数,默认为true。
1425
1414
  * @returns 返回防抖后的函数。
1426
1415
  */
1427
- debounce(e, t, n = !0) {
1428
- let s = null, i, r, a, o;
1429
- const c = function() {
1430
- const l = Date.now() - a;
1431
- l < t && l > 0 ? s = setTimeout(c, t - l) : (s = null, n || (o = e.apply(r, i)));
1416
+ debounce(t, e, n = !0) {
1417
+ let s = null, r, i, a;
1418
+ const o = () => {
1419
+ const c = Date.now() - i;
1420
+ c < e && c > 0 ? s = setTimeout(o, e - c) : (s = null, n || (a = t.apply(this, r)));
1432
1421
  };
1433
- return function(...l) {
1434
- r = this, a = Date.now();
1435
- const h = n && !s;
1436
- return s || (s = setTimeout(c, t)), h && (o = e.apply(r, l), s || (r = l = null)), o;
1422
+ return (...c) => {
1423
+ i = Date.now();
1424
+ const l = n && !s;
1425
+ return s || (s = setTimeout(o, e)), l && (a = t.apply(this, c), s || (c = null)), a;
1437
1426
  };
1438
1427
  },
1439
- throttle(e, t, n) {
1440
- let s = 0, i = null;
1441
- return function(...r) {
1442
- const a = this;
1428
+ /**
1429
+ * 节流函数,适用于像滚动事件、窗口resize事件这种需要限制调用频率的场景
1430
+ *
1431
+ * @param func 需要节流的函数
1432
+ * @param wait 节流间隔,单位为毫秒
1433
+ * @param type 节流类型,1表示时间戳方式,2表示定时器方式
1434
+ * @returns 返回一个新的函数,该函数在节流控制下执行传入的函数
1435
+ */
1436
+ throttle(t, e, n = 1) {
1437
+ let s = 0, r = null;
1438
+ return (...i) => {
1443
1439
  if (n === 1) {
1444
- const o = Date.now();
1445
- o - s > t && (e.apply(a, r), s = o);
1446
- } else n === 2 && (i || (i = setTimeout(() => {
1447
- i = null, e.apply(a, r);
1448
- }, t)));
1440
+ const a = Date.now();
1441
+ a - s >= e && (t.apply(this, i), s = a);
1442
+ } else n === 2 && (r || (r = setTimeout(() => {
1443
+ r = null, t.apply(this, i);
1444
+ }, e)));
1445
+ };
1446
+ },
1447
+ /**
1448
+ * 缓存函数,将传入的函数fn的计算结果缓存,提高重复计算的效率
1449
+ *
1450
+ * @param fn 传入待缓存的函数
1451
+ * @returns 返回缓存后的函数
1452
+ */
1453
+ memoize(t) {
1454
+ const e = /* @__PURE__ */ new Map();
1455
+ return (...n) => {
1456
+ const s = JSON.stringify(n);
1457
+ if (e.has(s))
1458
+ return e.get(s);
1459
+ {
1460
+ const r = t.apply(this, n);
1461
+ return e.set(s, r), r;
1462
+ }
1449
1463
  };
1450
1464
  },
1451
1465
  /**
@@ -1455,13 +1469,13 @@ const ut = {
1455
1469
  * @param frequency 每次调用函数之间的时间间隔,单位为毫秒,默认为500毫秒。
1456
1470
  * @param duration 函数递归调用的总时长,单位为毫秒,默认为5000毫秒。
1457
1471
  */
1458
- recurve(e, t = 500, n = 5e3) {
1472
+ recurve(t, e = 500, n = 5e3) {
1459
1473
  let s = 0;
1460
1474
  setTimeout(() => {
1461
- s++, s < Math.floor(n / t) && (e.call(this), setTimeout(this.recurve.bind(this, e, t, n), t));
1462
- }, t);
1475
+ s++, s < Math.floor(n / e) && (t.call(this), setTimeout(this.recurve.bind(this, t, e, n), e));
1476
+ }, e);
1463
1477
  }
1464
- }, K = {
1478
+ }, j = {
1465
1479
  /**
1466
1480
  * 校验字符串是否符合指定类型
1467
1481
  *
@@ -1486,42 +1500,42 @@ const ut = {
1486
1500
  * - 'HTML': HTML标记
1487
1501
  * @returns 校验结果,符合返回true,否则返回false
1488
1502
  */
1489
- checkStr(e, t) {
1490
- switch (t) {
1503
+ checkStr(t, e) {
1504
+ switch (e) {
1491
1505
  case "phone":
1492
- return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(e);
1506
+ return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);
1493
1507
  case "tel":
1494
- return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(e);
1508
+ return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);
1495
1509
  case "card":
1496
- return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e);
1510
+ return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);
1497
1511
  case "pwd":
1498
- return /^[a-zA-Z]\w{5,17}$/.test(e);
1512
+ return /^[a-zA-Z]\w{5,17}$/.test(t);
1499
1513
  case "postal":
1500
- return /[1-9]\d{5}(?!\d)/.test(e);
1514
+ return /[1-9]\d{5}(?!\d)/.test(t);
1501
1515
  case "QQ":
1502
- return /^[1-9][0-9]{4,9}$/.test(e);
1516
+ return /^[1-9][0-9]{4,9}$/.test(t);
1503
1517
  case "email":
1504
- return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(e);
1518
+ return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);
1505
1519
  case "money":
1506
- return /^\d*(?:\.\d{0,2})?$/.test(e);
1520
+ return /^\d*(?:\.\d{0,2})?$/.test(t);
1507
1521
  case "URL":
1508
- return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);
1522
+ return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);
1509
1523
  case "IP":
1510
- return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(e);
1524
+ return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);
1511
1525
  case "date":
1512
- return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(e) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(e);
1526
+ return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);
1513
1527
  case "number":
1514
- return /^[0-9]$/.test(e);
1528
+ return /^[0-9]$/.test(t);
1515
1529
  case "english":
1516
- return /^[a-zA-Z]+$/.test(e);
1530
+ return /^[a-zA-Z]+$/.test(t);
1517
1531
  case "chinese":
1518
- return /^[\u4E00-\u9FA5]+$/.test(e);
1532
+ return /^[\u4E00-\u9FA5]+$/.test(t);
1519
1533
  case "lower":
1520
- return /^[a-z]+$/.test(e);
1534
+ return /^[a-z]+$/.test(t);
1521
1535
  case "upper":
1522
- return /^[A-Z]+$/.test(e);
1536
+ return /^[A-Z]+$/.test(t);
1523
1537
  case "HTML":
1524
- return /<("[^"]*"|'[^']*'|[^'">])*>/.test(e);
1538
+ return /<("[^"]*"|'[^']*'|[^'">])*>/.test(t);
1525
1539
  default:
1526
1540
  return !0;
1527
1541
  }
@@ -1538,26 +1552,26 @@ const ut = {
1538
1552
  * 5:全部小写
1539
1553
  * @returns 转换后的字符串
1540
1554
  */
1541
- changeCase(e, t) {
1542
- switch (t = t || 4, t) {
1555
+ changeCase(t, e) {
1556
+ switch (e = e || 4, e) {
1543
1557
  case 1:
1544
- return e.replace(/\b\w+\b/g, function(n) {
1558
+ return t.replace(/\b\w+\b/g, function(n) {
1545
1559
  return n.substring(0, 1).toUpperCase() + n.substring(1).toLowerCase();
1546
1560
  });
1547
1561
  case 2:
1548
- return e.replace(/\b\w+\b/g, function(n) {
1562
+ return t.replace(/\b\w+\b/g, function(n) {
1549
1563
  return n.substring(0, 1).toLowerCase() + n.substring(1).toUpperCase();
1550
1564
  });
1551
1565
  case 3:
1552
- return e.split("").map(function(n) {
1566
+ return t.split("").map(function(n) {
1553
1567
  return /[a-z]/.test(n) ? n.toUpperCase() : n.toLowerCase();
1554
1568
  }).join("");
1555
1569
  case 4:
1556
- return e.toUpperCase();
1570
+ return t.toUpperCase();
1557
1571
  case 5:
1558
- return e.toLowerCase();
1572
+ return t.toLowerCase();
1559
1573
  default:
1560
- return e;
1574
+ return t;
1561
1575
  }
1562
1576
  },
1563
1577
  /**
@@ -1567,9 +1581,9 @@ const ut = {
1567
1581
  * @param args 可变参数列表,支持 Object、Array 类型和任意其他类型,若为 null 或 undefined,则按类型默认转换为 '{}'、'[]' 或 ''
1568
1582
  * @returns 返回生成的新字符串
1569
1583
  */
1570
- tag(e, ...t) {
1571
- return t = t.map((n) => {
1572
- switch (E.getDataType(n)) {
1584
+ tag(t, ...e) {
1585
+ return e = e.map((n) => {
1586
+ switch (y.getDataType(n)) {
1573
1587
  case "Object":
1574
1588
  return n || "{}";
1575
1589
  case "Array":
@@ -1577,7 +1591,7 @@ const ut = {
1577
1591
  default:
1578
1592
  return n || "";
1579
1593
  }
1580
- }), e.reduce((n, s, i) => `${n}${t[i - 1]}${s}`);
1594
+ }), t.reduce((n, s, r) => `${n}${e[r - 1]}${s}`);
1581
1595
  },
1582
1596
  /**
1583
1597
  * 计算字符串的字节长度
@@ -1585,8 +1599,8 @@ const ut = {
1585
1599
  * @param str 需要计算字节长度的字符串
1586
1600
  * @returns 返回字符串的字节长度
1587
1601
  */
1588
- getByteLength(e) {
1589
- return e.replace(/[\u0391-\uFFE5]/g, "aa").length;
1602
+ getByteLength(t) {
1603
+ return t.replace(/[\u0391-\uFFE5]/g, "aa").length;
1590
1604
  },
1591
1605
  /**
1592
1606
  * 截取字符串中指定字节长度的子串
@@ -1596,16 +1610,16 @@ const ut = {
1596
1610
  * @param n 截取字节长度
1597
1611
  * @returns 返回截取后的子串
1598
1612
  */
1599
- subStringByte(e, t, n) {
1613
+ subStringByte(t, e, n) {
1600
1614
  var s = /[^\x00-\xff]/g;
1601
- if (e.replace(s, "mm").length <= n)
1602
- return e;
1603
- for (var i = Math.floor(n / 2), r = i; r < e.length; r++) {
1604
- let a = e.substring(t, r);
1615
+ if (t.replace(s, "mm").length <= n)
1616
+ return t;
1617
+ for (var r = Math.floor(n / 2), i = r; i < t.length; i++) {
1618
+ let a = t.substring(e, i);
1605
1619
  if (a.replace(s, "mm").length >= n)
1606
1620
  return a;
1607
1621
  }
1608
- return e;
1622
+ return t;
1609
1623
  },
1610
1624
  /**
1611
1625
  * 将值转换为字符串
@@ -1613,141 +1627,141 @@ const ut = {
1613
1627
  * @param value 要转换的值
1614
1628
  * @returns 转换后的字符串,如果值为空,则返回空字符串
1615
1629
  */
1616
- asString(e) {
1617
- if (E.isEmpty(e))
1630
+ asString(t) {
1631
+ if (y.isEmpty(t))
1618
1632
  return "";
1619
- switch (E.getDataType(e)) {
1633
+ switch (y.getDataType(t)) {
1620
1634
  case "Object":
1621
1635
  case "Array":
1622
- return JSON.stringify(e);
1636
+ return JSON.stringify(t);
1623
1637
  default:
1624
- return e;
1638
+ return t;
1625
1639
  }
1626
1640
  }
1627
- }, mt = {
1628
- notNull(e) {
1629
- if (E.isEmpty(e))
1630
- throw Error("不能为空:>>>" + e);
1631
- },
1632
- legalLnglat(e, t) {
1633
- if (!j.isLnglat(e, t))
1634
- throw Error(p.COORDINATE_ERROR);
1635
- },
1636
- contain(e, ...t) {
1637
- let n = !1;
1638
- const s = t.length || 0;
1639
- for (let i = 0, r = s; i < r; i++)
1640
- n = e.indexOf(t[i]) >= 0;
1641
- if (n)
1642
- throw Error(p.STRING_CHECK_LOSS);
1643
- },
1644
- verify: {
1645
- array(e) {
1646
- if (E.getDataType(e) !== "Array")
1647
- throw Error(p.PARAMETER_ERROR_ARRAY + ":>>>" + e);
1648
- },
1649
- function(e) {
1650
- if (E.getDataType(e) !== "Function")
1651
- throw Error(p.PARAMETER_ERROR_FUNCTION + ":>>>" + e);
1652
- },
1653
- object(e) {
1654
- if (E.getDataType(e) !== "Object")
1655
- throw Error(p.PARAMETER_ERROR_OBJECT + ":>>>" + e);
1641
+ }, p = class p {
1642
+ static set(e, n = null, s = null) {
1643
+ var r = this._getPrefixedKey(e, s);
1644
+ try {
1645
+ localStorage.setItem(r, JSON.stringify({ data: n }));
1646
+ } catch {
1647
+ console && console.warn("StoreUtil didn't successfully save the '{" + e + ": " + n + "}' pair, because the localStorage is full.");
1656
1648
  }
1657
- },
1658
- legalJSON(e) {
1649
+ }
1650
+ static get(e, n, s) {
1651
+ var r = this._getPrefixedKey(e, s), i;
1659
1652
  try {
1660
- JSON.parse(e);
1653
+ i = JSON.parse(localStorage.getItem(r) || "");
1661
1654
  } catch {
1662
- throw Error(p.JSON_PARSE_ERROR + ":>>>" + e);
1655
+ localStorage[r] ? i = { data: localStorage.getItem(r) } : i = null;
1656
+ }
1657
+ if (i) {
1658
+ if (typeof i == "object" && typeof i.data < "u")
1659
+ return i.data;
1660
+ } else return n;
1661
+ }
1662
+ static keys() {
1663
+ const e = [];
1664
+ var n = Object.keys(localStorage);
1665
+ return p.prefix.length === 0 ? n : (n.forEach(function(s) {
1666
+ s.indexOf(p.prefix) !== -1 && e.push(s.replace(p.prefix, ""));
1667
+ }), e);
1668
+ }
1669
+ static getAll(e) {
1670
+ var n = p.keys();
1671
+ if (e) {
1672
+ const s = [];
1673
+ return n.forEach((r) => {
1674
+ if (e.includes(r)) {
1675
+ const i = {};
1676
+ i[r] = p.get(r, null, null), s.push(i);
1677
+ }
1678
+ }), s;
1663
1679
  }
1680
+ return n.map((s) => p.get(s, null, null));
1681
+ }
1682
+ static remove(e, n) {
1683
+ var s = this._getPrefixedKey(e, n);
1684
+ localStorage.removeItem(s);
1685
+ }
1686
+ static clear(e) {
1687
+ p.prefix.length ? this.keys().forEach((n) => {
1688
+ localStorage.removeItem(this._getPrefixedKey(n, e));
1689
+ }) : localStorage.clear();
1690
+ }
1691
+ };
1692
+ f(p, "prefix", ""), f(p, "_getPrefixedKey", function(e, n) {
1693
+ return n = n || {}, n.noPrefix ? e : p.prefix + e;
1694
+ });
1695
+ let w = p;
1696
+ const Y = {
1697
+ /**
1698
+ * 将json对象转换为查询字符串
1699
+ *
1700
+ * @param json 待转换的json对象
1701
+ * @returns 转换后的查询字符串
1702
+ */
1703
+ json2Query(t) {
1704
+ var e = [];
1705
+ for (var n in t)
1706
+ if (t.hasOwnProperty(n)) {
1707
+ var s = n, r = t[n];
1708
+ e.push(encodeURIComponent(s) + "=" + encodeURIComponent(r));
1709
+ }
1710
+ var i = e.join("&");
1711
+ return i;
1664
1712
  },
1665
- legalData(e, t) {
1666
- const n = K.checkStr(e, t);
1667
- let s = "";
1668
- switch (t) {
1669
- case "phone":
1670
- s = "电话";
1671
- break;
1672
- case "tel":
1673
- s = "座机";
1674
- break;
1675
- case "card":
1676
- s = "身份证";
1677
- break;
1678
- case "pwd":
1679
- s = "密码";
1680
- break;
1681
- case "postal":
1682
- s = "邮政编码";
1683
- break;
1684
- case "QQ":
1685
- s = "QQ";
1686
- break;
1687
- case "email":
1688
- s = "邮箱";
1689
- break;
1690
- case "money":
1691
- s = "金额";
1692
- break;
1693
- case "URL":
1694
- s = "网址";
1695
- break;
1696
- case "IP":
1697
- s = "IP";
1698
- break;
1699
- case "date":
1700
- s = "日期时间";
1701
- break;
1702
- case "number":
1703
- s = "数字";
1704
- break;
1705
- case "english":
1706
- s = "英文";
1707
- break;
1708
- case "chinese":
1709
- s = "中文";
1710
- break;
1711
- case "lower":
1712
- s = "小写";
1713
- break;
1714
- case "upper":
1715
- s = "大写";
1716
- break;
1717
- case "HTML":
1718
- s = "HTML标记";
1719
- break;
1713
+ /**
1714
+ * URL 中解析出查询参数和哈希参数,并以对象的形式返回
1715
+ *
1716
+ * @param href 需要解析的 URL 链接,默认为当前窗口的 URL
1717
+ * @param needDecode 是否需要解码参数值,默认为 true
1718
+ * @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
1719
+ */
1720
+ query2Json(t = window.location.href, e = !0) {
1721
+ const n = /([^&=]+)=([\w\W]*?)(&|$|#)/g, { search: s, hash: r } = new URL(t), i = [s, r];
1722
+ let a = {};
1723
+ for (let o = 0; o < i.length; o++) {
1724
+ const c = i[o];
1725
+ if (c) {
1726
+ const h = c.replace(/#|\//g, "").split("?");
1727
+ if (h.length > 1)
1728
+ for (let u = 1; u < h.length; u++) {
1729
+ let d;
1730
+ for (; d = n.exec(h[u]); )
1731
+ a[d[1]] = e ? decodeURIComponent(d[2]) : d[2];
1732
+ }
1733
+ }
1720
1734
  }
1721
- if (!n)
1722
- throw Error(p.PARAMETER_ERROR + ":>>>不是" + s);
1735
+ return a;
1723
1736
  }
1724
1737
  };
1725
1738
  export {
1726
- it as AnimateUtils,
1727
- at as ArrayUtils,
1728
- mt as AssertUtils,
1729
- tt as AudioPlayer,
1730
- ot as BrowserUtils,
1731
- et as CanvasDrawer,
1732
- ct as Cookie,
1733
- lt as CoordsUtils,
1734
- ht as DateUtils,
1735
- nt as DevicePixelRatio,
1736
- ut as DomUtils,
1737
- p as ErrorType,
1738
- q as EventDispatcher,
1739
- b as EventType,
1740
- dt as FileUtils,
1741
- j as GeoUtils,
1742
- V as GraphicType,
1743
- U as HashMap,
1744
- Q as LayerType,
1745
- g as MathUtils,
1746
- X as MeasureMode,
1747
- Z as ObjectState,
1748
- ft as OptimizeUtils,
1749
- K as StringUtils,
1750
- E as Utils,
1751
- st as WebSocketClient,
1752
- rt as WebStorage
1739
+ U as ArrayUtil,
1740
+ v as AudioPlayer,
1741
+ N as BrowserUtil,
1742
+ P as CanvasDrawer,
1743
+ B as ColorUtil,
1744
+ F as Cookie,
1745
+ $ as CoordsUtil,
1746
+ W as DateUtil,
1747
+ L as DevicePixelRatio,
1748
+ q as DomUtil,
1749
+ D as ErrorType,
1750
+ A as EventDispatcher,
1751
+ M as EventType,
1752
+ z as FileUtil,
1753
+ G as GeoUtil,
1754
+ I as GraphicType,
1755
+ E as HashMap,
1756
+ H as JsonUtil,
1757
+ C as LayerType,
1758
+ m as MathUtil,
1759
+ _ as MeasureMode,
1760
+ T as ObjectState,
1761
+ K as OptimizeUtil,
1762
+ w as StoreUtil,
1763
+ j as StringUtil,
1764
+ Y as UrlUtil,
1765
+ y as Util,
1766
+ k as WebSocketClient
1753
1767
  };