gis-common 5.1.15 → 5.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/gis-common.es.js +1637 -1717
  2. package/dist/gis-common.umd.js +1 -1
  3. package/dist/index.d.ts +1639 -4
  4. package/package.json +4 -4
  5. package/dist/constant/CaseType.d.ts +0 -8
  6. package/dist/constant/ErrorType.d.ts +0 -31
  7. package/dist/constant/EventType.d.ts +0 -24
  8. package/dist/constant/FormType.d.ts +0 -6
  9. package/dist/constant/GraphicTypes.d.ts +0 -26
  10. package/dist/constant/LayerType.d.ts +0 -10
  11. package/dist/constant/index.d.ts +0 -6
  12. package/dist/core/AudioPlayer.d.ts +0 -20
  13. package/dist/core/CanvasDrawer.d.ts +0 -37
  14. package/dist/core/Color.d.ts +0 -65
  15. package/dist/core/Cookie.d.ts +0 -5
  16. package/dist/core/DateTime.d.ts +0 -43
  17. package/dist/core/EventDispatcher.d.ts +0 -13
  18. package/dist/core/FullScreen.d.ts +0 -16
  19. package/dist/core/HashMap.d.ts +0 -20
  20. package/dist/core/MqttClient.d.ts +0 -32
  21. package/dist/core/Storage.d.ts +0 -51
  22. package/dist/core/WebGL.d.ts +0 -31
  23. package/dist/core/WebSocketClient.d.ts +0 -15
  24. package/dist/core/index.d.ts +0 -12
  25. package/dist/types.d.ts +0 -101
  26. package/dist/utils/AjaxUtil.d.ts +0 -109
  27. package/dist/utils/ArrayUtil.d.ts +0 -45
  28. package/dist/utils/AssertUtil.d.ts +0 -15
  29. package/dist/utils/BrowserUtil.d.ts +0 -85
  30. package/dist/utils/CommUtil.d.ts +0 -105
  31. package/dist/utils/CoordsUtil.d.ts +0 -43
  32. package/dist/utils/DomUtil.d.ts +0 -90
  33. package/dist/utils/ExceptionUtil.d.ts +0 -15
  34. package/dist/utils/FileUtil.d.ts +0 -33
  35. package/dist/utils/GeoJsonUtil.d.ts +0 -76
  36. package/dist/utils/GeoUtil.d.ts +0 -151
  37. package/dist/utils/ImageUtil.d.ts +0 -43
  38. package/dist/utils/MathUtil.d.ts +0 -37
  39. package/dist/utils/MessageUtil.d.ts +0 -35
  40. package/dist/utils/ObjectUtil.d.ts +0 -30
  41. package/dist/utils/OptimizeUtil.d.ts +0 -43
  42. package/dist/utils/StringUtil.d.ts +0 -34
  43. package/dist/utils/TreeUtil.d.ts +0 -25
  44. package/dist/utils/UrlUtil.d.ts +0 -18
  45. package/dist/utils/ValidateUtil.d.ts +0 -26
  46. package/dist/utils/index.d.ts +0 -20
@@ -247,8 +247,6 @@ const Util = {
247
247
  return !value.length;
248
248
  case "Object":
249
249
  return !Object.keys(value).length;
250
- case "Boolean":
251
- return !value;
252
250
  default:
253
251
  return false;
254
252
  }
@@ -424,7 +422,7 @@ const Util = {
424
422
  return typeof a === "object" && a !== null;
425
423
  },
426
424
  isNil(a) {
427
- return a === void 0 || a === "undefined" || a === null || a === "null";
425
+ return a === void 0 || a === null || Number.isNaN(a);
428
426
  },
429
427
  isNumber(a) {
430
428
  return typeof a === "number" && !isNaN(a) || typeof a === "string" && Number.isFinite(+a);
@@ -717,7 +715,7 @@ const AjaxUtil = {
717
715
  * }
718
716
  * );
719
717
  */
720
- get(url, options = {}, cb) {
718
+ get(url, options, cb) {
721
719
  if (Util.isFunction(options)) {
722
720
  const t = cb;
723
721
  cb = options;
@@ -905,11 +903,11 @@ const AjaxUtil = {
905
903
  * }
906
904
  * );
907
905
  */
908
- getJSON(url, options = {}, cb) {
906
+ getJSON(url, options, cb) {
909
907
  if (Util.isFunction(options)) {
910
908
  const t = cb;
911
909
  cb = options;
912
- options = t;
910
+ options = t || {};
913
911
  }
914
912
  const callback = function(resp, err) {
915
913
  const data = resp ? ObjectUtil.parse(resp) : null;
@@ -923,708 +921,766 @@ const AjaxUtil = {
923
921
  return this.get(url, options, callback);
924
922
  }
925
923
  };
926
- const MathUtil = {
927
- DEG2RAD: Math.PI / 180,
928
- RAD2DEG: 180 / Math.PI,
929
- randInt(low, high) {
930
- return low + Math.floor(Math.random() * (high - low + 1));
931
- },
932
- randFloat(low, high) {
933
- return low + Math.random() * (high - low);
934
- },
924
+ const myArray = Object.create(Array);
925
+ myArray.prototype.groupBy = function(f = (d) => d) {
926
+ var groups = {};
927
+ this.forEach(function(o) {
928
+ var group = JSON.stringify(f(o));
929
+ groups[group] = groups[group] || [];
930
+ groups[group].push(o);
931
+ });
932
+ return Object.keys(groups).map((group) => groups[group]);
933
+ };
934
+ myArray.prototype.distinct = function(f = (d) => d) {
935
+ const arr = [];
936
+ const obj = {};
937
+ this.forEach((item) => {
938
+ const val = f(item);
939
+ const key = String(val);
940
+ if (!obj[key]) {
941
+ obj[key] = true;
942
+ arr.push(item);
943
+ }
944
+ });
945
+ return arr;
946
+ };
947
+ myArray.prototype.max = function(f = (d) => d) {
948
+ return this.desc(f)[0];
949
+ };
950
+ myArray.prototype.min = function(f = (d) => d) {
951
+ return this.asc(f)[0];
952
+ };
953
+ myArray.prototype.sum = function(f = (d) => d) {
954
+ return this.length === 1 ? f(this[0]) : this.length > 1 ? this.reduce((prev = 0, curr = 0) => f(prev) + f(curr)) : 0;
955
+ };
956
+ myArray.prototype.avg = function(f = (d) => d) {
957
+ return this.length ? this.sum(f) / this.length : 0;
958
+ };
959
+ myArray.prototype.desc = function(f = (d) => d) {
960
+ return this.sort((n1, n2) => f(n2) - f(n1));
961
+ };
962
+ myArray.prototype.asc = function(f = (d) => d) {
963
+ return this.sort((n1, n2) => f(n1) - f(n2));
964
+ };
965
+ myArray.prototype.random = function() {
966
+ return this[Math.floor(Math.random() * this.length)];
967
+ };
968
+ myArray.prototype.remove = function(f = (d) => d) {
969
+ const i = this.findIndex(f);
970
+ if (i > -1) {
971
+ this.splice(i, 1);
972
+ this.remove(f);
973
+ }
974
+ return this;
975
+ };
976
+ const ArrayUtil = {
935
977
  /**
936
- * 角度转弧度
978
+ * 创建指定长度的数组,并返回其索引数组
937
979
  *
938
- * @param {*} degrees
939
- * @returns {*}
980
+ * @param length 数组长度
981
+ * @returns 索引数组
940
982
  */
941
- deg2Rad(degrees) {
942
- return degrees * this.DEG2RAD;
983
+ create(length) {
984
+ return [...new Array(length).keys()];
943
985
  },
944
986
  /**
945
- * 弧度转角度
987
+ * 合并多个数组,并去重
946
988
  *
947
- * @param {*} radians
948
- * @returns {*}
989
+ * @param args 需要合并的数组
990
+ * @returns 合并后的去重数组
949
991
  */
950
- rad2Deg(radians) {
951
- return radians * this.RAD2DEG;
952
- },
953
- round(value, n = 2) {
954
- return Util.isNumber(value) ? Math.round(Number(value) * Math.pow(10, n)) / Math.pow(10, n) : 0;
992
+ union(...args) {
993
+ let res = [];
994
+ args.forEach((arg) => {
995
+ if (Array.isArray(arg)) {
996
+ res = res.concat(arg.filter((v) => !res.includes(v)));
997
+ }
998
+ });
999
+ return res;
955
1000
  },
956
1001
  /**
957
- * 将数值限制在指定范围内
1002
+ * 求多个数组的交集
958
1003
  *
959
- * @param val 需要限制的数值
960
- * @param min 最小值
961
- * @param max 最大值
962
- * @returns 返回限制后的数值
1004
+ * @param args 多个需要求交集的数组
1005
+ * @returns 返回多个数组的交集数组
963
1006
  */
964
- clamp(val, min, max) {
965
- return Math.max(min, Math.min(max, val));
966
- },
967
- formatLength(length, options = { decimal: 1 }) {
968
- const { decimal } = options;
969
- if (length >= 1e3) {
970
- const km = length / 1e3;
971
- return km % 1 === 0 ? `${km.toFixed(0)}km` : `${km.toFixed(decimal).replace(/\.?0+$/, "")}km`;
972
- } else {
973
- return length % 1 === 0 ? `${length.toFixed(0)}m` : `${length.toFixed(decimal).replace(/\.?0+$/, "")}m`;
974
- }
1007
+ intersection(...args) {
1008
+ let res = args[0] || [];
1009
+ args.forEach((arg) => {
1010
+ if (Array.isArray(arg)) {
1011
+ res = res.filter((v) => arg.includes(v));
1012
+ }
1013
+ });
1014
+ return res;
975
1015
  },
976
- formatArea(area, options = { decimal: 1 }) {
977
- const { decimal } = options;
978
- if (area >= 1e6) {
979
- const km = area / 1e6;
980
- return km % 1 === 0 ? `${area.toFixed(0)}km²` : `${area.toFixed(decimal).replace(/\.?0+$/, "")}km²`;
981
- } else {
982
- return area % 1 === 0 ? `${area.toFixed(0)}m²` : `${area.toFixed(decimal).replace(/\.?0+$/, "")}m²`;
983
- }
984
- }
985
- };
986
- class GeoUtil {
987
- // 地球赤道半径
988
1016
  /**
989
- * 判断给定的经纬度是否合法
1017
+ * 将多个数组拼接为一个数组,并去除其中的空值。
990
1018
  *
991
- * @param lng 经度值
992
- * @param lat 纬度值
993
- * @returns 如果经纬度合法,返回true;否则返回false
1019
+ * @param args 需要拼接的数组列表。
1020
+ * @returns 拼接并去空后的数组。
994
1021
  */
995
- static isLnglat(lng, lat) {
996
- return Util.isNumber(lng) && Util.isNumber(lat) && !!(+lat >= -90 && +lat <= 90 && +lng >= -180 && +lng <= 180);
997
- }
1022
+ unionAll(...args) {
1023
+ return [...args].flat().filter((d) => !!d);
1024
+ },
998
1025
  /**
999
- * 计算两哥平面坐标点间的距离
1026
+ * 求差集
1000
1027
  *
1001
- * @param p1 坐标点1,包含x和y属性
1002
- * @param p2 坐标点2,包含x和y属性
1003
- * @returns 返回两点间的欧几里得距离
1028
+ * @param args 任意个集合
1029
+ * @returns 返回差集结果
1004
1030
  */
1005
- static distance(p1, p2) {
1006
- return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
1007
- }
1031
+ difference(...args) {
1032
+ if (args.length === 0) return [];
1033
+ return this.union(...args).filter((d) => !this.intersection(...args).includes(d));
1034
+ },
1008
1035
  /**
1009
- * 计算两个点之间的距离
1036
+ * 对字符串数组进行中文排序
1010
1037
  *
1011
- * @param A 点A,包含x和y两个属性
1012
- * @param B 点B,包含x和y两个属性
1013
- * @returns 返回两点之间的距离,单位为米
1038
+ * @param arr 待排序的字符串数组
1039
+ * @returns 排序后的字符串数组
1014
1040
  */
1015
- static distanceByPoints(A, B) {
1016
- const { x: xa, y: ya } = A;
1017
- const { x: xb, y: yb } = B;
1018
- const earthR = 6371e3;
1019
- const x = Math.cos(ya * Math.PI / 180) * Math.cos(yb * Math.PI / 180) * Math.cos((xa - xb) * Math.PI / 180);
1020
- const y = Math.sin(ya * Math.PI / 180) * Math.sin(yb * Math.PI / 180);
1021
- let s = x + y;
1022
- if (s > 1) s = 1;
1023
- if (s < -1) s = -1;
1024
- const alpha = Math.acos(s);
1025
- const distance = alpha * earthR;
1026
- return distance;
1041
+ zhSort(arr, f = (d) => d, reverse) {
1042
+ arr.sort(function(a, b) {
1043
+ return reverse ? f(a).localeCompare(f(b), "zh") : f(b).localeCompare(f(a), "zh");
1044
+ });
1045
+ return arr;
1027
1046
  }
1047
+ };
1048
+ class BrowserUtil {
1028
1049
  /**
1029
- * 格式化经纬度为度分秒格式
1050
+ * 获取系统类型
1030
1051
  *
1031
- * @param lng 经度
1032
- * @param lat 纬度
1033
- * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
1052
+ * @returns 返回一个包含系统类型和版本的对象
1034
1053
  */
1035
- static formatLnglat(lng, lat) {
1036
- let res = "";
1037
- function formatDegreeToDMS(valueInDegrees) {
1038
- const degree = Math.floor(valueInDegrees);
1039
- const minutes = Math.floor((valueInDegrees - degree) * 60);
1040
- const seconds = (valueInDegrees - degree) * 3600 - minutes * 60;
1041
- return `${degree}°${minutes}′${seconds.toFixed(2)}″`;
1042
- }
1043
- if (this.isLnglat(lng, lat)) {
1044
- res = formatDegreeToDMS(lng) + "," + formatDegreeToDMS(lat);
1045
- } else if (!isNaN(lng)) {
1046
- res = formatDegreeToDMS(lng);
1047
- } else if (!isNaN(lat)) {
1048
- res = formatDegreeToDMS(lat);
1054
+ static getSystem() {
1055
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
1056
+ const userAgent = this.userAgent || ((_a2 = this.navigator) == null ? void 0 : _a2.userAgent);
1057
+ let type = "", version = "";
1058
+ if (userAgent.includes("Android") || userAgent.includes("Adr")) {
1059
+ type = "Android";
1060
+ version = ((_b = userAgent.match(/Android ([\d.]+);/)) == null ? void 0 : _b[1]) || "";
1061
+ } else if (userAgent.includes("CrOS")) {
1062
+ type = "Chromium OS";
1063
+ version = ((_c = userAgent.match(/MSIE ([\d.]+)/)) == null ? void 0 : _c[1]) || ((_d = userAgent.match(/rv:([\d.]+)/)) == null ? void 0 : _d[1]) || "";
1064
+ } else if (userAgent.includes("Linux") || userAgent.includes("X11")) {
1065
+ type = "Linux";
1066
+ version = ((_e = userAgent.match(/Linux ([\d.]+)/)) == null ? void 0 : _e[1]) || "";
1067
+ } else if (userAgent.includes("Ubuntu")) {
1068
+ type = "Ubuntu";
1069
+ version = ((_f = userAgent.match(/Ubuntu ([\d.]+)/)) == null ? void 0 : _f[1]) || "";
1070
+ } else if (userAgent.includes("Windows")) {
1071
+ let v = ((_g = userAgent.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/)) == null ? void 0 : _g[1]) || "";
1072
+ let hash = {
1073
+ "10.0": "10",
1074
+ "6.4": "10 Technical Preview",
1075
+ "6.3": "8.1",
1076
+ "6.2": "8",
1077
+ "6.1": "7",
1078
+ "6.0": "Vista",
1079
+ "5.2": "XP 64-bit",
1080
+ "5.1": "XP",
1081
+ "5.01": "2000 SP1",
1082
+ "5.0": "2000",
1083
+ "4.0": "NT",
1084
+ "4.90": "ME"
1085
+ };
1086
+ type = "Windows";
1087
+ version = v in hash ? hash[v] : v;
1088
+ } else if (userAgent.includes("like Mac OS X")) {
1089
+ type = "IOS";
1090
+ version = ((_h = userAgent.match(/OS ([\d_]+) like/)) == null ? void 0 : _h[1].replace(/_/g, ".")) || "";
1091
+ } else if (userAgent.includes("Macintosh")) {
1092
+ type = "macOS";
1093
+ version = ((_i = userAgent.match(/Mac OS X -?([\d_]+)/)) == null ? void 0 : _i[1].replace(/_/g, ".")) || "";
1049
1094
  }
1050
- return res;
1095
+ return { type, version };
1051
1096
  }
1052
1097
  /**
1053
- * 将经纬度字符串转换为度
1098
+ * 获取浏览器类型信息
1054
1099
  *
1055
- * @param lng 经度字符串
1056
- * @param lat 纬度字符串
1057
- * @returns 转换后的经纬度对象
1100
+ * @returns 浏览器类型信息,包含浏览器类型和版本号
1058
1101
  */
1059
- static transformLnglat(lng, lat) {
1060
- function dms2deg(dmsString) {
1061
- const isNegative = /[sw]/i.test(dmsString);
1062
- let factor = isNegative ? -1 : 1;
1063
- const numericParts = dmsString.match(/[\d.]+/g) || [];
1064
- let degrees = 0;
1065
- for (let i = 0; i < numericParts.length; i++) {
1066
- degrees += parseFloat(numericParts[i]) / factor;
1067
- factor *= 60;
1102
+ static getExplorer() {
1103
+ var _a2;
1104
+ const userAgent = this.userAgent || ((_a2 = this.navigator) == null ? void 0 : _a2.userAgent);
1105
+ let type = "", version = "";
1106
+ if (/MSIE|Trident/.test(userAgent)) {
1107
+ let matches = /MSIE\s(\d+\.\d+)/.exec(userAgent) || /rv:(\d+\.\d+)/.exec(userAgent);
1108
+ if (matches) {
1109
+ type = "IE";
1110
+ version = matches[1];
1068
1111
  }
1069
- return degrees;
1070
- }
1071
- if (lng && lat) {
1072
- return {
1073
- lng: dms2deg(lng),
1074
- lat: dms2deg(lat)
1075
- };
1076
- }
1077
- }
1078
- /**
1079
- * 射线法判断点是否在多边形内
1080
- *
1081
- * @param p 点对象,包含x和y属性
1082
- * @param poly 多边形顶点数组,可以是字符串数组或对象数组
1083
- * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
1084
- */
1085
- static rayCasting(p, poly) {
1086
- var px = p.x, py = p.y, flag = false;
1087
- for (var i = 0, l = poly.length, j = l - 1; i < l; j = i, i++) {
1088
- var sx = poly[i].x, sy = poly[i].y, tx = poly[j].x, ty = poly[j].y;
1089
- if (sx === px && sy === py || tx === px && ty === py) {
1090
- return "on";
1112
+ } else if (/Edge/.test(userAgent)) {
1113
+ let matches = /Edge\/(\d+\.\d+)/.exec(userAgent);
1114
+ if (matches) {
1115
+ type = "Edge";
1116
+ version = matches[1];
1091
1117
  }
1092
- if (sy < py && ty >= py || sy >= py && ty < py) {
1093
- var x = sx + (py - sy) * (tx - sx) / (ty - sy);
1094
- if (x === px) {
1095
- return "on";
1096
- }
1097
- if (x > px) {
1098
- flag = !flag;
1099
- }
1118
+ } else if (/Chrome/.test(userAgent) && /Google Inc/.test(this.navigator.vendor)) {
1119
+ let matches = /Chrome\/(\d+\.\d+)/.exec(userAgent);
1120
+ if (matches) {
1121
+ type = "Chrome";
1122
+ version = matches[1];
1123
+ }
1124
+ } else if (/Firefox/.test(userAgent)) {
1125
+ let matches = /Firefox\/(\d+\.\d+)/.exec(userAgent);
1126
+ if (matches) {
1127
+ type = "Firefox";
1128
+ version = matches[1];
1129
+ }
1130
+ } else if (/Safari/.test(userAgent) && /Apple Computer/.test(this.navigator.vendor)) {
1131
+ let matches = /Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(userAgent);
1132
+ if (matches) {
1133
+ type = "Safari";
1134
+ version = matches[1];
1100
1135
  }
1101
1136
  }
1102
- return flag ? "in" : "out";
1103
- }
1104
- /**
1105
- * 旋转点
1106
- *
1107
- * @param p1 旋转前点坐标
1108
- * @param p2 旋转中心坐标
1109
- * @param θ 旋转角度(顺时针旋转为正)
1110
- * @returns 旋转后点坐标
1111
- */
1112
- static rotatePoint(p1, p2, θ) {
1113
- const x = (p1.x - p2.x) * Math.cos(Math.PI / 180 * -θ) - (p1.y - p2.y) * Math.sin(Math.PI / 180 * -θ) + p2.x;
1114
- const y = (p1.x - p2.x) * Math.sin(Math.PI / 180 * -θ) + (p1.y - p2.y) * Math.cos(Math.PI / 180 * -θ) + p2.y;
1115
- return { x, y };
1137
+ return {
1138
+ type,
1139
+ version
1140
+ };
1116
1141
  }
1117
1142
  /**
1118
- * 根据两个平面坐标点计算方位角和距离
1143
+ * 判断当前浏览器是否支持WebGL
1119
1144
  *
1120
- * @param p1 第一个点的坐标对象
1121
- * @param p2 第二个点的坐标对象
1122
- * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
1123
- * 正北为0°,顺时针增加
1145
+ * @returns 如果支持WebGL则返回true,否则返回false
1124
1146
  */
1125
- static calcBearAndDis(p1, p2) {
1126
- const { x: x1, y: y1 } = p1;
1127
- const { x: x2, y: y2 } = p2;
1128
- const dx = x2 - x1;
1129
- const dy = y2 - y1;
1130
- const distance = Math.sqrt(dx * dx + dy * dy);
1131
- const angleInRadians = Math.atan2(dx, dy);
1132
- const angle = (angleInRadians * (180 / Math.PI) + 360) % 360;
1133
- return { angle, distance };
1147
+ static isSupportWebGL() {
1148
+ if (!(this == null ? void 0 : this.document)) {
1149
+ return false;
1150
+ }
1151
+ const $canvas = this.document.createElement("canvas");
1152
+ const gl = $canvas.getContext("webgl") || $canvas.getContext("experimental-webgl");
1153
+ return gl && gl instanceof WebGLRenderingContext;
1134
1154
  }
1135
1155
  /**
1136
- * 根据两个经纬度点计算方位角和距离
1156
+ * 获取GPU信息
1137
1157
  *
1138
- * @param latlng1 第一个经纬度点
1139
- * @param latlng2 第二个经纬度点
1140
- * @returns 包含方位角和距离的对象
1158
+ * @returns 返回包含GPU类型和型号的对象
1141
1159
  */
1142
- static calcBearAndDisByPoints(latlng1, latlng2) {
1143
- var f1 = latlng1.lat * 1, l1 = latlng1.lng * 1, f2 = latlng2.lat * 1, l2 = latlng2.lng * 1;
1144
- var y = Math.sin((l2 - l1) * this.toRadian) * Math.cos(f2 * this.toRadian);
1145
- 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);
1146
- var angle = Math.atan2(y, x) * (180 / Math.PI);
1147
- var deltaF = (f2 - f1) * this.toRadian;
1148
- var deltaL = (l2 - l1) * this.toRadian;
1149
- var a = Math.sin(deltaF / 2) * Math.sin(deltaF / 2) + Math.cos(f1 * this.toRadian) * Math.cos(f2 * this.toRadian) * Math.sin(deltaL / 2) * Math.sin(deltaL / 2);
1150
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
1151
- var distance = this.R * c;
1160
+ static getGPU() {
1161
+ let type = "unknown";
1162
+ let model = "unknown";
1163
+ if (this == null ? void 0 : this.document) {
1164
+ let $canvas = this.document.createElement("canvas");
1165
+ let gl = $canvas.getContext("webgl") || $canvas.getContext("experimental-webgl");
1166
+ if (gl instanceof WebGLRenderingContext) {
1167
+ let debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
1168
+ if (debugInfo) {
1169
+ let gpu_str = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
1170
+ type = (gpu_str.match(/ANGLE \((.+?),/) || [])[1] || "";
1171
+ model = (gpu_str.match(/, (.+?) (\(|vs_)/) || [])[1] || "";
1172
+ }
1173
+ return {
1174
+ type,
1175
+ model,
1176
+ spec: {
1177
+ maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),
1178
+ // 最大纹理尺寸 16384/4k
1179
+ maxRenderBufferSize: gl.getParameter(gl.MAX_RENDERBUFFER_SIZE),
1180
+ // 最大渲染缓冲尺寸 16384/4k
1181
+ maxTextureUnits: gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
1182
+ // 纹理单元数量 32
1183
+ }
1184
+ };
1185
+ }
1186
+ }
1152
1187
  return {
1153
- angle,
1154
- distance
1188
+ type,
1189
+ model
1155
1190
  };
1156
1191
  }
1157
1192
  /**
1158
- * 计算点P到线段P1P2的最短距离
1193
+ * 获取当前浏览器设置的语言
1159
1194
  *
1160
- * @param p 点P的坐标
1161
- * @param p1 线段起点P1的坐标
1162
- * @param p2 线段终点P2的坐标
1163
- * @returns 点P到线段P1P2的最短距离
1195
+ * @returns 返回浏览器设置的语言,格式为 "语言_地区",例如 "zh_CN"。如果获取失败,则返回 "Unknown"。
1164
1196
  */
1165
- static distanceToSegment(p, p1, p2) {
1166
- const x = p.x, y = p.y, x1 = p1.x, y1 = p1.y, x2 = p2.x, y2 = p2.y;
1167
- const cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
1168
- if (cross <= 0) {
1169
- return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
1170
- }
1171
- const d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
1172
- if (cross >= d2) {
1173
- return Math.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));
1197
+ static getLanguage() {
1198
+ var _a2, _b;
1199
+ let g = ((_a2 = this.navigator) == null ? void 0 : _a2.language) || ((_b = this.navigator) == null ? void 0 : _b.userLanguage);
1200
+ if (typeof g !== "string") return "";
1201
+ let arr = g.split("-");
1202
+ if (arr[1]) {
1203
+ arr[1] = arr[1].toUpperCase();
1174
1204
  }
1175
- const r = cross / d2;
1176
- const px = x1 + (x2 - x1) * r;
1177
- const py = y1 + (y2 - y1) * r;
1178
- return Math.sqrt((x - px) * (x - px) + (y - py) * (y - py));
1205
+ let language = arr.join("_");
1206
+ return language;
1179
1207
  }
1180
1208
  /**
1181
- * 根据给定的经纬度、角度和距离计算新的经纬度点
1209
+ * 获取当前环境的时区。
1182
1210
  *
1183
- * @param latlng 给定的经纬度点,类型为LngLat
1184
- * @param angle 角度值,单位为度,表示从当前点出发的方向
1185
- * @param distance 距离值,单位为米,表示从当前点出发的距离
1186
- * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
1211
+ * @returns 返回当前环境的时区,若获取失败则返回 undefined。
1187
1212
  */
1188
- static calcPointByBearAndDis(latlng, angle, distance) {
1189
- const sLat = MathUtil.deg2Rad(latlng.lat * 1);
1190
- const sLng = MathUtil.deg2Rad(latlng.lng * 1);
1191
- const d = distance / this.R;
1192
- angle = MathUtil.deg2Rad(angle);
1193
- const lat = Math.asin(Math.sin(sLat) * Math.cos(d) + Math.cos(sLat) * Math.sin(d) * Math.cos(angle));
1194
- const lon = sLng + Math.atan2(Math.sin(angle) * Math.sin(d) * Math.cos(sLat), Math.cos(d) - Math.sin(sLat) * Math.sin(lat));
1195
- return {
1196
- lat: MathUtil.rad2Deg(lat),
1197
- lng: MathUtil.rad2Deg(lon)
1198
- };
1213
+ static getTimeZone() {
1214
+ var _a2, _b;
1215
+ return (_b = (_a2 = Intl == null ? void 0 : Intl.DateTimeFormat()) == null ? void 0 : _a2.resolvedOptions()) == null ? void 0 : _b.timeZone;
1199
1216
  }
1200
1217
  /**
1201
- * 将墨卡托坐标转换为经纬度坐标
1218
+ * 获取屏幕帧率
1202
1219
  *
1203
- * @param x 墨卡托坐标的x值
1204
- * @param y 墨卡托坐标的y值
1205
- * @returns 返回包含转换后的经度lng和纬度lat的对象
1220
+ * @returns 返回一个Promise,resolve为计算得到的屏幕帧率
1221
+ * eg: const fps = await BrowserUtil.getScreenFPS()
1206
1222
  */
1207
- static mercatorTolonlat(x, y) {
1208
- const earthRadius = this.R_EQU;
1209
- const lng = x / earthRadius * (180 / Math.PI);
1210
- const lat = Math.atan(Math.exp(y / earthRadius)) * (180 / Math.PI) * 2 - 90;
1211
- return { lng, lat };
1223
+ static async getScreenFPS() {
1224
+ return new Promise(function(resolve) {
1225
+ let lastTime = 0;
1226
+ let count = 1;
1227
+ let list = [];
1228
+ let tick = function(timestamp) {
1229
+ if (lastTime > 0) {
1230
+ if (count < 12) {
1231
+ list.push(timestamp - lastTime);
1232
+ lastTime = timestamp;
1233
+ count++;
1234
+ requestAnimationFrame(tick);
1235
+ } else {
1236
+ list.sort();
1237
+ list = list.slice(1, 11);
1238
+ let sum = list.reduce((a, b) => a + b);
1239
+ const fps = Math.round(1e4 / sum / 10) * 10;
1240
+ resolve(fps);
1241
+ }
1242
+ } else {
1243
+ lastTime = timestamp;
1244
+ requestAnimationFrame(tick);
1245
+ }
1246
+ };
1247
+ requestAnimationFrame(tick);
1248
+ });
1212
1249
  }
1213
1250
  /**
1214
- * 将经纬度坐标转换为墨卡托坐标
1251
+ * 获取IP地址
1215
1252
  *
1216
- * @param lng 经度值
1217
- * @param lat 纬度值
1218
- * @returns 墨卡托坐标对象,包含x和y属性
1253
+ * @returns 返回一个Promise,当成功获取到IP地址时resolve,返回IP地址字符串;当获取失败时reject,返回undefined
1219
1254
  */
1220
- static lonlatToMercator(lng, lat) {
1221
- var earthRad = this.R_EQU;
1222
- const x = lng * Math.PI / 180 * earthRad;
1223
- var a = lat * Math.PI / 180;
1224
- const y = earthRad / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a)));
1225
- return { x, y };
1226
- }
1227
- /**
1228
- * 计算三角形面积
1229
- *
1230
- * @param a 第一个点的坐标
1231
- * @param b 第二个点的坐标
1232
- * @param c 第三个点的坐标
1233
- * @returns 返回三角形的面积
1234
- */
1235
- static getTraingleArea(a, b, c) {
1236
- let area = 0;
1237
- const side = [];
1238
- side[0] = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2) + Math.pow((a.z || 0) - (b.z || 0), 2));
1239
- side[1] = Math.sqrt(Math.pow(a.x - c.x, 2) + Math.pow(a.y - c.y, 2) + Math.pow((a.z || 0) - (c.z || 0), 2));
1240
- side[2] = Math.sqrt(Math.pow(c.x - b.x, 2) + Math.pow(c.y - b.y, 2) + Math.pow((c.z || 0) - (b.z || 0), 2));
1241
- if (side[0] + side[1] <= side[2] || side[0] + side[2] <= side[1] || side[1] + side[2] <= side[0]) {
1242
- return area;
1243
- }
1244
- const p = (side[0] + side[1] + side[2]) / 2;
1245
- area = Math.sqrt(p * (p - side[0]) * (p - side[1]) * (p - side[2]));
1246
- return area;
1255
+ static async getIPAddress() {
1256
+ const reg = {
1257
+ IPv4: /\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/,
1258
+ IPv6: /\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i
1259
+ };
1260
+ let RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
1261
+ const ipSet = /* @__PURE__ */ new Set();
1262
+ const onicecandidate = (ice) => {
1263
+ var _a2;
1264
+ const candidate = (_a2 = ice == null ? void 0 : ice.candidate) == null ? void 0 : _a2.candidate;
1265
+ if (candidate) {
1266
+ for (const regex of [reg["IPv4"], reg["IPv6"]]) {
1267
+ const match = candidate.match(regex);
1268
+ if (match) {
1269
+ ipSet.add(match[0]);
1270
+ }
1271
+ }
1272
+ }
1273
+ };
1274
+ return new Promise(function(resolve, reject) {
1275
+ const conn = new RTCPeerConnection({
1276
+ iceServers: [
1277
+ {
1278
+ urls: "stun:stun.l.google.com:19302"
1279
+ },
1280
+ {
1281
+ urls: "stun:stun.services.mozilla.com"
1282
+ }
1283
+ ]
1284
+ });
1285
+ conn.addEventListener("icecandidate", onicecandidate);
1286
+ conn.createDataChannel("");
1287
+ conn.createOffer().then((offer) => conn.setLocalDescription(offer), reject);
1288
+ let count = 20;
1289
+ let hander;
1290
+ let closeConnect = function() {
1291
+ try {
1292
+ conn.removeEventListener("icecandidate", onicecandidate);
1293
+ conn.close();
1294
+ } catch {
1295
+ }
1296
+ hander && clearInterval(hander);
1297
+ };
1298
+ hander = window.setInterval(function() {
1299
+ let ips = [...ipSet];
1300
+ if (ips.length) {
1301
+ closeConnect();
1302
+ resolve(ips[0]);
1303
+ } else if (count) {
1304
+ count--;
1305
+ } else {
1306
+ closeConnect();
1307
+ resolve("");
1308
+ }
1309
+ }, 100);
1310
+ });
1247
1311
  }
1248
1312
  /**
1249
- * 计算多边形的质心坐标
1313
+ * 获取网络状态信息
1250
1314
  *
1251
- * @param coords 多边形顶点坐标数组,支持Coordinate[]或LngLat[]两种格式
1252
- * @returns 返回质心坐标,包含x和y属性
1315
+ * @returns 返回包含网络状态信息的对象,包含以下属性:
1316
+ * - network: 网络类型,可能的值为 'wifi'、'4g' 等
1317
+ * - isOnline: 是否在线,为 true 或 false
1318
+ * - ip: 当前设备的 IP 地址
1253
1319
  */
1254
- static getPolygonCentroid(coords) {
1255
- let xSum = 0, ySum = 0;
1256
- const n = coords.length;
1257
- for (let i = 0, l = coords.length; i < l; i++) {
1258
- const coord = coords[i];
1259
- if ("x" in coord && "y" in coord) {
1260
- xSum += coord.x;
1261
- ySum += coord.y;
1262
- } else if ("lng" in coord && "lat" in coord) {
1263
- xSum += coord.lng;
1264
- ySum += coord.lat;
1320
+ static async getNetwork() {
1321
+ var _a2, _b;
1322
+ let network = "unknown";
1323
+ let connection = (_a2 = this.navigator) == null ? void 0 : _a2.connection;
1324
+ if (connection) {
1325
+ network = connection.type || connection.effectiveType;
1326
+ if (network == "2" || network == "unknown") {
1327
+ network = "wifi";
1265
1328
  }
1266
1329
  }
1330
+ let isOnline = ((_b = this.navigator) == null ? void 0 : _b.onLine) || false;
1331
+ let ip = await this.getIPAddress();
1267
1332
  return {
1268
- x: xSum / n,
1269
- y: ySum / n
1333
+ network,
1334
+ isOnline,
1335
+ ip
1270
1336
  };
1271
1337
  }
1338
+ }
1339
+ __publicField(BrowserUtil, "document", window == null ? void 0 : window.document);
1340
+ __publicField(BrowserUtil, "navigator", window == null ? void 0 : window.navigator);
1341
+ __publicField(BrowserUtil, "userAgent", (_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent);
1342
+ __publicField(BrowserUtil, "screen", window == null ? void 0 : window.screen);
1343
+ class CoordsUtil {
1344
+ static delta(lat, lng) {
1345
+ const a = 6378245;
1346
+ const ee = 0.006693421622965943;
1347
+ let dLat = this.transformLat(lng - 105, lat - 35);
1348
+ let dLon = this.transformLon(lng - 105, lat - 35);
1349
+ const radLat = lat / 180 * this.PI;
1350
+ let magic = Math.sin(radLat);
1351
+ magic = 1 - ee * magic * magic;
1352
+ const sqrtMagic = Math.sqrt(magic);
1353
+ dLat = dLat * 180 / (a * (1 - ee) / (magic * sqrtMagic) * this.PI);
1354
+ dLon = dLon * 180 / (a / sqrtMagic * Math.cos(radLat) * this.PI);
1355
+ return { lat: dLat, lng: dLon };
1356
+ }
1272
1357
  /**
1273
- * 根据百分比获取坐标
1358
+ * 判断经纬度是否不在中国境内
1274
1359
  *
1275
- * @param pA 线段起点,可以是Coordinate类型(包含x,y属性)或LngLat类型(包含lng,lat属性)
1276
- * @param pB 线段终点,可以是Coordinate类型(包含x,y属性)或LngLat类型(包含lng,lat属性)
1277
- * @param ratio 插值比例,0表示在起点pA,1表示在终点pB,0-1之间表示两点间的插值点
1278
- * @returns 返回插值点坐标,类型与输入参数保持一致
1360
+ * @param lng 经度
1361
+ * @param lat 纬度
1362
+ * @returns 如果经纬度不在中国境内则返回true,否则返回false
1279
1363
  */
1280
- static interpolate(pA, pB, ratio) {
1281
- if ("x" in pA && "y" in pA && "x" in pB && "y" in pB) {
1282
- const dx = pB.x - pA.x;
1283
- const dy = pB.y - pA.y;
1284
- return { x: pA.x + dx * ratio, y: pA.y + dy * ratio };
1285
- } else if ("lng" in pA && "lat" in pA && "lng" in pB && "lat" in pB) {
1286
- const dx = pB.lng - pA.lng;
1287
- const dy = pB.lat - pA.lat;
1288
- return { x: pA.lng + dx * ratio, y: pA.lat + dy * ratio };
1364
+ static outOfChina(lng, lat) {
1365
+ if (lng < 72.004 || lng > 137.8347) {
1366
+ return true;
1367
+ }
1368
+ if (lat < 0.8293 || lat > 55.8271) {
1369
+ return true;
1289
1370
  }
1371
+ return false;
1290
1372
  }
1291
- }
1292
- __publicField(GeoUtil, "toRadian", Math.PI / 180);
1293
- __publicField(GeoUtil, "R", 6371393);
1294
- // 地球平均半径
1295
- __publicField(GeoUtil, "R_EQU", 6378137);
1296
- const ColorName = {
1297
- aliceblue: [240, 248, 255],
1298
- antiquewhite: [250, 235, 215],
1299
- aqua: [0, 255, 255],
1300
- aquamarine: [127, 255, 212],
1301
- azure: [240, 255, 255],
1302
- beige: [245, 245, 220],
1303
- bisque: [255, 228, 196],
1304
- black: [0, 0, 0],
1305
- blanchedalmond: [255, 235, 205],
1306
- blue: [0, 0, 255],
1307
- blueviolet: [138, 43, 226],
1308
- brown: [165, 42, 42],
1309
- burlywood: [222, 184, 135],
1310
- cadetblue: [95, 158, 160],
1311
- chartreuse: [127, 255, 0],
1312
- chocolate: [210, 105, 30],
1313
- coral: [255, 127, 80],
1314
- cornflowerblue: [100, 149, 237],
1315
- cornsilk: [255, 248, 220],
1316
- crimson: [220, 20, 60],
1317
- cyan: [0, 255, 255],
1318
- darkblue: [0, 0, 139],
1319
- darkcyan: [0, 139, 139],
1320
- darkgoldenrod: [184, 134, 11],
1321
- darkgray: [169, 169, 169],
1322
- darkgreen: [0, 100, 0],
1323
- darkgrey: [169, 169, 169],
1324
- darkkhaki: [189, 183, 107],
1325
- darkmagenta: [139, 0, 139],
1326
- darkolivegreen: [85, 107, 47],
1327
- darkorange: [255, 140, 0],
1328
- darkorchid: [153, 50, 204],
1329
- darkred: [139, 0, 0],
1330
- darksalmon: [233, 150, 122],
1331
- darkseagreen: [143, 188, 143],
1332
- darkslateblue: [72, 61, 139],
1333
- darkslategray: [47, 79, 79],
1334
- darkslategrey: [47, 79, 79],
1335
- darkturquoise: [0, 206, 209],
1336
- darkviolet: [148, 0, 211],
1337
- deeppink: [255, 20, 147],
1338
- deepskyblue: [0, 191, 255],
1339
- dimgray: [105, 105, 105],
1340
- dimgrey: [105, 105, 105],
1341
- dodgerblue: [30, 144, 255],
1342
- firebrick: [178, 34, 34],
1343
- floralwhite: [255, 250, 240],
1344
- forestgreen: [34, 139, 34],
1345
- fuchsia: [255, 0, 255],
1346
- gainsboro: [220, 220, 220],
1347
- ghostwhite: [248, 248, 255],
1348
- gold: [255, 215, 0],
1349
- goldenrod: [218, 165, 32],
1350
- gray: [128, 128, 128],
1351
- green: [0, 128, 0],
1352
- greenyellow: [173, 255, 47],
1353
- grey: [128, 128, 128],
1354
- honeydew: [240, 255, 240],
1355
- hotpink: [255, 105, 180],
1356
- indianred: [205, 92, 92],
1357
- indigo: [75, 0, 130],
1358
- ivory: [255, 255, 240],
1359
- khaki: [240, 230, 140],
1360
- lavender: [230, 230, 250],
1361
- lavenderblush: [255, 240, 245],
1362
- lawngreen: [124, 252, 0],
1363
- lemonchiffon: [255, 250, 205],
1364
- lightblue: [173, 216, 230],
1365
- lightcoral: [240, 128, 128],
1366
- lightcyan: [224, 255, 255],
1367
- lightgoldenrodyellow: [250, 250, 210],
1368
- lightgray: [211, 211, 211],
1369
- lightgreen: [144, 238, 144],
1370
- lightgrey: [211, 211, 211],
1371
- lightpink: [255, 182, 193],
1372
- lightsalmon: [255, 160, 122],
1373
- lightseagreen: [32, 178, 170],
1374
- lightskyblue: [135, 206, 250],
1375
- lightslategray: [119, 136, 153],
1376
- lightslategrey: [119, 136, 153],
1377
- lightsteelblue: [176, 196, 222],
1378
- lightyellow: [255, 255, 224],
1379
- lime: [0, 255, 0],
1380
- limegreen: [50, 205, 50],
1381
- linen: [250, 240, 230],
1382
- magenta: [255, 0, 255],
1383
- maroon: [128, 0, 0],
1384
- mediumaquamarine: [102, 205, 170],
1385
- mediumblue: [0, 0, 205],
1386
- mediumorchid: [186, 85, 211],
1387
- mediumpurple: [147, 112, 219],
1388
- mediumseagreen: [60, 179, 113],
1389
- mediumslateblue: [123, 104, 238],
1390
- mediumspringgreen: [0, 250, 154],
1391
- mediumturquoise: [72, 209, 204],
1392
- mediumvioletred: [199, 21, 133],
1393
- midnightblue: [25, 25, 112],
1394
- mintcream: [245, 255, 250],
1395
- mistyrose: [255, 228, 225],
1396
- moccasin: [255, 228, 181],
1397
- navajowhite: [255, 222, 173],
1398
- navy: [0, 0, 128],
1399
- oldlace: [253, 245, 230],
1400
- olive: [128, 128, 0],
1401
- olivedrab: [107, 142, 35],
1402
- orange: [255, 165, 0],
1403
- orangered: [255, 69, 0],
1404
- orchid: [218, 112, 214],
1405
- palegoldenrod: [238, 232, 170],
1406
- palegreen: [152, 251, 152],
1407
- paleturquoise: [175, 238, 238],
1408
- palevioletred: [219, 112, 147],
1409
- papayawhip: [255, 239, 213],
1410
- peachpuff: [255, 218, 185],
1411
- peru: [205, 133, 63],
1412
- pink: [255, 192, 203],
1413
- plum: [221, 160, 221],
1414
- powderblue: [176, 224, 230],
1415
- purple: [128, 0, 128],
1416
- rebeccapurple: [102, 51, 153],
1417
- red: [255, 0, 0],
1418
- rosybrown: [188, 143, 143],
1419
- royalblue: [65, 105, 225],
1420
- saddlebrown: [139, 69, 19],
1421
- salmon: [250, 128, 114],
1422
- sandybrown: [244, 164, 96],
1423
- seagreen: [46, 139, 87],
1424
- seashell: [255, 245, 238],
1425
- sienna: [160, 82, 45],
1426
- silver: [192, 192, 192],
1427
- skyblue: [135, 206, 235],
1428
- slateblue: [106, 90, 205],
1429
- slategray: [112, 128, 144],
1430
- slategrey: [112, 128, 144],
1431
- snow: [255, 250, 250],
1432
- springgreen: [0, 255, 127],
1433
- steelblue: [70, 130, 180],
1434
- tan: [210, 180, 140],
1435
- teal: [0, 128, 128],
1436
- thistle: [216, 191, 216],
1437
- tomato: [255, 99, 71],
1438
- turquoise: [64, 224, 208],
1439
- violet: [238, 130, 238],
1440
- wheat: [245, 222, 179],
1441
- white: [255, 255, 255],
1442
- whitesmoke: [245, 245, 245],
1443
- yellow: [255, 255, 0],
1444
- yellowgreen: [154, 205, 50]
1445
- };
1446
- class Color {
1447
- constructor(r, g, b, a) {
1448
- __publicField(this, "_r");
1449
- __publicField(this, "_g");
1450
- __publicField(this, "_b");
1451
- __publicField(this, "_alpha");
1452
- this._validateColorChannel(r);
1453
- this._validateColorChannel(g);
1454
- this._validateColorChannel(b);
1455
- this._r = r;
1456
- this._g = g;
1457
- this._b = b;
1458
- this._alpha = MathUtil.clamp(a ?? 1, 0, 1);
1373
+ // WGS-84 to GCJ-02
1374
+ static gcjEncrypt(wgsLat, wgsLon) {
1375
+ if (this.outOfChina(wgsLat, wgsLon)) {
1376
+ return { lat: wgsLat, lng: wgsLon };
1377
+ }
1378
+ const d = this.delta(wgsLat, wgsLon);
1379
+ return { lat: wgsLat + d.lat, lng: wgsLon + d.lng };
1459
1380
  }
1460
- _validateColorChannel(channel) {
1461
- if (channel < 0 || channel > 255) {
1462
- ExceptionUtil.throwException("Color channel must be between 0 and 255.");
1381
+ // GCJ-02 to WGS-84
1382
+ static gcjDecrypt(gcjLat, gcjLon) {
1383
+ if (this.outOfChina(gcjLat, gcjLon)) {
1384
+ return { lat: gcjLat, lng: gcjLon };
1463
1385
  }
1386
+ const d = this.delta(gcjLat, gcjLon);
1387
+ return { lat: gcjLat - d.lat, lng: gcjLon - d.lng };
1464
1388
  }
1465
- toArray() {
1466
- return [this._r, this._g, this._b, this._alpha];
1389
+ // GCJ-02 to WGS-84 exactly
1390
+ static gcjDecryptExact(gcjLat, gcjLon) {
1391
+ const initDelta = 0.01;
1392
+ const threshold = 1e-9;
1393
+ let dLat = initDelta;
1394
+ let dLon = initDelta;
1395
+ let mLat = gcjLat - dLat;
1396
+ let mLon = gcjLon - dLon;
1397
+ let pLat = gcjLat + dLat;
1398
+ let pLon = gcjLon + dLon;
1399
+ let wgsLat = 0;
1400
+ let wgsLon = 0;
1401
+ let i = 0;
1402
+ while (1) {
1403
+ wgsLat = (mLat + pLat) / 2;
1404
+ wgsLon = (mLon + pLon) / 2;
1405
+ const tmp = this.gcjEncrypt(wgsLat, wgsLon);
1406
+ dLat = tmp.lat - gcjLat;
1407
+ dLon = tmp.lng - gcjLon;
1408
+ if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
1409
+ break;
1410
+ }
1411
+ if (dLat > 0) pLat = wgsLat;
1412
+ else mLat = wgsLat;
1413
+ if (dLon > 0) pLon = wgsLon;
1414
+ else mLon = wgsLon;
1415
+ if (++i > 1e4) break;
1416
+ }
1417
+ return { lat: wgsLat, lng: wgsLon };
1467
1418
  }
1468
- toString() {
1469
- return `rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`;
1419
+ // GCJ-02 to BD-09
1420
+ static bdEncrypt(gcjLat, gcjLon) {
1421
+ const x = gcjLon;
1422
+ const y = gcjLat;
1423
+ const z = Math.sqrt(x * x + y * y) + 2e-5 * Math.sin(y * this.XPI);
1424
+ const theta = Math.atan2(y, x) + 3e-6 * Math.cos(x * this.XPI);
1425
+ const bdLon = z * Math.cos(theta) + 65e-4;
1426
+ const bdLat = z * Math.sin(theta) + 6e-3;
1427
+ return { lat: bdLat, lng: bdLon };
1470
1428
  }
1471
- toJson() {
1472
- return { r: this._r, g: this._g, b: this._b, a: this._alpha };
1429
+ // BD-09 to GCJ-02
1430
+ static bdDecrypt(bdLat, bdLon) {
1431
+ const x = bdLon - 65e-4;
1432
+ const y = bdLat - 6e-3;
1433
+ const z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * this.XPI);
1434
+ const theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * this.XPI);
1435
+ const gcjLon = z * Math.cos(theta);
1436
+ const gcjLat = z * Math.sin(theta);
1437
+ return { lat: gcjLat, lng: gcjLon };
1473
1438
  }
1474
- get rgba() {
1475
- return `rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`;
1439
+ // WGS-84 to Web mercator
1440
+ // mercatorLat -> y mercatorLon -> x
1441
+ static mercatorEncrypt(wgsLat, wgsLon) {
1442
+ const x = wgsLon * 2003750834e-2 / 180;
1443
+ let y = Math.log(Math.tan((90 + wgsLat) * this.PI / 360)) / (this.PI / 180);
1444
+ y = y * 2003750834e-2 / 180;
1445
+ return { lat: y, lng: x };
1476
1446
  }
1477
- get hex() {
1478
- return Color.rgb2hex(this._r, this._g, this._b, this._alpha);
1447
+ // Web mercator to WGS-84
1448
+ // mercatorLat -> y mercatorLon -> x
1449
+ static mercatorDecrypt(mercatorLat, mercatorLon) {
1450
+ const x = mercatorLon / 2003750834e-2 * 180;
1451
+ let y = mercatorLat / 2003750834e-2 * 180;
1452
+ y = 180 / this.PI * (2 * Math.atan(Math.exp(y * this.PI / 180)) - this.PI / 2);
1453
+ return { lat: y, lng: x };
1479
1454
  }
1480
- setAlpha(a) {
1481
- this._alpha = MathUtil.clamp(a ?? 1, 0, 1);
1482
- return this;
1455
+ static transformLat(x, y) {
1456
+ let ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
1457
+ ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
1458
+ ret += (20 * Math.sin(y * this.PI) + 40 * Math.sin(y / 3 * this.PI)) * 2 / 3;
1459
+ ret += (160 * Math.sin(y / 12 * this.PI) + 320 * Math.sin(y * this.PI / 30)) * 2 / 3;
1460
+ return ret;
1483
1461
  }
1484
- // 设置颜色的RGB值
1485
- setRgb(r, g, b) {
1486
- this._validateColorChannel(r);
1487
- this._validateColorChannel(g);
1488
- this._validateColorChannel(b);
1489
- this._r = r;
1490
- this._g = g;
1491
- this._b = b;
1492
- return this;
1462
+ static transformLon(x, y) {
1463
+ let ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
1464
+ ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
1465
+ ret += (20 * Math.sin(x * this.PI) + 40 * Math.sin(x / 3 * this.PI)) * 2 / 3;
1466
+ ret += (150 * Math.sin(x / 12 * this.PI) + 300 * Math.sin(x / 30 * this.PI)) * 2 / 3;
1467
+ return ret;
1493
1468
  }
1494
1469
  /**
1495
- * 从RGBA字符串创建Color对象
1470
+ * 生成一个介于两个坐标之间的随机坐标
1496
1471
  *
1497
- * @param rgbaValue RGBA颜色值字符串,格式为"rgba(r,g,b,a)"或"rgb(r,g,b)"
1498
- * @returns 返回Color对象
1499
- * @throws 如果rgbaValue不是有效的RGBA颜色值,则抛出错误
1472
+ * @param start 起始坐标,包含x和y属性
1473
+ * @param end 结束坐标,包含x和y属性
1474
+ * @returns 返回一个包含x和y属性的随机坐标
1500
1475
  */
1501
- static fromRgba(rgbaValue) {
1502
- const rgbaMatch = rgbaValue.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);
1503
- if (!rgbaMatch) throw new Error("Invalid RGBA color value");
1504
- const r = parseInt(rgbaMatch[1], 10);
1505
- const g = parseInt(rgbaMatch[2], 10);
1506
- const b = parseInt(rgbaMatch[3], 10);
1507
- const a = rgbaMatch[5] ? parseFloat(rgbaMatch[5]) : 1;
1508
- return new Color(r, g, b, a);
1476
+ static random({ x: minX, y: minY }, { x: maxX, y: maxY }) {
1477
+ return {
1478
+ x: Math.random() * (maxX - minX) + minX,
1479
+ y: Math.random() * (maxY - minY) + minY
1480
+ };
1509
1481
  }
1510
1482
  /**
1511
- * 将十六进制颜色值转换为颜色对象
1483
+ * 对坐标数组进行解构并应用函数处理
1512
1484
  *
1513
- * @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
1514
- * @returns 返回颜色对象
1485
+ * @param arr 待解构的数组
1486
+ * @param fn 处理函数
1487
+ * @param context 函数执行上下文,可选
1488
+ * @returns 处理后的数组
1515
1489
  */
1516
- static fromHex(hexValue, a = 1) {
1517
- const rgxShort = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1518
- const hex = hexValue.replace(rgxShort, (m, r2, g2, b2) => r2 + r2 + g2 + g2 + b2 + b2);
1519
- const rgx = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
1520
- const rgb = rgx.exec(hex);
1521
- if (!rgb) {
1522
- throw new Error("Invalid HEX color value");
1490
+ static deCompose(arr, fn, context) {
1491
+ const result = [];
1492
+ if (arr instanceof Array && !(arr[0] instanceof Array)) {
1493
+ fn(arr);
1494
+ } else if (arr instanceof Array && arr[0] instanceof Array) {
1495
+ for (let i = 0; i < arr.length; i++) {
1496
+ const d = arr[i];
1497
+ if (Util.isNil(d)) continue;
1498
+ if (d[0] instanceof Array) {
1499
+ const p = context ? this.deCompose(d, (d2) => fn(d2), context) : this.deCompose(d, (d2) => fn(d2));
1500
+ result.push(p);
1501
+ } else {
1502
+ const p = context ? fn.call(context, d) : fn(d);
1503
+ result.push(p);
1504
+ }
1505
+ }
1523
1506
  }
1524
- const r = parseInt(rgb[1], 16);
1525
- const g = parseInt(rgb[2], 16);
1526
- const b = parseInt(rgb[3], 16);
1527
- return new Color(r, g, b, a);
1507
+ return result;
1508
+ }
1509
+ static coordinate2LngLat(coordinate) {
1510
+ return { lng: coordinate.x, lat: coordinate.y };
1528
1511
  }
1512
+ static lngLat2Coordinate(lngLat) {
1513
+ return { x: lngLat.lng, y: lngLat.lat };
1514
+ }
1515
+ }
1516
+ __publicField(CoordsUtil, "PI", 3.141592653589793);
1517
+ __publicField(CoordsUtil, "XPI", 3.141592653589793 * 3e3 / 180);
1518
+ function trim(str) {
1519
+ return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
1520
+ }
1521
+ function splitWords(str) {
1522
+ return trim(str).split(/\s+/);
1523
+ }
1524
+ const DomUtil = {
1529
1525
  /**
1530
- * 从 HSL 字符串创建颜色对象
1526
+ * 获取元素的样式值
1531
1527
  *
1532
- * @param hsl HSL 字符串,格式为 hsl(h, s%, l%) 或 hsla(h, s%, l%, a)
1533
- * @returns 返回颜色对象,如果 hsl 字符串无效则返回 null
1528
+ * @param el 元素对象
1529
+ * @param style 样式属性名称
1530
+ * @returns 元素的样式值,如果获取不到则返回 null
1534
1531
  */
1535
- static fromHsl(hslValue) {
1536
- const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
1537
- if (!hsl) {
1538
- throw new Error("Invalid HSL color value");
1532
+ getStyle(el, style) {
1533
+ var _a2;
1534
+ let value = el.style[style];
1535
+ if (!value || value === "auto") {
1536
+ const css = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(el, null);
1537
+ value = css ? css[style] : null;
1538
+ if (value === "auto") value = null;
1539
1539
  }
1540
- const h = parseInt(hsl[1], 10) / 360;
1541
- const s = parseInt(hsl[2], 10) / 100;
1542
- const l = parseInt(hsl[3], 10) / 100;
1543
- const a = hsl[4] ? parseFloat(hsl[4]) : 1;
1544
- function hue2rgb(p, q, t) {
1545
- if (t < 0) t += 1;
1546
- if (t > 1) t -= 1;
1547
- if (t < 1 / 6) return p + (q - p) * 6 * t;
1548
- if (t < 1 / 2) return q;
1549
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
1550
- return p;
1540
+ return value;
1541
+ },
1542
+ /**
1543
+ * 创建一个HTML元素
1544
+ *
1545
+ * @param tagName 元素标签名
1546
+ * @param className 元素类名
1547
+ * @param container 父容器,若传入,则新创建的元素会被添加到该容器中
1548
+ * @returns 返回新创建的HTML元素
1549
+ */
1550
+ create(tagName, className, container) {
1551
+ const el = document.createElement(tagName);
1552
+ el.className = className || "";
1553
+ if (container) {
1554
+ container.appendChild(el);
1551
1555
  }
1552
- let r, g, b;
1553
- if (s === 0) {
1554
- r = g = b = l;
1555
- } else {
1556
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
1557
- const p = 2 * l - q;
1558
- r = hue2rgb(p, q, h + 1 / 3);
1559
- g = hue2rgb(p, q, h);
1560
- b = hue2rgb(p, q, h - 1 / 3);
1556
+ return el;
1557
+ },
1558
+ /**
1559
+ * 从父节点中移除指定元素。
1560
+ *
1561
+ * @param el 要移除的元素对象,必须包含parentNode属性。
1562
+ */
1563
+ remove(el) {
1564
+ const parent = el.parentNode;
1565
+ if (parent) {
1566
+ parent.removeChild(el);
1561
1567
  }
1562
- return new Color(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);
1563
- }
1564
- static fromName(str) {
1565
- const rgba = ColorName[str];
1566
- if (!rgba) {
1567
- ExceptionUtil.throwException(`Invalid color name: ${str}`);
1568
+ },
1569
+ /**
1570
+ * 清空给定元素的子节点
1571
+ *
1572
+ * @param el 要清空子节点的元素,包含firstChild和removeChild属性
1573
+ */
1574
+ empty(el) {
1575
+ while (el.firstChild) {
1576
+ el.removeChild(el.firstChild);
1568
1577
  }
1569
- return new Color(rgba[0], rgba[1], rgba[2], rgba.length > 3 ? rgba[3] : 1);
1570
- }
1578
+ },
1571
1579
  /**
1572
- * 从字符串中创建颜色对象
1580
+ * 将元素移到父节点的最前面
1573
1581
  *
1574
- * @param str 字符串类型的颜色值,支持rgba、hex、hsl格式
1575
- * @returns 返回创建的颜色对象
1576
- * @throws 当颜色值无效时,抛出错误
1582
+ * @param el 要移动的元素,需要包含 parentNode 属性
1577
1583
  */
1578
- static from(str) {
1579
- if (this.isRgb(str)) {
1580
- return this.fromRgba(str);
1581
- } else if (this.isHex(str)) {
1582
- return this.fromHex(str);
1583
- } else if (this.isHsl(str)) {
1584
- return this.fromHsl(str);
1585
- } else if (Object.keys(ColorName).map((key) => key.toString()).includes(str)) {
1586
- return this.fromName(str);
1584
+ toFront(el) {
1585
+ const parent = el.parentNode;
1586
+ if (parent && parent.lastChild !== el) {
1587
+ parent.appendChild(el);
1588
+ }
1589
+ },
1590
+ /**
1591
+ * 将元素移动到其父节点的最前面
1592
+ *
1593
+ * @param el 要移动的元素,需要包含parentNode属性
1594
+ */
1595
+ toBack(el) {
1596
+ const parent = el.parentNode;
1597
+ if (parent && parent.firstChild !== el) {
1598
+ parent.insertBefore(el, parent.firstChild);
1599
+ }
1600
+ },
1601
+ /**
1602
+ * 获取元素的类名
1603
+ *
1604
+ * @param el 包含对应元素和类名的对象
1605
+ * @param el.correspondingElement 对应的元素
1606
+ * @param el.className 类名对象
1607
+ * @param el.className.baseVal 类名字符串
1608
+ * @returns 返回元素的类名字符串
1609
+ */
1610
+ getClass(el) {
1611
+ const shadowElement = (el == null ? void 0 : el.host) || el;
1612
+ return shadowElement.className.toString();
1613
+ },
1614
+ /**
1615
+ * 判断元素是否包含指定类名
1616
+ *
1617
+ * @param el 元素对象,包含classList属性,classList属性包含contains方法
1618
+ * @param name 要判断的类名
1619
+ * @returns 返回一个布尔值,表示元素是否包含指定类名
1620
+ */
1621
+ hasClass(el, name) {
1622
+ var _a2;
1623
+ if ((_a2 = el.classList) == null ? void 0 : _a2.contains(name)) {
1624
+ return true;
1625
+ }
1626
+ const className = this.getClass(el);
1627
+ return className.length > 0 && new RegExp(`(^|\\s)${name}(\\s|$)`).test(className);
1628
+ },
1629
+ /**
1630
+ * 给指定的 HTML 元素添加类名
1631
+ *
1632
+ * @param el 要添加类名的 HTML 元素
1633
+ * @param name 要添加的类名,多个类名之间用空格分隔
1634
+ */
1635
+ addClass(el, name) {
1636
+ if (el.classList !== void 0) {
1637
+ const classes = splitWords(name);
1638
+ for (let i = 0, len = classes.length; i < len; i++) {
1639
+ el.classList.add(classes[i]);
1640
+ }
1641
+ } else if (!this.hasClass(el, name)) {
1642
+ const className = this.getClass(el);
1643
+ this.setClass(el, (className ? className + " " : "") + name);
1644
+ }
1645
+ },
1646
+ /**
1647
+ * 从元素中移除指定类名
1648
+ *
1649
+ * @param el 要移除类名的元素
1650
+ * @param name 要移除的类名,多个类名用空格分隔
1651
+ */
1652
+ removeClass(el, name) {
1653
+ if (el.classList !== void 0) {
1654
+ const classes = splitWords(name);
1655
+ classes.forEach((className) => el.classList.remove(className));
1587
1656
  } else {
1588
- return ExceptionUtil.throwException("Invalid color value");
1657
+ this.setClass(el, (" " + this.getClass(el) + " ").replace(" " + name + " ", " ").trim());
1589
1658
  }
1590
- }
1659
+ },
1591
1660
  /**
1592
- * 将RGB颜色值转换为十六进制颜色值
1661
+ * 设置元素的 CSS 类名
1593
1662
  *
1594
- * @param r 红色分量值,取值范围0-255
1595
- * @param g 绿色分量值,取值范围0-255
1596
- * @param b 蓝色分量值,取值范围0-255
1597
- * @param a 可选参数,透明度分量值,取值范围0-1
1598
- * @returns 十六进制颜色值,格式为#RRGGBB或#RRGGBBAA
1663
+ * @param el HTML 或 SVG 元素
1664
+ * @param name 要设置的类名,多个类名之间用空格分隔
1599
1665
  */
1600
- static rgb2hex(r, g, b, a) {
1601
- var hex = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1602
- if (a !== void 0) {
1603
- const alpha = Math.round(a * 255).toString(16).padStart(2, "0");
1604
- return hex + alpha;
1666
+ setClass(el, name) {
1667
+ if ("classList" in el) {
1668
+ el.classList.value = "";
1669
+ name.split(" ").forEach((className) => el.classList.add(className));
1605
1670
  }
1606
- return hex;
1607
- }
1608
- static isHex(a) {
1609
- return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a);
1610
- }
1611
- static isRgb(a) {
1612
- return /^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(a);
1613
- }
1614
- static isHsl(a) {
1615
- return /^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(a);
1616
- }
1617
- static isColor(a) {
1618
- return this.isHex(a) || this.isRgb(a) || this.isHsl(a);
1619
- }
1620
- static random() {
1621
- let r = Math.floor(Math.random() * 256);
1622
- let g = Math.floor(Math.random() * 256);
1623
- let b = Math.floor(Math.random() * 256);
1624
- let a = Math.random();
1625
- return new Color(r, g, b, a);
1671
+ },
1672
+ /**
1673
+ * 从字符串中解析XML文档,并返回根节点
1674
+ *
1675
+ * @param str 要解析的XML字符串
1676
+ * @returns 解析后的XML文档的根节点
1677
+ */
1678
+ parseFromString(str) {
1679
+ const parser = new DOMParser();
1680
+ const doc = parser.parseFromString(str, "text/xml");
1681
+ return doc.children[0];
1626
1682
  }
1627
- }
1683
+ };
1628
1684
  const TYPES = ["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"];
1629
1685
  const GeoJsonUtil = {
1630
1686
  /**
@@ -1867,862 +1923,400 @@ const GeoJsonUtil = {
1867
1923
  };
1868
1924
  }
1869
1925
  };
1870
- const AssertUtil = {
1871
- assertEmpty(...arg) {
1872
- arg.forEach((a) => {
1873
- if (Util.isEmpty(a)) {
1874
- ExceptionUtil.throwEmptyException(a);
1875
- }
1876
- });
1877
- },
1878
- assertInteger(...arg) {
1879
- arg.forEach((a) => {
1880
- if (!Util.isInteger(a)) {
1881
- ExceptionUtil.throwIntegerException(a);
1882
- }
1883
- });
1884
- },
1885
- assertNumber(...arg) {
1886
- arg.forEach((a) => {
1887
- if (!Util.isNumber(a)) {
1888
- ExceptionUtil.throwNumberException(a);
1889
- }
1890
- });
1926
+ const MathUtil = {
1927
+ DEG2RAD: Math.PI / 180,
1928
+ RAD2DEG: 180 / Math.PI,
1929
+ randInt(low, high) {
1930
+ return low + Math.floor(Math.random() * (high - low + 1));
1891
1931
  },
1892
- assertArray(...arg) {
1893
- arg.forEach((a) => {
1894
- if (!Util.isArray(a)) {
1895
- ExceptionUtil.throwArrayException(a);
1896
- }
1897
- });
1932
+ randFloat(low, high) {
1933
+ return low + Math.random() * (high - low);
1898
1934
  },
1899
- assertFunction(...arg) {
1900
- arg.forEach((a) => {
1901
- if (!Util.isFunction(a)) {
1902
- ExceptionUtil.throwFunctionException(a);
1903
- }
1904
- });
1935
+ /**
1936
+ * 角度转弧度
1937
+ *
1938
+ * @param {*} degrees
1939
+ * @returns {*}
1940
+ */
1941
+ deg2Rad(degrees) {
1942
+ return degrees * this.DEG2RAD;
1905
1943
  },
1906
- assertColor(...arg) {
1907
- arg.forEach((a) => {
1908
- if (!Color.isColor(a)) {
1909
- ExceptionUtil.throwColorException(a);
1910
- }
1911
- });
1944
+ /**
1945
+ * 弧度转角度
1946
+ *
1947
+ * @param {*} radians
1948
+ * @returns {*}
1949
+ */
1950
+ rad2Deg(radians) {
1951
+ return radians * this.RAD2DEG;
1912
1952
  },
1913
- assertLnglat(...arg) {
1914
- arg.forEach((a) => {
1915
- if (!GeoUtil.isLnglat(a.lng, a.lat)) {
1916
- ExceptionUtil.throwCoordinateException(JSON.stringify(a));
1917
- }
1918
- });
1953
+ round(value, n = 2) {
1954
+ return Util.isNumber(value) ? Math.round(Number(value) * Math.pow(10, n)) / Math.pow(10, n) : 0;
1919
1955
  },
1920
- assertGeoJson(...arg) {
1921
- arg.forEach((a) => {
1922
- if (!GeoJsonUtil.isGeoJson(a)) {
1923
- ExceptionUtil.throwGeoJsonException(a);
1924
- }
1925
- });
1926
- },
1927
- assertContain(str, ...args) {
1928
- let res = false;
1929
- const len = args.length || 0;
1930
- for (let i = 0, l = len; i < l; i++) {
1931
- res = str.indexOf(args[i]) >= 0;
1932
- }
1933
- if (res) {
1934
- throw Error(ErrorType.STRING_CHECK_LOSS + " -> " + str);
1935
- }
1956
+ /**
1957
+ * 将数值限制在指定范围内
1958
+ *
1959
+ * @param val 需要限制的数值
1960
+ * @param min 最小值
1961
+ * @param max 最大值
1962
+ * @returns 返回限制后的数值
1963
+ */
1964
+ clamp(val, min, max) {
1965
+ return Math.max(min, Math.min(max, val));
1936
1966
  },
1937
- assertStartWith(value, prefix) {
1938
- if (!value.startsWith(prefix)) {
1939
- throw Error("字符串" + value + "开头不是 -> " + prefix);
1967
+ formatLength(length, options = { decimal: 1 }) {
1968
+ const { decimal } = options;
1969
+ if (length >= 1e3) {
1970
+ const km = length / 1e3;
1971
+ return km % 1 === 0 ? `${km.toFixed(0)}km` : `${km.toFixed(decimal).replace(/\.?0+$/, "")}km`;
1972
+ } else {
1973
+ return length % 1 === 0 ? `${length.toFixed(0)}m` : `${length.toFixed(decimal).replace(/\.?0+$/, "")}m`;
1940
1974
  }
1941
1975
  },
1942
- assertEndWith(value, prefix) {
1943
- if (!value.endsWith(prefix)) {
1944
- throw Error("字符串" + value + "结尾不是 -> " + prefix);
1976
+ formatArea(area, options = { decimal: 1 }) {
1977
+ const { decimal } = options;
1978
+ if (area >= 1e6) {
1979
+ const km = area / 1e6;
1980
+ return km % 1 === 0 ? `${area.toFixed(0)}km²` : `${area.toFixed(decimal).replace(/\.?0+$/, "")}km²`;
1981
+ } else {
1982
+ return area % 1 === 0 ? `${area.toFixed(0)}m²` : `${area.toFixed(decimal).replace(/\.?0+$/, "")}m²`;
1945
1983
  }
1946
1984
  }
1947
1985
  };
1948
- const myArray = Object.create(Array);
1949
- myArray.prototype.groupBy = function(f = (d) => d) {
1950
- var groups = {};
1951
- this.forEach(function(o) {
1952
- var group = JSON.stringify(f(o));
1953
- groups[group] = groups[group] || [];
1954
- groups[group].push(o);
1955
- });
1956
- return Object.keys(groups).map((group) => groups[group]);
1957
- };
1958
- myArray.prototype.distinct = function(f = (d) => d) {
1959
- const arr = [];
1960
- const obj = {};
1961
- this.forEach((item) => {
1962
- const val = f(item);
1963
- const key = String(val);
1964
- if (!obj[key]) {
1965
- obj[key] = true;
1966
- arr.push(item);
1967
- }
1968
- });
1969
- return arr;
1970
- };
1971
- myArray.prototype.max = function(f = (d) => d) {
1972
- return this.desc(f)[0];
1973
- };
1974
- myArray.prototype.min = function(f = (d) => d) {
1975
- return this.asc(f)[0];
1976
- };
1977
- myArray.prototype.sum = function(f = (d) => d) {
1978
- return this.length === 1 ? f(this[0]) : this.length > 1 ? this.reduce((prev = 0, curr = 0) => f(prev) + f(curr)) : 0;
1979
- };
1980
- myArray.prototype.avg = function(f = (d) => d) {
1981
- return this.length ? this.sum(f) / this.length : 0;
1982
- };
1983
- myArray.prototype.desc = function(f = (d) => d) {
1984
- return this.sort((n1, n2) => f(n2) - f(n1));
1985
- };
1986
- myArray.prototype.asc = function(f = (d) => d) {
1987
- return this.sort((n1, n2) => f(n1) - f(n2));
1988
- };
1989
- myArray.prototype.random = function() {
1990
- return this[Math.floor(Math.random() * this.length)];
1991
- };
1992
- myArray.prototype.remove = function(f = (d) => d) {
1993
- const i = this.findIndex(f);
1994
- if (i > -1) {
1995
- this.splice(i, 1);
1996
- this.remove(f);
1986
+ class GeoUtil {
1987
+ // 地球赤道半径
1988
+ /**
1989
+ * 判断给定的经纬度是否合法
1990
+ *
1991
+ * @param lng 经度值
1992
+ * @param lat 纬度值
1993
+ * @returns 如果经纬度合法,返回true;否则返回false
1994
+ */
1995
+ static isLnglat(lng, lat) {
1996
+ return Util.isNumber(lng) && Util.isNumber(lat) && !!(+lat >= -90 && +lat <= 90 && +lng >= -180 && +lng <= 180);
1997
1997
  }
1998
- return this;
1999
- };
2000
- const ArrayUtil = {
2001
1998
  /**
2002
- * 创建指定长度的数组,并返回其索引数组
1999
+ * 计算两哥平面坐标点间的距离
2003
2000
  *
2004
- * @param length 数组长度
2005
- * @returns 索引数组
2001
+ * @param p1 坐标点1,包含x和y属性
2002
+ * @param p2 坐标点2,包含x和y属性
2003
+ * @returns 返回两点间的欧几里得距离
2006
2004
  */
2007
- create(length) {
2008
- return [...new Array(length).keys()];
2009
- },
2005
+ static distance(p1, p2) {
2006
+ return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
2007
+ }
2010
2008
  /**
2011
- * 合并多个数组,并去重
2009
+ * 计算两个点之间的距离
2012
2010
  *
2013
- * @param args 需要合并的数组
2014
- * @returns 合并后的去重数组
2011
+ * @param A 点A,包含x和y两个属性
2012
+ * @param B 点B,包含x和y两个属性
2013
+ * @returns 返回两点之间的距离,单位为米
2015
2014
  */
2016
- union(...args) {
2017
- let res = [];
2018
- args.forEach((arg) => {
2019
- if (Array.isArray(arg)) {
2020
- res = res.concat(arg.filter((v) => !res.includes(v)));
2021
- }
2022
- });
2023
- return res;
2024
- },
2015
+ static distanceByPoints(A, B) {
2016
+ const { x: xa, y: ya } = A;
2017
+ const { x: xb, y: yb } = B;
2018
+ const earthR = 6371e3;
2019
+ const x = Math.cos(ya * Math.PI / 180) * Math.cos(yb * Math.PI / 180) * Math.cos((xa - xb) * Math.PI / 180);
2020
+ const y = Math.sin(ya * Math.PI / 180) * Math.sin(yb * Math.PI / 180);
2021
+ let s = x + y;
2022
+ if (s > 1) s = 1;
2023
+ if (s < -1) s = -1;
2024
+ const alpha = Math.acos(s);
2025
+ const distance = alpha * earthR;
2026
+ return distance;
2027
+ }
2025
2028
  /**
2026
- * 求多个数组的交集
2029
+ * 格式化经纬度为度分秒格式
2027
2030
  *
2028
- * @param args 多个需要求交集的数组
2029
- * @returns 返回多个数组的交集数组
2031
+ * @param lng 经度
2032
+ * @param lat 纬度
2033
+ * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
2030
2034
  */
2031
- intersection(...args) {
2032
- let res = args[0] || [];
2033
- args.forEach((arg) => {
2034
- if (Array.isArray(arg)) {
2035
- res = res.filter((v) => arg.includes(v));
2036
- }
2037
- });
2035
+ static formatLnglat(lng, lat) {
2036
+ let res = "";
2037
+ function formatDegreeToDMS(valueInDegrees) {
2038
+ const degree = Math.floor(valueInDegrees);
2039
+ const minutes = Math.floor((valueInDegrees - degree) * 60);
2040
+ const seconds = (valueInDegrees - degree) * 3600 - minutes * 60;
2041
+ return `${degree}°${minutes}′${seconds.toFixed(2)}″`;
2042
+ }
2043
+ if (this.isLnglat(lng, lat)) {
2044
+ res = formatDegreeToDMS(lng) + "," + formatDegreeToDMS(lat);
2045
+ } else if (!isNaN(lng)) {
2046
+ res = formatDegreeToDMS(lng);
2047
+ } else if (!isNaN(lat)) {
2048
+ res = formatDegreeToDMS(lat);
2049
+ }
2038
2050
  return res;
2039
- },
2051
+ }
2040
2052
  /**
2041
- * 将多个数组拼接为一个数组,并去除其中的空值。
2053
+ * 将经纬度字符串转换为度
2042
2054
  *
2043
- * @param args 需要拼接的数组列表。
2044
- * @returns 拼接并去空后的数组。
2055
+ * @param lng 经度字符串
2056
+ * @param lat 纬度字符串
2057
+ * @returns 转换后的经纬度对象
2045
2058
  */
2046
- unionAll(...args) {
2047
- return [...args].flat().filter((d) => !!d);
2048
- },
2059
+ static transformLnglat(lng, lat) {
2060
+ function dms2deg(dmsString) {
2061
+ const isNegative = /[sw]/i.test(dmsString);
2062
+ let factor = isNegative ? -1 : 1;
2063
+ const numericParts = dmsString.match(/[\d.]+/g) || [];
2064
+ let degrees = 0;
2065
+ for (let i = 0; i < numericParts.length; i++) {
2066
+ degrees += parseFloat(numericParts[i]) / factor;
2067
+ factor *= 60;
2068
+ }
2069
+ return degrees;
2070
+ }
2071
+ if (lng && lat) {
2072
+ return {
2073
+ lng: dms2deg(lng),
2074
+ lat: dms2deg(lat)
2075
+ };
2076
+ }
2077
+ }
2049
2078
  /**
2050
- * 求差集
2079
+ * 射线法判断点是否在多边形内
2051
2080
  *
2052
- * @param args 任意个集合
2053
- * @returns 返回差集结果
2081
+ * @param p 点对象,包含x和y属性
2082
+ * @param poly 多边形顶点数组,可以是字符串数组或对象数组
2083
+ * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
2054
2084
  */
2055
- difference(...args) {
2056
- if (args.length === 0) return [];
2057
- return this.union(...args).filter((d) => !this.intersection(...args).includes(d));
2058
- },
2085
+ static rayCasting(p, poly) {
2086
+ var px = p.x, py = p.y, flag = false;
2087
+ for (var i = 0, l = poly.length, j = l - 1; i < l; j = i, i++) {
2088
+ var sx = poly[i].x, sy = poly[i].y, tx = poly[j].x, ty = poly[j].y;
2089
+ if (sx === px && sy === py || tx === px && ty === py) {
2090
+ return "on";
2091
+ }
2092
+ if (sy < py && ty >= py || sy >= py && ty < py) {
2093
+ var x = sx + (py - sy) * (tx - sx) / (ty - sy);
2094
+ if (x === px) {
2095
+ return "on";
2096
+ }
2097
+ if (x > px) {
2098
+ flag = !flag;
2099
+ }
2100
+ }
2101
+ }
2102
+ return flag ? "in" : "out";
2103
+ }
2059
2104
  /**
2060
- * 对字符串数组进行中文排序
2105
+ * 旋转点
2061
2106
  *
2062
- * @param arr 待排序的字符串数组
2063
- * @returns 排序后的字符串数组
2107
+ * @param p1 旋转前点坐标
2108
+ * @param p2 旋转中心坐标
2109
+ * @param θ 旋转角度(顺时针旋转为正)
2110
+ * @returns 旋转后点坐标
2064
2111
  */
2065
- zhSort(arr, f = (d) => d, reverse) {
2066
- arr.sort(function(a, b) {
2067
- return reverse ? f(a).localeCompare(f(b), "zh") : f(b).localeCompare(f(a), "zh");
2068
- });
2069
- return arr;
2112
+ static rotatePoint(p1, p2, θ) {
2113
+ const x = (p1.x - p2.x) * Math.cos(Math.PI / 180 * -θ) - (p1.y - p2.y) * Math.sin(Math.PI / 180 * -θ) + p2.x;
2114
+ const y = (p1.x - p2.x) * Math.sin(Math.PI / 180 * -θ) + (p1.y - p2.y) * Math.cos(Math.PI / 180 * -θ) + p2.y;
2115
+ return { x, y };
2070
2116
  }
2071
- };
2072
- class BrowserUtil {
2073
2117
  /**
2074
- * 获取系统类型
2118
+ * 根据两个平面坐标点计算方位角和距离
2075
2119
  *
2076
- * @returns 返回一个包含系统类型和版本的对象
2120
+ * @param p1 第一个点的坐标对象
2121
+ * @param p2 第二个点的坐标对象
2122
+ * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
2123
+ * 正北为0°,顺时针增加
2077
2124
  */
2078
- static getSystem() {
2079
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
2080
- const userAgent = this.userAgent || ((_a2 = this.navigator) == null ? void 0 : _a2.userAgent);
2081
- let type = "", version = "";
2082
- if (userAgent.includes("Android") || userAgent.includes("Adr")) {
2083
- type = "Android";
2084
- version = ((_b = userAgent.match(/Android ([\d.]+);/)) == null ? void 0 : _b[1]) || "";
2085
- } else if (userAgent.includes("CrOS")) {
2086
- type = "Chromium OS";
2087
- version = ((_c = userAgent.match(/MSIE ([\d.]+)/)) == null ? void 0 : _c[1]) || ((_d = userAgent.match(/rv:([\d.]+)/)) == null ? void 0 : _d[1]) || "";
2088
- } else if (userAgent.includes("Linux") || userAgent.includes("X11")) {
2089
- type = "Linux";
2090
- version = ((_e = userAgent.match(/Linux ([\d.]+)/)) == null ? void 0 : _e[1]) || "";
2091
- } else if (userAgent.includes("Ubuntu")) {
2092
- type = "Ubuntu";
2093
- version = ((_f = userAgent.match(/Ubuntu ([\d.]+)/)) == null ? void 0 : _f[1]) || "";
2094
- } else if (userAgent.includes("Windows")) {
2095
- let v = ((_g = userAgent.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/)) == null ? void 0 : _g[1]) || "";
2096
- let hash = {
2097
- "10.0": "10",
2098
- "6.4": "10 Technical Preview",
2099
- "6.3": "8.1",
2100
- "6.2": "8",
2101
- "6.1": "7",
2102
- "6.0": "Vista",
2103
- "5.2": "XP 64-bit",
2104
- "5.1": "XP",
2105
- "5.01": "2000 SP1",
2106
- "5.0": "2000",
2107
- "4.0": "NT",
2108
- "4.90": "ME"
2109
- };
2110
- type = "Windows";
2111
- version = v in hash ? hash[v] : v;
2112
- } else if (userAgent.includes("like Mac OS X")) {
2113
- type = "IOS";
2114
- version = ((_h = userAgent.match(/OS ([\d_]+) like/)) == null ? void 0 : _h[1].replace(/_/g, ".")) || "";
2115
- } else if (userAgent.includes("Macintosh")) {
2116
- type = "macOS";
2117
- version = ((_i = userAgent.match(/Mac OS X -?([\d_]+)/)) == null ? void 0 : _i[1].replace(/_/g, ".")) || "";
2118
- }
2119
- return { type, version };
2125
+ static calcBearAndDis(p1, p2) {
2126
+ const { x: x1, y: y1 } = p1;
2127
+ const { x: x2, y: y2 } = p2;
2128
+ const dx = x2 - x1;
2129
+ const dy = y2 - y1;
2130
+ const distance = Math.sqrt(dx * dx + dy * dy);
2131
+ const angleInRadians = Math.atan2(dx, dy);
2132
+ const angle = (angleInRadians * (180 / Math.PI) + 360) % 360;
2133
+ return { angle, distance };
2120
2134
  }
2121
2135
  /**
2122
- * 获取浏览器类型信息
2136
+ * 根据两个经纬度点计算方位角和距离
2123
2137
  *
2124
- * @returns 浏览器类型信息,包含浏览器类型和版本号
2138
+ * @param latlng1 第一个经纬度点
2139
+ * @param latlng2 第二个经纬度点
2140
+ * @returns 包含方位角和距离的对象
2125
2141
  */
2126
- static getExplorer() {
2127
- var _a2;
2128
- const userAgent = this.userAgent || ((_a2 = this.navigator) == null ? void 0 : _a2.userAgent);
2129
- let type = "", version = "";
2130
- if (/MSIE|Trident/.test(userAgent)) {
2131
- let matches = /MSIE\s(\d+\.\d+)/.exec(userAgent) || /rv:(\d+\.\d+)/.exec(userAgent);
2132
- if (matches) {
2133
- type = "IE";
2134
- version = matches[1];
2135
- }
2136
- } else if (/Edge/.test(userAgent)) {
2137
- let matches = /Edge\/(\d+\.\d+)/.exec(userAgent);
2138
- if (matches) {
2139
- type = "Edge";
2140
- version = matches[1];
2141
- }
2142
- } else if (/Chrome/.test(userAgent) && /Google Inc/.test(this.navigator.vendor)) {
2143
- let matches = /Chrome\/(\d+\.\d+)/.exec(userAgent);
2144
- if (matches) {
2145
- type = "Chrome";
2146
- version = matches[1];
2147
- }
2148
- } else if (/Firefox/.test(userAgent)) {
2149
- let matches = /Firefox\/(\d+\.\d+)/.exec(userAgent);
2150
- if (matches) {
2151
- type = "Firefox";
2152
- version = matches[1];
2153
- }
2154
- } else if (/Safari/.test(userAgent) && /Apple Computer/.test(this.navigator.vendor)) {
2155
- let matches = /Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(userAgent);
2156
- if (matches) {
2157
- type = "Safari";
2158
- version = matches[1];
2159
- }
2160
- }
2142
+ static calcBearAndDisByPoints(latlng1, latlng2) {
2143
+ var f1 = latlng1.lat * 1, l1 = latlng1.lng * 1, f2 = latlng2.lat * 1, l2 = latlng2.lng * 1;
2144
+ var y = Math.sin((l2 - l1) * this.toRadian) * Math.cos(f2 * this.toRadian);
2145
+ 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);
2146
+ var angle = Math.atan2(y, x) * (180 / Math.PI);
2147
+ var deltaF = (f2 - f1) * this.toRadian;
2148
+ var deltaL = (l2 - l1) * this.toRadian;
2149
+ var a = Math.sin(deltaF / 2) * Math.sin(deltaF / 2) + Math.cos(f1 * this.toRadian) * Math.cos(f2 * this.toRadian) * Math.sin(deltaL / 2) * Math.sin(deltaL / 2);
2150
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
2151
+ var distance = this.R * c;
2161
2152
  return {
2162
- type,
2163
- version
2153
+ angle,
2154
+ distance
2164
2155
  };
2165
2156
  }
2166
2157
  /**
2167
- * 判断当前浏览器是否支持WebGL
2158
+ * 计算点P到线段P1P2的最短距离
2168
2159
  *
2169
- * @returns 如果支持WebGL则返回true,否则返回false
2160
+ * @param p 点P的坐标
2161
+ * @param p1 线段起点P1的坐标
2162
+ * @param p2 线段终点P2的坐标
2163
+ * @returns 点P到线段P1P2的最短距离
2170
2164
  */
2171
- static isSupportWebGL() {
2172
- if (!(this == null ? void 0 : this.document)) {
2173
- return false;
2165
+ static distanceToSegment(p, p1, p2) {
2166
+ const x = p.x, y = p.y, x1 = p1.x, y1 = p1.y, x2 = p2.x, y2 = p2.y;
2167
+ const cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
2168
+ if (cross <= 0) {
2169
+ return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
2174
2170
  }
2175
- const $canvas = this.document.createElement("canvas");
2176
- const gl = $canvas.getContext("webgl") || $canvas.getContext("experimental-webgl");
2177
- return gl && gl instanceof WebGLRenderingContext;
2171
+ const d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
2172
+ if (cross >= d2) {
2173
+ return Math.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));
2174
+ }
2175
+ const r = cross / d2;
2176
+ const px = x1 + (x2 - x1) * r;
2177
+ const py = y1 + (y2 - y1) * r;
2178
+ return Math.sqrt((x - px) * (x - px) + (y - py) * (y - py));
2178
2179
  }
2179
2180
  /**
2180
- * 获取GPU信息
2181
+ * 根据给定的经纬度、角度和距离计算新的经纬度点
2181
2182
  *
2182
- * @returns 返回包含GPU类型和型号的对象
2183
+ * @param latlng 给定的经纬度点,类型为LngLat
2184
+ * @param angle 角度值,单位为度,表示从当前点出发的方向
2185
+ * @param distance 距离值,单位为米,表示从当前点出发的距离
2186
+ * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
2183
2187
  */
2184
- static getGPU() {
2185
- let type = "unknown";
2186
- let model = "unknown";
2187
- if (this == null ? void 0 : this.document) {
2188
- let $canvas = this.document.createElement("canvas");
2189
- let gl = $canvas.getContext("webgl") || $canvas.getContext("experimental-webgl");
2190
- if (gl instanceof WebGLRenderingContext) {
2191
- let debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
2192
- if (debugInfo) {
2193
- let gpu_str = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
2194
- type = (gpu_str.match(/ANGLE \((.+?),/) || [])[1] || "";
2195
- model = (gpu_str.match(/, (.+?) (\(|vs_)/) || [])[1] || "";
2196
- }
2197
- return {
2198
- type,
2199
- model,
2200
- spec: {
2201
- maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),
2202
- // 最大纹理尺寸 16384/4k
2203
- maxRenderBufferSize: gl.getParameter(gl.MAX_RENDERBUFFER_SIZE),
2204
- // 最大渲染缓冲尺寸 16384/4k
2205
- maxTextureUnits: gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
2206
- // 纹理单元数量 32
2207
- }
2208
- };
2209
- }
2210
- }
2188
+ static calcPointByBearAndDis(latlng, angle, distance) {
2189
+ const sLat = MathUtil.deg2Rad(latlng.lat * 1);
2190
+ const sLng = MathUtil.deg2Rad(latlng.lng * 1);
2191
+ const d = distance / this.R;
2192
+ angle = MathUtil.deg2Rad(angle);
2193
+ const lat = Math.asin(Math.sin(sLat) * Math.cos(d) + Math.cos(sLat) * Math.sin(d) * Math.cos(angle));
2194
+ const lon = sLng + Math.atan2(Math.sin(angle) * Math.sin(d) * Math.cos(sLat), Math.cos(d) - Math.sin(sLat) * Math.sin(lat));
2211
2195
  return {
2212
- type,
2213
- model
2196
+ lat: MathUtil.rad2Deg(lat),
2197
+ lng: MathUtil.rad2Deg(lon)
2214
2198
  };
2215
2199
  }
2216
2200
  /**
2217
- * 获取当前浏览器设置的语言
2201
+ * 将墨卡托坐标转换为经纬度坐标
2218
2202
  *
2219
- * @returns 返回浏览器设置的语言,格式为 "语言_地区",例如 "zh_CN"。如果获取失败,则返回 "Unknown"。
2203
+ * @param x 墨卡托坐标的x值
2204
+ * @param y 墨卡托坐标的y值
2205
+ * @returns 返回包含转换后的经度lng和纬度lat的对象
2220
2206
  */
2221
- static getLanguage() {
2222
- var _a2, _b;
2223
- let g = ((_a2 = this.navigator) == null ? void 0 : _a2.language) || ((_b = this.navigator) == null ? void 0 : _b.userLanguage);
2224
- if (typeof g !== "string") return "";
2225
- let arr = g.split("-");
2226
- if (arr[1]) {
2227
- arr[1] = arr[1].toUpperCase();
2228
- }
2229
- let language = arr.join("_");
2230
- return language;
2207
+ static mercatorTolonlat(x, y) {
2208
+ const earthRadius = this.R_EQU;
2209
+ const lng = x / earthRadius * (180 / Math.PI);
2210
+ const lat = Math.atan(Math.exp(y / earthRadius)) * (180 / Math.PI) * 2 - 90;
2211
+ return { lng, lat };
2231
2212
  }
2232
2213
  /**
2233
- * 获取当前环境的时区。
2214
+ * 将经纬度坐标转换为墨卡托坐标
2234
2215
  *
2235
- * @returns 返回当前环境的时区,若获取失败则返回 undefined。
2216
+ * @param lng 经度值
2217
+ * @param lat 纬度值
2218
+ * @returns 墨卡托坐标对象,包含x和y属性
2236
2219
  */
2237
- static getTimeZone() {
2238
- var _a2, _b;
2239
- return (_b = (_a2 = Intl == null ? void 0 : Intl.DateTimeFormat()) == null ? void 0 : _a2.resolvedOptions()) == null ? void 0 : _b.timeZone;
2220
+ static lonlatToMercator(lng, lat) {
2221
+ var earthRad = this.R_EQU;
2222
+ const x = lng * Math.PI / 180 * earthRad;
2223
+ var a = lat * Math.PI / 180;
2224
+ const y = earthRad / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a)));
2225
+ return { x, y };
2240
2226
  }
2241
2227
  /**
2242
- * 获取屏幕帧率
2228
+ * 计算三角形面积
2243
2229
  *
2244
- * @returns 返回一个Promise,resolve为计算得到的屏幕帧率
2245
- * eg: const fps = await BrowserUtil.getScreenFPS()
2230
+ * @param a 第一个点的坐标
2231
+ * @param b 第二个点的坐标
2232
+ * @param c 第三个点的坐标
2233
+ * @returns 返回三角形的面积
2246
2234
  */
2247
- static async getScreenFPS() {
2248
- return new Promise(function(resolve) {
2249
- let lastTime = 0;
2250
- let count = 1;
2251
- let list = [];
2252
- let tick = function(timestamp) {
2253
- if (lastTime > 0) {
2254
- if (count < 12) {
2255
- list.push(timestamp - lastTime);
2256
- lastTime = timestamp;
2257
- count++;
2258
- requestAnimationFrame(tick);
2259
- } else {
2260
- list.sort();
2261
- list = list.slice(1, 11);
2262
- let sum = list.reduce((a, b) => a + b);
2263
- const fps = Math.round(1e4 / sum / 10) * 10;
2264
- resolve(fps);
2265
- }
2266
- } else {
2267
- lastTime = timestamp;
2268
- requestAnimationFrame(tick);
2269
- }
2270
- };
2271
- requestAnimationFrame(tick);
2272
- });
2235
+ static getTraingleArea(a, b, c) {
2236
+ let area = 0;
2237
+ const side = [];
2238
+ side[0] = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2) + Math.pow((a.z || 0) - (b.z || 0), 2));
2239
+ side[1] = Math.sqrt(Math.pow(a.x - c.x, 2) + Math.pow(a.y - c.y, 2) + Math.pow((a.z || 0) - (c.z || 0), 2));
2240
+ side[2] = Math.sqrt(Math.pow(c.x - b.x, 2) + Math.pow(c.y - b.y, 2) + Math.pow((c.z || 0) - (b.z || 0), 2));
2241
+ if (side[0] + side[1] <= side[2] || side[0] + side[2] <= side[1] || side[1] + side[2] <= side[0]) {
2242
+ return area;
2243
+ }
2244
+ const p = (side[0] + side[1] + side[2]) / 2;
2245
+ area = Math.sqrt(p * (p - side[0]) * (p - side[1]) * (p - side[2]));
2246
+ return area;
2273
2247
  }
2274
2248
  /**
2275
- * 获取IP地址
2249
+ * 计算多边形的质心坐标
2276
2250
  *
2277
- * @returns 返回一个Promise,当成功获取到IP地址时resolve,返回IP地址字符串;当获取失败时reject,返回undefined
2251
+ * @param coords 多边形顶点坐标数组,支持Coordinate[]或LngLat[]两种格式
2252
+ * @returns 返回质心坐标,包含x和y属性
2278
2253
  */
2279
- static async getIPAddress() {
2280
- const reg = {
2281
- IPv4: /\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/,
2282
- IPv6: /\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i
2283
- };
2284
- let RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
2285
- const ipSet = /* @__PURE__ */ new Set();
2286
- const onicecandidate = (ice) => {
2287
- var _a2;
2288
- const candidate = (_a2 = ice == null ? void 0 : ice.candidate) == null ? void 0 : _a2.candidate;
2289
- if (candidate) {
2290
- for (const regex of [reg["IPv4"], reg["IPv6"]]) {
2291
- const match = candidate.match(regex);
2292
- if (match) {
2293
- ipSet.add(match[0]);
2294
- }
2295
- }
2254
+ static getPolygonCentroid(coords) {
2255
+ let xSum = 0, ySum = 0;
2256
+ const n = coords.length;
2257
+ for (let i = 0, l = coords.length; i < l; i++) {
2258
+ const coord = coords[i];
2259
+ if ("x" in coord && "y" in coord) {
2260
+ xSum += coord.x;
2261
+ ySum += coord.y;
2262
+ } else if ("lng" in coord && "lat" in coord) {
2263
+ xSum += coord.lng;
2264
+ ySum += coord.lat;
2296
2265
  }
2266
+ }
2267
+ return {
2268
+ x: xSum / n,
2269
+ y: ySum / n
2297
2270
  };
2298
- return new Promise(function(resolve, reject) {
2299
- const conn = new RTCPeerConnection({
2300
- iceServers: [
2301
- {
2302
- urls: "stun:stun.l.google.com:19302"
2303
- },
2304
- {
2305
- urls: "stun:stun.services.mozilla.com"
2306
- }
2307
- ]
2308
- });
2309
- conn.addEventListener("icecandidate", onicecandidate);
2310
- conn.createDataChannel("");
2311
- conn.createOffer().then((offer) => conn.setLocalDescription(offer), reject);
2312
- let count = 20;
2313
- let hander;
2314
- let closeConnect = function() {
2315
- try {
2316
- conn.removeEventListener("icecandidate", onicecandidate);
2317
- conn.close();
2318
- } catch {
2319
- }
2320
- hander && clearInterval(hander);
2321
- };
2322
- hander = window.setInterval(function() {
2323
- let ips = [...ipSet];
2324
- if (ips.length) {
2325
- closeConnect();
2326
- resolve(ips[0]);
2327
- } else if (count) {
2328
- count--;
2329
- } else {
2330
- closeConnect();
2331
- resolve("");
2332
- }
2333
- }, 100);
2334
- });
2335
2271
  }
2336
2272
  /**
2337
- * 获取网络状态信息
2273
+ * 根据百分比获取坐标
2338
2274
  *
2339
- * @returns 返回包含网络状态信息的对象,包含以下属性:
2340
- * - network: 网络类型,可能的值为 'wifi'、'4g' 等
2341
- * - isOnline: 是否在线,为 true 或 false
2342
- * - ip: 当前设备的 IP 地址
2275
+ * @param pA 线段起点,可以是Coordinate类型(包含x,y属性)或LngLat类型(包含lng,lat属性)
2276
+ * @param pB 线段终点,可以是Coordinate类型(包含x,y属性)或LngLat类型(包含lng,lat属性)
2277
+ * @param ratio 插值比例,0表示在起点pA,1表示在终点pB,0-1之间表示两点间的插值点
2278
+ * @returns 返回插值点坐标,类型与输入参数保持一致
2343
2279
  */
2344
- static async getNetwork() {
2345
- var _a2, _b;
2346
- let network = "unknown";
2347
- let connection = (_a2 = this.navigator) == null ? void 0 : _a2.connection;
2348
- if (connection) {
2349
- network = connection.type || connection.effectiveType;
2350
- if (network == "2" || network == "unknown") {
2351
- network = "wifi";
2352
- }
2280
+ static interpolate(pA, pB, ratio) {
2281
+ if ("x" in pA && "y" in pA && "x" in pB && "y" in pB) {
2282
+ const dx = pB.x - pA.x;
2283
+ const dy = pB.y - pA.y;
2284
+ return { x: pA.x + dx * ratio, y: pA.y + dy * ratio };
2285
+ } else if ("lng" in pA && "lat" in pA && "lng" in pB && "lat" in pB) {
2286
+ const dx = pB.lng - pA.lng;
2287
+ const dy = pB.lat - pA.lat;
2288
+ return { x: pA.lng + dx * ratio, y: pA.lat + dy * ratio };
2353
2289
  }
2354
- let isOnline = ((_b = this.navigator) == null ? void 0 : _b.onLine) || false;
2355
- let ip = await this.getIPAddress();
2356
- return {
2357
- network,
2358
- isOnline,
2359
- ip
2360
- };
2361
2290
  }
2362
2291
  }
2363
- __publicField(BrowserUtil, "document", window == null ? void 0 : window.document);
2364
- __publicField(BrowserUtil, "navigator", window == null ? void 0 : window.navigator);
2365
- __publicField(BrowserUtil, "userAgent", (_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent);
2366
- __publicField(BrowserUtil, "screen", window == null ? void 0 : window.screen);
2367
- class CoordsUtil {
2368
- static delta(lat, lng) {
2369
- const a = 6378245;
2370
- const ee = 0.006693421622965943;
2371
- let dLat = this.transformLat(lng - 105, lat - 35);
2372
- let dLon = this.transformLon(lng - 105, lat - 35);
2373
- const radLat = lat / 180 * this.PI;
2374
- let magic = Math.sin(radLat);
2375
- magic = 1 - ee * magic * magic;
2376
- const sqrtMagic = Math.sqrt(magic);
2377
- dLat = dLat * 180 / (a * (1 - ee) / (magic * sqrtMagic) * this.PI);
2378
- dLon = dLon * 180 / (a / sqrtMagic * Math.cos(radLat) * this.PI);
2379
- return { lat: dLat, lng: dLon };
2380
- }
2292
+ __publicField(GeoUtil, "toRadian", Math.PI / 180);
2293
+ __publicField(GeoUtil, "R", 6371393);
2294
+ // 地球平均半径
2295
+ __publicField(GeoUtil, "R_EQU", 6378137);
2296
+ const FileUtil = {
2381
2297
  /**
2382
- * 判断经纬度是否不在中国境内
2298
+ * 将Base64编码的字符串转换为Blob对象
2383
2299
  *
2384
- * @param lng 经度
2385
- * @param lat 纬度
2386
- * @returns 如果经纬度不在中国境内则返回true,否则返回false
2300
+ * @param data Base64编码的字符串
2301
+ * @returns 转换后的Blob对象
2387
2302
  */
2388
- static outOfChina(lng, lat) {
2389
- if (lng < 72.004 || lng > 137.8347) {
2390
- return true;
2391
- }
2392
- if (lat < 0.8293 || lat > 55.8271) {
2393
- return true;
2394
- }
2395
- return false;
2396
- }
2397
- // WGS-84 to GCJ-02
2398
- static gcjEncrypt(wgsLat, wgsLon) {
2399
- if (this.outOfChina(wgsLat, wgsLon)) {
2400
- return { lat: wgsLat, lng: wgsLon };
2401
- }
2402
- const d = this.delta(wgsLat, wgsLon);
2403
- return { lat: wgsLat + d.lat, lng: wgsLon + d.lng };
2404
- }
2405
- // GCJ-02 to WGS-84
2406
- static gcjDecrypt(gcjLat, gcjLon) {
2407
- if (this.outOfChina(gcjLat, gcjLon)) {
2408
- return { lat: gcjLat, lng: gcjLon };
2409
- }
2410
- const d = this.delta(gcjLat, gcjLon);
2411
- return { lat: gcjLat - d.lat, lng: gcjLon - d.lng };
2412
- }
2413
- // GCJ-02 to WGS-84 exactly
2414
- static gcjDecryptExact(gcjLat, gcjLon) {
2415
- const initDelta = 0.01;
2416
- const threshold = 1e-9;
2417
- let dLat = initDelta;
2418
- let dLon = initDelta;
2419
- let mLat = gcjLat - dLat;
2420
- let mLon = gcjLon - dLon;
2421
- let pLat = gcjLat + dLat;
2422
- let pLon = gcjLon + dLon;
2423
- let wgsLat = 0;
2424
- let wgsLon = 0;
2425
- let i = 0;
2426
- while (1) {
2427
- wgsLat = (mLat + pLat) / 2;
2428
- wgsLon = (mLon + pLon) / 2;
2429
- const tmp = this.gcjEncrypt(wgsLat, wgsLon);
2430
- dLat = tmp.lat - gcjLat;
2431
- dLon = tmp.lng - gcjLon;
2432
- if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
2433
- break;
2434
- }
2435
- if (dLat > 0) pLat = wgsLat;
2436
- else mLat = wgsLat;
2437
- if (dLon > 0) pLon = wgsLon;
2438
- else mLon = wgsLon;
2439
- if (++i > 1e4) break;
2303
+ convertBase64ToBlob(data) {
2304
+ const mimeString = data.split(",")[0].split(":")[1].split(";")[0];
2305
+ const byteCharacters = atob(data.split(",")[1]);
2306
+ const byteNumbers = new Array(byteCharacters.length);
2307
+ for (let i = 0; i < byteCharacters.length; i++) {
2308
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
2440
2309
  }
2441
- return { lat: wgsLat, lng: wgsLon };
2442
- }
2443
- // GCJ-02 to BD-09
2444
- static bdEncrypt(gcjLat, gcjLon) {
2445
- const x = gcjLon;
2446
- const y = gcjLat;
2447
- const z = Math.sqrt(x * x + y * y) + 2e-5 * Math.sin(y * this.XPI);
2448
- const theta = Math.atan2(y, x) + 3e-6 * Math.cos(x * this.XPI);
2449
- const bdLon = z * Math.cos(theta) + 65e-4;
2450
- const bdLat = z * Math.sin(theta) + 6e-3;
2451
- return { lat: bdLat, lng: bdLon };
2452
- }
2453
- // BD-09 to GCJ-02
2454
- static bdDecrypt(bdLat, bdLon) {
2455
- const x = bdLon - 65e-4;
2456
- const y = bdLat - 6e-3;
2457
- const z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * this.XPI);
2458
- const theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * this.XPI);
2459
- const gcjLon = z * Math.cos(theta);
2460
- const gcjLat = z * Math.sin(theta);
2461
- return { lat: gcjLat, lng: gcjLon };
2462
- }
2463
- // WGS-84 to Web mercator
2464
- // mercatorLat -> y mercatorLon -> x
2465
- static mercatorEncrypt(wgsLat, wgsLon) {
2466
- const x = wgsLon * 2003750834e-2 / 180;
2467
- let y = Math.log(Math.tan((90 + wgsLat) * this.PI / 360)) / (this.PI / 180);
2468
- y = y * 2003750834e-2 / 180;
2469
- return { lat: y, lng: x };
2470
- }
2471
- // Web mercator to WGS-84
2472
- // mercatorLat -> y mercatorLon -> x
2473
- static mercatorDecrypt(mercatorLat, mercatorLon) {
2474
- const x = mercatorLon / 2003750834e-2 * 180;
2475
- let y = mercatorLat / 2003750834e-2 * 180;
2476
- y = 180 / this.PI * (2 * Math.atan(Math.exp(y * this.PI / 180)) - this.PI / 2);
2477
- return { lat: y, lng: x };
2478
- }
2479
- static transformLat(x, y) {
2480
- let ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
2481
- ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
2482
- ret += (20 * Math.sin(y * this.PI) + 40 * Math.sin(y / 3 * this.PI)) * 2 / 3;
2483
- ret += (160 * Math.sin(y / 12 * this.PI) + 320 * Math.sin(y * this.PI / 30)) * 2 / 3;
2484
- return ret;
2485
- }
2486
- static transformLon(x, y) {
2487
- let ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
2488
- ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
2489
- ret += (20 * Math.sin(x * this.PI) + 40 * Math.sin(x / 3 * this.PI)) * 2 / 3;
2490
- ret += (150 * Math.sin(x / 12 * this.PI) + 300 * Math.sin(x / 30 * this.PI)) * 2 / 3;
2491
- return ret;
2492
- }
2310
+ const byteArray = new Uint8Array(byteNumbers);
2311
+ const blob = new Blob([byteArray], { type: mimeString });
2312
+ return blob;
2313
+ },
2493
2314
  /**
2494
- * 生成一个介于两个坐标之间的随机坐标
2315
+ * 将base64字符串转换为文件对象
2495
2316
  *
2496
- * @param start 起始坐标,包含x和y属性
2497
- * @param end 结束坐标,包含x和y属性
2498
- * @returns 返回一个包含x和y属性的随机坐标
2499
- */
2500
- static random({ x: minX, y: minY }, { x: maxX, y: maxY }) {
2501
- return {
2502
- x: Math.random() * (maxX - minX) + minX,
2503
- y: Math.random() * (maxY - minY) + minY
2504
- };
2505
- }
2506
- /**
2507
- * 对坐标数组进行解构并应用函数处理
2508
- *
2509
- * @param arr 待解构的数组
2510
- * @param fn 处理函数
2511
- * @param context 函数执行上下文,可选
2512
- * @returns 处理后的数组
2513
- */
2514
- static deCompose(arr, fn, context) {
2515
- const result = [];
2516
- if (arr instanceof Array && !(arr[0] instanceof Array)) {
2517
- fn(arr);
2518
- } else if (arr instanceof Array && arr[0] instanceof Array) {
2519
- for (let i = 0; i < arr.length; i++) {
2520
- const d = arr[i];
2521
- if (Util.isNil(d)) continue;
2522
- if (d[0] instanceof Array) {
2523
- const p = context ? this.deCompose(d, (d2) => fn(d2), context) : this.deCompose(d, (d2) => fn(d2));
2524
- result.push(p);
2525
- } else {
2526
- const p = context ? fn.call(context, d) : fn(d);
2527
- result.push(p);
2528
- }
2529
- }
2530
- }
2531
- return result;
2532
- }
2533
- }
2534
- __publicField(CoordsUtil, "PI", 3.141592653589793);
2535
- __publicField(CoordsUtil, "XPI", 3.141592653589793 * 3e3 / 180);
2536
- function trim(str) {
2537
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
2538
- }
2539
- function splitWords(str) {
2540
- return trim(str).split(/\s+/);
2541
- }
2542
- const DomUtil = {
2543
- /**
2544
- * 获取元素的样式值
2545
- *
2546
- * @param el 元素对象
2547
- * @param style 样式属性名称
2548
- * @returns 元素的样式值,如果获取不到则返回 null
2549
- */
2550
- getStyle(el, style) {
2551
- var _a2;
2552
- let value = el.style[style];
2553
- if (!value || value === "auto") {
2554
- const css = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(el, null);
2555
- value = css ? css[style] : null;
2556
- if (value === "auto") value = null;
2557
- }
2558
- return value;
2559
- },
2560
- /**
2561
- * 创建一个HTML元素
2562
- *
2563
- * @param tagName 元素标签名
2564
- * @param className 元素类名
2565
- * @param container 父容器,若传入,则新创建的元素会被添加到该容器中
2566
- * @returns 返回新创建的HTML元素
2567
- */
2568
- create(tagName, className, container) {
2569
- const el = document.createElement(tagName);
2570
- el.className = className || "";
2571
- if (container) {
2572
- container.appendChild(el);
2573
- }
2574
- return el;
2575
- },
2576
- /**
2577
- * 从父节点中移除指定元素。
2578
- *
2579
- * @param el 要移除的元素对象,必须包含parentNode属性。
2580
- */
2581
- remove(el) {
2582
- const parent = el.parentNode;
2583
- if (parent) {
2584
- parent.removeChild(el);
2585
- }
2586
- },
2587
- /**
2588
- * 清空给定元素的子节点
2589
- *
2590
- * @param el 要清空子节点的元素,包含firstChild和removeChild属性
2591
- */
2592
- empty(el) {
2593
- while (el.firstChild) {
2594
- el.removeChild(el.firstChild);
2595
- }
2596
- },
2597
- /**
2598
- * 将元素移到父节点的最前面
2599
- *
2600
- * @param el 要移动的元素,需要包含 parentNode 属性
2601
- */
2602
- toFront(el) {
2603
- const parent = el.parentNode;
2604
- if (parent && parent.lastChild !== el) {
2605
- parent.appendChild(el);
2606
- }
2607
- },
2608
- /**
2609
- * 将元素移动到其父节点的最前面
2610
- *
2611
- * @param el 要移动的元素,需要包含parentNode属性
2612
- */
2613
- toBack(el) {
2614
- const parent = el.parentNode;
2615
- if (parent && parent.firstChild !== el) {
2616
- parent.insertBefore(el, parent.firstChild);
2617
- }
2618
- },
2619
- /**
2620
- * 获取元素的类名
2621
- *
2622
- * @param el 包含对应元素和类名的对象
2623
- * @param el.correspondingElement 对应的元素
2624
- * @param el.className 类名对象
2625
- * @param el.className.baseVal 类名字符串
2626
- * @returns 返回元素的类名字符串
2627
- */
2628
- getClass(el) {
2629
- const shadowElement = (el == null ? void 0 : el.host) || el;
2630
- return shadowElement.className.toString();
2631
- },
2632
- /**
2633
- * 判断元素是否包含指定类名
2634
- *
2635
- * @param el 元素对象,包含classList属性,classList属性包含contains方法
2636
- * @param name 要判断的类名
2637
- * @returns 返回一个布尔值,表示元素是否包含指定类名
2638
- */
2639
- hasClass(el, name) {
2640
- var _a2;
2641
- if ((_a2 = el.classList) == null ? void 0 : _a2.contains(name)) {
2642
- return true;
2643
- }
2644
- const className = this.getClass(el);
2645
- return className.length > 0 && new RegExp(`(^|\\s)${name}(\\s|$)`).test(className);
2646
- },
2647
- /**
2648
- * 给指定的 HTML 元素添加类名
2649
- *
2650
- * @param el 要添加类名的 HTML 元素
2651
- * @param name 要添加的类名,多个类名之间用空格分隔
2652
- */
2653
- addClass(el, name) {
2654
- if (el.classList !== void 0) {
2655
- const classes = splitWords(name);
2656
- for (let i = 0, len = classes.length; i < len; i++) {
2657
- el.classList.add(classes[i]);
2658
- }
2659
- } else if (!this.hasClass(el, name)) {
2660
- const className = this.getClass(el);
2661
- this.setClass(el, (className ? className + " " : "") + name);
2662
- }
2663
- },
2664
- /**
2665
- * 从元素中移除指定类名
2666
- *
2667
- * @param el 要移除类名的元素
2668
- * @param name 要移除的类名,多个类名用空格分隔
2669
- */
2670
- removeClass(el, name) {
2671
- if (el.classList !== void 0) {
2672
- const classes = splitWords(name);
2673
- classes.forEach((className) => el.classList.remove(className));
2674
- } else {
2675
- this.setClass(el, (" " + this.getClass(el) + " ").replace(" " + name + " ", " ").trim());
2676
- }
2677
- },
2678
- /**
2679
- * 设置元素的 CSS 类名
2680
- *
2681
- * @param el HTML 或 SVG 元素
2682
- * @param name 要设置的类名,多个类名之间用空格分隔
2683
- */
2684
- setClass(el, name) {
2685
- if ("classList" in el) {
2686
- el.classList.value = "";
2687
- name.split(" ").forEach((className) => el.classList.add(className));
2688
- }
2689
- },
2690
- /**
2691
- * 从字符串中解析XML文档,并返回根节点
2692
- *
2693
- * @param str 要解析的XML字符串
2694
- * @returns 解析后的XML文档的根节点
2695
- */
2696
- parseFromString(str) {
2697
- const parser = new DOMParser();
2698
- const doc = parser.parseFromString(str, "text/xml");
2699
- return doc.children[0];
2700
- }
2701
- };
2702
- const FileUtil = {
2703
- /**
2704
- * 将Base64编码的字符串转换为Blob对象
2705
- *
2706
- * @param data Base64编码的字符串
2707
- * @returns 转换后的Blob对象
2708
- */
2709
- convertBase64ToBlob(data) {
2710
- const mimeString = data.split(",")[0].split(":")[1].split(";")[0];
2711
- const byteCharacters = atob(data.split(",")[1]);
2712
- const byteNumbers = new Array(byteCharacters.length);
2713
- for (let i = 0; i < byteCharacters.length; i++) {
2714
- byteNumbers[i] = byteCharacters.charCodeAt(i);
2715
- }
2716
- const byteArray = new Uint8Array(byteNumbers);
2717
- const blob = new Blob([byteArray], { type: mimeString });
2718
- return blob;
2719
- },
2720
- /**
2721
- * 将base64字符串转换为文件对象
2722
- *
2723
- * @param dataurl 包含base64字符串的数据URL
2724
- * @param filename 文件的名称
2725
- * @returns 返回文件对象
2317
+ * @param dataurl 包含base64字符串的数据URL
2318
+ * @param filename 文件的名称
2319
+ * @returns 返回文件对象
2726
2320
  */
2727
2321
  convertBase64ToFile(dataurl, filename) {
2728
2322
  const arr = dataurl.split(",");
@@ -2821,10 +2415,6 @@ class MessageUtil {
2821
2415
  static resetWarned() {
2822
2416
  this.warned = {};
2823
2417
  }
2824
- static changeVoice() {
2825
- this.isMute = !!Number(!this.isMute);
2826
- localStorage.setItem("mute", Number(this.isMute).toString());
2827
- }
2828
2418
  static _call(method, message, options) {
2829
2419
  if (!this.warned[message]) {
2830
2420
  method(message, options);
@@ -2840,10 +2430,9 @@ class MessageUtil {
2840
2430
  * @returns 无返回值
2841
2431
  */
2842
2432
  static msg(type, message, options = {}) {
2843
- if (this.isMute) return;
2844
- const typename = Util.decodeDict(type, "success", "恭喜", "error", "发生错误", "warning", "警告", "info", "友情提示") + ":";
2433
+ this.speechSynthesisUtterance.lang = options.lang || this.LANG;
2434
+ const typename = this.speechSynthesisUtterance.lang === "zh-CN" ? Util.decodeDict(type, "success", "恭喜", "error", "发生错误", "warning", "警告", "info", "友情提示") + ":" : Util.decodeDict(type, "success", "congratulation", "error", "Error occurred", "warning", "Warning", "info", "Tips") + ":";
2845
2435
  this.speechSynthesisUtterance.text = typename + message;
2846
- this.speechSynthesisUtterance.lang = options.lang || "zh-CN";
2847
2436
  this.speechSynthesisUtterance.volume = options.volume || 1;
2848
2437
  this.speechSynthesisUtterance.rate = options.rate || 1;
2849
2438
  this.speechSynthesisUtterance.pitch = options.pitch || 1;
@@ -2886,8 +2475,8 @@ class MessageUtil {
2886
2475
  this._call(this.success.bind(this), message, options);
2887
2476
  }
2888
2477
  }
2478
+ __publicField(MessageUtil, "LANG", "zh-CN");
2889
2479
  __publicField(MessageUtil, "warned", {});
2890
- __publicField(MessageUtil, "isMute", !!Number(localStorage.getItem("mute")) || false);
2891
2480
  __publicField(MessageUtil, "speechSynthesis", window.speechSynthesis);
2892
2481
  __publicField(MessageUtil, "speechSynthesisUtterance", new SpeechSynthesisUtterance());
2893
2482
  const OptimizeUtil = {
@@ -3158,155 +2747,487 @@ const TreeUtil = {
3158
2747
  return result;
3159
2748
  },
3160
2749
  /**
3161
- * 将树形结构的数据展平成一维数组
2750
+ * 将树形结构的数据展平成一维数组
2751
+ *
2752
+ * @param data 树形结构的节点数组
2753
+ * @returns 展平后的一维节点数组
2754
+ */
2755
+ flatTree(data) {
2756
+ let result = [];
2757
+ data.forEach((node) => {
2758
+ result.push(node);
2759
+ if (node.children && node.children.length > 0) {
2760
+ result = result.concat(this.flatTree(node.children));
2761
+ }
2762
+ });
2763
+ return result;
2764
+ }
2765
+ };
2766
+ const UrlUtil = {
2767
+ /**
2768
+ * 将json对象转换为查询字符串
2769
+ *
2770
+ * @param json 待转换的json对象
2771
+ * @returns 转换后的查询字符串
2772
+ */
2773
+ json2Query(json) {
2774
+ var tempArr = [];
2775
+ for (var i in json) {
2776
+ if (json.hasOwnProperty(i)) {
2777
+ var key = i;
2778
+ var value = json[i];
2779
+ tempArr.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
2780
+ }
2781
+ }
2782
+ var urlParamsStr = tempArr.join("&");
2783
+ return urlParamsStr;
2784
+ },
2785
+ /**
2786
+ * 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
2787
+ *
2788
+ * @param href 需要解析的 URL 链接,默认为当前窗口的 URL
2789
+ * @param needDecode 是否需要解码参数值,默认为 true
2790
+ * @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
2791
+ */
2792
+ query2Json(href = window.location.href, needDecode = true) {
2793
+ const reg = /([^&=]+)=([\w\W]*?)(&|$|#)/g;
2794
+ const { search, hash } = new URL(href);
2795
+ const args = [search, hash];
2796
+ let obj = {};
2797
+ for (let i = 0; i < args.length; i++) {
2798
+ const str = args[i];
2799
+ if (str) {
2800
+ const s = str.replace(/#|\//g, "");
2801
+ const arr = s.split("?");
2802
+ if (arr.length > 1) {
2803
+ for (let j = 1; j < arr.length; j++) {
2804
+ let res;
2805
+ while (res = reg.exec(arr[j])) {
2806
+ obj[res[1]] = needDecode ? decodeURIComponent(res[2]) : res[2];
2807
+ }
2808
+ }
2809
+ }
2810
+ }
2811
+ }
2812
+ return obj;
2813
+ }
2814
+ };
2815
+ const ValidateUtil = {
2816
+ isUrl(v) {
2817
+ return /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(
2818
+ v
2819
+ );
2820
+ },
2821
+ /**
2822
+ *
2823
+ * @param path 路径字符串
2824
+ * @returns 是否为外链
2825
+ */
2826
+ isExternal(path) {
2827
+ const reg = /^(https?:|mailto:|tel:)/;
2828
+ return reg.test(path);
2829
+ },
2830
+ isPhone(v) {
2831
+ return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(v);
2832
+ },
2833
+ isTel(v) {
2834
+ return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(v);
2835
+ },
2836
+ /**
2837
+ * 判断是否是强密码,至少包含一个大写字母、一个小写字母、一个数字的组合、长度8-20位
2838
+ *
2839
+ * @param v 待检测的密码字符串
2840
+ * @returns 如果是是强密码,则返回 true;否则返回 false
2841
+ */
2842
+ isStrongPwd(v) {
2843
+ return /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/.test(v);
2844
+ },
2845
+ isEmail(v) {
2846
+ return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
2847
+ v
2848
+ );
2849
+ },
2850
+ isIP(v) {
2851
+ return /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(
2852
+ v
2853
+ );
2854
+ },
2855
+ isEnglish(v) {
2856
+ return /^[a-zA-Z]+$/.test(v);
2857
+ },
2858
+ isChinese(v) {
2859
+ return /^[\u4E00-\u9FA5]+$/.test(v);
2860
+ },
2861
+ isHTML(v) {
2862
+ return /<("[^"]*"|'[^']*'|[^'">])*>/.test(v);
2863
+ },
2864
+ isXML(v) {
2865
+ return /^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(v);
2866
+ },
2867
+ isIDCard(v) {
2868
+ return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(v);
2869
+ }
2870
+ };
2871
+ class Cookie {
2872
+ static set(name, value, days) {
2873
+ if (typeof name !== "string" || typeof value !== "string") {
2874
+ ExceptionUtil.throwException("Invalid arguments");
2875
+ }
2876
+ let cookieString = `${name}=${encodeURIComponent(value)}`;
2877
+ if (days !== null && days !== void 0) {
2878
+ const exp = /* @__PURE__ */ new Date();
2879
+ exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1e3);
2880
+ cookieString += `;expires=${exp.toUTCString()}`;
2881
+ }
2882
+ document.cookie = cookieString;
2883
+ }
2884
+ static remove(name) {
2885
+ var exp = /* @__PURE__ */ new Date();
2886
+ exp.setTime(exp.getTime() - 1);
2887
+ var cval = this.get(name);
2888
+ if (cval != null) {
2889
+ document.cookie = name + "=" + cval + ";expires=" + exp.toUTCString();
2890
+ }
2891
+ }
2892
+ static get(name) {
2893
+ var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
2894
+ if (arr != null) {
2895
+ return arr[2];
2896
+ } else {
2897
+ return "";
2898
+ }
2899
+ }
2900
+ }
2901
+ const ColorName = {
2902
+ aliceblue: [240, 248, 255],
2903
+ antiquewhite: [250, 235, 215],
2904
+ aqua: [0, 255, 255],
2905
+ aquamarine: [127, 255, 212],
2906
+ azure: [240, 255, 255],
2907
+ beige: [245, 245, 220],
2908
+ bisque: [255, 228, 196],
2909
+ black: [0, 0, 0],
2910
+ blanchedalmond: [255, 235, 205],
2911
+ blue: [0, 0, 255],
2912
+ blueviolet: [138, 43, 226],
2913
+ brown: [165, 42, 42],
2914
+ burlywood: [222, 184, 135],
2915
+ cadetblue: [95, 158, 160],
2916
+ chartreuse: [127, 255, 0],
2917
+ chocolate: [210, 105, 30],
2918
+ coral: [255, 127, 80],
2919
+ cornflowerblue: [100, 149, 237],
2920
+ cornsilk: [255, 248, 220],
2921
+ crimson: [220, 20, 60],
2922
+ cyan: [0, 255, 255],
2923
+ darkblue: [0, 0, 139],
2924
+ darkcyan: [0, 139, 139],
2925
+ darkgoldenrod: [184, 134, 11],
2926
+ darkgray: [169, 169, 169],
2927
+ darkgreen: [0, 100, 0],
2928
+ darkgrey: [169, 169, 169],
2929
+ darkkhaki: [189, 183, 107],
2930
+ darkmagenta: [139, 0, 139],
2931
+ darkolivegreen: [85, 107, 47],
2932
+ darkorange: [255, 140, 0],
2933
+ darkorchid: [153, 50, 204],
2934
+ darkred: [139, 0, 0],
2935
+ darksalmon: [233, 150, 122],
2936
+ darkseagreen: [143, 188, 143],
2937
+ darkslateblue: [72, 61, 139],
2938
+ darkslategray: [47, 79, 79],
2939
+ darkslategrey: [47, 79, 79],
2940
+ darkturquoise: [0, 206, 209],
2941
+ darkviolet: [148, 0, 211],
2942
+ deeppink: [255, 20, 147],
2943
+ deepskyblue: [0, 191, 255],
2944
+ dimgray: [105, 105, 105],
2945
+ dimgrey: [105, 105, 105],
2946
+ dodgerblue: [30, 144, 255],
2947
+ firebrick: [178, 34, 34],
2948
+ floralwhite: [255, 250, 240],
2949
+ forestgreen: [34, 139, 34],
2950
+ fuchsia: [255, 0, 255],
2951
+ gainsboro: [220, 220, 220],
2952
+ ghostwhite: [248, 248, 255],
2953
+ gold: [255, 215, 0],
2954
+ goldenrod: [218, 165, 32],
2955
+ gray: [128, 128, 128],
2956
+ green: [0, 128, 0],
2957
+ greenyellow: [173, 255, 47],
2958
+ grey: [128, 128, 128],
2959
+ honeydew: [240, 255, 240],
2960
+ hotpink: [255, 105, 180],
2961
+ indianred: [205, 92, 92],
2962
+ indigo: [75, 0, 130],
2963
+ ivory: [255, 255, 240],
2964
+ khaki: [240, 230, 140],
2965
+ lavender: [230, 230, 250],
2966
+ lavenderblush: [255, 240, 245],
2967
+ lawngreen: [124, 252, 0],
2968
+ lemonchiffon: [255, 250, 205],
2969
+ lightblue: [173, 216, 230],
2970
+ lightcoral: [240, 128, 128],
2971
+ lightcyan: [224, 255, 255],
2972
+ lightgoldenrodyellow: [250, 250, 210],
2973
+ lightgray: [211, 211, 211],
2974
+ lightgreen: [144, 238, 144],
2975
+ lightgrey: [211, 211, 211],
2976
+ lightpink: [255, 182, 193],
2977
+ lightsalmon: [255, 160, 122],
2978
+ lightseagreen: [32, 178, 170],
2979
+ lightskyblue: [135, 206, 250],
2980
+ lightslategray: [119, 136, 153],
2981
+ lightslategrey: [119, 136, 153],
2982
+ lightsteelblue: [176, 196, 222],
2983
+ lightyellow: [255, 255, 224],
2984
+ lime: [0, 255, 0],
2985
+ limegreen: [50, 205, 50],
2986
+ linen: [250, 240, 230],
2987
+ magenta: [255, 0, 255],
2988
+ maroon: [128, 0, 0],
2989
+ mediumaquamarine: [102, 205, 170],
2990
+ mediumblue: [0, 0, 205],
2991
+ mediumorchid: [186, 85, 211],
2992
+ mediumpurple: [147, 112, 219],
2993
+ mediumseagreen: [60, 179, 113],
2994
+ mediumslateblue: [123, 104, 238],
2995
+ mediumspringgreen: [0, 250, 154],
2996
+ mediumturquoise: [72, 209, 204],
2997
+ mediumvioletred: [199, 21, 133],
2998
+ midnightblue: [25, 25, 112],
2999
+ mintcream: [245, 255, 250],
3000
+ mistyrose: [255, 228, 225],
3001
+ moccasin: [255, 228, 181],
3002
+ navajowhite: [255, 222, 173],
3003
+ navy: [0, 0, 128],
3004
+ oldlace: [253, 245, 230],
3005
+ olive: [128, 128, 0],
3006
+ olivedrab: [107, 142, 35],
3007
+ orange: [255, 165, 0],
3008
+ orangered: [255, 69, 0],
3009
+ orchid: [218, 112, 214],
3010
+ palegoldenrod: [238, 232, 170],
3011
+ palegreen: [152, 251, 152],
3012
+ paleturquoise: [175, 238, 238],
3013
+ palevioletred: [219, 112, 147],
3014
+ papayawhip: [255, 239, 213],
3015
+ peachpuff: [255, 218, 185],
3016
+ peru: [205, 133, 63],
3017
+ pink: [255, 192, 203],
3018
+ plum: [221, 160, 221],
3019
+ powderblue: [176, 224, 230],
3020
+ purple: [128, 0, 128],
3021
+ rebeccapurple: [102, 51, 153],
3022
+ red: [255, 0, 0],
3023
+ rosybrown: [188, 143, 143],
3024
+ royalblue: [65, 105, 225],
3025
+ saddlebrown: [139, 69, 19],
3026
+ salmon: [250, 128, 114],
3027
+ sandybrown: [244, 164, 96],
3028
+ seagreen: [46, 139, 87],
3029
+ seashell: [255, 245, 238],
3030
+ sienna: [160, 82, 45],
3031
+ silver: [192, 192, 192],
3032
+ skyblue: [135, 206, 235],
3033
+ slateblue: [106, 90, 205],
3034
+ slategray: [112, 128, 144],
3035
+ slategrey: [112, 128, 144],
3036
+ snow: [255, 250, 250],
3037
+ springgreen: [0, 255, 127],
3038
+ steelblue: [70, 130, 180],
3039
+ tan: [210, 180, 140],
3040
+ teal: [0, 128, 128],
3041
+ thistle: [216, 191, 216],
3042
+ tomato: [255, 99, 71],
3043
+ turquoise: [64, 224, 208],
3044
+ violet: [238, 130, 238],
3045
+ wheat: [245, 222, 179],
3046
+ white: [255, 255, 255],
3047
+ whitesmoke: [245, 245, 245],
3048
+ yellow: [255, 255, 0],
3049
+ yellowgreen: [154, 205, 50]
3050
+ };
3051
+ class Color {
3052
+ constructor(r, g, b, a) {
3053
+ __publicField(this, "_r");
3054
+ __publicField(this, "_g");
3055
+ __publicField(this, "_b");
3056
+ __publicField(this, "_alpha");
3057
+ this._validateColorChannel(r);
3058
+ this._validateColorChannel(g);
3059
+ this._validateColorChannel(b);
3060
+ this._r = r;
3061
+ this._g = g;
3062
+ this._b = b;
3063
+ this._alpha = MathUtil.clamp(a ?? 1, 0, 1);
3064
+ }
3065
+ _validateColorChannel(channel) {
3066
+ if (channel < 0 || channel > 255) {
3067
+ ExceptionUtil.throwException("Color channel must be between 0 and 255.");
3068
+ }
3069
+ }
3070
+ toArray() {
3071
+ return [this._r, this._g, this._b, this._alpha];
3072
+ }
3073
+ toString() {
3074
+ return `rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`;
3075
+ }
3076
+ toJson() {
3077
+ return { r: this._r, g: this._g, b: this._b, a: this._alpha };
3078
+ }
3079
+ get rgba() {
3080
+ return `rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`;
3081
+ }
3082
+ get hex() {
3083
+ return Color.rgb2hex(this._r, this._g, this._b, this._alpha);
3084
+ }
3085
+ setAlpha(a) {
3086
+ this._alpha = MathUtil.clamp(a ?? 1, 0, 1);
3087
+ return this;
3088
+ }
3089
+ // 设置颜色的RGB值
3090
+ setRgb(r, g, b) {
3091
+ this._validateColorChannel(r);
3092
+ this._validateColorChannel(g);
3093
+ this._validateColorChannel(b);
3094
+ this._r = r;
3095
+ this._g = g;
3096
+ this._b = b;
3097
+ return this;
3098
+ }
3099
+ /**
3100
+ * 从RGBA字符串创建Color对象
3162
3101
  *
3163
- * @param data 树形结构的节点数组
3164
- * @returns 展平后的一维节点数组
3102
+ * @param rgbaValue RGBA颜色值字符串,格式为"rgba(r,g,b,a)"或"rgb(r,g,b)"
3103
+ * @returns 返回Color对象
3104
+ * @throws 如果rgbaValue不是有效的RGBA颜色值,则抛出错误
3165
3105
  */
3166
- flatTree(data) {
3167
- let result = [];
3168
- data.forEach((node) => {
3169
- result.push(node);
3170
- if (node.children && node.children.length > 0) {
3171
- result = result.concat(this.flatTree(node.children));
3172
- }
3173
- });
3174
- return result;
3106
+ static fromRgba(rgbaValue) {
3107
+ const rgbaMatch = rgbaValue.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);
3108
+ if (!rgbaMatch) throw new Error("Invalid RGBA color value");
3109
+ const r = parseInt(rgbaMatch[1], 10);
3110
+ const g = parseInt(rgbaMatch[2], 10);
3111
+ const b = parseInt(rgbaMatch[3], 10);
3112
+ const a = rgbaMatch[5] ? parseFloat(rgbaMatch[5]) : 1;
3113
+ return new Color(r, g, b, a);
3175
3114
  }
3176
- };
3177
- const UrlUtil = {
3178
3115
  /**
3179
- * 将json对象转换为查询字符串
3116
+ * 将十六进制颜色值转换为颜色对象
3180
3117
  *
3181
- * @param json 待转换的json对象
3182
- * @returns 转换后的查询字符串
3118
+ * @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
3119
+ * @returns 返回颜色对象
3183
3120
  */
3184
- json2Query(json) {
3185
- var tempArr = [];
3186
- for (var i in json) {
3187
- if (json.hasOwnProperty(i)) {
3188
- var key = i;
3189
- var value = json[i];
3190
- tempArr.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
3191
- }
3121
+ static fromHex(hexValue, a = 1) {
3122
+ const rgxShort = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
3123
+ const hex = hexValue.replace(rgxShort, (m, r2, g2, b2) => r2 + r2 + g2 + g2 + b2 + b2);
3124
+ const rgx = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
3125
+ const rgb = rgx.exec(hex);
3126
+ if (!rgb) {
3127
+ throw new Error("Invalid HEX color value");
3192
3128
  }
3193
- var urlParamsStr = tempArr.join("&");
3194
- return urlParamsStr;
3195
- },
3129
+ const r = parseInt(rgb[1], 16);
3130
+ const g = parseInt(rgb[2], 16);
3131
+ const b = parseInt(rgb[3], 16);
3132
+ return new Color(r, g, b, a);
3133
+ }
3196
3134
  /**
3197
- * 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
3135
+ * 从 HSL 字符串创建颜色对象
3198
3136
  *
3199
- * @param href 需要解析的 URL 链接,默认为当前窗口的 URL
3200
- * @param needDecode 是否需要解码参数值,默认为 true
3201
- * @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
3137
+ * @param hsl HSL 字符串,格式为 hsl(h, s%, l%) 或 hsla(h, s%, l%, a)
3138
+ * @returns 返回颜色对象,如果 hsl 字符串无效则返回 null
3202
3139
  */
3203
- query2Json(href = window.location.href, needDecode = true) {
3204
- const reg = /([^&=]+)=([\w\W]*?)(&|$|#)/g;
3205
- const { search, hash } = new URL(href);
3206
- const args = [search, hash];
3207
- let obj = {};
3208
- for (let i = 0; i < args.length; i++) {
3209
- const str = args[i];
3210
- if (str) {
3211
- const s = str.replace(/#|\//g, "");
3212
- const arr = s.split("?");
3213
- if (arr.length > 1) {
3214
- for (let j = 1; j < arr.length; j++) {
3215
- let res;
3216
- while (res = reg.exec(arr[j])) {
3217
- obj[res[1]] = needDecode ? decodeURIComponent(res[2]) : res[2];
3218
- }
3219
- }
3220
- }
3221
- }
3140
+ static fromHsl(hslValue) {
3141
+ const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
3142
+ if (!hsl) {
3143
+ throw new Error("Invalid HSL color value");
3222
3144
  }
3223
- return obj;
3145
+ const h = parseInt(hsl[1], 10) / 360;
3146
+ const s = parseInt(hsl[2], 10) / 100;
3147
+ const l = parseInt(hsl[3], 10) / 100;
3148
+ const a = hsl[4] ? parseFloat(hsl[4]) : 1;
3149
+ function hue2rgb(p, q, t) {
3150
+ if (t < 0) t += 1;
3151
+ if (t > 1) t -= 1;
3152
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
3153
+ if (t < 1 / 2) return q;
3154
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
3155
+ return p;
3156
+ }
3157
+ let r, g, b;
3158
+ if (s === 0) {
3159
+ r = g = b = l;
3160
+ } else {
3161
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
3162
+ const p = 2 * l - q;
3163
+ r = hue2rgb(p, q, h + 1 / 3);
3164
+ g = hue2rgb(p, q, h);
3165
+ b = hue2rgb(p, q, h - 1 / 3);
3166
+ }
3167
+ return new Color(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);
3168
+ }
3169
+ static fromName(str) {
3170
+ const rgba = ColorName[str];
3171
+ if (!rgba) {
3172
+ ExceptionUtil.throwException(`Invalid color name: ${str}`);
3173
+ }
3174
+ return new Color(rgba[0], rgba[1], rgba[2], rgba.length > 3 ? rgba[3] : 1);
3224
3175
  }
3225
- };
3226
- const ValidateUtil = {
3227
- isUrl(v) {
3228
- return /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(
3229
- v
3230
- );
3231
- },
3232
3176
  /**
3177
+ * 从字符串中创建颜色对象
3233
3178
  *
3234
- * @param path 路径字符串
3235
- * @returns 是否为外链
3179
+ * @param str 字符串类型的颜色值,支持rgba、hex、hsl格式
3180
+ * @returns 返回创建的颜色对象
3181
+ * @throws 当颜色值无效时,抛出错误
3236
3182
  */
3237
- isExternal(path) {
3238
- const reg = /^(https?:|mailto:|tel:)/;
3239
- return reg.test(path);
3240
- },
3241
- isPhone(v) {
3242
- return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(v);
3243
- },
3244
- isTel(v) {
3245
- return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(v);
3246
- },
3183
+ static from(str) {
3184
+ if (this.isRgb(str)) {
3185
+ return this.fromRgba(str);
3186
+ } else if (this.isHex(str)) {
3187
+ return this.fromHex(str);
3188
+ } else if (this.isHsl(str)) {
3189
+ return this.fromHsl(str);
3190
+ } else if (Object.keys(ColorName).map((key) => key.toString()).includes(str)) {
3191
+ return this.fromName(str);
3192
+ } else {
3193
+ return ExceptionUtil.throwException("Invalid color value");
3194
+ }
3195
+ }
3247
3196
  /**
3248
- * 判断是否是强密码,至少包含一个大写字母、一个小写字母、一个数字的组合、长度8-20位
3197
+ * 将RGB颜色值转换为十六进制颜色值
3249
3198
  *
3250
- * @param v 待检测的密码字符串
3251
- * @returns 如果是是强密码,则返回 true;否则返回 false
3199
+ * @param r 红色分量值,取值范围0-255
3200
+ * @param g 绿色分量值,取值范围0-255
3201
+ * @param b 蓝色分量值,取值范围0-255
3202
+ * @param a 可选参数,透明度分量值,取值范围0-1
3203
+ * @returns 十六进制颜色值,格式为#RRGGBB或#RRGGBBAA
3252
3204
  */
3253
- isStrongPwd(v) {
3254
- return /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/.test(v);
3255
- },
3256
- isEmail(v) {
3257
- return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
3258
- v
3259
- );
3260
- },
3261
- isIP(v) {
3262
- return /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(
3263
- v
3264
- );
3265
- },
3266
- isEnglish(v) {
3267
- return /^[a-zA-Z]+$/.test(v);
3268
- },
3269
- isChinese(v) {
3270
- return /^[\u4E00-\u9FA5]+$/.test(v);
3271
- },
3272
- isHTML(v) {
3273
- return /<("[^"]*"|'[^']*'|[^'">])*>/.test(v);
3274
- },
3275
- isXML(v) {
3276
- return /^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(v);
3277
- },
3278
- isIDCard(v) {
3279
- return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(v);
3280
- }
3281
- };
3282
- class Cookie {
3283
- static set(name, value, days) {
3284
- if (typeof name !== "string" || typeof value !== "string") {
3285
- ExceptionUtil.throwException("Invalid arguments");
3286
- }
3287
- let cookieString = `${name}=${encodeURIComponent(value)}`;
3288
- if (days !== null && days !== void 0) {
3289
- const exp = /* @__PURE__ */ new Date();
3290
- exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1e3);
3291
- cookieString += `;expires=${exp.toUTCString()}`;
3205
+ static rgb2hex(r, g, b, a) {
3206
+ var hex = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
3207
+ if (a !== void 0) {
3208
+ const alpha = Math.round(a * 255).toString(16).padStart(2, "0");
3209
+ return hex + alpha;
3292
3210
  }
3293
- document.cookie = cookieString;
3211
+ return hex;
3294
3212
  }
3295
- static remove(name) {
3296
- var exp = /* @__PURE__ */ new Date();
3297
- exp.setTime(exp.getTime() - 1);
3298
- var cval = this.get(name);
3299
- if (cval != null) {
3300
- document.cookie = name + "=" + cval + ";expires=" + exp.toUTCString();
3301
- }
3213
+ static isHex(a) {
3214
+ return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a);
3302
3215
  }
3303
- static get(name) {
3304
- var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
3305
- if (arr != null) {
3306
- return arr[2];
3307
- } else {
3308
- return "";
3309
- }
3216
+ static isRgb(a) {
3217
+ return /^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(a);
3218
+ }
3219
+ static isHsl(a) {
3220
+ return /^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(a);
3221
+ }
3222
+ static isColor(a) {
3223
+ return this.isHex(a) || this.isRgb(a) || this.isHsl(a);
3224
+ }
3225
+ static random() {
3226
+ let r = Math.floor(Math.random() * 256);
3227
+ let g = Math.floor(Math.random() * 256);
3228
+ let b = Math.floor(Math.random() * 256);
3229
+ let a = Math.random();
3230
+ return new Color(r, g, b, a);
3310
3231
  }
3311
3232
  }
3312
3233
  class CanvasDrawer {
@@ -3784,7 +3705,7 @@ Object.defineProperties(FullScreen, {
3784
3705
  if (!nativeAPI) {
3785
3706
  FullScreen = { isEnabled: false };
3786
3707
  }
3787
- const FullScreen$1 = FullScreen;
3708
+ const FullScreen_default = FullScreen;
3788
3709
  class HashMap extends Map {
3789
3710
  isEmpty() {
3790
3711
  return this.size === 0;
@@ -3927,7 +3848,7 @@ function commonjsRequire(path) {
3927
3848
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
3928
3849
  }
3929
3850
  var mqtt = { exports: {} };
3930
- (function(module, exports) {
3851
+ (function(module, exports$1) {
3931
3852
  (function(f) {
3932
3853
  {
3933
3854
  module.exports = f();
@@ -3956,10 +3877,10 @@ var mqtt = { exports: {} };
3956
3877
  return o;
3957
3878
  }
3958
3879
  return r;
3959
- }())({ 1: [function(require2, module2, exports2) {
3960
- exports2.byteLength = byteLength;
3961
- exports2.toByteArray = toByteArray;
3962
- exports2.fromByteArray = fromByteArray;
3880
+ }())({ 1: [function(require2, module2, exports$12) {
3881
+ exports$12.byteLength = byteLength;
3882
+ exports$12.toByteArray = toByteArray;
3883
+ exports$12.fromByteArray = fromByteArray;
3963
3884
  var lookup = [];
3964
3885
  var revLookup = [];
3965
3886
  var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
@@ -4049,17 +3970,17 @@ var mqtt = { exports: {} };
4049
3970
  }
4050
3971
  return parts.join("");
4051
3972
  }
4052
- }, {}], 2: [function(require2, module2, exports2) {
4053
- }, {}], 3: [function(require2, module2, exports2) {
3973
+ }, {}], 2: [function(require2, module2, exports$12) {
3974
+ }, {}], 3: [function(require2, module2, exports$12) {
4054
3975
  (function(Buffer2) {
4055
3976
  (function() {
4056
3977
  var base64 = require2("base64-js");
4057
3978
  var ieee754 = require2("ieee754");
4058
- exports2.Buffer = Buffer3;
4059
- exports2.SlowBuffer = SlowBuffer;
4060
- exports2.INSPECT_MAX_BYTES = 50;
3979
+ exports$12.Buffer = Buffer3;
3980
+ exports$12.SlowBuffer = SlowBuffer;
3981
+ exports$12.INSPECT_MAX_BYTES = 50;
4061
3982
  var K_MAX_LENGTH = 2147483647;
4062
- exports2.kMaxLength = K_MAX_LENGTH;
3983
+ exports$12.kMaxLength = K_MAX_LENGTH;
4063
3984
  Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
4064
3985
  if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
4065
3986
  console.error(
@@ -4480,7 +4401,7 @@ var mqtt = { exports: {} };
4480
4401
  };
4481
4402
  Buffer3.prototype.inspect = function inspect() {
4482
4403
  var str = "";
4483
- var max = exports2.INSPECT_MAX_BYTES;
4404
+ var max = exports$12.INSPECT_MAX_BYTES;
4484
4405
  str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
4485
4406
  if (this.length > max) str += " ... ";
4486
4407
  return "<Buffer " + str + ">";
@@ -5402,7 +5323,7 @@ var mqtt = { exports: {} };
5402
5323
  }
5403
5324
  }).call(this);
5404
5325
  }).call(this, require2("buffer").Buffer);
5405
- }, { "base64-js": 1, "buffer": 3, "ieee754": 5 }], 4: [function(require2, module2, exports2) {
5326
+ }, { "base64-js": 1, "buffer": 3, "ieee754": 5 }], 4: [function(require2, module2, exports$12) {
5406
5327
  var R = typeof Reflect === "object" ? Reflect : null;
5407
5328
  var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
5408
5329
  return Function.prototype.apply.call(target, receiver, args);
@@ -5764,9 +5685,9 @@ var mqtt = { exports: {} };
5764
5685
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
5765
5686
  }
5766
5687
  }
5767
- }, {}], 5: [function(require2, module2, exports2) {
5688
+ }, {}], 5: [function(require2, module2, exports$12) {
5768
5689
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
5769
- exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
5690
+ exports$12.read = function(buffer, offset, isLE, mLen, nBytes) {
5770
5691
  var e, m;
5771
5692
  var eLen = nBytes * 8 - mLen - 1;
5772
5693
  var eMax = (1 << eLen) - 1;
@@ -5796,7 +5717,7 @@ var mqtt = { exports: {} };
5796
5717
  }
5797
5718
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
5798
5719
  };
5799
- exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
5720
+ exports$12.write = function(buffer, value, offset, isLE, mLen, nBytes) {
5800
5721
  var e, m, c;
5801
5722
  var eLen = nBytes * 8 - mLen - 1;
5802
5723
  var eMax = (1 << eLen) - 1;
@@ -5843,7 +5764,7 @@ var mqtt = { exports: {} };
5843
5764
  }
5844
5765
  buffer[offset + i - d] |= s * 128;
5845
5766
  };
5846
- }, {}], 6: [function(require2, module2, exports2) {
5767
+ }, {}], 6: [function(require2, module2, exports$12) {
5847
5768
  (function(process2, global2) {
5848
5769
  (function() {
5849
5770
  const EventEmitter = require2("events").EventEmitter;
@@ -7256,7 +7177,7 @@ var mqtt = { exports: {} };
7256
7177
  module2.exports = MqttClient2;
7257
7178
  }).call(this);
7258
7179
  }).call(this, require2("_process"), typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
7259
- }, { "./default-message-id-provider": 12, "./store": 13, "./topic-alias-recv": 14, "./topic-alias-send": 15, "./validations": 16, "_process": 85, "debug": 20, "events": 4, "inherits": 24, "mqtt-packet": 48, "readable-stream": 72, "reinterval": 73, "rfdc/default": 74, "xtend": 82 }], 7: [function(require2, module2, exports2) {
7180
+ }, { "./default-message-id-provider": 12, "./store": 13, "./topic-alias-recv": 14, "./topic-alias-send": 15, "./validations": 16, "_process": 85, "debug": 20, "events": 4, "inherits": 24, "mqtt-packet": 48, "readable-stream": 72, "reinterval": 73, "rfdc/default": 74, "xtend": 82 }], 7: [function(require2, module2, exports$12) {
7260
7181
  const { Buffer: Buffer2 } = require2("buffer");
7261
7182
  const Transform = require2("readable-stream").Transform;
7262
7183
  const duplexify = require2("duplexify");
@@ -7358,7 +7279,7 @@ var mqtt = { exports: {} };
7358
7279
  return stream;
7359
7280
  }
7360
7281
  module2.exports = buildStream;
7361
- }, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 8: [function(require2, module2, exports2) {
7282
+ }, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 8: [function(require2, module2, exports$12) {
7362
7283
  const net = require2("net");
7363
7284
  const debug = require2("debug")("mqttjs:tcp");
7364
7285
  function streamBuilder(client, opts) {
@@ -7370,7 +7291,7 @@ var mqtt = { exports: {} };
7370
7291
  return net.createConnection(port, host);
7371
7292
  }
7372
7293
  module2.exports = streamBuilder;
7373
- }, { "debug": 20, "net": 2 }], 9: [function(require2, module2, exports2) {
7294
+ }, { "debug": 20, "net": 2 }], 9: [function(require2, module2, exports$12) {
7374
7295
  const tls = require2("tls");
7375
7296
  const net = require2("net");
7376
7297
  const debug = require2("debug")("mqttjs:tls");
@@ -7401,7 +7322,7 @@ var mqtt = { exports: {} };
7401
7322
  return connection;
7402
7323
  }
7403
7324
  module2.exports = buildBuilder;
7404
- }, { "debug": 20, "net": 2, "tls": 2 }], 10: [function(require2, module2, exports2) {
7325
+ }, { "debug": 20, "net": 2, "tls": 2 }], 10: [function(require2, module2, exports$12) {
7405
7326
  (function(process2) {
7406
7327
  (function() {
7407
7328
  const { Buffer: Buffer2 } = require2("buffer");
@@ -7602,7 +7523,7 @@ var mqtt = { exports: {} };
7602
7523
  }
7603
7524
  }).call(this);
7604
7525
  }).call(this, require2("_process"));
7605
- }, { "_process": 85, "buffer": 3, "debug": 20, "duplexify": 22, "readable-stream": 72, "ws": 81 }], 11: [function(require2, module2, exports2) {
7526
+ }, { "_process": 85, "buffer": 3, "debug": 20, "duplexify": 22, "readable-stream": 72, "ws": 81 }], 11: [function(require2, module2, exports$12) {
7606
7527
  const { Buffer: Buffer2 } = require2("buffer");
7607
7528
  const Transform = require2("readable-stream").Transform;
7608
7529
  const duplexify = require2("duplexify");
@@ -7708,7 +7629,7 @@ var mqtt = { exports: {} };
7708
7629
  return stream;
7709
7630
  }
7710
7631
  module2.exports = buildStream;
7711
- }, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 12: [function(require2, module2, exports2) {
7632
+ }, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 12: [function(require2, module2, exports$12) {
7712
7633
  function DefaultMessageIdProvider() {
7713
7634
  if (!(this instanceof DefaultMessageIdProvider)) {
7714
7635
  return new DefaultMessageIdProvider();
@@ -7733,7 +7654,7 @@ var mqtt = { exports: {} };
7733
7654
  DefaultMessageIdProvider.prototype.clear = function() {
7734
7655
  };
7735
7656
  module2.exports = DefaultMessageIdProvider;
7736
- }, {}], 13: [function(require2, module2, exports2) {
7657
+ }, {}], 13: [function(require2, module2, exports$12) {
7737
7658
  const xtend = require2("xtend");
7738
7659
  const Readable = require2("readable-stream").Readable;
7739
7660
  const streamsOpts = { objectMode: true };
@@ -7810,7 +7731,7 @@ var mqtt = { exports: {} };
7810
7731
  }
7811
7732
  };
7812
7733
  module2.exports = Store;
7813
- }, { "readable-stream": 72, "xtend": 82 }], 14: [function(require2, module2, exports2) {
7734
+ }, { "readable-stream": 72, "xtend": 82 }], 14: [function(require2, module2, exports$12) {
7814
7735
  function TopicAliasRecv(max) {
7815
7736
  if (!(this instanceof TopicAliasRecv)) {
7816
7737
  return new TopicAliasRecv(max);
@@ -7833,7 +7754,7 @@ var mqtt = { exports: {} };
7833
7754
  this.aliasToTopic = {};
7834
7755
  };
7835
7756
  module2.exports = TopicAliasRecv;
7836
- }, {}], 15: [function(require2, module2, exports2) {
7757
+ }, {}], 15: [function(require2, module2, exports$12) {
7837
7758
  const LruMap = require2("lru-cache");
7838
7759
  const NumberAllocator = require2("number-allocator").NumberAllocator;
7839
7760
  function TopicAliasSend(max) {
@@ -7884,7 +7805,7 @@ var mqtt = { exports: {} };
7884
7805
  return this.aliasToTopic.keys()[this.aliasToTopic.length - 1];
7885
7806
  };
7886
7807
  module2.exports = TopicAliasSend;
7887
- }, { "lru-cache": 45, "number-allocator": 54 }], 16: [function(require2, module2, exports2) {
7808
+ }, { "lru-cache": 45, "number-allocator": 54 }], 16: [function(require2, module2, exports$12) {
7888
7809
  function validateTopic(topic) {
7889
7810
  const parts = topic.split("/");
7890
7811
  for (let i = 0; i < parts.length; i++) {
@@ -7914,7 +7835,7 @@ var mqtt = { exports: {} };
7914
7835
  module2.exports = {
7915
7836
  validateTopics
7916
7837
  };
7917
- }, {}], 17: [function(require2, module2, exports2) {
7838
+ }, {}], 17: [function(require2, module2, exports$12) {
7918
7839
  (function(process2) {
7919
7840
  (function() {
7920
7841
  const MqttClient2 = require2("../client");
@@ -8044,7 +7965,7 @@ var mqtt = { exports: {} };
8044
7965
  module2.exports.Store = Store;
8045
7966
  }).call(this);
8046
7967
  }).call(this, require2("_process"));
8047
- }, { "../client": 6, "../store": 13, "./ali": 7, "./tcp": 8, "./tls": 9, "./ws": 10, "./wx": 11, "_process": 85, "debug": 20, "url": 90, "xtend": 82 }], 18: [function(require2, module2, exports2) {
7968
+ }, { "../client": 6, "../store": 13, "./ali": 7, "./tcp": 8, "./tls": 9, "./ws": 10, "./wx": 11, "_process": 85, "debug": 20, "url": 90, "xtend": 82 }], 18: [function(require2, module2, exports$12) {
8048
7969
  const { Buffer: Buffer2 } = require2("buffer");
8049
7970
  const symbol = Symbol.for("BufferList");
8050
7971
  function BufferList(buf) {
@@ -8340,7 +8261,7 @@ var mqtt = { exports: {} };
8340
8261
  return b != null && b[symbol];
8341
8262
  };
8342
8263
  module2.exports = BufferList;
8343
- }, { "buffer": 3 }], 19: [function(require2, module2, exports2) {
8264
+ }, { "buffer": 3 }], 19: [function(require2, module2, exports$12) {
8344
8265
  const DuplexStream = require2("readable-stream").Duplex;
8345
8266
  const inherits = require2("inherits");
8346
8267
  const BufferList = require2("./BufferList");
@@ -8405,15 +8326,15 @@ var mqtt = { exports: {} };
8405
8326
  module2.exports = BufferListStream;
8406
8327
  module2.exports.BufferListStream = BufferListStream;
8407
8328
  module2.exports.BufferList = BufferList;
8408
- }, { "./BufferList": 18, "inherits": 24, "readable-stream": 72 }], 20: [function(require2, module2, exports2) {
8329
+ }, { "./BufferList": 18, "inherits": 24, "readable-stream": 72 }], 20: [function(require2, module2, exports$12) {
8409
8330
  (function(process2) {
8410
8331
  (function() {
8411
- exports2.formatArgs = formatArgs;
8412
- exports2.save = save;
8413
- exports2.load = load;
8414
- exports2.useColors = useColors;
8415
- exports2.storage = localstorage();
8416
- exports2.destroy = /* @__PURE__ */ (() => {
8332
+ exports$12.formatArgs = formatArgs;
8333
+ exports$12.save = save;
8334
+ exports$12.load = load;
8335
+ exports$12.useColors = useColors;
8336
+ exports$12.storage = localstorage();
8337
+ exports$12.destroy = /* @__PURE__ */ (() => {
8417
8338
  let warned = false;
8418
8339
  return () => {
8419
8340
  if (!warned) {
@@ -8422,7 +8343,7 @@ var mqtt = { exports: {} };
8422
8343
  }
8423
8344
  };
8424
8345
  })();
8425
- exports2.colors = [
8346
+ exports$12.colors = [
8426
8347
  "#0000CC",
8427
8348
  "#0000FF",
8428
8349
  "#0033CC",
@@ -8533,14 +8454,14 @@ var mqtt = { exports: {} };
8533
8454
  });
8534
8455
  args.splice(lastC, 0, c);
8535
8456
  }
8536
- exports2.log = console.debug || console.log || (() => {
8457
+ exports$12.log = console.debug || console.log || (() => {
8537
8458
  });
8538
8459
  function save(namespaces) {
8539
8460
  try {
8540
8461
  if (namespaces) {
8541
- exports2.storage.setItem("debug", namespaces);
8462
+ exports$12.storage.setItem("debug", namespaces);
8542
8463
  } else {
8543
- exports2.storage.removeItem("debug");
8464
+ exports$12.storage.removeItem("debug");
8544
8465
  }
8545
8466
  } catch (error) {
8546
8467
  }
@@ -8548,7 +8469,7 @@ var mqtt = { exports: {} };
8548
8469
  function load() {
8549
8470
  let r;
8550
8471
  try {
8551
- r = exports2.storage.getItem("debug");
8472
+ r = exports$12.storage.getItem("debug");
8552
8473
  } catch (error) {
8553
8474
  }
8554
8475
  if (!r && typeof process2 !== "undefined" && "env" in process2) {
@@ -8562,7 +8483,7 @@ var mqtt = { exports: {} };
8562
8483
  } catch (error) {
8563
8484
  }
8564
8485
  }
8565
- module2.exports = require2("./common")(exports2);
8486
+ module2.exports = require2("./common")(exports$12);
8566
8487
  const { formatters } = module2.exports;
8567
8488
  formatters.j = function(v) {
8568
8489
  try {
@@ -8573,7 +8494,7 @@ var mqtt = { exports: {} };
8573
8494
  };
8574
8495
  }).call(this);
8575
8496
  }).call(this, require2("_process"));
8576
- }, { "./common": 21, "_process": 85 }], 21: [function(require2, module2, exports2) {
8497
+ }, { "./common": 21, "_process": 85 }], 21: [function(require2, module2, exports$12) {
8577
8498
  function setup(env) {
8578
8499
  createDebug.debug = createDebug;
8579
8500
  createDebug.default = createDebug;
@@ -8731,7 +8652,7 @@ var mqtt = { exports: {} };
8731
8652
  return createDebug;
8732
8653
  }
8733
8654
  module2.exports = setup;
8734
- }, { "ms": 53 }], 22: [function(require2, module2, exports2) {
8655
+ }, { "ms": 53 }], 22: [function(require2, module2, exports$12) {
8735
8656
  (function(process2, Buffer2) {
8736
8657
  (function() {
8737
8658
  var stream = require2("readable-stream");
@@ -8923,7 +8844,7 @@ var mqtt = { exports: {} };
8923
8844
  module2.exports = Duplexify;
8924
8845
  }).call(this);
8925
8846
  }).call(this, require2("_process"), require2("buffer").Buffer);
8926
- }, { "_process": 85, "buffer": 3, "end-of-stream": 23, "inherits": 24, "readable-stream": 72, "stream-shift": 77 }], 23: [function(require2, module2, exports2) {
8847
+ }, { "_process": 85, "buffer": 3, "end-of-stream": 23, "inherits": 24, "readable-stream": 72, "stream-shift": 77 }], 23: [function(require2, module2, exports$12) {
8927
8848
  (function(process2) {
8928
8849
  (function() {
8929
8850
  var once = require2("once");
@@ -9004,7 +8925,7 @@ var mqtt = { exports: {} };
9004
8925
  module2.exports = eos;
9005
8926
  }).call(this);
9006
8927
  }).call(this, require2("_process"));
9007
- }, { "_process": 85, "once": 56 }], 24: [function(require2, module2, exports2) {
8928
+ }, { "_process": 85, "once": 56 }], 24: [function(require2, module2, exports$12) {
9008
8929
  if (typeof Object.create === "function") {
9009
8930
  module2.exports = function inherits(ctor, superCtor) {
9010
8931
  if (superCtor) {
@@ -9031,11 +8952,11 @@ var mqtt = { exports: {} };
9031
8952
  }
9032
8953
  };
9033
8954
  }
9034
- }, {}], 25: [function(require2, module2, exports2) {
9035
- Object.defineProperty(exports2, "t", {
8955
+ }, {}], 25: [function(require2, module2, exports$12) {
8956
+ Object.defineProperty(exports$12, "t", {
9036
8957
  value: true
9037
8958
  });
9038
- exports2.ContainerIterator = exports2.Container = exports2.Base = void 0;
8959
+ exports$12.ContainerIterator = exports$12.Container = exports$12.Base = void 0;
9039
8960
  class ContainerIterator {
9040
8961
  constructor(t = 0) {
9041
8962
  this.iteratorType = t;
@@ -9044,7 +8965,7 @@ var mqtt = { exports: {} };
9044
8965
  return this.o === t.o;
9045
8966
  }
9046
8967
  }
9047
- exports2.ContainerIterator = ContainerIterator;
8968
+ exports$12.ContainerIterator = ContainerIterator;
9048
8969
  class Base {
9049
8970
  constructor() {
9050
8971
  this.i = 0;
@@ -9059,15 +8980,15 @@ var mqtt = { exports: {} };
9059
8980
  return this.i === 0;
9060
8981
  }
9061
8982
  }
9062
- exports2.Base = Base;
8983
+ exports$12.Base = Base;
9063
8984
  class Container extends Base {
9064
8985
  }
9065
- exports2.Container = Container;
9066
- }, {}], 26: [function(require2, module2, exports2) {
9067
- Object.defineProperty(exports2, "t", {
8986
+ exports$12.Container = Container;
8987
+ }, {}], 26: [function(require2, module2, exports$12) {
8988
+ Object.defineProperty(exports$12, "t", {
9068
8989
  value: true
9069
8990
  });
9070
- exports2.HashContainerIterator = exports2.HashContainer = void 0;
8991
+ exports$12.HashContainerIterator = exports$12.HashContainer = void 0;
9071
8992
  var _ContainerBase = require2("../../ContainerBase");
9072
8993
  var _checkObject = _interopRequireDefault(require2("../../../utils/checkObject"));
9073
8994
  var _throwError = require2("../../../utils/throwError");
@@ -9114,7 +9035,7 @@ var mqtt = { exports: {} };
9114
9035
  }
9115
9036
  }
9116
9037
  }
9117
- exports2.HashContainerIterator = HashContainerIterator;
9038
+ exports$12.HashContainerIterator = HashContainerIterator;
9118
9039
  class HashContainer extends _ContainerBase.Container {
9119
9040
  constructor() {
9120
9041
  super();
@@ -9239,12 +9160,12 @@ var mqtt = { exports: {} };
9239
9160
  return this.i;
9240
9161
  }
9241
9162
  }
9242
- exports2.HashContainer = HashContainer;
9243
- }, { "../../../utils/checkObject": 43, "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 27: [function(require2, module2, exports2) {
9244
- Object.defineProperty(exports2, "t", {
9163
+ exports$12.HashContainer = HashContainer;
9164
+ }, { "../../../utils/checkObject": 43, "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 27: [function(require2, module2, exports$12) {
9165
+ Object.defineProperty(exports$12, "t", {
9245
9166
  value: true
9246
9167
  });
9247
- exports2.default = void 0;
9168
+ exports$12.default = void 0;
9248
9169
  var _Base = require2("./Base");
9249
9170
  var _checkObject = _interopRequireDefault(require2("../../utils/checkObject"));
9250
9171
  var _throwError = require2("../../utils/throwError");
@@ -9354,12 +9275,12 @@ var mqtt = { exports: {} };
9354
9275
  }
9355
9276
  }
9356
9277
  var _default = HashMap2;
9357
- exports2.default = _default;
9358
- }, { "../../utils/checkObject": 43, "../../utils/throwError": 44, "./Base": 26 }], 28: [function(require2, module2, exports2) {
9359
- Object.defineProperty(exports2, "t", {
9278
+ exports$12.default = _default;
9279
+ }, { "../../utils/checkObject": 43, "../../utils/throwError": 44, "./Base": 26 }], 28: [function(require2, module2, exports$12) {
9280
+ Object.defineProperty(exports$12, "t", {
9360
9281
  value: true
9361
9282
  });
9362
- exports2.default = void 0;
9283
+ exports$12.default = void 0;
9363
9284
  var _Base = require2("./Base");
9364
9285
  var _throwError = require2("../../utils/throwError");
9365
9286
  class HashSetIterator extends _Base.HashContainerIterator {
@@ -9439,12 +9360,12 @@ var mqtt = { exports: {} };
9439
9360
  }
9440
9361
  }
9441
9362
  var _default = HashSet;
9442
- exports2.default = _default;
9443
- }, { "../../utils/throwError": 44, "./Base": 26 }], 29: [function(require2, module2, exports2) {
9444
- Object.defineProperty(exports2, "t", {
9363
+ exports$12.default = _default;
9364
+ }, { "../../utils/throwError": 44, "./Base": 26 }], 29: [function(require2, module2, exports$12) {
9365
+ Object.defineProperty(exports$12, "t", {
9445
9366
  value: true
9446
9367
  });
9447
- exports2.default = void 0;
9368
+ exports$12.default = void 0;
9448
9369
  var _ContainerBase = require2("../ContainerBase");
9449
9370
  class PriorityQueue extends _ContainerBase.Base {
9450
9371
  constructor(t = [], s = function(t2, s2) {
@@ -9550,12 +9471,12 @@ var mqtt = { exports: {} };
9550
9471
  }
9551
9472
  }
9552
9473
  var _default = PriorityQueue;
9553
- exports2.default = _default;
9554
- }, { "../ContainerBase": 25 }], 30: [function(require2, module2, exports2) {
9555
- Object.defineProperty(exports2, "t", {
9474
+ exports$12.default = _default;
9475
+ }, { "../ContainerBase": 25 }], 30: [function(require2, module2, exports$12) {
9476
+ Object.defineProperty(exports$12, "t", {
9556
9477
  value: true
9557
9478
  });
9558
- exports2.default = void 0;
9479
+ exports$12.default = void 0;
9559
9480
  var _ContainerBase = require2("../ContainerBase");
9560
9481
  class Queue extends _ContainerBase.Base {
9561
9482
  constructor(t = []) {
@@ -9595,12 +9516,12 @@ var mqtt = { exports: {} };
9595
9516
  }
9596
9517
  }
9597
9518
  var _default = Queue;
9598
- exports2.default = _default;
9599
- }, { "../ContainerBase": 25 }], 31: [function(require2, module2, exports2) {
9600
- Object.defineProperty(exports2, "t", {
9519
+ exports$12.default = _default;
9520
+ }, { "../ContainerBase": 25 }], 31: [function(require2, module2, exports$12) {
9521
+ Object.defineProperty(exports$12, "t", {
9601
9522
  value: true
9602
9523
  });
9603
- exports2.default = void 0;
9524
+ exports$12.default = void 0;
9604
9525
  var _ContainerBase = require2("../ContainerBase");
9605
9526
  class Stack extends _ContainerBase.Base {
9606
9527
  constructor(t = []) {
@@ -9630,12 +9551,12 @@ var mqtt = { exports: {} };
9630
9551
  }
9631
9552
  }
9632
9553
  var _default = Stack;
9633
- exports2.default = _default;
9634
- }, { "../ContainerBase": 25 }], 32: [function(require2, module2, exports2) {
9635
- Object.defineProperty(exports2, "t", {
9554
+ exports$12.default = _default;
9555
+ }, { "../ContainerBase": 25 }], 32: [function(require2, module2, exports$12) {
9556
+ Object.defineProperty(exports$12, "t", {
9636
9557
  value: true
9637
9558
  });
9638
- exports2.RandomIterator = void 0;
9559
+ exports$12.RandomIterator = void 0;
9639
9560
  var _ContainerBase = require2("../../ContainerBase");
9640
9561
  var _throwError = require2("../../../utils/throwError");
9641
9562
  class RandomIterator extends _ContainerBase.ContainerIterator {
@@ -9681,22 +9602,22 @@ var mqtt = { exports: {} };
9681
9602
  this.container.setElementByPos(this.o, t);
9682
9603
  }
9683
9604
  }
9684
- exports2.RandomIterator = RandomIterator;
9685
- }, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 33: [function(require2, module2, exports2) {
9686
- Object.defineProperty(exports2, "t", {
9605
+ exports$12.RandomIterator = RandomIterator;
9606
+ }, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 33: [function(require2, module2, exports$12) {
9607
+ Object.defineProperty(exports$12, "t", {
9687
9608
  value: true
9688
9609
  });
9689
- exports2.default = void 0;
9610
+ exports$12.default = void 0;
9690
9611
  var _ContainerBase = require2("../../ContainerBase");
9691
9612
  class SequentialContainer extends _ContainerBase.Container {
9692
9613
  }
9693
9614
  var _default = SequentialContainer;
9694
- exports2.default = _default;
9695
- }, { "../../ContainerBase": 25 }], 34: [function(require2, module2, exports2) {
9696
- Object.defineProperty(exports2, "t", {
9615
+ exports$12.default = _default;
9616
+ }, { "../../ContainerBase": 25 }], 34: [function(require2, module2, exports$12) {
9617
+ Object.defineProperty(exports$12, "t", {
9697
9618
  value: true
9698
9619
  });
9699
- exports2.default = void 0;
9620
+ exports$12.default = void 0;
9700
9621
  var _Base = _interopRequireDefault(require2("./Base"));
9701
9622
  var _RandomIterator = require2("./Base/RandomIterator");
9702
9623
  function _interopRequireDefault(t) {
@@ -10021,12 +9942,12 @@ var mqtt = { exports: {} };
10021
9942
  }
10022
9943
  }
10023
9944
  var _default = Deque;
10024
- exports2.default = _default;
10025
- }, { "./Base": 33, "./Base/RandomIterator": 32 }], 35: [function(require2, module2, exports2) {
10026
- Object.defineProperty(exports2, "t", {
9945
+ exports$12.default = _default;
9946
+ }, { "./Base": 33, "./Base/RandomIterator": 32 }], 35: [function(require2, module2, exports$12) {
9947
+ Object.defineProperty(exports$12, "t", {
10027
9948
  value: true
10028
9949
  });
10029
- exports2.default = void 0;
9950
+ exports$12.default = void 0;
10030
9951
  var _Base = _interopRequireDefault(require2("./Base"));
10031
9952
  var _ContainerBase = require2("../ContainerBase");
10032
9953
  var _throwError = require2("../../utils/throwError");
@@ -10340,12 +10261,12 @@ var mqtt = { exports: {} };
10340
10261
  }
10341
10262
  }
10342
10263
  var _default = LinkList;
10343
- exports2.default = _default;
10344
- }, { "../../utils/throwError": 44, "../ContainerBase": 25, "./Base": 33 }], 36: [function(require2, module2, exports2) {
10345
- Object.defineProperty(exports2, "t", {
10264
+ exports$12.default = _default;
10265
+ }, { "../../utils/throwError": 44, "../ContainerBase": 25, "./Base": 33 }], 36: [function(require2, module2, exports$12) {
10266
+ Object.defineProperty(exports$12, "t", {
10346
10267
  value: true
10347
10268
  });
10348
- exports2.default = void 0;
10269
+ exports$12.default = void 0;
10349
10270
  var _Base = _interopRequireDefault(require2("./Base"));
10350
10271
  var _RandomIterator = require2("./Base/RandomIterator");
10351
10272
  function _interopRequireDefault(t) {
@@ -10488,12 +10409,12 @@ var mqtt = { exports: {} };
10488
10409
  }
10489
10410
  }
10490
10411
  var _default = Vector;
10491
- exports2.default = _default;
10492
- }, { "./Base": 33, "./Base/RandomIterator": 32 }], 37: [function(require2, module2, exports2) {
10493
- Object.defineProperty(exports2, "t", {
10412
+ exports$12.default = _default;
10413
+ }, { "./Base": 33, "./Base/RandomIterator": 32 }], 37: [function(require2, module2, exports$12) {
10414
+ Object.defineProperty(exports$12, "t", {
10494
10415
  value: true
10495
10416
  });
10496
- exports2.default = void 0;
10417
+ exports$12.default = void 0;
10497
10418
  var _ContainerBase = require2("../../ContainerBase");
10498
10419
  var _throwError = require2("../../../utils/throwError");
10499
10420
  class TreeIterator extends _ContainerBase.ContainerIterator {
@@ -10560,12 +10481,12 @@ var mqtt = { exports: {} };
10560
10481
  }
10561
10482
  }
10562
10483
  var _default = TreeIterator;
10563
- exports2.default = _default;
10564
- }, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 38: [function(require2, module2, exports2) {
10565
- Object.defineProperty(exports2, "t", {
10484
+ exports$12.default = _default;
10485
+ }, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 38: [function(require2, module2, exports$12) {
10486
+ Object.defineProperty(exports$12, "t", {
10566
10487
  value: true
10567
10488
  });
10568
- exports2.TreeNodeEnableIndex = exports2.TreeNode = void 0;
10489
+ exports$12.TreeNodeEnableIndex = exports$12.TreeNode = void 0;
10569
10490
  class TreeNode {
10570
10491
  constructor(e, t) {
10571
10492
  this.ee = 1;
@@ -10644,7 +10565,7 @@ var mqtt = { exports: {} };
10644
10565
  return t;
10645
10566
  }
10646
10567
  }
10647
- exports2.TreeNode = TreeNode;
10568
+ exports$12.TreeNode = TreeNode;
10648
10569
  class TreeNodeEnableIndex extends TreeNode {
10649
10570
  constructor() {
10650
10571
  super(...arguments);
@@ -10672,12 +10593,12 @@ var mqtt = { exports: {} };
10672
10593
  }
10673
10594
  }
10674
10595
  }
10675
- exports2.TreeNodeEnableIndex = TreeNodeEnableIndex;
10676
- }, {}], 39: [function(require2, module2, exports2) {
10677
- Object.defineProperty(exports2, "t", {
10596
+ exports$12.TreeNodeEnableIndex = TreeNodeEnableIndex;
10597
+ }, {}], 39: [function(require2, module2, exports$12) {
10598
+ Object.defineProperty(exports$12, "t", {
10678
10599
  value: true
10679
10600
  });
10680
- exports2.default = void 0;
10601
+ exports$12.default = void 0;
10681
10602
  var _TreeNode = require2("./TreeNode");
10682
10603
  var _ContainerBase = require2("../../ContainerBase");
10683
10604
  var _throwError = require2("../../../utils/throwError");
@@ -11177,12 +11098,12 @@ var mqtt = { exports: {} };
11177
11098
  }
11178
11099
  }
11179
11100
  var _default = TreeContainer;
11180
- exports2.default = _default;
11181
- }, { "../../../utils/throwError": 44, "../../ContainerBase": 25, "./TreeNode": 38 }], 40: [function(require2, module2, exports2) {
11182
- Object.defineProperty(exports2, "t", {
11101
+ exports$12.default = _default;
11102
+ }, { "../../../utils/throwError": 44, "../../ContainerBase": 25, "./TreeNode": 38 }], 40: [function(require2, module2, exports$12) {
11103
+ Object.defineProperty(exports$12, "t", {
11183
11104
  value: true
11184
11105
  });
11185
- exports2.default = void 0;
11106
+ exports$12.default = void 0;
11186
11107
  var _Base = _interopRequireDefault(require2("./Base"));
11187
11108
  var _TreeIterator = _interopRequireDefault(require2("./Base/TreeIterator"));
11188
11109
  var _throwError = require2("../../utils/throwError");
@@ -11294,12 +11215,12 @@ var mqtt = { exports: {} };
11294
11215
  }
11295
11216
  }
11296
11217
  var _default = OrderedMap;
11297
- exports2.default = _default;
11298
- }, { "../../utils/throwError": 44, "./Base": 39, "./Base/TreeIterator": 37 }], 41: [function(require2, module2, exports2) {
11299
- Object.defineProperty(exports2, "t", {
11218
+ exports$12.default = _default;
11219
+ }, { "../../utils/throwError": 44, "./Base": 39, "./Base/TreeIterator": 37 }], 41: [function(require2, module2, exports$12) {
11220
+ Object.defineProperty(exports$12, "t", {
11300
11221
  value: true
11301
11222
  });
11302
- exports2.default = void 0;
11223
+ exports$12.default = void 0;
11303
11224
  var _Base = _interopRequireDefault(require2("./Base"));
11304
11225
  var _TreeIterator = _interopRequireDefault(require2("./Base/TreeIterator"));
11305
11226
  var _throwError = require2("../../utils/throwError");
@@ -11390,66 +11311,66 @@ var mqtt = { exports: {} };
11390
11311
  }
11391
11312
  }
11392
11313
  var _default = OrderedSet;
11393
- exports2.default = _default;
11394
- }, { "../../utils/throwError": 44, "./Base": 39, "./Base/TreeIterator": 37 }], 42: [function(require2, module2, exports2) {
11395
- Object.defineProperty(exports2, "t", {
11314
+ exports$12.default = _default;
11315
+ }, { "../../utils/throwError": 44, "./Base": 39, "./Base/TreeIterator": 37 }], 42: [function(require2, module2, exports$12) {
11316
+ Object.defineProperty(exports$12, "t", {
11396
11317
  value: true
11397
11318
  });
11398
- Object.defineProperty(exports2, "Deque", {
11319
+ Object.defineProperty(exports$12, "Deque", {
11399
11320
  enumerable: true,
11400
11321
  get: function() {
11401
11322
  return _Deque.default;
11402
11323
  }
11403
11324
  });
11404
- Object.defineProperty(exports2, "HashMap", {
11325
+ Object.defineProperty(exports$12, "HashMap", {
11405
11326
  enumerable: true,
11406
11327
  get: function() {
11407
11328
  return _HashMap.default;
11408
11329
  }
11409
11330
  });
11410
- Object.defineProperty(exports2, "HashSet", {
11331
+ Object.defineProperty(exports$12, "HashSet", {
11411
11332
  enumerable: true,
11412
11333
  get: function() {
11413
11334
  return _HashSet.default;
11414
11335
  }
11415
11336
  });
11416
- Object.defineProperty(exports2, "LinkList", {
11337
+ Object.defineProperty(exports$12, "LinkList", {
11417
11338
  enumerable: true,
11418
11339
  get: function() {
11419
11340
  return _LinkList.default;
11420
11341
  }
11421
11342
  });
11422
- Object.defineProperty(exports2, "OrderedMap", {
11343
+ Object.defineProperty(exports$12, "OrderedMap", {
11423
11344
  enumerable: true,
11424
11345
  get: function() {
11425
11346
  return _OrderedMap.default;
11426
11347
  }
11427
11348
  });
11428
- Object.defineProperty(exports2, "OrderedSet", {
11349
+ Object.defineProperty(exports$12, "OrderedSet", {
11429
11350
  enumerable: true,
11430
11351
  get: function() {
11431
11352
  return _OrderedSet.default;
11432
11353
  }
11433
11354
  });
11434
- Object.defineProperty(exports2, "PriorityQueue", {
11355
+ Object.defineProperty(exports$12, "PriorityQueue", {
11435
11356
  enumerable: true,
11436
11357
  get: function() {
11437
11358
  return _PriorityQueue.default;
11438
11359
  }
11439
11360
  });
11440
- Object.defineProperty(exports2, "Queue", {
11361
+ Object.defineProperty(exports$12, "Queue", {
11441
11362
  enumerable: true,
11442
11363
  get: function() {
11443
11364
  return _Queue.default;
11444
11365
  }
11445
11366
  });
11446
- Object.defineProperty(exports2, "Stack", {
11367
+ Object.defineProperty(exports$12, "Stack", {
11447
11368
  enumerable: true,
11448
11369
  get: function() {
11449
11370
  return _Stack.default;
11450
11371
  }
11451
11372
  });
11452
- Object.defineProperty(exports2, "Vector", {
11373
+ Object.defineProperty(exports$12, "Vector", {
11453
11374
  enumerable: true,
11454
11375
  get: function() {
11455
11376
  return _Vector.default;
@@ -11470,24 +11391,24 @@ var mqtt = { exports: {} };
11470
11391
  default: e
11471
11392
  };
11472
11393
  }
11473
- }, { "./container/HashContainer/HashMap": 27, "./container/HashContainer/HashSet": 28, "./container/OtherContainer/PriorityQueue": 29, "./container/OtherContainer/Queue": 30, "./container/OtherContainer/Stack": 31, "./container/SequentialContainer/Deque": 34, "./container/SequentialContainer/LinkList": 35, "./container/SequentialContainer/Vector": 36, "./container/TreeContainer/OrderedMap": 40, "./container/TreeContainer/OrderedSet": 41 }], 43: [function(require2, module2, exports2) {
11474
- Object.defineProperty(exports2, "t", {
11394
+ }, { "./container/HashContainer/HashMap": 27, "./container/HashContainer/HashSet": 28, "./container/OtherContainer/PriorityQueue": 29, "./container/OtherContainer/Queue": 30, "./container/OtherContainer/Stack": 31, "./container/SequentialContainer/Deque": 34, "./container/SequentialContainer/LinkList": 35, "./container/SequentialContainer/Vector": 36, "./container/TreeContainer/OrderedMap": 40, "./container/TreeContainer/OrderedSet": 41 }], 43: [function(require2, module2, exports$12) {
11395
+ Object.defineProperty(exports$12, "t", {
11475
11396
  value: true
11476
11397
  });
11477
- exports2.default = checkObject;
11398
+ exports$12.default = checkObject;
11478
11399
  function checkObject(e) {
11479
11400
  const t = typeof e;
11480
11401
  return t === "object" && e !== null || t === "function";
11481
11402
  }
11482
- }, {}], 44: [function(require2, module2, exports2) {
11483
- Object.defineProperty(exports2, "t", {
11403
+ }, {}], 44: [function(require2, module2, exports$12) {
11404
+ Object.defineProperty(exports$12, "t", {
11484
11405
  value: true
11485
11406
  });
11486
- exports2.throwIteratorAccessError = throwIteratorAccessError;
11407
+ exports$12.throwIteratorAccessError = throwIteratorAccessError;
11487
11408
  function throwIteratorAccessError() {
11488
11409
  throw new RangeError("Iterator access denied!");
11489
11410
  }
11490
- }, {}], 45: [function(require2, module2, exports2) {
11411
+ }, {}], 45: [function(require2, module2, exports$12) {
11491
11412
  const Yallist = require2("yallist");
11492
11413
  const MAX = Symbol("max");
11493
11414
  const LENGTH = Symbol("length");
@@ -11750,7 +11671,7 @@ var mqtt = { exports: {} };
11750
11671
  fn.call(thisp, hit.value, hit.key, self2);
11751
11672
  };
11752
11673
  module2.exports = LRUCache;
11753
- }, { "yallist": 84 }], 46: [function(require2, module2, exports2) {
11674
+ }, { "yallist": 84 }], 46: [function(require2, module2, exports$12) {
11754
11675
  (function(Buffer2) {
11755
11676
  (function() {
11756
11677
  const protocol = module2.exports;
@@ -11912,7 +11833,7 @@ var mqtt = { exports: {} };
11912
11833
  };
11913
11834
  }).call(this);
11914
11835
  }).call(this, require2("buffer").Buffer);
11915
- }, { "buffer": 3 }], 47: [function(require2, module2, exports2) {
11836
+ }, { "buffer": 3 }], 47: [function(require2, module2, exports$12) {
11916
11837
  (function(Buffer2) {
11917
11838
  (function() {
11918
11839
  const writeToStream = require2("./writeToStream");
@@ -11959,11 +11880,11 @@ var mqtt = { exports: {} };
11959
11880
  module2.exports = generate;
11960
11881
  }).call(this);
11961
11882
  }).call(this, require2("buffer").Buffer);
11962
- }, { "./writeToStream": 52, "buffer": 3, "events": 4 }], 48: [function(require2, module2, exports2) {
11963
- exports2.parser = require2("./parser").parser;
11964
- exports2.generate = require2("./generate");
11965
- exports2.writeToStream = require2("./writeToStream");
11966
- }, { "./generate": 47, "./parser": 51, "./writeToStream": 52 }], 49: [function(require2, module2, exports2) {
11883
+ }, { "./writeToStream": 52, "buffer": 3, "events": 4 }], 48: [function(require2, module2, exports$12) {
11884
+ exports$12.parser = require2("./parser").parser;
11885
+ exports$12.generate = require2("./generate");
11886
+ exports$12.writeToStream = require2("./writeToStream");
11887
+ }, { "./generate": 47, "./parser": 51, "./writeToStream": 52 }], 49: [function(require2, module2, exports$12) {
11967
11888
  (function(Buffer2) {
11968
11889
  (function() {
11969
11890
  const max = 65536;
@@ -12010,7 +11931,7 @@ var mqtt = { exports: {} };
12010
11931
  };
12011
11932
  }).call(this);
12012
11933
  }).call(this, require2("buffer").Buffer);
12013
- }, { "buffer": 3 }], 50: [function(require2, module2, exports2) {
11934
+ }, { "buffer": 3 }], 50: [function(require2, module2, exports$12) {
12014
11935
  class Packet {
12015
11936
  constructor() {
12016
11937
  this.cmd = null;
@@ -12023,7 +11944,7 @@ var mqtt = { exports: {} };
12023
11944
  }
12024
11945
  }
12025
11946
  module2.exports = Packet;
12026
- }, {}], 51: [function(require2, module2, exports2) {
11947
+ }, {}], 51: [function(require2, module2, exports$12) {
12027
11948
  const bl = require2("bl");
12028
11949
  const EventEmitter = require2("events");
12029
11950
  const Packet = require2("./packet");
@@ -12598,7 +12519,7 @@ var mqtt = { exports: {} };
12598
12519
  }
12599
12520
  }
12600
12521
  module2.exports = Parser;
12601
- }, { "./constants": 46, "./packet": 50, "bl": 19, "debug": 20, "events": 4 }], 52: [function(require2, module2, exports2) {
12522
+ }, { "./constants": 46, "./packet": 50, "bl": 19, "debug": 20, "events": 4 }], 52: [function(require2, module2, exports$12) {
12602
12523
  (function(Buffer2) {
12603
12524
  (function() {
12604
12525
  const protocol = require2("./constants");
@@ -12687,7 +12608,7 @@ var mqtt = { exports: {} };
12687
12608
  const properties = settings.properties;
12688
12609
  if (clean === void 0) clean = true;
12689
12610
  let length = 0;
12690
- if (!protocolId || typeof protocolId !== "string" && !Buffer2.isBuffer(protocolId)) {
12611
+ if (typeof protocolId !== "string" && !Buffer2.isBuffer(protocolId)) {
12691
12612
  stream.emit("error", new Error("Invalid protocolId"));
12692
12613
  return false;
12693
12614
  } else length += protocolId.length + 2;
@@ -13454,7 +13375,7 @@ var mqtt = { exports: {} };
13454
13375
  module2.exports = generate;
13455
13376
  }).call(this);
13456
13377
  }).call(this, require2("buffer").Buffer);
13457
- }, { "./constants": 46, "./numbers": 49, "buffer": 3, "debug": 20, "process-nextick-args": 57 }], 53: [function(require2, module2, exports2) {
13378
+ }, { "./constants": 46, "./numbers": 49, "buffer": 3, "debug": 20, "process-nextick-args": 57 }], 53: [function(require2, module2, exports$12) {
13458
13379
  var s = 1e3;
13459
13380
  var m = s * 60;
13460
13381
  var h = m * 60;
@@ -13565,10 +13486,10 @@ var mqtt = { exports: {} };
13565
13486
  var isPlural = msAbs >= n * 1.5;
13566
13487
  return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
13567
13488
  }
13568
- }, {}], 54: [function(require2, module2, exports2) {
13489
+ }, {}], 54: [function(require2, module2, exports$12) {
13569
13490
  const NumberAllocator = require2("./lib/number-allocator.js");
13570
13491
  module2.exports.NumberAllocator = NumberAllocator;
13571
- }, { "./lib/number-allocator.js": 55 }], 55: [function(require2, module2, exports2) {
13492
+ }, { "./lib/number-allocator.js": 55 }], 55: [function(require2, module2, exports$12) {
13572
13493
  const SortedSet = require2("js-sdsl").OrderedSet;
13573
13494
  const debugTrace = require2("debug")("number-allocator:trace");
13574
13495
  const debugError = require2("debug")("number-allocator:error");
@@ -13718,7 +13639,7 @@ var mqtt = { exports: {} };
13718
13639
  }
13719
13640
  };
13720
13641
  module2.exports = NumberAllocator;
13721
- }, { "debug": 20, "js-sdsl": 42 }], 56: [function(require2, module2, exports2) {
13642
+ }, { "debug": 20, "js-sdsl": 42 }], 56: [function(require2, module2, exports$12) {
13722
13643
  var wrappy = require2("wrappy");
13723
13644
  module2.exports = wrappy(once);
13724
13645
  module2.exports.strict = wrappy(onceStrict);
@@ -13757,7 +13678,7 @@ var mqtt = { exports: {} };
13757
13678
  f.called = false;
13758
13679
  return f;
13759
13680
  }
13760
- }, { "wrappy": 80 }], 57: [function(require2, module2, exports2) {
13681
+ }, { "wrappy": 80 }], 57: [function(require2, module2, exports$12) {
13761
13682
  (function(process2) {
13762
13683
  (function() {
13763
13684
  if (typeof process2 === "undefined" || !process2.version || process2.version.indexOf("v0.") === 0 || process2.version.indexOf("v1.") === 0 && process2.version.indexOf("v1.8.") !== 0) {
@@ -13800,7 +13721,7 @@ var mqtt = { exports: {} };
13800
13721
  }
13801
13722
  }).call(this);
13802
13723
  }).call(this, require2("_process"));
13803
- }, { "_process": 85 }], 58: [function(require2, module2, exports2) {
13724
+ }, { "_process": 85 }], 58: [function(require2, module2, exports$12) {
13804
13725
  function _inheritsLoose(subClass, superClass) {
13805
13726
  subClass.prototype = Object.create(superClass.prototype);
13806
13727
  subClass.prototype.constructor = subClass;
@@ -13903,7 +13824,7 @@ var mqtt = { exports: {} };
13903
13824
  }, TypeError);
13904
13825
  createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
13905
13826
  module2.exports.codes = codes;
13906
- }, {}], 59: [function(require2, module2, exports2) {
13827
+ }, {}], 59: [function(require2, module2, exports$12) {
13907
13828
  (function(process2) {
13908
13829
  (function() {
13909
13830
  var objectKeys = Object.keys || function(obj) {
@@ -13993,7 +13914,7 @@ var mqtt = { exports: {} };
13993
13914
  });
13994
13915
  }).call(this);
13995
13916
  }).call(this, require2("_process"));
13996
- }, { "./_stream_readable": 61, "./_stream_writable": 63, "_process": 85, "inherits": 24 }], 60: [function(require2, module2, exports2) {
13917
+ }, { "./_stream_readable": 61, "./_stream_writable": 63, "_process": 85, "inherits": 24 }], 60: [function(require2, module2, exports$12) {
13997
13918
  module2.exports = PassThrough;
13998
13919
  var Transform = require2("./_stream_transform");
13999
13920
  require2("inherits")(PassThrough, Transform);
@@ -14004,7 +13925,7 @@ var mqtt = { exports: {} };
14004
13925
  PassThrough.prototype._transform = function(chunk, encoding, cb) {
14005
13926
  cb(null, chunk);
14006
13927
  };
14007
- }, { "./_stream_transform": 62, "inherits": 24 }], 61: [function(require2, module2, exports2) {
13928
+ }, { "./_stream_transform": 62, "inherits": 24 }], 61: [function(require2, module2, exports$12) {
14008
13929
  (function(process2, global2) {
14009
13930
  (function() {
14010
13931
  module2.exports = Readable;
@@ -14733,7 +14654,7 @@ var mqtt = { exports: {} };
14733
14654
  }
14734
14655
  }).call(this);
14735
14656
  }).call(this, require2("_process"), typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
14736
- }, { "../errors": 58, "./_stream_duplex": 59, "./internal/streams/async_iterator": 64, "./internal/streams/buffer_list": 65, "./internal/streams/destroy": 66, "./internal/streams/from": 68, "./internal/streams/state": 70, "./internal/streams/stream": 71, "_process": 85, "buffer": 3, "events": 4, "inherits": 24, "string_decoder/": 78, "util": 2 }], 62: [function(require2, module2, exports2) {
14657
+ }, { "../errors": 58, "./_stream_duplex": 59, "./internal/streams/async_iterator": 64, "./internal/streams/buffer_list": 65, "./internal/streams/destroy": 66, "./internal/streams/from": 68, "./internal/streams/state": 70, "./internal/streams/stream": 71, "_process": 85, "buffer": 3, "events": 4, "inherits": 24, "string_decoder/": 78, "util": 2 }], 62: [function(require2, module2, exports$12) {
14737
14658
  module2.exports = Transform;
14738
14659
  var _require$codes = require2("../errors").codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
14739
14660
  var Duplex = require2("./_stream_duplex");
@@ -14824,7 +14745,7 @@ var mqtt = { exports: {} };
14824
14745
  if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
14825
14746
  return stream.push(null);
14826
14747
  }
14827
- }, { "../errors": 58, "./_stream_duplex": 59, "inherits": 24 }], 63: [function(require2, module2, exports2) {
14748
+ }, { "../errors": 58, "./_stream_duplex": 59, "inherits": 24 }], 63: [function(require2, module2, exports$12) {
14828
14749
  (function(process2, global2) {
14829
14750
  (function() {
14830
14751
  module2.exports = Writable;
@@ -15284,7 +15205,7 @@ var mqtt = { exports: {} };
15284
15205
  };
15285
15206
  }).call(this);
15286
15207
  }).call(this, require2("_process"), typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
15287
- }, { "../errors": 58, "./_stream_duplex": 59, "./internal/streams/destroy": 66, "./internal/streams/state": 70, "./internal/streams/stream": 71, "_process": 85, "buffer": 3, "inherits": 24, "util-deprecate": 79 }], 64: [function(require2, module2, exports2) {
15208
+ }, { "../errors": 58, "./_stream_duplex": 59, "./internal/streams/destroy": 66, "./internal/streams/state": 70, "./internal/streams/stream": 71, "_process": 85, "buffer": 3, "inherits": 24, "util-deprecate": 79 }], 64: [function(require2, module2, exports$12) {
15288
15209
  (function(process2) {
15289
15210
  (function() {
15290
15211
  var _Object$setPrototypeO;
@@ -15450,7 +15371,7 @@ var mqtt = { exports: {} };
15450
15371
  module2.exports = createReadableStreamAsyncIterator;
15451
15372
  }).call(this);
15452
15373
  }).call(this, require2("_process"));
15453
- }, { "./end-of-stream": 67, "_process": 85 }], 65: [function(require2, module2, exports2) {
15374
+ }, { "./end-of-stream": 67, "_process": 85 }], 65: [function(require2, module2, exports$12) {
15454
15375
  function ownKeys(object, enumerableOnly) {
15455
15376
  var keys = Object.keys(object);
15456
15377
  if (Object.getOwnPropertySymbols) {
@@ -15676,7 +15597,7 @@ var mqtt = { exports: {} };
15676
15597
  }]);
15677
15598
  return BufferList;
15678
15599
  }();
15679
- }, { "buffer": 3, "util": 2 }], 66: [function(require2, module2, exports2) {
15600
+ }, { "buffer": 3, "util": 2 }], 66: [function(require2, module2, exports$12) {
15680
15601
  (function(process2) {
15681
15602
  (function() {
15682
15603
  function destroy(err, cb) {
@@ -15763,7 +15684,7 @@ var mqtt = { exports: {} };
15763
15684
  };
15764
15685
  }).call(this);
15765
15686
  }).call(this, require2("_process"));
15766
- }, { "_process": 85 }], 67: [function(require2, module2, exports2) {
15687
+ }, { "_process": 85 }], 67: [function(require2, module2, exports$12) {
15767
15688
  var ERR_STREAM_PREMATURE_CLOSE = require2("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;
15768
15689
  function once(callback) {
15769
15690
  var called = false;
@@ -15846,11 +15767,11 @@ var mqtt = { exports: {} };
15846
15767
  };
15847
15768
  }
15848
15769
  module2.exports = eos;
15849
- }, { "../../../errors": 58 }], 68: [function(require2, module2, exports2) {
15770
+ }, { "../../../errors": 58 }], 68: [function(require2, module2, exports$12) {
15850
15771
  module2.exports = function() {
15851
15772
  throw new Error("Readable.from is not available in the browser");
15852
15773
  };
15853
- }, {}], 69: [function(require2, module2, exports2) {
15774
+ }, {}], 69: [function(require2, module2, exports$12) {
15854
15775
  var eos;
15855
15776
  function once(callback) {
15856
15777
  var called = false;
@@ -15927,7 +15848,7 @@ var mqtt = { exports: {} };
15927
15848
  return streams.reduce(pipe);
15928
15849
  }
15929
15850
  module2.exports = pipeline;
15930
- }, { "../../../errors": 58, "./end-of-stream": 67 }], 70: [function(require2, module2, exports2) {
15851
+ }, { "../../../errors": 58, "./end-of-stream": 67 }], 70: [function(require2, module2, exports$12) {
15931
15852
  var ERR_INVALID_OPT_VALUE = require2("../../../errors").codes.ERR_INVALID_OPT_VALUE;
15932
15853
  function highWaterMarkFrom(options, isDuplex, duplexKey) {
15933
15854
  return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
@@ -15946,19 +15867,19 @@ var mqtt = { exports: {} };
15946
15867
  module2.exports = {
15947
15868
  getHighWaterMark
15948
15869
  };
15949
- }, { "../../../errors": 58 }], 71: [function(require2, module2, exports2) {
15870
+ }, { "../../../errors": 58 }], 71: [function(require2, module2, exports$12) {
15950
15871
  module2.exports = require2("events").EventEmitter;
15951
- }, { "events": 4 }], 72: [function(require2, module2, exports2) {
15952
- exports2 = module2.exports = require2("./lib/_stream_readable.js");
15953
- exports2.Stream = exports2;
15954
- exports2.Readable = exports2;
15955
- exports2.Writable = require2("./lib/_stream_writable.js");
15956
- exports2.Duplex = require2("./lib/_stream_duplex.js");
15957
- exports2.Transform = require2("./lib/_stream_transform.js");
15958
- exports2.PassThrough = require2("./lib/_stream_passthrough.js");
15959
- exports2.finished = require2("./lib/internal/streams/end-of-stream.js");
15960
- exports2.pipeline = require2("./lib/internal/streams/pipeline.js");
15961
- }, { "./lib/_stream_duplex.js": 59, "./lib/_stream_passthrough.js": 60, "./lib/_stream_readable.js": 61, "./lib/_stream_transform.js": 62, "./lib/_stream_writable.js": 63, "./lib/internal/streams/end-of-stream.js": 67, "./lib/internal/streams/pipeline.js": 69 }], 73: [function(require2, module2, exports2) {
15872
+ }, { "events": 4 }], 72: [function(require2, module2, exports$12) {
15873
+ exports$12 = module2.exports = require2("./lib/_stream_readable.js");
15874
+ exports$12.Stream = exports$12;
15875
+ exports$12.Readable = exports$12;
15876
+ exports$12.Writable = require2("./lib/_stream_writable.js");
15877
+ exports$12.Duplex = require2("./lib/_stream_duplex.js");
15878
+ exports$12.Transform = require2("./lib/_stream_transform.js");
15879
+ exports$12.PassThrough = require2("./lib/_stream_passthrough.js");
15880
+ exports$12.finished = require2("./lib/internal/streams/end-of-stream.js");
15881
+ exports$12.pipeline = require2("./lib/internal/streams/pipeline.js");
15882
+ }, { "./lib/_stream_duplex.js": 59, "./lib/_stream_passthrough.js": 60, "./lib/_stream_readable.js": 61, "./lib/_stream_transform.js": 62, "./lib/_stream_writable.js": 63, "./lib/internal/streams/end-of-stream.js": 67, "./lib/internal/streams/pipeline.js": 69 }], 73: [function(require2, module2, exports$12) {
15962
15883
  function ReInterval(callback, interval, args) {
15963
15884
  var self2 = this;
15964
15885
  this._callback = callback;
@@ -16001,9 +15922,9 @@ var mqtt = { exports: {} };
16001
15922
  return new ReInterval(arguments[0], arguments[1], args);
16002
15923
  }
16003
15924
  module2.exports = reInterval;
16004
- }, {}], 74: [function(require2, module2, exports2) {
15925
+ }, {}], 74: [function(require2, module2, exports$12) {
16005
15926
  module2.exports = require2("./index.js")();
16006
- }, { "./index.js": 75 }], 75: [function(require2, module2, exports2) {
15927
+ }, { "./index.js": 75 }], 75: [function(require2, module2, exports$12) {
16007
15928
  (function(Buffer2) {
16008
15929
  (function() {
16009
15930
  module2.exports = rfdc;
@@ -16186,7 +16107,7 @@ var mqtt = { exports: {} };
16186
16107
  }
16187
16108
  }).call(this);
16188
16109
  }).call(this, require2("buffer").Buffer);
16189
- }, { "buffer": 3 }], 76: [function(require2, module2, exports2) {
16110
+ }, { "buffer": 3 }], 76: [function(require2, module2, exports$12) {
16190
16111
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
16191
16112
  var buffer = require2("buffer");
16192
16113
  var Buffer2 = buffer.Buffer;
@@ -16198,8 +16119,8 @@ var mqtt = { exports: {} };
16198
16119
  if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
16199
16120
  module2.exports = buffer;
16200
16121
  } else {
16201
- copyProps(buffer, exports2);
16202
- exports2.Buffer = SafeBuffer;
16122
+ copyProps(buffer, exports$12);
16123
+ exports$12.Buffer = SafeBuffer;
16203
16124
  }
16204
16125
  function SafeBuffer(arg, encodingOrOffset, length) {
16205
16126
  return Buffer2(arg, encodingOrOffset, length);
@@ -16240,7 +16161,7 @@ var mqtt = { exports: {} };
16240
16161
  }
16241
16162
  return buffer.SlowBuffer(size);
16242
16163
  };
16243
- }, { "buffer": 3 }], 77: [function(require2, module2, exports2) {
16164
+ }, { "buffer": 3 }], 77: [function(require2, module2, exports$12) {
16244
16165
  module2.exports = shift;
16245
16166
  function shift(stream) {
16246
16167
  var rs = stream._readableState;
@@ -16256,7 +16177,7 @@ var mqtt = { exports: {} };
16256
16177
  }
16257
16178
  return state.length;
16258
16179
  }
16259
- }, {}], 78: [function(require2, module2, exports2) {
16180
+ }, {}], 78: [function(require2, module2, exports$12) {
16260
16181
  var Buffer2 = require2("safe-buffer").Buffer;
16261
16182
  var isEncoding = Buffer2.isEncoding || function(encoding) {
16262
16183
  encoding = "" + encoding;
@@ -16309,7 +16230,7 @@ var mqtt = { exports: {} };
16309
16230
  if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
16310
16231
  return nenc || enc;
16311
16232
  }
16312
- exports2.StringDecoder = StringDecoder;
16233
+ exports$12.StringDecoder = StringDecoder;
16313
16234
  function StringDecoder(encoding) {
16314
16235
  this.encoding = normalizeEncoding(encoding);
16315
16236
  var nb;
@@ -16488,7 +16409,7 @@ var mqtt = { exports: {} };
16488
16409
  function simpleEnd(buf) {
16489
16410
  return buf && buf.length ? this.write(buf) : "";
16490
16411
  }
16491
- }, { "safe-buffer": 76 }], 79: [function(require2, module2, exports2) {
16412
+ }, { "safe-buffer": 76 }], 79: [function(require2, module2, exports$12) {
16492
16413
  (function(global2) {
16493
16414
  (function() {
16494
16415
  module2.exports = deprecate;
@@ -16524,7 +16445,7 @@ var mqtt = { exports: {} };
16524
16445
  }
16525
16446
  }).call(this);
16526
16447
  }).call(this, typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
16527
- }, {}], 80: [function(require2, module2, exports2) {
16448
+ }, {}], 80: [function(require2, module2, exports$12) {
16528
16449
  module2.exports = wrappy;
16529
16450
  function wrappy(fn, cb) {
16530
16451
  if (fn && cb) return wrappy(fn)(cb);
@@ -16549,13 +16470,13 @@ var mqtt = { exports: {} };
16549
16470
  return ret;
16550
16471
  }
16551
16472
  }
16552
- }, {}], 81: [function(require2, module2, exports2) {
16473
+ }, {}], 81: [function(require2, module2, exports$12) {
16553
16474
  module2.exports = function() {
16554
16475
  throw new Error(
16555
16476
  "ws does not work in the browser. Browser clients must use the native WebSocket object"
16556
16477
  );
16557
16478
  };
16558
- }, {}], 82: [function(require2, module2, exports2) {
16479
+ }, {}], 82: [function(require2, module2, exports$12) {
16559
16480
  module2.exports = extend;
16560
16481
  var hasOwnProperty = Object.prototype.hasOwnProperty;
16561
16482
  function extend() {
@@ -16570,7 +16491,7 @@ var mqtt = { exports: {} };
16570
16491
  }
16571
16492
  return target;
16572
16493
  }
16573
- }, {}], 83: [function(require2, module2, exports2) {
16494
+ }, {}], 83: [function(require2, module2, exports$12) {
16574
16495
  module2.exports = function(Yallist) {
16575
16496
  Yallist.prototype[Symbol.iterator] = function* () {
16576
16497
  for (let walker = this.head; walker; walker = walker.next) {
@@ -16578,7 +16499,7 @@ var mqtt = { exports: {} };
16578
16499
  }
16579
16500
  };
16580
16501
  };
16581
- }, {}], 84: [function(require2, module2, exports2) {
16502
+ }, {}], 84: [function(require2, module2, exports$12) {
16582
16503
  module2.exports = Yallist;
16583
16504
  Yallist.Node = Node;
16584
16505
  Yallist.create = Yallist;
@@ -16941,7 +16862,7 @@ var mqtt = { exports: {} };
16941
16862
  require2("./iterator.js")(Yallist);
16942
16863
  } catch (er) {
16943
16864
  }
16944
- }, { "./iterator.js": 83 }], 85: [function(require2, module2, exports2) {
16865
+ }, { "./iterator.js": 83 }], 85: [function(require2, module2, exports$12) {
16945
16866
  var process2 = module2.exports = {};
16946
16867
  var cachedSetTimeout;
16947
16868
  var cachedClearTimeout;
@@ -17098,11 +17019,11 @@ var mqtt = { exports: {} };
17098
17019
  process2.umask = function() {
17099
17020
  return 0;
17100
17021
  };
17101
- }, {}], 86: [function(require2, module2, exports2) {
17022
+ }, {}], 86: [function(require2, module2, exports$12) {
17102
17023
  (function(global2) {
17103
17024
  (function() {
17104
17025
  (function(root) {
17105
- var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
17026
+ var freeExports = typeof exports$12 == "object" && exports$12 && !exports$12.nodeType && exports$12;
17106
17027
  var freeModule = typeof module2 == "object" && module2 && !module2.nodeType && module2;
17107
17028
  var freeGlobal = typeof global2 == "object" && global2;
17108
17029
  if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
@@ -17339,7 +17260,7 @@ var mqtt = { exports: {} };
17339
17260
  })(this);
17340
17261
  }).call(this);
17341
17262
  }).call(this, typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
17342
- }, {}], 87: [function(require2, module2, exports2) {
17263
+ }, {}], 87: [function(require2, module2, exports$12) {
17343
17264
  function hasOwnProperty(obj, prop) {
17344
17265
  return Object.prototype.hasOwnProperty.call(obj, prop);
17345
17266
  }
@@ -17384,7 +17305,7 @@ var mqtt = { exports: {} };
17384
17305
  var isArray = Array.isArray || function(xs) {
17385
17306
  return Object.prototype.toString.call(xs) === "[object Array]";
17386
17307
  };
17387
- }, {}], 88: [function(require2, module2, exports2) {
17308
+ }, {}], 88: [function(require2, module2, exports$12) {
17388
17309
  var stringifyPrimitive = function(v) {
17389
17310
  switch (typeof v) {
17390
17311
  case "string":
@@ -17436,17 +17357,17 @@ var mqtt = { exports: {} };
17436
17357
  }
17437
17358
  return res;
17438
17359
  };
17439
- }, {}], 89: [function(require2, module2, exports2) {
17440
- exports2.decode = exports2.parse = require2("./decode");
17441
- exports2.encode = exports2.stringify = require2("./encode");
17442
- }, { "./decode": 87, "./encode": 88 }], 90: [function(require2, module2, exports2) {
17360
+ }, {}], 89: [function(require2, module2, exports$12) {
17361
+ exports$12.decode = exports$12.parse = require2("./decode");
17362
+ exports$12.encode = exports$12.stringify = require2("./encode");
17363
+ }, { "./decode": 87, "./encode": 88 }], 90: [function(require2, module2, exports$12) {
17443
17364
  var punycode = require2("punycode");
17444
17365
  var util = require2("./util");
17445
- exports2.parse = urlParse;
17446
- exports2.resolve = urlResolve;
17447
- exports2.resolveObject = urlResolveObject;
17448
- exports2.format = urlFormat;
17449
- exports2.Url = Url;
17366
+ exports$12.parse = urlParse;
17367
+ exports$12.resolve = urlResolve;
17368
+ exports$12.resolveObject = urlResolveObject;
17369
+ exports$12.format = urlFormat;
17370
+ exports$12.Url = Url;
17450
17371
  function Url() {
17451
17372
  this.protocol = null;
17452
17373
  this.slashes = null;
@@ -17891,7 +17812,7 @@ var mqtt = { exports: {} };
17891
17812
  }
17892
17813
  if (host) this.hostname = host;
17893
17814
  };
17894
- }, { "./util": 91, "punycode": 86, "querystring": 89 }], 91: [function(require2, module2, exports2) {
17815
+ }, { "./util": 91, "punycode": 86, "querystring": 89 }], 91: [function(require2, module2, exports$12) {
17895
17816
  module2.exports = {
17896
17817
  isString: function(arg) {
17897
17818
  return typeof arg === "string";
@@ -18323,7 +18244,6 @@ class WebGL {
18323
18244
  export {
18324
18245
  AjaxUtil,
18325
18246
  ArrayUtil,
18326
- AssertUtil,
18327
18247
  AudioPlayer,
18328
18248
  BrowserUtil,
18329
18249
  CanvasDrawer,
@@ -18339,7 +18259,7 @@ export {
18339
18259
  ExceptionUtil,
18340
18260
  FileUtil,
18341
18261
  FormType,
18342
- FullScreen$1 as FullScreen,
18262
+ FullScreen_default as FullScreen,
18343
18263
  GeoJsonUtil,
18344
18264
  GeoUtil,
18345
18265
  GraphicType,