gis-common 4.2.7 → 4.2.9

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.
@@ -9,22 +9,6 @@ export default class AudioPlayer {
9
9
  * @param {*} url
10
10
  */
11
11
  private audio;
12
- /**
13
- * 朗读文本
14
- *
15
- * @param message 要朗读的文本内容
16
- * @param options 朗读选项,可选参数包括:
17
- * - lang: 使用的语言,默认为中文
18
- * - volume: 声音音量,默认为1
19
- * - rate: 语速,默认为1
20
- * - pitch: 音高,默认为1
21
- */
22
- static speak(message: string, options?: {
23
- lang?: string;
24
- volume?: number;
25
- rate?: number;
26
- pitch?: number;
27
- }): void;
28
12
  constructor(url: string);
29
13
  play(): void;
30
14
  pause(): void;
@@ -106,25 +106,6 @@ class AudioPlayer {
106
106
  this.audio = new Audio();
107
107
  this.audio.src = url;
108
108
  }
109
- /**
110
- * 朗读文本
111
- *
112
- * @param message 要朗读的文本内容
113
- * @param options 朗读选项,可选参数包括:
114
- * - lang: 使用的语言,默认为中文
115
- * - volume: 声音音量,默认为1
116
- * - rate: 语速,默认为1
117
- * - pitch: 音高,默认为1
118
- */
119
- static speak(message, options = {}) {
120
- const msg = new SpeechSynthesisUtterance();
121
- msg.text = message;
122
- msg.lang = options.lang || "zh-CN";
123
- msg.volume = options.volume || 1;
124
- msg.rate = options.rate || 1;
125
- msg.pitch = options.pitch || 1;
126
- window.speechSynthesis.speak(msg);
127
- }
128
109
  play() {
129
110
  !this.muted && this.audio.play();
130
111
  }
@@ -661,7 +642,7 @@ const AjaxUtil = {
661
642
  * }
662
643
  * );
663
644
  */
664
- get(url, options, cb) {
645
+ get(url, options = {}, cb) {
665
646
  if (CommUtils.isFunction(options)) {
666
647
  const t = cb;
667
648
  cb = options;
@@ -906,9 +887,7 @@ const MathUtils = {
906
887
  return Math.max(min, Math.min(max, val));
907
888
  }
908
889
  };
909
- const GeoUtil = {
910
- toRadian: Math.PI / 180,
911
- R: 6371393,
890
+ class GeoUtil {
912
891
  /**
913
892
  * 判断给定的经纬度是否合法
914
893
  *
@@ -916,9 +895,9 @@ const GeoUtil = {
916
895
  * @param lat 纬度值
917
896
  * @returns 如果经纬度合法,返回true;否则返回false
918
897
  */
919
- isLnglat(lng, lat) {
898
+ static isLnglat(lng, lat) {
920
899
  return !isNaN(lng) && !isNaN(lat) && !!(+lat > -90 && +lat < 90 && +lng > -180 && +lng < 180);
921
- },
900
+ }
922
901
  /**
923
902
  * 计算两哥平面坐标点间的距离
924
903
  *
@@ -926,9 +905,9 @@ const GeoUtil = {
926
905
  * @param p2 坐标点2,包含x和y属性
927
906
  * @returns 返回两点间的欧几里得距离
928
907
  */
929
- distance(p1, p2) {
908
+ static distance(p1, p2) {
930
909
  return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
931
- },
910
+ }
932
911
  /**
933
912
  * 计算两个经纬度点之间的距离
934
913
  *
@@ -936,7 +915,7 @@ const GeoUtil = {
936
915
  * @param B 经纬度点B,包含lng(经度)和lat(纬度)两个属性
937
916
  * @returns 返回两点之间的距离,单位为米
938
917
  */
939
- distanceByPoints(A, B) {
918
+ static distanceByPoints(A, B) {
940
919
  const { lng: lngA, lat: latA } = A;
941
920
  const { lng: lngB, lat: latB } = B;
942
921
  const earthR = 6371e3;
@@ -948,7 +927,7 @@ const GeoUtil = {
948
927
  const alpha = Math.acos(s);
949
928
  const distance = alpha * earthR;
950
929
  return distance;
951
- },
930
+ }
952
931
  /**
953
932
  * 格式化经纬度为度分秒格式
954
933
  *
@@ -956,7 +935,7 @@ const GeoUtil = {
956
935
  * @param lat 纬度
957
936
  * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
958
937
  */
959
- formatLnglat(lng, lat) {
938
+ static formatLnglat(lng, lat) {
960
939
  let res = "";
961
940
  function formatDegreeToDMS(valueInDegrees) {
962
941
  const degree = Math.floor(valueInDegrees);
@@ -972,7 +951,7 @@ const GeoUtil = {
972
951
  res = formatDegreeToDMS(lat);
973
952
  }
974
953
  return res;
975
- },
954
+ }
976
955
  /**
977
956
  * 将经纬度字符串转换为度
978
957
  *
@@ -980,7 +959,7 @@ const GeoUtil = {
980
959
  * @param lat 纬度字符串
981
960
  * @returns 转换后的经纬度对象
982
961
  */
983
- transformLnglat(lng, lat) {
962
+ static transformLnglat(lng, lat) {
984
963
  function dms2deg(dmsString) {
985
964
  const isNegative = /[sw]/i.test(dmsString);
986
965
  let factor = isNegative ? -1 : 1;
@@ -998,7 +977,7 @@ const GeoUtil = {
998
977
  lat: dms2deg(lat)
999
978
  };
1000
979
  }
1001
- },
980
+ }
1002
981
  /**
1003
982
  * 射线法判断点是否在多边形内
1004
983
  *
@@ -1006,7 +985,7 @@ const GeoUtil = {
1006
985
  * @param poly 多边形顶点数组,可以是字符串数组或对象数组
1007
986
  * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
1008
987
  */
1009
- rayCasting(p, poly) {
988
+ static rayCasting(p, poly) {
1010
989
  var px = p.x, py = p.y, flag = false;
1011
990
  for (var i = 0, l = poly.length, j = l - 1; i < l; j = i, i++) {
1012
991
  var sx = poly[i].x, sy = poly[i].y, tx = poly[j].x, ty = poly[j].y;
@@ -1024,7 +1003,7 @@ const GeoUtil = {
1024
1003
  }
1025
1004
  }
1026
1005
  return flag ? "in" : "out";
1027
- },
1006
+ }
1028
1007
  /**
1029
1008
  * 旋转点
1030
1009
  *
@@ -1033,11 +1012,11 @@ const GeoUtil = {
1033
1012
  * @param θ 旋转角度(顺时针旋转为正)
1034
1013
  * @returns 旋转后点坐标
1035
1014
  */
1036
- rotatePoint(p1, p2, θ) {
1015
+ static rotatePoint(p1, p2, θ) {
1037
1016
  const x = (p1.x - p2.x) * Math.cos(Math.PI / 180 * -θ) - (p1.y - p2.y) * Math.sin(Math.PI / 180 * -θ) + p2.x;
1038
1017
  const y = (p1.x - p2.x) * Math.sin(Math.PI / 180 * -θ) + (p1.y - p2.y) * Math.cos(Math.PI / 180 * -θ) + p2.y;
1039
1018
  return { x, y };
1040
- },
1019
+ }
1041
1020
  /**
1042
1021
  * 根据两个平面坐标点计算方位角和距离
1043
1022
  *
@@ -1045,7 +1024,7 @@ const GeoUtil = {
1045
1024
  * @param p2 第二个点的坐标对象
1046
1025
  * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
1047
1026
  */
1048
- calcBearAndDis(p1, p2) {
1027
+ static calcBearAndDis(p1, p2) {
1049
1028
  const { x: x1, y: y1 } = p1;
1050
1029
  const { x: x2, y: y2 } = p2;
1051
1030
  const dx = x2 - x1;
@@ -1054,7 +1033,7 @@ const GeoUtil = {
1054
1033
  const angleInRadians = Math.atan2(dy, dx);
1055
1034
  const angle = (angleInRadians * (180 / Math.PI) + 360 + 90) % 360;
1056
1035
  return { angle, distance };
1057
- },
1036
+ }
1058
1037
  /**
1059
1038
  * 根据两个经纬度点计算方位角和距离
1060
1039
  *
@@ -1062,7 +1041,7 @@ const GeoUtil = {
1062
1041
  * @param latlng2 第二个经纬度点
1063
1042
  * @returns 包含方位角和距离的对象
1064
1043
  */
1065
- calcBearAndDisByPoints(latlng1, latlng2) {
1044
+ static calcBearAndDisByPoints(latlng1, latlng2) {
1066
1045
  var f1 = latlng1.lat * 1, l1 = latlng1.lng * 1, f2 = latlng2.lat * 1, l2 = latlng2.lng * 1;
1067
1046
  var y = Math.sin((l2 - l1) * this.toRadian) * Math.cos(f2 * this.toRadian);
1068
1047
  var x = Math.cos(f1 * this.toRadian) * Math.sin(f2 * this.toRadian) - Math.sin(f1 * this.toRadian) * Math.cos(f2 * this.toRadian) * Math.cos((l2 - l1) * this.toRadian);
@@ -1076,7 +1055,7 @@ const GeoUtil = {
1076
1055
  angle,
1077
1056
  distance
1078
1057
  };
1079
- },
1058
+ }
1080
1059
  /**
1081
1060
  * 计算点P到线段P1P2的最短距离
1082
1061
  *
@@ -1085,7 +1064,7 @@ const GeoUtil = {
1085
1064
  * @param p2 线段终点P2的坐标
1086
1065
  * @returns 点P到线段P1P2的最短距离
1087
1066
  */
1088
- distanceToSegment(p, p1, p2) {
1067
+ static distanceToSegment(p, p1, p2) {
1089
1068
  const x = p.x, y = p.y, x1 = p1.x, y1 = p1.y, x2 = p2.x, y2 = p2.y;
1090
1069
  const cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
1091
1070
  if (cross <= 0) {
@@ -1099,7 +1078,7 @@ const GeoUtil = {
1099
1078
  const px = x1 + (x2 - x1) * r;
1100
1079
  const py = y1 + (y2 - y1) * r;
1101
1080
  return Math.sqrt((x - px) * (x - px) + (y - py) * (y - py));
1102
- },
1081
+ }
1103
1082
  /**
1104
1083
  * 根据给定的经纬度、角度和距离计算新的经纬度点
1105
1084
  *
@@ -1108,7 +1087,7 @@ const GeoUtil = {
1108
1087
  * @param distance 距离值,单位为米,表示从当前点出发的距离
1109
1088
  * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
1110
1089
  */
1111
- calcPointByBearAndDis(latlng, angle, distance) {
1090
+ static calcPointByBearAndDis(latlng, angle, distance) {
1112
1091
  const sLat = MathUtils.deg2Rad(latlng.lat * 1);
1113
1092
  const sLng = MathUtils.deg2Rad(latlng.lng * 1);
1114
1093
  const d = distance / this.R;
@@ -1119,7 +1098,7 @@ const GeoUtil = {
1119
1098
  lat: MathUtils.rad2Deg(lat),
1120
1099
  lng: MathUtils.rad2Deg(lon)
1121
1100
  };
1122
- },
1101
+ }
1123
1102
  /**
1124
1103
  * 将墨卡托坐标转换为经纬度坐标
1125
1104
  *
@@ -1127,12 +1106,12 @@ const GeoUtil = {
1127
1106
  * @param y 墨卡托坐标的y值
1128
1107
  * @returns 返回包含转换后的经度lng和纬度lat的对象
1129
1108
  */
1130
- mercatorTolonlat(x, y) {
1109
+ static mercatorTolonlat(x, y) {
1131
1110
  const lng = x / 2003750834e-2 * 180;
1132
1111
  var mmy = y / 2003750834e-2 * 180;
1133
1112
  const lat = 180 / Math.PI * (2 * Math.atan(Math.exp(mmy * Math.PI / 180)) - Math.PI / 2);
1134
1113
  return { lng, lat };
1135
- },
1114
+ }
1136
1115
  /**
1137
1116
  * 将经纬度坐标转换为墨卡托坐标
1138
1117
  *
@@ -1140,13 +1119,13 @@ const GeoUtil = {
1140
1119
  * @param lat 纬度值
1141
1120
  * @returns 墨卡托坐标对象,包含x和y属性
1142
1121
  */
1143
- lonlatToMercator(lng, lat) {
1122
+ static lonlatToMercator(lng, lat) {
1144
1123
  var earthRad = 6378137;
1145
1124
  const x = lng * Math.PI / 180 * earthRad;
1146
1125
  var a = lat * Math.PI / 180;
1147
1126
  const y = earthRad / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a)));
1148
1127
  return { x, y };
1149
- },
1128
+ }
1150
1129
  /**
1151
1130
  * 根据百分比获取坐标
1152
1131
  *
@@ -1155,11 +1134,13 @@ const GeoUtil = {
1155
1134
  * @param percent 百分比,取值范围0-1
1156
1135
  * @returns 返回插值后的坐标
1157
1136
  */
1158
- interpolate({ x: x1, y: y1, z: z1 = 0 }, { x: x2, y: y2, z: z2 = 0 }, percent) {
1137
+ static interpolate({ x: x1, y: y1, z: z1 = 0 }, { x: x2, y: y2, z: z2 = 0 }, percent) {
1159
1138
  const dx = x2 - x1, dy = y2 - y1, dz = z2 - z1;
1160
1139
  return { x: x1 + dx * percent, y: y1 + dy * percent, z: z1 + dz * percent };
1161
1140
  }
1162
- };
1141
+ }
1142
+ __publicField(GeoUtil, "toRadian", Math.PI / 180);
1143
+ __publicField(GeoUtil, "R", 6371393);
1163
1144
  const StringUtil = {
1164
1145
  /**
1165
1146
  * 校验字符串是否符合指定类型
@@ -1864,6 +1845,18 @@ const ArrayUtil = {
1864
1845
  difference(...args) {
1865
1846
  if (args.length === 0) return [];
1866
1847
  return this.union(...args).filter((d) => !this.intersection(...args).includes(d));
1848
+ },
1849
+ /**
1850
+ * 对字符串数组进行中文排序
1851
+ *
1852
+ * @param arr 待排序的字符串数组
1853
+ * @returns 排序后的字符串数组
1854
+ */
1855
+ zhSort(arr, f = (d) => d, reverse) {
1856
+ arr.sort(function(a, b) {
1857
+ return reverse ? f(a).localeCompare(f(b), "zh") : f(b).localeCompare(f(a), "zh");
1858
+ });
1859
+ return arr;
1867
1860
  }
1868
1861
  };
1869
1862
  class BrowserUtil {
@@ -2133,7 +2126,7 @@ class BrowserUtil {
2133
2126
  }
2134
2127
  hander && clearInterval(hander);
2135
2128
  };
2136
- hander = setInterval(function() {
2129
+ hander = window.setInterval(function() {
2137
2130
  let ips = [...ipSet];
2138
2131
  if (ips.length) {
2139
2132
  closeConnect();
@@ -2178,10 +2171,8 @@ __publicField(BrowserUtil, "document", window == null ? void 0 : window.document
2178
2171
  __publicField(BrowserUtil, "navigator", window == null ? void 0 : window.navigator);
2179
2172
  __publicField(BrowserUtil, "userAgent", (_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent);
2180
2173
  __publicField(BrowserUtil, "screen", window == null ? void 0 : window.screen);
2181
- const CoordsUtil = {
2182
- PI: 3.141592653589793,
2183
- XPI: 3.141592653589793 * 3e3 / 180,
2184
- delta(lat, lng) {
2174
+ class CoordsUtil {
2175
+ static delta(lat, lng) {
2185
2176
  const a = 6378245;
2186
2177
  const ee = 0.006693421622965943;
2187
2178
  let dLat = this.transformLat(lng - 105, lat - 35);
@@ -2193,7 +2184,7 @@ const CoordsUtil = {
2193
2184
  dLat = dLat * 180 / (a * (1 - ee) / (magic * sqrtMagic) * this.PI);
2194
2185
  dLon = dLon * 180 / (a / sqrtMagic * Math.cos(radLat) * this.PI);
2195
2186
  return { lat: dLat, lng: dLon };
2196
- },
2187
+ }
2197
2188
  /**
2198
2189
  * 判断经纬度是否不在中国境内
2199
2190
  *
@@ -2201,7 +2192,7 @@ const CoordsUtil = {
2201
2192
  * @param lat 纬度
2202
2193
  * @returns 如果经纬度不在中国境内则返回true,否则返回false
2203
2194
  */
2204
- outOfChina(lng, lat) {
2195
+ static outOfChina(lng, lat) {
2205
2196
  if (lng < 72.004 || lng > 137.8347) {
2206
2197
  return true;
2207
2198
  }
@@ -2209,25 +2200,25 @@ const CoordsUtil = {
2209
2200
  return true;
2210
2201
  }
2211
2202
  return false;
2212
- },
2203
+ }
2213
2204
  // WGS-84 to GCJ-02
2214
- gcjEncrypt(wgsLat, wgsLon) {
2205
+ static gcjEncrypt(wgsLat, wgsLon) {
2215
2206
  if (this.outOfChina(wgsLat, wgsLon)) {
2216
2207
  return { lat: wgsLat, lng: wgsLon };
2217
2208
  }
2218
2209
  const d = this.delta(wgsLat, wgsLon);
2219
2210
  return { lat: wgsLat + d.lat, lng: wgsLon + d.lng };
2220
- },
2211
+ }
2221
2212
  // GCJ-02 to WGS-84
2222
- gcjDecrypt(gcjLat, gcjLon) {
2213
+ static gcjDecrypt(gcjLat, gcjLon) {
2223
2214
  if (this.outOfChina(gcjLat, gcjLon)) {
2224
2215
  return { lat: gcjLat, lng: gcjLon };
2225
2216
  }
2226
2217
  const d = this.delta(gcjLat, gcjLon);
2227
2218
  return { lat: gcjLat - d.lat, lng: gcjLon - d.lng };
2228
- },
2219
+ }
2229
2220
  // GCJ-02 to WGS-84 exactly
2230
- gcjDecryptExact(gcjLat, gcjLon) {
2221
+ static gcjDecryptExact(gcjLat, gcjLon) {
2231
2222
  const initDelta = 0.01;
2232
2223
  const threshold = 1e-9;
2233
2224
  let dLat = initDelta;
@@ -2255,9 +2246,9 @@ const CoordsUtil = {
2255
2246
  if (++i > 1e4) break;
2256
2247
  }
2257
2248
  return { lat: wgsLat, lng: wgsLon };
2258
- },
2249
+ }
2259
2250
  // GCJ-02 to BD-09
2260
- bdEncrypt(gcjLat, gcjLon) {
2251
+ static bdEncrypt(gcjLat, gcjLon) {
2261
2252
  const x = gcjLon;
2262
2253
  const y = gcjLat;
2263
2254
  const z = Math.sqrt(x * x + y * y) + 2e-5 * Math.sin(y * this.XPI);
@@ -2265,9 +2256,9 @@ const CoordsUtil = {
2265
2256
  const bdLon = z * Math.cos(theta) + 65e-4;
2266
2257
  const bdLat = z * Math.sin(theta) + 6e-3;
2267
2258
  return { lat: bdLat, lng: bdLon };
2268
- },
2259
+ }
2269
2260
  // BD-09 to GCJ-02
2270
- bdDecrypt(bdLat, bdLon) {
2261
+ static bdDecrypt(bdLat, bdLon) {
2271
2262
  const x = bdLon - 65e-4;
2272
2263
  const y = bdLat - 6e-3;
2273
2264
  const z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * this.XPI);
@@ -2275,37 +2266,37 @@ const CoordsUtil = {
2275
2266
  const gcjLon = z * Math.cos(theta);
2276
2267
  const gcjLat = z * Math.sin(theta);
2277
2268
  return { lat: gcjLat, lng: gcjLon };
2278
- },
2269
+ }
2279
2270
  // WGS-84 to Web mercator
2280
2271
  // mercatorLat -> y mercatorLon -> x
2281
- mercatorEncrypt(wgsLat, wgsLon) {
2272
+ static mercatorEncrypt(wgsLat, wgsLon) {
2282
2273
  const x = wgsLon * 2003750834e-2 / 180;
2283
2274
  let y = Math.log(Math.tan((90 + wgsLat) * this.PI / 360)) / (this.PI / 180);
2284
2275
  y = y * 2003750834e-2 / 180;
2285
2276
  return { lat: y, lng: x };
2286
- },
2277
+ }
2287
2278
  // Web mercator to WGS-84
2288
2279
  // mercatorLat -> y mercatorLon -> x
2289
- mercatorDecrypt(mercatorLat, mercatorLon) {
2280
+ static mercatorDecrypt(mercatorLat, mercatorLon) {
2290
2281
  const x = mercatorLon / 2003750834e-2 * 180;
2291
2282
  let y = mercatorLat / 2003750834e-2 * 180;
2292
2283
  y = 180 / this.PI * (2 * Math.atan(Math.exp(y * this.PI / 180)) - this.PI / 2);
2293
2284
  return { lat: y, lng: x };
2294
- },
2295
- transformLat(x, y) {
2285
+ }
2286
+ static transformLat(x, y) {
2296
2287
  let ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
2297
2288
  ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
2298
2289
  ret += (20 * Math.sin(y * this.PI) + 40 * Math.sin(y / 3 * this.PI)) * 2 / 3;
2299
2290
  ret += (160 * Math.sin(y / 12 * this.PI) + 320 * Math.sin(y * this.PI / 30)) * 2 / 3;
2300
2291
  return ret;
2301
- },
2302
- transformLon(x, y) {
2292
+ }
2293
+ static transformLon(x, y) {
2303
2294
  let ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
2304
2295
  ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
2305
2296
  ret += (20 * Math.sin(x * this.PI) + 40 * Math.sin(x / 3 * this.PI)) * 2 / 3;
2306
2297
  ret += (150 * Math.sin(x / 12 * this.PI) + 300 * Math.sin(x / 30 * this.PI)) * 2 / 3;
2307
2298
  return ret;
2308
- },
2299
+ }
2309
2300
  /**
2310
2301
  * 生成一个介于两个坐标之间的随机坐标
2311
2302
  *
@@ -2313,12 +2304,12 @@ const CoordsUtil = {
2313
2304
  * @param end 结束坐标,包含x和y属性
2314
2305
  * @returns 返回一个包含x和y属性的随机坐标
2315
2306
  */
2316
- random({ x: minX, y: minY }, { x: maxX, y: maxY }) {
2307
+ static random({ x: minX, y: minY }, { x: maxX, y: maxY }) {
2317
2308
  return {
2318
2309
  x: Math.random() * (maxX - minX) + minX,
2319
2310
  y: Math.random() * (maxY - minY) + minY
2320
2311
  };
2321
- },
2312
+ }
2322
2313
  /**
2323
2314
  * 对坐标数组进行解构并应用函数处理
2324
2315
  *
@@ -2327,7 +2318,7 @@ const CoordsUtil = {
2327
2318
  * @param context 函数执行上下文,可选
2328
2319
  * @returns 处理后的数组
2329
2320
  */
2330
- deCompose(arr, fn, context) {
2321
+ static deCompose(arr, fn, context) {
2331
2322
  if (!Array.isArray(arr)) {
2332
2323
  return context ? fn.call(context, arr) : fn(arr);
2333
2324
  }
@@ -2348,7 +2339,9 @@ const CoordsUtil = {
2348
2339
  }
2349
2340
  return result;
2350
2341
  }
2351
- };
2342
+ }
2343
+ __publicField(CoordsUtil, "PI", 3.141592653589793);
2344
+ __publicField(CoordsUtil, "XPI", 3.141592653589793 * 3e3 / 180);
2352
2345
  const myDate = Object.create(Date);
2353
2346
  myDate.prototype.format = function(fmt = "yyyy-MM-dd hh:mm:ss") {
2354
2347
  const o = {
@@ -2413,17 +2406,14 @@ myDate.prototype.addDate = function(interval, number) {
2413
2406
  }
2414
2407
  return date;
2415
2408
  };
2416
- const DateUtil = {
2417
- lastMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1),
2418
- thisMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
2419
- nextMonthDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1),
2420
- lastWeekDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - 7 - (/* @__PURE__ */ new Date()).getDay()),
2421
- thisWeekDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - (/* @__PURE__ */ new Date()).getDay()),
2422
- nextWeekDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 + 7 - (/* @__PURE__ */ new Date()).getDay()),
2423
- lastDayDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() - 1),
2424
- thisDayDate: new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)),
2425
- nextDayDate: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1),
2426
- parseDate(str) {
2409
+ class DateUtil {
2410
+ /**
2411
+ * 解析日期字符串,并返回对应的Date对象。
2412
+ *
2413
+ * @param str 日期字符串,格式为"yyyy-MM-dd"、"yyyy-MM-dd HH:mm:ss"或"yyyy-MM-dd HH:mm:ss.SSS"。
2414
+ * @returns 返回解析后的Date对象,如果解析失败则返回null。
2415
+ */
2416
+ static parseDate(str) {
2427
2417
  if (typeof str == "string") {
2428
2418
  var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
2429
2419
  if (results && results.length > 3) return new Date(parseInt(results[1]), parseInt(results[2]) - 1, parseInt(results[3]));
@@ -2450,7 +2440,7 @@ const DateUtil = {
2450
2440
  );
2451
2441
  }
2452
2442
  return null;
2453
- },
2443
+ }
2454
2444
  /**
2455
2445
  * 格式化时间间隔
2456
2446
  *
@@ -2458,7 +2448,7 @@ const DateUtil = {
2458
2448
  * @param endTime 结束时间,可以是字符串、数字或日期类型
2459
2449
  * @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
2460
2450
  */
2461
- formatDateInterval(startTime, endTime) {
2451
+ static formatDateInterval(startTime, endTime) {
2462
2452
  const dateCreateTime = new Date(startTime);
2463
2453
  const dateFinishTime = new Date(endTime);
2464
2454
  const dateInterval = dateFinishTime.getTime() - dateCreateTime.getTime();
@@ -2486,8 +2476,14 @@ const DateUtil = {
2486
2476
  intervalDes = "少于1秒";
2487
2477
  }
2488
2478
  return intervalDes;
2489
- },
2490
- formatterCounter(times) {
2479
+ }
2480
+ /**
2481
+ * 将给定的时间(秒)格式化为时:分:秒格式的字符串
2482
+ *
2483
+ * @param times 时间(秒)
2484
+ * @returns 返回格式化后的字符串
2485
+ */
2486
+ static formatterCounter(times) {
2491
2487
  const checked = function(j) {
2492
2488
  return (j > 10 ? "" : "0") + (j || 0);
2493
2489
  };
@@ -2497,10 +2493,25 @@ const DateUtil = {
2497
2493
  const leave2 = level1 % 60;
2498
2494
  const seconds = checked(Math.round(leave2));
2499
2495
  return `${houres}:${minutes}:${seconds}`;
2500
- },
2501
- sleep(d) {
2502
2496
  }
2503
- };
2497
+ /**
2498
+ * 静态方法:使当前线程暂停执行指定的毫秒数
2499
+ *
2500
+ * @param d 需要暂停的毫秒数
2501
+ * @returns 无返回值
2502
+ */
2503
+ static sleep(d) {
2504
+ }
2505
+ }
2506
+ __publicField(DateUtil, "lastMonthDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1));
2507
+ __publicField(DateUtil, "thisMonthDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1));
2508
+ __publicField(DateUtil, "nextMonthDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 1));
2509
+ __publicField(DateUtil, "lastWeekDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - 7 - (/* @__PURE__ */ new Date()).getDay()));
2510
+ __publicField(DateUtil, "thisWeekDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 - (/* @__PURE__ */ new Date()).getDay()));
2511
+ __publicField(DateUtil, "nextWeekDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1 + 7 - (/* @__PURE__ */ new Date()).getDay()));
2512
+ __publicField(DateUtil, "lastDayDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() - 1));
2513
+ __publicField(DateUtil, "thisDayDate", new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)));
2514
+ __publicField(DateUtil, "nextDayDate", new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate() + 1));
2504
2515
  function trim(str) {
2505
2516
  return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
2506
2517
  }
@@ -2738,6 +2749,53 @@ const FileUtil = {
2738
2749
  window.URL.revokeObjectURL(link.href);
2739
2750
  }
2740
2751
  };
2752
+ class MessageUtil {
2753
+ static warning(message) {
2754
+ if (process.env.NODE_ENV !== "production" && console !== void 0) {
2755
+ console.error(`Warning: ${message}`);
2756
+ }
2757
+ }
2758
+ static note(message) {
2759
+ if (process.env.NODE_ENV !== "production" && console !== void 0) {
2760
+ console.warn(`Note: ${message}`);
2761
+ }
2762
+ }
2763
+ static resetWarned() {
2764
+ this.warned = {};
2765
+ }
2766
+ static _call(method, message) {
2767
+ if (!this.warned[message]) {
2768
+ method(message);
2769
+ this.warned[message] = true;
2770
+ }
2771
+ }
2772
+ static warningOnce(message) {
2773
+ this._call(this.warning, message);
2774
+ }
2775
+ static noteOnce(message) {
2776
+ this._call(this.note, message);
2777
+ }
2778
+ /**
2779
+ * 朗读文本
2780
+ *
2781
+ * @param message 要朗读的文本内容
2782
+ * @param options 朗读选项,可选参数包括:
2783
+ * - lang: 使用的语言,默认为中文
2784
+ * - volume: 声音音量,默认为1
2785
+ * - rate: 语速,默认为1
2786
+ * - pitch: 音高,默认为1
2787
+ */
2788
+ static speak(message, options = {}) {
2789
+ const msg = new SpeechSynthesisUtterance();
2790
+ msg.text = message;
2791
+ msg.lang = options.lang || "zh-CN";
2792
+ msg.volume = options.volume || 1;
2793
+ msg.rate = options.rate || 1;
2794
+ msg.pitch = options.pitch || 1;
2795
+ window.speechSynthesis.speak(msg);
2796
+ }
2797
+ }
2798
+ __publicField(MessageUtil, "warned", {});
2741
2799
  const OptimizeUtil = {
2742
2800
  /**
2743
2801
  * 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。适用于像搜索输入框这种需要用户停止输入后才调用的场景
@@ -3594,6 +3652,7 @@ export {
3594
3652
  LineSymbol,
3595
3653
  MathUtils as MathUtil,
3596
3654
  MeasureMode,
3655
+ MessageUtil,
3597
3656
  MqttClient,
3598
3657
  ObjectState,
3599
3658
  ObjectUtil,
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.mqttBrowser)}(this,(function(t,e){"use strict";var n,s=Object.defineProperty,r=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),i=(t=>(t.MAP_RENDER="mapRender",t.MAP_READY="mapReady",t.MOUSE_CLICK="click",t.MOUSE_DOUBLE_CLICK="dblclick",t.MOUSE_MOVE="mousemove",t.MOUSE_IN="mousein",t.MOUSE_OUT="mouseout",t.MOUSE_RIGHT_CLICK="mouseRightClick",t.KEY_DOWN="keyDown",t.KEY_UP="keyUp",t.DRAW_ACTIVE="drawActive",t.DRAW_MOVE="drawMove",t.DRAW_COMPLETE="drawComplete",t.MQTT_CONNECT="mqttConnect",t.MQTT_ERROR="mqttError",t.MQTT_MESSAGE="mqttMessage",t.MQTT_CLOSE="mqttClose",t.WEB_SOCKET_CONNECT="webSocketConnect",t.WEB_SOCKET_ERROR="webSocketError",t.WEB_SOCKET_MESSAGE="webSocketMessage",t.WEB_SOCKET_CLOSE="webSocketClose",t))(i||{}),o=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.CROSS_ERROR="跨域访问",t.UNEXIST_RESOURCE="资源不存在",t.TIMEOUT="请求超时",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="处理失败",t.AUTH_VERIFY_ERROR="权限验证失败",t.NO_DATA_FOUND="未找到数据",t.DUPLICATE_INSTANCE="实例为单例模式,不允许重复构建",t.JSON_PARSE_ERROR="JSON解析失败,格式有误",t.JSON_VALUE_ERROR="JSON无此键",t.STRING_CHECK_LOSS="字符缺少关键字",t.PARAMETER_ERROR="验证数据类型失败",t.PARAMETER_ERROR_ARRAY="验证数据类型失败,必须是数组",t.PARAMETER_ERROR_STRING="验证数据类型失败,必须是字符",t.PARAMETER_ERROR_FUNCTION="验证数据类型失败,必须是函数",t.PARAMETER_ERROR_OBJECT="验证数据类型失败,必须是对象",t.PARAMETER_ERROR_INTEGER="验证数据类型失败,必须是整型",t.PARAMETER_ERROR_NUMBER="验证数据类型失败,必须是数值",t.PARAMETER_ERROR_LACK="验证数据类型失败,必须非空",t.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t))(o||{}),a=(t=>(t.SUPER_MAP_IMAGES="SuperMapImages",t.SUPER_MAP_DATA="SuperMapData",t.ARC_GIS_MAP_IMAGES="ArcGisMapImages",t.ARC_GIS_MAP_DATA="ArcGisMapData",t.OSGB_LAYER="OSGBLayer",t.S3M_GROUP="S3MGroup",t.TERRAIN_LAYER="TerrainFileLayer",t))(a||{}),l=(t=>(t.POINT="point",t.POLYLINE="polyline",t.POLYGON="polygon",t.BILLBOARD="billboard",t.CYLINDER="cylinder",t.ELLIPSOID="ellipsoid",t.LABEL="label",t.MODEL="model",t.WALL="wall",t))(l||{}),c=(t=>(t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(c||{}),h=(t=>(t.DISTANCE="distance",t.AREA="area",t.HEIGHT="height",t))(h||{}),u=(t=>(t.ADD="add",t.REMOVE="remove",t.INIT="init",t))(u||{});const d={getDataType:t=>Object.prototype.toString.call(t).slice(8,-1),asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber:t=>Number.isNaN(Number(t))?0:Number(t),asString(t){if(this.isEmpty(t))return"";switch(this.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},isEmpty(t){if(null==t)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}},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},guid(){const t=function(){return(65536*(1+Math.random())|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 s=0;s<n.length;s+=2){const r=n[s];t[0]===r&&(e=n[s+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,s,r,i;for(s=0,r=e.length;s<r;s++)for(n in i=e[s],i)t[n]=i[n];return t},convertToTree2(t,e="id",n="parentId",s="children"){const r=[];function i(o){const a=t.filter((t=>t[n]===o[e])).map((t=>(r.some((n=>n[e]===t[e]))||i(t),t)));a.length>0&&(o[s]=a)}return t.forEach((s=>{t.some((t=>t[n]===s[e]))||(i(s),r.push(s))})),r},asyncLoadScript:t=>new Promise(((e,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=t,"readyState"in s?s.onreadystatechange=function(){"complete"!==s.readyState&&"loaded"!==s.readyState||e(s)}:(s.onload=function(){e(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(s)}catch(s){n(s)}})),loadStyle(t){t.forEach((t=>{const e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",e.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(e)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,n)=>{const s=e[n];if(void 0===s)throw new Error(`${o.JSON_VALUE_ERROR}: ${t}`);return"function"==typeof s?s(e):s})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[e]])))},deepAssign(t,...e){"object"==typeof t&&null!==t||(t={});for(const n of e)if("object"==typeof n&&null!==n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&("object"==typeof n[e]&&null!==n[e]?(t[e]||(t[e]=Array.isArray(n[e])?[]:{}),this.deepAssign(t[e],n[e])):t[e]=n[e]);return t},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(((t,n)=>{try{document.execCommand("copy"),t()}catch(s){n(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>Object.prototype.toString.call(t).indexOf("Object")>-1,isNil:t=>void 0===t||"undefined"===t||null===t||"null"===t,isNumber:t=>"number"==typeof t&&!isNaN(t)||"string"==typeof t&&Number.isFinite(+t),isInteger:t=>parseInt(t)===t,isFunction(t){return!this.isNil(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)},isElement:t=>"object"==typeof t&&1===t.nodeType,checheVersion:(t,e)=>t.replace(/[^0-9]/gi,"")<e.replace(/[^0-9]/gi,"")},g={deepClone:t=>structuredClone(t),isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse:t=>t&&"string"==typeof t?JSON.parse(t):t},p={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",getURL(t){let e,n;if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)n=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const s=e.getContext("2d");s&&(t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height)),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64(t){return new Promise(((e,n)=>{let s=new Image;s.setAttribute("crossOrigin","Anonymous"),s.src=t,s.onload=()=>{let t=this.getURL(s);e(t)},s.onerror=n}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);return e&&e.groups?{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data}:null},async copyImage(t){try{const e=await this.getBase64(t),n=this.parseBase64(e.dataURL);if(!n)throw new Error("Failed to parse base64 data.");let s=n.type,r=atob(n.data),i=new ArrayBuffer(r.length),o=new Uint8Array(i);for(let t=0;t<r.length;t++)o[t]=r.charCodeAt(t);let a=new Blob([i],{type:s});await navigator.clipboard.write([new ClipboardItem({[s]:a})])}catch(e){console.error("Failed to copy image to clipboard:",e)}}},f={jsonp(t,e){const n="_jsonp_"+d.guid(),s=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let r=document.createElement("script");r.type="text/javascript",r.src=t,window[n]=function(t){e(null,t),s.removeChild(r),r=null,delete window[n]},s.appendChild(r)},get(t,e,n){if(d.isFunction(e)){const t=n;n=e,e=t}const s=this._getClient(n);if(s.open("GET",t,!0),e){for(const t in e.headers)s.setRequestHeader(t,e.headers[t]);s.withCredentials="include"===e.credentials,e.responseType&&(s.responseType=e.responseType)}return s.send(null),s},post(t,e={},n){let s;if("string"!=typeof t?(n=e.cb,s=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(n=e,e={}),s=e.postData),!n)throw new Error("Callback function is required");const r=this._getClient(n);return r.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach((t=>{r.setRequestHeader(t,e.headers[t])})),"string"!=typeof s&&(s=JSON.stringify(s)),r.send(s),r},_wrapCallback:(t,e)=>function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e(new Error("http status 200 returned without content.")):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e(new Error(t.statusText+","+t.status))},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch(n){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(d.isFunction(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,n)},getImage(t,e,n){return this.getArrayBuffer(e,n,((e,n)=>{if(e)t.onerror&&t.onerror(e);else if(n){const e=window.URL||window.webkitURL,s=t.onload;t.onload=()=>{s&&s(),e.revokeObjectURL(t.src)};const r=new Blob([new Uint8Array(n.data)],{type:n.contentType});t.cacheControl=n.cacheControl,t.expires=n.expires,t.src=n.data.byteLength?e.createObjectURL(r):p.emptyImageUrl}}))},getJSON(t,e,n){if(d.isFunction(e)){const t=n;n=e,e=t}const s=function(t,e){const s=e?g.parse(e):null;n&&n(t,s)};return e&&e.jsonp?this.jsonp(t,s):this.get(t,e,s)}},m={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:(t,e)=>t+Math.floor(Math.random()*(e-t+1)),randFloat:(t,e)=>t+Math.random()*(e-t),deg2Rad(t){return t*this.DEG2RAD},rad2Deg(t){return t*this.RAD2DEG},round:(t,e=2)=>Math.round(t*Math.pow(10,e))/Math.pow(10,e),clamp:(t,e,n)=>Math.max(e,Math.min(n,t))},y={toRadian:Math.PI/180,R:6371393,isLnglat:(t,e)=>!isNaN(t)&&!isNaN(e)&&!!(+e>-90&&+e<90&&+t>-180&&+t<180),distance:(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),distanceByPoints(t,e){const{lng:n,lat:s}=t,{lng:r,lat:i}=e;let o=Math.cos(s*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-r)*Math.PI/180)+Math.sin(s*Math.PI/180)*Math.sin(i*Math.PI/180);o>1&&(o=1),o<-1&&(o=-1);return 6371e3*Math.acos(o)},formatLnglat(t,e){let n="";function s(t){const e=Math.floor(t),n=Math.floor(60*(t-e));return`${e}°${n}′${(3600*(t-e)-60*n).toFixed(2)}″`}return this.isLnglat(t,e)?n=s(t)+","+s(e):isNaN(t)?isNaN(e)||(n=s(e)):n=s(t),n},transformLnglat(t,e){function n(t){let e=/[sw]/i.test(t)?-1:1;const n=t.match(/[\d.]+/g)||[];let s=0;for(let r=0;r<n.length;r++)s+=parseFloat(n[r])/e,e*=60;return s}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,s=t.y,r=!1,i=0,o=e.length,a=o-1;i<o;a=i,i++){var l=e[i].x,c=e[i].y,h=e[a].x,u=e[a].y;if(l===n&&c===s||h===n&&u===s)return"on";if(c<s&&u>=s||c>=s&&u<s){var d=l+(s-c)*(h-l)/(u-c);if(d===n)return"on";d>n&&(r=!r)}}return r?"in":"out"},rotatePoint:(t,e,n)=>({x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}),calcBearAndDis(t,e){const{x:n,y:s}=t,{x:r,y:i}=e,o=r-n,a=i-s,l=Math.sqrt(o*o+a*a);return{angle:(Math.atan2(a,o)*(180/Math.PI)+360+90)%360,distance:l}},calcBearAndDisByPoints(t,e){var n=1*t.lat,s=1*t.lng,r=1*e.lat,i=1*e.lng,o=Math.sin((i-s)*this.toRadian)*Math.cos(r*this.toRadian),a=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),l=Math.atan2(o,a)*(180/Math.PI),c=(r-n)*this.toRadian,h=(i-s)*this.toRadian,u=Math.sin(c/2)*Math.sin(c/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));return{angle:l,distance:this.R*d}},distanceToSegment(t,e,n){const s=t.x,r=t.y,i=e.x,o=e.y,a=n.x,l=n.y,c=(a-i)*(s-i)+(l-o)*(r-o);if(c<=0)return Math.sqrt((s-i)*(s-i)+(r-o)*(r-o));const h=(a-i)*(a-i)+(l-o)*(l-o);if(c>=h)return Math.sqrt((s-a)*(s-a)+(r-l)*(r-l));const u=c/h,d=i+(a-i)*u,g=o+(l-o)*u;return Math.sqrt((s-d)*(s-d)+(r-g)*(r-g))},calcPointByBearAndDis(t,e,n){const s=m.deg2Rad(1*t.lat),r=m.deg2Rad(1*t.lng),i=n/this.R;e=m.deg2Rad(e);const o=Math.asin(Math.sin(s)*Math.cos(i)+Math.cos(s)*Math.sin(i)*Math.cos(e)),a=r+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(s),Math.cos(i)-Math.sin(s)*Math.sin(o));return{lat:m.rad2Deg(o),lng:m.rad2Deg(a)}},mercatorTolonlat(t,e){var n=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2)}},lonlatToMercator(t,e){var n=6378137;const s=t*Math.PI/180*n;var r=e*Math.PI/180;return{x:s,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}},interpolate:({x:t,y:e,z:n=0},{x:s,y:r,z:i=0},o)=>({x:t+(s-t)*o,y:e+(r-e)*o,z:n+(i-n)*o})},E={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){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:(t,...e)=>(e=e.map((t=>{switch(d.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce(((t,n,s)=>`${t}${e[s-1]}${n}`))),getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,n){var s=/[^\x00-\xff]/g;if(t.replace(s,"mm").length<=n)return t;for(var r=Math.floor(n/2);r<t.length;r++){let i=t.substring(e,r);if(i.replace(s,"mm").length>=n)return i}return t},string2Bytes(t){const e=[];let n;const s=t.length;for(let r=0;r<s;r++)n=t.charCodeAt(r),n>=65536&&n<=1114111?(e.push(n>>18&7|240),e.push(n>>12&63|128),e.push(n>>6&63|128),e.push(63&n|128)):n>=2048&&n<=65535?(e.push(n>>12&15|224),e.push(n>>6&63|128),e.push(63&n|128)):n>=128&&n<=2047?(e.push(n>>6&31|192),e.push(63&n|128)):e.push(255&n);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const n=t;for(let s=0;s<n.length;s++){const t=n[s].toString(2),r=t.match(/^1+?(?=0)/);if(r&&8==t.length){const t=r[0].length;let i=n[s].toString(2).slice(7-t);for(let e=1;e<t;e++)i+=n[e+s].toString(2).slice(2);e+=String.fromCharCode(parseInt(i,2)),s+=t-1}else e+=String.fromCharCode(n[s])}return e}},w=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],M={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let n=0,s=w.length;n<s;n++)if(w[n]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==w[4]&&e!==w[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==w[2]&&e!==w[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==w[0]&&e!==w[1])},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates:t=>t.geometry?t.geometry.coordinates:[],getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const s=t.geometry.coordinates;if(!s)return null;let r=0,i=0,o=0;switch(n){case"Point":r=s[0],i=s[1],o++;break;case"MultiPoint":case"LineString":for(let t=0,e=s.length;t<e;t++)r+=s[t][0],i+=s[t][1],o++;break;case"MultiLineString":case"Polygon":for(let t=0,e=s.length;t<e;t++)for(let n=0,a=s[t].length;n<a;n++)r+=s[t][n][0],i+=s[t][n][1],o++;break;case"MultiPolygon":for(let t=0,e=s.length;t<e;t++)for(let n=0,a=s[t].length;n<a;n++)for(let e=0,l=s[t][n].length;e<l;e++)r+=s[t][n][e][0],i+=s[t][n][e][1],o++}const a=r/o,l=i/o;return e?(e.x=a,e.y=l,e):{x:a,y:l}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,s=t.properties||{},r=n.coordinates;if(!r)return null;const i=[];let o;switch(e){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}if(o)for(let a=0,l=r.length;a<l;a++)i.push({type:"Feature",geometry:{type:o,coordinates:r[a]},properties:s});else i.push(t);return i},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])e="Point";else if(Array.isArray(t[0])&&2===t[0].length)e="LineString";else{if(!Array.isArray(t[0])||!Array.isArray(t[0][0]))throw Error("coordinates 参数格式错误");{const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");e="MultiPolygon"}}}return{type:"Feature",geometry:{type:e,coordinates:t}}}},R={assertEmpty(...t){t.forEach((t=>{if(d.isEmpty(t))throw Error(o.PARAMETER_ERROR_LACK+" -> "+t)}))},assertInteger(...t){t.forEach((t=>{if(!d.isInteger(t))throw Error(o.PARAMETER_ERROR_INTEGER+" -> "+t)}))},assertNumber(...t){t.forEach((t=>{if(!d.isNumber(t))throw Error(o.PARAMETER_ERROR_NUMBER+" -> "+t)}))},assertArray(...t){t.forEach((t=>{if(!d.isArray(t))throw Error(o.PARAMETER_ERROR_ARRAY+" -> "+t)}))},assertFunction(...t){t.forEach((t=>{if(!d.isFunction(t))throw Error(o.PARAMETER_ERROR_FUNCTION+" -> "+t)}))},assertObject(...t){t.forEach((t=>{if(!d.isObject(t))throw Error(o.PARAMETER_ERROR_OBJECT+" -> "+t)}))},assertColor(...t){t.forEach((t=>{if(!P.isColor(t))throw Error(o.DATA_ERROR_COLOR+" -> "+t)}))},assertLnglat(...t){t.forEach((t=>{if(!y.isLnglat(t.lng,t.lat))throw Error(o.DATA_ERROR_COORDINATE+" -> "+t)}))},assertGeoJson(...t){t.forEach((t=>{if(!M.isGeoJson(t))throw Error(o.DATA_ERROR_GEOJSON+" -> "+t)}))},assertContain(t,...e){let n=!1;for(let s=0,r=e.length||0;s<r;s++)n=t.indexOf(e[s])>=0;if(n)throw Error(o.STRING_CHECK_LOSS+" -> "+t)},assertStartWith(t,e){if(!t.startsWith(e))throw Error("字符串"+t+"开头不是 -> "+e)},assertEndWith(t,e){if(!t.endsWith(e))throw Error("字符串"+t+"结尾不是 -> "+e)},assertLegal(t,e){const n=E.checkStr(t,e);let s="";switch(e){case"phone":s="电话";break;case"tel":s="座机";break;case"card":s="身份证";break;case"pwd":s="密码";break;case"postal":s="邮政编码";break;case"QQ":s="QQ";break;case"email":s="邮箱";break;case"money":s="金额";break;case"URL":s="网址";break;case"IP":s="IP";break;case"date":s="日期时间";break;case"number":s="数字";break;case"english":s="英文";break;case"chinese":s="中文";break;case"lower":s="小写";break;case"upper":s="大写";break;case"HTML":s="HTML标记"}if(!n)throw Error(o.DATA_ERROR+" -> 不是"+s)}},A=Object.create(Array);A.groupBy=function(t){var e={};return this.forEach((function(n){var s=JSON.stringify(t(n));e[s]=e[s]||[],e[s].push(n)})),Object.keys(e).map((t=>e[t]))},A.distinct=function(t=t=>t){const e=[],n={};return this.forEach((s=>{const r=t(s),i=String(r);n[i]||(n[i]=!0,e.push(s))})),e},A.prototype.max=function(){return Math.max.apply({},this)},A.prototype.min=function(){return Math.min.apply({},this)},A.sum=function(){return this.length>0?this.reduce(((t=0,e=0)=>t+e)):0},A.avg=function(){return this.length?this.sum()/this.length:0},A.desc=function(t=t=>t){return this.sort(((e,n)=>t(n)-t(e)))},A.asc=function(t=t=>t){return this.sort(((e,n)=>t(e)-t(n)))},A.random=function(){return this[Math.floor(Math.random()*this.length)]},A.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const b={create:t=>[...new Array(t).keys()],union(...t){let e=[];return t.forEach((t=>{Array.isArray(t)&&(e=e.concat(t.filter((t=>!e.includes(t)))))})),e},intersection(...t){let e=t[0]||[];return t.forEach((t=>{Array.isArray(t)&&(e=e.filter((e=>t.includes(e))))})),e},unionAll:(...t)=>[...t].flat().filter((t=>!!t)),difference(...t){return 0===t.length?[]:this.union(...t).filter((e=>!this.intersection(...t).includes(e)))}};class C{static getSystem(){var t,e,n,s,r,i,o,a,l;const c=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(c.includes("Android")||c.includes("Adr"))h="Android",u=(null==(e=c.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(c.includes("CrOS"))h="Chromium OS",u=(null==(n=c.match(/MSIE ([\d.]+)/))?void 0:n[1])||(null==(s=c.match(/rv:([\d.]+)/))?void 0:s[1])||"";else if(c.includes("Linux")||c.includes("X11"))h="Linux",u=(null==(r=c.match(/Linux ([\d.]+)/))?void 0:r[1])||"";else if(c.includes("Ubuntu"))h="Ubuntu",u=(null==(i=c.match(/Ubuntu ([\d.]+)/))?void 0:i[1])||"";else if(c.includes("Windows")){let t=(null==(o=c.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:o[1])||"",e={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};h="Windows",u=t in e?e[t]:t}else c.includes("like Mac OS X")?(h="IOS",u=(null==(a=c.match(/OS ([\d_]+) like/))?void 0:a[1].replace(/_/g,"."))||""):c.includes("Macintosh")&&(h="macOS",u=(null==(l=c.match(/Mac OS X -?([\d_]+)/))?void 0:l[1].replace(/_/g,"."))||"");return{type:h,version:u}}static getExplorer(){var t;const e=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let n="",s="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(n="IE",s=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(n="Edge",s=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(n="Chrome",s=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(n="Firefox",s=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(n="Safari",s=t[1])}return{type:n,version:s}}static switchFullScreen(t){if(t){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():"msRequestFullscreen"in t?t.msRequestFullscreen():"mozRequestFullScreen"in t?t.mozRequestFullScreen():"webkitRequestFullscreen"in t&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()}static isSupportWebGL(){if(!(null==this?void 0:this.document))return!1;const t=this.document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");return e&&e instanceof WebGLRenderingContext}static getGPU(){let t="",e="";if(null==this?void 0:this.document){let n=this.document.createElement("canvas"),s=n.getContext("webgl")||n.getContext("experimental-webgl");if(s instanceof WebGLRenderingContext){let n=s.getExtension("WEBGL_debug_renderer_info");if(n){let r=s.getParameter(n.UNMASKED_RENDERER_WEBGL);t=(r.match(/ANGLE \((.+?),/)||[])[1]||"",e=(r.match(/, (.+?) (\(|vs_)/)||[])[1]||""}}}return{type:t,model:e}}static getLanguage(){var t,e;let n=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof n)return"";let s=n.split("-");return s[1]&&(s[1]=s[1].toUpperCase()),s.join("_")}static getTimeZone(){var t,e;return null==(e=null==(t=null==Intl?void 0:Intl.DateTimeFormat())?void 0:t.resolvedOptions())?void 0:e.timeZone}static async getScreenFPS(){return new Promise((function(t){let e=0,n=1,s=[],r=function(i){if(e>0)if(n<12)s.push(i-e),e=i,n++,requestAnimationFrame(r);else{s.sort(),s=s.slice(1,11);let e=s.reduce(((t,e)=>t+e));const n=10*Math.round(1e4/e/10);t(n)}else e=i,requestAnimationFrame(r)};requestAnimationFrame(r)}))}static async getIPAddress(){const t=/\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/,e=/\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i;let n=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const s=new Set,r=n=>{var r;const i=null==(r=null==n?void 0:n.candidate)?void 0:r.candidate;if(i)for(const o of[t,e]){const t=i.match(o);t&&s.add(t[0])}};return new Promise((function(t,e){const i=new n({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});i.addEventListener("icecandidate",r),i.createDataChannel(""),i.createOffer().then((t=>i.setLocalDescription(t)),e);let o,a=20,l=function(){try{i.removeEventListener("icecandidate",r),i.close()}catch{}o&&clearInterval(o)};o=setInterval((function(){let e=[...s];e.length?(l(),t(e[0])):a?a--:(l(),t(""))}),100)}))}static async getNetwork(){var t,e;let n="unknown",s=null==(t=this.navigator)?void 0:t.connection;return s&&(n=s.type||s.effectiveType,"2"!=n&&"unknown"!=n||(n="wifi")),{network:n,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}r(C,"document",null==window?void 0:window.document),r(C,"navigator",null==window?void 0:window.navigator),r(C,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),r(C,"screen",null==window?void 0:window.screen);const _={PI:3.141592653589793,XPI:52.35987755982988,delta(t,e){const n=6378245,s=.006693421622965943;let r=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const o=t/180*this.PI;let a=Math.sin(o);a=1-s*a*a;const l=Math.sqrt(a);return r=180*r/(n*(1-s)/(a*l)*this.PI),i=180*i/(n/l*Math.cos(o)*this.PI),{lat:r,lng:i}},outOfChina:(t,e)=>t<72.004||t>137.8347||(e<.8293||e>55.8271),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 n=.01,s=.01,r=t-n,i=e-s,o=t+n,a=e+s,l=0,c=0,h=0;for(;;){l=(r+o)/2,c=(i+a)/2;const u=this.gcjEncrypt(l,c);if(n=u.lat-t,s=u.lng-e,Math.abs(n)<1e-9&&Math.abs(s)<1e-9)break;if(n>0?o=l:r=l,s>0?a=c:i=c,++h>1e4)break}return{lat:l,lng:c}},bdEncrypt(t,e){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),o=r*Math.cos(i)+.0065;return{lat:r*Math.sin(i)+.006,lng:o}},bdDecrypt(t,e){const n=e-.0065,s=t-.006,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),o=r*Math.cos(i);return{lat:r*Math.sin(i),lng:o}},mercatorEncrypt(t,e){const n=20037508.34*e/180;let s=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return s=20037508.34*s/180,{lat:s,lng:n}},mercatorDecrypt(t,e){const n=e/20037508.34*180;let s=t/20037508.34*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}},transformLat(t,e){let n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/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+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,n},random:({x:t,y:e},{x:n,y:s})=>({x:Math.random()*(n-t)+t,y:Math.random()*(s-e)+e}),deCompose(t,e,n){if(!Array.isArray(t))return n?e.call(n,t):e(t);const s=[];let r,i;for(let o=0,a=t.length;o<a;o++)r=t[o],d.isNil(r)?s.push(null):Array.isArray(r)?s.push(this.deCompose(r,e,n)):(i=n?e.call(n,r):e(r),s.push(i));return s}},S=Object.create(Date);S.prototype.format=function(t="yyyy-MM-dd hh:mm:ss"){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"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)if(new RegExp("("+n+")").test(t)){const s=1===n.length?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+s-(e[n]+"").length))}return t},S.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()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":default: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)}return n};const v={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("string"==typeof t){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.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.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),s=new Date(e).getTime()-n.getTime(),r=Math.floor(s/864e5),i=s%864e5,o=Math.floor(i/36e5),a=i%36e5,l=Math.floor(a/6e4),c=a%6e4,h=Math.round(c/1e3);let u="";return r>0&&(u+=r+"天"),o>0&&(u+=o+"时"),l>0&&(u+=l+"分"),h>0&&(u+=h+"秒"),0===r&&0===o&&0===l&&0===h&&(u="少于1秒"),u},formatterCounter(t){const e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,s=n%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(n/60))}:${e(Math.round(s))}`},sleep(t){}};function T(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}const x={getStyle(t,e){var n;let s=t.style[e];if(!s||"auto"===s){const r=null==(n=document.defaultView)?void 0:n.getComputedStyle(t,null);s=r?r[e]:null,"auto"===s&&(s=null)}return s},create(t,e,n){const s=document.createElement(t);return s.className=e||"",n&&n.appendChild(s),s},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=>((null==t?void 0:t.host)||t).className.toString(),hasClass(t,e){var n;if(null==(n=t.classList)?void 0:n.contains(e))return!0;const s=this.getClass(t);return s.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(s)},addClass(t,e){if(void 0!==t.classList){const n=T(e);for(let e=0,s=n.length;e<s;e++)t.classList.add(n[e])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){if(void 0!==t.classList){T(e).forEach((e=>t.classList.remove(e)))}else this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach((e=>t.classList.add(e))))},parseFromString:t=>(new DOMParser).parseFromString(t,"text/xml").children[0]},O={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);const r=new Uint8Array(s);return new Blob([r],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),s=n[0].match(/:(.*?);/),r=s?s[1]:"image/png",i=atob(n[1]),o=new Uint8Array(i.length);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return new File([o],e,{type:r})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),n=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(n)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},I={debounce(t,e,n=!0){let s,r,i=null;const o=()=>{const a=Date.now()-s;a<e&&a>0?i=setTimeout(o,e-a):(i=null,n||(r=t.apply(this,undefined)))};return(...a)=>{s=Date.now();const l=n&&!i;return i||(i=setTimeout(o,e)),l&&(r=t.apply(this,a),i||(a=null)),r}},throttle(t,e,n=1){let s=0,r=null;return(...i)=>{if(1===n){const n=Date.now();n-s>=e&&(t.apply(this,i),s=n)}else 2===n&&(r||(r=setTimeout((()=>{r=null,t.apply(this,i)}),e)))}},memoize(t){const e=new Map;return(...n)=>{const s=JSON.stringify(n);if(e.has(s))return e.get(s);{const r=t.apply(this,n);return e.set(s,r),r}}},recurve(t,e=500,n=5e3){let s=0;setTimeout((()=>{s++,s<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))}),e)},once(t){let e=!1;return function(...n){if(!e)return e=!0,t(...n)}}},D={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var s=n,r=t[n];e.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return e.join("&")},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:r}=new URL(t),i=[s,r];let o={};for(let a=0;a<i.length;a++){const t=i[a];if(t){const s=t.replace(/#|\//g,"").split("?");if(s.length>1)for(let t=1;t<s.length;t++){let r;for(;r=n.exec(s[t]);)o[r[1]]=e?decodeURIComponent(r[2]):r[2]}}}return o}};class P{constructor(t,e,n,s){r(this,"_r"),r(this,"_g"),r(this,"_b"),r(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this._alpha=m.clamp(s||1,0,1)}_validateColorChannel(t){if(t<0||t>255)throw new Error("Color channel must be between 0 and 255.")}get rgba(){return{r:this._r,g:this._g,b:this._b,a:this._alpha}}get hex(){return P.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=m.clamp(t,0,1),this}setRgb(t,e,n){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this}static fromRgba(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);if(!e)throw new Error("Invalid RGBA color value");const n=parseInt(e[1],10),s=parseInt(e[2],10),r=parseInt(e[3],10),i=e[5]?parseFloat(e[5]):1;return new P(n,s,r,i)}static fromHex(t,e=1){const n=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,n,s)=>e+e+n+n+s+s)),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!s)throw new Error("Invalid HEX color value");const r=parseInt(s[1],16),i=parseInt(s[2],16),o=parseInt(s[3],16);return new P(r,i,o,e)}static fromHsl(t){const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)throw new Error("Invalid HSL color value");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;function o(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}let a,l,c;if(0===s)a=l=c=r;else{const t=r<.5?r*(1+s):r+s-r*s,e=2*r-t;a=o(e,t,n+1/3),l=o(e,t,n),c=o(e,t,n-1/3)}return new P(Math.round(255*a),Math.round(255*l),Math.round(255*c),i)}static from(t){if(this.isRgb(t))return this.fromRgba(t);if(this.isHex(t))return this.fromHex(t);if(this.isHsl(t))return this.fromHsl(t);throw new Error("Invalid color value")}static rgb2hex(t,e,n,s){var r="#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1);if(void 0!==s){return r+Math.round(255*s).toString(16).padStart(2,"0")}return r}static isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static isRgb(t){return/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(t)}static isHsl(t){return/^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(t)}static isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)}static random(){let t=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),n=Math.floor(256*Math.random()),s=Math.random();return new P(t,e,n,s)}}class L{constructor(){r(this,"_listeners"),r(this,"_mutex",{}),r(this,"_context")}addEventListener(t,e,n,s){void 0===this._listeners&&(this._listeners={}),this._context=n;const r=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(s&&(r[t]=e),i[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){const t=n.map((t=>t.toString())).indexOf(e.toString());-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);if(void 0!==this._mutex[t.type]){const e=n.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,s=n.length;e<s;e++){const s=n[e];"function"==typeof s&&s.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}class k extends Map{isEmpty(){return 0===this.size}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}static fromEntries(t=[]){const e=new k;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=g.parse(t);return new k(Object.entries(e))}}const N=class t extends L{constructor(n=`ws://${window.document.domain}:20007/mqtt`,s={}){super(),r(this,"state"),r(this,"url"),r(this,"context"),r(this,"options"),r(this,"client"),r(this,"topics"),this.context=d.extend(t.defaultContext,s),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:d.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0},this.url=n,this.client=e.connect(this.url,this.options),this._onConnect(),this._onMessage(),this.state=0,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=1,console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:i.MQTT_CONNECT,message:this})})),this.client.on("error",(t=>{console.log("链接mqtt报错",t),this.state=-1,this.dispatchEvent({type:i.MQTT_ERROR,message:this}),this.client.end(),this.client.reconnect()}))}_onMessage(){this.client.on("message",((t,e)=>{let n=e,s="";e instanceof Uint8Array&&(n=e.toString());try{s=g.parse(n)}catch(r){throw new Error(o.JSON_PARSE_ERROR)}this.dispatchEvent({type:i.MQTT_MESSAGE,message:{topic:t,data:s}})}))}sendMsg(t,e){this.client.connected?this.client.publish(t,e,{qos:1,retain:!0}):console.error("客户端未连接")}subscribe(t){return 1===this.state?this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=b.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(i.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=b.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=b.difference(this.topics,t),console.log(`取消订阅成功==>${t}`))})),this}unsubscribeAll(){this.unsubscribe(this.topics)}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:i.MQTT_CLOSE,message:null}),console.log("断开mqtt成功==>"+this.url)}};r(N,"defaultContext",{MQTT_USERNAME:"iRVMS-WEB",MQTT_PASSWORD:"novasky888",MQTT_TIMEOUTM:2e4});let U=N;const F=class t{static useLocal(){this.store=window.localStorage}static useSession(){this.store=window.sessionStorage}static set(t,e=null,n={}){var s=this._getPrefixedKey(t,n);try{const{expires:t}=n,r={data:e};t&&(r.expires=t),this.store.setItem(s,JSON.stringify(r))}catch(r){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static get(t,e,n){var s,r=this._getPrefixedKey(t,n);try{s=JSON.parse(this.store.getItem(r)||"")}catch(i){s=this.store[r]?{data:this.store.getItem(r)}:null}if(!s)return e;if("object"==typeof s&&void 0!==s.data){const t=s.expires;return t&&Date.now()>t?e:s.data}}static keys(){const e=[];var n=Object.keys(this.store);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static getAll(e){var n=t.keys();if(e){const s=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.get(n,null,null),s.push(e)}})),s}return n.map((e=>t.get(e,null,null)))}static remove(t,e){var n=this._getPrefixedKey(t,e);this.store.removeItem(n)}static clear(e){t.prefix.length?this.keys().forEach((t=>{this.store.removeItem(this._getPrefixedKey(t,e))})):this.store.clear()}};r(F,"store",window.localStorage),r(F,"prefix",""),r(F,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:F.prefix+t}));let G=F;t.AjaxUtil=f,t.ArrayUtil=b,t.AssertUtil=R,t.AudioPlayer=class{constructor(t){r(this,"audio"),this.audio=new Audio,this.audio.src=t}static speak(t,e={}){const n=new SpeechSynthesisUtterance;n.text=t,n.lang=e.lang||"zh-CN",n.volume=e.volume||1,n.rate=e.rate||1,n.pitch=e.pitch||1,window.speechSynthesis.speak(n)}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(t){this.audio.muted=t}},t.BrowserUtil=C,t.CanvasDrawer=class{constructor(t){if(r(this,"context",null),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");this.context=e.getContext("2d")}}drawLine({x:t,y:e},{x:n,y:s},r={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const i=r.width||1,o=r.color||"#000";this.context.lineWidth=i,this.context.strokeStyle=o,this.context.moveTo(t,e),this.context.lineTo(n,s),this.context.stroke()}drawArc({x:t,y:e},n,s,r,i,o,a){if(!this.context)throw new Error("Canvas context is null or undefined");o?(this.context.fillStyle=a,this.context.beginPath(),this.context.arc(t,e,n,m.deg2Rad(s),m.deg2Rad(r),i),this.context.fill()):(this.context.strokeStyle=a,this.context.beginPath(),this.context.arc(t,e,n,m.deg2Rad(s),m.deg2Rad(r),i),this.context.stroke())}static createCanvas(t=1,e=1){const n=document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n}},t.Color=P,t.Cookie=class{static set(t,e,n=30){if("string"!=typeof t||"string"!=typeof e||"number"!=typeof n)throw new Error("Invalid arguments");const s=new Date;s.setTime(s.getTime()+24*n*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${s.toUTCString()}`}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=_,t.DateUtil=v,t.DomUtil=x,t.ErrorType=o,t.EventDispatcher=L,t.EventType=i,t.FileUtil=O,t.GeoJsonUtil=M,t.GeoUtil=y,t.GraphicType=l,t.HashMap=k,t.ImageUtil=p,t.LayerType=a,t.LineSymbol=c,t.MathUtil=m,t.MeasureMode=h,t.MqttClient=U,t.ObjectState=u,t.ObjectUtil=g,t.OptimizeUtil=I,t.Storage=G,t.StringUtil=E,t.UrlUtil=D,t.Util=d,t.WebSocketClient=class extends L{constructor(t="ws://127.0.0.1:10088"){super(),r(this,"maxCheckTimes",10),r(this,"url"),r(this,"checkTimes",0),r(this,"connectStatus",!1),r(this,"client",null),this.maxCheckTimes=10,this.url=t,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const t=this;this.client.onopen=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:i.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:i.WEB_SOCKET_ERROR,message:e})})}}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}connCheckStatus(t){this.checkTimes>t||setTimeout((()=>{this.checkTimes++,this.client&&0!==this.client.readyState&&1!==this.client.readyState&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),!1)}heartbeat(){setTimeout((()=>{this.client&&1===this.client.readyState&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.mqttBrowser)}(this,(function(t,e){"use strict";var n,s=Object.defineProperty,r=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),i=(t=>(t.MAP_RENDER="mapRender",t.MAP_READY="mapReady",t.MOUSE_CLICK="click",t.MOUSE_DOUBLE_CLICK="dblclick",t.MOUSE_MOVE="mousemove",t.MOUSE_IN="mousein",t.MOUSE_OUT="mouseout",t.MOUSE_RIGHT_CLICK="mouseRightClick",t.KEY_DOWN="keyDown",t.KEY_UP="keyUp",t.DRAW_ACTIVE="drawActive",t.DRAW_MOVE="drawMove",t.DRAW_COMPLETE="drawComplete",t.MQTT_CONNECT="mqttConnect",t.MQTT_ERROR="mqttError",t.MQTT_MESSAGE="mqttMessage",t.MQTT_CLOSE="mqttClose",t.WEB_SOCKET_CONNECT="webSocketConnect",t.WEB_SOCKET_ERROR="webSocketError",t.WEB_SOCKET_MESSAGE="webSocketMessage",t.WEB_SOCKET_CLOSE="webSocketClose",t))(i||{}),a=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.CROSS_ERROR="跨域访问",t.UNEXIST_RESOURCE="资源不存在",t.TIMEOUT="请求超时",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="处理失败",t.AUTH_VERIFY_ERROR="权限验证失败",t.NO_DATA_FOUND="未找到数据",t.DUPLICATE_INSTANCE="实例为单例模式,不允许重复构建",t.JSON_PARSE_ERROR="JSON解析失败,格式有误",t.JSON_VALUE_ERROR="JSON无此键",t.STRING_CHECK_LOSS="字符缺少关键字",t.PARAMETER_ERROR="验证数据类型失败",t.PARAMETER_ERROR_ARRAY="验证数据类型失败,必须是数组",t.PARAMETER_ERROR_STRING="验证数据类型失败,必须是字符",t.PARAMETER_ERROR_FUNCTION="验证数据类型失败,必须是函数",t.PARAMETER_ERROR_OBJECT="验证数据类型失败,必须是对象",t.PARAMETER_ERROR_INTEGER="验证数据类型失败,必须是整型",t.PARAMETER_ERROR_NUMBER="验证数据类型失败,必须是数值",t.PARAMETER_ERROR_LACK="验证数据类型失败,必须非空",t.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t))(a||{}),o=(t=>(t.SUPER_MAP_IMAGES="SuperMapImages",t.SUPER_MAP_DATA="SuperMapData",t.ARC_GIS_MAP_IMAGES="ArcGisMapImages",t.ARC_GIS_MAP_DATA="ArcGisMapData",t.OSGB_LAYER="OSGBLayer",t.S3M_GROUP="S3MGroup",t.TERRAIN_LAYER="TerrainFileLayer",t))(o||{}),l=(t=>(t.POINT="point",t.POLYLINE="polyline",t.POLYGON="polygon",t.BILLBOARD="billboard",t.CYLINDER="cylinder",t.ELLIPSOID="ellipsoid",t.LABEL="label",t.MODEL="model",t.WALL="wall",t))(l||{}),c=(t=>(t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(c||{}),h=(t=>(t.DISTANCE="distance",t.AREA="area",t.HEIGHT="height",t))(h||{}),u=(t=>(t.ADD="add",t.REMOVE="remove",t.INIT="init",t))(u||{});const d={getDataType:t=>Object.prototype.toString.call(t).slice(8,-1),asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber:t=>Number.isNaN(Number(t))?0:Number(t),asString(t){if(this.isEmpty(t))return"";switch(this.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},isEmpty(t){if(null==t)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}},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},guid(){const t=function(){return(65536*(1+Math.random())|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 s=0;s<n.length;s+=2){const r=n[s];t[0]===r&&(e=n[s+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,s,r,i;for(s=0,r=e.length;s<r;s++)for(n in i=e[s],i)t[n]=i[n];return t},convertToTree2(t,e="id",n="parentId",s="children"){const r=[];function i(a){const o=t.filter((t=>t[n]===a[e])).map((t=>(r.some((n=>n[e]===t[e]))||i(t),t)));o.length>0&&(a[s]=o)}return t.forEach((s=>{t.some((t=>t[n]===s[e]))||(i(s),r.push(s))})),r},asyncLoadScript:t=>new Promise(((e,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=t,"readyState"in s?s.onreadystatechange=function(){"complete"!==s.readyState&&"loaded"!==s.readyState||e(s)}:(s.onload=function(){e(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(s)}catch(s){n(s)}})),loadStyle(t){t.forEach((t=>{const e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",e.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(e)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,n)=>{const s=e[n];if(void 0===s)throw new Error(`${a.JSON_VALUE_ERROR}: ${t}`);return"function"==typeof s?s(e):s})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[e]])))},deepAssign(t,...e){"object"==typeof t&&null!==t||(t={});for(const n of e)if("object"==typeof n&&null!==n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&("object"==typeof n[e]&&null!==n[e]?(t[e]||(t[e]=Array.isArray(n[e])?[]:{}),this.deepAssign(t[e],n[e])):t[e]=n[e]);return t},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(((t,n)=>{try{document.execCommand("copy"),t()}catch(s){n(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>Object.prototype.toString.call(t).indexOf("Object")>-1,isNil:t=>void 0===t||"undefined"===t||null===t||"null"===t,isNumber:t=>"number"==typeof t&&!isNaN(t)||"string"==typeof t&&Number.isFinite(+t),isInteger:t=>parseInt(t)===t,isFunction(t){return!this.isNil(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)},isElement:t=>"object"==typeof t&&1===t.nodeType,checheVersion:(t,e)=>t.replace(/[^0-9]/gi,"")<e.replace(/[^0-9]/gi,"")},g={deepClone:t=>structuredClone(t),isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse:t=>t&&"string"==typeof t?JSON.parse(t):t},p={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",getURL(t){let e,n;if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)n=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const s=e.getContext("2d");s&&(t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height)),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64(t){return new Promise(((e,n)=>{let s=new Image;s.setAttribute("crossOrigin","Anonymous"),s.src=t,s.onload=()=>{let t=this.getURL(s);e(t)},s.onerror=n}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);return e&&e.groups?{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data}:null},async copyImage(t){try{const e=await this.getBase64(t),n=this.parseBase64(e.dataURL);if(!n)throw new Error("Failed to parse base64 data.");let s=n.type,r=atob(n.data),i=new ArrayBuffer(r.length),a=new Uint8Array(i);for(let t=0;t<r.length;t++)a[t]=r.charCodeAt(t);let o=new Blob([i],{type:s});await navigator.clipboard.write([new ClipboardItem({[s]:o})])}catch(e){console.error("Failed to copy image to clipboard:",e)}}},f={jsonp(t,e){const n="_jsonp_"+d.guid(),s=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let r=document.createElement("script");r.type="text/javascript",r.src=t,window[n]=function(t){e(null,t),s.removeChild(r),r=null,delete window[n]},s.appendChild(r)},get(t,e={},n){if(d.isFunction(e)){const t=n;n=e,e=t}const s=this._getClient(n);if(s.open("GET",t,!0),e){for(const t in e.headers)s.setRequestHeader(t,e.headers[t]);s.withCredentials="include"===e.credentials,e.responseType&&(s.responseType=e.responseType)}return s.send(null),s},post(t,e={},n){let s;if("string"!=typeof t?(n=e.cb,s=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(n=e,e={}),s=e.postData),!n)throw new Error("Callback function is required");const r=this._getClient(n);return r.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach((t=>{r.setRequestHeader(t,e.headers[t])})),"string"!=typeof s&&(s=JSON.stringify(s)),r.send(s),r},_wrapCallback:(t,e)=>function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e(new Error("http status 200 returned without content.")):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e(new Error(t.statusText+","+t.status))},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch(n){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(d.isFunction(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,n)},getImage(t,e,n){return this.getArrayBuffer(e,n,((e,n)=>{if(e)t.onerror&&t.onerror(e);else if(n){const e=window.URL||window.webkitURL,s=t.onload;t.onload=()=>{s&&s(),e.revokeObjectURL(t.src)};const r=new Blob([new Uint8Array(n.data)],{type:n.contentType});t.cacheControl=n.cacheControl,t.expires=n.expires,t.src=n.data.byteLength?e.createObjectURL(r):p.emptyImageUrl}}))},getJSON(t,e,n){if(d.isFunction(e)){const t=n;n=e,e=t}const s=function(t,e){const s=e?g.parse(e):null;n&&n(t,s)};return e&&e.jsonp?this.jsonp(t,s):this.get(t,e,s)}},m={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:(t,e)=>t+Math.floor(Math.random()*(e-t+1)),randFloat:(t,e)=>t+Math.random()*(e-t),deg2Rad(t){return t*this.DEG2RAD},rad2Deg(t){return t*this.RAD2DEG},round:(t,e=2)=>Math.round(t*Math.pow(10,e))/Math.pow(10,e),clamp:(t,e,n)=>Math.max(e,Math.min(n,t))};class y{static isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&!!(+e>-90&&+e<90&&+t>-180&&+t<180)}static distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static distanceByPoints(t,e){const{lng:n,lat:s}=t,{lng:r,lat:i}=e;let a=Math.cos(s*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-r)*Math.PI/180)+Math.sin(s*Math.PI/180)*Math.sin(i*Math.PI/180);a>1&&(a=1),a<-1&&(a=-1);return 6371e3*Math.acos(a)}static formatLnglat(t,e){let n="";function s(t){const e=Math.floor(t),n=Math.floor(60*(t-e));return`${e}°${n}′${(3600*(t-e)-60*n).toFixed(2)}″`}return this.isLnglat(t,e)?n=s(t)+","+s(e):isNaN(t)?isNaN(e)||(n=s(e)):n=s(t),n}static transformLnglat(t,e){function n(t){let e=/[sw]/i.test(t)?-1:1;const n=t.match(/[\d.]+/g)||[];let s=0;for(let r=0;r<n.length;r++)s+=parseFloat(n[r])/e,e*=60;return s}if(t&&e)return{lng:n(t),lat:n(e)}}static rayCasting(t,e){for(var n=t.x,s=t.y,r=!1,i=0,a=e.length,o=a-1;i<a;o=i,i++){var l=e[i].x,c=e[i].y,h=e[o].x,u=e[o].y;if(l===n&&c===s||h===n&&u===s)return"on";if(c<s&&u>=s||c>=s&&u<s){var d=l+(s-c)*(h-l)/(u-c);if(d===n)return"on";d>n&&(r=!r)}}return r?"in":"out"}static rotatePoint(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}}static calcBearAndDis(t,e){const{x:n,y:s}=t,{x:r,y:i}=e,a=r-n,o=i-s,l=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:l}}static calcBearAndDisByPoints(t,e){var n=1*t.lat,s=1*t.lng,r=1*e.lat,i=1*e.lng,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),l=Math.atan2(a,o)*(180/Math.PI),c=(r-n)*this.toRadian,h=(i-s)*this.toRadian,u=Math.sin(c/2)*Math.sin(c/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));return{angle:l,distance:this.R*d}}static distanceToSegment(t,e,n){const s=t.x,r=t.y,i=e.x,a=e.y,o=n.x,l=n.y,c=(o-i)*(s-i)+(l-a)*(r-a);if(c<=0)return Math.sqrt((s-i)*(s-i)+(r-a)*(r-a));const h=(o-i)*(o-i)+(l-a)*(l-a);if(c>=h)return Math.sqrt((s-o)*(s-o)+(r-l)*(r-l));const u=c/h,d=i+(o-i)*u,g=a+(l-a)*u;return Math.sqrt((s-d)*(s-d)+(r-g)*(r-g))}static calcPointByBearAndDis(t,e,n){const s=m.deg2Rad(1*t.lat),r=m.deg2Rad(1*t.lng),i=n/this.R;e=m.deg2Rad(e);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));return{lat:m.rad2Deg(a),lng:m.rad2Deg(o)}}static mercatorTolonlat(t,e){var n=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2)}}static lonlatToMercator(t,e){var n=6378137;const s=t*Math.PI/180*n;var r=e*Math.PI/180;return{x:s,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}}static interpolate({x:t,y:e,z:n=0},{x:s,y:r,z:i=0},a){return{x:t+(s-t)*a,y:e+(r-e)*a,z:n+(i-n)*a}}}r(y,"toRadian",Math.PI/180),r(y,"R",6371393);const E={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){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:(t,...e)=>(e=e.map((t=>{switch(d.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce(((t,n,s)=>`${t}${e[s-1]}${n}`))),getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,n){var s=/[^\x00-\xff]/g;if(t.replace(s,"mm").length<=n)return t;for(var r=Math.floor(n/2);r<t.length;r++){let i=t.substring(e,r);if(i.replace(s,"mm").length>=n)return i}return t},string2Bytes(t){const e=[];let n;const s=t.length;for(let r=0;r<s;r++)n=t.charCodeAt(r),n>=65536&&n<=1114111?(e.push(n>>18&7|240),e.push(n>>12&63|128),e.push(n>>6&63|128),e.push(63&n|128)):n>=2048&&n<=65535?(e.push(n>>12&15|224),e.push(n>>6&63|128),e.push(63&n|128)):n>=128&&n<=2047?(e.push(n>>6&31|192),e.push(63&n|128)):e.push(255&n);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const n=t;for(let s=0;s<n.length;s++){const t=n[s].toString(2),r=t.match(/^1+?(?=0)/);if(r&&8==t.length){const t=r[0].length;let i=n[s].toString(2).slice(7-t);for(let e=1;e<t;e++)i+=n[e+s].toString(2).slice(2);e+=String.fromCharCode(parseInt(i,2)),s+=t-1}else e+=String.fromCharCode(n[s])}return e}},w=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],M={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let n=0,s=w.length;n<s;n++)if(w[n]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==w[4]&&e!==w[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==w[2]&&e!==w[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==w[0]&&e!==w[1])},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates:t=>t.geometry?t.geometry.coordinates:[],getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const s=t.geometry.coordinates;if(!s)return null;let r=0,i=0,a=0;switch(n){case"Point":r=s[0],i=s[1],a++;break;case"MultiPoint":case"LineString":for(let t=0,e=s.length;t<e;t++)r+=s[t][0],i+=s[t][1],a++;break;case"MultiLineString":case"Polygon":for(let t=0,e=s.length;t<e;t++)for(let n=0,o=s[t].length;n<o;n++)r+=s[t][n][0],i+=s[t][n][1],a++;break;case"MultiPolygon":for(let t=0,e=s.length;t<e;t++)for(let n=0,o=s[t].length;n<o;n++)for(let e=0,l=s[t][n].length;e<l;e++)r+=s[t][n][e][0],i+=s[t][n][e][1],a++}const o=r/a,l=i/a;return e?(e.x=o,e.y=l,e):{x:o,y:l}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,s=t.properties||{},r=n.coordinates;if(!r)return null;const i=[];let a;switch(e){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}if(a)for(let o=0,l=r.length;o<l;o++)i.push({type:"Feature",geometry:{type:a,coordinates:r[o]},properties:s});else i.push(t);return i},getGeoJsonByCoordinates(t){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let e;if(2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])e="Point";else if(Array.isArray(t[0])&&2===t[0].length)e="LineString";else{if(!Array.isArray(t[0])||!Array.isArray(t[0][0]))throw Error("coordinates 参数格式错误");{const n=t[0];if(n[0].join(",")===n[n.length-1].join(","))e="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");e="MultiPolygon"}}}return{type:"Feature",geometry:{type:e,coordinates:t}}}},R={assertEmpty(...t){t.forEach((t=>{if(d.isEmpty(t))throw Error(a.PARAMETER_ERROR_LACK+" -> "+t)}))},assertInteger(...t){t.forEach((t=>{if(!d.isInteger(t))throw Error(a.PARAMETER_ERROR_INTEGER+" -> "+t)}))},assertNumber(...t){t.forEach((t=>{if(!d.isNumber(t))throw Error(a.PARAMETER_ERROR_NUMBER+" -> "+t)}))},assertArray(...t){t.forEach((t=>{if(!d.isArray(t))throw Error(a.PARAMETER_ERROR_ARRAY+" -> "+t)}))},assertFunction(...t){t.forEach((t=>{if(!d.isFunction(t))throw Error(a.PARAMETER_ERROR_FUNCTION+" -> "+t)}))},assertObject(...t){t.forEach((t=>{if(!d.isObject(t))throw Error(a.PARAMETER_ERROR_OBJECT+" -> "+t)}))},assertColor(...t){t.forEach((t=>{if(!L.isColor(t))throw Error(a.DATA_ERROR_COLOR+" -> "+t)}))},assertLnglat(...t){t.forEach((t=>{if(!y.isLnglat(t.lng,t.lat))throw Error(a.DATA_ERROR_COORDINATE+" -> "+t)}))},assertGeoJson(...t){t.forEach((t=>{if(!M.isGeoJson(t))throw Error(a.DATA_ERROR_GEOJSON+" -> "+t)}))},assertContain(t,...e){let n=!1;for(let s=0,r=e.length||0;s<r;s++)n=t.indexOf(e[s])>=0;if(n)throw Error(a.STRING_CHECK_LOSS+" -> "+t)},assertStartWith(t,e){if(!t.startsWith(e))throw Error("字符串"+t+"开头不是 -> "+e)},assertEndWith(t,e){if(!t.endsWith(e))throw Error("字符串"+t+"结尾不是 -> "+e)},assertLegal(t,e){const n=E.checkStr(t,e);let s="";switch(e){case"phone":s="电话";break;case"tel":s="座机";break;case"card":s="身份证";break;case"pwd":s="密码";break;case"postal":s="邮政编码";break;case"QQ":s="QQ";break;case"email":s="邮箱";break;case"money":s="金额";break;case"URL":s="网址";break;case"IP":s="IP";break;case"date":s="日期时间";break;case"number":s="数字";break;case"english":s="英文";break;case"chinese":s="中文";break;case"lower":s="小写";break;case"upper":s="大写";break;case"HTML":s="HTML标记"}if(!n)throw Error(a.DATA_ERROR+" -> 不是"+s)}},A=Object.create(Array);A.groupBy=function(t){var e={};return this.forEach((function(n){var s=JSON.stringify(t(n));e[s]=e[s]||[],e[s].push(n)})),Object.keys(e).map((t=>e[t]))},A.distinct=function(t=t=>t){const e=[],n={};return this.forEach((s=>{const r=t(s),i=String(r);n[i]||(n[i]=!0,e.push(s))})),e},A.prototype.max=function(){return Math.max.apply({},this)},A.prototype.min=function(){return Math.min.apply({},this)},A.sum=function(){return this.length>0?this.reduce(((t=0,e=0)=>t+e)):0},A.avg=function(){return this.length?this.sum()/this.length:0},A.desc=function(t=t=>t){return this.sort(((e,n)=>t(n)-t(e)))},A.asc=function(t=t=>t){return this.sort(((e,n)=>t(e)-t(n)))},A.random=function(){return this[Math.floor(Math.random()*this.length)]},A.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const b={create:t=>[...new Array(t).keys()],union(...t){let e=[];return t.forEach((t=>{Array.isArray(t)&&(e=e.concat(t.filter((t=>!e.includes(t)))))})),e},intersection(...t){let e=t[0]||[];return t.forEach((t=>{Array.isArray(t)&&(e=e.filter((e=>t.includes(e))))})),e},unionAll:(...t)=>[...t].flat().filter((t=>!!t)),difference(...t){return 0===t.length?[]:this.union(...t).filter((e=>!this.intersection(...t).includes(e)))},zhSort:(t,e=t=>t,n)=>(t.sort((function(t,s){return n?e(t).localeCompare(e(s),"zh"):e(s).localeCompare(e(t),"zh")})),t)};class _{static getSystem(){var t,e,n,s,r,i,a,o,l;const c=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(c.includes("Android")||c.includes("Adr"))h="Android",u=(null==(e=c.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(c.includes("CrOS"))h="Chromium OS",u=(null==(n=c.match(/MSIE ([\d.]+)/))?void 0:n[1])||(null==(s=c.match(/rv:([\d.]+)/))?void 0:s[1])||"";else if(c.includes("Linux")||c.includes("X11"))h="Linux",u=(null==(r=c.match(/Linux ([\d.]+)/))?void 0:r[1])||"";else if(c.includes("Ubuntu"))h="Ubuntu",u=(null==(i=c.match(/Ubuntu ([\d.]+)/))?void 0:i[1])||"";else if(c.includes("Windows")){let t=(null==(a=c.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:a[1])||"",e={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};h="Windows",u=t in e?e[t]:t}else c.includes("like Mac OS X")?(h="IOS",u=(null==(o=c.match(/OS ([\d_]+) like/))?void 0:o[1].replace(/_/g,"."))||""):c.includes("Macintosh")&&(h="macOS",u=(null==(l=c.match(/Mac OS X -?([\d_]+)/))?void 0:l[1].replace(/_/g,"."))||"");return{type:h,version:u}}static getExplorer(){var t;const e=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let n="",s="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(n="IE",s=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(n="Edge",s=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(n="Chrome",s=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(n="Firefox",s=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(n="Safari",s=t[1])}return{type:n,version:s}}static switchFullScreen(t){if(t){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():"msRequestFullscreen"in t?t.msRequestFullscreen():"mozRequestFullScreen"in t?t.mozRequestFullScreen():"webkitRequestFullscreen"in t&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():"msExitFullscreen"in document?document.msExitFullscreen():"mozCancelFullScreen"in document?document.mozCancelFullScreen():"webkitExitFullscreen"in document&&document.webkitExitFullscreen()}static isSupportWebGL(){if(!(null==this?void 0:this.document))return!1;const t=this.document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");return e&&e instanceof WebGLRenderingContext}static getGPU(){let t="",e="";if(null==this?void 0:this.document){let n=this.document.createElement("canvas"),s=n.getContext("webgl")||n.getContext("experimental-webgl");if(s instanceof WebGLRenderingContext){let n=s.getExtension("WEBGL_debug_renderer_info");if(n){let r=s.getParameter(n.UNMASKED_RENDERER_WEBGL);t=(r.match(/ANGLE \((.+?),/)||[])[1]||"",e=(r.match(/, (.+?) (\(|vs_)/)||[])[1]||""}}}return{type:t,model:e}}static getLanguage(){var t,e;let n=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof n)return"";let s=n.split("-");return s[1]&&(s[1]=s[1].toUpperCase()),s.join("_")}static getTimeZone(){var t,e;return null==(e=null==(t=null==Intl?void 0:Intl.DateTimeFormat())?void 0:t.resolvedOptions())?void 0:e.timeZone}static async getScreenFPS(){return new Promise((function(t){let e=0,n=1,s=[],r=function(i){if(e>0)if(n<12)s.push(i-e),e=i,n++,requestAnimationFrame(r);else{s.sort(),s=s.slice(1,11);let e=s.reduce(((t,e)=>t+e));const n=10*Math.round(1e4/e/10);t(n)}else e=i,requestAnimationFrame(r)};requestAnimationFrame(r)}))}static async getIPAddress(){const t=/\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/,e=/\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i;let n=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const s=new Set,r=n=>{var r;const i=null==(r=null==n?void 0:n.candidate)?void 0:r.candidate;if(i)for(const a of[t,e]){const t=i.match(a);t&&s.add(t[0])}};return new Promise((function(t,e){const i=new n({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});i.addEventListener("icecandidate",r),i.createDataChannel(""),i.createOffer().then((t=>i.setLocalDescription(t)),e);let a,o=20,l=function(){try{i.removeEventListener("icecandidate",r),i.close()}catch{}a&&clearInterval(a)};a=window.setInterval((function(){let e=[...s];e.length?(l(),t(e[0])):o?o--:(l(),t(""))}),100)}))}static async getNetwork(){var t,e;let n="unknown",s=null==(t=this.navigator)?void 0:t.connection;return s&&(n=s.type||s.effectiveType,"2"!=n&&"unknown"!=n||(n="wifi")),{network:n,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}r(_,"document",null==window?void 0:window.document),r(_,"navigator",null==window?void 0:window.navigator),r(_,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),r(_,"screen",null==window?void 0:window.screen);class C{static delta(t,e){const n=6378245,s=.006693421622965943;let r=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const a=t/180*this.PI;let o=Math.sin(a);o=1-s*o*o;const l=Math.sqrt(o);return r=180*r/(n*(1-s)/(o*l)*this.PI),i=180*i/(n/l*Math.cos(a)*this.PI),{lat:r,lng:i}}static outOfChina(t,e){return t<72.004||t>137.8347||(e<.8293||e>55.8271)}static 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}}static 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}}static gcjDecryptExact(t,e){let n=.01,s=.01,r=t-n,i=e-s,a=t+n,o=e+s,l=0,c=0,h=0;for(;;){l=(r+a)/2,c=(i+o)/2;const u=this.gcjEncrypt(l,c);if(n=u.lat-t,s=u.lng-e,Math.abs(n)<1e-9&&Math.abs(s)<1e-9)break;if(n>0?a=l:r=l,s>0?o=c:i=c,++h>1e4)break}return{lat:l,lng:c}}static bdEncrypt(t,e){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)+.0065;return{lat:r*Math.sin(i)+.006,lng:a}}static bdDecrypt(t,e){const n=e-.0065,s=t-.006,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);return{lat:r*Math.sin(i),lng:a}}static mercatorEncrypt(t,e){const n=20037508.34*e/180;let s=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return s=20037508.34*s/180,{lat:s,lng:n}}static mercatorDecrypt(t,e){const n=e/20037508.34*180;let s=t/20037508.34*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}}static transformLat(t,e){let n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,n}static transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,n}static random({x:t,y:e},{x:n,y:s}){return{x:Math.random()*(n-t)+t,y:Math.random()*(s-e)+e}}static deCompose(t,e,n){if(!Array.isArray(t))return n?e.call(n,t):e(t);const s=[];let r,i;for(let a=0,o=t.length;a<o;a++)r=t[a],d.isNil(r)?s.push(null):Array.isArray(r)?s.push(this.deCompose(r,e,n)):(i=n?e.call(n,r):e(r),s.push(i));return s}}r(C,"PI",3.141592653589793),r(C,"XPI",52.35987755982988);const S=Object.create(Date);S.prototype.format=function(t="yyyy-MM-dd hh:mm:ss"){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"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)if(new RegExp("("+n+")").test(t)){const s=1===n.length?1:Number(n.slice(1));t=t.replace(RegExp.$1,("00"+e[n]).substr((""+e[n]).length+s-(e[n]+"").length))}return t},S.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()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":default: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)}return n};class v{static parseDate(t){if("string"==typeof t){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.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.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}static formatDateInterval(t,e){const n=new Date(t),s=new Date(e).getTime()-n.getTime(),r=Math.floor(s/864e5),i=s%864e5,a=Math.floor(i/36e5),o=i%36e5,l=Math.floor(o/6e4),c=o%6e4,h=Math.round(c/1e3);let u="";return r>0&&(u+=r+"天"),a>0&&(u+=a+"时"),l>0&&(u+=l+"分"),h>0&&(u+=h+"秒"),0===r&&0===a&&0===l&&0===h&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,s=n%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(n/60))}:${e(Math.round(s))}`}static sleep(t){}}function T(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}r(v,"lastMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()-1,1)),r(v,"thisMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth(),1)),r(v,"nextMonthDate",new Date((new Date).getFullYear(),(new Date).getMonth()+1,1)),r(v,"lastWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())),r(v,"thisWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())),r(v,"nextWeekDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())),r(v,"lastDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)),r(v,"thisDayDate",new Date((new Date).setHours(0,0,0,0))),r(v,"nextDayDate",new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1));const x={getStyle(t,e){var n;let s=t.style[e];if(!s||"auto"===s){const r=null==(n=document.defaultView)?void 0:n.getComputedStyle(t,null);s=r?r[e]:null,"auto"===s&&(s=null)}return s},create(t,e,n){const s=document.createElement(t);return s.className=e||"",n&&n.appendChild(s),s},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=>((null==t?void 0:t.host)||t).className.toString(),hasClass(t,e){var n;if(null==(n=t.classList)?void 0:n.contains(e))return!0;const s=this.getClass(t);return s.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(s)},addClass(t,e){if(void 0!==t.classList){const n=T(e);for(let e=0,s=n.length;e<s;e++)t.classList.add(n[e])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){if(void 0!==t.classList){T(e).forEach((e=>t.classList.remove(e)))}else this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach((e=>t.classList.add(e))))},parseFromString:t=>(new DOMParser).parseFromString(t,"text/xml").children[0]},O={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);const r=new Uint8Array(s);return new Blob([r],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),s=n[0].match(/:(.*?);/),r=s?s[1]:"image/png",i=atob(n[1]),a=new Uint8Array(i.length);for(let o=0;o<i.length;o++)a[o]=i.charCodeAt(o);return new File([a],e,{type:r})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),n=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(n)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}};class I{static warning(t){"production"!==process.env.NODE_ENV&&void 0!==console&&console.error(`Warning: ${t}`)}static note(t){"production"!==process.env.NODE_ENV&&void 0!==console&&console.warn(`Note: ${t}`)}static resetWarned(){this.warned={}}static _call(t,e){this.warned[e]||(t(e),this.warned[e]=!0)}static warningOnce(t){this._call(this.warning,t)}static noteOnce(t){this._call(this.note,t)}static speak(t,e={}){const n=new SpeechSynthesisUtterance;n.text=t,n.lang=e.lang||"zh-CN",n.volume=e.volume||1,n.rate=e.rate||1,n.pitch=e.pitch||1,window.speechSynthesis.speak(n)}}r(I,"warned",{});const D={debounce(t,e,n=!0){let s,r,i=null;const a=()=>{const o=Date.now()-s;o<e&&o>0?i=setTimeout(a,e-o):(i=null,n||(r=t.apply(this,undefined)))};return(...o)=>{s=Date.now();const l=n&&!i;return i||(i=setTimeout(a,e)),l&&(r=t.apply(this,o),i||(o=null)),r}},throttle(t,e,n=1){let s=0,r=null;return(...i)=>{if(1===n){const n=Date.now();n-s>=e&&(t.apply(this,i),s=n)}else 2===n&&(r||(r=setTimeout((()=>{r=null,t.apply(this,i)}),e)))}},memoize(t){const e=new Map;return(...n)=>{const s=JSON.stringify(n);if(e.has(s))return e.get(s);{const r=t.apply(this,n);return e.set(s,r),r}}},recurve(t,e=500,n=5e3){let s=0;setTimeout((()=>{s++,s<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))}),e)},once(t){let e=!1;return function(...n){if(!e)return e=!0,t(...n)}}},P={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var s=n,r=t[n];e.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return e.join("&")},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:r}=new URL(t),i=[s,r];let a={};for(let o=0;o<i.length;o++){const t=i[o];if(t){const s=t.replace(/#|\//g,"").split("?");if(s.length>1)for(let t=1;t<s.length;t++){let r;for(;r=n.exec(s[t]);)a[r[1]]=e?decodeURIComponent(r[2]):r[2]}}}return a}};class L{constructor(t,e,n,s){r(this,"_r"),r(this,"_g"),r(this,"_b"),r(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this._alpha=m.clamp(s||1,0,1)}_validateColorChannel(t){if(t<0||t>255)throw new Error("Color channel must be between 0 and 255.")}get rgba(){return{r:this._r,g:this._g,b:this._b,a:this._alpha}}get hex(){return L.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=m.clamp(t,0,1),this}setRgb(t,e,n){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this}static fromRgba(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);if(!e)throw new Error("Invalid RGBA color value");const n=parseInt(e[1],10),s=parseInt(e[2],10),r=parseInt(e[3],10),i=e[5]?parseFloat(e[5]):1;return new L(n,s,r,i)}static fromHex(t,e=1){const n=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,n,s)=>e+e+n+n+s+s)),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!s)throw new Error("Invalid HEX color value");const r=parseInt(s[1],16),i=parseInt(s[2],16),a=parseInt(s[3],16);return new L(r,i,a,e)}static fromHsl(t){const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)throw new Error("Invalid HSL color value");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;function a(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}let o,l,c;if(0===s)o=l=c=r;else{const t=r<.5?r*(1+s):r+s-r*s,e=2*r-t;o=a(e,t,n+1/3),l=a(e,t,n),c=a(e,t,n-1/3)}return new L(Math.round(255*o),Math.round(255*l),Math.round(255*c),i)}static from(t){if(this.isRgb(t))return this.fromRgba(t);if(this.isHex(t))return this.fromHex(t);if(this.isHsl(t))return this.fromHsl(t);throw new Error("Invalid color value")}static rgb2hex(t,e,n,s){var r="#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1);if(void 0!==s){return r+Math.round(255*s).toString(16).padStart(2,"0")}return r}static isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static isRgb(t){return/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(t)}static isHsl(t){return/^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(t)}static isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)}static random(){let t=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),n=Math.floor(256*Math.random()),s=Math.random();return new L(t,e,n,s)}}class N{constructor(){r(this,"_listeners"),r(this,"_mutex",{}),r(this,"_context")}addEventListener(t,e,n,s){void 0===this._listeners&&(this._listeners={}),this._context=n;const r=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(s&&(r[t]=e),i[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){const t=n.map((t=>t.toString())).indexOf(e.toString());-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);if(void 0!==this._mutex[t.type]){const e=n.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,s=n.length;e<s;e++){const s=n[e];"function"==typeof s&&s.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}class k extends Map{isEmpty(){return 0===this.size}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}static fromEntries(t=[]){const e=new k;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=g.parse(t);return new k(Object.entries(e))}}const U=class t extends N{constructor(n=`ws://${window.document.domain}:20007/mqtt`,s={}){super(),r(this,"state"),r(this,"url"),r(this,"context"),r(this,"options"),r(this,"client"),r(this,"topics"),this.context=d.extend(t.defaultContext,s),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:d.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0},this.url=n,this.client=e.connect(this.url,this.options),this._onConnect(),this._onMessage(),this.state=0,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=1,console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:i.MQTT_CONNECT,message:this})})),this.client.on("error",(t=>{console.log("链接mqtt报错",t),this.state=-1,this.dispatchEvent({type:i.MQTT_ERROR,message:this}),this.client.end(),this.client.reconnect()}))}_onMessage(){this.client.on("message",((t,e)=>{let n=e,s="";e instanceof Uint8Array&&(n=e.toString());try{s=g.parse(n)}catch(r){throw new Error(a.JSON_PARSE_ERROR)}this.dispatchEvent({type:i.MQTT_MESSAGE,message:{topic:t,data:s}})}))}sendMsg(t,e){this.client.connected?this.client.publish(t,e,{qos:1,retain:!0}):console.error("客户端未连接")}subscribe(t){return 1===this.state?this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=b.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(i.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=b.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=b.difference(this.topics,t),console.log(`取消订阅成功==>${t}`))})),this}unsubscribeAll(){this.unsubscribe(this.topics)}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:i.MQTT_CLOSE,message:null}),console.log("断开mqtt成功==>"+this.url)}};r(U,"defaultContext",{MQTT_USERNAME:"iRVMS-WEB",MQTT_PASSWORD:"novasky888",MQTT_TIMEOUTM:2e4});let F=U;const G=class t{static useLocal(){this.store=window.localStorage}static useSession(){this.store=window.sessionStorage}static set(t,e=null,n={}){var s=this._getPrefixedKey(t,n);try{const{expires:t}=n,r={data:e};t&&(r.expires=t),this.store.setItem(s,JSON.stringify(r))}catch(r){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static get(t,e,n){var s,r=this._getPrefixedKey(t,n);try{s=JSON.parse(this.store.getItem(r)||"")}catch(i){s=this.store[r]?{data:this.store.getItem(r)}:null}if(!s)return e;if("object"==typeof s&&void 0!==s.data){const t=s.expires;return t&&Date.now()>t?e:s.data}}static keys(){const e=[];var n=Object.keys(this.store);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static getAll(e){var n=t.keys();if(e){const s=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.get(n,null,null),s.push(e)}})),s}return n.map((e=>t.get(e,null,null)))}static remove(t,e){var n=this._getPrefixedKey(t,e);this.store.removeItem(n)}static clear(e){t.prefix.length?this.keys().forEach((t=>{this.store.removeItem(this._getPrefixedKey(t,e))})):this.store.clear()}};r(G,"store",window.localStorage),r(G,"prefix",""),r(G,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:G.prefix+t}));let B=G;t.AjaxUtil=f,t.ArrayUtil=b,t.AssertUtil=R,t.AudioPlayer=class{constructor(t){r(this,"audio"),this.audio=new Audio,this.audio.src=t}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(t){this.audio.muted=t}},t.BrowserUtil=_,t.CanvasDrawer=class{constructor(t){if(r(this,"context",null),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");this.context=e.getContext("2d")}}drawLine({x:t,y:e},{x:n,y:s},r={}){if(!this.context)throw new Error("Canvas context is null or undefined");this.context.beginPath();const i=r.width||1,a=r.color||"#000";this.context.lineWidth=i,this.context.strokeStyle=a,this.context.moveTo(t,e),this.context.lineTo(n,s),this.context.stroke()}drawArc({x:t,y:e},n,s,r,i,a,o){if(!this.context)throw new Error("Canvas context is null or undefined");a?(this.context.fillStyle=o,this.context.beginPath(),this.context.arc(t,e,n,m.deg2Rad(s),m.deg2Rad(r),i),this.context.fill()):(this.context.strokeStyle=o,this.context.beginPath(),this.context.arc(t,e,n,m.deg2Rad(s),m.deg2Rad(r),i),this.context.stroke())}static createCanvas(t=1,e=1){const n=document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n}},t.Color=L,t.Cookie=class{static set(t,e,n=30){if("string"!=typeof t||"string"!=typeof e||"number"!=typeof n)throw new Error("Invalid arguments");const s=new Date;s.setTime(s.getTime()+24*n*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${s.toUTCString()}`}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=C,t.DateUtil=v,t.DomUtil=x,t.ErrorType=a,t.EventDispatcher=N,t.EventType=i,t.FileUtil=O,t.GeoJsonUtil=M,t.GeoUtil=y,t.GraphicType=l,t.HashMap=k,t.ImageUtil=p,t.LayerType=o,t.LineSymbol=c,t.MathUtil=m,t.MeasureMode=h,t.MessageUtil=I,t.MqttClient=F,t.ObjectState=u,t.ObjectUtil=g,t.OptimizeUtil=D,t.Storage=B,t.StringUtil=E,t.UrlUtil=P,t.Util=d,t.WebSocketClient=class extends N{constructor(t="ws://127.0.0.1:10088"){super(),r(this,"maxCheckTimes",10),r(this,"url"),r(this,"checkTimes",0),r(this,"connectStatus",!1),r(this,"client",null),this.maxCheckTimes=10,this.url=t,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const t=this;this.client.onopen=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:i.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:i.WEB_SOCKET_ERROR,message:e})})}}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}connCheckStatus(t){this.checkTimes>t||setTimeout((()=>{this.checkTimes++,this.client&&0!==this.client.readyState&&1!==this.client.readyState&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),!1)}heartbeat(){setTimeout((()=>{this.client&&1===this.client.readyState&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
@@ -1,7 +1,14 @@
1
1
  export type AjaxGetOption = {
2
- headers: any;
3
- responseType: any;
4
- credentials: any;
2
+ headers?: any;
3
+ responseType?: any;
4
+ credentials?: any;
5
+ jsonp?: any;
6
+ };
7
+ export type AjaxPostOption = {
8
+ url?: any;
9
+ headers?: any;
10
+ postData?: any;
11
+ cb?: Callback;
5
12
  };
6
13
  export type Callback = (...params: any[]) => any;
7
14
  declare const _default: {
@@ -31,7 +38,7 @@ declare const _default: {
31
38
  * }
32
39
  * );
33
40
  */
34
- get(url: string, options?: any, cb?: any): any;
41
+ get(url: string, options?: AjaxGetOption, cb?: any): any;
35
42
  /**
36
43
  * Fetch remote resource by HTTP "POST" method
37
44
  * @param {String} url - resource url
@@ -57,7 +64,7 @@ declare const _default: {
57
64
  * }
58
65
  * );
59
66
  */
60
- post(url: string, options?: any, cb?: Callback): any;
67
+ post(url: string, options?: AjaxPostOption, cb?: Callback): any;
61
68
  _wrapCallback(client: XMLHttpRequest, cb: Callback): () => void;
62
69
  _getClient(cb: Callback): XMLHttpRequest;
63
70
  /**
@@ -76,7 +83,7 @@ declare const _default: {
76
83
  * }
77
84
  * );
78
85
  */
79
- getArrayBuffer(url: string, options: any, cb: Callback): any;
86
+ getArrayBuffer(url: string, options: AjaxGetOption | Callback, cb: Callback): any;
80
87
  getImage(img: any, url: string, options: any): any;
81
88
  /**
82
89
  * Fetch resource as a JSON Object.
@@ -97,6 +104,6 @@ declare const _default: {
97
104
  * }
98
105
  * );
99
106
  */
100
- getJSON(url: string, options?: any, cb?: Callback): any;
107
+ getJSON(url: string, options: AjaxGetOption | Callback, cb?: Callback): any;
101
108
  };
102
109
  export default _default;
@@ -5,14 +5,14 @@ declare const _default: {
5
5
  * @param length 数组长度
6
6
  * @returns 索引数组
7
7
  */
8
- create(length: any): number[];
8
+ create(length: number): number[];
9
9
  /**
10
10
  * 合并多个数组,并去重
11
11
  *
12
12
  * @param args 需要合并的数组
13
13
  * @returns 合并后的去重数组
14
14
  */
15
- union(...args: any[][]): any[];
15
+ union<T>(...args: T[][]): T[];
16
16
  /**
17
17
  * 求多个数组的交集
18
18
  *
@@ -34,5 +34,12 @@ declare const _default: {
34
34
  * @returns 返回差集结果
35
35
  */
36
36
  difference(...args: any[]): any;
37
+ /**
38
+ * 对字符串数组进行中文排序
39
+ *
40
+ * @param arr 待排序的字符串数组
41
+ * @returns 排序后的字符串数组
42
+ */
43
+ zhSort(arr: any[], f?: (d: any) => string, reverse?: boolean): any[];
37
44
  };
38
45
  export default _default;
@@ -1,8 +1,8 @@
1
1
  import { Coordinate, LngLat } from '../types';
2
- declare const _default: {
3
- PI: number;
4
- XPI: number;
5
- delta(lat: number, lng: number): LngLat;
2
+ export default class {
3
+ private static readonly PI;
4
+ private static readonly XPI;
5
+ private static delta;
6
6
  /**
7
7
  * 判断经纬度是否不在中国境内
8
8
  *
@@ -10,19 +10,19 @@ declare const _default: {
10
10
  * @param lat 纬度
11
11
  * @returns 如果经纬度不在中国境内则返回true,否则返回false
12
12
  */
13
- outOfChina(lng: number, lat: number): boolean;
14
- gcjEncrypt(wgsLat: number, wgsLon: number): LngLat;
15
- gcjDecrypt(gcjLat: number, gcjLon: number): LngLat;
16
- gcjDecryptExact(gcjLat: number, gcjLon: number): LngLat;
17
- bdEncrypt(gcjLat: number, gcjLon: number): LngLat;
18
- bdDecrypt(bdLat: number, bdLon: number): {
13
+ static outOfChina(lng: number, lat: number): boolean;
14
+ static gcjEncrypt(wgsLat: number, wgsLon: number): LngLat;
15
+ static gcjDecrypt(gcjLat: number, gcjLon: number): LngLat;
16
+ static gcjDecryptExact(gcjLat: number, gcjLon: number): LngLat;
17
+ static bdEncrypt(gcjLat: number, gcjLon: number): LngLat;
18
+ static bdDecrypt(bdLat: number, bdLon: number): {
19
19
  lat: number;
20
20
  lng: number;
21
21
  };
22
- mercatorEncrypt(wgsLat: number, wgsLon: number): LngLat;
23
- mercatorDecrypt(mercatorLat: number, mercatorLon: number): LngLat;
24
- transformLat(x: number, y: number): number;
25
- transformLon(x: number, y: number): number;
22
+ static mercatorEncrypt(wgsLat: number, wgsLon: number): LngLat;
23
+ static mercatorDecrypt(mercatorLat: number, mercatorLon: number): LngLat;
24
+ private static transformLat;
25
+ private static transformLon;
26
26
  /**
27
27
  * 生成一个介于两个坐标之间的随机坐标
28
28
  *
@@ -30,7 +30,7 @@ declare const _default: {
30
30
  * @param end 结束坐标,包含x和y属性
31
31
  * @returns 返回一个包含x和y属性的随机坐标
32
32
  */
33
- random({ x: minX, y: minY }: Coordinate, { x: maxX, y: maxY }: Coordinate): Coordinate;
33
+ static random({ x: minX, y: minY }: Coordinate, { x: maxX, y: maxY }: Coordinate): Coordinate;
34
34
  /**
35
35
  * 对坐标数组进行解构并应用函数处理
36
36
  *
@@ -39,6 +39,5 @@ declare const _default: {
39
39
  * @param context 函数执行上下文,可选
40
40
  * @returns 处理后的数组
41
41
  */
42
- deCompose(arr: any[], fn: Function, context: any): any[];
43
- };
44
- export default _default;
42
+ static deCompose(arr: any[], fn: Function, context: any): any[];
43
+ }
@@ -1,14 +1,20 @@
1
- declare const _default: {
2
- lastMonthDate: Date;
3
- thisMonthDate: Date;
4
- nextMonthDate: Date;
5
- lastWeekDate: Date;
6
- thisWeekDate: Date;
7
- nextWeekDate: Date;
8
- lastDayDate: Date;
9
- thisDayDate: Date;
10
- nextDayDate: Date;
11
- parseDate(str: string): Date;
1
+ export default class {
2
+ static readonly lastMonthDate: Date;
3
+ static readonly thisMonthDate: Date;
4
+ static readonly nextMonthDate: Date;
5
+ static readonly lastWeekDate: Date;
6
+ static readonly thisWeekDate: Date;
7
+ static readonly nextWeekDate: Date;
8
+ static readonly lastDayDate: Date;
9
+ static readonly thisDayDate: Date;
10
+ static readonly nextDayDate: Date;
11
+ /**
12
+ * 解析日期字符串,并返回对应的Date对象。
13
+ *
14
+ * @param str 日期字符串,格式为"yyyy-MM-dd"、"yyyy-MM-dd HH:mm:ss"或"yyyy-MM-dd HH:mm:ss.SSS"。
15
+ * @returns 返回解析后的Date对象,如果解析失败则返回null。
16
+ */
17
+ static parseDate(str: string): Date;
12
18
  /**
13
19
  * 格式化时间间隔
14
20
  *
@@ -16,8 +22,19 @@ declare const _default: {
16
22
  * @param endTime 结束时间,可以是字符串、数字或日期类型
17
23
  * @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
18
24
  */
19
- formatDateInterval(startTime: string | number | Date, endTime: string | number | Date): string;
20
- formatterCounter(times: number): string;
21
- sleep(d: number): void;
22
- };
23
- export default _default;
25
+ static formatDateInterval(startTime: string | number | Date, endTime: string | number | Date): string;
26
+ /**
27
+ * 将给定的时间(秒)格式化为时:分:秒格式的字符串
28
+ *
29
+ * @param times 时间(秒)
30
+ * @returns 返回格式化后的字符串
31
+ */
32
+ static formatterCounter(times: number): string;
33
+ /**
34
+ * 静态方法:使当前线程暂停执行指定的毫秒数
35
+ *
36
+ * @param d 需要暂停的毫秒数
37
+ * @returns 无返回值
38
+ */
39
+ static sleep(d: number): void;
40
+ }
@@ -1,7 +1,7 @@
1
1
  import { Coordinate, LngLat } from '../types';
2
- declare const _default: {
3
- toRadian: number;
4
- R: number;
2
+ export default class {
3
+ private static readonly toRadian;
4
+ private static readonly R;
5
5
  /**
6
6
  * 判断给定的经纬度是否合法
7
7
  *
@@ -9,7 +9,7 @@ declare const _default: {
9
9
  * @param lat 纬度值
10
10
  * @returns 如果经纬度合法,返回true;否则返回false
11
11
  */
12
- isLnglat(lng: number, lat: number): boolean;
12
+ static isLnglat(lng: number, lat: number): boolean;
13
13
  /**
14
14
  * 计算两哥平面坐标点间的距离
15
15
  *
@@ -17,7 +17,7 @@ declare const _default: {
17
17
  * @param p2 坐标点2,包含x和y属性
18
18
  * @returns 返回两点间的欧几里得距离
19
19
  */
20
- distance(p1: Coordinate, p2: Coordinate): number;
20
+ static distance(p1: Coordinate, p2: Coordinate): number;
21
21
  /**
22
22
  * 计算两个经纬度点之间的距离
23
23
  *
@@ -25,7 +25,7 @@ declare const _default: {
25
25
  * @param B 经纬度点B,包含lng(经度)和lat(纬度)两个属性
26
26
  * @returns 返回两点之间的距离,单位为米
27
27
  */
28
- distanceByPoints(A: LngLat, B: LngLat): number;
28
+ static distanceByPoints(A: LngLat, B: LngLat): number;
29
29
  /**
30
30
  * 格式化经纬度为度分秒格式
31
31
  *
@@ -33,7 +33,7 @@ declare const _default: {
33
33
  * @param lat 纬度
34
34
  * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
35
35
  */
36
- formatLnglat(lng: any, lat: any): string;
36
+ static formatLnglat(lng: any, lat: any): string;
37
37
  /**
38
38
  * 将经纬度字符串转换为度
39
39
  *
@@ -41,7 +41,7 @@ declare const _default: {
41
41
  * @param lat 纬度字符串
42
42
  * @returns 转换后的经纬度对象
43
43
  */
44
- transformLnglat(lng: any, lat: any): any;
44
+ static transformLnglat(lng: any, lat: any): any;
45
45
  /**
46
46
  * 射线法判断点是否在多边形内
47
47
  *
@@ -49,7 +49,7 @@ declare const _default: {
49
49
  * @param poly 多边形顶点数组,可以是字符串数组或对象数组
50
50
  * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
51
51
  */
52
- rayCasting(p: Coordinate, poly: string | any[]): "on" | "in" | "out";
52
+ static rayCasting(p: Coordinate, poly: string | any[]): "on" | "in" | "out";
53
53
  /**
54
54
  * 旋转点
55
55
  *
@@ -58,7 +58,7 @@ declare const _default: {
58
58
  * @param θ 旋转角度(顺时针旋转为正)
59
59
  * @returns 旋转后点坐标
60
60
  */
61
- rotatePoint(p1: Coordinate, p2: Coordinate, θ: number): {
61
+ static rotatePoint(p1: Coordinate, p2: Coordinate, θ: number): {
62
62
  x: number;
63
63
  y: number;
64
64
  };
@@ -69,7 +69,7 @@ declare const _default: {
69
69
  * @param p2 第二个点的坐标对象
70
70
  * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
71
71
  */
72
- calcBearAndDis(p1: Coordinate, p2: Coordinate): {
72
+ static calcBearAndDis(p1: Coordinate, p2: Coordinate): {
73
73
  angle: number;
74
74
  distance: number;
75
75
  };
@@ -80,7 +80,7 @@ declare const _default: {
80
80
  * @param latlng2 第二个经纬度点
81
81
  * @returns 包含方位角和距离的对象
82
82
  */
83
- calcBearAndDisByPoints(latlng1: LngLat, latlng2: LngLat): {
83
+ static calcBearAndDisByPoints(latlng1: LngLat, latlng2: LngLat): {
84
84
  angle: number;
85
85
  distance: number;
86
86
  };
@@ -92,7 +92,7 @@ declare const _default: {
92
92
  * @param p2 线段终点P2的坐标
93
93
  * @returns 点P到线段P1P2的最短距离
94
94
  */
95
- distanceToSegment(p: Coordinate, p1: Coordinate, p2: Coordinate): number;
95
+ static distanceToSegment(p: Coordinate, p1: Coordinate, p2: Coordinate): number;
96
96
  /**
97
97
  * 根据给定的经纬度、角度和距离计算新的经纬度点
98
98
  *
@@ -101,7 +101,7 @@ declare const _default: {
101
101
  * @param distance 距离值,单位为米,表示从当前点出发的距离
102
102
  * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
103
103
  */
104
- calcPointByBearAndDis(latlng: LngLat, angle: number, distance: number): LngLat;
104
+ static calcPointByBearAndDis(latlng: LngLat, angle: number, distance: number): LngLat;
105
105
  /**
106
106
  * 将墨卡托坐标转换为经纬度坐标
107
107
  *
@@ -109,7 +109,7 @@ declare const _default: {
109
109
  * @param y 墨卡托坐标的y值
110
110
  * @returns 返回包含转换后的经度lng和纬度lat的对象
111
111
  */
112
- mercatorTolonlat(x: number, y: number): LngLat;
112
+ static mercatorTolonlat(x: number, y: number): LngLat;
113
113
  /**
114
114
  * 将经纬度坐标转换为墨卡托坐标
115
115
  *
@@ -117,7 +117,7 @@ declare const _default: {
117
117
  * @param lat 纬度值
118
118
  * @returns 墨卡托坐标对象,包含x和y属性
119
119
  */
120
- lonlatToMercator(lng: number, lat: number): Coordinate;
120
+ static lonlatToMercator(lng: number, lat: number): Coordinate;
121
121
  /**
122
122
  * 根据百分比获取坐标
123
123
  *
@@ -126,6 +126,5 @@ declare const _default: {
126
126
  * @param percent 百分比,取值范围0-1
127
127
  * @returns 返回插值后的坐标
128
128
  */
129
- interpolate({ x: x1, y: y1, z: z1 }: Coordinate, { x: x2, y: y2, z: z2 }: Coordinate, percent: number): Coordinate;
130
- };
131
- export default _default;
129
+ static interpolate({ x: x1, y: y1, z: z1 }: Coordinate, { x: x2, y: y2, z: z2 }: Coordinate, percent: number): Coordinate;
130
+ }
@@ -0,0 +1,25 @@
1
+ export default class {
2
+ private static warned;
3
+ static warning(message: string): void;
4
+ static note(message: string): void;
5
+ static resetWarned(): void;
6
+ private static _call;
7
+ static warningOnce(message: string): void;
8
+ static noteOnce(message: string): void;
9
+ /**
10
+ * 朗读文本
11
+ *
12
+ * @param message 要朗读的文本内容
13
+ * @param options 朗读选项,可选参数包括:
14
+ * - lang: 使用的语言,默认为中文
15
+ * - volume: 声音音量,默认为1
16
+ * - rate: 语速,默认为1
17
+ * - pitch: 音高,默认为1
18
+ */
19
+ static speak(message: string, options?: {
20
+ lang?: string;
21
+ volume?: number;
22
+ rate?: number;
23
+ pitch?: number;
24
+ }): void;
25
+ }
@@ -11,6 +11,7 @@ export { default as ImageUtil } from './ImageUtil';
11
11
  export { default as ObjectUtil } from './ObjectUtil';
12
12
  export { default as FileUtil } from './FileUtil';
13
13
  export { default as MathUtil } from './MathUtil';
14
+ export { default as MessageUtil } from './MessageUtil';
14
15
  export { default as OptimizeUtil } from './OptimizeUtil';
15
16
  export { default as StringUtil } from './StringUtil';
16
17
  export { default as UrlUtil } from './UrlUtil';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gis-common",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "author": "Guo.Yan <luv02@vip.qq.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -10,7 +10,7 @@
10
10
  "files": [
11
11
  "dist"
12
12
  ],
13
- "types": "dist/index.d.ts",
13
+ "types": "dist/types.d.ts",
14
14
  "exports": {
15
15
  ".": {
16
16
  "import": "./dist/gis-common.es.js",
@@ -30,6 +30,8 @@
30
30
  "mqtt-browser": "^4.3.7"
31
31
  },
32
32
  "devDependencies": {
33
+ "@types/leaflet": "^1.9.12",
34
+ "@types/node": "^22.5.5",
33
35
  "terser": "^5.32.0",
34
36
  "typescript": "^5.5.4",
35
37
  "vite": "^5.4.0",