@idm-plugin/geo 2.1.2 → 2.1.3

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 CHANGED
@@ -1,5 +1,5 @@
1
- import * as S from "@turf/turf";
2
- import B from "moment";
1
+ import * as t from "@turf/turf";
2
+ import U from "moment";
3
3
  import j from "@log4js-node/log4js-api";
4
4
  var n0 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
5
  function X0(m) {
@@ -13,7 +13,7 @@ var _ = { exports: {} };
13
13
  //! license : MIT
14
14
  //! github.com/moment/moment-timezone
15
15
  (function(M, z) {
16
- m.exports ? m.exports = z(B) : z(M.moment);
16
+ m.exports ? m.exports = z(U) : z(M.moment);
17
17
  })(n0, function(M) {
18
18
  M.version === void 0 && M.default && (M = M.default);
19
19
  var z = "0.5.48", p = {}, b = {}, c = {}, O = {}, A = {}, W;
@@ -24,40 +24,40 @@ var _ = { exports: {} };
24
24
  return q > 96 ? q - 87 : q > 64 ? q - 29 : q - 48;
25
25
  }
26
26
  function T(q) {
27
- var n = 0, X = q.split("."), L = X[0], N = X[1] || "", U = 1, E, V = 0, P = 1;
27
+ var n = 0, X = q.split("."), L = X[0], N = X[1] || "", V = 1, E, s = 0, P = 1;
28
28
  for (q.charCodeAt(0) === 45 && (n = 1, P = -1), n; n < L.length; n++)
29
- E = R(L.charCodeAt(n)), V = 60 * V + E;
29
+ E = R(L.charCodeAt(n)), s = 60 * s + E;
30
30
  for (n = 0; n < N.length; n++)
31
- U = U / 60, E = R(N.charCodeAt(n)), V += E * U;
32
- return V * P;
31
+ V = V / 60, E = R(N.charCodeAt(n)), s += E * V;
32
+ return s * P;
33
33
  }
34
- function f(q) {
34
+ function e(q) {
35
35
  for (var n = 0; n < q.length; n++)
36
36
  q[n] = T(q[n]);
37
37
  }
38
- function i(q, n) {
38
+ function f(q, n) {
39
39
  for (var X = 0; X < n; X++)
40
40
  q[X] = Math.round((q[X - 1] || 0) + q[X] * 6e4);
41
41
  q[n - 1] = 1 / 0;
42
42
  }
43
- function e(q, n) {
43
+ function i(q, n) {
44
44
  var X = [], L;
45
45
  for (L = 0; L < n.length; L++)
46
46
  X[L] = q[n[L]];
47
47
  return X;
48
48
  }
49
- function t(q) {
49
+ function S(q) {
50
50
  var n = q.split("|"), X = n[2].split(" "), L = n[3].split(""), N = n[4].split(" ");
51
- return f(X), f(L), f(N), i(N, L.length), {
51
+ return e(X), e(L), e(N), f(N, L.length), {
52
52
  name: n[0],
53
- abbrs: e(n[1].split(" "), L),
54
- offsets: e(X, L),
53
+ abbrs: i(n[1].split(" "), L),
54
+ offsets: i(X, L),
55
55
  untils: N,
56
56
  population: n[5] | 0
57
57
  };
58
58
  }
59
- function l(q) {
60
- q && this._set(t(q));
59
+ function u(q) {
60
+ q && this._set(S(q));
61
61
  }
62
62
  function Z(q, n) {
63
63
  var X = n.length;
@@ -67,11 +67,11 @@ var _ = { exports: {} };
67
67
  return X - 1;
68
68
  if (q >= n[X - 1])
69
69
  return -1;
70
- for (var L, N = 0, U = X - 1; U - N > 1; )
71
- L = Math.floor((N + U) / 2), n[L] <= q ? N = L : U = L;
72
- return U;
70
+ for (var L, N = 0, V = X - 1; V - N > 1; )
71
+ L = Math.floor((N + V) / 2), n[L] <= q ? N = L : V = L;
72
+ return V;
73
73
  }
74
- l.prototype = {
74
+ u.prototype = {
75
75
  _set: function(q) {
76
76
  this.name = q.name, this.abbrs = q.abbrs, this.untils = q.untils, this.offsets = q.offsets, this.population = q.population;
77
77
  },
@@ -87,9 +87,9 @@ var _ = { exports: {} };
87
87
  });
88
88
  },
89
89
  parse: function(q) {
90
- var n = +q, X = this.offsets, L = this.untils, N = L.length - 1, U, E, V, P;
90
+ var n = +q, X = this.offsets, L = this.untils, N = L.length - 1, V, E, s, P;
91
91
  for (P = 0; P < N; P++)
92
- if (U = X[P], E = X[P + 1], V = X[P && P - 1], U < E && s.moveAmbiguousForward ? U = E : U > V && s.moveInvalidForward && (U = V), n < L[P] - U * 6e4)
92
+ if (V = X[P], E = X[P + 1], s = X[P && P - 1], V < E && l.moveAmbiguousForward ? V = E : V > s && l.moveInvalidForward && (V = s), n < L[P] - V * 6e4)
93
93
  return X[P];
94
94
  return X[N];
95
95
  },
@@ -103,17 +103,17 @@ var _ = { exports: {} };
103
103
  return this.offsets[this._index(q)];
104
104
  }
105
105
  };
106
- function u(q, n) {
106
+ function B(q, n) {
107
107
  this.name = q, this.zones = n;
108
108
  }
109
109
  function G(q) {
110
110
  var n = q.toTimeString(), X = n.match(/\([a-z ]+\)/i);
111
111
  X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X = n.match(/[A-Z]{3,5}/g), X = X ? X[0] : void 0), X === "GMT" && (X = void 0), this.at = +q, this.abbr = X, this.offset = q.getTimezoneOffset();
112
112
  }
113
- function H(q) {
113
+ function Q(q) {
114
114
  this.zone = q, this.offsetScore = 0, this.abbrScore = 0;
115
115
  }
116
- H.prototype.scoreOffsetAt = function(q) {
116
+ Q.prototype.scoreOffsetAt = function(q) {
117
117
  this.offsetScore += Math.abs(this.zone.utcOffset(q.at) - q.offset), this.zone.abbr(q.at).replace(/[^A-Z]/g, "") !== q.abbr && this.abbrScore++;
118
118
  };
119
119
  function F(q, n) {
@@ -122,11 +122,11 @@ var _ = { exports: {} };
122
122
  return q;
123
123
  }
124
124
  function $() {
125
- var q = (/* @__PURE__ */ new Date()).getFullYear() - 2, n = new G(new Date(q, 0, 1)), X = n.offset, L = [n], N, U, E, V;
126
- for (V = 1; V < 48; V++)
127
- E = new Date(q, V, 1).getTimezoneOffset(), E !== X && (U = new G(new Date(q, V, 1)), N = F(n, U), L.push(N), L.push(new G(new Date(N.at + 6e4))), n = U, X = E);
128
- for (V = 0; V < 4; V++)
129
- L.push(new G(new Date(q + V, 0, 1))), L.push(new G(new Date(q + V, 6, 1)));
125
+ var q = (/* @__PURE__ */ new Date()).getFullYear() - 2, n = new G(new Date(q, 0, 1)), X = n.offset, L = [n], N, V, E, s;
126
+ for (s = 1; s < 48; s++)
127
+ E = new Date(q, s, 1).getTimezoneOffset(), E !== X && (V = new G(new Date(q, s, 1)), N = F(n, V), L.push(N), L.push(new G(new Date(N.at + 6e4))), n = V, X = E);
128
+ for (s = 0; s < 4; s++)
129
+ L.push(new G(new Date(q + s, 0, 1))), L.push(new G(new Date(q + s, 6, 1)));
130
130
  return L;
131
131
  }
132
132
  function z0(q, n) {
@@ -134,20 +134,20 @@ var _ = { exports: {} };
134
134
  }
135
135
  function b0(q, n) {
136
136
  var X, L;
137
- for (f(n), X = 0; X < n.length; X++)
137
+ for (e(n), X = 0; X < n.length; X++)
138
138
  L = n[X], A[L] = A[L] || {}, A[L][q] = !0;
139
139
  }
140
140
  function p0(q) {
141
- var n = q.length, X = {}, L = [], N = {}, U, E, V, P;
142
- for (U = 0; U < n; U++)
143
- if (V = q[U].offset, !N.hasOwnProperty(V)) {
144
- P = A[V] || {};
141
+ var n = q.length, X = {}, L = [], N = {}, V, E, s, P;
142
+ for (V = 0; V < n; V++)
143
+ if (s = q[V].offset, !N.hasOwnProperty(s)) {
144
+ P = A[s] || {};
145
145
  for (E in P)
146
146
  P.hasOwnProperty(E) && (X[E] = !0);
147
- N[V] = !0;
147
+ N[s] = !0;
148
148
  }
149
- for (U in X)
150
- X.hasOwnProperty(U) && L.push(O[U]);
149
+ for (V in X)
150
+ X.hasOwnProperty(V) && L.push(O[V]);
151
151
  return L;
152
152
  }
153
153
  function O0() {
@@ -161,13 +161,13 @@ var _ = { exports: {} };
161
161
  }
162
162
  } catch {
163
163
  }
164
- var X = $(), L = X.length, N = p0(X), U = [], E, V, P;
165
- for (V = 0; V < N.length; V++) {
166
- for (E = new H(g(N[V])), P = 0; P < L; P++)
164
+ var X = $(), L = X.length, N = p0(X), V = [], E, s, P;
165
+ for (s = 0; s < N.length; s++) {
166
+ for (E = new Q(g(N[s])), P = 0; P < L; P++)
167
167
  E.scoreOffsetAt(X[P]);
168
- U.push(E);
168
+ V.push(E);
169
169
  }
170
- return U.sort(z0), U.length > 0 ? U[0].zone.name : void 0;
170
+ return V.sort(z0), V.length > 0 ? V[0].zone.name : void 0;
171
171
  }
172
172
  function A0(q) {
173
173
  return (!W || q) && (W = O0()), W;
@@ -183,7 +183,7 @@ var _ = { exports: {} };
183
183
  function g(q, n) {
184
184
  q = h(q);
185
185
  var X = p[q], L;
186
- return X instanceof l ? X : typeof X == "string" ? (X = new l(X), p[q] = X, X) : b[q] && n !== g && (L = g(b[q], g)) ? (X = p[q] = new l(), X._set(L), X.name = O[q], X) : null;
186
+ return X instanceof u ? X : typeof X == "string" ? (X = new u(X), p[q] = X, X) : b[q] && n !== g && (L = g(b[q], g)) ? (X = p[q] = new u(), X._set(L), X.name = O[q], X) : null;
187
187
  }
188
188
  function c0() {
189
189
  var q, n = [];
@@ -203,7 +203,7 @@ var _ = { exports: {} };
203
203
  var n, X, L, N;
204
204
  if (!(!q || !q.length))
205
205
  for (n = 0; n < q.length; n++)
206
- N = q[n].split("|"), X = N[0].toUpperCase(), L = N[1].split(" "), c[X] = new u(
206
+ N = q[n].split("|"), X = N[0].toUpperCase(), L = N[1].split(" "), c[X] = new B(
207
207
  X,
208
208
  L
209
209
  );
@@ -224,7 +224,7 @@ var _ = { exports: {} };
224
224
  }) : X;
225
225
  }
226
226
  function d0(q) {
227
- k(q.zones), y(q.links), o0(q.countries), s.dataVersion = q.version;
227
+ k(q.zones), y(q.links), o0(q.countries), l.dataVersion = q.version;
228
228
  }
229
229
  function J(q) {
230
230
  return J.didShowError || (J.didShowError = !0, D("moment.tz.zoneExists('" + q + "') has been deprecated in favor of !moment.tz.zone('" + q + "')")), !!g(q);
@@ -236,13 +236,13 @@ var _ = { exports: {} };
236
236
  function D(q) {
237
237
  typeof console < "u" && typeof console.error == "function" && console.error(q);
238
238
  }
239
- function s(q) {
239
+ function l(q) {
240
240
  var n = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], L = M.utc.apply(null, n), N;
241
241
  return !M.isMoment(q) && v(L) && (N = g(X)) && L.add(N.parse(L), "minutes"), L.tz(X), L;
242
242
  }
243
- s.version = z, s.dataVersion = "", s._zones = p, s._links = b, s._names = O, s._countries = c, s.add = k, s.link = y, s.load = d0, s.zone = g, s.zoneExists = J, s.guess = A0, s.names = c0, s.Zone = l, s.unpack = t, s.unpackBase60 = T, s.needsOffset = v, s.moveInvalidForward = !0, s.moveAmbiguousForward = !1, s.countries = W0, s.zonesForCountry = Y0;
243
+ l.version = z, l.dataVersion = "", l._zones = p, l._links = b, l._names = O, l._countries = c, l.add = k, l.link = y, l.load = d0, l.zone = g, l.zoneExists = J, l.guess = A0, l.names = c0, l.Zone = u, l.unpack = S, l.unpackBase60 = T, l.needsOffset = v, l.moveInvalidForward = !0, l.moveAmbiguousForward = !1, l.countries = W0, l.zonesForCountry = Y0;
244
244
  var C = M.fn;
245
- M.tz = s, M.defaultZone = null, M.updateOffset = function(q, n) {
245
+ M.tz = l, M.defaultZone = null, M.updateOffset = function(q, n) {
246
246
  var X = M.defaultZone, L;
247
247
  if (q._z === void 0 && (X && v(q) && !q._isUTC && q.isValid() && (q._d = M.utc(q._a)._d, q.utc().add(X.parse(q), "minutes")), q._z = X), q._z)
248
248
  if (L = q._z.utcOffset(q), Math.abs(L) < 16 && (L = L / 60), q.utcOffset !== void 0) {
@@ -1162,7 +1162,7 @@ class a {
1162
1162
  */
1163
1163
  static guessTimeZoneOffset(M, z) {
1164
1164
  M = a.convertToStdLng(M);
1165
- const p = S0(z, M), b = B().tz(p).utcOffset();
1165
+ const p = S0(z, M), b = U().tz(p).utcOffset();
1166
1166
  return a.roundPrecision(b / 60, 1);
1167
1167
  }
1168
1168
  /**
@@ -1364,14 +1364,14 @@ class t0 {
1364
1364
  lng: O.lng,
1365
1365
  sog: O.sog,
1366
1366
  positionTime: O.positionTime,
1367
- utc: B.unix(O.positionTime).utc().format()
1367
+ utc: U.unix(O.positionTime).utc().format()
1368
1368
  },
1369
1369
  end: {
1370
1370
  lat: A.lat,
1371
1371
  lng: A.lng,
1372
1372
  sog: A.sog,
1373
1373
  positionTime: A.positionTime,
1374
- utc: B.unix(A.positionTime).utc().format()
1374
+ utc: U.unix(A.positionTime).utc().format()
1375
1375
  },
1376
1376
  duration: A.positionTime - O.positionTime
1377
1377
  }, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), R = r.divideAccordingToLng(d);
@@ -1389,7 +1389,7 @@ class t0 {
1389
1389
  * @param etm
1390
1390
  */
1391
1391
  static inspectSummary(M, z, p) {
1392
- const b = B(z), c = B(p), O = M.filter((Y) => Y.positionTime >= b.unix() && Y.positionTime <= c.unix());
1392
+ const b = U(z), c = U(p), O = M.filter((Y) => Y.positionTime >= b.unix() && Y.positionTime <= c.unix());
1393
1393
  let A = 0, W = 0;
1394
1394
  if (O.length > 1)
1395
1395
  for (let Y = 0; Y < O.length - 1; Y++) {
@@ -1401,9 +1401,9 @@ class t0 {
1401
1401
  return { distance: A, interval: W, avgSpd: o };
1402
1402
  }
1403
1403
  }
1404
- let Q;
1404
+ let H;
1405
1405
  try {
1406
- Q = j.getLogger("meteo");
1406
+ H = j.getLogger("meteo");
1407
1407
  } catch {
1408
1408
  } finally {
1409
1409
  }
@@ -1417,12 +1417,12 @@ class r {
1417
1417
  * @returns {number} 单位度
1418
1418
  */
1419
1419
  static calculateBearing(M, z, p = !0, b = 4) {
1420
- const c = S.points([
1420
+ const c = t.points([
1421
1421
  [M.lng, M.lat],
1422
1422
  [z.lng, z.lat]
1423
1423
  ]);
1424
1424
  let O;
1425
- return p ? O = S.rhumbBearing(c.features[0], c.features[1]) : O = S.bearing(c.features[0], c.features[1]), O < 0 && (O += 360), a.roundPrecision(O, b);
1425
+ return p ? O = t.rhumbBearing(c.features[0], c.features[1]) : O = t.bearing(c.features[0], c.features[1]), O < 0 && (O += 360), a.roundPrecision(O, b);
1426
1426
  }
1427
1427
  /**
1428
1428
  * 计算两点间距离
@@ -1435,12 +1435,12 @@ class r {
1435
1435
  */
1436
1436
  static calculateDistance(M, z, p = !0, b = 4, c = "nauticalmiles") {
1437
1437
  M = { ...M }, z = { ...z }, M.lng = a.convertToStdLng(M.lng, b), z.lng = a.convertToStdLng(z.lng, b);
1438
- const O = S.points([
1438
+ const O = t.points([
1439
1439
  [M.lng, M.lat],
1440
1440
  [z.lng, z.lat]
1441
1441
  ]);
1442
1442
  let A;
1443
- return p ? A = S.rhumbDistance(O.features[0], O.features[1], { units: c }) : A = S.distance(O.features[0], O.features[1], { units: c }), a.roundPrecision(A, b);
1443
+ return p ? A = t.rhumbDistance(O.features[0], O.features[1], { units: c }) : A = t.distance(O.features[0], O.features[1], { units: c }), a.roundPrecision(A, b);
1444
1444
  }
1445
1445
  /**
1446
1446
  * 计算航线距离
@@ -1468,9 +1468,9 @@ class r {
1468
1468
  * @param rhumb
1469
1469
  */
1470
1470
  static calculateCoordinate(M, z, p, b = "nauticalmiles", c = !0) {
1471
- const O = S.point([M.lng, M.lat]);
1471
+ const O = t.point([M.lng, M.lat]);
1472
1472
  let A;
1473
- c ? A = S.rhumbDestination(O, p, z, { units: b }) : A = S.destination(O, p, z, { units: b });
1473
+ c ? A = t.rhumbDestination(O, p, z, { units: b }) : A = t.destination(O, p, z, { units: b });
1474
1474
  const W = A.geometry.coordinates;
1475
1475
  return { lng: a.convertToStdLng(W[0], 8), lat: a.roundPrecision(W[1], 8) };
1476
1476
  }
@@ -1519,18 +1519,18 @@ class r {
1519
1519
  [A, M[W + 1].lat]
1520
1520
  ]);
1521
1521
  let d, R;
1522
- z ? (d = S.lineString(Y), R = S.lineString([
1522
+ z ? (d = t.lineString(Y), R = t.lineString([
1523
1523
  [o > 0 ? 180 : -180, 89],
1524
1524
  [o > 0 ? 180 : -180, -89]
1525
- ])) : (d = S.greatCircle(Y[0], Y[1]), R = S.greatCircle([o > 0 ? 180 : -180, 89], [o > 0 ? 180 : -180, -89]));
1526
- const T = S.lineIntersect(d, R);
1527
- let f;
1525
+ ])) : (d = t.greatCircle(Y[0], Y[1]), R = t.greatCircle([o > 0 ? 180 : -180, 89], [o > 0 ? 180 : -180, -89]));
1526
+ const T = t.lineIntersect(d, R);
1527
+ let e;
1528
1528
  if (T.features.length) {
1529
- const i = S.getCoord(T.features[0]);
1530
- f = a.roundPrecision(i[1], 8);
1529
+ const f = t.getCoord(T.features[0]);
1530
+ e = a.roundPrecision(f[1], 8);
1531
1531
  } else
1532
- f = M[W].lat;
1533
- o > 0 ? (b.push([180 - 1e-6, f]), c.push([...b]), b = [], b.push([-(180 - 1e-6), f])) : (b.push([-(180 - 1e-6), f]), c.push([...b]), b = [], b.push([180 - 1e-6, f]));
1532
+ e = M[W].lat;
1533
+ o > 0 ? (b.push([180 - 1e-6, e]), c.push([...b]), b = [], b.push([-(180 - 1e-6), e])) : (b.push([-(180 - 1e-6), e]), c.push([...b]), b = [], b.push([180 - 1e-6, e]));
1534
1534
  }
1535
1535
  W === M.length - 2 && b.push([A, M[W + 1].lat]);
1536
1536
  }
@@ -1741,10 +1741,10 @@ class r {
1741
1741
  M.lng = a.convertToStdLng(M.lng, 8), z = { ...z }, p = { ...p }, z.lng = a.convertToStdLng(z.lng, 8), p.lng = a.convertToStdLng(p.lng, 8);
1742
1742
  const c = a.convertToMonotonicLng([z, p]);
1743
1743
  z = c[0], p = c[1];
1744
- const O = S.lineString([
1744
+ const O = t.lineString([
1745
1745
  [z.lng, z.lat],
1746
1746
  [p.lng, p.lat]
1747
- ]), A = S.pointToLineDistance(S.point([M.lng, M.lat]), O, b), W = S.pointToLineDistance(S.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), O, b);
1747
+ ]), A = t.pointToLineDistance(t.point([M.lng, M.lat]), O, b), W = t.pointToLineDistance(t.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), O, b);
1748
1748
  return a.roundPrecision(Math.min(A, W), 6);
1749
1749
  }
1750
1750
  /**
@@ -1829,7 +1829,7 @@ class r {
1829
1829
  * @param route [[[lng, lat]]]
1830
1830
  */
1831
1831
  static nearestCoordinateInRoute(M, z) {
1832
- const p = S.point([M.lng, M.lat]), c = this.convertRouteToCoordinates(z).map((o) => [o.lng, o.lat]), O = S.lineString(c), A = S.nearestPointOnLine(O, p), W = S.getCoord(A);
1832
+ const p = t.point([M.lng, M.lat]), c = this.convertRouteToCoordinates(z).map((o) => [o.lng, o.lat]), O = t.lineString(c), A = t.nearestPointOnLine(O, p), W = t.getCoord(A);
1833
1833
  return { lng: a.roundPrecision(W[0], 8), lat: a.roundPrecision(W[1], 8) };
1834
1834
  }
1835
1835
  /**
@@ -1865,31 +1865,31 @@ class r {
1865
1865
  var R;
1866
1866
  const c = M.speed || 12, O = [];
1867
1867
  let A = [], W = !1, o = 0, Y = 0, d;
1868
- if (z && p.length ? (O.push(M), p.forEach((T, f) => {
1868
+ if (z && p.length ? (O.push(M), p.forEach((T, e) => {
1869
1869
  if (W)
1870
1870
  A.push(T);
1871
1871
  else {
1872
- const i = [];
1873
- let e;
1874
- for (let t = 0; t < T.length; t++)
1872
+ const f = [];
1873
+ let i;
1874
+ for (let S = 0; S < T.length; S++)
1875
1875
  if (d)
1876
- i.push(T[t]);
1876
+ f.push(T[S]);
1877
1877
  else {
1878
- e = { lng: T[t][0], lat: T[t][1] };
1879
- const l = this.calculateDistance(M, e, !0, 8, b);
1880
- if (o += l, o < z)
1881
- Y += l, l && O.push(e), M = e;
1878
+ i = { lng: T[S][0], lat: T[S][1] };
1879
+ const u = this.calculateDistance(M, i, !0, 8, b);
1880
+ if (o += u, o < z)
1881
+ Y += u, u && O.push(i), M = i;
1882
1882
  else {
1883
1883
  if (Y = z, o === z)
1884
- d = e, i.push([d.lng, d.lat]);
1884
+ d = i, f.push([d.lng, d.lat]);
1885
1885
  else {
1886
- const Z = o - z, u = this.calculateBearing(e, M);
1887
- d = this.calculateCoordinate(e, u, Z, b), i.push([d.lng, d.lat]), i.push([e.lng, e.lat]);
1886
+ const Z = o - z, B = this.calculateBearing(i, M);
1887
+ d = this.calculateCoordinate(i, B, Z, b), f.push([d.lng, d.lat]), f.push([i.lng, i.lat]);
1888
1888
  }
1889
1889
  W = !0;
1890
1890
  }
1891
1891
  }
1892
- i.length && A.push(i), f === p.length - 1 && !d && (d = e);
1892
+ f.length && A.push(f), e === p.length - 1 && !d && (d = i);
1893
1893
  }
1894
1894
  })) : (A = p, d = { ...M }), d)
1895
1895
  if (O.push(d), d.distanceFromPrevious = Math.round(Y * 1e4) / 1e4, d.hourFromPrevious = Math.round(Y / c * 1e4) / 1e4, ((R = A[0]) == null ? void 0 : R.length) > 1) {
@@ -1906,10 +1906,10 @@ class r {
1906
1906
  * @param to {lng, lat}
1907
1907
  */
1908
1908
  static nearestCoordinateInLine(M, z, p) {
1909
- const b = a.convertToStdLng(M.lng, 6), c = S.point([b, M.lat]), O = a.convertToStdLng(z.lng, 6), A = a.convertToStdLng(p.lng, 6), W = S.lineString([
1909
+ const b = a.convertToStdLng(M.lng, 6), c = t.point([b, M.lat]), O = a.convertToStdLng(z.lng, 6), A = a.convertToStdLng(p.lng, 6), W = t.lineString([
1910
1910
  [O, z.lat],
1911
1911
  [A, p.lat]
1912
- ]), o = S.nearestPointOnLine(W, c), Y = S.getCoord(o), d = a.roundPrecision(Y[0], 6), R = a.roundPrecision(Y[1], 6);
1912
+ ]), o = t.nearestPointOnLine(W, c), Y = t.getCoord(o), d = a.roundPrecision(Y[0], 6), R = a.roundPrecision(Y[1], 6);
1913
1913
  return { lng: d, lat: R, inline: !(d === O && R === z.lat) && !(d === A && R === p.lat) };
1914
1914
  }
1915
1915
  /**
@@ -1978,10 +1978,10 @@ class r {
1978
1978
  for (const A of M)
1979
1979
  for (const W of A)
1980
1980
  z.push(W);
1981
- const p = S.featureCollection([]), b = a.convertToMonotonicLng2(z);
1981
+ const p = t.featureCollection([]), b = a.convertToMonotonicLng2(z);
1982
1982
  for (const A of b)
1983
- p.features.push(S.point(A));
1984
- const O = S.center(p).geometry.coordinates;
1983
+ p.features.push(t.point(A));
1984
+ const O = t.center(p).geometry.coordinates;
1985
1985
  return { lng: a.convertToStdLng(O[0], 8), lat: a.roundPrecision(O[1], 8) };
1986
1986
  }
1987
1987
  /**
@@ -2001,8 +2001,8 @@ class r {
2001
2001
  for (const c of M)
2002
2002
  for (const O of c)
2003
2003
  z.push(O);
2004
- const p = a.convertToMonotonicLng2(z), b = S.lineString(p);
2005
- return S.bbox(b);
2004
+ const p = a.convertToMonotonicLng2(z), b = t.lineString(p);
2005
+ return t.bbox(b);
2006
2006
  }
2007
2007
  /**
2008
2008
  * 计算BBox
@@ -2024,8 +2024,8 @@ class r {
2024
2024
  const O = M[c - 1], A = M[c], W = M[c + 1];
2025
2025
  let o = !1, Y = !1;
2026
2026
  if ((O.velocity || O.suspend || O.important || O.pilot || c === 1) && (o = !0, b.push(O)), A.gcToPrevious && (o || (o = !0, b.push(O)), Y = !0, b.push(A), c++), W) {
2027
- const d = r.calculateDistance(O, A, !0), R = r.calculateDistance(A, W, !0), T = r.calculateDistance(O, W, !0), f = (Math.pow(d, 2) + Math.pow(R, 2) - Math.pow(T, 2)) / (2 * d * R);
2028
- Math.round(Math.acos(f) * 180 / Math.PI) < p && T > z && !Y && (b.push(A), c++);
2027
+ const d = r.calculateDistance(O, A, !0), R = r.calculateDistance(A, W, !0), T = r.calculateDistance(O, W, !0), e = (Math.pow(d, 2) + Math.pow(R, 2) - Math.pow(T, 2)) / (2 * d * R);
2028
+ Math.round(Math.acos(e) * 180 / Math.PI) < p && T > z && !Y && (b.push(A), c++);
2029
2029
  }
2030
2030
  if (c >= M.length - 1) {
2031
2031
  const d = M.at(-1);
@@ -2041,7 +2041,7 @@ class r {
2041
2041
  * @param waypoints 带时间的轨迹, 单位秒
2042
2042
  */
2043
2043
  static nearestTSPointInWaypoints(M, z, p) {
2044
- const b = B.unix(M), c = p.filter(
2044
+ const b = U.unix(M), c = p.filter(
2045
2045
  (O) => b.clone().subtract(z, "hour").unix() <= (O.positionTime || 0) && b.clone().add(z, "h").unix() >= (O.positionTime || 0)
2046
2046
  );
2047
2047
  return c.sort((O, A) => (O.positionTime || 0) - (A.positionTime || 0)), c.at(-1);
@@ -2054,7 +2054,7 @@ class r {
2054
2054
  static deadReckoning(M, z) {
2055
2055
  var c, O, A, W;
2056
2056
  M > 1e12 && (M = Math.round(M / 1e3));
2057
- const p = B.unix(M);
2057
+ const p = U.unix(M);
2058
2058
  let b = z.find((o) => o.positionTime === p.unix());
2059
2059
  if (!b) {
2060
2060
  const o = (O = (c = z.filter((d) => (d == null ? void 0 : d.positionTime) < p.unix())) == null ? void 0 : c.sort((d, R) => (d.positionTime || 0) - (R.positionTime || 0))) == null ? void 0 : O.at(-1), Y = (W = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) > p.unix())) == null ? void 0 : A.sort((d, R) => (d.positionTime || 0) - (R.positionTime || 0))) == null ? void 0 : W.at(0);
@@ -2062,7 +2062,7 @@ class r {
2062
2062
  const d = r.calculateBearing(o, Y, !0), R = r.calculateDistance(o, Y), T = (p.unix() - o.positionTime) / (Y.positionTime - o.positionTime);
2063
2063
  b = r.calculateCoordinate(o, d, R * T), b.positionTime = p.unix(), b.utc = p.utc().format(), b.cog = d, b.sog = Math.round(R / ((Y.positionTime - o.positionTime) / 3600) * 100) / 100;
2064
2064
  } else
2065
- b = o || Y, b && (b.utc = B.unix(b == null ? void 0 : b.positionTime).utc().format());
2065
+ b = o || Y, b && (b.utc = U.unix(b == null ? void 0 : b.positionTime).utc().format());
2066
2066
  }
2067
2067
  return b;
2068
2068
  }
@@ -2087,7 +2087,7 @@ class r {
2087
2087
  const o = c.positionTime || 0, Y = O.positionTime || 0, d = r.calculateDistance(c, O);
2088
2088
  M.positionTime = Math.round(o + (Y - o) * (A / d));
2089
2089
  }
2090
- return M.utc = M.positionTime ? B.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
2090
+ return M.utc = M.positionTime ? U.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
2091
2091
  }
2092
2092
  /**
2093
2093
  * 翻转轨迹
@@ -2151,7 +2151,7 @@ class r {
2151
2151
  Y.push(` <time>${r.xmlEscape(c.utc)}</time>`);
2152
2152
  else if (c.positionTime)
2153
2153
  try {
2154
- Y.push(` <time>${r.xmlEscape(B.unix(c.positionTime).utc().format())}</time>`);
2154
+ Y.push(` <time>${r.xmlEscape(U.unix(c.positionTime).utc().format())}</time>`);
2155
2155
  } catch {
2156
2156
  }
2157
2157
  c.cog !== void 0 && Y.push(` <cog>${r.xmlEscape(c.cog)}</cog>`), c.sog !== void 0 && Y.push(` <sog>${r.xmlEscape(c.sog)}</sog>`), Y.length && (p.push(" <extensions>"), p.push(...Y), p.push(" </extensions>")), p.push(" </waypoint>");
@@ -2161,17 +2161,19 @@ class r {
2161
2161
  /**
2162
2162
  * 路径转通用CSV (纯十进制度数、无厂商头、RFC 4180标准)
2163
2163
  * 大部分海图设备/导航软件均可导入此格式
2164
+ * @param name 兼容旧版本
2164
2165
  * @param waypoints 途径点
2165
2166
  * @param options.precision 经纬度小数位数,默认6
2166
2167
  */
2167
- static waypoints2CSV(M, z) {
2168
- const p = (z == null ? void 0 : z.precision) ?? 6, b = M.some((i) => i.name), c = M.some((i) => i.description), O = M.some((i) => i.port != null), A = M.some((i) => i.stbd != null), W = M.some((i) => i.arrRad != null), o = M.some((i) => i.speed != null), Y = M.some((i, e) => e > 0 && i.gcToPrevious != null), d = M.some((i) => i.bearing != null), R = M.some((i) => i.distanceFromPrevious != null), T = ["WPT No.", "Latitude", "Longitude"];
2169
- b && T.push("Name"), c && T.push("Description"), Y && T.push("Leg"), d && T.push("Bearing[deg]"), R && T.push("Distance[NM]"), o && T.push("Speed[kn]"), O && T.push("PORT XTD[NM]"), A && T.push("STBD XTD[NM]"), W && T.push("Arr.Rad[NM]");
2168
+ static waypoints2CSV(M, z, p) {
2169
+ H.debug("keep name for waypoints2CSV for legacy compatibility only", M);
2170
+ const b = (p == null ? void 0 : p.precision) ?? 6, c = z.some((i) => i.name), O = z.some((i) => i.description), A = z.some((i) => i.port != null), W = z.some((i) => i.stbd != null), o = z.some((i) => i.arrRad != null), Y = z.some((i) => i.speed != null), d = z.some((i, S) => S > 0 && i.gcToPrevious != null), R = z.some((i) => i.bearing != null), T = z.some((i) => i.distanceFromPrevious != null), e = ["WPT No.", "Latitude", "Longitude"];
2171
+ c && e.push("Name"), O && e.push("Description"), d && e.push("Leg"), R && e.push("Bearing[deg]"), T && e.push("Distance[NM]"), Y && e.push("Speed[kn]"), A && e.push("PORT XTD[NM]"), W && e.push("STBD XTD[NM]"), o && e.push("Arr.Rad[NM]");
2170
2172
  const f = [];
2171
- f.push(T.map((i) => r.csvEscapeField(i)).join(","));
2172
- for (let i = 0; i < M.length; i++) {
2173
- const e = M[i], t = [];
2174
- t.push((i + 1).toString()), t.push(e.lat.toFixed(p)), t.push(e.lng.toFixed(p)), b && t.push(e.name ?? ""), c && t.push(e.description ?? ""), Y && t.push(i === 0 ? "" : e.gcToPrevious ? "GC" : "RL"), d && t.push(e.bearing != null ? String(e.bearing) : ""), R && t.push(e.distanceFromPrevious != null ? String(e.distanceFromPrevious) : ""), o && t.push(e.speed != null ? String(e.speed) : ""), O && t.push(e.port != null ? String(e.port) : ""), A && t.push(e.stbd != null ? String(e.stbd) : ""), W && t.push(e.arrRad != null ? String(e.arrRad) : ""), f.push(t.map((l) => r.csvEscapeField(l)).join(","));
2173
+ f.push(e.map((i) => r.csvEscapeField(i)).join(","));
2174
+ for (let i = 0; i < z.length; i++) {
2175
+ const S = z[i], u = [];
2176
+ u.push((i + 1).toString()), u.push(S.lat.toFixed(b)), u.push(S.lng.toFixed(b)), c && u.push(S.name ?? ""), O && u.push(S.description ?? ""), d && u.push(i === 0 ? "" : S.gcToPrevious ? "GC" : "RL"), R && u.push(S.bearing != null ? String(S.bearing) : ""), T && u.push(S.distanceFromPrevious != null ? String(S.distanceFromPrevious) : ""), Y && u.push(S.speed != null ? String(S.speed) : ""), A && u.push(S.port != null ? String(S.port) : ""), W && u.push(S.stbd != null ? String(S.stbd) : ""), o && u.push(S.arrRad != null ? String(S.arrRad) : ""), f.push(u.map((Z) => r.csvEscapeField(Z)).join(","));
2175
2177
  }
2176
2178
  return f.join(`
2177
2179
  `);
@@ -2233,8 +2235,8 @@ class r {
2233
2235
  */
2234
2236
  static coordinatesSummary(M, z = 3) {
2235
2237
  if (M.length > 1) {
2236
- const p = M[0], b = M[M.length - 1], c = (p == null ? void 0 : p.positionTime) < (b == null ? void 0 : b.positionTime) ? B.unix(p == null ? void 0 : p.positionTime) : B.unix(b == null ? void 0 : b.positionTime), O = (p == null ? void 0 : p.positionTime) > (b == null ? void 0 : b.positionTime) ? B.unix(p == null ? void 0 : p.positionTime) : B.unix(b == null ? void 0 : b.positionTime), A = Math.round(O.diff(c, "hours", !0) * 100) / 100, W = this.generateRouteAccordingToWaypoints(M, !0, !0), o = this.calculateRouteDistance(W), d = t0.inspectStoppages(M, z).reduce(
2237
- (T, f) => (T.duration += f.duration, T.distance += f.distance, T),
2238
+ const p = M[0], b = M[M.length - 1], c = (p == null ? void 0 : p.positionTime) < (b == null ? void 0 : b.positionTime) ? U.unix(p == null ? void 0 : p.positionTime) : U.unix(b == null ? void 0 : b.positionTime), O = (p == null ? void 0 : p.positionTime) > (b == null ? void 0 : b.positionTime) ? U.unix(p == null ? void 0 : p.positionTime) : U.unix(b == null ? void 0 : b.positionTime), A = Math.round(O.diff(c, "hours", !0) * 100) / 100, W = this.generateRouteAccordingToWaypoints(M, !0, !0), o = this.calculateRouteDistance(W), d = t0.inspectStoppages(M, z).reduce(
2239
+ (T, e) => (T.duration += e.duration, T.distance += e.distance, T),
2238
2240
  { hours: 0, distance: 0, spd: 0, duration: 0 }
2239
2241
  );
2240
2242
  d.hours = Math.round(d.duration / 3600 * 100) / 100, d.distance = Math.round(d.distance * 100) / 100, d.spd = d.hours ? Math.round(d.distance / d.hours * 100) / 100 : 0;
@@ -2269,21 +2271,21 @@ class r {
2269
2271
  var Y, d, R;
2270
2272
  if (!((d = (Y = z == null ? void 0 : z.sample) == null ? void 0 : Y.hours) != null && d.length))
2271
2273
  return { routes: [], hour: void 0 };
2272
- const p = z.sample.hours.at(0), b = B.utc(M), c = B.utc(z.eta), O = b.isAfter(c) ? c : b;
2274
+ const p = z.sample.hours.at(0), b = U.utc(M), c = U.utc(z.eta), O = b.isAfter(c) ? c : b;
2273
2275
  let A = z.sample.all.find((T) => T.eta === O.format());
2274
2276
  if (!A) {
2275
- const T = z.sample.all.filter((G) => B.utc(G.eta).isBefore(O)).at(-1), f = this.calculateSubRoute(T, z.route);
2276
- A = (R = this.calculateNextCoordinateAlongRoute(T, T.speed * O.diff(B(T.etd), "hours", !0), f)) == null ? void 0 : R.coordinate;
2277
- const { cFactor: i, cog: e, wxFactor: t, meteo: l } = T, Z = Math.round(A.distanceFromPrevious * 1e4) / 1e4, u = Math.round((Z + T.distanceFromStart) * 1e4) / 1e4;
2277
+ const T = z.sample.all.filter((G) => U.utc(G.eta).isBefore(O)).at(-1), e = this.calculateSubRoute(T, z.route);
2278
+ A = (R = this.calculateNextCoordinateAlongRoute(T, T.speed * O.diff(U(T.etd), "hours", !0), e)) == null ? void 0 : R.coordinate;
2279
+ const { cFactor: f, cog: i, wxFactor: S, meteo: u } = T, Z = Math.round(A.distanceFromPrevious * 1e4) / 1e4, B = Math.round((Z + T.distanceFromStart) * 1e4) / 1e4;
2278
2280
  A = {
2279
2281
  ...A,
2280
- cFactor: i,
2281
- cog: e,
2282
+ cFactor: f,
2283
+ cog: i,
2282
2284
  speed: T.speed,
2283
- wxFactor: t,
2284
- distanceFromStart: u,
2285
+ wxFactor: S,
2286
+ distanceFromStart: B,
2285
2287
  distanceFromPrevious: Z,
2286
- meteo: l,
2288
+ meteo: u,
2287
2289
  eta: O.format(),
2288
2290
  etd: O.format()
2289
2291
  };
@@ -2307,10 +2309,10 @@ class r {
2307
2309
  */
2308
2310
  static pickUTCSampleFromRoute(M, z, p) {
2309
2311
  var T;
2310
- const b = this.calculateSubRoute(z, p), c = this.calculateRouteDistance(b), O = c / z.speed, A = B.utc(M), W = B(z.etd), o = (T = this.calculateNextCoordinateAlongRoute(z, z.speed * A.diff(B(z.etd), "hours", !0), b)) == null ? void 0 : T.coordinate;
2312
+ const b = this.calculateSubRoute(z, p), c = this.calculateRouteDistance(b), O = c / z.speed, A = U.utc(M), W = U(z.etd), o = (T = this.calculateNextCoordinateAlongRoute(z, z.speed * A.diff(U(z.etd), "hours", !0), b)) == null ? void 0 : T.coordinate;
2311
2313
  o.speed = z.speed;
2312
2314
  const Y = W.clone().add(o.hourFromPrevious, "hour");
2313
- o.eta = Math.abs(Y.diff(A, "second")) < 2 ? A.format() : Y.format(), o.etd = o.eta, o.distanceFromStart = Math.round(o.distanceFromPrevious * 100) / 100, o.distanceToGo = Math.round((c - o.distanceFromStart) * 100) / 100, o.timeToGo = Math.round(W.clone().add(O, "hour").diff(B(o.etd), "hour") * 100) / 100;
2315
+ o.eta = Math.abs(Y.diff(A, "second")) < 2 ? A.format() : Y.format(), o.etd = o.eta, o.distanceFromStart = Math.round(o.distanceFromPrevious * 100) / 100, o.distanceToGo = Math.round((c - o.distanceFromStart) * 100) / 100, o.timeToGo = Math.round(W.clone().add(O, "hour").diff(U(o.etd), "hour") * 100) / 100;
2314
2316
  const d = this.calculateRangeWaypoints(z, o, p);
2315
2317
  return {
2316
2318
  routes: this.generateRouteAccordingToWaypoints(d),
@@ -2323,7 +2325,7 @@ class r {
2323
2325
  * @param degree 要素角度,如 swell.degree
2324
2326
  */
2325
2327
  static includedAngle(M, z) {
2326
- Q == null || Q.debug("calculate bearing via: %j", { bearing: M, degree: z });
2328
+ H == null || H.debug("calculate bearing via: %j", { bearing: M, degree: z });
2327
2329
  let p = Math.abs(M % 360 - (z % 360 || 0));
2328
2330
  return p = p > 180 ? 360 - p : p, p;
2329
2331
  }
@@ -2341,80 +2343,80 @@ class V0 {
2341
2343
  */
2342
2344
  static convert2Geojson(M) {
2343
2345
  var p, b, c;
2344
- const z = S.featureCollection([]);
2346
+ const z = t.featureCollection([]);
2345
2347
  for (const O of M) {
2346
2348
  const A = (p = O.history) == null ? void 0 : p[0];
2347
2349
  if (O.forecasts) {
2348
2350
  A && A.wind && (A.wind.kts = A.kts);
2349
2351
  for (const W of O.forecasts) {
2350
2352
  let o;
2351
- const Y = [], d = [], R = B(W.date).utc(), T = `${O.name}-${W.model}`;
2352
- for (const i in W == null ? void 0 : W.hours) {
2353
- const e = W.hours[i];
2354
- o = o || e;
2355
- const t = R.clone().add(Number(i), "hour"), l = S.point([e.lng, e.lat], {
2353
+ const Y = [], d = [], R = U(W.date).utc(), T = `${O.name}-${W.model}`;
2354
+ for (const f in W == null ? void 0 : W.hours) {
2355
+ const i = W.hours[f];
2356
+ o = o || i;
2357
+ const S = R.clone().add(Number(f), "hour"), u = t.point([i.lng, i.lat], {
2356
2358
  model: W.model,
2357
2359
  name: O.name,
2358
2360
  nameCn: O.nameCn,
2359
- date: t.format(),
2360
- hour: Number(i),
2361
- format: t.format("MMM-DD/HHmm[Z]"),
2362
- pressure: e.pressure > 1e4 ? a.roundPrecision(e.pressure / 100, 0) : a.roundPrecision(e.pressure, 0),
2363
- gusts: e.gusts,
2364
- wind: e.wind || {},
2365
- movement: e.movement,
2361
+ date: S.format(),
2362
+ hour: Number(f),
2363
+ format: S.format("MMM-DD/HHmm[Z]"),
2364
+ pressure: i.pressure > 1e4 ? a.roundPrecision(i.pressure / 100, 0) : a.roundPrecision(i.pressure, 0),
2365
+ gusts: i.gusts,
2366
+ wind: i.wind || {},
2367
+ movement: i.movement,
2366
2368
  category: T,
2367
2369
  type: "forecast"
2368
2370
  });
2369
- d.push(l), Y.push(l.geometry.coordinates);
2371
+ d.push(u), Y.push(u.geometry.coordinates);
2370
2372
  }
2371
- const f = {
2373
+ const e = {
2372
2374
  kts: void 0,
2373
2375
  deg: void 0
2374
2376
  };
2375
2377
  if (A) {
2376
- const i = B(A.updated).utc();
2378
+ const f = U(A.updated).utc();
2377
2379
  if (o) {
2378
- const t = r.calculateDistance(A, o), l = B(o.utc || o.updated).diff(i, "h", !0);
2379
- f.kts = Math.round(t / l * 100) / 100, f.deg = r.calculateBearing(A, o, !0, 0);
2380
+ const S = r.calculateDistance(A, o), u = U(o.utc || o.updated).diff(f, "h", !0);
2381
+ e.kts = Math.round(S / u * 100) / 100, e.deg = r.calculateBearing(A, o, !0, 0);
2380
2382
  }
2381
- const e = S.point([A.lng, A.lat], {
2383
+ const i = t.point([A.lng, A.lat], {
2382
2384
  model: W.model,
2383
2385
  name: O.name,
2384
2386
  nameCn: O.nameCn,
2385
- date: i.format(),
2387
+ date: f.format(),
2386
2388
  hour: 0,
2387
- format: i.format("MMM-DD/HHmm[Z]"),
2389
+ format: f.format("MMM-DD/HHmm[Z]"),
2388
2390
  pressure: A.pressure > 1e4 ? a.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : a.roundPrecision(A.pressure, 0),
2389
2391
  wind: A.wind,
2390
- movement: f,
2392
+ movement: e,
2391
2393
  category: T,
2392
2394
  type: "forecast",
2393
2395
  important: !0
2394
2396
  // 第一个预报点为重要点
2395
2397
  });
2396
- d.unshift(e), Y.unshift(e.geometry.coordinates);
2398
+ d.unshift(i), Y.unshift(i.geometry.coordinates);
2397
2399
  }
2398
2400
  if (z.features.push(...d), (Y == null ? void 0 : Y.length) > 1) {
2399
- const i = S.lineString(a.convertToMonotonicLng2(Y), {
2401
+ const f = t.lineString(a.convertToMonotonicLng2(Y), {
2400
2402
  date: (A == null ? void 0 : A.updated) || (R == null ? void 0 : R.format()),
2401
2403
  id: O.id || O.name,
2402
2404
  model: W.model,
2403
2405
  name: O.name,
2404
2406
  category: T,
2405
2407
  type: "forecast",
2406
- movement: f
2408
+ movement: e
2407
2409
  });
2408
- z.features.push(i);
2410
+ z.features.push(f);
2409
2411
  }
2410
2412
  }
2411
2413
  }
2412
- if (z.features.sort((W, o) => W.properties.type === "forecast" && o.properties.type === "forecast" && W.geometry.type === "Point" && o.geometry.type === "Point" ? B(W.properties.date).valueOf() - B(o.properties.date).valueOf() : 0), (b = O.history) != null && b.length) {
2413
- const W = [], o = B(A == null ? void 0 : A.updated).utc(), Y = B((c = O.history) == null ? void 0 : c.at(-1).updated).utc(), d = o.diff(Y, "h") % 24 > 2 ? 24 : 12;
2414
+ if (z.features.sort((W, o) => W.properties.type === "forecast" && o.properties.type === "forecast" && W.geometry.type === "Point" && o.geometry.type === "Point" ? U(W.properties.date).valueOf() - U(o.properties.date).valueOf() : 0), (b = O.history) != null && b.length) {
2415
+ const W = [], o = U(A == null ? void 0 : A.updated).utc(), Y = U((c = O.history) == null ? void 0 : c.at(-1).updated).utc(), d = o.diff(Y, "h") % 24 > 2 ? 24 : 12;
2414
2416
  for (const R of O.history) {
2415
- const T = B(R.updated).utc(), f = T.isSameOrBefore(o) || T.isSame(Y);
2416
- f && o.add(-d, "h");
2417
- const i = S.point([R.lng, R.lat], {
2417
+ const T = U(R.updated).utc(), e = T.isSameOrBefore(o) || T.isSame(Y);
2418
+ e && o.add(-d, "h");
2419
+ const f = t.point([R.lng, R.lat], {
2418
2420
  name: O.name,
2419
2421
  nameCn: O.nameCn,
2420
2422
  date: T.format(),
@@ -2426,12 +2428,12 @@ class V0 {
2426
2428
  category: `${O.name}-history`,
2427
2429
  wind: R.wind,
2428
2430
  movement: R.movement,
2429
- important: f
2431
+ important: e
2430
2432
  });
2431
- z.features.push(i), W.push(i.geometry.coordinates);
2433
+ z.features.push(f), W.push(f.geometry.coordinates);
2432
2434
  }
2433
2435
  if (W.length === 1 && W.push(W[0]), W.length > 1) {
2434
- const R = S.lineString(a.convertToMonotonicLng2(W), {
2436
+ const R = t.lineString(a.convertToMonotonicLng2(W), {
2435
2437
  name: O.name,
2436
2438
  type: "history",
2437
2439
  updated: A == null ? void 0 : A.updated,
@@ -2454,32 +2456,32 @@ class V0 {
2454
2456
  var c, O, A, W;
2455
2457
  const p = (c = M == null ? void 0 : M.data) == null ? void 0 : c.features.filter((o) => o.geometry.type === "LineString" && o.properties.type === "forecast"), b = [];
2456
2458
  for (const o of p) {
2457
- const Y = o.properties.name, d = o.properties.model, R = o.properties.showCircle, T = o.properties.disabled, f = B(o.properties.date).utc();
2458
- let i = z * 60;
2459
- const e = (O = M == null ? void 0 : M.data) == null ? void 0 : O.features.filter(
2459
+ const Y = o.properties.name, d = o.properties.model, R = o.properties.showCircle, T = o.properties.disabled, e = U(o.properties.date).utc();
2460
+ let f = z * 60;
2461
+ const i = (O = M == null ? void 0 : M.data) == null ? void 0 : O.features.filter(
2460
2462
  (Z) => Z.geometry.type === "Point" && Z.properties.type === "forecast" && Z.properties.category === `${Y}-${d}`
2461
2463
  );
2462
- let t, l = f.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2463
- for (; t = this.pickIndex(e, l), t <= e.length - 1; ) {
2464
- if (t > 0) {
2465
- const Z = e[t], u = t === 0 ? void 0 : e[t - 1], G = (i / 60 - ((A = u == null ? void 0 : u.properties) == null ? void 0 : A.hour)) / (Z.properties.hour - ((W = u == null ? void 0 : u.properties) == null ? void 0 : W.hour)), H = this.computeNumber(u == null ? void 0 : u.geometry.coordinates[0], Z.geometry.coordinates[0], G), F = this.computeNumber(u == null ? void 0 : u.geometry.coordinates[1], Z.geometry.coordinates[1], G), $ = S.point([H, F], {
2464
+ let S, u = e.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2465
+ for (; S = this.pickIndex(i, u), S <= i.length - 1; ) {
2466
+ if (S > 0) {
2467
+ const Z = i[S], B = S === 0 ? void 0 : i[S - 1], G = (f / 60 - ((A = B == null ? void 0 : B.properties) == null ? void 0 : A.hour)) / (Z.properties.hour - ((W = B == null ? void 0 : B.properties) == null ? void 0 : W.hour)), Q = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[0], Z.geometry.coordinates[0], G), F = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[1], Z.geometry.coordinates[1], G), $ = t.point([Q, F], {
2466
2468
  name: Y,
2467
2469
  model: d,
2468
2470
  category: Z == null ? void 0 : Z.properties.category,
2469
- date: l.format(),
2470
- format: l.format("MMM-DD/HHmm[Z]"),
2471
- gusts: this.computeNumber(u == null ? void 0 : u.properties.gusts, Z.properties.gusts, G),
2472
- hour: this.computeNumber(u == null ? void 0 : u.properties.hour, Z.properties.hour, G),
2473
- movement: this.computeNumber(u == null ? void 0 : u.properties.movement, Z.properties.movement, G),
2474
- pressure: this.computeNumber(u == null ? void 0 : u.properties.pressure, Z.properties.pressure, G),
2475
- wind: this.computeNumber(u == null ? void 0 : u.properties.wind, Z.properties.wind, G),
2471
+ date: u.format(),
2472
+ format: u.format("MMM-DD/HHmm[Z]"),
2473
+ gusts: this.computeNumber(B == null ? void 0 : B.properties.gusts, Z.properties.gusts, G),
2474
+ hour: this.computeNumber(B == null ? void 0 : B.properties.hour, Z.properties.hour, G),
2475
+ movement: this.computeNumber(B == null ? void 0 : B.properties.movement, Z.properties.movement, G),
2476
+ pressure: this.computeNumber(B == null ? void 0 : B.properties.pressure, Z.properties.pressure, G),
2477
+ wind: this.computeNumber(B == null ? void 0 : B.properties.wind, Z.properties.wind, G),
2476
2478
  type: "forecast",
2477
2479
  disabled: T,
2478
2480
  showCircle: R
2479
2481
  });
2480
2482
  b.push($);
2481
2483
  }
2482
- i += z * 60, l = f.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2484
+ f += z * 60, u = e.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2483
2485
  }
2484
2486
  }
2485
2487
  return b;
@@ -2509,9 +2511,9 @@ class V0 {
2509
2511
  const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, b);
2510
2512
  if (c && O) {
2511
2513
  if (!b.debug) {
2512
- const f = r.calculateDistance(M, c), i = r.calculateDistance(M, O);
2513
- if (f > 2 * p && i > 2 * p)
2514
- return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", b.requestId, f, i, {
2514
+ const e = r.calculateDistance(M, c), f = r.calculateDistance(M, O);
2515
+ if (e > 2 * p && f > 2 * p)
2516
+ return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", b.requestId, e, f, {
2515
2517
  from: M,
2516
2518
  t1: c,
2517
2519
  t2: O,
@@ -2548,9 +2550,9 @@ class V0 {
2548
2550
  const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, b);
2549
2551
  if (c && O) {
2550
2552
  if (!b.debug) {
2551
- const T = r.calculateDistance(M, c), f = r.calculateDistance(M, O);
2552
- if (T > 2 * p && f > 2 * p)
2553
- return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", b.requestId, T, f, {
2553
+ const T = r.calculateDistance(M, c), e = r.calculateDistance(M, O);
2554
+ if (T > 2 * p && e > 2 * p)
2555
+ return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", b.requestId, T, e, {
2554
2556
  from: M,
2555
2557
  t1: c,
2556
2558
  t2: O,
@@ -2571,26 +2573,26 @@ class V0 {
2571
2573
  * @private
2572
2574
  */
2573
2575
  static tropicalCenterTwin(M, z = 24, p = {}) {
2574
- var Y, d, R, T, f;
2576
+ var Y, d, R, T, e;
2575
2577
  let b = {};
2576
- (Y = M.forecasts) == null || Y.forEach((i) => {
2577
- b = { ...i.hours, ...b };
2578
+ (Y = M.forecasts) == null || Y.forEach((f) => {
2579
+ b = { ...f.hours, ...b };
2578
2580
  });
2579
2581
  const c = ((d = M == null ? void 0 : M.history) == null ? void 0 : d[0]) || (b == null ? void 0 : b[(R = Object.keys(b)) == null ? void 0 : R[0]]);
2580
2582
  I == null || I.info("[%s] the first tropical center: %j", p.requestId, c);
2581
- let O = (T = Object.keys(b || {}).filter((i) => Number(i) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2582
- O || (O = (f = Object.keys(b || {}).filter((i) => Number(i) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : f.at(-1));
2583
+ let O = (T = Object.keys(b || {}).filter((f) => Number(f) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2584
+ O || (O = (e = Object.keys(b || {}).filter((f) => Number(f) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : e.at(-1));
2583
2585
  const A = b == null ? void 0 : b[O || -1];
2584
2586
  I == null || I.info("[%s] the second tropical center: %j in %d hrs", p.requestId, A, O);
2585
- const W = Object.keys(b || {}).filter((i) => Number(i) <= Number(O)), o = { 0: c };
2586
- for (const i of W)
2587
- o[i] = b[i];
2587
+ const W = Object.keys(b || {}).filter((f) => Number(f) <= Number(O)), o = { 0: c };
2588
+ for (const f of W)
2589
+ o[f] = b[f];
2588
2590
  return { t1: c, t2: A, hr: Number(O), hours: o };
2589
2591
  }
2590
2592
  static pickIndex(M, z) {
2591
2593
  let p = 0;
2592
2594
  for (const b of M) {
2593
- if (B(b.properties.date).isAfter(z))
2595
+ if (U(b.properties.date).isAfter(z))
2594
2596
  return p === 0 ? -1 : p;
2595
2597
  p++;
2596
2598
  }