gis-common 3.1.6 → 3.1.8

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.
@@ -14,3 +14,8 @@ export declare const MeasureMode: {
14
14
  AREA: string;
15
15
  HEIGHT: string;
16
16
  };
17
+ export declare const ObjectState: {
18
+ ADD: string;
19
+ REMOVE: string;
20
+ INIT: string;
21
+ };
@@ -0,0 +1,34 @@
1
+ interface StorageData {
2
+ key: string;
3
+ value: any;
4
+ expired?: number;
5
+ }
6
+ export default class WebStorage {
7
+ private cacheType;
8
+ private storage;
9
+ constructor(type?: number);
10
+ /**
11
+ * 设置带过期时间的LocalStorage
12
+ * @param key 缓存关键字
13
+ * @param value 缓存对象,可以是任意类型
14
+ * @param expired 以秒为单位,默认为1小时
15
+ * @returns {Object}
16
+ */
17
+ setItem(key: string, value: string, expired: number): StorageData;
18
+ /***
19
+ * 获取带过期时间的缓存
20
+ * @param key
21
+ * @returns {null|*}
22
+ */
23
+ getItem(key: string): string | null;
24
+ /**
25
+ * 移除指定缓存
26
+ * @param keys
27
+ */
28
+ remove(keys: string): void;
29
+ /**
30
+ * 移出全部缓存
31
+ */
32
+ clear(): void;
33
+ }
34
+ export {};
@@ -0,0 +1,7 @@
1
+ export { default as AudioPlayer } from './AudioPlayer';
2
+ export { default as CanvasDrawer } from './CanvasDrawer';
3
+ export { default as DevicePixelRatio } from './DevicePixelRatio';
4
+ export { default as EventDispatcher } from './EventDispatcher';
5
+ export { default as HashMap } from './HashMap';
6
+ export { default as WebSocketClient } from './WebSocketClient';
7
+ export { default as WebStorage } from './WebStorage';
@@ -1,35 +1,7 @@
1
1
  var G = Object.defineProperty;
2
2
  var z = (t, e, n) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var P = (t, e, n) => z(t, typeof e != "symbol" ? e + "" : e, n);
4
- const Y = {
5
- /**
6
- * 多属性的动画函数
7
- * @param {*} ele 需要运动的节点
8
- * @param {*} attr_options 传入的是一个需要运动的属性包括运动的目标值,操作的节点属性
9
- * @param {*} timefn 运动的形式,默认是缓冲运动
10
- * @param {*} speed 运动的速度
11
- */
12
- animate(t, e, n, r = "swing", a = 5) {
13
- for (var s in e)
14
- e[s] = {
15
- target: s === "opacity" ? parseInt(e[s] * 100) : e[s],
16
- // 需要计算得到
17
- iNow: parseInt(s === "opacity" ? getComputedStyle(t)[s] * 100 : getComputedStyle(t)[s])
18
- };
19
- r === "liner" && (a = e[s].iNow < e[s].target ? Math.abs(a) : -Math.abs(a)), clearInterval(t.timer), t.timer = setInterval(function() {
20
- for (var i in e) {
21
- var o = e[i].target, c = e[i].iNow;
22
- if (r === "swing" && (a = (o - c) / 20, a = a > 0 ? Math.ceil(a) : Math.floor(a)), Math.abs(o - c) <= Math.abs(a)) {
23
- i === "opacity" ? t.style[i] = o / 100 : t.style[i] = o + "px", delete e[i];
24
- for (var l in e)
25
- return !1;
26
- clearInterval(t.timer), typeof n == "function" && n();
27
- } else
28
- e[i].iNow += a, i === "opacity" ? t.style[i] = e[i].iNow / 100 : t.style[i] = e[i].iNow + "px";
29
- }
30
- }, 30);
31
- }
32
- }, v = {
3
+ var v = (t, e, n) => z(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const b = {
33
5
  MAP_RENDER: "mapRender",
34
6
  MAP_READY: "mapReady",
35
7
  MOUSE_CLICK: "click",
@@ -72,7 +44,7 @@ const Y = {
72
44
  PARAMETER_ERROR_OBJECT: "格式类型验证失败:必须是对象",
73
45
  PARAMETER_ERROR_LACK: "参数缺失",
74
46
  STRING_CHECK_LOSS: "字符缺少关键字"
75
- }, K = {
47
+ }, H = {
76
48
  SUPER_MAP_IMAGES: "SuperMapImages",
77
49
  // 超图影像服务 栅格数据
78
50
  SUPER_MAP_DATA: "SuperMapData",
@@ -86,7 +58,7 @@ const Y = {
86
58
  // addS3MGroupLayer(url, options, index) 添加S3M分组图层。
87
59
  TERRAIN_LAYER: "TerrainFileLayer"
88
60
  // 地形图层, 需要单独处理
89
- }, J = {
61
+ }, K = {
90
62
  POINT: "point",
91
63
  POLYLINE: "polyline",
92
64
  POLYGON: "polygon",
@@ -96,10 +68,34 @@ const Y = {
96
68
  LABEL: "label",
97
69
  MODEL: "model",
98
70
  WALL: "wall"
99
- }, V = {
100
- DISTANCE: "distance",
101
- AREA: "area",
102
- HEIGHT: "height"
71
+ }, J = {
72
+ /**
73
+ * 多属性的动画函数
74
+ * @param {*} ele 需要运动的节点
75
+ * @param {*} attr_options 传入的是一个需要运动的属性包括运动的目标值,操作的节点属性
76
+ * @param {*} timefn 运动的形式,默认是缓冲运动
77
+ * @param {*} speed 运动的速度
78
+ */
79
+ animate(t, e, n, r = "swing", a = 5) {
80
+ for (var s in e)
81
+ e[s] = {
82
+ target: s === "opacity" ? parseInt(e[s] * 100) : e[s],
83
+ // 需要计算得到
84
+ iNow: parseInt(s === "opacity" ? getComputedStyle(t)[s] * 100 : getComputedStyle(t)[s])
85
+ };
86
+ r === "liner" && (a = e[s].iNow < e[s].target ? Math.abs(a) : -Math.abs(a)), clearInterval(t.timer), t.timer = setInterval(function() {
87
+ for (var i in e) {
88
+ var o = e[i].target, c = e[i].iNow;
89
+ if (r === "swing" && (a = (o - c) / 20, a = a > 0 ? Math.ceil(a) : Math.floor(a)), Math.abs(o - c) <= Math.abs(a)) {
90
+ i === "opacity" ? t.style[i] = o / 100 : t.style[i] = o + "px", delete e[i];
91
+ for (var l in e)
92
+ return !1;
93
+ clearInterval(t.timer), typeof n == "function" && n();
94
+ } else
95
+ e[i].iNow += a, i === "opacity" ? t.style[i] = e[i].iNow / 100 : t.style[i] = e[i].iNow + "px";
96
+ }
97
+ }, 30);
98
+ }
103
99
  }, E = {
104
100
  /**
105
101
  * 判断数据类型
@@ -311,7 +307,7 @@ Array.prototype.asc = function(t = (e) => e) {
311
307
  Array.prototype.clear = function() {
312
308
  return this.length = 0, this;
313
309
  };
314
- const Q = {
310
+ const V = {
315
311
  asArray(t) {
316
312
  return E.isEmpty(t) ? [] : Array.isArray(t) ? t : [t];
317
313
  },
@@ -336,7 +332,7 @@ const Q = {
336
332
  difference(...t) {
337
333
  return this.union(...t).filter((e) => !this.intersection(...t).includes(e));
338
334
  }
339
- }, X = {
335
+ }, Q = {
340
336
  getUrlParams(t = window.location.href, e = !0) {
341
337
  const n = /([^&=]+)=([\w\W]*?)(&|$|#)/g, { search: r, hash: a } = new URL(t), s = [r, a];
342
338
  let i = {};
@@ -394,7 +390,7 @@ const Q = {
394
390
  const t = document.documentElement.clientWidth || document.body.clientWidth, e = document.querySelector("html");
395
391
  e.style.fontSize = t / 192 + "px";
396
392
  }
397
- }, Z = {
393
+ }, X = {
398
394
  set: function(t, e, n = 30) {
399
395
  var r = /* @__PURE__ */ new Date();
400
396
  r.setTime(r.getTime() + n * 24 * 60 * 60 * 1e3), document.cookie = t + "=" + escape(e) + ";expires=" + r.toUTCString();
@@ -409,7 +405,7 @@ const Q = {
409
405
  var e = document.cookie.match(new RegExp("(^| )" + t + "=([^;]*)(;|$)"));
410
406
  return e != null ? e[2] : "";
411
407
  }
412
- }, tt = {
408
+ }, Z = {
413
409
  PI: 3.141592653589793,
414
410
  XPI: 3.141592653589793 * 3e3 / 180,
415
411
  delta(t, e) {
@@ -437,10 +433,10 @@ const Q = {
437
433
  },
438
434
  // GCJ-02 to WGS-84 exactly
439
435
  gcjDecryptExact(t, e) {
440
- let a = 0.01, s = 0.01, i = t - a, o = e - s, c = t + a, l = e + s, h, u, d = 0;
436
+ let a = 0.01, s = 0.01, i = t - a, o = e - s, c = t + a, l = e + s, h = 0, u = 0, d = 0;
441
437
  for (; ; ) {
442
438
  h = (i + c) / 2, u = (o + l) / 2;
443
- const f = this.gcj_encrypt(h, u);
439
+ const f = this.gcjEncrypt(h, u);
444
440
  if (a = f.lat - t, s = f.lng - e, Math.abs(a) < 1e-9 && Math.abs(s) < 1e-9 || (a > 0 ? c = h : i = h, s > 0 ? l = u : o = u, ++d > 1e4)) break;
445
441
  }
446
442
  return { lat: h, lng: u };
@@ -548,7 +544,7 @@ Date.prototype.addDate = function(t, e) {
548
544
  }
549
545
  return n;
550
546
  };
551
- const et = {
547
+ const tt = {
552
548
  lastMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1),
553
549
  thisMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
554
550
  nextMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1),
@@ -611,7 +607,7 @@ function N(t) {
611
607
  function L(t) {
612
608
  return N(t).split(/\s+/);
613
609
  }
614
- const nt = {
610
+ const et = {
615
611
  getStyle(t, e) {
616
612
  let n = t.style[e] || t.currentStyle && t.currentStyle[e];
617
613
  if ((!n || n === "auto") && document.defaultView) {
@@ -800,20 +796,20 @@ const nt = {
800
796
  if (arguments.length != 2)
801
797
  return 0;
802
798
  lon1 = t.x, lat1 = t.y, lon2 = e.x, lat2 = e.y;
803
- var a = 6378137, s = 63567523142e-4, i = 1 / 298.257223563, o = r(lon2 - lon1), c = Math.atan((1 - i) * Math.tan(r(lat1))), l = Math.atan((1 - i) * Math.tan(r(lat2))), h = Math.sin(c), u = Math.cos(c), d = Math.sin(l), f = Math.cos(l), w = o, T, _ = 100;
799
+ var a = 6378137, s = 63567523142e-4, i = 1 / 298.257223563, o = r(lon2 - lon1), c = Math.atan((1 - i) * Math.tan(r(lat1))), l = Math.atan((1 - i) * Math.tan(r(lat2))), h = Math.sin(c), u = Math.cos(c), d = Math.sin(l), f = Math.cos(l), R = o, _, C = 100;
804
800
  do {
805
- var b = Math.sin(w), A = Math.cos(w), R = Math.sqrt(
806
- f * b * (f * b) + (u * d - h * f * A) * (u * d - h * f * A)
801
+ var A = Math.sin(R), x = Math.cos(R), w = Math.sqrt(
802
+ f * A * (f * A) + (u * d - h * f * x) * (u * d - h * f * x)
807
803
  );
808
- if (R == 0) return 0;
809
- var D = h * d + u * f * A, C = Math.atan2(R, D), x = u * f * b / R, O = 1 - x * x, p = D - 2 * h * d / O;
804
+ if (w == 0) return 0;
805
+ var D = h * d + u * f * x, P = Math.atan2(w, D), I = u * f * A / w, O = 1 - I * I, p = D - 2 * h * d / O;
810
806
  isNaN(p) && (p = 0);
811
- var I = i / 16 * O * (4 + i * (4 - 3 * O));
812
- T = w, w = o + (1 - I) * i * x * (C + I * R * (p + I * D * (-1 + 2 * p * p)));
813
- } while (Math.abs(w - T) > 1e-12 && --_ > 0);
814
- if (_ == 0)
807
+ var S = i / 16 * O * (4 + i * (4 - 3 * O));
808
+ _ = R, R = o + (1 - S) * i * I * (P + S * w * (p + S * D * (-1 + 2 * p * p)));
809
+ } while (Math.abs(R - _) > 1e-12 && --C > 0);
810
+ if (C == 0)
815
811
  return NaN;
816
- var M = O * (a * a - s * s) / (s * s), F = 1 + M / 16384 * (4096 + M * (-768 + M * (320 - 175 * M))), S = M / 1024 * (256 + M * (-128 + M * (74 - 47 * M))), B = S * R * (p + S / 4 * (D * (-1 + 2 * p * p) - S / 6 * p * (-3 + 4 * R * R) * (-3 + 4 * p * p))), $ = s * F * (C - B);
812
+ var M = O * (a * a - s * s) / (s * s), F = 1 + M / 16384 * (4096 + M * (-768 + M * (320 - 175 * M))), T = M / 1024 * (256 + M * (-128 + M * (74 - 47 * M))), B = T * w * (p + T / 4 * (D * (-1 + 2 * p * p) - T / 6 * p * (-3 + 4 * w * w) * (-3 + 4 * p * p))), $ = s * F * (P - B);
817
813
  return $;
818
814
  },
819
815
  /**
@@ -877,7 +873,7 @@ const nt = {
877
873
  const s = n / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a)));
878
874
  return { x: r, y: s };
879
875
  }
880
- }, rt = {
876
+ }, nt = {
881
877
  /**
882
878
  * 将base64类型编码的图片转换成blob类型
883
879
  *
@@ -950,7 +946,7 @@ const nt = {
950
946
  var n = document.createElement("a");
951
947
  n.href = t, n.download = e || "", n.click(), window.URL.revokeObjectURL(n.href);
952
948
  }
953
- }, st = {
949
+ }, rt = {
954
950
  /**
955
951
  * @desc 在事件被触发n秒后再执行回调函数,如果在这n秒内又被触发,则重新计时
956
952
  * @desc 防止onresize,scroll,mousemove ,mousehover等,会被频繁触发影响性能
@@ -1139,7 +1135,7 @@ const nt = {
1139
1135
  return t;
1140
1136
  }
1141
1137
  }
1142
- }, at = {
1138
+ }, st = {
1143
1139
  notNull(t) {
1144
1140
  if (E.isEmpty(t))
1145
1141
  throw Error("不能为空:>>>" + t);
@@ -1237,13 +1233,13 @@ const nt = {
1237
1233
  throw Error(m.PARAMETER_ERROR + ":>>>不是" + r);
1238
1234
  }
1239
1235
  };
1240
- class it {
1236
+ class at {
1241
1237
  constructor(e) {
1242
1238
  /**
1243
1239
  * Creates an instance of AudioPlayer.
1244
1240
  * @param {*} url
1245
1241
  */
1246
- P(this, "audio");
1242
+ v(this, "audio");
1247
1243
  this.audio = new Audio(), this.audio.src = e;
1248
1244
  }
1249
1245
  play() {
@@ -1262,7 +1258,7 @@ class it {
1262
1258
  this.audio.muted = e;
1263
1259
  }
1264
1260
  }
1265
- class ot {
1261
+ class it {
1266
1262
  constructor(e) {
1267
1263
  E.getDataType(e) === "String" && (e = document.querySelector("#" + e)), this.ctx = e.getContext("2d");
1268
1264
  }
@@ -1288,6 +1284,51 @@ class ot {
1288
1284
  o ? (this.cxt.fillStyle = c, this.cxt.beginPath(), this.cxt.arc(e, n, r, g.degreesToRadians(a), g.degreesToRadians(s), i), this.cxt.closePath(), this.cxt.fill()) : (this.cxt.strokeStyle = c, this.cxt.beginPath(), this.cxt.arc(e, n, r, g.degreesToRadians(a), g.degreesToRadians(s), i), this.cxt.stroke());
1289
1285
  }
1290
1286
  }
1287
+ class ot {
1288
+ constructor(e = 1) {
1289
+ this.magnification = e;
1290
+ }
1291
+ // 获取系统类型
1292
+ _getSystem() {
1293
+ var e = navigator.userAgent.toLowerCase();
1294
+ if (e.indexOf("windows") >= 0)
1295
+ return !0;
1296
+ }
1297
+ // 获取页面缩放比例
1298
+ // _getDevicePixelRatio() {
1299
+ // let t = this;
1300
+ // }
1301
+ // 监听方法兼容写法
1302
+ _addHandler(e, n, r) {
1303
+ e.addEventListener ? e.addEventListener(n, r, !1) : e.attachEvent ? e.attachEvent("on" + n, r) : e["on" + n] = r;
1304
+ }
1305
+ // 校正浏览器缩放比例
1306
+ _correct() {
1307
+ let e = window.innerWidth;
1308
+ if (typeof e != "number" && (document.compatMode == "CSS1Compat" ? e = document.documentElement.clientWidth : e = document.body.clientWidth), e <= 750) {
1309
+ const r = document.documentElement.clientWidth / e;
1310
+ document.documentElement.style.fontSize = this.magnification * 75 * Math.min(r, 2) + "px";
1311
+ } else if (e > 750 && e <= 1200) {
1312
+ const r = document.documentElement.clientWidth / e;
1313
+ document.documentElement.style.fontSize = this.magnification * 85 * Math.min(r, 2) + "px";
1314
+ } else {
1315
+ const r = document.documentElement.clientWidth / 1920;
1316
+ document.documentElement.style.fontSize = this.magnification * 100 * Math.min(r, 2) + "px";
1317
+ }
1318
+ }
1319
+ // 监听页面缩放
1320
+ _watch() {
1321
+ let e = this;
1322
+ e._addHandler(window, "resize", function() {
1323
+ e._correct();
1324
+ });
1325
+ }
1326
+ // 初始化页面比例
1327
+ init() {
1328
+ let e = this;
1329
+ e._getSystem() && (e._correct(), e._watch());
1330
+ }
1331
+ }
1291
1332
  function k() {
1292
1333
  }
1293
1334
  Object.assign(k.prototype, {
@@ -1373,22 +1414,22 @@ class y extends k {
1373
1414
  const e = this;
1374
1415
  this.client.onopen = function(n) {
1375
1416
  e.dispatchEvent({
1376
- type: v.WEB_SOCKET_CONNECT,
1417
+ type: b.WEB_SOCKET_CONNECT,
1377
1418
  message: n
1378
1419
  });
1379
1420
  }, this.client.onmessage = function(n) {
1380
1421
  e.connectStatus = !0, e.dispatchEvent({
1381
- type: v.WEB_SOCKET_MESSAGE,
1422
+ type: b.WEB_SOCKET_MESSAGE,
1382
1423
  message: n
1383
1424
  });
1384
1425
  }, this.client.onclose = function(n) {
1385
1426
  e.dispatchEvent({
1386
- type: v.WEB_SOCKET_CLOSE,
1427
+ type: b.WEB_SOCKET_CLOSE,
1387
1428
  message: n
1388
1429
  });
1389
1430
  }, this.checkTimes === this.maxCheckTimes && (this.client.onerror = function(n) {
1390
1431
  e.dispatchEvent({
1391
- type: v.WEB_SOCKET_ERROR,
1432
+ type: b.WEB_SOCKET_ERROR,
1392
1433
  message: n
1393
1434
  });
1394
1435
  });
@@ -1427,6 +1468,8 @@ class y extends k {
1427
1468
  }
1428
1469
  class ct {
1429
1470
  constructor(e = 1) {
1471
+ v(this, "cacheType");
1472
+ v(this, "storage");
1430
1473
  if (this.cacheType = e, e === 1)
1431
1474
  this.storage = window.localStorage;
1432
1475
  else if (e === 2)
@@ -1455,9 +1498,12 @@ class ct {
1455
1498
  * @returns {null|*}
1456
1499
  */
1457
1500
  getItem(e) {
1458
- const n = this.storage.getItem(e) || null, r = JSON.parse(n) || {};
1501
+ const n = this.storage.getItem(e);
1502
+ if (n === null)
1503
+ return null;
1504
+ const r = JSON.parse(n) || {};
1459
1505
  if (this.cacheType === 1) {
1460
- const a = r.expired || Date.now();
1506
+ const a = r.expired ? new Date(r.expired).getTime() : Date.now();
1461
1507
  if (Date.now() > a)
1462
1508
  return this.remove(e), null;
1463
1509
  }
@@ -1479,74 +1525,28 @@ class ct {
1479
1525
  this.storage.clear();
1480
1526
  }
1481
1527
  }
1482
- class lt {
1483
- constructor(e = 1) {
1484
- this.magnification = e;
1485
- }
1486
- // 获取系统类型
1487
- _getSystem() {
1488
- var e = navigator.userAgent.toLowerCase();
1489
- if (e.indexOf("windows") >= 0)
1490
- return !0;
1491
- }
1492
- // 获取页面缩放比例
1493
- // _getDevicePixelRatio() {
1494
- // let t = this;
1495
- // }
1496
- // 监听方法兼容写法
1497
- _addHandler(e, n, r) {
1498
- e.addEventListener ? e.addEventListener(n, r, !1) : e.attachEvent ? e.attachEvent("on" + n, r) : e["on" + n] = r;
1499
- }
1500
- // 校正浏览器缩放比例
1501
- _correct() {
1502
- let e = window.innerWidth;
1503
- if (typeof e != "number" && (document.compatMode == "CSS1Compat" ? e = document.documentElement.clientWidth : e = document.body.clientWidth), e <= 750) {
1504
- const r = document.documentElement.clientWidth / e;
1505
- document.documentElement.style.fontSize = this.magnification * 75 * Math.min(r, 2) + "px";
1506
- } else if (e > 750 && e <= 1200) {
1507
- const r = document.documentElement.clientWidth / e;
1508
- document.documentElement.style.fontSize = this.magnification * 85 * Math.min(r, 2) + "px";
1509
- } else {
1510
- const r = document.documentElement.clientWidth / 1920;
1511
- document.documentElement.style.fontSize = this.magnification * 100 * Math.min(r, 2) + "px";
1512
- }
1513
- }
1514
- // 监听页面缩放
1515
- _watch() {
1516
- let e = this;
1517
- e._addHandler(window, "resize", function() {
1518
- e._correct();
1519
- });
1520
- }
1521
- // 初始化页面比例
1522
- init() {
1523
- let e = this;
1524
- e._getSystem() && (e._correct(), e._watch());
1525
- }
1526
- }
1527
1528
  export {
1528
- Y as AnimateUtils,
1529
- Q as ArrayUtils,
1530
- at as AssertUtils,
1531
- it as AudioPlayer,
1532
- X as BrowserUtils,
1533
- ot as CanvasDrawer,
1534
- Z as Cookie,
1535
- tt as CoordsUtils,
1536
- et as DateUtils,
1537
- lt as DevicePixelRatio,
1538
- nt as DomUtils,
1529
+ J as AnimateUtils,
1530
+ V as ArrayUtils,
1531
+ st as AssertUtils,
1532
+ at as AudioPlayer,
1533
+ Q as BrowserUtils,
1534
+ it as CanvasDrawer,
1535
+ X as Cookie,
1536
+ Z as CoordsUtils,
1537
+ tt as DateUtils,
1538
+ ot as DevicePixelRatio,
1539
+ et as DomUtils,
1539
1540
  m as ErrorType,
1540
1541
  k as EventDispatcher,
1541
- v as EventType,
1542
- rt as FileUtils,
1542
+ b as EventType,
1543
+ nt as FileUtils,
1543
1544
  j as GeoUtils,
1544
- J as GraphicType,
1545
+ K as GraphicType,
1545
1546
  U as HashMap,
1546
- K as LayerType,
1547
+ H as LayerType,
1547
1548
  g as MathUtils,
1548
- V as MeasureMode,
1549
- st as OptimizeUtils,
1549
+ rt as OptimizeUtils,
1550
1550
  q as StringUtils,
1551
1551
  E as Utils,
1552
1552
  y as WebSocketClient,
@@ -1 +1 @@
1
- (function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ct=Object.defineProperty;var lt=(l,m,E)=>m in l?ct(l,m,{enumerable:!0,configurable:!0,writable:!0,value:E}):l[m]=E;var $=(l,m,E)=>lt(l,typeof m!="symbol"?m+"":m,E);const m={animate(t,e,n,r="swing",a=5){for(var s in e)e[s]={target:s==="opacity"?parseInt(e[s]*100):e[s],iNow:parseInt(s==="opacity"?getComputedStyle(t)[s]*100:getComputedStyle(t)[s])};r==="liner"&&(a=e[s].iNow<e[s].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval(function(){for(var i in e){var o=e[i].target,c=e[i].iNow;if(r==="swing"&&(a=(o-c)/20,a=a>0?Math.ceil(a):Math.floor(a)),Math.abs(o-c)<=Math.abs(a)){i==="opacity"?t.style[i]=o/100:t.style[i]=o+"px",delete e[i];for(var h in e)return!1;clearInterval(t.timer),typeof n=="function"&&n()}else e[i].iNow+=a,i==="opacity"?t.style[i]=e[i].iNow/100:t.style[i]=e[i].iNow+"px"}},30)}},E={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},M={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},G={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},z={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},j={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},y={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},json2Query(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}var s=e.join("&");return s},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const a=n[r];t[0]===a&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,a,s;for(r=0,a=e.length;r<a;r++){s=e[r];for(n in s)t[n]=s[n]}return t},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},convertToTree2(t,e="id",n="parentId",r="children"){const a=[];function s(i){const o=i[e],c=t.filter(h=>h.hasOwnProperty(n)&&h[n]===o);c.length>0&&(c.forEach(s),i[r]=c)}for(const i of t)t.findIndex(o=>o[e]===i[n])===-1&&(s(i),a.push(i));return a},asyncLoadScript(t){return new Promise((e,n)=>{try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(a){n(a)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,function(r,a){var s=e[a];if(s===void 0)throw new Error(M.JSON_VALUE_ERROR+r);return typeof s=="function"&&(s=s(e)),s})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(){let t=arguments.length,e=arguments[0];this.getDataType(e)!=="Object"&&(e={});for(let n=1;n<t;n++){let r=arguments[n];if(this.getDataType(r)==="Object")for(let a in r)a==="__proto__"||e===r[a]||(this.getDataType(r[a])==="Object"?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");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,r)=>{document.execCommand("copy")?n():r(new Error("copy failed")),e.remove()})}}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const a=t(r);!n[a]&&(n[a]=e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};const q={asArray(t){return y.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},H={getUrlParams(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:a}=new URL(t),s=[r,a];let i={};for(let o=0;o<s.length;o++){const c=s[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)i[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return i},getExplorer(){var t=window.navigator.userAgent;if(t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window)return"IE";if(t.indexOf("Firefox")>=0)return"Firefox";if(t.indexOf("Chrome")>=0)return"Chrome";if(t.indexOf("Opera")>=0)return"Opera";if(t.indexOf("Safari")>=0)return"Safari"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,a=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/e,a=16/9;let s=t/1920;r>a&&(s=e/1080),n.transformOrigin="left top",n.transform=`scale(${s}) translateX(-49.99%)`,n.width=`${t/s}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e.style.fontSize=t/192+"px"}},Y={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},K={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let a=this.transformLat(e-105,t-35),s=this.transformLon(e-105,t-35);const i=t/180*this.PI;let o=Math.sin(i);o=1-r*o*o;const c=Math.sqrt(o);return a=a*180/(6378245*(1-r)/(o*c)*this.PI),s=s*180/(6378245/c*Math.cos(i)*this.PI),{lat:a,lng:s}},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let a=.01,s=.01,i=t-a,o=e-s,c=t+a,h=e+s,u,d,f=0;for(;;){u=(i+c)/2,d=(o+h)/2;const p=this.gcj_encrypt(u,d);if(a=p.lat-t,s=p.lng-e,Math.abs(a)<1e-9&&Math.abs(s)<1e-9||(a>0?c=u:i=u,s>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(t,e){const n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s)+.0065;return{lat:a*Math.sin(s)+.006,lng:i}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s);return{lat:a*Math.sin(s),lng:i}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},distance(t,e,n,r){const s=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180),i=Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);let o=s+i;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));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},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));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},randomCoordinate(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length===1?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const J={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));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)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));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)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),a=new Date(e).getTime()-n.getTime(),s=Math.floor(a/(24*3600*1e3)),i=a%(24*3600*1e3),o=Math.floor(i/(3600*1e3)),c=i%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return s>0&&(f+=s+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),s===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),r=t%3600,a=e(Math.floor(r/60)),s=r%60,i=e(Math.round(s));return`${n}:${a}:${i}`},sleep(t){}};function L(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function U(t){return L(t).split(/\s+/)}const V={getStyle(t,e){let n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||n==="auto")&&document.defaultView){const r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return n==="auto"?null:n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal},hasClass(t,e){if(t.classList!==void 0)return t.classList.contains(e);const n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass(t,e){if(t.classList!==void 0){const n=U(e);for(let r=0,a=n.length;r<a;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?U(e).forEach(r=>t.classList.remove(r)):this.setClass(t,L((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},w={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},N={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return t&&e&&+e>-90&&+e<90&&+t>-180&&+t<180},formatLnglat(t,e){let n="";function r(a){const s=parseFloat(a),i=parseInt(s);let o=parseInt((s-i)*60),c=(s-i)*3600-o*60;return i+"°"+o+"′"+c.toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat(t,e){function n(r){for(var a=/[sw]/i.test(r),s=a?-1:1,i=r.match(/[\d.]+/g),o=0,c=0,h=i.length;c<h;c++)o+=i[c]/s,s*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,a=!1,s=0,i=e.length,o=i-1;s<i;o=s,s++){var c=e[s].x,h=e[s].y,u=e[o].x,d=e[o].y;if(c===n&&h===r||u===n&&d===r)return"on";if(h<r&&d>=r||h>=r&&d<r){var f=c+(r-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance(t,e){var n=Math.PI;function r(ot){return ot*n/180}if(arguments.length!=2)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a=6378137,s=63567523142e-4,i=1/298.257223563,o=r(lon2-lon1),c=Math.atan((1-i)*Math.tan(r(lat1))),h=Math.atan((1-i)*Math.tan(r(lat2))),u=Math.sin(c),d=Math.cos(c),f=Math.sin(h),p=Math.cos(h),v=o,F,B=100;do{var T=Math.sin(v),C=Math.cos(v),D=Math.sqrt(p*T*(p*T)+(d*f-u*p*C)*(d*f-u*p*C));if(D==0)return 0;var b=u*f+d*p*C,W=Math.atan2(D,b),_=d*p*T/D,A=1-_*_,g=b-2*u*f/A;isNaN(g)&&(g=0);var x=i/16*A*(4+i*(4-3*A));F=v,v=o+(1-x)*i*_*(W+x*D*(g+x*b*(-1+2*g*g)))}while(Math.abs(v-F)>1e-12&&--B>0);if(B==0)return NaN;var R=A*(a*a-s*s)/(s*s),st=1+R/16384*(4096+R*(-768+R*(320-175*R))),P=R/1024*(256+R*(-128+R*(74-47*R))),at=P*D*(g+P/4*(b*(-1+2*g*g)-P/6*g*(-3+4*D*D)*(-3+4*g*g))),it=s*st*(W-at);return it},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,a=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:a}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:a,y:s}=e,i=a-n,o=s-r,c=Math.sqrt(i*i+o*o);return{angle:(Math.atan2(o,i)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),s=parseFloat(e.lng),i=Math.sin((s-r)*this.toRadian)*Math.cos(a*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((s-r)*this.toRadian),c=Math.atan2(i,o)*(180/Math.PI),h=(a-n)*this.toRadian,u=(s-r)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),p=this.R*f;return{angle:c,distance:p}},calcPointByBearAndDis(t,e,n){const r=w.toRadians(parseFloat(t.lat)),a=w.toRadians(parseFloat(t.lng));e=parseFloat(e),n=parseFloat(n);const s=n/this.R;e=w.toRadians(e);const i=Math.asin(Math.sin(r)*Math.cos(s)+Math.cos(r)*Math.sin(s)*Math.cos(e)),o=a+Math.atan2(Math.sin(e)*Math.sin(s)*Math.cos(r),Math.cos(s)-Math.sin(r)*Math.sin(i));return{lat:w.toDegrees(i),lng:w.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const a=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:a}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var a=e*Math.PI/180;const s=n/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)));return{x:r,y:s}}},Q={convertBase64ToBlob(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),s=0;s<n.length;s++)a[s]=n.charCodeAt(s);var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return i?(i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder),i.append(r),i.getBlob(e)):(i=new Blob([r],{type:e}),i)},convertUrlToBase64(t,e,n){return new Promise(function(r,a){var s=new Image;s.crossOrigin="Anonymous",s.src=t,s.onload=function(){var i=document.createElement("canvas");i.width=e||s.width,i.height=n||s.height;var o=i.getContext("2d");o.drawImage(s,0,0,s.width,s.height);var c=s.src.substring(s.src.lastIndexOf(".")+1).toLowerCase(),h=i.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};r(u)}})},convertBase64ToFile(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),s=a.length,i=new Uint8Array(s);s--;)i[s]=a.charCodeAt(s);return new File([i],e,{type:r})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),a=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(a)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},X={debounce(t,e,n=!0){let r,a,s,i,o;const c=function(){const h=+new Date-i;h<e&&h>0?r=setTimeout(c,e-h):(r=null,n||(o=t.apply(s,a),r||(s=a=null)))};return function(...h){s=this,i=+new Date;const u=n&&!r;return r||(r=setTimeout(c,e)),u&&(o=t.apply(s,h),s=h=null),o}},throttle(t,e,n){if(n===1)var r=0;else if(n===2)var a;return function(){let s=this,i=arguments;if(n===1){let o=Date.now();o-r>e&&(t.apply(s,i),r=o)}else n===2&&(a||(a=setTimeout(()=>{a=null,t.apply(s,i)},e)))}},recurve(t,e=500,n=5e3){let r=0;setTimeout(function a(){r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))})}},k={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":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);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(y.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,a)=>`${n}${e[a-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2),s=a;s<t.length;s++){let i=t.substring(e,s);if(i.replace(r,"mm").length>=n)return i}return t},asString(t){if(y.isEmpty(t))return"";switch(y.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},Z={notNull(t){if(y.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat(t,e){if(!N.isLnglat(t,e))throw Error(M.COORDINATE_ERROR)},contain(t,...e){let n=!1;const r=e.length||0;for(let a=0,s=r;a<s;a++)n=t.indexOf(e[a])>=0;if(n)throw Error(M.STRING_CHECK_LOSS)},verify:{array(t){if(y.getDataType(t)!=="Array")throw Error(M.PARAMETER_ERROR_ARRAY+":>>>"+t)},function(t){if(y.getDataType(t)!=="Function")throw Error(M.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object(t){if(y.getDataType(t)!=="Object")throw Error(M.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON(t){try{JSON.parse(t)}catch{throw Error(M.JSON_PARSE_ERROR+":>>>"+t)}},legalData(t,e){const n=k.checkStr(t,e);let r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记";break}if(!n)throw Error(M.PARAMETER_ERROR+":>>>不是"+r)}};class tt{constructor(e){$(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}class et{constructor(e){y.getDataType(e)==="String"&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}drawLine(e,n,r,a,s={}){this.cxt.beginPath();const i=s.width||1,o=s.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(e,n),this.cxt.lineTo(r,a),this.cxt.closePath(),this.cxt.fill()}drawArc(e,n,r,a,s,i,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,w.degreesToRadians(a),w.degreesToRadians(s),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,w.degreesToRadians(a),w.degreesToRadians(s),i),this.cxt.stroke())}}function S(){}Object.assign(S.prototype,{addEventListener(t,e,n,r=!1){this._listeners===void 0&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;const a=this._mutex,s=this._listeners;return s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&(r&&(a[t]=e),s[t].push(e)),this},hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),r!==void 0){const a=r.map(s=>s.toString()).indexOf(e.toString());a!==-1&&r.splice(a,1)}},dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);if(this._mutex[t.type]){r.find(s=>s===this._mutex[t.type]).call(this._context||this,t);return}for(let a=0,s=r.length;a<s;a++)r[a].call(this._context||this,t)}},removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}),Object.assign(Map.prototype,{isEmpty(){return this.size===0},_values(){return Array.from(Map.prototype.values.call(this))},_keys(){return Array.from(Map.prototype.keys.call(this))},_entries(){return Array.from(Map.prototype.entries.call(this))}});function I(){return new Map}I.fromEntries=function(t=[]){const e=new I;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class O extends S{constructor(e="ws://127.0.0.1:10088"){super(),this.maxCheckTimes=10,this.url=e,this.checkTimes=0,this.connectStatus=!1,this.connect(),this.connCheckStatus(this.maxCheckTimes),O.instance=this}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const e=this;this.client.onopen=function(n){e.dispatchEvent({type:E.WEB_SOCKET_CONNECT,message:n})},this.client.onmessage=function(n){e.connectStatus=!0,e.dispatchEvent({type:E.WEB_SOCKET_MESSAGE,message:n})},this.client.onclose=function(n){e.dispatchEvent({type:E.WEB_SOCKET_CLOSE,message:n})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(n){e.dispatchEvent({type:E.WEB_SOCKET_ERROR,message:n})})}}catch(e){console.error("创建ws连接失败"+this.url+":"+e)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(e){this.checkTimes>e||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(e)},2e3)}send(e){return this.client&&this.client.readyState===1?(this.client.send(e),!0):(console.error(this.url+"消息发送失败:"+e),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}static getInstance(){return O.instance?O.instance:Object.freeze(new O)}static get _instance(){return this.getInstance()}}class nt{constructor(e=1){if(this.cacheType=e,e===1)this.storage=window.localStorage;else if(e===2)this.storage=window.sessionStorage;else throw new Error(M.PARAMETER_ERROR)}setItem(e,n,r){const a={key:e,value:n};if(this.cacheType===1){const s=Date.now();r&&(a.expired=s+r*1e3)}return this.storage[e]=JSON.stringify(a),a}getItem(e){const n=this.storage.getItem(e)||null,r=JSON.parse(n)||{};if(this.cacheType===1){const a=r.expired||Date.now();if(Date.now()>a)return this.remove(e),null}return r.value}remove(e){e&&(e.indexOf(",")>-1?e.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(e))}clear(){this.storage.clear()}}class rt{constructor(e=1){this.magnification=e}_getSystem(){var e=navigator.userAgent.toLowerCase();if(e.indexOf("windows")>=0)return!0}_addHandler(e,n,r){e.addEventListener?e.addEventListener(n,r,!1):e.attachEvent?e.attachEvent("on"+n,r):e["on"+n]=r}_correct(){let e=window.innerWidth;if(typeof e!="number"&&(document.compatMode=="CSS1Compat"?e=document.documentElement.clientWidth:e=document.body.clientWidth),e<=750){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*75*Math.min(r,2)+"px"}else if(e>750&&e<=1200){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*85*Math.min(r,2)+"px"}else{const r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(r,2)+"px"}}_watch(){let e=this;e._addHandler(window,"resize",function(){e._correct()})}init(){let e=this;e._getSystem()&&(e._correct(),e._watch())}}l.AnimateUtils=m,l.ArrayUtils=q,l.AssertUtils=Z,l.AudioPlayer=tt,l.BrowserUtils=H,l.CanvasDrawer=et,l.Cookie=Y,l.CoordsUtils=K,l.DateUtils=J,l.DevicePixelRatio=rt,l.DomUtils=V,l.ErrorType=M,l.EventDispatcher=S,l.EventType=E,l.FileUtils=Q,l.GeoUtils=N,l.GraphicType=z,l.HashMap=I,l.LayerType=G,l.MathUtils=w,l.MeasureMode=j,l.OptimizeUtils=X,l.StringUtils=k,l.Utils=y,l.WebSocketClient=O,l.WebStorage=nt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ot=Object.defineProperty;var ct=(l,m,p)=>m in l?ot(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var A=(l,m,p)=>ct(l,typeof m!="symbol"?m+"":m,p);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},p={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},$={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},G={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},z={animate(t,e,n,r="swing",a=5){for(var s in e)e[s]={target:s==="opacity"?parseInt(e[s]*100):e[s],iNow:parseInt(s==="opacity"?getComputedStyle(t)[s]*100:getComputedStyle(t)[s])};r==="liner"&&(a=e[s].iNow<e[s].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval(function(){for(var i in e){var o=e[i].target,c=e[i].iNow;if(r==="swing"&&(a=(o-c)/20,a=a>0?Math.ceil(a):Math.floor(a)),Math.abs(o-c)<=Math.abs(a)){i==="opacity"?t.style[i]=o/100:t.style[i]=o+"px",delete e[i];for(var h in e)return!1;clearInterval(t.timer),typeof n=="function"&&n()}else e[i].iNow+=a,i==="opacity"?t.style[i]=e[i].iNow/100:t.style[i]=e[i].iNow+"px"}},30)}},M={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},json2Query(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}var s=e.join("&");return s},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const a=n[r];t[0]===a&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,a,s;for(r=0,a=e.length;r<a;r++){s=e[r];for(n in s)t[n]=s[n]}return t},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},convertToTree2(t,e="id",n="parentId",r="children"){const a=[];function s(i){const o=i[e],c=t.filter(h=>h.hasOwnProperty(n)&&h[n]===o);c.length>0&&(c.forEach(s),i[r]=c)}for(const i of t)t.findIndex(o=>o[e]===i[n])===-1&&(s(i),a.push(i));return a},asyncLoadScript(t){return new Promise((e,n)=>{try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(a){n(a)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,function(r,a){var s=e[a];if(s===void 0)throw new Error(p.JSON_VALUE_ERROR+r);return typeof s=="function"&&(s=s(e)),s})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(){let t=arguments.length,e=arguments[0];this.getDataType(e)!=="Object"&&(e={});for(let n=1;n<t;n++){let r=arguments[n];if(this.getDataType(r)==="Object")for(let a in r)a==="__proto__"||e===r[a]||(this.getDataType(r[a])==="Object"?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");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,r)=>{document.execCommand("copy")?n():r(new Error("copy failed")),e.remove()})}}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const a=t(r);!n[a]&&(n[a]=e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};const j={asArray(t){return M.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},q={getUrlParams(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:a}=new URL(t),s=[r,a];let i={};for(let o=0;o<s.length;o++){const c=s[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)i[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return i},getExplorer(){var t=window.navigator.userAgent;if(t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window)return"IE";if(t.indexOf("Firefox")>=0)return"Firefox";if(t.indexOf("Chrome")>=0)return"Chrome";if(t.indexOf("Opera")>=0)return"Opera";if(t.indexOf("Safari")>=0)return"Safari"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,a=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/e,a=16/9;let s=t/1920;r>a&&(s=e/1080),n.transformOrigin="left top",n.transform=`scale(${s}) translateX(-49.99%)`,n.width=`${t/s}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e.style.fontSize=t/192+"px"}},Y={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},H={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let a=this.transformLat(e-105,t-35),s=this.transformLon(e-105,t-35);const i=t/180*this.PI;let o=Math.sin(i);o=1-r*o*o;const c=Math.sqrt(o);return a=a*180/(6378245*(1-r)/(o*c)*this.PI),s=s*180/(6378245/c*Math.cos(i)*this.PI),{lat:a,lng:s}},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let a=.01,s=.01,i=t-a,o=e-s,c=t+a,h=e+s,u=0,d=0,f=0;for(;;){u=(i+c)/2,d=(o+h)/2;const g=this.gcjEncrypt(u,d);if(a=g.lat-t,s=g.lng-e,Math.abs(a)<1e-9&&Math.abs(s)<1e-9||(a>0?c=u:i=u,s>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(t,e){const n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s)+.0065;return{lat:a*Math.sin(s)+.006,lng:i}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s);return{lat:a*Math.sin(s),lng:i}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},distance(t,e,n,r){const s=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180),i=Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);let o=s+i;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));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},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));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},randomCoordinate(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length===1?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const K={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));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)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));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)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),a=new Date(e).getTime()-n.getTime(),s=Math.floor(a/(24*3600*1e3)),i=a%(24*3600*1e3),o=Math.floor(i/(3600*1e3)),c=i%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return s>0&&(f+=s+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),s===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),r=t%3600,a=e(Math.floor(r/60)),s=r%60,i=e(Math.round(s));return`${n}:${a}:${i}`},sleep(t){}};function L(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function U(t){return L(t).split(/\s+/)}const J={getStyle(t,e){let n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||n==="auto")&&document.defaultView){const r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return n==="auto"?null:n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal},hasClass(t,e){if(t.classList!==void 0)return t.classList.contains(e);const n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass(t,e){if(t.classList!==void 0){const n=U(e);for(let r=0,a=n.length;r<a;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?U(e).forEach(r=>t.classList.remove(r)):this.setClass(t,L((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},k={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return t&&e&&+e>-90&&+e<90&&+t>-180&&+t<180},formatLnglat(t,e){let n="";function r(a){const s=parseFloat(a),i=parseInt(s);let o=parseInt((s-i)*60),c=(s-i)*3600-o*60;return i+"°"+o+"′"+c.toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat(t,e){function n(r){for(var a=/[sw]/i.test(r),s=a?-1:1,i=r.match(/[\d.]+/g),o=0,c=0,h=i.length;c<h;c++)o+=i[c]/s,s*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,a=!1,s=0,i=e.length,o=i-1;s<i;o=s,s++){var c=e[s].x,h=e[s].y,u=e[o].x,d=e[o].y;if(c===n&&h===r||u===n&&d===r)return"on";if(h<r&&d>=r||h>=r&&d<r){var f=c+(r-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance(t,e){var n=Math.PI;function r(it){return it*n/180}if(arguments.length!=2)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a=6378137,s=63567523142e-4,i=1/298.257223563,o=r(lon2-lon1),c=Math.atan((1-i)*Math.tan(r(lat1))),h=Math.atan((1-i)*Math.tan(r(lat2))),u=Math.sin(c),d=Math.cos(c),f=Math.sin(h),g=Math.cos(h),O=o,F,B=100;do{var I=Math.sin(O),C=Math.cos(O),R=Math.sqrt(g*I*(g*I)+(d*f-u*g*C)*(d*f-u*g*C));if(R==0)return 0;var v=u*f+d*g*C,W=Math.atan2(R,v),_=d*g*I/R,b=1-_*_,E=v-2*u*f/b;isNaN(E)&&(E=0);var x=i/16*b*(4+i*(4-3*b));F=O,O=o+(1-x)*i*_*(W+x*R*(E+x*v*(-1+2*E*E)))}while(Math.abs(O-F)>1e-12&&--B>0);if(B==0)return NaN;var w=b*(a*a-s*s)/(s*s),rt=1+w/16384*(4096+w*(-768+w*(320-175*w))),P=w/1024*(256+w*(-128+w*(74-47*w))),st=P*R*(E+P/4*(v*(-1+2*E*E)-P/6*E*(-3+4*R*R)*(-3+4*E*E))),at=s*rt*(W-st);return at},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,a=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:a}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:a,y:s}=e,i=a-n,o=s-r,c=Math.sqrt(i*i+o*o);return{angle:(Math.atan2(o,i)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),s=parseFloat(e.lng),i=Math.sin((s-r)*this.toRadian)*Math.cos(a*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((s-r)*this.toRadian),c=Math.atan2(i,o)*(180/Math.PI),h=(a-n)*this.toRadian,u=(s-r)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),g=this.R*f;return{angle:c,distance:g}},calcPointByBearAndDis(t,e,n){const r=y.toRadians(parseFloat(t.lat)),a=y.toRadians(parseFloat(t.lng));e=parseFloat(e),n=parseFloat(n);const s=n/this.R;e=y.toRadians(e);const i=Math.asin(Math.sin(r)*Math.cos(s)+Math.cos(r)*Math.sin(s)*Math.cos(e)),o=a+Math.atan2(Math.sin(e)*Math.sin(s)*Math.cos(r),Math.cos(s)-Math.sin(r)*Math.sin(i));return{lat:y.toDegrees(i),lng:y.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const a=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:a}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var a=e*Math.PI/180;const s=n/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)));return{x:r,y:s}}},V={convertBase64ToBlob(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),s=0;s<n.length;s++)a[s]=n.charCodeAt(s);var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return i?(i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder),i.append(r),i.getBlob(e)):(i=new Blob([r],{type:e}),i)},convertUrlToBase64(t,e,n){return new Promise(function(r,a){var s=new Image;s.crossOrigin="Anonymous",s.src=t,s.onload=function(){var i=document.createElement("canvas");i.width=e||s.width,i.height=n||s.height;var o=i.getContext("2d");o.drawImage(s,0,0,s.width,s.height);var c=s.src.substring(s.src.lastIndexOf(".")+1).toLowerCase(),h=i.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};r(u)}})},convertBase64ToFile(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),s=a.length,i=new Uint8Array(s);s--;)i[s]=a.charCodeAt(s);return new File([i],e,{type:r})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),a=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(a)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},Q={debounce(t,e,n=!0){let r,a,s,i,o;const c=function(){const h=+new Date-i;h<e&&h>0?r=setTimeout(c,e-h):(r=null,n||(o=t.apply(s,a),r||(s=a=null)))};return function(...h){s=this,i=+new Date;const u=n&&!r;return r||(r=setTimeout(c,e)),u&&(o=t.apply(s,h),s=h=null),o}},throttle(t,e,n){if(n===1)var r=0;else if(n===2)var a;return function(){let s=this,i=arguments;if(n===1){let o=Date.now();o-r>e&&(t.apply(s,i),r=o)}else n===2&&(a||(a=setTimeout(()=>{a=null,t.apply(s,i)},e)))}},recurve(t,e=500,n=5e3){let r=0;setTimeout(function a(){r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))})}},N={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":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);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,a)=>`${n}${e[a-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2),s=a;s<t.length;s++){let i=t.substring(e,s);if(i.replace(r,"mm").length>=n)return i}return t},asString(t){if(M.isEmpty(t))return"";switch(M.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},X={notNull(t){if(M.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat(t,e){if(!k.isLnglat(t,e))throw Error(p.COORDINATE_ERROR)},contain(t,...e){let n=!1;const r=e.length||0;for(let a=0,s=r;a<s;a++)n=t.indexOf(e[a])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(t){if(M.getDataType(t)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+t)},function(t){if(M.getDataType(t)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object(t){if(M.getDataType(t)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON(t){try{JSON.parse(t)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+t)}},legalData(t,e){const n=N.checkStr(t,e);let r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+r)}};class Z{constructor(e){A(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}class tt{constructor(e){M.getDataType(e)==="String"&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}drawLine(e,n,r,a,s={}){this.cxt.beginPath();const i=s.width||1,o=s.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(e,n),this.cxt.lineTo(r,a),this.cxt.closePath(),this.cxt.fill()}drawArc(e,n,r,a,s,i,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,y.degreesToRadians(a),y.degreesToRadians(s),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,y.degreesToRadians(a),y.degreesToRadians(s),i),this.cxt.stroke())}}class et{constructor(e=1){this.magnification=e}_getSystem(){var e=navigator.userAgent.toLowerCase();if(e.indexOf("windows")>=0)return!0}_addHandler(e,n,r){e.addEventListener?e.addEventListener(n,r,!1):e.attachEvent?e.attachEvent("on"+n,r):e["on"+n]=r}_correct(){let e=window.innerWidth;if(typeof e!="number"&&(document.compatMode=="CSS1Compat"?e=document.documentElement.clientWidth:e=document.body.clientWidth),e<=750){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*75*Math.min(r,2)+"px"}else if(e>750&&e<=1200){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*85*Math.min(r,2)+"px"}else{const r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(r,2)+"px"}}_watch(){let e=this;e._addHandler(window,"resize",function(){e._correct()})}init(){let e=this;e._getSystem()&&(e._correct(),e._watch())}}function S(){}Object.assign(S.prototype,{addEventListener(t,e,n,r=!1){this._listeners===void 0&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;const a=this._mutex,s=this._listeners;return s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&(r&&(a[t]=e),s[t].push(e)),this},hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),r!==void 0){const a=r.map(s=>s.toString()).indexOf(e.toString());a!==-1&&r.splice(a,1)}},dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);if(this._mutex[t.type]){r.find(s=>s===this._mutex[t.type]).call(this._context||this,t);return}for(let a=0,s=r.length;a<s;a++)r[a].call(this._context||this,t)}},removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}),Object.assign(Map.prototype,{isEmpty(){return this.size===0},_values(){return Array.from(Map.prototype.values.call(this))},_keys(){return Array.from(Map.prototype.keys.call(this))},_entries(){return Array.from(Map.prototype.entries.call(this))}});function T(){return new Map}T.fromEntries=function(t=[]){const e=new T;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class D extends S{constructor(e="ws://127.0.0.1:10088"){super(),this.maxCheckTimes=10,this.url=e,this.checkTimes=0,this.connectStatus=!1,this.connect(),this.connCheckStatus(this.maxCheckTimes),D.instance=this}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const e=this;this.client.onopen=function(n){e.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:n})},this.client.onmessage=function(n){e.connectStatus=!0,e.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:n})},this.client.onclose=function(n){e.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:n})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(n){e.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:n})})}}catch(e){console.error("创建ws连接失败"+this.url+":"+e)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(e){this.checkTimes>e||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(e)},2e3)}send(e){return this.client&&this.client.readyState===1?(this.client.send(e),!0):(console.error(this.url+"消息发送失败:"+e),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}static getInstance(){return D.instance?D.instance:Object.freeze(new D)}static get _instance(){return this.getInstance()}}class nt{constructor(e=1){A(this,"cacheType");A(this,"storage");if(this.cacheType=e,e===1)this.storage=window.localStorage;else if(e===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(e,n,r){const a={key:e,value:n};if(this.cacheType===1){const s=Date.now();r&&(a.expired=s+r*1e3)}return this.storage[e]=JSON.stringify(a),a}getItem(e){const n=this.storage.getItem(e);if(n===null)return null;const r=JSON.parse(n)||{};if(this.cacheType===1){const a=r.expired?new Date(r.expired).getTime():Date.now();if(Date.now()>a)return this.remove(e),null}return r.value}remove(e){e&&(e.indexOf(",")>-1?e.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(e))}clear(){this.storage.clear()}}l.AnimateUtils=z,l.ArrayUtils=j,l.AssertUtils=X,l.AudioPlayer=Z,l.BrowserUtils=q,l.CanvasDrawer=tt,l.Cookie=Y,l.CoordsUtils=H,l.DateUtils=K,l.DevicePixelRatio=et,l.DomUtils=J,l.ErrorType=p,l.EventDispatcher=S,l.EventType=m,l.FileUtils=V,l.GeoUtils=k,l.GraphicType=G,l.HashMap=T,l.LayerType=$,l.MathUtils=y,l.OptimizeUtils=Q,l.StringUtils=N,l.Utils=M,l.WebSocketClient=D,l.WebStorage=nt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/dist/index.d.ts CHANGED
@@ -1,9 +1,4 @@
1
- export * from './utils';
2
- export * from './constant';
3
- export { default as AudioPlayer } from './core/AudioPlayer';
4
- export { default as CanvasDrawer } from './core/CanvasDrawer';
5
- export { default as EventDispatcher } from './core/EventDispatcher';
6
- export { default as HashMap } from './core/HashMap';
7
- export { default as WebSocketClient } from './core/WebSocketClient';
8
- export { default as WebStorage } from './core/WebStorage';
9
- export { default as DevicePixelRatio } from './core/DevicePixelRatio';
1
+ import { ErrorType, EventType, GraphicType, LayerType } from './constant';
2
+ import { AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils } from './utils';
3
+ import { AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage } from './core';
4
+ export { ErrorType, EventType, GraphicType, LayerType, AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils, AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage, };
@@ -0,0 +1,25 @@
1
+ interface Coordinate {
2
+ lng: number;
3
+ lat: number;
4
+ }
5
+ declare const _default: {
6
+ PI: number;
7
+ XPI: number;
8
+ delta(lat: number, lng: number): Coordinate;
9
+ gcjEncrypt(wgsLat: number, wgsLon: number): Coordinate;
10
+ gcjDecrypt(gcjLat: number, gcjLon: number): Coordinate;
11
+ gcjDecryptExact(gcjLat: number, gcjLon: number): Coordinate;
12
+ bdEncrypt(gcjLat: number, gcjLon: number): Coordinate;
13
+ bdDecrypt(bdLat: number, bdLon: number): {
14
+ lat: number;
15
+ lng: number;
16
+ };
17
+ mercatorEncrypt(wgsLat: number, wgsLon: number): Coordinate;
18
+ mercatorDecrypt(mercatorLat: number, mercatorLon: number): Coordinate;
19
+ distance(latA: number, lngA: number, latB: number, lngB: number): number;
20
+ outOfChina(lat: number, lng: number): boolean;
21
+ transformLat(x: number, y: number): number;
22
+ transformLon(x: number, y: number): number;
23
+ randomCoordinate(minX: number, minY: number, maxX: number, maxY: number): Coordinate;
24
+ };
25
+ export default _default;
@@ -0,0 +1,14 @@
1
+ export { default as AnimateUtils } from './AnimateUtils';
2
+ export { default as ArrayUtils } from './ArrayUtils';
3
+ export { default as BrowserUtils } from './BrowserUtils';
4
+ export { default as Cookie } from './Cookie';
5
+ export { default as CoordsUtils } from './CoordsUtils';
6
+ export { default as DateUtils } from './DateUtils';
7
+ export { default as DomUtils } from './DomUtils';
8
+ export { default as GeoUtils } from './GeoUtils';
9
+ export { default as FileUtils } from './FileUtils';
10
+ export { default as MathUtils } from './MathUtils';
11
+ export { default as OptimizeUtils } from './OptimizeUtils';
12
+ export { default as StringUtils } from './StringUtils';
13
+ export { default as AssertUtils } from './AssertUtils';
14
+ export { default as Utils } from './CommUtils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gis-common",
3
- "version": "3.1.6",
3
+ "version": "3.1.8",
4
4
  "author": "Guo.Yan <luv02@vip.qq.com>",
5
5
  "license": "MIT",
6
6
  "private": false,