@idm-plugin/geo 1.5.4 → 1.5.5
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/index.js +239 -233
- package/dist/index.umd.cjs +2 -2
- package/dist/lane/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,57 +19,57 @@ var M0 = { exports: {} };
|
|
|
19
19
|
M.version === void 0 && M.default && (M = M.default);
|
|
20
20
|
var z = "0.5.45", p = {}, O = {}, A = {}, b = {}, W = {}, q;
|
|
21
21
|
(!M || typeof M.version != "string") && D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
|
|
22
|
-
var o = M.version.split("."), R = +o[0],
|
|
23
|
-
(R < 2 || R === 2 &&
|
|
22
|
+
var o = M.version.split("."), R = +o[0], d = +o[1];
|
|
23
|
+
(R < 2 || R === 2 && d < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
|
|
24
24
|
function i(c) {
|
|
25
25
|
return c > 96 ? c - 87 : c > 64 ? c - 29 : c - 48;
|
|
26
26
|
}
|
|
27
27
|
function e(c) {
|
|
28
|
-
var
|
|
29
|
-
for (c.charCodeAt(0) === 45 && (
|
|
30
|
-
t = i(n.charCodeAt(
|
|
31
|
-
for (
|
|
32
|
-
f = f / 60, t = i(L.charCodeAt(
|
|
28
|
+
var a = 0, X = c.split("."), n = X[0], L = X[1] || "", f = 1, t, B = 0, V = 1;
|
|
29
|
+
for (c.charCodeAt(0) === 45 && (a = 1, V = -1), a; a < n.length; a++)
|
|
30
|
+
t = i(n.charCodeAt(a)), B = 60 * B + t;
|
|
31
|
+
for (a = 0; a < L.length; a++)
|
|
32
|
+
f = f / 60, t = i(L.charCodeAt(a)), B += t * f;
|
|
33
33
|
return B * V;
|
|
34
34
|
}
|
|
35
35
|
function u(c) {
|
|
36
|
-
for (var
|
|
37
|
-
c[
|
|
36
|
+
for (var a = 0; a < c.length; a++)
|
|
37
|
+
c[a] = e(c[a]);
|
|
38
38
|
}
|
|
39
|
-
function S(c,
|
|
40
|
-
for (var
|
|
41
|
-
c[
|
|
42
|
-
c[
|
|
39
|
+
function S(c, a) {
|
|
40
|
+
for (var X = 0; X < a; X++)
|
|
41
|
+
c[X] = Math.round((c[X - 1] || 0) + c[X] * 6e4);
|
|
42
|
+
c[a - 1] = 1 / 0;
|
|
43
43
|
}
|
|
44
|
-
function s(c,
|
|
45
|
-
var
|
|
46
|
-
for (n = 0; n <
|
|
47
|
-
|
|
48
|
-
return
|
|
44
|
+
function s(c, a) {
|
|
45
|
+
var X = [], n;
|
|
46
|
+
for (n = 0; n < a.length; n++)
|
|
47
|
+
X[n] = c[a[n]];
|
|
48
|
+
return X;
|
|
49
49
|
}
|
|
50
50
|
function P(c) {
|
|
51
|
-
var
|
|
52
|
-
return u(
|
|
53
|
-
name:
|
|
54
|
-
abbrs: s(
|
|
55
|
-
offsets: s(
|
|
51
|
+
var a = c.split("|"), X = a[2].split(" "), n = a[3].split(""), L = a[4].split(" ");
|
|
52
|
+
return u(X), u(n), u(L), S(L, n.length), {
|
|
53
|
+
name: a[0],
|
|
54
|
+
abbrs: s(a[1].split(" "), n),
|
|
55
|
+
offsets: s(X, n),
|
|
56
56
|
untils: L,
|
|
57
|
-
population:
|
|
57
|
+
population: a[5] | 0
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
function G(c) {
|
|
61
61
|
c && this._set(P(c));
|
|
62
62
|
}
|
|
63
|
-
function l(c,
|
|
64
|
-
var
|
|
65
|
-
if (c <
|
|
63
|
+
function l(c, a) {
|
|
64
|
+
var X = a.length;
|
|
65
|
+
if (c < a[0])
|
|
66
66
|
return 0;
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
-
if (c >= X
|
|
67
|
+
if (X > 1 && a[X - 1] === 1 / 0 && c >= a[X - 2])
|
|
68
|
+
return X - 1;
|
|
69
|
+
if (c >= a[X - 1])
|
|
70
70
|
return -1;
|
|
71
|
-
for (var n, L = 0, f =
|
|
72
|
-
n = Math.floor((L + f) / 2),
|
|
71
|
+
for (var n, L = 0, f = X - 1; f - L > 1; )
|
|
72
|
+
n = Math.floor((L + f) / 2), a[n] <= c ? L = n : f = n;
|
|
73
73
|
return f;
|
|
74
74
|
}
|
|
75
75
|
G.prototype = {
|
|
@@ -77,22 +77,22 @@ var M0 = { exports: {} };
|
|
|
77
77
|
this.name = c.name, this.abbrs = c.abbrs, this.untils = c.untils, this.offsets = c.offsets, this.population = c.population;
|
|
78
78
|
},
|
|
79
79
|
_index: function(c) {
|
|
80
|
-
var
|
|
81
|
-
if (n = l(
|
|
80
|
+
var a = +c, X = this.untils, n;
|
|
81
|
+
if (n = l(a, X), n >= 0)
|
|
82
82
|
return n;
|
|
83
83
|
},
|
|
84
84
|
countries: function() {
|
|
85
85
|
var c = this.name;
|
|
86
|
-
return Object.keys(A).filter(function(
|
|
87
|
-
return A[
|
|
86
|
+
return Object.keys(A).filter(function(a) {
|
|
87
|
+
return A[a].zones.indexOf(c) !== -1;
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
90
|
parse: function(c) {
|
|
91
|
-
var
|
|
91
|
+
var a = +c, X = this.offsets, n = this.untils, L = n.length - 1, f, t, B, V;
|
|
92
92
|
for (V = 0; V < L; V++)
|
|
93
|
-
if (f =
|
|
94
|
-
return
|
|
95
|
-
return
|
|
93
|
+
if (f = X[V], t = X[V + 1], B = X[V && V - 1], f < t && U.moveAmbiguousForward ? f = t : f > B && U.moveInvalidForward && (f = B), a < n[V] - f * 6e4)
|
|
94
|
+
return X[V];
|
|
95
|
+
return X[L];
|
|
96
96
|
},
|
|
97
97
|
abbr: function(c) {
|
|
98
98
|
return this.abbrs[this._index(c)];
|
|
@@ -104,12 +104,12 @@ var M0 = { exports: {} };
|
|
|
104
104
|
return this.offsets[this._index(c)];
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
-
function N(c,
|
|
108
|
-
this.name = c, this.zones =
|
|
107
|
+
function N(c, a) {
|
|
108
|
+
this.name = c, this.zones = a;
|
|
109
109
|
}
|
|
110
110
|
function E(c) {
|
|
111
|
-
var
|
|
112
|
-
|
|
111
|
+
var a = c.toTimeString(), X = a.match(/\([a-z ]+\)/i);
|
|
112
|
+
X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X = a.match(/[A-Z]{3,5}/g), X = X ? X[0] : void 0), X === "GMT" && (X = void 0), this.at = +c, this.abbr = X, this.offset = c.getTimezoneOffset();
|
|
113
113
|
}
|
|
114
114
|
function Q(c) {
|
|
115
115
|
this.zone = c, this.offsetScore = 0, this.abbrScore = 0;
|
|
@@ -117,55 +117,55 @@ var M0 = { exports: {} };
|
|
|
117
117
|
Q.prototype.scoreOffsetAt = function(c) {
|
|
118
118
|
this.offsetScore += Math.abs(this.zone.utcOffset(c.at) - c.offset), this.zone.abbr(c.at).replace(/[^A-Z]/g, "") !== c.abbr && this.abbrScore++;
|
|
119
119
|
};
|
|
120
|
-
function F(c,
|
|
121
|
-
for (var
|
|
122
|
-
|
|
120
|
+
function F(c, a) {
|
|
121
|
+
for (var X, n; n = ((a.at - c.at) / 12e4 | 0) * 6e4; )
|
|
122
|
+
X = new E(new Date(c.at + n)), X.offset === c.offset ? c = X : a = X;
|
|
123
123
|
return c;
|
|
124
124
|
}
|
|
125
125
|
function $() {
|
|
126
|
-
var c = (/* @__PURE__ */ new Date()).getFullYear() - 2,
|
|
126
|
+
var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new E(new Date(c, 0, 1)), X = a.offset, n = [a], L, f, t, B;
|
|
127
127
|
for (B = 1; B < 48; B++)
|
|
128
|
-
t = new Date(c, B, 1).getTimezoneOffset(), t !==
|
|
128
|
+
t = new Date(c, B, 1).getTimezoneOffset(), t !== X && (f = new E(new Date(c, B, 1)), L = F(a, f), n.push(L), n.push(new E(new Date(L.at + 6e4))), a = f, X = t);
|
|
129
129
|
for (B = 0; B < 4; B++)
|
|
130
130
|
n.push(new E(new Date(c + B, 0, 1))), n.push(new E(new Date(c + B, 6, 1)));
|
|
131
131
|
return n;
|
|
132
132
|
}
|
|
133
|
-
function b0(c,
|
|
134
|
-
return c.offsetScore !==
|
|
133
|
+
function b0(c, a) {
|
|
134
|
+
return c.offsetScore !== a.offsetScore ? c.offsetScore - a.offsetScore : c.abbrScore !== a.abbrScore ? c.abbrScore - a.abbrScore : c.zone.population !== a.zone.population ? a.zone.population - c.zone.population : a.zone.name.localeCompare(c.zone.name);
|
|
135
135
|
}
|
|
136
|
-
function p0(c,
|
|
137
|
-
var
|
|
138
|
-
for (u(
|
|
139
|
-
n = X
|
|
136
|
+
function p0(c, a) {
|
|
137
|
+
var X, n;
|
|
138
|
+
for (u(a), X = 0; X < a.length; X++)
|
|
139
|
+
n = a[X], W[n] = W[n] || {}, W[n][c] = !0;
|
|
140
140
|
}
|
|
141
141
|
function O0(c) {
|
|
142
|
-
var
|
|
143
|
-
for (f = 0; f <
|
|
142
|
+
var a = c.length, X = {}, n = [], L = {}, f, t, B, V;
|
|
143
|
+
for (f = 0; f < a; f++)
|
|
144
144
|
if (B = c[f].offset, !L.hasOwnProperty(B)) {
|
|
145
145
|
V = W[B] || {};
|
|
146
146
|
for (t in V)
|
|
147
|
-
V.hasOwnProperty(t) && (
|
|
147
|
+
V.hasOwnProperty(t) && (X[t] = !0);
|
|
148
148
|
L[B] = !0;
|
|
149
149
|
}
|
|
150
|
-
for (f in
|
|
151
|
-
|
|
150
|
+
for (f in X)
|
|
151
|
+
X.hasOwnProperty(f) && n.push(b[f]);
|
|
152
152
|
return n;
|
|
153
153
|
}
|
|
154
154
|
function A0() {
|
|
155
155
|
try {
|
|
156
156
|
var c = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
157
157
|
if (c && c.length > 3) {
|
|
158
|
-
var
|
|
159
|
-
if (
|
|
160
|
-
return
|
|
158
|
+
var a = b[h(c)];
|
|
159
|
+
if (a)
|
|
160
|
+
return a;
|
|
161
161
|
D("Moment Timezone found " + c + " from the Intl api, but did not have that data loaded.");
|
|
162
162
|
}
|
|
163
163
|
} catch {
|
|
164
164
|
}
|
|
165
|
-
var
|
|
165
|
+
var X = $(), n = X.length, L = O0(X), f = [], t, B, V;
|
|
166
166
|
for (B = 0; B < L.length; B++) {
|
|
167
167
|
for (t = new Q(m(L[B])), V = 0; V < n; V++)
|
|
168
|
-
t.scoreOffsetAt(
|
|
168
|
+
t.scoreOffsetAt(X[V]);
|
|
169
169
|
f.push(t);
|
|
170
170
|
}
|
|
171
171
|
return f.sort(b0), f.length > 0 ? f[0].zone.name : void 0;
|
|
@@ -173,89 +173,89 @@ var M0 = { exports: {} };
|
|
|
173
173
|
function c0(c) {
|
|
174
174
|
return (!q || c) && (q = A0()), q;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function h(c) {
|
|
177
177
|
return (c || "").toLowerCase().replace(/\//g, "_");
|
|
178
178
|
}
|
|
179
179
|
function v(c) {
|
|
180
|
-
var
|
|
181
|
-
for (typeof c == "string" && (c = [c]),
|
|
182
|
-
n = c[
|
|
180
|
+
var a, X, n, L;
|
|
181
|
+
for (typeof c == "string" && (c = [c]), a = 0; a < c.length; a++)
|
|
182
|
+
n = c[a].split("|"), X = n[0], L = h(X), p[L] = c[a], b[L] = X, p0(L, n[2].split(" "));
|
|
183
183
|
}
|
|
184
|
-
function m(c,
|
|
185
|
-
c =
|
|
186
|
-
var
|
|
187
|
-
return
|
|
184
|
+
function m(c, a) {
|
|
185
|
+
c = h(c);
|
|
186
|
+
var X = p[c], n;
|
|
187
|
+
return X instanceof G ? X : typeof X == "string" ? (X = new G(X), p[c] = X, X) : O[c] && a !== m && (n = m(O[c], m)) ? (X = p[c] = new G(), X._set(n), X.name = b[c], X) : null;
|
|
188
188
|
}
|
|
189
189
|
function W0() {
|
|
190
|
-
var c,
|
|
190
|
+
var c, a = [];
|
|
191
191
|
for (c in b)
|
|
192
|
-
b.hasOwnProperty(c) && (p[c] || p[O[c]]) && b[c] &&
|
|
193
|
-
return
|
|
192
|
+
b.hasOwnProperty(c) && (p[c] || p[O[c]]) && b[c] && a.push(b[c]);
|
|
193
|
+
return a.sort();
|
|
194
194
|
}
|
|
195
195
|
function q0() {
|
|
196
196
|
return Object.keys(A);
|
|
197
197
|
}
|
|
198
198
|
function y(c) {
|
|
199
|
-
var
|
|
200
|
-
for (typeof c == "string" && (c = [c]),
|
|
201
|
-
|
|
199
|
+
var a, X, n, L;
|
|
200
|
+
for (typeof c == "string" && (c = [c]), a = 0; a < c.length; a++)
|
|
201
|
+
X = c[a].split("|"), n = h(X[0]), L = h(X[1]), O[n] = L, b[n] = X[0], O[L] = n, b[L] = X[1];
|
|
202
202
|
}
|
|
203
203
|
function o0(c) {
|
|
204
|
-
var
|
|
204
|
+
var a, X, n, L;
|
|
205
205
|
if (!(!c || !c.length))
|
|
206
|
-
for (
|
|
207
|
-
L = c[
|
|
208
|
-
|
|
206
|
+
for (a = 0; a < c.length; a++)
|
|
207
|
+
L = c[a].split("|"), X = L[0].toUpperCase(), n = L[1].split(" "), A[X] = new N(
|
|
208
|
+
X,
|
|
209
209
|
n
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
function Y0(c) {
|
|
213
213
|
return c = c.toUpperCase(), A[c] || null;
|
|
214
214
|
}
|
|
215
|
-
function d0(c,
|
|
215
|
+
function d0(c, a) {
|
|
216
216
|
if (c = Y0(c), !c)
|
|
217
217
|
return null;
|
|
218
|
-
var
|
|
219
|
-
return
|
|
218
|
+
var X = c.zones.sort();
|
|
219
|
+
return a ? X.map(function(n) {
|
|
220
220
|
var L = m(n);
|
|
221
221
|
return {
|
|
222
222
|
name: n,
|
|
223
223
|
offset: L.utcOffset(/* @__PURE__ */ new Date())
|
|
224
224
|
};
|
|
225
|
-
}) :
|
|
225
|
+
}) : X;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function a0(c) {
|
|
228
228
|
v(c.zones), y(c.links), o0(c.countries), U.dataVersion = c.version;
|
|
229
229
|
}
|
|
230
230
|
function J(c) {
|
|
231
231
|
return J.didShowError || (J.didShowError = !0, D("moment.tz.zoneExists('" + c + "') has been deprecated in favor of !moment.tz.zone('" + c + "')")), !!m(c);
|
|
232
232
|
}
|
|
233
233
|
function k(c) {
|
|
234
|
-
var
|
|
235
|
-
return !!(c._a && c._tzm === void 0 && !
|
|
234
|
+
var a = c._f === "X" || c._f === "x";
|
|
235
|
+
return !!(c._a && c._tzm === void 0 && !a);
|
|
236
236
|
}
|
|
237
237
|
function D(c) {
|
|
238
238
|
typeof console < "u" && typeof console.error == "function" && console.error(c);
|
|
239
239
|
}
|
|
240
240
|
function U(c) {
|
|
241
|
-
var
|
|
242
|
-
return !M.isMoment(c) && k(n) && (L = m(
|
|
241
|
+
var a = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], n = M.utc.apply(null, a), L;
|
|
242
|
+
return !M.isMoment(c) && k(n) && (L = m(X)) && n.add(L.parse(n), "minutes"), n.tz(X), n;
|
|
243
243
|
}
|
|
244
|
-
U.version = z, U.dataVersion = "", U._zones = p, U._links = O, U._names = b, U._countries = A, U.add = v, U.link = y, U.load =
|
|
244
|
+
U.version = z, U.dataVersion = "", U._zones = p, U._links = O, U._names = b, U._countries = A, U.add = v, U.link = y, U.load = a0, U.zone = m, U.zoneExists = J, U.guess = c0, U.names = W0, U.Zone = G, U.unpack = P, U.unpackBase60 = e, U.needsOffset = k, U.moveInvalidForward = !0, U.moveAmbiguousForward = !1, U.countries = q0, U.zonesForCountry = d0;
|
|
245
245
|
var C = M.fn;
|
|
246
|
-
M.tz = U, M.defaultZone = null, M.updateOffset = function(c,
|
|
247
|
-
var
|
|
248
|
-
if (c._z === void 0 && (
|
|
246
|
+
M.tz = U, M.defaultZone = null, M.updateOffset = function(c, a) {
|
|
247
|
+
var X = M.defaultZone, n;
|
|
248
|
+
if (c._z === void 0 && (X && k(c) && !c._isUTC && c.isValid() && (c._d = M.utc(c._a)._d, c.utc().add(X.parse(c), "minutes")), c._z = X), c._z)
|
|
249
249
|
if (n = c._z.utcOffset(c), Math.abs(n) < 16 && (n = n / 60), c.utcOffset !== void 0) {
|
|
250
250
|
var L = c._z;
|
|
251
|
-
c.utcOffset(-n,
|
|
251
|
+
c.utcOffset(-n, a), c._z = L;
|
|
252
252
|
} else
|
|
253
|
-
c.zone(n,
|
|
254
|
-
}, C.tz = function(c,
|
|
253
|
+
c.zone(n, a);
|
|
254
|
+
}, C.tz = function(c, a) {
|
|
255
255
|
if (c) {
|
|
256
256
|
if (typeof c != "string")
|
|
257
257
|
throw new Error("Time zone name must be a string, got " + c + " [" + typeof c + "]");
|
|
258
|
-
return this._z = m(c), this._z ? M.updateOffset(this,
|
|
258
|
+
return this._z = m(c), this._z ? M.updateOffset(this, a) : D("Moment Timezone has no data for " + c + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
|
|
259
259
|
}
|
|
260
260
|
if (this._z)
|
|
261
261
|
return this._z.name;
|
|
@@ -270,16 +270,16 @@ var M0 = { exports: {} };
|
|
|
270
270
|
return this._z = null, c.apply(this, arguments);
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function X0(c) {
|
|
274
274
|
return function() {
|
|
275
275
|
return arguments.length > 0 && (this._z = null), c.apply(this, arguments);
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
|
-
C.zoneName = w(C.zoneName), C.zoneAbbr = w(C.zoneAbbr), C.utc = _(C.utc), C.local = _(C.local), C.utcOffset =
|
|
279
|
-
return (R < 2 || R === 2 &&
|
|
278
|
+
C.zoneName = w(C.zoneName), C.zoneAbbr = w(C.zoneAbbr), C.utc = _(C.utc), C.local = _(C.local), C.utcOffset = X0(C.utcOffset), M.tz.setDefault = function(c) {
|
|
279
|
+
return (R < 2 || R === 2 && d < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = c ? m(c) : null, M;
|
|
280
280
|
};
|
|
281
|
-
var
|
|
282
|
-
return Object.prototype.toString.call(
|
|
281
|
+
var H = M.momentProperties;
|
|
282
|
+
return Object.prototype.toString.call(H) === "[object Array]" ? (H.push("_z"), H.push("_a")) : H && (H._z = null), M;
|
|
283
283
|
});
|
|
284
284
|
})(M0);
|
|
285
285
|
var L0 = M0.exports;
|
|
@@ -1145,16 +1145,16 @@ var z0 = { exports: {} };
|
|
|
1145
1145
|
throw new RangeError("invalid coordinates");
|
|
1146
1146
|
if (90 <= z)
|
|
1147
1147
|
return "Etc/GMT";
|
|
1148
|
-
var b = -1, W = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - z) / 180.00000000000003, o = 0 | W, R = 0 | q,
|
|
1149
|
-
for (
|
|
1150
|
-
|
|
1151
|
-
return A[
|
|
1148
|
+
var b = -1, W = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - z) / 180.00000000000003, o = 0 | W, R = 0 | q, d = 96 * R + 2 * o;
|
|
1149
|
+
for (d = 56 * O.charCodeAt(d) + O.charCodeAt(d + 1) - 1995; d + A.length < 3136; )
|
|
1150
|
+
d = 56 * O.charCodeAt(d = 8 * (b = b + d + 1) + 4 * (R = 0 | (q = 2 * (q - R) % 2)) + 2 * (o = 0 | (W = 2 * (W - o) % 2)) + 2304) + O.charCodeAt(d + 1) - 1995;
|
|
1151
|
+
return A[d + A.length - 3136];
|
|
1152
1152
|
}
|
|
1153
1153
|
I.exports = M;
|
|
1154
1154
|
})(z0);
|
|
1155
1155
|
var S0 = z0.exports;
|
|
1156
1156
|
const r0 = /* @__PURE__ */ n0(S0);
|
|
1157
|
-
class
|
|
1157
|
+
class Y {
|
|
1158
1158
|
/**
|
|
1159
1159
|
* 基于输入的经度,计算出时区
|
|
1160
1160
|
* @param lng
|
|
@@ -1174,17 +1174,17 @@ class d {
|
|
|
1174
1174
|
return p = p > 9 ? p : `0${p}`, z = z > 9 ? z : `0${z}`, M > 0 ? `+${z}:${p}` : `-${z}:${p}`;
|
|
1175
1175
|
}
|
|
1176
1176
|
static lng2pretty(M, z = 6, p = "H°M′") {
|
|
1177
|
-
z = z < 6 ? 6 : z, M =
|
|
1177
|
+
z = z < 6 ? 6 : z, M = Y.convertToStdLng(M, z);
|
|
1178
1178
|
let O = "E";
|
|
1179
1179
|
M < 0 && (O = "W"), M = Math.abs(M), p = p.toUpperCase();
|
|
1180
|
-
let A = M * 3600, b, W, q, o, R,
|
|
1181
|
-
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W =
|
|
1182
|
-
const i = `${p.replace(/S+/gi, W).replace(/M+/gi, o).replace(/H+/gi,
|
|
1180
|
+
let A = M * 3600, b, W, q, o, R, d;
|
|
1181
|
+
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = Y.padNumber(b, 2, 2)), q = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = Y.roundPrecision(q, z).toString().padStart(2, "0") : o = Y.padNumber(q, 2, 2), A = A - q * 60), R = A / 3600, p.indexOf("M") !== -1 ? d = Y.roundPrecision(R, z).toString().padStart(3, "0") : d = Y.padNumber(R, 3, 2), Number(W) >= 60 && (o = Number(o) + 1, W = 0), Number(o) >= 60 && (d = Number(d) + 1, o = 0);
|
|
1182
|
+
const i = `${p.replace(/S+/gi, W).replace(/M+/gi, o).replace(/H+/gi, d)}${O}`;
|
|
1183
1183
|
return {
|
|
1184
1184
|
direction: O,
|
|
1185
|
-
degree:
|
|
1186
|
-
minute:
|
|
1187
|
-
second:
|
|
1185
|
+
degree: Y.roundPrecision(R, z),
|
|
1186
|
+
minute: Y.roundPrecision(q, z),
|
|
1187
|
+
second: Y.roundPrecision(b, z),
|
|
1188
1188
|
pretty: i
|
|
1189
1189
|
};
|
|
1190
1190
|
}
|
|
@@ -1198,21 +1198,21 @@ class d {
|
|
|
1198
1198
|
z = z < 6 ? 6 : z, M = M % 180;
|
|
1199
1199
|
let O = "N";
|
|
1200
1200
|
M < 0 && (O = "S"), M = Math.abs(M), p = p.toUpperCase();
|
|
1201
|
-
let A = M * 3600, b, W, q, o, R,
|
|
1202
|
-
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W =
|
|
1203
|
-
const i = `${p.replace(/S+/gi, W).replace(/M+/gi, o).replace(/H+/gi,
|
|
1201
|
+
let A = M * 3600, b, W, q, o, R, d;
|
|
1202
|
+
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = Y.padNumber(b, 2, 2)), q = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = Y.roundPrecision(q, z).toString().padStart(2, "0") : o = Y.padNumber(q, 2, 2), A = A - q * 60), R = A / 3600, p.indexOf("M") !== -1 ? d = Y.roundPrecision(R, z).toString().padStart(2, "0") : d = Y.padNumber(R, 2, 2), Number(W) >= 60 && (o = Number(o) + 1, W = 0), Number(o) >= 60 && (d = Number(d) + 1, o = 0);
|
|
1203
|
+
const i = `${p.replace(/S+/gi, W).replace(/M+/gi, o).replace(/H+/gi, d)}${O}`;
|
|
1204
1204
|
return {
|
|
1205
1205
|
direction: O,
|
|
1206
|
-
degree:
|
|
1207
|
-
minute:
|
|
1208
|
-
second:
|
|
1206
|
+
degree: Y.roundPrecision(R, z),
|
|
1207
|
+
minute: Y.roundPrecision(q, z),
|
|
1208
|
+
second: Y.roundPrecision(b, z),
|
|
1209
1209
|
pretty: i
|
|
1210
1210
|
};
|
|
1211
1211
|
}
|
|
1212
1212
|
static str2Lng(M, z = 6) {
|
|
1213
1213
|
let p;
|
|
1214
1214
|
if (isNaN(M)) {
|
|
1215
|
-
M =
|
|
1215
|
+
M = Y.strReplace(M, "LNG");
|
|
1216
1216
|
const O = M[M.length - 1].toUpperCase();
|
|
1217
1217
|
M = M.substring(0, M.length - 1).trim();
|
|
1218
1218
|
const A = M.split(" ").filter((q) => q !== "").map((q) => Number(q));
|
|
@@ -1224,12 +1224,12 @@ class d {
|
|
|
1224
1224
|
p = b + (W ?? 0) / 60, O === "W" && (p = p * -1);
|
|
1225
1225
|
} else
|
|
1226
1226
|
p = Number(M);
|
|
1227
|
-
return
|
|
1227
|
+
return Y.convertToStdLng(p, z);
|
|
1228
1228
|
}
|
|
1229
1229
|
static str2Lat(M, z = 6) {
|
|
1230
1230
|
let p;
|
|
1231
1231
|
if (isNaN(M)) {
|
|
1232
|
-
M =
|
|
1232
|
+
M = Y.strReplace(M, "LAT");
|
|
1233
1233
|
const O = M[M.length - 1].toUpperCase();
|
|
1234
1234
|
M = M.substring(0, M.length - 1).trim();
|
|
1235
1235
|
const A = M.split(" ").filter((q) => q !== "").map((q) => Number(q));
|
|
@@ -1243,19 +1243,19 @@ class d {
|
|
|
1243
1243
|
O === "S" && (p = p * -1);
|
|
1244
1244
|
} else
|
|
1245
1245
|
p = Number(M);
|
|
1246
|
-
return
|
|
1246
|
+
return Y.roundPrecision(p, z);
|
|
1247
1247
|
}
|
|
1248
1248
|
static str2LngOrLat(M, z = 6, p = "LAT") {
|
|
1249
|
-
M =
|
|
1249
|
+
M = Y.strReplace(M, p);
|
|
1250
1250
|
const O = M[M.length - 1].toUpperCase();
|
|
1251
1251
|
return ["N", "S"].includes(O) ? {
|
|
1252
|
-
lat:
|
|
1252
|
+
lat: Y.str2Lat(M, z)
|
|
1253
1253
|
} : {
|
|
1254
|
-
lng:
|
|
1254
|
+
lng: Y.str2Lng(M, z)
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
1257
|
static convertToStdLng(M, z = 6) {
|
|
1258
|
-
return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M),
|
|
1258
|
+
return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), Y.roundPrecision(M, z);
|
|
1259
1259
|
}
|
|
1260
1260
|
static roundPrecision(M, z = 4) {
|
|
1261
1261
|
if (typeof M == "number") {
|
|
@@ -1301,13 +1301,13 @@ class d {
|
|
|
1301
1301
|
* @param dcmPrecision 小数位数
|
|
1302
1302
|
*/
|
|
1303
1303
|
static padNumber(M, z = 2, p = 2) {
|
|
1304
|
-
const O =
|
|
1304
|
+
const O = Y.roundPrecision(M - Math.trunc(M), p), A = O >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
|
|
1305
1305
|
return O >= 1 ? A : `${A}.${Math.trunc(O * Math.pow(10, p)).toString().padStart(p, "0")}`;
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
|
-
let
|
|
1308
|
+
let K;
|
|
1309
1309
|
try {
|
|
1310
|
-
|
|
1310
|
+
K = x.getLogger("meteo");
|
|
1311
1311
|
} catch {
|
|
1312
1312
|
} finally {
|
|
1313
1313
|
}
|
|
@@ -1326,7 +1326,7 @@ class r {
|
|
|
1326
1326
|
[z.lng, z.lat]
|
|
1327
1327
|
]);
|
|
1328
1328
|
let b;
|
|
1329
|
-
return p ? b = T.rhumbBearing(A.features[0], A.features[1]) : b = T.bearing(A.features[0], A.features[1]), b < 0 && (b += 360),
|
|
1329
|
+
return p ? b = T.rhumbBearing(A.features[0], A.features[1]) : b = T.bearing(A.features[0], A.features[1]), b < 0 && (b += 360), Y.roundPrecision(b, O);
|
|
1330
1330
|
}
|
|
1331
1331
|
/**
|
|
1332
1332
|
* 计算两点间距离
|
|
@@ -1338,13 +1338,13 @@ class r {
|
|
|
1338
1338
|
* @returns {number}
|
|
1339
1339
|
*/
|
|
1340
1340
|
static calculateDistance(M, z, p = !0, O = 4, A = "nauticalmiles") {
|
|
1341
|
-
M = { ...M }, z = { ...z }, M.lng =
|
|
1341
|
+
M = { ...M }, z = { ...z }, M.lng = Y.convertToStdLng(M.lng, O), z.lng = Y.convertToStdLng(z.lng, O);
|
|
1342
1342
|
const b = T.points([
|
|
1343
1343
|
[M.lng, M.lat],
|
|
1344
1344
|
[z.lng, z.lat]
|
|
1345
1345
|
]);
|
|
1346
1346
|
let W;
|
|
1347
|
-
return p ? W = T.rhumbDistance(b.features[0], b.features[1], { units: A }) : W = T.distance(b.features[0], b.features[1], { units: A }),
|
|
1347
|
+
return p ? W = T.rhumbDistance(b.features[0], b.features[1], { units: A }) : W = T.distance(b.features[0], b.features[1], { units: A }), Y.roundPrecision(W, O);
|
|
1348
1348
|
}
|
|
1349
1349
|
/**
|
|
1350
1350
|
* 计算航线距离
|
|
@@ -1361,7 +1361,7 @@ class r {
|
|
|
1361
1361
|
const o = { lng: b[W + 1][0], lat: b[W + 1][1] };
|
|
1362
1362
|
O += this.calculateDistance(q, o, !0, z, p), A = o;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return Y.roundPrecision(O, z);
|
|
1365
1365
|
}
|
|
1366
1366
|
/**
|
|
1367
1367
|
* 计算坐标(基于方位角和距离)
|
|
@@ -1376,7 +1376,7 @@ class r {
|
|
|
1376
1376
|
let W;
|
|
1377
1377
|
A ? W = T.rhumbDestination(b, p, z, { units: O }) : W = T.destination(b, p, z, { units: O });
|
|
1378
1378
|
const q = W.geometry.coordinates;
|
|
1379
|
-
return { lng:
|
|
1379
|
+
return { lng: Y.convertToStdLng(q[0], 8), lat: Y.roundPrecision(q[1], 8) };
|
|
1380
1380
|
}
|
|
1381
1381
|
/**
|
|
1382
1382
|
* 插值大圆坐标(基于两点方位角和间距)
|
|
@@ -1414,23 +1414,23 @@ class r {
|
|
|
1414
1414
|
const O = [];
|
|
1415
1415
|
let A, b;
|
|
1416
1416
|
for (let W = 0; W < M.length - 1; W++) {
|
|
1417
|
-
A =
|
|
1417
|
+
A = Y.convertToStdLng(M[W].lng, 8), b = Y.convertToStdLng(M[W + 1].lng, 8), M[W].lat = Y.roundPrecision(M[W].lat, 8), M[W + 1].lat = Y.roundPrecision(M[W + 1].lat, 8), p.push([A, M[W].lat]);
|
|
1418
1418
|
const q = A - b;
|
|
1419
1419
|
if (Math.abs(q) > 180) {
|
|
1420
|
-
const o =
|
|
1420
|
+
const o = Y.convertToMonotonicLng2([
|
|
1421
1421
|
[A, M[W].lat],
|
|
1422
1422
|
[b, M[W + 1].lat]
|
|
1423
1423
|
]);
|
|
1424
|
-
let R,
|
|
1425
|
-
z ? (R = T.lineString(o),
|
|
1424
|
+
let R, d;
|
|
1425
|
+
z ? (R = T.lineString(o), d = T.lineString([
|
|
1426
1426
|
[q > 0 ? 180 : -180, 89],
|
|
1427
1427
|
[q > 0 ? 180 : -180, -89]
|
|
1428
|
-
])) : (R = T.greatCircle(o[0], o[1]),
|
|
1429
|
-
const i = T.lineIntersect(R,
|
|
1428
|
+
])) : (R = T.greatCircle(o[0], o[1]), d = T.greatCircle([q > 0 ? 180 : -180, 89], [q > 0 ? 180 : -180, -89]));
|
|
1429
|
+
const i = T.lineIntersect(R, d);
|
|
1430
1430
|
let e;
|
|
1431
1431
|
if (i.features.length) {
|
|
1432
1432
|
const u = T.getCoord(i.features[0]);
|
|
1433
|
-
e =
|
|
1433
|
+
e = Y.roundPrecision(u[1], 8);
|
|
1434
1434
|
} else
|
|
1435
1435
|
e = M[W].lat;
|
|
1436
1436
|
q > 0 ? (p.push([180 - 1e-6, e]), O.push([...p]), p = [], p.push([-(180 - 1e-6), e])) : (p.push([-(180 - 1e-6), e]), O.push([...p]), p = [], p.push([180 - 1e-6, e]));
|
|
@@ -1464,10 +1464,10 @@ class r {
|
|
|
1464
1464
|
* @param route 航线[[[lng, lat],[lng, lat]]]
|
|
1465
1465
|
*/
|
|
1466
1466
|
static removeCoordinateFromRoute(M, z) {
|
|
1467
|
-
M.lng =
|
|
1467
|
+
M.lng = Y.convertToStdLng(M.lng, 8);
|
|
1468
1468
|
for (const p of z)
|
|
1469
1469
|
for (let O = p.length - 1; O >= 0; O--)
|
|
1470
|
-
|
|
1470
|
+
Y.roundPrecision(p[O][0], 8) === M.lng && Y.roundPrecision(p[O][1], 8) === Y.roundPrecision(M.lat, 8) && p.splice(O, 1);
|
|
1471
1471
|
return z;
|
|
1472
1472
|
}
|
|
1473
1473
|
/**
|
|
@@ -1476,9 +1476,9 @@ class r {
|
|
|
1476
1476
|
* @param waypoints [{lat, lng}, {lat, lng}]
|
|
1477
1477
|
*/
|
|
1478
1478
|
static removeCoordinateFromWaypoints(M, z) {
|
|
1479
|
-
M.lng =
|
|
1479
|
+
M.lng = Y.convertToStdLng(M.lng, 8);
|
|
1480
1480
|
for (let p = z.length - 1; p >= 0; p--)
|
|
1481
|
-
|
|
1481
|
+
Y.roundPrecision(z[p].lng, 8) === M.lng && Y.roundPrecision(z[p].lat, 8) === Y.roundPrecision(M.lat, 8) && z.splice(p, 1);
|
|
1482
1482
|
return z;
|
|
1483
1483
|
}
|
|
1484
1484
|
/**
|
|
@@ -1493,12 +1493,12 @@ class r {
|
|
|
1493
1493
|
* [[[120, 30], [120, 35], [125,40], [130, 37]], [[-150, 40], [-130, 30]]]
|
|
1494
1494
|
*/
|
|
1495
1495
|
static mergeCoordinateToRoute(M, z) {
|
|
1496
|
-
M.lng =
|
|
1496
|
+
M.lng = Y.convertToStdLng(M.lng, 8);
|
|
1497
1497
|
let p = Number.MAX_VALUE, O = 0, A = 0, b, W;
|
|
1498
1498
|
return z.forEach((q, o) => {
|
|
1499
1499
|
for (let R = 0; R < q.length - 1; R++) {
|
|
1500
|
-
const
|
|
1501
|
-
p > e && (p = e, A = R, O = o, b = this.calculateDistance(
|
|
1500
|
+
const d = { lng: q[R][0], lat: q[R][1] }, i = { lng: q[R + 1][0], lat: q[R + 1][1] }, e = this.calculatePointToLineDistance(M, d, i);
|
|
1501
|
+
p > e && (p = e, A = R, O = o, b = this.calculateDistance(d, M), W = this.calculateDistance(i, M));
|
|
1502
1502
|
}
|
|
1503
1503
|
}), b !== 0 && W !== 0 ? z[O].splice(A + 1, 0, [M.lng, M.lat]) : b === 0 ? z[O].splice(A, 1, [M.lng, M.lat]) : W === 0 && z[O].splice(A + 1, 1, [M.lng, M.lat]), z;
|
|
1504
1504
|
}
|
|
@@ -1508,7 +1508,7 @@ class r {
|
|
|
1508
1508
|
* @param route
|
|
1509
1509
|
*/
|
|
1510
1510
|
static appendCoordinateToRoute(M, z) {
|
|
1511
|
-
M.lng =
|
|
1511
|
+
M.lng = Y.convertToStdLng(M.lng, 8);
|
|
1512
1512
|
const p = r.convertRouteToCoordinates(z);
|
|
1513
1513
|
return p.push(M), r.divideAccordingToLng(p);
|
|
1514
1514
|
}
|
|
@@ -1547,11 +1547,11 @@ class r {
|
|
|
1547
1547
|
return;
|
|
1548
1548
|
const W = [];
|
|
1549
1549
|
for (const q of b) {
|
|
1550
|
-
if (
|
|
1550
|
+
if (Y.roundPrecision(z.lng, 8) === Y.roundPrecision(q[0], 8) && Y.roundPrecision(z.lat, 8) === Y.roundPrecision(q[1], 8)) {
|
|
1551
1551
|
W.push(q), A === 0 && W.push([M.lng, M.lat]), A = 2;
|
|
1552
1552
|
break;
|
|
1553
1553
|
}
|
|
1554
|
-
A === 1 ? W.push(q) :
|
|
1554
|
+
A === 1 ? W.push(q) : Y.roundPrecision(M.lng, 8) === Y.roundPrecision(q[0], 8) && Y.roundPrecision(M.lat, 8) === Y.roundPrecision(q[1], 8) && (A = 1, W.push(q));
|
|
1555
1555
|
}
|
|
1556
1556
|
W.length && O.push(W);
|
|
1557
1557
|
}), O;
|
|
@@ -1566,11 +1566,11 @@ class r {
|
|
|
1566
1566
|
*/
|
|
1567
1567
|
static calculateRangeWaypoints(M, z, p, O = []) {
|
|
1568
1568
|
const A = this.convertRouteToCoordinates(p, 0), b = this.mergeCoordinatesToWaypoints([M, z, ...O], A), W = b.findIndex(
|
|
1569
|
-
(R) =>
|
|
1569
|
+
(R) => Y.roundPrecision(M.lng, 8) === Y.roundPrecision(R.lng, 8) && Y.roundPrecision(M.lat, 8) === Y.roundPrecision(R.lat, 8)
|
|
1570
1570
|
), q = b.findIndex(
|
|
1571
|
-
(R) =>
|
|
1571
|
+
(R) => Y.roundPrecision(z.lng, 8) === Y.roundPrecision(R.lng, 8) && Y.roundPrecision(z.lat, 8) === Y.roundPrecision(R.lat, 8)
|
|
1572
1572
|
);
|
|
1573
|
-
return b.filter((R,
|
|
1573
|
+
return b.filter((R, d) => d >= W && d <= q);
|
|
1574
1574
|
}
|
|
1575
1575
|
/**
|
|
1576
1576
|
* 计算坐标到航路上的最短距离
|
|
@@ -1581,8 +1581,8 @@ class r {
|
|
|
1581
1581
|
let p = Number.MAX_VALUE, O = 0, A = 0;
|
|
1582
1582
|
return z.forEach((b, W) => {
|
|
1583
1583
|
for (let q = 0; q < b.length - 1; q++) {
|
|
1584
|
-
const o = { lng: b[q][0], lat: b[q][1] }, R = { lng: b[q + 1][0], lat: b[q + 1][1] },
|
|
1585
|
-
p >
|
|
1584
|
+
const o = { lng: b[q][0], lat: b[q][1] }, R = { lng: b[q + 1][0], lat: b[q + 1][1] }, d = this.calculatePointToLineDistance(M, o, R);
|
|
1585
|
+
p > d && (p = d, O = q, A = W);
|
|
1586
1586
|
}
|
|
1587
1587
|
}), { minDist: p, segIndex: A, minIndex: O };
|
|
1588
1588
|
}
|
|
@@ -1596,7 +1596,7 @@ class r {
|
|
|
1596
1596
|
const p = r.convertRouteToCoordinates(z);
|
|
1597
1597
|
r.mergeCoordinateToWaypoints(M, p, !0), z = r.divideAccordingToLng(p);
|
|
1598
1598
|
const { segIndex: O, minIndex: A } = this.calculateMinDistanceToRoute({ ...M }, z);
|
|
1599
|
-
M.lng =
|
|
1599
|
+
M.lng = Y.convertToStdLng(M.lng);
|
|
1600
1600
|
const b = [];
|
|
1601
1601
|
let W = !0;
|
|
1602
1602
|
for (let q = O; q < z.length; q++)
|
|
@@ -1623,11 +1623,11 @@ class r {
|
|
|
1623
1623
|
if (this.calculateDistance(M, W) === 0)
|
|
1624
1624
|
return z;
|
|
1625
1625
|
if (this.calculateDistance(M, q) === 0)
|
|
1626
|
-
return z.filter((R,
|
|
1626
|
+
return z.filter((R, d) => d > 0);
|
|
1627
1627
|
const o = this.calculatePointToLineDistance(M, W, q);
|
|
1628
1628
|
p > o && (p = o, O = b);
|
|
1629
1629
|
}
|
|
1630
|
-
M.lng =
|
|
1630
|
+
M.lng = Y.convertToStdLng(M.lng);
|
|
1631
1631
|
const A = [M];
|
|
1632
1632
|
for (let b = O + 1; b < z.length; b++)
|
|
1633
1633
|
A.push(z[b]);
|
|
@@ -1641,14 +1641,14 @@ class r {
|
|
|
1641
1641
|
* @param options
|
|
1642
1642
|
*/
|
|
1643
1643
|
static calculatePointToLineDistance(M, z, p, O = { units: "nauticalmiles", method: "geodesic" }) {
|
|
1644
|
-
M.lng =
|
|
1645
|
-
const A =
|
|
1644
|
+
M.lng = Y.convertToStdLng(M.lng, 8), z = { ...z }, p = { ...p }, z.lng = Y.convertToStdLng(z.lng, 8), p.lng = Y.convertToStdLng(p.lng, 8);
|
|
1645
|
+
const A = Y.convertToMonotonicLng([z, p]);
|
|
1646
1646
|
z = A[0], p = A[1];
|
|
1647
1647
|
const b = T.lineString([
|
|
1648
1648
|
[z.lng, z.lat],
|
|
1649
1649
|
[p.lng, p.lat]
|
|
1650
1650
|
]), W = T.pointToLineDistance(T.point([M.lng, M.lat]), b, O), q = T.pointToLineDistance(T.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), b, O);
|
|
1651
|
-
return
|
|
1651
|
+
return Y.roundPrecision(Math.min(W, q), 6);
|
|
1652
1652
|
}
|
|
1653
1653
|
/**
|
|
1654
1654
|
* 计算途经点的COG, Distance等属性
|
|
@@ -1659,7 +1659,7 @@ class r {
|
|
|
1659
1659
|
z = this.mergeWaypointsToRoute(M, z);
|
|
1660
1660
|
for (let p = 0; p < M.length - 1; p++) {
|
|
1661
1661
|
const O = M[p], A = M[p + 1], b = this.calculateRangeRoute(O, A, z);
|
|
1662
|
-
p === 0 && (O.distanceFromPrevious = 0, O.distanceFromStart = 0), A.distanceFromPrevious = this.calculateRouteDistance(b), A.distanceFromStart =
|
|
1662
|
+
p === 0 && (O.distanceFromPrevious = 0, O.distanceFromStart = 0), A.distanceFromPrevious = this.calculateRouteDistance(b), A.distanceFromStart = Y.roundPrecision((O.distanceFromStart || 0) + A.distanceFromPrevious);
|
|
1663
1663
|
}
|
|
1664
1664
|
return M;
|
|
1665
1665
|
}
|
|
@@ -1686,18 +1686,18 @@ class r {
|
|
|
1686
1686
|
* [{ lng: 160, lat: 30}, { lng: 170, lat: 40}, {lng: 179, lat: 50}, {lng: -170, lat: 40}, {lng: -160, lat: 30}]
|
|
1687
1687
|
*/
|
|
1688
1688
|
static mergeCoordinateToWaypoints(M, z, p = !0) {
|
|
1689
|
-
M.lng =
|
|
1689
|
+
M.lng = Y.convertToStdLng(M.lng, 8);
|
|
1690
1690
|
let O = Number.MAX_VALUE, A = 0, b = 0, W = 0;
|
|
1691
1691
|
if (z.length < 2)
|
|
1692
1692
|
z.push(M);
|
|
1693
1693
|
else {
|
|
1694
1694
|
for (let q = 0; q < z.length - 1; q++) {
|
|
1695
|
-
const o = { lng: z[q].lng, lat: z[q].lat }, R = { lng: z[q + 1].lng, lat: z[q + 1].lat },
|
|
1696
|
-
O >=
|
|
1695
|
+
const o = { lng: z[q].lng, lat: z[q].lat }, R = { lng: z[q + 1].lng, lat: z[q + 1].lat }, d = this.calculatePointToLineDistance(M, o, R);
|
|
1696
|
+
O >= d && (O = d, A = q, b = this.calculateDistance(o, M, !1, 6), W = this.calculateDistance(R, M, !1, 6));
|
|
1697
1697
|
}
|
|
1698
1698
|
b !== 0 && W !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : W < O || W === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p && z.splice(A, 1, M) : W === 0 && p && z.splice(A + 1, 1, M);
|
|
1699
1699
|
}
|
|
1700
|
-
return z.map((q) => (q.lng =
|
|
1700
|
+
return z.map((q) => (q.lng = Y.convertToStdLng(q.lng), q));
|
|
1701
1701
|
}
|
|
1702
1702
|
/**
|
|
1703
1703
|
* 生成航线(基于途经点生成大圆/横向航线,并根据是否跨180度分组)
|
|
@@ -1723,7 +1723,7 @@ class r {
|
|
|
1723
1723
|
*/
|
|
1724
1724
|
static nearestCoordinateInRoute(M, z) {
|
|
1725
1725
|
const p = T.point([M.lng, M.lat]), A = this.convertRouteToCoordinates(z).map((o) => [o.lng, o.lat]), b = T.lineString(A), W = T.nearestPointOnLine(b, p), q = T.getCoord(W);
|
|
1726
|
-
return { lng:
|
|
1726
|
+
return { lng: Y.roundPrecision(q[0], 8), lat: Y.roundPrecision(q[1], 8) };
|
|
1727
1727
|
}
|
|
1728
1728
|
/**
|
|
1729
1729
|
* 计算经过方向上的最后一个waypoint
|
|
@@ -1757,7 +1757,7 @@ class r {
|
|
|
1757
1757
|
static calculateNextCoordinateAlongRoute(M, z, p, O = "nauticalmiles") {
|
|
1758
1758
|
var i;
|
|
1759
1759
|
const A = M.speed || 12, b = [];
|
|
1760
|
-
let W = [], q = !1, o = 0, R = 0,
|
|
1760
|
+
let W = [], q = !1, o = 0, R = 0, d;
|
|
1761
1761
|
if (z && p.length ? (b.push(M), p.forEach((e, u) => {
|
|
1762
1762
|
if (q)
|
|
1763
1763
|
W.push(e);
|
|
@@ -1765,7 +1765,7 @@ class r {
|
|
|
1765
1765
|
const S = [];
|
|
1766
1766
|
let s;
|
|
1767
1767
|
for (let P = 0; P < e.length; P++)
|
|
1768
|
-
if (
|
|
1768
|
+
if (d)
|
|
1769
1769
|
S.push(e[P]);
|
|
1770
1770
|
else {
|
|
1771
1771
|
s = { lng: e[P][0], lat: e[P][1] };
|
|
@@ -1774,23 +1774,23 @@ class r {
|
|
|
1774
1774
|
R += G, b.push(s), M = s;
|
|
1775
1775
|
else {
|
|
1776
1776
|
if (R = z, o === z)
|
|
1777
|
-
|
|
1777
|
+
d = s, S.push([d.lng, d.lat]);
|
|
1778
1778
|
else {
|
|
1779
1779
|
const l = o - z, N = this.calculateBearing(s, M);
|
|
1780
|
-
|
|
1780
|
+
d = this.calculateCoordinate(s, N, l, O), S.push([d.lng, d.lat]), S.push([s.lng, s.lat]);
|
|
1781
1781
|
}
|
|
1782
1782
|
q = !0;
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
|
-
S.length && W.push(S), u === p.length - 1 && !
|
|
1785
|
+
S.length && W.push(S), u === p.length - 1 && !d && (d = s);
|
|
1786
1786
|
}
|
|
1787
|
-
})) : (W = p,
|
|
1788
|
-
if (b.push(
|
|
1787
|
+
})) : (W = p, d = { ...M }), d)
|
|
1788
|
+
if (b.push(d), d.distanceFromPrevious = R, d.hourFromPrevious = Math.round(R / A * 1e4) / 1e4, ((i = W[0]) == null ? void 0 : i.length) > 1) {
|
|
1789
1789
|
const e = { lng: W[0][1][0], lat: W[0][1][1] };
|
|
1790
|
-
|
|
1790
|
+
d.bearing = this.calculateBearing(d, e);
|
|
1791
1791
|
} else
|
|
1792
|
-
|
|
1793
|
-
return { coordinate:
|
|
1792
|
+
d.bearing = 0;
|
|
1793
|
+
return { coordinate: d, nextRoute: W, prevRoute: b };
|
|
1794
1794
|
}
|
|
1795
1795
|
/**
|
|
1796
1796
|
* 返回最近点及其是否为垂足(最近点不是起点或终点)
|
|
@@ -1799,11 +1799,11 @@ class r {
|
|
|
1799
1799
|
* @param to {lng, lat}
|
|
1800
1800
|
*/
|
|
1801
1801
|
static nearestCoordinateInLine(M, z, p) {
|
|
1802
|
-
const O =
|
|
1802
|
+
const O = Y.convertToStdLng(M.lng, 6), A = T.point([O, M.lat]), b = Y.convertToStdLng(z.lng, 6), W = Y.convertToStdLng(p.lng, 6), q = T.lineString([
|
|
1803
1803
|
[b, z.lat],
|
|
1804
1804
|
[W, p.lat]
|
|
1805
|
-
]), o = T.nearestPointOnLine(q, A), R = T.getCoord(o),
|
|
1806
|
-
return { lng:
|
|
1805
|
+
]), o = T.nearestPointOnLine(q, A), R = T.getCoord(o), d = Y.roundPrecision(R[0], 6), i = Y.roundPrecision(R[1], 6);
|
|
1806
|
+
return { lng: d, lat: i, inline: !(d === b && i === z.lat) && !(d === W && i === p.lat) };
|
|
1807
1807
|
}
|
|
1808
1808
|
/**
|
|
1809
1809
|
* 将route转coordinate
|
|
@@ -1815,7 +1815,7 @@ class r {
|
|
|
1815
1815
|
let O, A;
|
|
1816
1816
|
return M.forEach((b) => {
|
|
1817
1817
|
b.forEach((W) => {
|
|
1818
|
-
const q = { lng:
|
|
1818
|
+
const q = { lng: Y.roundPrecision(W[0], 8), lat: Y.roundPrecision(W[1], 8) };
|
|
1819
1819
|
if (!A)
|
|
1820
1820
|
p.push(q), A = q;
|
|
1821
1821
|
else if (A.bearing === void 0)
|
|
@@ -1858,9 +1858,9 @@ class r {
|
|
|
1858
1858
|
let p = 0;
|
|
1859
1859
|
for (let O = 1; O < M.length; O++) {
|
|
1860
1860
|
const A = M[O - 1], b = M[O];
|
|
1861
|
-
b.gcToPrevious ? (A.bearing = this.calculateBearing(A, b, !1), b.distanceFromPrevious = this.calculateDistance(A, b, !1)) : (A.bearing = this.calculateBearing(A, b, !0), b.distanceFromPrevious = this.calculateDistance(A, b, !0)), p =
|
|
1861
|
+
b.gcToPrevious ? (A.bearing = this.calculateBearing(A, b, !1), b.distanceFromPrevious = this.calculateDistance(A, b, !1)) : (A.bearing = this.calculateBearing(A, b, !0), b.distanceFromPrevious = this.calculateDistance(A, b, !0)), p = Y.roundPrecision(p + b.distanceFromPrevious), b.distanceFromStart = p;
|
|
1862
1862
|
}
|
|
1863
|
-
return M.map((O) => (O.lng =
|
|
1863
|
+
return M.map((O) => (O.lng = Y.convertToStdLng(O.lng), O));
|
|
1864
1864
|
}
|
|
1865
1865
|
/**
|
|
1866
1866
|
* 计算轨迹中心点
|
|
@@ -1871,11 +1871,11 @@ class r {
|
|
|
1871
1871
|
for (const W of M)
|
|
1872
1872
|
for (const q of W)
|
|
1873
1873
|
z.push(q);
|
|
1874
|
-
const p = T.featureCollection([]), O =
|
|
1874
|
+
const p = T.featureCollection([]), O = Y.convertToMonotonicLng2(z);
|
|
1875
1875
|
for (const W of O)
|
|
1876
1876
|
p.features.push(T.point(W));
|
|
1877
1877
|
const b = T.center(p).geometry.coordinates;
|
|
1878
|
-
return { lng:
|
|
1878
|
+
return { lng: Y.convertToStdLng(b[0], 8), lat: Y.roundPrecision(b[1], 8) };
|
|
1879
1879
|
}
|
|
1880
1880
|
/**
|
|
1881
1881
|
* 计算中心点
|
|
@@ -1894,7 +1894,7 @@ class r {
|
|
|
1894
1894
|
for (const A of M)
|
|
1895
1895
|
for (const b of A)
|
|
1896
1896
|
z.push(b);
|
|
1897
|
-
const p =
|
|
1897
|
+
const p = Y.convertToMonotonicLng2(z), O = T.lineString(p);
|
|
1898
1898
|
return T.bbox(O);
|
|
1899
1899
|
}
|
|
1900
1900
|
/**
|
|
@@ -1917,12 +1917,12 @@ class r {
|
|
|
1917
1917
|
const b = M[A - 1], W = M[A], q = M[A + 1];
|
|
1918
1918
|
let o = !1, R = !1;
|
|
1919
1919
|
if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (o = !0, O.push(b)), W.gcToPrevious && (o || (o = !0, O.push(b)), R = !0, O.push(W), A++), q) {
|
|
1920
|
-
const
|
|
1920
|
+
const d = r.calculateDistance(b, W, !0), i = r.calculateDistance(W, q, !0), e = r.calculateDistance(b, q, !0), u = (Math.pow(d, 2) + Math.pow(i, 2) - Math.pow(e, 2)) / (2 * d * i);
|
|
1921
1921
|
Math.round(Math.acos(u) * 180 / Math.PI) < p && e > z && !R && (O.push(W), A++);
|
|
1922
1922
|
}
|
|
1923
1923
|
if (A >= M.length - 1) {
|
|
1924
|
-
const
|
|
1925
|
-
|
|
1924
|
+
const d = M.at(-1);
|
|
1925
|
+
d && O.push(d);
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
1928
|
return O;
|
|
@@ -1946,7 +1946,7 @@ class r {
|
|
|
1946
1946
|
* @param options
|
|
1947
1947
|
*/
|
|
1948
1948
|
static async calculateAIRoute(M, z, p = {}) {
|
|
1949
|
-
var
|
|
1949
|
+
var W;
|
|
1950
1950
|
const O = "https://airtgw.idmwx.com/get_path", A = {
|
|
1951
1951
|
lon1: M.lng,
|
|
1952
1952
|
lat1: M.lat,
|
|
@@ -1954,19 +1954,25 @@ class r {
|
|
|
1954
1954
|
lat2: z.lat,
|
|
1955
1955
|
open_areas: p.open || void 0,
|
|
1956
1956
|
close_areas: p.close || void 0
|
|
1957
|
-
}, b =
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1957
|
+
}, b = {
|
|
1958
|
+
status: "Failed"
|
|
1959
|
+
};
|
|
1960
|
+
try {
|
|
1961
|
+
K.info("[%s] get ai-route(%s): %j", O, A);
|
|
1962
|
+
const q = await j.get(O, { searchParams: A, timeout: p.timeout || 1e4 }).json();
|
|
1963
|
+
if (q != null && q.coordinates) {
|
|
1964
|
+
const o = (W = q == null ? void 0 : q.coordinates) == null ? void 0 : W.map((i) => ({ lng: Y.roundPrecision(i[0], 8), lat: Y.roundPrecision(i[1], 8) })), R = r.divideAccordingToLng(o), d = r.calculateRouteDistance(R);
|
|
1965
|
+
b.distance = d, b.waypoints = r.simplifyCoordinates(o), b.route = R, b.memo = `time cost: ${q.search_time} s`, b.status = "Success";
|
|
1966
|
+
} else
|
|
1967
|
+
b.memo = `no path, starting point(${M.lat}, ${M.lng}) or endpoit(${z.lat}, ${z.lng}) is not at sea.`, K.warn("[%s] get ai-route failed: %j", p.requestId, q), b.status = "Failed";
|
|
1968
|
+
} catch (q) {
|
|
1969
|
+
b.memo = `no path or timeout, starting point(${M.lat}, ${M.lng}) or endpoit(${z.lat}, ${z.lng}) is not at sea.`, K.warn("[%s] get ai-route failed: %j", p.requestId, q);
|
|
1968
1970
|
}
|
|
1969
|
-
|
|
1971
|
+
if (b.status !== "Success") {
|
|
1972
|
+
const q = [M, z], o = r.divideAccordingToLng(q), R = r.calculateRouteDistance(o);
|
|
1973
|
+
b.distance = R, b.waypoints = r.simplifyCoordinates(q), b.route = o, K.info("[%s] get ai-route with from/to only: %j", p.requestId, q), b.status = "Success";
|
|
1974
|
+
}
|
|
1975
|
+
return b;
|
|
1970
1976
|
}
|
|
1971
1977
|
/**
|
|
1972
1978
|
* 重新加载AI路由数据
|
|
@@ -1974,7 +1980,7 @@ class r {
|
|
|
1974
1980
|
*/
|
|
1975
1981
|
static async reloadAIRoute(M) {
|
|
1976
1982
|
const z = "https://airtgw.idmwx.com/update_map", p = await j.get(z).text();
|
|
1977
|
-
return
|
|
1983
|
+
return K.info("[%s] reload ai-route(%s): %s", M.requestId, z, p), !0;
|
|
1978
1984
|
}
|
|
1979
1985
|
}
|
|
1980
1986
|
let Z;
|
|
@@ -1998,39 +2004,39 @@ class s0 {
|
|
|
1998
2004
|
for (const b of O.forecasts) {
|
|
1999
2005
|
const W = [], q = g(b.date).utc(), o = `${O.name}-${b.model}`;
|
|
2000
2006
|
if (A) {
|
|
2001
|
-
const R = g(A.updated).utc(),
|
|
2007
|
+
const R = g(A.updated).utc(), d = T.point([A.lng, A.lat], {
|
|
2002
2008
|
model: b.model,
|
|
2003
2009
|
name: O.name,
|
|
2004
2010
|
date: R.format(),
|
|
2005
2011
|
hour: 0,
|
|
2006
2012
|
format: R.format("MMM-DD/HHmm[Z]"),
|
|
2007
|
-
pressure: A.pressure > 1e4 ?
|
|
2013
|
+
pressure: A.pressure > 1e4 ? Y.roundPrecision(A.pressure / 100, 0) : Y.roundPrecision(A.pressure, 0),
|
|
2008
2014
|
wind: A == null ? void 0 : A.wind,
|
|
2009
2015
|
category: o,
|
|
2010
2016
|
type: "forecast"
|
|
2011
2017
|
});
|
|
2012
|
-
z.features.push(
|
|
2018
|
+
z.features.push(d), W.push(d.geometry.coordinates);
|
|
2013
2019
|
}
|
|
2014
2020
|
for (const R in b == null ? void 0 : b.hours) {
|
|
2015
|
-
const
|
|
2016
|
-
|
|
2017
|
-
const i = q.clone().add(Number(R), "hour"), e = T.point([
|
|
2021
|
+
const d = b.hours[R];
|
|
2022
|
+
d.wind.spd = d.wind.spd || d.wind.speed;
|
|
2023
|
+
const i = q.clone().add(Number(R), "hour"), e = T.point([d.lng, d.lat], {
|
|
2018
2024
|
model: b.model,
|
|
2019
2025
|
name: O.name,
|
|
2020
2026
|
date: i.format(),
|
|
2021
2027
|
hour: Number(R),
|
|
2022
2028
|
format: i.format("MMM-DD/HHmm[Z]"),
|
|
2023
|
-
pressure:
|
|
2024
|
-
gusts:
|
|
2025
|
-
wind:
|
|
2026
|
-
movement:
|
|
2029
|
+
pressure: d.pressure > 1e4 ? Y.roundPrecision(d.pressure / 100, 0) : Y.roundPrecision(d.pressure, 0),
|
|
2030
|
+
gusts: d.gusts,
|
|
2031
|
+
wind: d.wind || {},
|
|
2032
|
+
movement: d.movement,
|
|
2027
2033
|
category: o,
|
|
2028
2034
|
type: "forecast"
|
|
2029
2035
|
});
|
|
2030
2036
|
z.features.push(e), W.push(e.geometry.coordinates);
|
|
2031
2037
|
}
|
|
2032
2038
|
if ((W == null ? void 0 : W.length) > 1) {
|
|
2033
|
-
const R = T.lineString(
|
|
2039
|
+
const R = T.lineString(Y.convertToMonotonicLng2(W), {
|
|
2034
2040
|
date: b.date,
|
|
2035
2041
|
id: O.id || O.name,
|
|
2036
2042
|
model: b.model,
|
|
@@ -2049,7 +2055,7 @@ class s0 {
|
|
|
2049
2055
|
name: O.name,
|
|
2050
2056
|
date: q.format(),
|
|
2051
2057
|
format: q.format("MMM-DD/HHmm[Z]"),
|
|
2052
|
-
pressure: W.pressure > 1e4 ?
|
|
2058
|
+
pressure: W.pressure > 1e4 ? Y.roundPrecision(W.pressure / 100, 0) : Y.roundPrecision(W.pressure, 0),
|
|
2053
2059
|
spd: W.speed || W.spd,
|
|
2054
2060
|
kts: W.kts,
|
|
2055
2061
|
source: W.source,
|
|
@@ -2062,11 +2068,11 @@ class s0 {
|
|
|
2062
2068
|
}
|
|
2063
2069
|
const b = O.history[0];
|
|
2064
2070
|
if (A.length === 1 && A.push(A[0]), A.length > 1) {
|
|
2065
|
-
const W = T.lineString(
|
|
2071
|
+
const W = T.lineString(Y.convertToMonotonicLng2(A), {
|
|
2066
2072
|
name: O.name,
|
|
2067
2073
|
type: "history",
|
|
2068
2074
|
updated: b == null ? void 0 : b.updated,
|
|
2069
|
-
pressure: (b == null ? void 0 : b.pressure) > 1e4 ?
|
|
2075
|
+
pressure: (b == null ? void 0 : b.pressure) > 1e4 ? Y.roundPrecision((b == null ? void 0 : b.pressure) / 100, 0) : Y.roundPrecision(b == null ? void 0 : b.pressure, 0),
|
|
2070
2076
|
spd: (b == null ? void 0 : b.speed) || (b == null ? void 0 : b.spd),
|
|
2071
2077
|
kts: b == null ? void 0 : b.kts,
|
|
2072
2078
|
source: b == null ? void 0 : b.source,
|
|
@@ -2087,17 +2093,17 @@ class s0 {
|
|
|
2087
2093
|
var A, b, W, q;
|
|
2088
2094
|
const p = (A = M == null ? void 0 : M.data) == null ? void 0 : A.features.filter((o) => o.geometry.type === "LineString" && o.properties.type === "forecast"), O = [];
|
|
2089
2095
|
for (const o of p) {
|
|
2090
|
-
const R = o.properties.name,
|
|
2096
|
+
const R = o.properties.name, d = o.properties.model, i = o.properties.showCircle, e = o.properties.disabled, u = g(o.properties.date).utc();
|
|
2091
2097
|
let S = z * 60 - (u.get("hour") * 60 + u.get("minute")) % (z * 60);
|
|
2092
2098
|
const s = (b = M == null ? void 0 : M.data) == null ? void 0 : b.features.filter(
|
|
2093
|
-
(l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${R}-${
|
|
2099
|
+
(l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${R}-${d}`
|
|
2094
2100
|
);
|
|
2095
2101
|
let P, G = u.clone().add(S, "minute").set({ minute: 0, second: 0, millisecond: 0 });
|
|
2096
2102
|
for (; P = this.pickIndex(s, G), P <= s.length - 1; ) {
|
|
2097
2103
|
if (P > 0) {
|
|
2098
2104
|
const l = s[P], N = P === 0 ? void 0 : s[P - 1], E = (S / 60 - ((W = N == null ? void 0 : N.properties) == null ? void 0 : W.hour)) / (l.properties.hour - ((q = N == null ? void 0 : N.properties) == null ? void 0 : q.hour)), Q = this.computeNumber(N == null ? void 0 : N.geometry.coordinates[0], l.geometry.coordinates[0], E), F = this.computeNumber(N == null ? void 0 : N.geometry.coordinates[1], l.geometry.coordinates[1], E), $ = T.point([Q, F], {
|
|
2099
2105
|
name: R,
|
|
2100
|
-
model:
|
|
2106
|
+
model: d,
|
|
2101
2107
|
category: l == null ? void 0 : l.properties.category,
|
|
2102
2108
|
date: G.format(),
|
|
2103
2109
|
format: G.format("MMM-DD/HHmm[Z]"),
|
|
@@ -2151,9 +2157,9 @@ class s0 {
|
|
|
2151
2157
|
hr: W
|
|
2152
2158
|
}), {};
|
|
2153
2159
|
}
|
|
2154
|
-
const o = r.calculateBearing(M, A), R = r.calculateBearing(A, b),
|
|
2160
|
+
const o = r.calculateBearing(M, A), R = r.calculateBearing(A, b), d = Math.abs(o - R);
|
|
2155
2161
|
let i = 0;
|
|
2156
|
-
|
|
2162
|
+
d < 180 ? i = d + 90 : d >= 180 && (i = d - 90);
|
|
2157
2163
|
const e = r.calculateCoordinate(A, i, p);
|
|
2158
2164
|
return Z == null || Z.info("[%s] the right tangent position: %j", O.requestId, {
|
|
2159
2165
|
from: M,
|
|
@@ -2190,8 +2196,8 @@ class s0 {
|
|
|
2190
2196
|
hr: W
|
|
2191
2197
|
}), {};
|
|
2192
2198
|
}
|
|
2193
|
-
const o = r.calculateBearing(M, A), R = r.calculateBearing(A, b),
|
|
2194
|
-
return { at: r.calculateCoordinate(A, o - R + 180, p <
|
|
2199
|
+
const o = r.calculateBearing(M, A), R = r.calculateBearing(A, b), d = r.calculateDistance(M, A);
|
|
2200
|
+
return { at: r.calculateCoordinate(A, o - R + 180, p < d ? p : d), t1: A, t2: b, hr: Number(W), hours: q };
|
|
2195
2201
|
} else
|
|
2196
2202
|
return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: W }), {};
|
|
2197
2203
|
}
|
|
@@ -2204,12 +2210,12 @@ class s0 {
|
|
|
2204
2210
|
* @private
|
|
2205
2211
|
*/
|
|
2206
2212
|
static tropicalCenterTwin(M, z = 24, p = {}) {
|
|
2207
|
-
var R,
|
|
2213
|
+
var R, d, i, e, u;
|
|
2208
2214
|
let O = {};
|
|
2209
2215
|
(R = M.forecasts) == null || R.forEach((S) => {
|
|
2210
2216
|
O = { ...S.hours, ...O };
|
|
2211
2217
|
});
|
|
2212
|
-
const A = ((
|
|
2218
|
+
const A = ((d = M == null ? void 0 : M.history) == null ? void 0 : d[0]) || (O == null ? void 0 : O[(i = Object.keys(O)) == null ? void 0 : i[0]]);
|
|
2213
2219
|
Z == null || Z.info("[%s] the first tropical center: %j", p.requestId, A);
|
|
2214
2220
|
let b = (e = Object.keys(O || {}).filter((S) => Number(S) <= (z < 0 ? 24 : z))) == null ? void 0 : e.at(-1);
|
|
2215
2221
|
b || (b = (u = Object.keys(O || {}).filter((S) => Number(S) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : u.at(-1));
|
|
@@ -2247,6 +2253,6 @@ class s0 {
|
|
|
2247
2253
|
}
|
|
2248
2254
|
export {
|
|
2249
2255
|
r as LaneHelper,
|
|
2250
|
-
|
|
2256
|
+
Y as LngLatHelper,
|
|
2251
2257
|
s0 as TropicalHelper
|
|
2252
2258
|
};
|