gis-common 5.1.16 → 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.
- package/dist/gis-common.es.js +1634 -1707
- package/dist/gis-common.umd.js +1 -1
- package/dist/index.d.ts +1639 -4
- package/package.json +4 -4
- package/dist/constant/CaseType.d.ts +0 -8
- package/dist/constant/ErrorType.d.ts +0 -31
- package/dist/constant/EventType.d.ts +0 -24
- package/dist/constant/FormType.d.ts +0 -6
- package/dist/constant/GraphicTypes.d.ts +0 -26
- package/dist/constant/LayerType.d.ts +0 -10
- package/dist/constant/index.d.ts +0 -6
- package/dist/core/AudioPlayer.d.ts +0 -20
- package/dist/core/CanvasDrawer.d.ts +0 -37
- package/dist/core/Color.d.ts +0 -65
- package/dist/core/Cookie.d.ts +0 -5
- package/dist/core/DateTime.d.ts +0 -43
- package/dist/core/EventDispatcher.d.ts +0 -13
- package/dist/core/FullScreen.d.ts +0 -16
- package/dist/core/HashMap.d.ts +0 -20
- package/dist/core/MqttClient.d.ts +0 -32
- package/dist/core/Storage.d.ts +0 -51
- package/dist/core/WebGL.d.ts +0 -31
- package/dist/core/WebSocketClient.d.ts +0 -15
- package/dist/core/index.d.ts +0 -12
- package/dist/types.d.ts +0 -101
- package/dist/utils/AjaxUtil.d.ts +0 -109
- package/dist/utils/ArrayUtil.d.ts +0 -45
- package/dist/utils/AssertUtil.d.ts +0 -15
- package/dist/utils/BrowserUtil.d.ts +0 -85
- package/dist/utils/CommUtil.d.ts +0 -105
- package/dist/utils/CoordsUtil.d.ts +0 -43
- package/dist/utils/DomUtil.d.ts +0 -90
- package/dist/utils/ExceptionUtil.d.ts +0 -15
- package/dist/utils/FileUtil.d.ts +0 -33
- package/dist/utils/GeoJsonUtil.d.ts +0 -76
- package/dist/utils/GeoUtil.d.ts +0 -151
- package/dist/utils/ImageUtil.d.ts +0 -43
- package/dist/utils/MathUtil.d.ts +0 -37
- package/dist/utils/MessageUtil.d.ts +0 -34
- package/dist/utils/ObjectUtil.d.ts +0 -30
- package/dist/utils/OptimizeUtil.d.ts +0 -43
- package/dist/utils/StringUtil.d.ts +0 -34
- package/dist/utils/TreeUtil.d.ts +0 -25
- package/dist/utils/UrlUtil.d.ts +0 -18
- package/dist/utils/ValidateUtil.d.ts +0 -26
- package/dist/utils/index.d.ts +0 -20
package/dist/gis-common.es.js
CHANGED
|
@@ -422,7 +422,7 @@ const Util = {
|
|
|
422
422
|
return typeof a === "object" && a !== null;
|
|
423
423
|
},
|
|
424
424
|
isNil(a) {
|
|
425
|
-
return a === void 0 || a ===
|
|
425
|
+
return a === void 0 || a === null || Number.isNaN(a);
|
|
426
426
|
},
|
|
427
427
|
isNumber(a) {
|
|
428
428
|
return typeof a === "number" && !isNaN(a) || typeof a === "string" && Number.isFinite(+a);
|
|
@@ -715,7 +715,7 @@ const AjaxUtil = {
|
|
|
715
715
|
* }
|
|
716
716
|
* );
|
|
717
717
|
*/
|
|
718
|
-
get(url, options
|
|
718
|
+
get(url, options, cb) {
|
|
719
719
|
if (Util.isFunction(options)) {
|
|
720
720
|
const t = cb;
|
|
721
721
|
cb = options;
|
|
@@ -903,11 +903,11 @@ const AjaxUtil = {
|
|
|
903
903
|
* }
|
|
904
904
|
* );
|
|
905
905
|
*/
|
|
906
|
-
getJSON(url, options
|
|
906
|
+
getJSON(url, options, cb) {
|
|
907
907
|
if (Util.isFunction(options)) {
|
|
908
908
|
const t = cb;
|
|
909
909
|
cb = options;
|
|
910
|
-
options = t;
|
|
910
|
+
options = t || {};
|
|
911
911
|
}
|
|
912
912
|
const callback = function(resp, err) {
|
|
913
913
|
const data = resp ? ObjectUtil.parse(resp) : null;
|
|
@@ -921,708 +921,766 @@ const AjaxUtil = {
|
|
|
921
921
|
return this.get(url, options, callback);
|
|
922
922
|
}
|
|
923
923
|
};
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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 = {
|
|
933
977
|
/**
|
|
934
|
-
*
|
|
978
|
+
* 创建指定长度的数组,并返回其索引数组
|
|
935
979
|
*
|
|
936
|
-
* @param
|
|
937
|
-
* @returns
|
|
980
|
+
* @param length 数组长度
|
|
981
|
+
* @returns 索引数组
|
|
938
982
|
*/
|
|
939
|
-
|
|
940
|
-
return
|
|
983
|
+
create(length) {
|
|
984
|
+
return [...new Array(length).keys()];
|
|
941
985
|
},
|
|
942
986
|
/**
|
|
943
|
-
*
|
|
987
|
+
* 合并多个数组,并去重
|
|
944
988
|
*
|
|
945
|
-
* @param
|
|
946
|
-
* @returns
|
|
989
|
+
* @param args 需要合并的数组
|
|
990
|
+
* @returns 合并后的去重数组
|
|
947
991
|
*/
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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;
|
|
953
1000
|
},
|
|
954
1001
|
/**
|
|
955
|
-
*
|
|
1002
|
+
* 求多个数组的交集
|
|
956
1003
|
*
|
|
957
|
-
* @param
|
|
958
|
-
* @
|
|
959
|
-
* @param max 最大值
|
|
960
|
-
* @returns 返回限制后的数值
|
|
1004
|
+
* @param args 多个需要求交集的数组
|
|
1005
|
+
* @returns 返回多个数组的交集数组
|
|
961
1006
|
*/
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
} else {
|
|
971
|
-
return length % 1 === 0 ? `${length.toFixed(0)}m` : `${length.toFixed(decimal).replace(/\.?0+$/, "")}m`;
|
|
972
|
-
}
|
|
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;
|
|
973
1015
|
},
|
|
974
|
-
formatArea(area, options = { decimal: 1 }) {
|
|
975
|
-
const { decimal } = options;
|
|
976
|
-
if (area >= 1e6) {
|
|
977
|
-
const km = area / 1e6;
|
|
978
|
-
return km % 1 === 0 ? `${area.toFixed(0)}km²` : `${area.toFixed(decimal).replace(/\.?0+$/, "")}km²`;
|
|
979
|
-
} else {
|
|
980
|
-
return area % 1 === 0 ? `${area.toFixed(0)}m²` : `${area.toFixed(decimal).replace(/\.?0+$/, "")}m²`;
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
class GeoUtil {
|
|
985
|
-
// 地球赤道半径
|
|
986
1016
|
/**
|
|
987
|
-
*
|
|
1017
|
+
* 将多个数组拼接为一个数组,并去除其中的空值。
|
|
988
1018
|
*
|
|
989
|
-
* @param
|
|
990
|
-
* @
|
|
991
|
-
* @returns 如果经纬度合法,返回true;否则返回false
|
|
1019
|
+
* @param args 需要拼接的数组列表。
|
|
1020
|
+
* @returns 拼接并去空后的数组。
|
|
992
1021
|
*/
|
|
993
|
-
|
|
994
|
-
return
|
|
995
|
-
}
|
|
1022
|
+
unionAll(...args) {
|
|
1023
|
+
return [...args].flat().filter((d) => !!d);
|
|
1024
|
+
},
|
|
996
1025
|
/**
|
|
997
|
-
*
|
|
1026
|
+
* 求差集
|
|
998
1027
|
*
|
|
999
|
-
* @param
|
|
1000
|
-
* @
|
|
1001
|
-
* @returns 返回两点间的欧几里得距离
|
|
1028
|
+
* @param args 任意个集合
|
|
1029
|
+
* @returns 返回差集结果
|
|
1002
1030
|
*/
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1031
|
+
difference(...args) {
|
|
1032
|
+
if (args.length === 0) return [];
|
|
1033
|
+
return this.union(...args).filter((d) => !this.intersection(...args).includes(d));
|
|
1034
|
+
},
|
|
1006
1035
|
/**
|
|
1007
|
-
*
|
|
1036
|
+
* 对字符串数组进行中文排序
|
|
1008
1037
|
*
|
|
1009
|
-
* @param
|
|
1010
|
-
* @
|
|
1011
|
-
* @returns 返回两点之间的距离,单位为米
|
|
1038
|
+
* @param arr 待排序的字符串数组
|
|
1039
|
+
* @returns 排序后的字符串数组
|
|
1012
1040
|
*/
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
const y = Math.sin(ya * Math.PI / 180) * Math.sin(yb * Math.PI / 180);
|
|
1019
|
-
let s = x + y;
|
|
1020
|
-
if (s > 1) s = 1;
|
|
1021
|
-
if (s < -1) s = -1;
|
|
1022
|
-
const alpha = Math.acos(s);
|
|
1023
|
-
const distance = alpha * earthR;
|
|
1024
|
-
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;
|
|
1025
1046
|
}
|
|
1047
|
+
};
|
|
1048
|
+
class BrowserUtil {
|
|
1026
1049
|
/**
|
|
1027
|
-
*
|
|
1050
|
+
* 获取系统类型
|
|
1028
1051
|
*
|
|
1029
|
-
* @
|
|
1030
|
-
* @param lat 纬度
|
|
1031
|
-
* @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
|
|
1052
|
+
* @returns 返回一个包含系统类型和版本的对象
|
|
1032
1053
|
*/
|
|
1033
|
-
static
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
} else if (
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
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, ".")) || "";
|
|
1047
1094
|
}
|
|
1048
|
-
return
|
|
1095
|
+
return { type, version };
|
|
1049
1096
|
}
|
|
1050
1097
|
/**
|
|
1051
|
-
*
|
|
1098
|
+
* 获取浏览器类型信息
|
|
1052
1099
|
*
|
|
1053
|
-
* @
|
|
1054
|
-
* @param lat 纬度字符串
|
|
1055
|
-
* @returns 转换后的经纬度对象
|
|
1100
|
+
* @returns 浏览器类型信息,包含浏览器类型和版本号
|
|
1056
1101
|
*/
|
|
1057
|
-
static
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
let
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
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];
|
|
1066
1111
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
lat: dms2deg(lat)
|
|
1073
|
-
};
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
/**
|
|
1077
|
-
* 射线法判断点是否在多边形内
|
|
1078
|
-
*
|
|
1079
|
-
* @param p 点对象,包含x和y属性
|
|
1080
|
-
* @param poly 多边形顶点数组,可以是字符串数组或对象数组
|
|
1081
|
-
* @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
|
|
1082
|
-
*/
|
|
1083
|
-
static rayCasting(p, poly) {
|
|
1084
|
-
var px = p.x, py = p.y, flag = false;
|
|
1085
|
-
for (var i = 0, l = poly.length, j = l - 1; i < l; j = i, i++) {
|
|
1086
|
-
var sx = poly[i].x, sy = poly[i].y, tx = poly[j].x, ty = poly[j].y;
|
|
1087
|
-
if (sx === px && sy === py || tx === px && ty === py) {
|
|
1088
|
-
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];
|
|
1089
1117
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
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];
|
|
1098
1135
|
}
|
|
1099
1136
|
}
|
|
1100
|
-
return
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
*
|
|
1105
|
-
* @param p1 旋转前点坐标
|
|
1106
|
-
* @param p2 旋转中心坐标
|
|
1107
|
-
* @param θ 旋转角度(顺时针旋转为正)
|
|
1108
|
-
* @returns 旋转后点坐标
|
|
1109
|
-
*/
|
|
1110
|
-
static rotatePoint(p1, p2, θ) {
|
|
1111
|
-
const x = (p1.x - p2.x) * Math.cos(Math.PI / 180 * -θ) - (p1.y - p2.y) * Math.sin(Math.PI / 180 * -θ) + p2.x;
|
|
1112
|
-
const y = (p1.x - p2.x) * Math.sin(Math.PI / 180 * -θ) + (p1.y - p2.y) * Math.cos(Math.PI / 180 * -θ) + p2.y;
|
|
1113
|
-
return { x, y };
|
|
1137
|
+
return {
|
|
1138
|
+
type,
|
|
1139
|
+
version
|
|
1140
|
+
};
|
|
1114
1141
|
}
|
|
1115
1142
|
/**
|
|
1116
|
-
*
|
|
1143
|
+
* 判断当前浏览器是否支持WebGL
|
|
1117
1144
|
*
|
|
1118
|
-
* @
|
|
1119
|
-
* @param p2 第二个点的坐标对象
|
|
1120
|
-
* @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
|
|
1121
|
-
* 正北为0°,顺时针增加
|
|
1145
|
+
* @returns 如果支持WebGL则返回true,否则返回false
|
|
1122
1146
|
*/
|
|
1123
|
-
static
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
const
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
const angle = (angleInRadians * (180 / Math.PI) + 360) % 360;
|
|
1131
|
-
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;
|
|
1132
1154
|
}
|
|
1133
1155
|
/**
|
|
1134
|
-
*
|
|
1156
|
+
* 获取GPU信息
|
|
1135
1157
|
*
|
|
1136
|
-
* @
|
|
1137
|
-
* @param latlng2 第二个经纬度点
|
|
1138
|
-
* @returns 包含方位角和距离的对象
|
|
1158
|
+
* @returns 返回包含GPU类型和型号的对象
|
|
1139
1159
|
*/
|
|
1140
|
-
static
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
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
|
+
}
|
|
1150
1187
|
return {
|
|
1151
|
-
|
|
1152
|
-
|
|
1188
|
+
type,
|
|
1189
|
+
model
|
|
1153
1190
|
};
|
|
1154
1191
|
}
|
|
1155
1192
|
/**
|
|
1156
|
-
*
|
|
1193
|
+
* 获取当前浏览器设置的语言
|
|
1157
1194
|
*
|
|
1158
|
-
* @
|
|
1159
|
-
* @param p1 线段起点P1的坐标
|
|
1160
|
-
* @param p2 线段终点P2的坐标
|
|
1161
|
-
* @returns 点P到线段P1P2的最短距离
|
|
1195
|
+
* @returns 返回浏览器设置的语言,格式为 "语言_地区",例如 "zh_CN"。如果获取失败,则返回 "Unknown"。
|
|
1162
1196
|
*/
|
|
1163
|
-
static
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
if (
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
if (cross >= d2) {
|
|
1171
|
-
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();
|
|
1172
1204
|
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
const py = y1 + (y2 - y1) * r;
|
|
1176
|
-
return Math.sqrt((x - px) * (x - px) + (y - py) * (y - py));
|
|
1205
|
+
let language = arr.join("_");
|
|
1206
|
+
return language;
|
|
1177
1207
|
}
|
|
1178
1208
|
/**
|
|
1179
|
-
*
|
|
1209
|
+
* 获取当前环境的时区。
|
|
1180
1210
|
*
|
|
1181
|
-
* @
|
|
1182
|
-
* @param angle 角度值,单位为度,表示从当前点出发的方向
|
|
1183
|
-
* @param distance 距离值,单位为米,表示从当前点出发的距离
|
|
1184
|
-
* @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
|
|
1211
|
+
* @returns 返回当前环境的时区,若获取失败则返回 undefined。
|
|
1185
1212
|
*/
|
|
1186
|
-
static
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
const d = distance / this.R;
|
|
1190
|
-
angle = MathUtil.deg2Rad(angle);
|
|
1191
|
-
const lat = Math.asin(Math.sin(sLat) * Math.cos(d) + Math.cos(sLat) * Math.sin(d) * Math.cos(angle));
|
|
1192
|
-
const lon = sLng + Math.atan2(Math.sin(angle) * Math.sin(d) * Math.cos(sLat), Math.cos(d) - Math.sin(sLat) * Math.sin(lat));
|
|
1193
|
-
return {
|
|
1194
|
-
lat: MathUtil.rad2Deg(lat),
|
|
1195
|
-
lng: MathUtil.rad2Deg(lon)
|
|
1196
|
-
};
|
|
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;
|
|
1197
1216
|
}
|
|
1198
1217
|
/**
|
|
1199
|
-
*
|
|
1218
|
+
* 获取屏幕帧率
|
|
1200
1219
|
*
|
|
1201
|
-
* @
|
|
1202
|
-
*
|
|
1203
|
-
* @returns 返回包含转换后的经度lng和纬度lat的对象
|
|
1220
|
+
* @returns 返回一个Promise,resolve为计算得到的屏幕帧率
|
|
1221
|
+
* eg: const fps = await BrowserUtil.getScreenFPS()
|
|
1204
1222
|
*/
|
|
1205
|
-
static
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
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
|
+
});
|
|
1210
1249
|
}
|
|
1211
1250
|
/**
|
|
1212
|
-
*
|
|
1251
|
+
* 获取IP地址
|
|
1213
1252
|
*
|
|
1214
|
-
* @
|
|
1215
|
-
* @param lat 纬度值
|
|
1216
|
-
* @returns 墨卡托坐标对象,包含x和y属性
|
|
1253
|
+
* @returns 返回一个Promise,当成功获取到IP地址时resolve,返回IP地址字符串;当获取失败时reject,返回undefined
|
|
1217
1254
|
*/
|
|
1218
|
-
static
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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
|
+
});
|
|
1245
1311
|
}
|
|
1246
1312
|
/**
|
|
1247
|
-
*
|
|
1313
|
+
* 获取网络状态信息
|
|
1248
1314
|
*
|
|
1249
|
-
* @
|
|
1250
|
-
*
|
|
1315
|
+
* @returns 返回包含网络状态信息的对象,包含以下属性:
|
|
1316
|
+
* - network: 网络类型,可能的值为 'wifi'、'4g' 等
|
|
1317
|
+
* - isOnline: 是否在线,为 true 或 false
|
|
1318
|
+
* - ip: 当前设备的 IP 地址
|
|
1251
1319
|
*/
|
|
1252
|
-
static
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
} else if ("lng" in coord && "lat" in coord) {
|
|
1261
|
-
xSum += coord.lng;
|
|
1262
|
-
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";
|
|
1263
1328
|
}
|
|
1264
1329
|
}
|
|
1330
|
+
let isOnline = ((_b = this.navigator) == null ? void 0 : _b.onLine) || false;
|
|
1331
|
+
let ip = await this.getIPAddress();
|
|
1265
1332
|
return {
|
|
1266
|
-
|
|
1267
|
-
|
|
1333
|
+
network,
|
|
1334
|
+
isOnline,
|
|
1335
|
+
ip
|
|
1268
1336
|
};
|
|
1269
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
|
+
}
|
|
1270
1357
|
/**
|
|
1271
|
-
*
|
|
1358
|
+
* 判断经纬度是否不在中国境内
|
|
1272
1359
|
*
|
|
1273
|
-
* @param
|
|
1274
|
-
* @param
|
|
1275
|
-
* @
|
|
1276
|
-
* @returns 返回插值点坐标,类型与输入参数保持一致
|
|
1360
|
+
* @param lng 经度
|
|
1361
|
+
* @param lat 纬度
|
|
1362
|
+
* @returns 如果经纬度不在中国境内则返回true,否则返回false
|
|
1277
1363
|
*/
|
|
1278
|
-
static
|
|
1279
|
-
if (
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
const dx = pB.lng - pA.lng;
|
|
1285
|
-
const dy = pB.lat - pA.lat;
|
|
1286
|
-
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;
|
|
1287
1370
|
}
|
|
1371
|
+
return false;
|
|
1288
1372
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1296
|
-
antiquewhite: [250, 235, 215],
|
|
1297
|
-
aqua: [0, 255, 255],
|
|
1298
|
-
aquamarine: [127, 255, 212],
|
|
1299
|
-
azure: [240, 255, 255],
|
|
1300
|
-
beige: [245, 245, 220],
|
|
1301
|
-
bisque: [255, 228, 196],
|
|
1302
|
-
black: [0, 0, 0],
|
|
1303
|
-
blanchedalmond: [255, 235, 205],
|
|
1304
|
-
blue: [0, 0, 255],
|
|
1305
|
-
blueviolet: [138, 43, 226],
|
|
1306
|
-
brown: [165, 42, 42],
|
|
1307
|
-
burlywood: [222, 184, 135],
|
|
1308
|
-
cadetblue: [95, 158, 160],
|
|
1309
|
-
chartreuse: [127, 255, 0],
|
|
1310
|
-
chocolate: [210, 105, 30],
|
|
1311
|
-
coral: [255, 127, 80],
|
|
1312
|
-
cornflowerblue: [100, 149, 237],
|
|
1313
|
-
cornsilk: [255, 248, 220],
|
|
1314
|
-
crimson: [220, 20, 60],
|
|
1315
|
-
cyan: [0, 255, 255],
|
|
1316
|
-
darkblue: [0, 0, 139],
|
|
1317
|
-
darkcyan: [0, 139, 139],
|
|
1318
|
-
darkgoldenrod: [184, 134, 11],
|
|
1319
|
-
darkgray: [169, 169, 169],
|
|
1320
|
-
darkgreen: [0, 100, 0],
|
|
1321
|
-
darkgrey: [169, 169, 169],
|
|
1322
|
-
darkkhaki: [189, 183, 107],
|
|
1323
|
-
darkmagenta: [139, 0, 139],
|
|
1324
|
-
darkolivegreen: [85, 107, 47],
|
|
1325
|
-
darkorange: [255, 140, 0],
|
|
1326
|
-
darkorchid: [153, 50, 204],
|
|
1327
|
-
darkred: [139, 0, 0],
|
|
1328
|
-
darksalmon: [233, 150, 122],
|
|
1329
|
-
darkseagreen: [143, 188, 143],
|
|
1330
|
-
darkslateblue: [72, 61, 139],
|
|
1331
|
-
darkslategray: [47, 79, 79],
|
|
1332
|
-
darkslategrey: [47, 79, 79],
|
|
1333
|
-
darkturquoise: [0, 206, 209],
|
|
1334
|
-
darkviolet: [148, 0, 211],
|
|
1335
|
-
deeppink: [255, 20, 147],
|
|
1336
|
-
deepskyblue: [0, 191, 255],
|
|
1337
|
-
dimgray: [105, 105, 105],
|
|
1338
|
-
dimgrey: [105, 105, 105],
|
|
1339
|
-
dodgerblue: [30, 144, 255],
|
|
1340
|
-
firebrick: [178, 34, 34],
|
|
1341
|
-
floralwhite: [255, 250, 240],
|
|
1342
|
-
forestgreen: [34, 139, 34],
|
|
1343
|
-
fuchsia: [255, 0, 255],
|
|
1344
|
-
gainsboro: [220, 220, 220],
|
|
1345
|
-
ghostwhite: [248, 248, 255],
|
|
1346
|
-
gold: [255, 215, 0],
|
|
1347
|
-
goldenrod: [218, 165, 32],
|
|
1348
|
-
gray: [128, 128, 128],
|
|
1349
|
-
green: [0, 128, 0],
|
|
1350
|
-
greenyellow: [173, 255, 47],
|
|
1351
|
-
grey: [128, 128, 128],
|
|
1352
|
-
honeydew: [240, 255, 240],
|
|
1353
|
-
hotpink: [255, 105, 180],
|
|
1354
|
-
indianred: [205, 92, 92],
|
|
1355
|
-
indigo: [75, 0, 130],
|
|
1356
|
-
ivory: [255, 255, 240],
|
|
1357
|
-
khaki: [240, 230, 140],
|
|
1358
|
-
lavender: [230, 230, 250],
|
|
1359
|
-
lavenderblush: [255, 240, 245],
|
|
1360
|
-
lawngreen: [124, 252, 0],
|
|
1361
|
-
lemonchiffon: [255, 250, 205],
|
|
1362
|
-
lightblue: [173, 216, 230],
|
|
1363
|
-
lightcoral: [240, 128, 128],
|
|
1364
|
-
lightcyan: [224, 255, 255],
|
|
1365
|
-
lightgoldenrodyellow: [250, 250, 210],
|
|
1366
|
-
lightgray: [211, 211, 211],
|
|
1367
|
-
lightgreen: [144, 238, 144],
|
|
1368
|
-
lightgrey: [211, 211, 211],
|
|
1369
|
-
lightpink: [255, 182, 193],
|
|
1370
|
-
lightsalmon: [255, 160, 122],
|
|
1371
|
-
lightseagreen: [32, 178, 170],
|
|
1372
|
-
lightskyblue: [135, 206, 250],
|
|
1373
|
-
lightslategray: [119, 136, 153],
|
|
1374
|
-
lightslategrey: [119, 136, 153],
|
|
1375
|
-
lightsteelblue: [176, 196, 222],
|
|
1376
|
-
lightyellow: [255, 255, 224],
|
|
1377
|
-
lime: [0, 255, 0],
|
|
1378
|
-
limegreen: [50, 205, 50],
|
|
1379
|
-
linen: [250, 240, 230],
|
|
1380
|
-
magenta: [255, 0, 255],
|
|
1381
|
-
maroon: [128, 0, 0],
|
|
1382
|
-
mediumaquamarine: [102, 205, 170],
|
|
1383
|
-
mediumblue: [0, 0, 205],
|
|
1384
|
-
mediumorchid: [186, 85, 211],
|
|
1385
|
-
mediumpurple: [147, 112, 219],
|
|
1386
|
-
mediumseagreen: [60, 179, 113],
|
|
1387
|
-
mediumslateblue: [123, 104, 238],
|
|
1388
|
-
mediumspringgreen: [0, 250, 154],
|
|
1389
|
-
mediumturquoise: [72, 209, 204],
|
|
1390
|
-
mediumvioletred: [199, 21, 133],
|
|
1391
|
-
midnightblue: [25, 25, 112],
|
|
1392
|
-
mintcream: [245, 255, 250],
|
|
1393
|
-
mistyrose: [255, 228, 225],
|
|
1394
|
-
moccasin: [255, 228, 181],
|
|
1395
|
-
navajowhite: [255, 222, 173],
|
|
1396
|
-
navy: [0, 0, 128],
|
|
1397
|
-
oldlace: [253, 245, 230],
|
|
1398
|
-
olive: [128, 128, 0],
|
|
1399
|
-
olivedrab: [107, 142, 35],
|
|
1400
|
-
orange: [255, 165, 0],
|
|
1401
|
-
orangered: [255, 69, 0],
|
|
1402
|
-
orchid: [218, 112, 214],
|
|
1403
|
-
palegoldenrod: [238, 232, 170],
|
|
1404
|
-
palegreen: [152, 251, 152],
|
|
1405
|
-
paleturquoise: [175, 238, 238],
|
|
1406
|
-
palevioletred: [219, 112, 147],
|
|
1407
|
-
papayawhip: [255, 239, 213],
|
|
1408
|
-
peachpuff: [255, 218, 185],
|
|
1409
|
-
peru: [205, 133, 63],
|
|
1410
|
-
pink: [255, 192, 203],
|
|
1411
|
-
plum: [221, 160, 221],
|
|
1412
|
-
powderblue: [176, 224, 230],
|
|
1413
|
-
purple: [128, 0, 128],
|
|
1414
|
-
rebeccapurple: [102, 51, 153],
|
|
1415
|
-
red: [255, 0, 0],
|
|
1416
|
-
rosybrown: [188, 143, 143],
|
|
1417
|
-
royalblue: [65, 105, 225],
|
|
1418
|
-
saddlebrown: [139, 69, 19],
|
|
1419
|
-
salmon: [250, 128, 114],
|
|
1420
|
-
sandybrown: [244, 164, 96],
|
|
1421
|
-
seagreen: [46, 139, 87],
|
|
1422
|
-
seashell: [255, 245, 238],
|
|
1423
|
-
sienna: [160, 82, 45],
|
|
1424
|
-
silver: [192, 192, 192],
|
|
1425
|
-
skyblue: [135, 206, 235],
|
|
1426
|
-
slateblue: [106, 90, 205],
|
|
1427
|
-
slategray: [112, 128, 144],
|
|
1428
|
-
slategrey: [112, 128, 144],
|
|
1429
|
-
snow: [255, 250, 250],
|
|
1430
|
-
springgreen: [0, 255, 127],
|
|
1431
|
-
steelblue: [70, 130, 180],
|
|
1432
|
-
tan: [210, 180, 140],
|
|
1433
|
-
teal: [0, 128, 128],
|
|
1434
|
-
thistle: [216, 191, 216],
|
|
1435
|
-
tomato: [255, 99, 71],
|
|
1436
|
-
turquoise: [64, 224, 208],
|
|
1437
|
-
violet: [238, 130, 238],
|
|
1438
|
-
wheat: [245, 222, 179],
|
|
1439
|
-
white: [255, 255, 255],
|
|
1440
|
-
whitesmoke: [245, 245, 245],
|
|
1441
|
-
yellow: [255, 255, 0],
|
|
1442
|
-
yellowgreen: [154, 205, 50]
|
|
1443
|
-
};
|
|
1444
|
-
class Color {
|
|
1445
|
-
constructor(r, g, b, a) {
|
|
1446
|
-
__publicField(this, "_r");
|
|
1447
|
-
__publicField(this, "_g");
|
|
1448
|
-
__publicField(this, "_b");
|
|
1449
|
-
__publicField(this, "_alpha");
|
|
1450
|
-
this._validateColorChannel(r);
|
|
1451
|
-
this._validateColorChannel(g);
|
|
1452
|
-
this._validateColorChannel(b);
|
|
1453
|
-
this._r = r;
|
|
1454
|
-
this._g = g;
|
|
1455
|
-
this._b = b;
|
|
1456
|
-
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 };
|
|
1457
1380
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1381
|
+
// GCJ-02 to WGS-84
|
|
1382
|
+
static gcjDecrypt(gcjLat, gcjLon) {
|
|
1383
|
+
if (this.outOfChina(gcjLat, gcjLon)) {
|
|
1384
|
+
return { lat: gcjLat, lng: gcjLon };
|
|
1461
1385
|
}
|
|
1386
|
+
const d = this.delta(gcjLat, gcjLon);
|
|
1387
|
+
return { lat: gcjLat - d.lat, lng: gcjLon - d.lng };
|
|
1462
1388
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
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 };
|
|
1465
1418
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
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 };
|
|
1468
1428
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
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 };
|
|
1471
1438
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
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 };
|
|
1474
1446
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
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 };
|
|
1477
1454
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
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;
|
|
1481
1461
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
this.
|
|
1485
|
-
this.
|
|
1486
|
-
this.
|
|
1487
|
-
|
|
1488
|
-
this._g = g;
|
|
1489
|
-
this._b = b;
|
|
1490
|
-
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;
|
|
1491
1468
|
}
|
|
1492
1469
|
/**
|
|
1493
|
-
*
|
|
1470
|
+
* 生成一个介于两个坐标之间的随机坐标
|
|
1494
1471
|
*
|
|
1495
|
-
* @param
|
|
1496
|
-
* @
|
|
1497
|
-
* @
|
|
1472
|
+
* @param start 起始坐标,包含x和y属性
|
|
1473
|
+
* @param end 结束坐标,包含x和y属性
|
|
1474
|
+
* @returns 返回一个包含x和y属性的随机坐标
|
|
1498
1475
|
*/
|
|
1499
|
-
static
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
const b = parseInt(rgbaMatch[3], 10);
|
|
1505
|
-
const a = rgbaMatch[5] ? parseFloat(rgbaMatch[5]) : 1;
|
|
1506
|
-
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
|
+
};
|
|
1507
1481
|
}
|
|
1508
1482
|
/**
|
|
1509
|
-
*
|
|
1483
|
+
* 对坐标数组进行解构并应用函数处理
|
|
1510
1484
|
*
|
|
1511
|
-
* @param
|
|
1512
|
-
* @
|
|
1485
|
+
* @param arr 待解构的数组
|
|
1486
|
+
* @param fn 处理函数
|
|
1487
|
+
* @param context 函数执行上下文,可选
|
|
1488
|
+
* @returns 处理后的数组
|
|
1513
1489
|
*/
|
|
1514
|
-
static
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
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
|
+
}
|
|
1521
1506
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
return
|
|
1507
|
+
return result;
|
|
1508
|
+
}
|
|
1509
|
+
static coordinate2LngLat(coordinate) {
|
|
1510
|
+
return { lng: coordinate.x, lat: coordinate.y };
|
|
1526
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 = {
|
|
1527
1525
|
/**
|
|
1528
|
-
*
|
|
1526
|
+
* 获取元素的样式值
|
|
1529
1527
|
*
|
|
1530
|
-
* @param
|
|
1531
|
-
* @
|
|
1528
|
+
* @param el 元素对象
|
|
1529
|
+
* @param style 样式属性名称
|
|
1530
|
+
* @returns 元素的样式值,如果获取不到则返回 null
|
|
1532
1531
|
*/
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
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;
|
|
1537
1539
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
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);
|
|
1549
1555
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
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);
|
|
1559
1567
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1568
|
+
},
|
|
1569
|
+
/**
|
|
1570
|
+
* 清空给定元素的子节点
|
|
1571
|
+
*
|
|
1572
|
+
* @param el 要清空子节点的元素,包含firstChild和removeChild属性
|
|
1573
|
+
*/
|
|
1574
|
+
empty(el) {
|
|
1575
|
+
while (el.firstChild) {
|
|
1576
|
+
el.removeChild(el.firstChild);
|
|
1566
1577
|
}
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1578
|
+
},
|
|
1569
1579
|
/**
|
|
1570
|
-
*
|
|
1580
|
+
* 将元素移到父节点的最前面
|
|
1571
1581
|
*
|
|
1572
|
-
* @param
|
|
1573
|
-
* @returns 返回创建的颜色对象
|
|
1574
|
-
* @throws 当颜色值无效时,抛出错误
|
|
1582
|
+
* @param el 要移动的元素,需要包含 parentNode 属性
|
|
1575
1583
|
*/
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
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));
|
|
1585
1656
|
} else {
|
|
1586
|
-
|
|
1657
|
+
this.setClass(el, (" " + this.getClass(el) + " ").replace(" " + name + " ", " ").trim());
|
|
1587
1658
|
}
|
|
1588
|
-
}
|
|
1659
|
+
},
|
|
1589
1660
|
/**
|
|
1590
|
-
*
|
|
1661
|
+
* 设置元素的 CSS 类名
|
|
1591
1662
|
*
|
|
1592
|
-
* @param
|
|
1593
|
-
* @param
|
|
1594
|
-
* @param b 蓝色分量值,取值范围0-255
|
|
1595
|
-
* @param a 可选参数,透明度分量值,取值范围0-1
|
|
1596
|
-
* @returns 十六进制颜色值,格式为#RRGGBB或#RRGGBBAA
|
|
1663
|
+
* @param el HTML 或 SVG 元素
|
|
1664
|
+
* @param name 要设置的类名,多个类名之间用空格分隔
|
|
1597
1665
|
*/
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
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));
|
|
1603
1670
|
}
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
static isColor(a) {
|
|
1616
|
-
return this.isHex(a) || this.isRgb(a) || this.isHsl(a);
|
|
1617
|
-
}
|
|
1618
|
-
static random() {
|
|
1619
|
-
let r = Math.floor(Math.random() * 256);
|
|
1620
|
-
let g = Math.floor(Math.random() * 256);
|
|
1621
|
-
let b = Math.floor(Math.random() * 256);
|
|
1622
|
-
let a = Math.random();
|
|
1623
|
-
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];
|
|
1624
1682
|
}
|
|
1625
|
-
}
|
|
1683
|
+
};
|
|
1626
1684
|
const TYPES = ["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"];
|
|
1627
1685
|
const GeoJsonUtil = {
|
|
1628
1686
|
/**
|
|
@@ -1865,862 +1923,400 @@ const GeoJsonUtil = {
|
|
|
1865
1923
|
};
|
|
1866
1924
|
}
|
|
1867
1925
|
};
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
}
|
|
1874
|
-
});
|
|
1875
|
-
},
|
|
1876
|
-
assertInteger(...arg) {
|
|
1877
|
-
arg.forEach((a) => {
|
|
1878
|
-
if (!Util.isInteger(a)) {
|
|
1879
|
-
ExceptionUtil.throwIntegerException(a);
|
|
1880
|
-
}
|
|
1881
|
-
});
|
|
1882
|
-
},
|
|
1883
|
-
assertNumber(...arg) {
|
|
1884
|
-
arg.forEach((a) => {
|
|
1885
|
-
if (!Util.isNumber(a)) {
|
|
1886
|
-
ExceptionUtil.throwNumberException(a);
|
|
1887
|
-
}
|
|
1888
|
-
});
|
|
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));
|
|
1889
1931
|
},
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
if (!Util.isArray(a)) {
|
|
1893
|
-
ExceptionUtil.throwArrayException(a);
|
|
1894
|
-
}
|
|
1895
|
-
});
|
|
1932
|
+
randFloat(low, high) {
|
|
1933
|
+
return low + Math.random() * (high - low);
|
|
1896
1934
|
},
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1935
|
+
/**
|
|
1936
|
+
* 角度转弧度
|
|
1937
|
+
*
|
|
1938
|
+
* @param {*} degrees
|
|
1939
|
+
* @returns {*}
|
|
1940
|
+
*/
|
|
1941
|
+
deg2Rad(degrees) {
|
|
1942
|
+
return degrees * this.DEG2RAD;
|
|
1903
1943
|
},
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1944
|
+
/**
|
|
1945
|
+
* 弧度转角度
|
|
1946
|
+
*
|
|
1947
|
+
* @param {*} radians
|
|
1948
|
+
* @returns {*}
|
|
1949
|
+
*/
|
|
1950
|
+
rad2Deg(radians) {
|
|
1951
|
+
return radians * this.RAD2DEG;
|
|
1910
1952
|
},
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
if (!GeoUtil.isLnglat(a.lng, a.lat)) {
|
|
1914
|
-
ExceptionUtil.throwCoordinateException(JSON.stringify(a));
|
|
1915
|
-
}
|
|
1916
|
-
});
|
|
1953
|
+
round(value, n = 2) {
|
|
1954
|
+
return Util.isNumber(value) ? Math.round(Number(value) * Math.pow(10, n)) / Math.pow(10, n) : 0;
|
|
1917
1955
|
},
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
for (let i = 0, l = len; i < l; i++) {
|
|
1929
|
-
res = str.indexOf(args[i]) >= 0;
|
|
1930
|
-
}
|
|
1931
|
-
if (res) {
|
|
1932
|
-
throw Error(ErrorType.STRING_CHECK_LOSS + " -> " + str);
|
|
1933
|
-
}
|
|
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));
|
|
1934
1966
|
},
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
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`;
|
|
1938
1974
|
}
|
|
1939
1975
|
},
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
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²`;
|
|
1943
1983
|
}
|
|
1944
1984
|
}
|
|
1945
1985
|
};
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
const arr = [];
|
|
1958
|
-
const obj = {};
|
|
1959
|
-
this.forEach((item) => {
|
|
1960
|
-
const val = f(item);
|
|
1961
|
-
const key = String(val);
|
|
1962
|
-
if (!obj[key]) {
|
|
1963
|
-
obj[key] = true;
|
|
1964
|
-
arr.push(item);
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
return arr;
|
|
1968
|
-
};
|
|
1969
|
-
myArray.prototype.max = function(f = (d) => d) {
|
|
1970
|
-
return this.desc(f)[0];
|
|
1971
|
-
};
|
|
1972
|
-
myArray.prototype.min = function(f = (d) => d) {
|
|
1973
|
-
return this.asc(f)[0];
|
|
1974
|
-
};
|
|
1975
|
-
myArray.prototype.sum = function(f = (d) => d) {
|
|
1976
|
-
return this.length === 1 ? f(this[0]) : this.length > 1 ? this.reduce((prev = 0, curr = 0) => f(prev) + f(curr)) : 0;
|
|
1977
|
-
};
|
|
1978
|
-
myArray.prototype.avg = function(f = (d) => d) {
|
|
1979
|
-
return this.length ? this.sum(f) / this.length : 0;
|
|
1980
|
-
};
|
|
1981
|
-
myArray.prototype.desc = function(f = (d) => d) {
|
|
1982
|
-
return this.sort((n1, n2) => f(n2) - f(n1));
|
|
1983
|
-
};
|
|
1984
|
-
myArray.prototype.asc = function(f = (d) => d) {
|
|
1985
|
-
return this.sort((n1, n2) => f(n1) - f(n2));
|
|
1986
|
-
};
|
|
1987
|
-
myArray.prototype.random = function() {
|
|
1988
|
-
return this[Math.floor(Math.random() * this.length)];
|
|
1989
|
-
};
|
|
1990
|
-
myArray.prototype.remove = function(f = (d) => d) {
|
|
1991
|
-
const i = this.findIndex(f);
|
|
1992
|
-
if (i > -1) {
|
|
1993
|
-
this.splice(i, 1);
|
|
1994
|
-
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);
|
|
1995
1997
|
}
|
|
1996
|
-
return this;
|
|
1997
|
-
};
|
|
1998
|
-
const ArrayUtil = {
|
|
1999
1998
|
/**
|
|
2000
|
-
*
|
|
1999
|
+
* 计算两哥平面坐标点间的距离
|
|
2001
2000
|
*
|
|
2002
|
-
* @param
|
|
2003
|
-
* @
|
|
2001
|
+
* @param p1 坐标点1,包含x和y属性
|
|
2002
|
+
* @param p2 坐标点2,包含x和y属性
|
|
2003
|
+
* @returns 返回两点间的欧几里得距离
|
|
2004
2004
|
*/
|
|
2005
|
-
|
|
2006
|
-
return
|
|
2007
|
-
}
|
|
2005
|
+
static distance(p1, p2) {
|
|
2006
|
+
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
|
2007
|
+
}
|
|
2008
2008
|
/**
|
|
2009
|
-
*
|
|
2009
|
+
* 计算两个点之间的距离
|
|
2010
2010
|
*
|
|
2011
|
-
* @param
|
|
2012
|
-
* @
|
|
2011
|
+
* @param A 点A,包含x和y两个属性
|
|
2012
|
+
* @param B 点B,包含x和y两个属性
|
|
2013
|
+
* @returns 返回两点之间的距离,单位为米
|
|
2013
2014
|
*/
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
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
|
+
}
|
|
2023
2028
|
/**
|
|
2024
|
-
*
|
|
2029
|
+
* 格式化经纬度为度分秒格式
|
|
2025
2030
|
*
|
|
2026
|
-
* @param
|
|
2027
|
-
* @
|
|
2031
|
+
* @param lng 经度
|
|
2032
|
+
* @param lat 纬度
|
|
2033
|
+
* @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
|
|
2028
2034
|
*/
|
|
2029
|
-
|
|
2030
|
-
let res =
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
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
|
+
}
|
|
2036
2050
|
return res;
|
|
2037
|
-
}
|
|
2051
|
+
}
|
|
2038
2052
|
/**
|
|
2039
|
-
*
|
|
2053
|
+
* 将经纬度字符串转换为度
|
|
2040
2054
|
*
|
|
2041
|
-
* @param
|
|
2042
|
-
* @
|
|
2055
|
+
* @param lng 经度字符串
|
|
2056
|
+
* @param lat 纬度字符串
|
|
2057
|
+
* @returns 转换后的经纬度对象
|
|
2043
2058
|
*/
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
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
|
+
}
|
|
2047
2078
|
/**
|
|
2048
|
-
*
|
|
2079
|
+
* 射线法判断点是否在多边形内
|
|
2049
2080
|
*
|
|
2050
|
-
* @param
|
|
2051
|
-
* @
|
|
2081
|
+
* @param p 点对象,包含x和y属性
|
|
2082
|
+
* @param poly 多边形顶点数组,可以是字符串数组或对象数组
|
|
2083
|
+
* @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
|
|
2052
2084
|
*/
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
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
|
+
}
|
|
2057
2104
|
/**
|
|
2058
|
-
*
|
|
2105
|
+
* 旋转点
|
|
2059
2106
|
*
|
|
2060
|
-
* @param
|
|
2061
|
-
* @
|
|
2107
|
+
* @param p1 旋转前点坐标
|
|
2108
|
+
* @param p2 旋转中心坐标
|
|
2109
|
+
* @param θ 旋转角度(顺时针旋转为正)
|
|
2110
|
+
* @returns 旋转后点坐标
|
|
2062
2111
|
*/
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
}
|
|
2067
|
-
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 };
|
|
2068
2116
|
}
|
|
2069
|
-
};
|
|
2070
|
-
class BrowserUtil {
|
|
2071
2117
|
/**
|
|
2072
|
-
*
|
|
2118
|
+
* 根据两个平面坐标点计算方位角和距离
|
|
2073
2119
|
*
|
|
2074
|
-
* @
|
|
2120
|
+
* @param p1 第一个点的坐标对象
|
|
2121
|
+
* @param p2 第二个点的坐标对象
|
|
2122
|
+
* @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
|
|
2123
|
+
* 正北为0°,顺时针增加
|
|
2075
2124
|
*/
|
|
2076
|
-
static
|
|
2077
|
-
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
version = ((_c = userAgent.match(/MSIE ([\d.]+)/)) == null ? void 0 : _c[1]) || ((_d = userAgent.match(/rv:([\d.]+)/)) == null ? void 0 : _d[1]) || "";
|
|
2086
|
-
} else if (userAgent.includes("Linux") || userAgent.includes("X11")) {
|
|
2087
|
-
type = "Linux";
|
|
2088
|
-
version = ((_e = userAgent.match(/Linux ([\d.]+)/)) == null ? void 0 : _e[1]) || "";
|
|
2089
|
-
} else if (userAgent.includes("Ubuntu")) {
|
|
2090
|
-
type = "Ubuntu";
|
|
2091
|
-
version = ((_f = userAgent.match(/Ubuntu ([\d.]+)/)) == null ? void 0 : _f[1]) || "";
|
|
2092
|
-
} else if (userAgent.includes("Windows")) {
|
|
2093
|
-
let v = ((_g = userAgent.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/)) == null ? void 0 : _g[1]) || "";
|
|
2094
|
-
let hash = {
|
|
2095
|
-
"10.0": "10",
|
|
2096
|
-
"6.4": "10 Technical Preview",
|
|
2097
|
-
"6.3": "8.1",
|
|
2098
|
-
"6.2": "8",
|
|
2099
|
-
"6.1": "7",
|
|
2100
|
-
"6.0": "Vista",
|
|
2101
|
-
"5.2": "XP 64-bit",
|
|
2102
|
-
"5.1": "XP",
|
|
2103
|
-
"5.01": "2000 SP1",
|
|
2104
|
-
"5.0": "2000",
|
|
2105
|
-
"4.0": "NT",
|
|
2106
|
-
"4.90": "ME"
|
|
2107
|
-
};
|
|
2108
|
-
type = "Windows";
|
|
2109
|
-
version = v in hash ? hash[v] : v;
|
|
2110
|
-
} else if (userAgent.includes("like Mac OS X")) {
|
|
2111
|
-
type = "IOS";
|
|
2112
|
-
version = ((_h = userAgent.match(/OS ([\d_]+) like/)) == null ? void 0 : _h[1].replace(/_/g, ".")) || "";
|
|
2113
|
-
} else if (userAgent.includes("Macintosh")) {
|
|
2114
|
-
type = "macOS";
|
|
2115
|
-
version = ((_i = userAgent.match(/Mac OS X -?([\d_]+)/)) == null ? void 0 : _i[1].replace(/_/g, ".")) || "";
|
|
2116
|
-
}
|
|
2117
|
-
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 };
|
|
2118
2134
|
}
|
|
2119
2135
|
/**
|
|
2120
|
-
*
|
|
2136
|
+
* 根据两个经纬度点计算方位角和距离
|
|
2121
2137
|
*
|
|
2122
|
-
* @
|
|
2138
|
+
* @param latlng1 第一个经纬度点
|
|
2139
|
+
* @param latlng2 第二个经纬度点
|
|
2140
|
+
* @returns 包含方位角和距离的对象
|
|
2123
2141
|
*/
|
|
2124
|
-
static
|
|
2125
|
-
var
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
} else if (/Edge/.test(userAgent)) {
|
|
2135
|
-
let matches = /Edge\/(\d+\.\d+)/.exec(userAgent);
|
|
2136
|
-
if (matches) {
|
|
2137
|
-
type = "Edge";
|
|
2138
|
-
version = matches[1];
|
|
2139
|
-
}
|
|
2140
|
-
} else if (/Chrome/.test(userAgent) && /Google Inc/.test(this.navigator.vendor)) {
|
|
2141
|
-
let matches = /Chrome\/(\d+\.\d+)/.exec(userAgent);
|
|
2142
|
-
if (matches) {
|
|
2143
|
-
type = "Chrome";
|
|
2144
|
-
version = matches[1];
|
|
2145
|
-
}
|
|
2146
|
-
} else if (/Firefox/.test(userAgent)) {
|
|
2147
|
-
let matches = /Firefox\/(\d+\.\d+)/.exec(userAgent);
|
|
2148
|
-
if (matches) {
|
|
2149
|
-
type = "Firefox";
|
|
2150
|
-
version = matches[1];
|
|
2151
|
-
}
|
|
2152
|
-
} else if (/Safari/.test(userAgent) && /Apple Computer/.test(this.navigator.vendor)) {
|
|
2153
|
-
let matches = /Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(userAgent);
|
|
2154
|
-
if (matches) {
|
|
2155
|
-
type = "Safari";
|
|
2156
|
-
version = matches[1];
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
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;
|
|
2159
2152
|
return {
|
|
2160
|
-
|
|
2161
|
-
|
|
2153
|
+
angle,
|
|
2154
|
+
distance
|
|
2162
2155
|
};
|
|
2163
2156
|
}
|
|
2164
2157
|
/**
|
|
2165
|
-
*
|
|
2158
|
+
* 计算点P到线段P1P2的最短距离
|
|
2166
2159
|
*
|
|
2167
|
-
* @
|
|
2160
|
+
* @param p 点P的坐标
|
|
2161
|
+
* @param p1 线段起点P1的坐标
|
|
2162
|
+
* @param p2 线段终点P2的坐标
|
|
2163
|
+
* @returns 点P到线段P1P2的最短距离
|
|
2168
2164
|
*/
|
|
2169
|
-
static
|
|
2170
|
-
|
|
2171
|
-
|
|
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));
|
|
2172
2170
|
}
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2175
|
-
|
|
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));
|
|
2176
2179
|
}
|
|
2177
2180
|
/**
|
|
2178
|
-
*
|
|
2181
|
+
* 根据给定的经纬度、角度和距离计算新的经纬度点
|
|
2179
2182
|
*
|
|
2180
|
-
* @
|
|
2183
|
+
* @param latlng 给定的经纬度点,类型为LngLat
|
|
2184
|
+
* @param angle 角度值,单位为度,表示从当前点出发的方向
|
|
2185
|
+
* @param distance 距离值,单位为米,表示从当前点出发的距离
|
|
2186
|
+
* @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
|
|
2181
2187
|
*/
|
|
2182
|
-
static
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
let debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
2190
|
-
if (debugInfo) {
|
|
2191
|
-
let gpu_str = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
|
2192
|
-
type = (gpu_str.match(/ANGLE \((.+?),/) || [])[1] || "";
|
|
2193
|
-
model = (gpu_str.match(/, (.+?) (\(|vs_)/) || [])[1] || "";
|
|
2194
|
-
}
|
|
2195
|
-
return {
|
|
2196
|
-
type,
|
|
2197
|
-
model,
|
|
2198
|
-
spec: {
|
|
2199
|
-
maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),
|
|
2200
|
-
// 最大纹理尺寸 16384/4k
|
|
2201
|
-
maxRenderBufferSize: gl.getParameter(gl.MAX_RENDERBUFFER_SIZE),
|
|
2202
|
-
// 最大渲染缓冲尺寸 16384/4k
|
|
2203
|
-
maxTextureUnits: gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
|
|
2204
|
-
// 纹理单元数量 32
|
|
2205
|
-
}
|
|
2206
|
-
};
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
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));
|
|
2209
2195
|
return {
|
|
2210
|
-
|
|
2211
|
-
|
|
2196
|
+
lat: MathUtil.rad2Deg(lat),
|
|
2197
|
+
lng: MathUtil.rad2Deg(lon)
|
|
2212
2198
|
};
|
|
2213
2199
|
}
|
|
2214
2200
|
/**
|
|
2215
|
-
*
|
|
2201
|
+
* 将墨卡托坐标转换为经纬度坐标
|
|
2216
2202
|
*
|
|
2217
|
-
* @
|
|
2203
|
+
* @param x 墨卡托坐标的x值
|
|
2204
|
+
* @param y 墨卡托坐标的y值
|
|
2205
|
+
* @returns 返回包含转换后的经度lng和纬度lat的对象
|
|
2218
2206
|
*/
|
|
2219
|
-
static
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
if (arr[1]) {
|
|
2225
|
-
arr[1] = arr[1].toUpperCase();
|
|
2226
|
-
}
|
|
2227
|
-
let language = arr.join("_");
|
|
2228
|
-
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 };
|
|
2229
2212
|
}
|
|
2230
2213
|
/**
|
|
2231
|
-
*
|
|
2214
|
+
* 将经纬度坐标转换为墨卡托坐标
|
|
2232
2215
|
*
|
|
2233
|
-
* @
|
|
2216
|
+
* @param lng 经度值
|
|
2217
|
+
* @param lat 纬度值
|
|
2218
|
+
* @returns 墨卡托坐标对象,包含x和y属性
|
|
2234
2219
|
*/
|
|
2235
|
-
static
|
|
2236
|
-
var
|
|
2237
|
-
|
|
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 };
|
|
2238
2226
|
}
|
|
2239
2227
|
/**
|
|
2240
|
-
*
|
|
2228
|
+
* 计算三角形面积
|
|
2241
2229
|
*
|
|
2242
|
-
* @
|
|
2243
|
-
*
|
|
2230
|
+
* @param a 第一个点的坐标
|
|
2231
|
+
* @param b 第二个点的坐标
|
|
2232
|
+
* @param c 第三个点的坐标
|
|
2233
|
+
* @returns 返回三角形的面积
|
|
2244
2234
|
*/
|
|
2245
|
-
static
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
} else {
|
|
2258
|
-
list.sort();
|
|
2259
|
-
list = list.slice(1, 11);
|
|
2260
|
-
let sum = list.reduce((a, b) => a + b);
|
|
2261
|
-
const fps = Math.round(1e4 / sum / 10) * 10;
|
|
2262
|
-
resolve(fps);
|
|
2263
|
-
}
|
|
2264
|
-
} else {
|
|
2265
|
-
lastTime = timestamp;
|
|
2266
|
-
requestAnimationFrame(tick);
|
|
2267
|
-
}
|
|
2268
|
-
};
|
|
2269
|
-
requestAnimationFrame(tick);
|
|
2270
|
-
});
|
|
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;
|
|
2271
2247
|
}
|
|
2272
2248
|
/**
|
|
2273
|
-
*
|
|
2249
|
+
* 计算多边形的质心坐标
|
|
2274
2250
|
*
|
|
2275
|
-
* @
|
|
2251
|
+
* @param coords 多边形顶点坐标数组,支持Coordinate[]或LngLat[]两种格式
|
|
2252
|
+
* @returns 返回质心坐标,包含x和y属性
|
|
2276
2253
|
*/
|
|
2277
|
-
static
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
for (const regex of [reg["IPv4"], reg["IPv6"]]) {
|
|
2289
|
-
const match = candidate.match(regex);
|
|
2290
|
-
if (match) {
|
|
2291
|
-
ipSet.add(match[0]);
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
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;
|
|
2294
2265
|
}
|
|
2266
|
+
}
|
|
2267
|
+
return {
|
|
2268
|
+
x: xSum / n,
|
|
2269
|
+
y: ySum / n
|
|
2295
2270
|
};
|
|
2296
|
-
return new Promise(function(resolve, reject) {
|
|
2297
|
-
const conn = new RTCPeerConnection({
|
|
2298
|
-
iceServers: [
|
|
2299
|
-
{
|
|
2300
|
-
urls: "stun:stun.l.google.com:19302"
|
|
2301
|
-
},
|
|
2302
|
-
{
|
|
2303
|
-
urls: "stun:stun.services.mozilla.com"
|
|
2304
|
-
}
|
|
2305
|
-
]
|
|
2306
|
-
});
|
|
2307
|
-
conn.addEventListener("icecandidate", onicecandidate);
|
|
2308
|
-
conn.createDataChannel("");
|
|
2309
|
-
conn.createOffer().then((offer) => conn.setLocalDescription(offer), reject);
|
|
2310
|
-
let count = 20;
|
|
2311
|
-
let hander;
|
|
2312
|
-
let closeConnect = function() {
|
|
2313
|
-
try {
|
|
2314
|
-
conn.removeEventListener("icecandidate", onicecandidate);
|
|
2315
|
-
conn.close();
|
|
2316
|
-
} catch {
|
|
2317
|
-
}
|
|
2318
|
-
hander && clearInterval(hander);
|
|
2319
|
-
};
|
|
2320
|
-
hander = window.setInterval(function() {
|
|
2321
|
-
let ips = [...ipSet];
|
|
2322
|
-
if (ips.length) {
|
|
2323
|
-
closeConnect();
|
|
2324
|
-
resolve(ips[0]);
|
|
2325
|
-
} else if (count) {
|
|
2326
|
-
count--;
|
|
2327
|
-
} else {
|
|
2328
|
-
closeConnect();
|
|
2329
|
-
resolve("");
|
|
2330
|
-
}
|
|
2331
|
-
}, 100);
|
|
2332
|
-
});
|
|
2333
2271
|
}
|
|
2334
2272
|
/**
|
|
2335
|
-
*
|
|
2273
|
+
* 根据百分比获取坐标
|
|
2336
2274
|
*
|
|
2337
|
-
* @
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2340
|
-
*
|
|
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 返回插值点坐标,类型与输入参数保持一致
|
|
2341
2279
|
*/
|
|
2342
|
-
static
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
}
|
|
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 };
|
|
2351
2289
|
}
|
|
2352
|
-
let isOnline = ((_b = this.navigator) == null ? void 0 : _b.onLine) || false;
|
|
2353
|
-
let ip = await this.getIPAddress();
|
|
2354
|
-
return {
|
|
2355
|
-
network,
|
|
2356
|
-
isOnline,
|
|
2357
|
-
ip
|
|
2358
|
-
};
|
|
2359
2290
|
}
|
|
2360
2291
|
}
|
|
2361
|
-
__publicField(
|
|
2362
|
-
__publicField(
|
|
2363
|
-
|
|
2364
|
-
__publicField(
|
|
2365
|
-
|
|
2366
|
-
static delta(lat, lng) {
|
|
2367
|
-
const a = 6378245;
|
|
2368
|
-
const ee = 0.006693421622965943;
|
|
2369
|
-
let dLat = this.transformLat(lng - 105, lat - 35);
|
|
2370
|
-
let dLon = this.transformLon(lng - 105, lat - 35);
|
|
2371
|
-
const radLat = lat / 180 * this.PI;
|
|
2372
|
-
let magic = Math.sin(radLat);
|
|
2373
|
-
magic = 1 - ee * magic * magic;
|
|
2374
|
-
const sqrtMagic = Math.sqrt(magic);
|
|
2375
|
-
dLat = dLat * 180 / (a * (1 - ee) / (magic * sqrtMagic) * this.PI);
|
|
2376
|
-
dLon = dLon * 180 / (a / sqrtMagic * Math.cos(radLat) * this.PI);
|
|
2377
|
-
return { lat: dLat, lng: dLon };
|
|
2378
|
-
}
|
|
2292
|
+
__publicField(GeoUtil, "toRadian", Math.PI / 180);
|
|
2293
|
+
__publicField(GeoUtil, "R", 6371393);
|
|
2294
|
+
// 地球平均半径
|
|
2295
|
+
__publicField(GeoUtil, "R_EQU", 6378137);
|
|
2296
|
+
const FileUtil = {
|
|
2379
2297
|
/**
|
|
2380
|
-
*
|
|
2298
|
+
* 将Base64编码的字符串转换为Blob对象
|
|
2381
2299
|
*
|
|
2382
|
-
* @param
|
|
2383
|
-
* @
|
|
2384
|
-
* @returns 如果经纬度不在中国境内则返回true,否则返回false
|
|
2300
|
+
* @param data Base64编码的字符串
|
|
2301
|
+
* @returns 转换后的Blob对象
|
|
2385
2302
|
*/
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
}
|
|
2393
|
-
return false;
|
|
2394
|
-
}
|
|
2395
|
-
// WGS-84 to GCJ-02
|
|
2396
|
-
static gcjEncrypt(wgsLat, wgsLon) {
|
|
2397
|
-
if (this.outOfChina(wgsLat, wgsLon)) {
|
|
2398
|
-
return { lat: wgsLat, lng: wgsLon };
|
|
2399
|
-
}
|
|
2400
|
-
const d = this.delta(wgsLat, wgsLon);
|
|
2401
|
-
return { lat: wgsLat + d.lat, lng: wgsLon + d.lng };
|
|
2402
|
-
}
|
|
2403
|
-
// GCJ-02 to WGS-84
|
|
2404
|
-
static gcjDecrypt(gcjLat, gcjLon) {
|
|
2405
|
-
if (this.outOfChina(gcjLat, gcjLon)) {
|
|
2406
|
-
return { lat: gcjLat, lng: gcjLon };
|
|
2407
|
-
}
|
|
2408
|
-
const d = this.delta(gcjLat, gcjLon);
|
|
2409
|
-
return { lat: gcjLat - d.lat, lng: gcjLon - d.lng };
|
|
2410
|
-
}
|
|
2411
|
-
// GCJ-02 to WGS-84 exactly
|
|
2412
|
-
static gcjDecryptExact(gcjLat, gcjLon) {
|
|
2413
|
-
const initDelta = 0.01;
|
|
2414
|
-
const threshold = 1e-9;
|
|
2415
|
-
let dLat = initDelta;
|
|
2416
|
-
let dLon = initDelta;
|
|
2417
|
-
let mLat = gcjLat - dLat;
|
|
2418
|
-
let mLon = gcjLon - dLon;
|
|
2419
|
-
let pLat = gcjLat + dLat;
|
|
2420
|
-
let pLon = gcjLon + dLon;
|
|
2421
|
-
let wgsLat = 0;
|
|
2422
|
-
let wgsLon = 0;
|
|
2423
|
-
let i = 0;
|
|
2424
|
-
while (1) {
|
|
2425
|
-
wgsLat = (mLat + pLat) / 2;
|
|
2426
|
-
wgsLon = (mLon + pLon) / 2;
|
|
2427
|
-
const tmp = this.gcjEncrypt(wgsLat, wgsLon);
|
|
2428
|
-
dLat = tmp.lat - gcjLat;
|
|
2429
|
-
dLon = tmp.lng - gcjLon;
|
|
2430
|
-
if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
|
|
2431
|
-
break;
|
|
2432
|
-
}
|
|
2433
|
-
if (dLat > 0) pLat = wgsLat;
|
|
2434
|
-
else mLat = wgsLat;
|
|
2435
|
-
if (dLon > 0) pLon = wgsLon;
|
|
2436
|
-
else mLon = wgsLon;
|
|
2437
|
-
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);
|
|
2438
2309
|
}
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
const x = gcjLon;
|
|
2444
|
-
const y = gcjLat;
|
|
2445
|
-
const z = Math.sqrt(x * x + y * y) + 2e-5 * Math.sin(y * this.XPI);
|
|
2446
|
-
const theta = Math.atan2(y, x) + 3e-6 * Math.cos(x * this.XPI);
|
|
2447
|
-
const bdLon = z * Math.cos(theta) + 65e-4;
|
|
2448
|
-
const bdLat = z * Math.sin(theta) + 6e-3;
|
|
2449
|
-
return { lat: bdLat, lng: bdLon };
|
|
2450
|
-
}
|
|
2451
|
-
// BD-09 to GCJ-02
|
|
2452
|
-
static bdDecrypt(bdLat, bdLon) {
|
|
2453
|
-
const x = bdLon - 65e-4;
|
|
2454
|
-
const y = bdLat - 6e-3;
|
|
2455
|
-
const z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * this.XPI);
|
|
2456
|
-
const theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * this.XPI);
|
|
2457
|
-
const gcjLon = z * Math.cos(theta);
|
|
2458
|
-
const gcjLat = z * Math.sin(theta);
|
|
2459
|
-
return { lat: gcjLat, lng: gcjLon };
|
|
2460
|
-
}
|
|
2461
|
-
// WGS-84 to Web mercator
|
|
2462
|
-
// mercatorLat -> y mercatorLon -> x
|
|
2463
|
-
static mercatorEncrypt(wgsLat, wgsLon) {
|
|
2464
|
-
const x = wgsLon * 2003750834e-2 / 180;
|
|
2465
|
-
let y = Math.log(Math.tan((90 + wgsLat) * this.PI / 360)) / (this.PI / 180);
|
|
2466
|
-
y = y * 2003750834e-2 / 180;
|
|
2467
|
-
return { lat: y, lng: x };
|
|
2468
|
-
}
|
|
2469
|
-
// Web mercator to WGS-84
|
|
2470
|
-
// mercatorLat -> y mercatorLon -> x
|
|
2471
|
-
static mercatorDecrypt(mercatorLat, mercatorLon) {
|
|
2472
|
-
const x = mercatorLon / 2003750834e-2 * 180;
|
|
2473
|
-
let y = mercatorLat / 2003750834e-2 * 180;
|
|
2474
|
-
y = 180 / this.PI * (2 * Math.atan(Math.exp(y * this.PI / 180)) - this.PI / 2);
|
|
2475
|
-
return { lat: y, lng: x };
|
|
2476
|
-
}
|
|
2477
|
-
static transformLat(x, y) {
|
|
2478
|
-
let ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
|
|
2479
|
-
ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
|
|
2480
|
-
ret += (20 * Math.sin(y * this.PI) + 40 * Math.sin(y / 3 * this.PI)) * 2 / 3;
|
|
2481
|
-
ret += (160 * Math.sin(y / 12 * this.PI) + 320 * Math.sin(y * this.PI / 30)) * 2 / 3;
|
|
2482
|
-
return ret;
|
|
2483
|
-
}
|
|
2484
|
-
static transformLon(x, y) {
|
|
2485
|
-
let ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
|
|
2486
|
-
ret += (20 * Math.sin(6 * x * this.PI) + 20 * Math.sin(2 * x * this.PI)) * 2 / 3;
|
|
2487
|
-
ret += (20 * Math.sin(x * this.PI) + 40 * Math.sin(x / 3 * this.PI)) * 2 / 3;
|
|
2488
|
-
ret += (150 * Math.sin(x / 12 * this.PI) + 300 * Math.sin(x / 30 * this.PI)) * 2 / 3;
|
|
2489
|
-
return ret;
|
|
2490
|
-
}
|
|
2310
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
2311
|
+
const blob = new Blob([byteArray], { type: mimeString });
|
|
2312
|
+
return blob;
|
|
2313
|
+
},
|
|
2491
2314
|
/**
|
|
2492
|
-
*
|
|
2315
|
+
* 将base64字符串转换为文件对象
|
|
2493
2316
|
*
|
|
2494
|
-
* @param
|
|
2495
|
-
* @param
|
|
2496
|
-
* @returns
|
|
2497
|
-
*/
|
|
2498
|
-
static random({ x: minX, y: minY }, { x: maxX, y: maxY }) {
|
|
2499
|
-
return {
|
|
2500
|
-
x: Math.random() * (maxX - minX) + minX,
|
|
2501
|
-
y: Math.random() * (maxY - minY) + minY
|
|
2502
|
-
};
|
|
2503
|
-
}
|
|
2504
|
-
/**
|
|
2505
|
-
* 对坐标数组进行解构并应用函数处理
|
|
2506
|
-
*
|
|
2507
|
-
* @param arr 待解构的数组
|
|
2508
|
-
* @param fn 处理函数
|
|
2509
|
-
* @param context 函数执行上下文,可选
|
|
2510
|
-
* @returns 处理后的数组
|
|
2511
|
-
*/
|
|
2512
|
-
static deCompose(arr, fn, context) {
|
|
2513
|
-
const result = [];
|
|
2514
|
-
if (arr instanceof Array && !(arr[0] instanceof Array)) {
|
|
2515
|
-
fn(arr);
|
|
2516
|
-
} else if (arr instanceof Array && arr[0] instanceof Array) {
|
|
2517
|
-
for (let i = 0; i < arr.length; i++) {
|
|
2518
|
-
const d = arr[i];
|
|
2519
|
-
if (Util.isNil(d)) continue;
|
|
2520
|
-
if (d[0] instanceof Array) {
|
|
2521
|
-
const p = context ? this.deCompose(d, (d2) => fn(d2), context) : this.deCompose(d, (d2) => fn(d2));
|
|
2522
|
-
result.push(p);
|
|
2523
|
-
} else {
|
|
2524
|
-
const p = context ? fn.call(context, d) : fn(d);
|
|
2525
|
-
result.push(p);
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
return result;
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
__publicField(CoordsUtil, "PI", 3.141592653589793);
|
|
2533
|
-
__publicField(CoordsUtil, "XPI", 3.141592653589793 * 3e3 / 180);
|
|
2534
|
-
function trim(str) {
|
|
2535
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
|
2536
|
-
}
|
|
2537
|
-
function splitWords(str) {
|
|
2538
|
-
return trim(str).split(/\s+/);
|
|
2539
|
-
}
|
|
2540
|
-
const DomUtil = {
|
|
2541
|
-
/**
|
|
2542
|
-
* 获取元素的样式值
|
|
2543
|
-
*
|
|
2544
|
-
* @param el 元素对象
|
|
2545
|
-
* @param style 样式属性名称
|
|
2546
|
-
* @returns 元素的样式值,如果获取不到则返回 null
|
|
2547
|
-
*/
|
|
2548
|
-
getStyle(el, style) {
|
|
2549
|
-
var _a2;
|
|
2550
|
-
let value = el.style[style];
|
|
2551
|
-
if (!value || value === "auto") {
|
|
2552
|
-
const css = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(el, null);
|
|
2553
|
-
value = css ? css[style] : null;
|
|
2554
|
-
if (value === "auto") value = null;
|
|
2555
|
-
}
|
|
2556
|
-
return value;
|
|
2557
|
-
},
|
|
2558
|
-
/**
|
|
2559
|
-
* 创建一个HTML元素
|
|
2560
|
-
*
|
|
2561
|
-
* @param tagName 元素标签名
|
|
2562
|
-
* @param className 元素类名
|
|
2563
|
-
* @param container 父容器,若传入,则新创建的元素会被添加到该容器中
|
|
2564
|
-
* @returns 返回新创建的HTML元素
|
|
2565
|
-
*/
|
|
2566
|
-
create(tagName, className, container) {
|
|
2567
|
-
const el = document.createElement(tagName);
|
|
2568
|
-
el.className = className || "";
|
|
2569
|
-
if (container) {
|
|
2570
|
-
container.appendChild(el);
|
|
2571
|
-
}
|
|
2572
|
-
return el;
|
|
2573
|
-
},
|
|
2574
|
-
/**
|
|
2575
|
-
* 从父节点中移除指定元素。
|
|
2576
|
-
*
|
|
2577
|
-
* @param el 要移除的元素对象,必须包含parentNode属性。
|
|
2578
|
-
*/
|
|
2579
|
-
remove(el) {
|
|
2580
|
-
const parent = el.parentNode;
|
|
2581
|
-
if (parent) {
|
|
2582
|
-
parent.removeChild(el);
|
|
2583
|
-
}
|
|
2584
|
-
},
|
|
2585
|
-
/**
|
|
2586
|
-
* 清空给定元素的子节点
|
|
2587
|
-
*
|
|
2588
|
-
* @param el 要清空子节点的元素,包含firstChild和removeChild属性
|
|
2589
|
-
*/
|
|
2590
|
-
empty(el) {
|
|
2591
|
-
while (el.firstChild) {
|
|
2592
|
-
el.removeChild(el.firstChild);
|
|
2593
|
-
}
|
|
2594
|
-
},
|
|
2595
|
-
/**
|
|
2596
|
-
* 将元素移到父节点的最前面
|
|
2597
|
-
*
|
|
2598
|
-
* @param el 要移动的元素,需要包含 parentNode 属性
|
|
2599
|
-
*/
|
|
2600
|
-
toFront(el) {
|
|
2601
|
-
const parent = el.parentNode;
|
|
2602
|
-
if (parent && parent.lastChild !== el) {
|
|
2603
|
-
parent.appendChild(el);
|
|
2604
|
-
}
|
|
2605
|
-
},
|
|
2606
|
-
/**
|
|
2607
|
-
* 将元素移动到其父节点的最前面
|
|
2608
|
-
*
|
|
2609
|
-
* @param el 要移动的元素,需要包含parentNode属性
|
|
2610
|
-
*/
|
|
2611
|
-
toBack(el) {
|
|
2612
|
-
const parent = el.parentNode;
|
|
2613
|
-
if (parent && parent.firstChild !== el) {
|
|
2614
|
-
parent.insertBefore(el, parent.firstChild);
|
|
2615
|
-
}
|
|
2616
|
-
},
|
|
2617
|
-
/**
|
|
2618
|
-
* 获取元素的类名
|
|
2619
|
-
*
|
|
2620
|
-
* @param el 包含对应元素和类名的对象
|
|
2621
|
-
* @param el.correspondingElement 对应的元素
|
|
2622
|
-
* @param el.className 类名对象
|
|
2623
|
-
* @param el.className.baseVal 类名字符串
|
|
2624
|
-
* @returns 返回元素的类名字符串
|
|
2625
|
-
*/
|
|
2626
|
-
getClass(el) {
|
|
2627
|
-
const shadowElement = (el == null ? void 0 : el.host) || el;
|
|
2628
|
-
return shadowElement.className.toString();
|
|
2629
|
-
},
|
|
2630
|
-
/**
|
|
2631
|
-
* 判断元素是否包含指定类名
|
|
2632
|
-
*
|
|
2633
|
-
* @param el 元素对象,包含classList属性,classList属性包含contains方法
|
|
2634
|
-
* @param name 要判断的类名
|
|
2635
|
-
* @returns 返回一个布尔值,表示元素是否包含指定类名
|
|
2636
|
-
*/
|
|
2637
|
-
hasClass(el, name) {
|
|
2638
|
-
var _a2;
|
|
2639
|
-
if ((_a2 = el.classList) == null ? void 0 : _a2.contains(name)) {
|
|
2640
|
-
return true;
|
|
2641
|
-
}
|
|
2642
|
-
const className = this.getClass(el);
|
|
2643
|
-
return className.length > 0 && new RegExp(`(^|\\s)${name}(\\s|$)`).test(className);
|
|
2644
|
-
},
|
|
2645
|
-
/**
|
|
2646
|
-
* 给指定的 HTML 元素添加类名
|
|
2647
|
-
*
|
|
2648
|
-
* @param el 要添加类名的 HTML 元素
|
|
2649
|
-
* @param name 要添加的类名,多个类名之间用空格分隔
|
|
2650
|
-
*/
|
|
2651
|
-
addClass(el, name) {
|
|
2652
|
-
if (el.classList !== void 0) {
|
|
2653
|
-
const classes = splitWords(name);
|
|
2654
|
-
for (let i = 0, len = classes.length; i < len; i++) {
|
|
2655
|
-
el.classList.add(classes[i]);
|
|
2656
|
-
}
|
|
2657
|
-
} else if (!this.hasClass(el, name)) {
|
|
2658
|
-
const className = this.getClass(el);
|
|
2659
|
-
this.setClass(el, (className ? className + " " : "") + name);
|
|
2660
|
-
}
|
|
2661
|
-
},
|
|
2662
|
-
/**
|
|
2663
|
-
* 从元素中移除指定类名
|
|
2664
|
-
*
|
|
2665
|
-
* @param el 要移除类名的元素
|
|
2666
|
-
* @param name 要移除的类名,多个类名用空格分隔
|
|
2667
|
-
*/
|
|
2668
|
-
removeClass(el, name) {
|
|
2669
|
-
if (el.classList !== void 0) {
|
|
2670
|
-
const classes = splitWords(name);
|
|
2671
|
-
classes.forEach((className) => el.classList.remove(className));
|
|
2672
|
-
} else {
|
|
2673
|
-
this.setClass(el, (" " + this.getClass(el) + " ").replace(" " + name + " ", " ").trim());
|
|
2674
|
-
}
|
|
2675
|
-
},
|
|
2676
|
-
/**
|
|
2677
|
-
* 设置元素的 CSS 类名
|
|
2678
|
-
*
|
|
2679
|
-
* @param el HTML 或 SVG 元素
|
|
2680
|
-
* @param name 要设置的类名,多个类名之间用空格分隔
|
|
2681
|
-
*/
|
|
2682
|
-
setClass(el, name) {
|
|
2683
|
-
if ("classList" in el) {
|
|
2684
|
-
el.classList.value = "";
|
|
2685
|
-
name.split(" ").forEach((className) => el.classList.add(className));
|
|
2686
|
-
}
|
|
2687
|
-
},
|
|
2688
|
-
/**
|
|
2689
|
-
* 从字符串中解析XML文档,并返回根节点
|
|
2690
|
-
*
|
|
2691
|
-
* @param str 要解析的XML字符串
|
|
2692
|
-
* @returns 解析后的XML文档的根节点
|
|
2693
|
-
*/
|
|
2694
|
-
parseFromString(str) {
|
|
2695
|
-
const parser = new DOMParser();
|
|
2696
|
-
const doc = parser.parseFromString(str, "text/xml");
|
|
2697
|
-
return doc.children[0];
|
|
2698
|
-
}
|
|
2699
|
-
};
|
|
2700
|
-
const FileUtil = {
|
|
2701
|
-
/**
|
|
2702
|
-
* 将Base64编码的字符串转换为Blob对象
|
|
2703
|
-
*
|
|
2704
|
-
* @param data Base64编码的字符串
|
|
2705
|
-
* @returns 转换后的Blob对象
|
|
2706
|
-
*/
|
|
2707
|
-
convertBase64ToBlob(data) {
|
|
2708
|
-
const mimeString = data.split(",")[0].split(":")[1].split(";")[0];
|
|
2709
|
-
const byteCharacters = atob(data.split(",")[1]);
|
|
2710
|
-
const byteNumbers = new Array(byteCharacters.length);
|
|
2711
|
-
for (let i = 0; i < byteCharacters.length; i++) {
|
|
2712
|
-
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
2713
|
-
}
|
|
2714
|
-
const byteArray = new Uint8Array(byteNumbers);
|
|
2715
|
-
const blob = new Blob([byteArray], { type: mimeString });
|
|
2716
|
-
return blob;
|
|
2717
|
-
},
|
|
2718
|
-
/**
|
|
2719
|
-
* 将base64字符串转换为文件对象
|
|
2720
|
-
*
|
|
2721
|
-
* @param dataurl 包含base64字符串的数据URL
|
|
2722
|
-
* @param filename 文件的名称
|
|
2723
|
-
* @returns 返回文件对象
|
|
2317
|
+
* @param dataurl 包含base64字符串的数据URL
|
|
2318
|
+
* @param filename 文件的名称
|
|
2319
|
+
* @returns 返回文件对象
|
|
2724
2320
|
*/
|
|
2725
2321
|
convertBase64ToFile(dataurl, filename) {
|
|
2726
2322
|
const arr = dataurl.split(",");
|
|
@@ -3151,155 +2747,487 @@ const TreeUtil = {
|
|
|
3151
2747
|
return result;
|
|
3152
2748
|
},
|
|
3153
2749
|
/**
|
|
3154
|
-
* 将树形结构的数据展平成一维数组
|
|
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对象
|
|
3155
3101
|
*
|
|
3156
|
-
* @param
|
|
3157
|
-
* @returns
|
|
3102
|
+
* @param rgbaValue RGBA颜色值字符串,格式为"rgba(r,g,b,a)"或"rgb(r,g,b)"
|
|
3103
|
+
* @returns 返回Color对象
|
|
3104
|
+
* @throws 如果rgbaValue不是有效的RGBA颜色值,则抛出错误
|
|
3158
3105
|
*/
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
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);
|
|
3168
3114
|
}
|
|
3169
|
-
};
|
|
3170
|
-
const UrlUtil = {
|
|
3171
3115
|
/**
|
|
3172
|
-
*
|
|
3116
|
+
* 将十六进制颜色值转换为颜色对象
|
|
3173
3117
|
*
|
|
3174
|
-
* @param
|
|
3175
|
-
* @returns
|
|
3118
|
+
* @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
|
|
3119
|
+
* @returns 返回颜色对象
|
|
3176
3120
|
*/
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
}
|
|
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");
|
|
3185
3128
|
}
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
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
|
+
}
|
|
3189
3134
|
/**
|
|
3190
|
-
* 从
|
|
3135
|
+
* 从 HSL 字符串创建颜色对象
|
|
3191
3136
|
*
|
|
3192
|
-
* @param
|
|
3193
|
-
* @
|
|
3194
|
-
* @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
|
|
3137
|
+
* @param hsl HSL 字符串,格式为 hsl(h, s%, l%) 或 hsla(h, s%, l%, a)
|
|
3138
|
+
* @returns 返回颜色对象,如果 hsl 字符串无效则返回 null
|
|
3195
3139
|
*/
|
|
3196
|
-
|
|
3197
|
-
const
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
let obj = {};
|
|
3201
|
-
for (let i = 0; i < args.length; i++) {
|
|
3202
|
-
const str = args[i];
|
|
3203
|
-
if (str) {
|
|
3204
|
-
const s = str.replace(/#|\//g, "");
|
|
3205
|
-
const arr = s.split("?");
|
|
3206
|
-
if (arr.length > 1) {
|
|
3207
|
-
for (let j = 1; j < arr.length; j++) {
|
|
3208
|
-
let res;
|
|
3209
|
-
while (res = reg.exec(arr[j])) {
|
|
3210
|
-
obj[res[1]] = needDecode ? decodeURIComponent(res[2]) : res[2];
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
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");
|
|
3215
3144
|
}
|
|
3216
|
-
|
|
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);
|
|
3217
3175
|
}
|
|
3218
|
-
};
|
|
3219
|
-
const ValidateUtil = {
|
|
3220
|
-
isUrl(v) {
|
|
3221
|
-
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(
|
|
3222
|
-
v
|
|
3223
|
-
);
|
|
3224
|
-
},
|
|
3225
3176
|
/**
|
|
3177
|
+
* 从字符串中创建颜色对象
|
|
3226
3178
|
*
|
|
3227
|
-
* @param
|
|
3228
|
-
* @returns
|
|
3179
|
+
* @param str 字符串类型的颜色值,支持rgba、hex、hsl格式
|
|
3180
|
+
* @returns 返回创建的颜色对象
|
|
3181
|
+
* @throws 当颜色值无效时,抛出错误
|
|
3229
3182
|
*/
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
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
|
+
}
|
|
3240
3196
|
/**
|
|
3241
|
-
*
|
|
3197
|
+
* 将RGB颜色值转换为十六进制颜色值
|
|
3242
3198
|
*
|
|
3243
|
-
* @param
|
|
3244
|
-
* @
|
|
3199
|
+
* @param r 红色分量值,取值范围0-255
|
|
3200
|
+
* @param g 绿色分量值,取值范围0-255
|
|
3201
|
+
* @param b 蓝色分量值,取值范围0-255
|
|
3202
|
+
* @param a 可选参数,透明度分量值,取值范围0-1
|
|
3203
|
+
* @returns 十六进制颜色值,格式为#RRGGBB或#RRGGBBAA
|
|
3245
3204
|
*/
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
v
|
|
3252
|
-
);
|
|
3253
|
-
},
|
|
3254
|
-
isIP(v) {
|
|
3255
|
-
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(
|
|
3256
|
-
v
|
|
3257
|
-
);
|
|
3258
|
-
},
|
|
3259
|
-
isEnglish(v) {
|
|
3260
|
-
return /^[a-zA-Z]+$/.test(v);
|
|
3261
|
-
},
|
|
3262
|
-
isChinese(v) {
|
|
3263
|
-
return /^[\u4E00-\u9FA5]+$/.test(v);
|
|
3264
|
-
},
|
|
3265
|
-
isHTML(v) {
|
|
3266
|
-
return /<("[^"]*"|'[^']*'|[^'">])*>/.test(v);
|
|
3267
|
-
},
|
|
3268
|
-
isXML(v) {
|
|
3269
|
-
return /^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(v);
|
|
3270
|
-
},
|
|
3271
|
-
isIDCard(v) {
|
|
3272
|
-
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(v);
|
|
3273
|
-
}
|
|
3274
|
-
};
|
|
3275
|
-
class Cookie {
|
|
3276
|
-
static set(name, value, days) {
|
|
3277
|
-
if (typeof name !== "string" || typeof value !== "string") {
|
|
3278
|
-
ExceptionUtil.throwException("Invalid arguments");
|
|
3279
|
-
}
|
|
3280
|
-
let cookieString = `${name}=${encodeURIComponent(value)}`;
|
|
3281
|
-
if (days !== null && days !== void 0) {
|
|
3282
|
-
const exp = /* @__PURE__ */ new Date();
|
|
3283
|
-
exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3284
|
-
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;
|
|
3285
3210
|
}
|
|
3286
|
-
|
|
3211
|
+
return hex;
|
|
3287
3212
|
}
|
|
3288
|
-
static
|
|
3289
|
-
|
|
3290
|
-
exp.setTime(exp.getTime() - 1);
|
|
3291
|
-
var cval = this.get(name);
|
|
3292
|
-
if (cval != null) {
|
|
3293
|
-
document.cookie = name + "=" + cval + ";expires=" + exp.toUTCString();
|
|
3294
|
-
}
|
|
3213
|
+
static isHex(a) {
|
|
3214
|
+
return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a);
|
|
3295
3215
|
}
|
|
3296
|
-
static
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
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);
|
|
3303
3231
|
}
|
|
3304
3232
|
}
|
|
3305
3233
|
class CanvasDrawer {
|
|
@@ -3777,7 +3705,7 @@ Object.defineProperties(FullScreen, {
|
|
|
3777
3705
|
if (!nativeAPI) {
|
|
3778
3706
|
FullScreen = { isEnabled: false };
|
|
3779
3707
|
}
|
|
3780
|
-
const
|
|
3708
|
+
const FullScreen_default = FullScreen;
|
|
3781
3709
|
class HashMap extends Map {
|
|
3782
3710
|
isEmpty() {
|
|
3783
3711
|
return this.size === 0;
|
|
@@ -3920,7 +3848,7 @@ function commonjsRequire(path) {
|
|
|
3920
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.');
|
|
3921
3849
|
}
|
|
3922
3850
|
var mqtt = { exports: {} };
|
|
3923
|
-
(function(module, exports) {
|
|
3851
|
+
(function(module, exports$1) {
|
|
3924
3852
|
(function(f) {
|
|
3925
3853
|
{
|
|
3926
3854
|
module.exports = f();
|
|
@@ -3949,10 +3877,10 @@ var mqtt = { exports: {} };
|
|
|
3949
3877
|
return o;
|
|
3950
3878
|
}
|
|
3951
3879
|
return r;
|
|
3952
|
-
}())({ 1: [function(require2, module2,
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3880
|
+
}())({ 1: [function(require2, module2, exports$12) {
|
|
3881
|
+
exports$12.byteLength = byteLength;
|
|
3882
|
+
exports$12.toByteArray = toByteArray;
|
|
3883
|
+
exports$12.fromByteArray = fromByteArray;
|
|
3956
3884
|
var lookup = [];
|
|
3957
3885
|
var revLookup = [];
|
|
3958
3886
|
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
@@ -4042,17 +3970,17 @@ var mqtt = { exports: {} };
|
|
|
4042
3970
|
}
|
|
4043
3971
|
return parts.join("");
|
|
4044
3972
|
}
|
|
4045
|
-
}, {}], 2: [function(require2, module2,
|
|
4046
|
-
}, {}], 3: [function(require2, module2,
|
|
3973
|
+
}, {}], 2: [function(require2, module2, exports$12) {
|
|
3974
|
+
}, {}], 3: [function(require2, module2, exports$12) {
|
|
4047
3975
|
(function(Buffer2) {
|
|
4048
3976
|
(function() {
|
|
4049
3977
|
var base64 = require2("base64-js");
|
|
4050
3978
|
var ieee754 = require2("ieee754");
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
3979
|
+
exports$12.Buffer = Buffer3;
|
|
3980
|
+
exports$12.SlowBuffer = SlowBuffer;
|
|
3981
|
+
exports$12.INSPECT_MAX_BYTES = 50;
|
|
4054
3982
|
var K_MAX_LENGTH = 2147483647;
|
|
4055
|
-
|
|
3983
|
+
exports$12.kMaxLength = K_MAX_LENGTH;
|
|
4056
3984
|
Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
4057
3985
|
if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
|
4058
3986
|
console.error(
|
|
@@ -4473,7 +4401,7 @@ var mqtt = { exports: {} };
|
|
|
4473
4401
|
};
|
|
4474
4402
|
Buffer3.prototype.inspect = function inspect() {
|
|
4475
4403
|
var str = "";
|
|
4476
|
-
var max =
|
|
4404
|
+
var max = exports$12.INSPECT_MAX_BYTES;
|
|
4477
4405
|
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
4478
4406
|
if (this.length > max) str += " ... ";
|
|
4479
4407
|
return "<Buffer " + str + ">";
|
|
@@ -5395,7 +5323,7 @@ var mqtt = { exports: {} };
|
|
|
5395
5323
|
}
|
|
5396
5324
|
}).call(this);
|
|
5397
5325
|
}).call(this, require2("buffer").Buffer);
|
|
5398
|
-
}, { "base64-js": 1, "buffer": 3, "ieee754": 5 }], 4: [function(require2, module2,
|
|
5326
|
+
}, { "base64-js": 1, "buffer": 3, "ieee754": 5 }], 4: [function(require2, module2, exports$12) {
|
|
5399
5327
|
var R = typeof Reflect === "object" ? Reflect : null;
|
|
5400
5328
|
var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
|
|
5401
5329
|
return Function.prototype.apply.call(target, receiver, args);
|
|
@@ -5757,9 +5685,9 @@ var mqtt = { exports: {} };
|
|
|
5757
5685
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
|
|
5758
5686
|
}
|
|
5759
5687
|
}
|
|
5760
|
-
}, {}], 5: [function(require2, module2,
|
|
5688
|
+
}, {}], 5: [function(require2, module2, exports$12) {
|
|
5761
5689
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
5762
|
-
|
|
5690
|
+
exports$12.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
5763
5691
|
var e, m;
|
|
5764
5692
|
var eLen = nBytes * 8 - mLen - 1;
|
|
5765
5693
|
var eMax = (1 << eLen) - 1;
|
|
@@ -5789,7 +5717,7 @@ var mqtt = { exports: {} };
|
|
|
5789
5717
|
}
|
|
5790
5718
|
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
5791
5719
|
};
|
|
5792
|
-
|
|
5720
|
+
exports$12.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
5793
5721
|
var e, m, c;
|
|
5794
5722
|
var eLen = nBytes * 8 - mLen - 1;
|
|
5795
5723
|
var eMax = (1 << eLen) - 1;
|
|
@@ -5836,7 +5764,7 @@ var mqtt = { exports: {} };
|
|
|
5836
5764
|
}
|
|
5837
5765
|
buffer[offset + i - d] |= s * 128;
|
|
5838
5766
|
};
|
|
5839
|
-
}, {}], 6: [function(require2, module2,
|
|
5767
|
+
}, {}], 6: [function(require2, module2, exports$12) {
|
|
5840
5768
|
(function(process2, global2) {
|
|
5841
5769
|
(function() {
|
|
5842
5770
|
const EventEmitter = require2("events").EventEmitter;
|
|
@@ -7249,7 +7177,7 @@ var mqtt = { exports: {} };
|
|
|
7249
7177
|
module2.exports = MqttClient2;
|
|
7250
7178
|
}).call(this);
|
|
7251
7179
|
}).call(this, require2("_process"), typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
|
|
7252
|
-
}, { "./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,
|
|
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) {
|
|
7253
7181
|
const { Buffer: Buffer2 } = require2("buffer");
|
|
7254
7182
|
const Transform = require2("readable-stream").Transform;
|
|
7255
7183
|
const duplexify = require2("duplexify");
|
|
@@ -7351,7 +7279,7 @@ var mqtt = { exports: {} };
|
|
|
7351
7279
|
return stream;
|
|
7352
7280
|
}
|
|
7353
7281
|
module2.exports = buildStream;
|
|
7354
|
-
}, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 8: [function(require2, module2,
|
|
7282
|
+
}, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 8: [function(require2, module2, exports$12) {
|
|
7355
7283
|
const net = require2("net");
|
|
7356
7284
|
const debug = require2("debug")("mqttjs:tcp");
|
|
7357
7285
|
function streamBuilder(client, opts) {
|
|
@@ -7363,7 +7291,7 @@ var mqtt = { exports: {} };
|
|
|
7363
7291
|
return net.createConnection(port, host);
|
|
7364
7292
|
}
|
|
7365
7293
|
module2.exports = streamBuilder;
|
|
7366
|
-
}, { "debug": 20, "net": 2 }], 9: [function(require2, module2,
|
|
7294
|
+
}, { "debug": 20, "net": 2 }], 9: [function(require2, module2, exports$12) {
|
|
7367
7295
|
const tls = require2("tls");
|
|
7368
7296
|
const net = require2("net");
|
|
7369
7297
|
const debug = require2("debug")("mqttjs:tls");
|
|
@@ -7394,7 +7322,7 @@ var mqtt = { exports: {} };
|
|
|
7394
7322
|
return connection;
|
|
7395
7323
|
}
|
|
7396
7324
|
module2.exports = buildBuilder;
|
|
7397
|
-
}, { "debug": 20, "net": 2, "tls": 2 }], 10: [function(require2, module2,
|
|
7325
|
+
}, { "debug": 20, "net": 2, "tls": 2 }], 10: [function(require2, module2, exports$12) {
|
|
7398
7326
|
(function(process2) {
|
|
7399
7327
|
(function() {
|
|
7400
7328
|
const { Buffer: Buffer2 } = require2("buffer");
|
|
@@ -7595,7 +7523,7 @@ var mqtt = { exports: {} };
|
|
|
7595
7523
|
}
|
|
7596
7524
|
}).call(this);
|
|
7597
7525
|
}).call(this, require2("_process"));
|
|
7598
|
-
}, { "_process": 85, "buffer": 3, "debug": 20, "duplexify": 22, "readable-stream": 72, "ws": 81 }], 11: [function(require2, module2,
|
|
7526
|
+
}, { "_process": 85, "buffer": 3, "debug": 20, "duplexify": 22, "readable-stream": 72, "ws": 81 }], 11: [function(require2, module2, exports$12) {
|
|
7599
7527
|
const { Buffer: Buffer2 } = require2("buffer");
|
|
7600
7528
|
const Transform = require2("readable-stream").Transform;
|
|
7601
7529
|
const duplexify = require2("duplexify");
|
|
@@ -7701,7 +7629,7 @@ var mqtt = { exports: {} };
|
|
|
7701
7629
|
return stream;
|
|
7702
7630
|
}
|
|
7703
7631
|
module2.exports = buildStream;
|
|
7704
|
-
}, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 12: [function(require2, module2,
|
|
7632
|
+
}, { "buffer": 3, "duplexify": 22, "readable-stream": 72 }], 12: [function(require2, module2, exports$12) {
|
|
7705
7633
|
function DefaultMessageIdProvider() {
|
|
7706
7634
|
if (!(this instanceof DefaultMessageIdProvider)) {
|
|
7707
7635
|
return new DefaultMessageIdProvider();
|
|
@@ -7726,7 +7654,7 @@ var mqtt = { exports: {} };
|
|
|
7726
7654
|
DefaultMessageIdProvider.prototype.clear = function() {
|
|
7727
7655
|
};
|
|
7728
7656
|
module2.exports = DefaultMessageIdProvider;
|
|
7729
|
-
}, {}], 13: [function(require2, module2,
|
|
7657
|
+
}, {}], 13: [function(require2, module2, exports$12) {
|
|
7730
7658
|
const xtend = require2("xtend");
|
|
7731
7659
|
const Readable = require2("readable-stream").Readable;
|
|
7732
7660
|
const streamsOpts = { objectMode: true };
|
|
@@ -7803,7 +7731,7 @@ var mqtt = { exports: {} };
|
|
|
7803
7731
|
}
|
|
7804
7732
|
};
|
|
7805
7733
|
module2.exports = Store;
|
|
7806
|
-
}, { "readable-stream": 72, "xtend": 82 }], 14: [function(require2, module2,
|
|
7734
|
+
}, { "readable-stream": 72, "xtend": 82 }], 14: [function(require2, module2, exports$12) {
|
|
7807
7735
|
function TopicAliasRecv(max) {
|
|
7808
7736
|
if (!(this instanceof TopicAliasRecv)) {
|
|
7809
7737
|
return new TopicAliasRecv(max);
|
|
@@ -7826,7 +7754,7 @@ var mqtt = { exports: {} };
|
|
|
7826
7754
|
this.aliasToTopic = {};
|
|
7827
7755
|
};
|
|
7828
7756
|
module2.exports = TopicAliasRecv;
|
|
7829
|
-
}, {}], 15: [function(require2, module2,
|
|
7757
|
+
}, {}], 15: [function(require2, module2, exports$12) {
|
|
7830
7758
|
const LruMap = require2("lru-cache");
|
|
7831
7759
|
const NumberAllocator = require2("number-allocator").NumberAllocator;
|
|
7832
7760
|
function TopicAliasSend(max) {
|
|
@@ -7877,7 +7805,7 @@ var mqtt = { exports: {} };
|
|
|
7877
7805
|
return this.aliasToTopic.keys()[this.aliasToTopic.length - 1];
|
|
7878
7806
|
};
|
|
7879
7807
|
module2.exports = TopicAliasSend;
|
|
7880
|
-
}, { "lru-cache": 45, "number-allocator": 54 }], 16: [function(require2, module2,
|
|
7808
|
+
}, { "lru-cache": 45, "number-allocator": 54 }], 16: [function(require2, module2, exports$12) {
|
|
7881
7809
|
function validateTopic(topic) {
|
|
7882
7810
|
const parts = topic.split("/");
|
|
7883
7811
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -7907,7 +7835,7 @@ var mqtt = { exports: {} };
|
|
|
7907
7835
|
module2.exports = {
|
|
7908
7836
|
validateTopics
|
|
7909
7837
|
};
|
|
7910
|
-
}, {}], 17: [function(require2, module2,
|
|
7838
|
+
}, {}], 17: [function(require2, module2, exports$12) {
|
|
7911
7839
|
(function(process2) {
|
|
7912
7840
|
(function() {
|
|
7913
7841
|
const MqttClient2 = require2("../client");
|
|
@@ -8037,7 +7965,7 @@ var mqtt = { exports: {} };
|
|
|
8037
7965
|
module2.exports.Store = Store;
|
|
8038
7966
|
}).call(this);
|
|
8039
7967
|
}).call(this, require2("_process"));
|
|
8040
|
-
}, { "../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,
|
|
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) {
|
|
8041
7969
|
const { Buffer: Buffer2 } = require2("buffer");
|
|
8042
7970
|
const symbol = Symbol.for("BufferList");
|
|
8043
7971
|
function BufferList(buf) {
|
|
@@ -8333,7 +8261,7 @@ var mqtt = { exports: {} };
|
|
|
8333
8261
|
return b != null && b[symbol];
|
|
8334
8262
|
};
|
|
8335
8263
|
module2.exports = BufferList;
|
|
8336
|
-
}, { "buffer": 3 }], 19: [function(require2, module2,
|
|
8264
|
+
}, { "buffer": 3 }], 19: [function(require2, module2, exports$12) {
|
|
8337
8265
|
const DuplexStream = require2("readable-stream").Duplex;
|
|
8338
8266
|
const inherits = require2("inherits");
|
|
8339
8267
|
const BufferList = require2("./BufferList");
|
|
@@ -8398,15 +8326,15 @@ var mqtt = { exports: {} };
|
|
|
8398
8326
|
module2.exports = BufferListStream;
|
|
8399
8327
|
module2.exports.BufferListStream = BufferListStream;
|
|
8400
8328
|
module2.exports.BufferList = BufferList;
|
|
8401
|
-
}, { "./BufferList": 18, "inherits": 24, "readable-stream": 72 }], 20: [function(require2, module2,
|
|
8329
|
+
}, { "./BufferList": 18, "inherits": 24, "readable-stream": 72 }], 20: [function(require2, module2, exports$12) {
|
|
8402
8330
|
(function(process2) {
|
|
8403
8331
|
(function() {
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
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__ */ (() => {
|
|
8410
8338
|
let warned = false;
|
|
8411
8339
|
return () => {
|
|
8412
8340
|
if (!warned) {
|
|
@@ -8415,7 +8343,7 @@ var mqtt = { exports: {} };
|
|
|
8415
8343
|
}
|
|
8416
8344
|
};
|
|
8417
8345
|
})();
|
|
8418
|
-
|
|
8346
|
+
exports$12.colors = [
|
|
8419
8347
|
"#0000CC",
|
|
8420
8348
|
"#0000FF",
|
|
8421
8349
|
"#0033CC",
|
|
@@ -8526,14 +8454,14 @@ var mqtt = { exports: {} };
|
|
|
8526
8454
|
});
|
|
8527
8455
|
args.splice(lastC, 0, c);
|
|
8528
8456
|
}
|
|
8529
|
-
|
|
8457
|
+
exports$12.log = console.debug || console.log || (() => {
|
|
8530
8458
|
});
|
|
8531
8459
|
function save(namespaces) {
|
|
8532
8460
|
try {
|
|
8533
8461
|
if (namespaces) {
|
|
8534
|
-
|
|
8462
|
+
exports$12.storage.setItem("debug", namespaces);
|
|
8535
8463
|
} else {
|
|
8536
|
-
|
|
8464
|
+
exports$12.storage.removeItem("debug");
|
|
8537
8465
|
}
|
|
8538
8466
|
} catch (error) {
|
|
8539
8467
|
}
|
|
@@ -8541,7 +8469,7 @@ var mqtt = { exports: {} };
|
|
|
8541
8469
|
function load() {
|
|
8542
8470
|
let r;
|
|
8543
8471
|
try {
|
|
8544
|
-
r =
|
|
8472
|
+
r = exports$12.storage.getItem("debug");
|
|
8545
8473
|
} catch (error) {
|
|
8546
8474
|
}
|
|
8547
8475
|
if (!r && typeof process2 !== "undefined" && "env" in process2) {
|
|
@@ -8555,7 +8483,7 @@ var mqtt = { exports: {} };
|
|
|
8555
8483
|
} catch (error) {
|
|
8556
8484
|
}
|
|
8557
8485
|
}
|
|
8558
|
-
module2.exports = require2("./common")(
|
|
8486
|
+
module2.exports = require2("./common")(exports$12);
|
|
8559
8487
|
const { formatters } = module2.exports;
|
|
8560
8488
|
formatters.j = function(v) {
|
|
8561
8489
|
try {
|
|
@@ -8566,7 +8494,7 @@ var mqtt = { exports: {} };
|
|
|
8566
8494
|
};
|
|
8567
8495
|
}).call(this);
|
|
8568
8496
|
}).call(this, require2("_process"));
|
|
8569
|
-
}, { "./common": 21, "_process": 85 }], 21: [function(require2, module2,
|
|
8497
|
+
}, { "./common": 21, "_process": 85 }], 21: [function(require2, module2, exports$12) {
|
|
8570
8498
|
function setup(env) {
|
|
8571
8499
|
createDebug.debug = createDebug;
|
|
8572
8500
|
createDebug.default = createDebug;
|
|
@@ -8724,7 +8652,7 @@ var mqtt = { exports: {} };
|
|
|
8724
8652
|
return createDebug;
|
|
8725
8653
|
}
|
|
8726
8654
|
module2.exports = setup;
|
|
8727
|
-
}, { "ms": 53 }], 22: [function(require2, module2,
|
|
8655
|
+
}, { "ms": 53 }], 22: [function(require2, module2, exports$12) {
|
|
8728
8656
|
(function(process2, Buffer2) {
|
|
8729
8657
|
(function() {
|
|
8730
8658
|
var stream = require2("readable-stream");
|
|
@@ -8916,7 +8844,7 @@ var mqtt = { exports: {} };
|
|
|
8916
8844
|
module2.exports = Duplexify;
|
|
8917
8845
|
}).call(this);
|
|
8918
8846
|
}).call(this, require2("_process"), require2("buffer").Buffer);
|
|
8919
|
-
}, { "_process": 85, "buffer": 3, "end-of-stream": 23, "inherits": 24, "readable-stream": 72, "stream-shift": 77 }], 23: [function(require2, module2,
|
|
8847
|
+
}, { "_process": 85, "buffer": 3, "end-of-stream": 23, "inherits": 24, "readable-stream": 72, "stream-shift": 77 }], 23: [function(require2, module2, exports$12) {
|
|
8920
8848
|
(function(process2) {
|
|
8921
8849
|
(function() {
|
|
8922
8850
|
var once = require2("once");
|
|
@@ -8997,7 +8925,7 @@ var mqtt = { exports: {} };
|
|
|
8997
8925
|
module2.exports = eos;
|
|
8998
8926
|
}).call(this);
|
|
8999
8927
|
}).call(this, require2("_process"));
|
|
9000
|
-
}, { "_process": 85, "once": 56 }], 24: [function(require2, module2,
|
|
8928
|
+
}, { "_process": 85, "once": 56 }], 24: [function(require2, module2, exports$12) {
|
|
9001
8929
|
if (typeof Object.create === "function") {
|
|
9002
8930
|
module2.exports = function inherits(ctor, superCtor) {
|
|
9003
8931
|
if (superCtor) {
|
|
@@ -9024,11 +8952,11 @@ var mqtt = { exports: {} };
|
|
|
9024
8952
|
}
|
|
9025
8953
|
};
|
|
9026
8954
|
}
|
|
9027
|
-
}, {}], 25: [function(require2, module2,
|
|
9028
|
-
Object.defineProperty(
|
|
8955
|
+
}, {}], 25: [function(require2, module2, exports$12) {
|
|
8956
|
+
Object.defineProperty(exports$12, "t", {
|
|
9029
8957
|
value: true
|
|
9030
8958
|
});
|
|
9031
|
-
|
|
8959
|
+
exports$12.ContainerIterator = exports$12.Container = exports$12.Base = void 0;
|
|
9032
8960
|
class ContainerIterator {
|
|
9033
8961
|
constructor(t = 0) {
|
|
9034
8962
|
this.iteratorType = t;
|
|
@@ -9037,7 +8965,7 @@ var mqtt = { exports: {} };
|
|
|
9037
8965
|
return this.o === t.o;
|
|
9038
8966
|
}
|
|
9039
8967
|
}
|
|
9040
|
-
|
|
8968
|
+
exports$12.ContainerIterator = ContainerIterator;
|
|
9041
8969
|
class Base {
|
|
9042
8970
|
constructor() {
|
|
9043
8971
|
this.i = 0;
|
|
@@ -9052,15 +8980,15 @@ var mqtt = { exports: {} };
|
|
|
9052
8980
|
return this.i === 0;
|
|
9053
8981
|
}
|
|
9054
8982
|
}
|
|
9055
|
-
|
|
8983
|
+
exports$12.Base = Base;
|
|
9056
8984
|
class Container extends Base {
|
|
9057
8985
|
}
|
|
9058
|
-
|
|
9059
|
-
}, {}], 26: [function(require2, module2,
|
|
9060
|
-
Object.defineProperty(
|
|
8986
|
+
exports$12.Container = Container;
|
|
8987
|
+
}, {}], 26: [function(require2, module2, exports$12) {
|
|
8988
|
+
Object.defineProperty(exports$12, "t", {
|
|
9061
8989
|
value: true
|
|
9062
8990
|
});
|
|
9063
|
-
|
|
8991
|
+
exports$12.HashContainerIterator = exports$12.HashContainer = void 0;
|
|
9064
8992
|
var _ContainerBase = require2("../../ContainerBase");
|
|
9065
8993
|
var _checkObject = _interopRequireDefault(require2("../../../utils/checkObject"));
|
|
9066
8994
|
var _throwError = require2("../../../utils/throwError");
|
|
@@ -9107,7 +9035,7 @@ var mqtt = { exports: {} };
|
|
|
9107
9035
|
}
|
|
9108
9036
|
}
|
|
9109
9037
|
}
|
|
9110
|
-
|
|
9038
|
+
exports$12.HashContainerIterator = HashContainerIterator;
|
|
9111
9039
|
class HashContainer extends _ContainerBase.Container {
|
|
9112
9040
|
constructor() {
|
|
9113
9041
|
super();
|
|
@@ -9232,12 +9160,12 @@ var mqtt = { exports: {} };
|
|
|
9232
9160
|
return this.i;
|
|
9233
9161
|
}
|
|
9234
9162
|
}
|
|
9235
|
-
|
|
9236
|
-
}, { "../../../utils/checkObject": 43, "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 27: [function(require2, module2,
|
|
9237
|
-
Object.defineProperty(
|
|
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", {
|
|
9238
9166
|
value: true
|
|
9239
9167
|
});
|
|
9240
|
-
|
|
9168
|
+
exports$12.default = void 0;
|
|
9241
9169
|
var _Base = require2("./Base");
|
|
9242
9170
|
var _checkObject = _interopRequireDefault(require2("../../utils/checkObject"));
|
|
9243
9171
|
var _throwError = require2("../../utils/throwError");
|
|
@@ -9347,12 +9275,12 @@ var mqtt = { exports: {} };
|
|
|
9347
9275
|
}
|
|
9348
9276
|
}
|
|
9349
9277
|
var _default = HashMap2;
|
|
9350
|
-
|
|
9351
|
-
}, { "../../utils/checkObject": 43, "../../utils/throwError": 44, "./Base": 26 }], 28: [function(require2, module2,
|
|
9352
|
-
Object.defineProperty(
|
|
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", {
|
|
9353
9281
|
value: true
|
|
9354
9282
|
});
|
|
9355
|
-
|
|
9283
|
+
exports$12.default = void 0;
|
|
9356
9284
|
var _Base = require2("./Base");
|
|
9357
9285
|
var _throwError = require2("../../utils/throwError");
|
|
9358
9286
|
class HashSetIterator extends _Base.HashContainerIterator {
|
|
@@ -9432,12 +9360,12 @@ var mqtt = { exports: {} };
|
|
|
9432
9360
|
}
|
|
9433
9361
|
}
|
|
9434
9362
|
var _default = HashSet;
|
|
9435
|
-
|
|
9436
|
-
}, { "../../utils/throwError": 44, "./Base": 26 }], 29: [function(require2, module2,
|
|
9437
|
-
Object.defineProperty(
|
|
9363
|
+
exports$12.default = _default;
|
|
9364
|
+
}, { "../../utils/throwError": 44, "./Base": 26 }], 29: [function(require2, module2, exports$12) {
|
|
9365
|
+
Object.defineProperty(exports$12, "t", {
|
|
9438
9366
|
value: true
|
|
9439
9367
|
});
|
|
9440
|
-
|
|
9368
|
+
exports$12.default = void 0;
|
|
9441
9369
|
var _ContainerBase = require2("../ContainerBase");
|
|
9442
9370
|
class PriorityQueue extends _ContainerBase.Base {
|
|
9443
9371
|
constructor(t = [], s = function(t2, s2) {
|
|
@@ -9543,12 +9471,12 @@ var mqtt = { exports: {} };
|
|
|
9543
9471
|
}
|
|
9544
9472
|
}
|
|
9545
9473
|
var _default = PriorityQueue;
|
|
9546
|
-
|
|
9547
|
-
}, { "../ContainerBase": 25 }], 30: [function(require2, module2,
|
|
9548
|
-
Object.defineProperty(
|
|
9474
|
+
exports$12.default = _default;
|
|
9475
|
+
}, { "../ContainerBase": 25 }], 30: [function(require2, module2, exports$12) {
|
|
9476
|
+
Object.defineProperty(exports$12, "t", {
|
|
9549
9477
|
value: true
|
|
9550
9478
|
});
|
|
9551
|
-
|
|
9479
|
+
exports$12.default = void 0;
|
|
9552
9480
|
var _ContainerBase = require2("../ContainerBase");
|
|
9553
9481
|
class Queue extends _ContainerBase.Base {
|
|
9554
9482
|
constructor(t = []) {
|
|
@@ -9588,12 +9516,12 @@ var mqtt = { exports: {} };
|
|
|
9588
9516
|
}
|
|
9589
9517
|
}
|
|
9590
9518
|
var _default = Queue;
|
|
9591
|
-
|
|
9592
|
-
}, { "../ContainerBase": 25 }], 31: [function(require2, module2,
|
|
9593
|
-
Object.defineProperty(
|
|
9519
|
+
exports$12.default = _default;
|
|
9520
|
+
}, { "../ContainerBase": 25 }], 31: [function(require2, module2, exports$12) {
|
|
9521
|
+
Object.defineProperty(exports$12, "t", {
|
|
9594
9522
|
value: true
|
|
9595
9523
|
});
|
|
9596
|
-
|
|
9524
|
+
exports$12.default = void 0;
|
|
9597
9525
|
var _ContainerBase = require2("../ContainerBase");
|
|
9598
9526
|
class Stack extends _ContainerBase.Base {
|
|
9599
9527
|
constructor(t = []) {
|
|
@@ -9623,12 +9551,12 @@ var mqtt = { exports: {} };
|
|
|
9623
9551
|
}
|
|
9624
9552
|
}
|
|
9625
9553
|
var _default = Stack;
|
|
9626
|
-
|
|
9627
|
-
}, { "../ContainerBase": 25 }], 32: [function(require2, module2,
|
|
9628
|
-
Object.defineProperty(
|
|
9554
|
+
exports$12.default = _default;
|
|
9555
|
+
}, { "../ContainerBase": 25 }], 32: [function(require2, module2, exports$12) {
|
|
9556
|
+
Object.defineProperty(exports$12, "t", {
|
|
9629
9557
|
value: true
|
|
9630
9558
|
});
|
|
9631
|
-
|
|
9559
|
+
exports$12.RandomIterator = void 0;
|
|
9632
9560
|
var _ContainerBase = require2("../../ContainerBase");
|
|
9633
9561
|
var _throwError = require2("../../../utils/throwError");
|
|
9634
9562
|
class RandomIterator extends _ContainerBase.ContainerIterator {
|
|
@@ -9674,22 +9602,22 @@ var mqtt = { exports: {} };
|
|
|
9674
9602
|
this.container.setElementByPos(this.o, t);
|
|
9675
9603
|
}
|
|
9676
9604
|
}
|
|
9677
|
-
|
|
9678
|
-
}, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 33: [function(require2, module2,
|
|
9679
|
-
Object.defineProperty(
|
|
9605
|
+
exports$12.RandomIterator = RandomIterator;
|
|
9606
|
+
}, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 33: [function(require2, module2, exports$12) {
|
|
9607
|
+
Object.defineProperty(exports$12, "t", {
|
|
9680
9608
|
value: true
|
|
9681
9609
|
});
|
|
9682
|
-
|
|
9610
|
+
exports$12.default = void 0;
|
|
9683
9611
|
var _ContainerBase = require2("../../ContainerBase");
|
|
9684
9612
|
class SequentialContainer extends _ContainerBase.Container {
|
|
9685
9613
|
}
|
|
9686
9614
|
var _default = SequentialContainer;
|
|
9687
|
-
|
|
9688
|
-
}, { "../../ContainerBase": 25 }], 34: [function(require2, module2,
|
|
9689
|
-
Object.defineProperty(
|
|
9615
|
+
exports$12.default = _default;
|
|
9616
|
+
}, { "../../ContainerBase": 25 }], 34: [function(require2, module2, exports$12) {
|
|
9617
|
+
Object.defineProperty(exports$12, "t", {
|
|
9690
9618
|
value: true
|
|
9691
9619
|
});
|
|
9692
|
-
|
|
9620
|
+
exports$12.default = void 0;
|
|
9693
9621
|
var _Base = _interopRequireDefault(require2("./Base"));
|
|
9694
9622
|
var _RandomIterator = require2("./Base/RandomIterator");
|
|
9695
9623
|
function _interopRequireDefault(t) {
|
|
@@ -10014,12 +9942,12 @@ var mqtt = { exports: {} };
|
|
|
10014
9942
|
}
|
|
10015
9943
|
}
|
|
10016
9944
|
var _default = Deque;
|
|
10017
|
-
|
|
10018
|
-
}, { "./Base": 33, "./Base/RandomIterator": 32 }], 35: [function(require2, module2,
|
|
10019
|
-
Object.defineProperty(
|
|
9945
|
+
exports$12.default = _default;
|
|
9946
|
+
}, { "./Base": 33, "./Base/RandomIterator": 32 }], 35: [function(require2, module2, exports$12) {
|
|
9947
|
+
Object.defineProperty(exports$12, "t", {
|
|
10020
9948
|
value: true
|
|
10021
9949
|
});
|
|
10022
|
-
|
|
9950
|
+
exports$12.default = void 0;
|
|
10023
9951
|
var _Base = _interopRequireDefault(require2("./Base"));
|
|
10024
9952
|
var _ContainerBase = require2("../ContainerBase");
|
|
10025
9953
|
var _throwError = require2("../../utils/throwError");
|
|
@@ -10333,12 +10261,12 @@ var mqtt = { exports: {} };
|
|
|
10333
10261
|
}
|
|
10334
10262
|
}
|
|
10335
10263
|
var _default = LinkList;
|
|
10336
|
-
|
|
10337
|
-
}, { "../../utils/throwError": 44, "../ContainerBase": 25, "./Base": 33 }], 36: [function(require2, module2,
|
|
10338
|
-
Object.defineProperty(
|
|
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", {
|
|
10339
10267
|
value: true
|
|
10340
10268
|
});
|
|
10341
|
-
|
|
10269
|
+
exports$12.default = void 0;
|
|
10342
10270
|
var _Base = _interopRequireDefault(require2("./Base"));
|
|
10343
10271
|
var _RandomIterator = require2("./Base/RandomIterator");
|
|
10344
10272
|
function _interopRequireDefault(t) {
|
|
@@ -10481,12 +10409,12 @@ var mqtt = { exports: {} };
|
|
|
10481
10409
|
}
|
|
10482
10410
|
}
|
|
10483
10411
|
var _default = Vector;
|
|
10484
|
-
|
|
10485
|
-
}, { "./Base": 33, "./Base/RandomIterator": 32 }], 37: [function(require2, module2,
|
|
10486
|
-
Object.defineProperty(
|
|
10412
|
+
exports$12.default = _default;
|
|
10413
|
+
}, { "./Base": 33, "./Base/RandomIterator": 32 }], 37: [function(require2, module2, exports$12) {
|
|
10414
|
+
Object.defineProperty(exports$12, "t", {
|
|
10487
10415
|
value: true
|
|
10488
10416
|
});
|
|
10489
|
-
|
|
10417
|
+
exports$12.default = void 0;
|
|
10490
10418
|
var _ContainerBase = require2("../../ContainerBase");
|
|
10491
10419
|
var _throwError = require2("../../../utils/throwError");
|
|
10492
10420
|
class TreeIterator extends _ContainerBase.ContainerIterator {
|
|
@@ -10553,12 +10481,12 @@ var mqtt = { exports: {} };
|
|
|
10553
10481
|
}
|
|
10554
10482
|
}
|
|
10555
10483
|
var _default = TreeIterator;
|
|
10556
|
-
|
|
10557
|
-
}, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 38: [function(require2, module2,
|
|
10558
|
-
Object.defineProperty(
|
|
10484
|
+
exports$12.default = _default;
|
|
10485
|
+
}, { "../../../utils/throwError": 44, "../../ContainerBase": 25 }], 38: [function(require2, module2, exports$12) {
|
|
10486
|
+
Object.defineProperty(exports$12, "t", {
|
|
10559
10487
|
value: true
|
|
10560
10488
|
});
|
|
10561
|
-
|
|
10489
|
+
exports$12.TreeNodeEnableIndex = exports$12.TreeNode = void 0;
|
|
10562
10490
|
class TreeNode {
|
|
10563
10491
|
constructor(e, t) {
|
|
10564
10492
|
this.ee = 1;
|
|
@@ -10637,7 +10565,7 @@ var mqtt = { exports: {} };
|
|
|
10637
10565
|
return t;
|
|
10638
10566
|
}
|
|
10639
10567
|
}
|
|
10640
|
-
|
|
10568
|
+
exports$12.TreeNode = TreeNode;
|
|
10641
10569
|
class TreeNodeEnableIndex extends TreeNode {
|
|
10642
10570
|
constructor() {
|
|
10643
10571
|
super(...arguments);
|
|
@@ -10665,12 +10593,12 @@ var mqtt = { exports: {} };
|
|
|
10665
10593
|
}
|
|
10666
10594
|
}
|
|
10667
10595
|
}
|
|
10668
|
-
|
|
10669
|
-
}, {}], 39: [function(require2, module2,
|
|
10670
|
-
Object.defineProperty(
|
|
10596
|
+
exports$12.TreeNodeEnableIndex = TreeNodeEnableIndex;
|
|
10597
|
+
}, {}], 39: [function(require2, module2, exports$12) {
|
|
10598
|
+
Object.defineProperty(exports$12, "t", {
|
|
10671
10599
|
value: true
|
|
10672
10600
|
});
|
|
10673
|
-
|
|
10601
|
+
exports$12.default = void 0;
|
|
10674
10602
|
var _TreeNode = require2("./TreeNode");
|
|
10675
10603
|
var _ContainerBase = require2("../../ContainerBase");
|
|
10676
10604
|
var _throwError = require2("../../../utils/throwError");
|
|
@@ -11170,12 +11098,12 @@ var mqtt = { exports: {} };
|
|
|
11170
11098
|
}
|
|
11171
11099
|
}
|
|
11172
11100
|
var _default = TreeContainer;
|
|
11173
|
-
|
|
11174
|
-
}, { "../../../utils/throwError": 44, "../../ContainerBase": 25, "./TreeNode": 38 }], 40: [function(require2, module2,
|
|
11175
|
-
Object.defineProperty(
|
|
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", {
|
|
11176
11104
|
value: true
|
|
11177
11105
|
});
|
|
11178
|
-
|
|
11106
|
+
exports$12.default = void 0;
|
|
11179
11107
|
var _Base = _interopRequireDefault(require2("./Base"));
|
|
11180
11108
|
var _TreeIterator = _interopRequireDefault(require2("./Base/TreeIterator"));
|
|
11181
11109
|
var _throwError = require2("../../utils/throwError");
|
|
@@ -11287,12 +11215,12 @@ var mqtt = { exports: {} };
|
|
|
11287
11215
|
}
|
|
11288
11216
|
}
|
|
11289
11217
|
var _default = OrderedMap;
|
|
11290
|
-
|
|
11291
|
-
}, { "../../utils/throwError": 44, "./Base": 39, "./Base/TreeIterator": 37 }], 41: [function(require2, module2,
|
|
11292
|
-
Object.defineProperty(
|
|
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", {
|
|
11293
11221
|
value: true
|
|
11294
11222
|
});
|
|
11295
|
-
|
|
11223
|
+
exports$12.default = void 0;
|
|
11296
11224
|
var _Base = _interopRequireDefault(require2("./Base"));
|
|
11297
11225
|
var _TreeIterator = _interopRequireDefault(require2("./Base/TreeIterator"));
|
|
11298
11226
|
var _throwError = require2("../../utils/throwError");
|
|
@@ -11383,66 +11311,66 @@ var mqtt = { exports: {} };
|
|
|
11383
11311
|
}
|
|
11384
11312
|
}
|
|
11385
11313
|
var _default = OrderedSet;
|
|
11386
|
-
|
|
11387
|
-
}, { "../../utils/throwError": 44, "./Base": 39, "./Base/TreeIterator": 37 }], 42: [function(require2, module2,
|
|
11388
|
-
Object.defineProperty(
|
|
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", {
|
|
11389
11317
|
value: true
|
|
11390
11318
|
});
|
|
11391
|
-
Object.defineProperty(
|
|
11319
|
+
Object.defineProperty(exports$12, "Deque", {
|
|
11392
11320
|
enumerable: true,
|
|
11393
11321
|
get: function() {
|
|
11394
11322
|
return _Deque.default;
|
|
11395
11323
|
}
|
|
11396
11324
|
});
|
|
11397
|
-
Object.defineProperty(
|
|
11325
|
+
Object.defineProperty(exports$12, "HashMap", {
|
|
11398
11326
|
enumerable: true,
|
|
11399
11327
|
get: function() {
|
|
11400
11328
|
return _HashMap.default;
|
|
11401
11329
|
}
|
|
11402
11330
|
});
|
|
11403
|
-
Object.defineProperty(
|
|
11331
|
+
Object.defineProperty(exports$12, "HashSet", {
|
|
11404
11332
|
enumerable: true,
|
|
11405
11333
|
get: function() {
|
|
11406
11334
|
return _HashSet.default;
|
|
11407
11335
|
}
|
|
11408
11336
|
});
|
|
11409
|
-
Object.defineProperty(
|
|
11337
|
+
Object.defineProperty(exports$12, "LinkList", {
|
|
11410
11338
|
enumerable: true,
|
|
11411
11339
|
get: function() {
|
|
11412
11340
|
return _LinkList.default;
|
|
11413
11341
|
}
|
|
11414
11342
|
});
|
|
11415
|
-
Object.defineProperty(
|
|
11343
|
+
Object.defineProperty(exports$12, "OrderedMap", {
|
|
11416
11344
|
enumerable: true,
|
|
11417
11345
|
get: function() {
|
|
11418
11346
|
return _OrderedMap.default;
|
|
11419
11347
|
}
|
|
11420
11348
|
});
|
|
11421
|
-
Object.defineProperty(
|
|
11349
|
+
Object.defineProperty(exports$12, "OrderedSet", {
|
|
11422
11350
|
enumerable: true,
|
|
11423
11351
|
get: function() {
|
|
11424
11352
|
return _OrderedSet.default;
|
|
11425
11353
|
}
|
|
11426
11354
|
});
|
|
11427
|
-
Object.defineProperty(
|
|
11355
|
+
Object.defineProperty(exports$12, "PriorityQueue", {
|
|
11428
11356
|
enumerable: true,
|
|
11429
11357
|
get: function() {
|
|
11430
11358
|
return _PriorityQueue.default;
|
|
11431
11359
|
}
|
|
11432
11360
|
});
|
|
11433
|
-
Object.defineProperty(
|
|
11361
|
+
Object.defineProperty(exports$12, "Queue", {
|
|
11434
11362
|
enumerable: true,
|
|
11435
11363
|
get: function() {
|
|
11436
11364
|
return _Queue.default;
|
|
11437
11365
|
}
|
|
11438
11366
|
});
|
|
11439
|
-
Object.defineProperty(
|
|
11367
|
+
Object.defineProperty(exports$12, "Stack", {
|
|
11440
11368
|
enumerable: true,
|
|
11441
11369
|
get: function() {
|
|
11442
11370
|
return _Stack.default;
|
|
11443
11371
|
}
|
|
11444
11372
|
});
|
|
11445
|
-
Object.defineProperty(
|
|
11373
|
+
Object.defineProperty(exports$12, "Vector", {
|
|
11446
11374
|
enumerable: true,
|
|
11447
11375
|
get: function() {
|
|
11448
11376
|
return _Vector.default;
|
|
@@ -11463,24 +11391,24 @@ var mqtt = { exports: {} };
|
|
|
11463
11391
|
default: e
|
|
11464
11392
|
};
|
|
11465
11393
|
}
|
|
11466
|
-
}, { "./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,
|
|
11467
|
-
Object.defineProperty(
|
|
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", {
|
|
11468
11396
|
value: true
|
|
11469
11397
|
});
|
|
11470
|
-
|
|
11398
|
+
exports$12.default = checkObject;
|
|
11471
11399
|
function checkObject(e) {
|
|
11472
11400
|
const t = typeof e;
|
|
11473
11401
|
return t === "object" && e !== null || t === "function";
|
|
11474
11402
|
}
|
|
11475
|
-
}, {}], 44: [function(require2, module2,
|
|
11476
|
-
Object.defineProperty(
|
|
11403
|
+
}, {}], 44: [function(require2, module2, exports$12) {
|
|
11404
|
+
Object.defineProperty(exports$12, "t", {
|
|
11477
11405
|
value: true
|
|
11478
11406
|
});
|
|
11479
|
-
|
|
11407
|
+
exports$12.throwIteratorAccessError = throwIteratorAccessError;
|
|
11480
11408
|
function throwIteratorAccessError() {
|
|
11481
11409
|
throw new RangeError("Iterator access denied!");
|
|
11482
11410
|
}
|
|
11483
|
-
}, {}], 45: [function(require2, module2,
|
|
11411
|
+
}, {}], 45: [function(require2, module2, exports$12) {
|
|
11484
11412
|
const Yallist = require2("yallist");
|
|
11485
11413
|
const MAX = Symbol("max");
|
|
11486
11414
|
const LENGTH = Symbol("length");
|
|
@@ -11743,7 +11671,7 @@ var mqtt = { exports: {} };
|
|
|
11743
11671
|
fn.call(thisp, hit.value, hit.key, self2);
|
|
11744
11672
|
};
|
|
11745
11673
|
module2.exports = LRUCache;
|
|
11746
|
-
}, { "yallist": 84 }], 46: [function(require2, module2,
|
|
11674
|
+
}, { "yallist": 84 }], 46: [function(require2, module2, exports$12) {
|
|
11747
11675
|
(function(Buffer2) {
|
|
11748
11676
|
(function() {
|
|
11749
11677
|
const protocol = module2.exports;
|
|
@@ -11905,7 +11833,7 @@ var mqtt = { exports: {} };
|
|
|
11905
11833
|
};
|
|
11906
11834
|
}).call(this);
|
|
11907
11835
|
}).call(this, require2("buffer").Buffer);
|
|
11908
|
-
}, { "buffer": 3 }], 47: [function(require2, module2,
|
|
11836
|
+
}, { "buffer": 3 }], 47: [function(require2, module2, exports$12) {
|
|
11909
11837
|
(function(Buffer2) {
|
|
11910
11838
|
(function() {
|
|
11911
11839
|
const writeToStream = require2("./writeToStream");
|
|
@@ -11952,11 +11880,11 @@ var mqtt = { exports: {} };
|
|
|
11952
11880
|
module2.exports = generate;
|
|
11953
11881
|
}).call(this);
|
|
11954
11882
|
}).call(this, require2("buffer").Buffer);
|
|
11955
|
-
}, { "./writeToStream": 52, "buffer": 3, "events": 4 }], 48: [function(require2, module2,
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
}, { "./generate": 47, "./parser": 51, "./writeToStream": 52 }], 49: [function(require2, module2,
|
|
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) {
|
|
11960
11888
|
(function(Buffer2) {
|
|
11961
11889
|
(function() {
|
|
11962
11890
|
const max = 65536;
|
|
@@ -12003,7 +11931,7 @@ var mqtt = { exports: {} };
|
|
|
12003
11931
|
};
|
|
12004
11932
|
}).call(this);
|
|
12005
11933
|
}).call(this, require2("buffer").Buffer);
|
|
12006
|
-
}, { "buffer": 3 }], 50: [function(require2, module2,
|
|
11934
|
+
}, { "buffer": 3 }], 50: [function(require2, module2, exports$12) {
|
|
12007
11935
|
class Packet {
|
|
12008
11936
|
constructor() {
|
|
12009
11937
|
this.cmd = null;
|
|
@@ -12016,7 +11944,7 @@ var mqtt = { exports: {} };
|
|
|
12016
11944
|
}
|
|
12017
11945
|
}
|
|
12018
11946
|
module2.exports = Packet;
|
|
12019
|
-
}, {}], 51: [function(require2, module2,
|
|
11947
|
+
}, {}], 51: [function(require2, module2, exports$12) {
|
|
12020
11948
|
const bl = require2("bl");
|
|
12021
11949
|
const EventEmitter = require2("events");
|
|
12022
11950
|
const Packet = require2("./packet");
|
|
@@ -12591,7 +12519,7 @@ var mqtt = { exports: {} };
|
|
|
12591
12519
|
}
|
|
12592
12520
|
}
|
|
12593
12521
|
module2.exports = Parser;
|
|
12594
|
-
}, { "./constants": 46, "./packet": 50, "bl": 19, "debug": 20, "events": 4 }], 52: [function(require2, module2,
|
|
12522
|
+
}, { "./constants": 46, "./packet": 50, "bl": 19, "debug": 20, "events": 4 }], 52: [function(require2, module2, exports$12) {
|
|
12595
12523
|
(function(Buffer2) {
|
|
12596
12524
|
(function() {
|
|
12597
12525
|
const protocol = require2("./constants");
|
|
@@ -12680,7 +12608,7 @@ var mqtt = { exports: {} };
|
|
|
12680
12608
|
const properties = settings.properties;
|
|
12681
12609
|
if (clean === void 0) clean = true;
|
|
12682
12610
|
let length = 0;
|
|
12683
|
-
if (
|
|
12611
|
+
if (typeof protocolId !== "string" && !Buffer2.isBuffer(protocolId)) {
|
|
12684
12612
|
stream.emit("error", new Error("Invalid protocolId"));
|
|
12685
12613
|
return false;
|
|
12686
12614
|
} else length += protocolId.length + 2;
|
|
@@ -13447,7 +13375,7 @@ var mqtt = { exports: {} };
|
|
|
13447
13375
|
module2.exports = generate;
|
|
13448
13376
|
}).call(this);
|
|
13449
13377
|
}).call(this, require2("buffer").Buffer);
|
|
13450
|
-
}, { "./constants": 46, "./numbers": 49, "buffer": 3, "debug": 20, "process-nextick-args": 57 }], 53: [function(require2, module2,
|
|
13378
|
+
}, { "./constants": 46, "./numbers": 49, "buffer": 3, "debug": 20, "process-nextick-args": 57 }], 53: [function(require2, module2, exports$12) {
|
|
13451
13379
|
var s = 1e3;
|
|
13452
13380
|
var m = s * 60;
|
|
13453
13381
|
var h = m * 60;
|
|
@@ -13558,10 +13486,10 @@ var mqtt = { exports: {} };
|
|
|
13558
13486
|
var isPlural = msAbs >= n * 1.5;
|
|
13559
13487
|
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
13560
13488
|
}
|
|
13561
|
-
}, {}], 54: [function(require2, module2,
|
|
13489
|
+
}, {}], 54: [function(require2, module2, exports$12) {
|
|
13562
13490
|
const NumberAllocator = require2("./lib/number-allocator.js");
|
|
13563
13491
|
module2.exports.NumberAllocator = NumberAllocator;
|
|
13564
|
-
}, { "./lib/number-allocator.js": 55 }], 55: [function(require2, module2,
|
|
13492
|
+
}, { "./lib/number-allocator.js": 55 }], 55: [function(require2, module2, exports$12) {
|
|
13565
13493
|
const SortedSet = require2("js-sdsl").OrderedSet;
|
|
13566
13494
|
const debugTrace = require2("debug")("number-allocator:trace");
|
|
13567
13495
|
const debugError = require2("debug")("number-allocator:error");
|
|
@@ -13711,7 +13639,7 @@ var mqtt = { exports: {} };
|
|
|
13711
13639
|
}
|
|
13712
13640
|
};
|
|
13713
13641
|
module2.exports = NumberAllocator;
|
|
13714
|
-
}, { "debug": 20, "js-sdsl": 42 }], 56: [function(require2, module2,
|
|
13642
|
+
}, { "debug": 20, "js-sdsl": 42 }], 56: [function(require2, module2, exports$12) {
|
|
13715
13643
|
var wrappy = require2("wrappy");
|
|
13716
13644
|
module2.exports = wrappy(once);
|
|
13717
13645
|
module2.exports.strict = wrappy(onceStrict);
|
|
@@ -13750,7 +13678,7 @@ var mqtt = { exports: {} };
|
|
|
13750
13678
|
f.called = false;
|
|
13751
13679
|
return f;
|
|
13752
13680
|
}
|
|
13753
|
-
}, { "wrappy": 80 }], 57: [function(require2, module2,
|
|
13681
|
+
}, { "wrappy": 80 }], 57: [function(require2, module2, exports$12) {
|
|
13754
13682
|
(function(process2) {
|
|
13755
13683
|
(function() {
|
|
13756
13684
|
if (typeof process2 === "undefined" || !process2.version || process2.version.indexOf("v0.") === 0 || process2.version.indexOf("v1.") === 0 && process2.version.indexOf("v1.8.") !== 0) {
|
|
@@ -13793,7 +13721,7 @@ var mqtt = { exports: {} };
|
|
|
13793
13721
|
}
|
|
13794
13722
|
}).call(this);
|
|
13795
13723
|
}).call(this, require2("_process"));
|
|
13796
|
-
}, { "_process": 85 }], 58: [function(require2, module2,
|
|
13724
|
+
}, { "_process": 85 }], 58: [function(require2, module2, exports$12) {
|
|
13797
13725
|
function _inheritsLoose(subClass, superClass) {
|
|
13798
13726
|
subClass.prototype = Object.create(superClass.prototype);
|
|
13799
13727
|
subClass.prototype.constructor = subClass;
|
|
@@ -13896,7 +13824,7 @@ var mqtt = { exports: {} };
|
|
|
13896
13824
|
}, TypeError);
|
|
13897
13825
|
createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
|
|
13898
13826
|
module2.exports.codes = codes;
|
|
13899
|
-
}, {}], 59: [function(require2, module2,
|
|
13827
|
+
}, {}], 59: [function(require2, module2, exports$12) {
|
|
13900
13828
|
(function(process2) {
|
|
13901
13829
|
(function() {
|
|
13902
13830
|
var objectKeys = Object.keys || function(obj) {
|
|
@@ -13986,7 +13914,7 @@ var mqtt = { exports: {} };
|
|
|
13986
13914
|
});
|
|
13987
13915
|
}).call(this);
|
|
13988
13916
|
}).call(this, require2("_process"));
|
|
13989
|
-
}, { "./_stream_readable": 61, "./_stream_writable": 63, "_process": 85, "inherits": 24 }], 60: [function(require2, module2,
|
|
13917
|
+
}, { "./_stream_readable": 61, "./_stream_writable": 63, "_process": 85, "inherits": 24 }], 60: [function(require2, module2, exports$12) {
|
|
13990
13918
|
module2.exports = PassThrough;
|
|
13991
13919
|
var Transform = require2("./_stream_transform");
|
|
13992
13920
|
require2("inherits")(PassThrough, Transform);
|
|
@@ -13997,7 +13925,7 @@ var mqtt = { exports: {} };
|
|
|
13997
13925
|
PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
|
13998
13926
|
cb(null, chunk);
|
|
13999
13927
|
};
|
|
14000
|
-
}, { "./_stream_transform": 62, "inherits": 24 }], 61: [function(require2, module2,
|
|
13928
|
+
}, { "./_stream_transform": 62, "inherits": 24 }], 61: [function(require2, module2, exports$12) {
|
|
14001
13929
|
(function(process2, global2) {
|
|
14002
13930
|
(function() {
|
|
14003
13931
|
module2.exports = Readable;
|
|
@@ -14726,7 +14654,7 @@ var mqtt = { exports: {} };
|
|
|
14726
14654
|
}
|
|
14727
14655
|
}).call(this);
|
|
14728
14656
|
}).call(this, require2("_process"), typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
|
|
14729
|
-
}, { "../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,
|
|
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) {
|
|
14730
14658
|
module2.exports = Transform;
|
|
14731
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;
|
|
14732
14660
|
var Duplex = require2("./_stream_duplex");
|
|
@@ -14817,7 +14745,7 @@ var mqtt = { exports: {} };
|
|
|
14817
14745
|
if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
|
14818
14746
|
return stream.push(null);
|
|
14819
14747
|
}
|
|
14820
|
-
}, { "../errors": 58, "./_stream_duplex": 59, "inherits": 24 }], 63: [function(require2, module2,
|
|
14748
|
+
}, { "../errors": 58, "./_stream_duplex": 59, "inherits": 24 }], 63: [function(require2, module2, exports$12) {
|
|
14821
14749
|
(function(process2, global2) {
|
|
14822
14750
|
(function() {
|
|
14823
14751
|
module2.exports = Writable;
|
|
@@ -15277,7 +15205,7 @@ var mqtt = { exports: {} };
|
|
|
15277
15205
|
};
|
|
15278
15206
|
}).call(this);
|
|
15279
15207
|
}).call(this, require2("_process"), typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
|
|
15280
|
-
}, { "../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,
|
|
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) {
|
|
15281
15209
|
(function(process2) {
|
|
15282
15210
|
(function() {
|
|
15283
15211
|
var _Object$setPrototypeO;
|
|
@@ -15443,7 +15371,7 @@ var mqtt = { exports: {} };
|
|
|
15443
15371
|
module2.exports = createReadableStreamAsyncIterator;
|
|
15444
15372
|
}).call(this);
|
|
15445
15373
|
}).call(this, require2("_process"));
|
|
15446
|
-
}, { "./end-of-stream": 67, "_process": 85 }], 65: [function(require2, module2,
|
|
15374
|
+
}, { "./end-of-stream": 67, "_process": 85 }], 65: [function(require2, module2, exports$12) {
|
|
15447
15375
|
function ownKeys(object, enumerableOnly) {
|
|
15448
15376
|
var keys = Object.keys(object);
|
|
15449
15377
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -15669,7 +15597,7 @@ var mqtt = { exports: {} };
|
|
|
15669
15597
|
}]);
|
|
15670
15598
|
return BufferList;
|
|
15671
15599
|
}();
|
|
15672
|
-
}, { "buffer": 3, "util": 2 }], 66: [function(require2, module2,
|
|
15600
|
+
}, { "buffer": 3, "util": 2 }], 66: [function(require2, module2, exports$12) {
|
|
15673
15601
|
(function(process2) {
|
|
15674
15602
|
(function() {
|
|
15675
15603
|
function destroy(err, cb) {
|
|
@@ -15756,7 +15684,7 @@ var mqtt = { exports: {} };
|
|
|
15756
15684
|
};
|
|
15757
15685
|
}).call(this);
|
|
15758
15686
|
}).call(this, require2("_process"));
|
|
15759
|
-
}, { "_process": 85 }], 67: [function(require2, module2,
|
|
15687
|
+
}, { "_process": 85 }], 67: [function(require2, module2, exports$12) {
|
|
15760
15688
|
var ERR_STREAM_PREMATURE_CLOSE = require2("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;
|
|
15761
15689
|
function once(callback) {
|
|
15762
15690
|
var called = false;
|
|
@@ -15839,11 +15767,11 @@ var mqtt = { exports: {} };
|
|
|
15839
15767
|
};
|
|
15840
15768
|
}
|
|
15841
15769
|
module2.exports = eos;
|
|
15842
|
-
}, { "../../../errors": 58 }], 68: [function(require2, module2,
|
|
15770
|
+
}, { "../../../errors": 58 }], 68: [function(require2, module2, exports$12) {
|
|
15843
15771
|
module2.exports = function() {
|
|
15844
15772
|
throw new Error("Readable.from is not available in the browser");
|
|
15845
15773
|
};
|
|
15846
|
-
}, {}], 69: [function(require2, module2,
|
|
15774
|
+
}, {}], 69: [function(require2, module2, exports$12) {
|
|
15847
15775
|
var eos;
|
|
15848
15776
|
function once(callback) {
|
|
15849
15777
|
var called = false;
|
|
@@ -15920,7 +15848,7 @@ var mqtt = { exports: {} };
|
|
|
15920
15848
|
return streams.reduce(pipe);
|
|
15921
15849
|
}
|
|
15922
15850
|
module2.exports = pipeline;
|
|
15923
|
-
}, { "../../../errors": 58, "./end-of-stream": 67 }], 70: [function(require2, module2,
|
|
15851
|
+
}, { "../../../errors": 58, "./end-of-stream": 67 }], 70: [function(require2, module2, exports$12) {
|
|
15924
15852
|
var ERR_INVALID_OPT_VALUE = require2("../../../errors").codes.ERR_INVALID_OPT_VALUE;
|
|
15925
15853
|
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
|
15926
15854
|
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
|
@@ -15939,19 +15867,19 @@ var mqtt = { exports: {} };
|
|
|
15939
15867
|
module2.exports = {
|
|
15940
15868
|
getHighWaterMark
|
|
15941
15869
|
};
|
|
15942
|
-
}, { "../../../errors": 58 }], 71: [function(require2, module2,
|
|
15870
|
+
}, { "../../../errors": 58 }], 71: [function(require2, module2, exports$12) {
|
|
15943
15871
|
module2.exports = require2("events").EventEmitter;
|
|
15944
|
-
}, { "events": 4 }], 72: [function(require2, module2,
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
}, { "./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,
|
|
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) {
|
|
15955
15883
|
function ReInterval(callback, interval, args) {
|
|
15956
15884
|
var self2 = this;
|
|
15957
15885
|
this._callback = callback;
|
|
@@ -15994,9 +15922,9 @@ var mqtt = { exports: {} };
|
|
|
15994
15922
|
return new ReInterval(arguments[0], arguments[1], args);
|
|
15995
15923
|
}
|
|
15996
15924
|
module2.exports = reInterval;
|
|
15997
|
-
}, {}], 74: [function(require2, module2,
|
|
15925
|
+
}, {}], 74: [function(require2, module2, exports$12) {
|
|
15998
15926
|
module2.exports = require2("./index.js")();
|
|
15999
|
-
}, { "./index.js": 75 }], 75: [function(require2, module2,
|
|
15927
|
+
}, { "./index.js": 75 }], 75: [function(require2, module2, exports$12) {
|
|
16000
15928
|
(function(Buffer2) {
|
|
16001
15929
|
(function() {
|
|
16002
15930
|
module2.exports = rfdc;
|
|
@@ -16179,7 +16107,7 @@ var mqtt = { exports: {} };
|
|
|
16179
16107
|
}
|
|
16180
16108
|
}).call(this);
|
|
16181
16109
|
}).call(this, require2("buffer").Buffer);
|
|
16182
|
-
}, { "buffer": 3 }], 76: [function(require2, module2,
|
|
16110
|
+
}, { "buffer": 3 }], 76: [function(require2, module2, exports$12) {
|
|
16183
16111
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
16184
16112
|
var buffer = require2("buffer");
|
|
16185
16113
|
var Buffer2 = buffer.Buffer;
|
|
@@ -16191,8 +16119,8 @@ var mqtt = { exports: {} };
|
|
|
16191
16119
|
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
16192
16120
|
module2.exports = buffer;
|
|
16193
16121
|
} else {
|
|
16194
|
-
copyProps(buffer,
|
|
16195
|
-
|
|
16122
|
+
copyProps(buffer, exports$12);
|
|
16123
|
+
exports$12.Buffer = SafeBuffer;
|
|
16196
16124
|
}
|
|
16197
16125
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
16198
16126
|
return Buffer2(arg, encodingOrOffset, length);
|
|
@@ -16233,7 +16161,7 @@ var mqtt = { exports: {} };
|
|
|
16233
16161
|
}
|
|
16234
16162
|
return buffer.SlowBuffer(size);
|
|
16235
16163
|
};
|
|
16236
|
-
}, { "buffer": 3 }], 77: [function(require2, module2,
|
|
16164
|
+
}, { "buffer": 3 }], 77: [function(require2, module2, exports$12) {
|
|
16237
16165
|
module2.exports = shift;
|
|
16238
16166
|
function shift(stream) {
|
|
16239
16167
|
var rs = stream._readableState;
|
|
@@ -16249,7 +16177,7 @@ var mqtt = { exports: {} };
|
|
|
16249
16177
|
}
|
|
16250
16178
|
return state.length;
|
|
16251
16179
|
}
|
|
16252
|
-
}, {}], 78: [function(require2, module2,
|
|
16180
|
+
}, {}], 78: [function(require2, module2, exports$12) {
|
|
16253
16181
|
var Buffer2 = require2("safe-buffer").Buffer;
|
|
16254
16182
|
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
16255
16183
|
encoding = "" + encoding;
|
|
@@ -16302,7 +16230,7 @@ var mqtt = { exports: {} };
|
|
|
16302
16230
|
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
|
|
16303
16231
|
return nenc || enc;
|
|
16304
16232
|
}
|
|
16305
|
-
|
|
16233
|
+
exports$12.StringDecoder = StringDecoder;
|
|
16306
16234
|
function StringDecoder(encoding) {
|
|
16307
16235
|
this.encoding = normalizeEncoding(encoding);
|
|
16308
16236
|
var nb;
|
|
@@ -16481,7 +16409,7 @@ var mqtt = { exports: {} };
|
|
|
16481
16409
|
function simpleEnd(buf) {
|
|
16482
16410
|
return buf && buf.length ? this.write(buf) : "";
|
|
16483
16411
|
}
|
|
16484
|
-
}, { "safe-buffer": 76 }], 79: [function(require2, module2,
|
|
16412
|
+
}, { "safe-buffer": 76 }], 79: [function(require2, module2, exports$12) {
|
|
16485
16413
|
(function(global2) {
|
|
16486
16414
|
(function() {
|
|
16487
16415
|
module2.exports = deprecate;
|
|
@@ -16517,7 +16445,7 @@ var mqtt = { exports: {} };
|
|
|
16517
16445
|
}
|
|
16518
16446
|
}).call(this);
|
|
16519
16447
|
}).call(this, typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
|
|
16520
|
-
}, {}], 80: [function(require2, module2,
|
|
16448
|
+
}, {}], 80: [function(require2, module2, exports$12) {
|
|
16521
16449
|
module2.exports = wrappy;
|
|
16522
16450
|
function wrappy(fn, cb) {
|
|
16523
16451
|
if (fn && cb) return wrappy(fn)(cb);
|
|
@@ -16542,13 +16470,13 @@ var mqtt = { exports: {} };
|
|
|
16542
16470
|
return ret;
|
|
16543
16471
|
}
|
|
16544
16472
|
}
|
|
16545
|
-
}, {}], 81: [function(require2, module2,
|
|
16473
|
+
}, {}], 81: [function(require2, module2, exports$12) {
|
|
16546
16474
|
module2.exports = function() {
|
|
16547
16475
|
throw new Error(
|
|
16548
16476
|
"ws does not work in the browser. Browser clients must use the native WebSocket object"
|
|
16549
16477
|
);
|
|
16550
16478
|
};
|
|
16551
|
-
}, {}], 82: [function(require2, module2,
|
|
16479
|
+
}, {}], 82: [function(require2, module2, exports$12) {
|
|
16552
16480
|
module2.exports = extend;
|
|
16553
16481
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
16554
16482
|
function extend() {
|
|
@@ -16563,7 +16491,7 @@ var mqtt = { exports: {} };
|
|
|
16563
16491
|
}
|
|
16564
16492
|
return target;
|
|
16565
16493
|
}
|
|
16566
|
-
}, {}], 83: [function(require2, module2,
|
|
16494
|
+
}, {}], 83: [function(require2, module2, exports$12) {
|
|
16567
16495
|
module2.exports = function(Yallist) {
|
|
16568
16496
|
Yallist.prototype[Symbol.iterator] = function* () {
|
|
16569
16497
|
for (let walker = this.head; walker; walker = walker.next) {
|
|
@@ -16571,7 +16499,7 @@ var mqtt = { exports: {} };
|
|
|
16571
16499
|
}
|
|
16572
16500
|
};
|
|
16573
16501
|
};
|
|
16574
|
-
}, {}], 84: [function(require2, module2,
|
|
16502
|
+
}, {}], 84: [function(require2, module2, exports$12) {
|
|
16575
16503
|
module2.exports = Yallist;
|
|
16576
16504
|
Yallist.Node = Node;
|
|
16577
16505
|
Yallist.create = Yallist;
|
|
@@ -16934,7 +16862,7 @@ var mqtt = { exports: {} };
|
|
|
16934
16862
|
require2("./iterator.js")(Yallist);
|
|
16935
16863
|
} catch (er) {
|
|
16936
16864
|
}
|
|
16937
|
-
}, { "./iterator.js": 83 }], 85: [function(require2, module2,
|
|
16865
|
+
}, { "./iterator.js": 83 }], 85: [function(require2, module2, exports$12) {
|
|
16938
16866
|
var process2 = module2.exports = {};
|
|
16939
16867
|
var cachedSetTimeout;
|
|
16940
16868
|
var cachedClearTimeout;
|
|
@@ -17091,11 +17019,11 @@ var mqtt = { exports: {} };
|
|
|
17091
17019
|
process2.umask = function() {
|
|
17092
17020
|
return 0;
|
|
17093
17021
|
};
|
|
17094
|
-
}, {}], 86: [function(require2, module2,
|
|
17022
|
+
}, {}], 86: [function(require2, module2, exports$12) {
|
|
17095
17023
|
(function(global2) {
|
|
17096
17024
|
(function() {
|
|
17097
17025
|
(function(root) {
|
|
17098
|
-
var freeExports = typeof
|
|
17026
|
+
var freeExports = typeof exports$12 == "object" && exports$12 && !exports$12.nodeType && exports$12;
|
|
17099
17027
|
var freeModule = typeof module2 == "object" && module2 && !module2.nodeType && module2;
|
|
17100
17028
|
var freeGlobal = typeof global2 == "object" && global2;
|
|
17101
17029
|
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
|
|
@@ -17332,7 +17260,7 @@ var mqtt = { exports: {} };
|
|
|
17332
17260
|
})(this);
|
|
17333
17261
|
}).call(this);
|
|
17334
17262
|
}).call(this, typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
|
|
17335
|
-
}, {}], 87: [function(require2, module2,
|
|
17263
|
+
}, {}], 87: [function(require2, module2, exports$12) {
|
|
17336
17264
|
function hasOwnProperty(obj, prop) {
|
|
17337
17265
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17338
17266
|
}
|
|
@@ -17377,7 +17305,7 @@ var mqtt = { exports: {} };
|
|
|
17377
17305
|
var isArray = Array.isArray || function(xs) {
|
|
17378
17306
|
return Object.prototype.toString.call(xs) === "[object Array]";
|
|
17379
17307
|
};
|
|
17380
|
-
}, {}], 88: [function(require2, module2,
|
|
17308
|
+
}, {}], 88: [function(require2, module2, exports$12) {
|
|
17381
17309
|
var stringifyPrimitive = function(v) {
|
|
17382
17310
|
switch (typeof v) {
|
|
17383
17311
|
case "string":
|
|
@@ -17429,17 +17357,17 @@ var mqtt = { exports: {} };
|
|
|
17429
17357
|
}
|
|
17430
17358
|
return res;
|
|
17431
17359
|
};
|
|
17432
|
-
}, {}], 89: [function(require2, module2,
|
|
17433
|
-
|
|
17434
|
-
|
|
17435
|
-
}, { "./decode": 87, "./encode": 88 }], 90: [function(require2, module2,
|
|
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) {
|
|
17436
17364
|
var punycode = require2("punycode");
|
|
17437
17365
|
var util = require2("./util");
|
|
17438
|
-
|
|
17439
|
-
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
|
|
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;
|
|
17443
17371
|
function Url() {
|
|
17444
17372
|
this.protocol = null;
|
|
17445
17373
|
this.slashes = null;
|
|
@@ -17884,7 +17812,7 @@ var mqtt = { exports: {} };
|
|
|
17884
17812
|
}
|
|
17885
17813
|
if (host) this.hostname = host;
|
|
17886
17814
|
};
|
|
17887
|
-
}, { "./util": 91, "punycode": 86, "querystring": 89 }], 91: [function(require2, module2,
|
|
17815
|
+
}, { "./util": 91, "punycode": 86, "querystring": 89 }], 91: [function(require2, module2, exports$12) {
|
|
17888
17816
|
module2.exports = {
|
|
17889
17817
|
isString: function(arg) {
|
|
17890
17818
|
return typeof arg === "string";
|
|
@@ -18316,7 +18244,6 @@ class WebGL {
|
|
|
18316
18244
|
export {
|
|
18317
18245
|
AjaxUtil,
|
|
18318
18246
|
ArrayUtil,
|
|
18319
|
-
AssertUtil,
|
|
18320
18247
|
AudioPlayer,
|
|
18321
18248
|
BrowserUtil,
|
|
18322
18249
|
CanvasDrawer,
|
|
@@ -18332,7 +18259,7 @@ export {
|
|
|
18332
18259
|
ExceptionUtil,
|
|
18333
18260
|
FileUtil,
|
|
18334
18261
|
FormType,
|
|
18335
|
-
|
|
18262
|
+
FullScreen_default as FullScreen,
|
|
18336
18263
|
GeoJsonUtil,
|
|
18337
18264
|
GeoUtil,
|
|
18338
18265
|
GraphicType,
|