@idm-plugin/geo 2.1.2 → 2.1.4

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,208 +13,208 @@ 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;
20
20
  (!M || typeof M.version != "string") && D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
21
- var o = M.version.split("."), Y = +o[0], d = +o[1];
22
- (Y < 2 || Y === 2 && d < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
23
- function R(q) {
24
- return q > 96 ? q - 87 : q > 64 ? q - 29 : q - 48;
21
+ var q = M.version.split("."), d = +q[0], Y = +q[1];
22
+ (d < 2 || d === 2 && Y < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
23
+ function R(o) {
24
+ return o > 96 ? o - 87 : o > 64 ? o - 29 : o - 48;
25
25
  }
26
- function T(q) {
27
- var n = 0, X = q.split("."), L = X[0], N = X[1] || "", U = 1, E, V = 0, P = 1;
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;
26
+ function T(o) {
27
+ var n = 0, X = o.split("."), L = X[0], N = X[1] || "", V = 1, E, s = 0, P = 1;
28
+ for (o.charCodeAt(0) === 45 && (n = 1, P = -1), n; n < L.length; n++)
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) {
35
- for (var n = 0; n < q.length; n++)
36
- q[n] = T(q[n]);
34
+ function e(o) {
35
+ for (var n = 0; n < o.length; n++)
36
+ o[n] = T(o[n]);
37
37
  }
38
- function i(q, n) {
38
+ function f(o, n) {
39
39
  for (var X = 0; X < n; X++)
40
- q[X] = Math.round((q[X - 1] || 0) + q[X] * 6e4);
41
- q[n - 1] = 1 / 0;
40
+ o[X] = Math.round((o[X - 1] || 0) + o[X] * 6e4);
41
+ o[n - 1] = 1 / 0;
42
42
  }
43
- function e(q, n) {
43
+ function i(o, n) {
44
44
  var X = [], L;
45
45
  for (L = 0; L < n.length; L++)
46
- X[L] = q[n[L]];
46
+ X[L] = o[n[L]];
47
47
  return X;
48
48
  }
49
- function t(q) {
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), {
49
+ function S(o) {
50
+ var n = o.split("|"), X = n[2].split(" "), L = n[3].split(""), N = n[4].split(" ");
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(o) {
60
+ o && this._set(S(o));
61
61
  }
62
- function Z(q, n) {
62
+ function Z(o, n) {
63
63
  var X = n.length;
64
- if (q < n[0])
64
+ if (o < n[0])
65
65
  return 0;
66
- if (X > 1 && n[X - 1] === 1 / 0 && q >= n[X - 2])
66
+ if (X > 1 && n[X - 1] === 1 / 0 && o >= n[X - 2])
67
67
  return X - 1;
68
- if (q >= n[X - 1])
68
+ if (o >= 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] <= o ? N = L : V = L;
72
+ return V;
73
73
  }
74
- l.prototype = {
75
- _set: function(q) {
76
- this.name = q.name, this.abbrs = q.abbrs, this.untils = q.untils, this.offsets = q.offsets, this.population = q.population;
74
+ u.prototype = {
75
+ _set: function(o) {
76
+ this.name = o.name, this.abbrs = o.abbrs, this.untils = o.untils, this.offsets = o.offsets, this.population = o.population;
77
77
  },
78
- _index: function(q) {
79
- var n = +q, X = this.untils, L;
78
+ _index: function(o) {
79
+ var n = +o, X = this.untils, L;
80
80
  if (L = Z(n, X), L >= 0)
81
81
  return L;
82
82
  },
83
83
  countries: function() {
84
- var q = this.name;
84
+ var o = this.name;
85
85
  return Object.keys(c).filter(function(n) {
86
- return c[n].zones.indexOf(q) !== -1;
86
+ return c[n].zones.indexOf(o) !== -1;
87
87
  });
88
88
  },
89
- parse: function(q) {
90
- var n = +q, X = this.offsets, L = this.untils, N = L.length - 1, U, E, V, P;
89
+ parse: function(o) {
90
+ var n = +o, 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
  },
96
- abbr: function(q) {
97
- return this.abbrs[this._index(q)];
96
+ abbr: function(o) {
97
+ return this.abbrs[this._index(o)];
98
98
  },
99
- offset: function(q) {
100
- return D("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(q)];
99
+ offset: function(o) {
100
+ return D("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(o)];
101
101
  },
102
- utcOffset: function(q) {
103
- return this.offsets[this._index(q)];
102
+ utcOffset: function(o) {
103
+ return this.offsets[this._index(o)];
104
104
  }
105
105
  };
106
- function u(q, n) {
107
- this.name = q, this.zones = n;
106
+ function B(o, n) {
107
+ this.name = o, this.zones = n;
108
108
  }
109
- function G(q) {
110
- var n = q.toTimeString(), X = n.match(/\([a-z ]+\)/i);
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();
109
+ function G(o) {
110
+ var n = o.toTimeString(), X = n.match(/\([a-z ]+\)/i);
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 = +o, this.abbr = X, this.offset = o.getTimezoneOffset();
112
112
  }
113
- function H(q) {
114
- this.zone = q, this.offsetScore = 0, this.abbrScore = 0;
113
+ function Q(o) {
114
+ this.zone = o, this.offsetScore = 0, this.abbrScore = 0;
115
115
  }
116
- H.prototype.scoreOffsetAt = function(q) {
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++;
116
+ Q.prototype.scoreOffsetAt = function(o) {
117
+ this.offsetScore += Math.abs(this.zone.utcOffset(o.at) - o.offset), this.zone.abbr(o.at).replace(/[^A-Z]/g, "") !== o.abbr && this.abbrScore++;
118
118
  };
119
- function F(q, n) {
120
- for (var X, L; L = ((n.at - q.at) / 12e4 | 0) * 6e4; )
121
- X = new G(new Date(q.at + L)), X.offset === q.offset ? q = X : n = X;
122
- return q;
119
+ function F(o, n) {
120
+ for (var X, L; L = ((n.at - o.at) / 12e4 | 0) * 6e4; )
121
+ X = new G(new Date(o.at + L)), X.offset === o.offset ? o = X : n = X;
122
+ return o;
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 o = (/* @__PURE__ */ new Date()).getFullYear() - 2, n = new G(new Date(o, 0, 1)), X = n.offset, L = [n], N, V, E, s;
126
+ for (s = 1; s < 48; s++)
127
+ E = new Date(o, s, 1).getTimezoneOffset(), E !== X && (V = new G(new Date(o, 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(o + s, 0, 1))), L.push(new G(new Date(o + s, 6, 1)));
130
130
  return L;
131
131
  }
132
- function z0(q, n) {
133
- return q.offsetScore !== n.offsetScore ? q.offsetScore - n.offsetScore : q.abbrScore !== n.abbrScore ? q.abbrScore - n.abbrScore : q.zone.population !== n.zone.population ? n.zone.population - q.zone.population : n.zone.name.localeCompare(q.zone.name);
132
+ function z0(o, n) {
133
+ return o.offsetScore !== n.offsetScore ? o.offsetScore - n.offsetScore : o.abbrScore !== n.abbrScore ? o.abbrScore - n.abbrScore : o.zone.population !== n.zone.population ? n.zone.population - o.zone.population : n.zone.name.localeCompare(o.zone.name);
134
134
  }
135
- function b0(q, n) {
135
+ function b0(o, n) {
136
136
  var X, L;
137
- for (f(n), X = 0; X < n.length; X++)
138
- L = n[X], A[L] = A[L] || {}, A[L][q] = !0;
137
+ for (e(n), X = 0; X < n.length; X++)
138
+ L = n[X], A[L] = A[L] || {}, A[L][o] = !0;
139
139
  }
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] || {};
140
+ function p0(o) {
141
+ var n = o.length, X = {}, L = [], N = {}, V, E, s, P;
142
+ for (V = 0; V < n; V++)
143
+ if (s = o[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() {
154
154
  try {
155
- var q = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
- if (q && q.length > 3) {
157
- var n = O[h(q)];
155
+ var o = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
+ if (o && o.length > 3) {
157
+ var n = O[h(o)];
158
158
  if (n)
159
159
  return n;
160
- D("Moment Timezone found " + q + " from the Intl api, but did not have that data loaded.");
160
+ D("Moment Timezone found " + o + " from the Intl api, but did not have that data loaded.");
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
- function A0(q) {
173
- return (!W || q) && (W = O0()), W;
172
+ function A0(o) {
173
+ return (!W || o) && (W = O0()), W;
174
174
  }
175
- function h(q) {
176
- return (q || "").toLowerCase().replace(/\//g, "_");
175
+ function h(o) {
176
+ return (o || "").toLowerCase().replace(/\//g, "_");
177
177
  }
178
- function k(q) {
178
+ function k(o) {
179
179
  var n, X, L, N;
180
- for (typeof q == "string" && (q = [q]), n = 0; n < q.length; n++)
181
- L = q[n].split("|"), X = L[0], N = h(X), p[N] = q[n], O[N] = X, b0(N, L[2].split(" "));
180
+ for (typeof o == "string" && (o = [o]), n = 0; n < o.length; n++)
181
+ L = o[n].split("|"), X = L[0], N = h(X), p[N] = o[n], O[N] = X, b0(N, L[2].split(" "));
182
182
  }
183
- function g(q, n) {
184
- q = h(q);
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;
183
+ function g(o, n) {
184
+ o = h(o);
185
+ var X = p[o], L;
186
+ return X instanceof u ? X : typeof X == "string" ? (X = new u(X), p[o] = X, X) : b[o] && n !== g && (L = g(b[o], g)) ? (X = p[o] = new u(), X._set(L), X.name = O[o], X) : null;
187
187
  }
188
188
  function c0() {
189
- var q, n = [];
190
- for (q in O)
191
- O.hasOwnProperty(q) && (p[q] || p[b[q]]) && O[q] && n.push(O[q]);
189
+ var o, n = [];
190
+ for (o in O)
191
+ O.hasOwnProperty(o) && (p[o] || p[b[o]]) && O[o] && n.push(O[o]);
192
192
  return n.sort();
193
193
  }
194
194
  function W0() {
195
195
  return Object.keys(c);
196
196
  }
197
- function y(q) {
197
+ function y(o) {
198
198
  var n, X, L, N;
199
- for (typeof q == "string" && (q = [q]), n = 0; n < q.length; n++)
200
- X = q[n].split("|"), L = h(X[0]), N = h(X[1]), b[L] = N, O[L] = X[0], b[N] = L, O[N] = X[1];
199
+ for (typeof o == "string" && (o = [o]), n = 0; n < o.length; n++)
200
+ X = o[n].split("|"), L = h(X[0]), N = h(X[1]), b[L] = N, O[L] = X[0], b[N] = L, O[N] = X[1];
201
201
  }
202
- function o0(q) {
202
+ function o0(o) {
203
203
  var n, X, L, N;
204
- if (!(!q || !q.length))
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(
204
+ if (!(!o || !o.length))
205
+ for (n = 0; n < o.length; n++)
206
+ N = o[n].split("|"), X = N[0].toUpperCase(), L = N[1].split(" "), c[X] = new B(
207
207
  X,
208
208
  L
209
209
  );
210
210
  }
211
- function q0(q) {
212
- return q = q.toUpperCase(), c[q] || null;
211
+ function q0(o) {
212
+ return o = o.toUpperCase(), c[o] || null;
213
213
  }
214
- function Y0(q, n) {
215
- if (q = q0(q), !q)
214
+ function Y0(o, n) {
215
+ if (o = q0(o), !o)
216
216
  return null;
217
- var X = q.zones.sort();
217
+ var X = o.zones.sort();
218
218
  return n ? X.map(function(L) {
219
219
  var N = g(L);
220
220
  return {
@@ -223,59 +223,59 @@ var _ = { exports: {} };
223
223
  };
224
224
  }) : X;
225
225
  }
226
- function d0(q) {
227
- k(q.zones), y(q.links), o0(q.countries), s.dataVersion = q.version;
226
+ function d0(o) {
227
+ k(o.zones), y(o.links), o0(o.countries), l.dataVersion = o.version;
228
228
  }
229
- function J(q) {
230
- return J.didShowError || (J.didShowError = !0, D("moment.tz.zoneExists('" + q + "') has been deprecated in favor of !moment.tz.zone('" + q + "')")), !!g(q);
229
+ function J(o) {
230
+ return J.didShowError || (J.didShowError = !0, D("moment.tz.zoneExists('" + o + "') has been deprecated in favor of !moment.tz.zone('" + o + "')")), !!g(o);
231
231
  }
232
- function v(q) {
233
- var n = q._f === "X" || q._f === "x";
234
- return !!(q._a && q._tzm === void 0 && !n);
232
+ function v(o) {
233
+ var n = o._f === "X" || o._f === "x";
234
+ return !!(o._a && o._tzm === void 0 && !n);
235
235
  }
236
- function D(q) {
237
- typeof console < "u" && typeof console.error == "function" && console.error(q);
236
+ function D(o) {
237
+ typeof console < "u" && typeof console.error == "function" && console.error(o);
238
238
  }
239
- function s(q) {
239
+ function l(o) {
240
240
  var n = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], L = M.utc.apply(null, n), N;
241
- return !M.isMoment(q) && v(L) && (N = g(X)) && L.add(N.parse(L), "minutes"), L.tz(X), L;
241
+ return !M.isMoment(o) && 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(o, n) {
246
246
  var X = M.defaultZone, L;
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
- if (L = q._z.utcOffset(q), Math.abs(L) < 16 && (L = L / 60), q.utcOffset !== void 0) {
249
- var N = q._z;
250
- q.utcOffset(-L, n), q._z = N;
247
+ if (o._z === void 0 && (X && v(o) && !o._isUTC && o.isValid() && (o._d = M.utc(o._a)._d, o.utc().add(X.parse(o), "minutes")), o._z = X), o._z)
248
+ if (L = o._z.utcOffset(o), Math.abs(L) < 16 && (L = L / 60), o.utcOffset !== void 0) {
249
+ var N = o._z;
250
+ o.utcOffset(-L, n), o._z = N;
251
251
  } else
252
- q.zone(L, n);
253
- }, C.tz = function(q, n) {
254
- if (q) {
255
- if (typeof q != "string")
256
- throw new Error("Time zone name must be a string, got " + q + " [" + typeof q + "]");
257
- return this._z = g(q), this._z ? M.updateOffset(this, n) : D("Moment Timezone has no data for " + q + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
252
+ o.zone(L, n);
253
+ }, C.tz = function(o, n) {
254
+ if (o) {
255
+ if (typeof o != "string")
256
+ throw new Error("Time zone name must be a string, got " + o + " [" + typeof o + "]");
257
+ return this._z = g(o), this._z ? M.updateOffset(this, n) : D("Moment Timezone has no data for " + o + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
258
258
  }
259
259
  if (this._z)
260
260
  return this._z.name;
261
261
  };
262
- function w(q) {
262
+ function w(o) {
263
263
  return function() {
264
- return this._z ? this._z.abbr(this) : q.call(this);
264
+ return this._z ? this._z.abbr(this) : o.call(this);
265
265
  };
266
266
  }
267
- function x(q) {
267
+ function x(o) {
268
268
  return function() {
269
- return this._z = null, q.apply(this, arguments);
269
+ return this._z = null, o.apply(this, arguments);
270
270
  };
271
271
  }
272
- function a0(q) {
272
+ function a0(o) {
273
273
  return function() {
274
- return arguments.length > 0 && (this._z = null), q.apply(this, arguments);
274
+ return arguments.length > 0 && (this._z = null), o.apply(this, arguments);
275
275
  };
276
276
  }
277
- C.zoneName = w(C.zoneName), C.zoneAbbr = w(C.zoneAbbr), C.utc = x(C.utc), C.local = x(C.local), C.utcOffset = a0(C.utcOffset), M.tz.setDefault = function(q) {
278
- return (Y < 2 || Y === 2 && d < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = q ? g(q) : null, M;
277
+ C.zoneName = w(C.zoneName), C.zoneAbbr = w(C.zoneAbbr), C.utc = x(C.utc), C.local = x(C.local), C.utcOffset = a0(C.utcOffset), M.tz.setDefault = function(o) {
278
+ return (d < 2 || d === 2 && Y < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = o ? g(o) : null, M;
279
279
  };
280
280
  var K = M.momentProperties;
281
281
  return Object.prototype.toString.call(K) === "[object Array]" ? (K.push("_z"), K.push("_a")) : K && (K._z = null), M;
@@ -1145,10 +1145,10 @@ var M0 = { exports: {} };
1145
1145
  throw new RangeError("invalid coordinates");
1146
1146
  if (90 <= z)
1147
1147
  return "Etc/GMT";
1148
- var O = -1, A = 48 * (180 + p) / 360.00000000000006, W = 24 * (90 - z) / 180.00000000000003, o = 0 | A, Y = 0 | W, d = 96 * Y + 2 * o;
1149
- for (d = 56 * b.charCodeAt(d) + b.charCodeAt(d + 1) - 1995; d + c.length < 3136; )
1150
- d = 56 * b.charCodeAt(d = 8 * (O = O + d + 1) + 4 * (Y = 0 | (W = 2 * (W - Y) % 2)) + 2 * (o = 0 | (A = 2 * (A - o) % 2)) + 2304) + b.charCodeAt(d + 1) - 1995;
1151
- return c[d + c.length - 3136];
1148
+ var O = -1, A = 48 * (180 + p) / 360.00000000000006, W = 24 * (90 - z) / 180.00000000000003, q = 0 | A, d = 0 | W, Y = 96 * d + 2 * q;
1149
+ for (Y = 56 * b.charCodeAt(Y) + b.charCodeAt(Y + 1) - 1995; Y + c.length < 3136; )
1150
+ Y = 56 * b.charCodeAt(Y = 8 * (O = O + Y + 1) + 4 * (d = 0 | (W = 2 * (W - d) % 2)) + 2 * (q = 0 | (A = 2 * (A - q) % 2)) + 2304) + b.charCodeAt(Y + 1) - 1995;
1151
+ return c[Y + c.length - 3136];
1152
1152
  }
1153
1153
  m.exports = M;
1154
1154
  })(M0);
@@ -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
  /**
@@ -1183,18 +1183,18 @@ class a {
1183
1183
  M = a.convertToStdLng(M, z);
1184
1184
  let b = "E";
1185
1185
  M < 0 && (b = "W"), M = Math.abs(M), p = p.toUpperCase();
1186
- let c = M * 3600, O, A, W, o, Y, d;
1187
- O = c % 3600 % 60, p.indexOf("S") !== -1 && (c = c - O, A = a.padNumber(O, 2, 2)), W = c / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = a.roundPrecision(W, z).toString().padStart(2, "0") : o = a.padNumber(W, 2, 3), c = c - W * 60), Y = c / 3600, p.indexOf("M") !== -1 ? d = a.roundPrecision(Y, z).toString().padStart(3, "0") : d = a.padNumber(Y, 3, 6), Number(A) >= 60 && (o = Number(o) + 1, A = 0), Number(o) >= 60 && (d = Number(d) + 1, o = 0);
1188
- const R = `${p.replace(/S+/gi, A).replace(/M+/gi, o).replace(/H+/gi, d)}${b}`;
1186
+ let c = M * 3600, O, A, W, q, d, Y;
1187
+ O = c % 3600 % 60, p.indexOf("S") !== -1 && (c = c - O, A = a.padNumber(O, 2, 2)), W = c / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = a.roundPrecision(W, z).toString().padStart(2, "0") : q = a.padNumber(W, 2, 3), c = c - W * 60), d = c / 3600, p.indexOf("M") !== -1 ? Y = a.roundPrecision(d, z).toString().padStart(3, "0") : Y = a.padNumber(d, 3, 6), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (Y = Number(Y) + 1, q = 0);
1188
+ const R = `${p.replace(/S+/gi, A).replace(/M+/gi, q).replace(/H+/gi, Y)}${b}`;
1189
1189
  return {
1190
1190
  direction: b,
1191
- degree: a.roundPrecision(Y, z),
1191
+ degree: a.roundPrecision(d, z),
1192
1192
  minute: a.roundPrecision(W, z),
1193
1193
  second: a.roundPrecision(O, z),
1194
1194
  pretty: R,
1195
1195
  S: A,
1196
- M: o,
1197
- H: d
1196
+ M: q,
1197
+ H: Y
1198
1198
  };
1199
1199
  }
1200
1200
  /**
@@ -1207,18 +1207,18 @@ class a {
1207
1207
  M = M % 180;
1208
1208
  let b = "N";
1209
1209
  M < 0 && (b = "S"), M = Math.abs(M), p = p.toUpperCase();
1210
- let c = M * 3600, O, A, W, o, Y, d;
1211
- O = c % 3600 % 60, p.indexOf("S") !== -1 && (c = c - O, A = a.padNumber(O, 2, 2)), W = c / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = a.roundPrecision(W, z).toString().padStart(2, "0") : o = a.padNumber(W, 2, 3), c = c - W * 60), Y = c / 3600, p.indexOf("M") !== -1 ? d = a.roundPrecision(Y, z).toString().padStart(2, "0") : d = a.padNumber(Y, 2, 6), Number(A) >= 60 && (o = Number(o) + 1, A = 0), Number(o) >= 60 && (d = Number(d) + 1, o = 0);
1212
- const R = `${p.replace(/S+/gi, A).replace(/M+/gi, o).replace(/H+/gi, d)}${b}`;
1210
+ let c = M * 3600, O, A, W, q, d, Y;
1211
+ O = c % 3600 % 60, p.indexOf("S") !== -1 && (c = c - O, A = a.padNumber(O, 2, 2)), W = c / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = a.roundPrecision(W, z).toString().padStart(2, "0") : q = a.padNumber(W, 2, 3), c = c - W * 60), d = c / 3600, p.indexOf("M") !== -1 ? Y = a.roundPrecision(d, z).toString().padStart(2, "0") : Y = a.padNumber(d, 2, 6), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (Y = Number(Y) + 1, q = 0);
1212
+ const R = `${p.replace(/S+/gi, A).replace(/M+/gi, q).replace(/H+/gi, Y)}${b}`;
1213
1213
  return {
1214
1214
  direction: b,
1215
- degree: a.roundPrecision(Y, z),
1215
+ degree: a.roundPrecision(d, z),
1216
1216
  minute: a.roundPrecision(W, z),
1217
1217
  second: a.roundPrecision(O, z),
1218
1218
  pretty: R,
1219
1219
  S: A,
1220
- M: o,
1221
- H: d
1220
+ M: q,
1221
+ H: Y
1222
1222
  };
1223
1223
  }
1224
1224
  static str2Lng(M, z = 6) {
@@ -1227,11 +1227,11 @@ class a {
1227
1227
  M = a.strReplace(M, "LNG");
1228
1228
  const b = M[M.length - 1].toUpperCase();
1229
1229
  M = M.substring(0, M.length - 1).trim();
1230
- const c = M.split(" ").filter((o) => o !== "").map((o) => Math.abs(Number(o)));
1230
+ const c = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
1231
1231
  let [O, A, W] = c;
1232
1232
  if (A = A || 0, A = A > 60 ? A / Math.pow(10, String(A).length - 2) : A, W = W || 0, W = W > 60 ? W / Math.pow(10, String(W).length - 2) : W, O > 360 && !A) {
1233
- const o = this.roundPrecision(O / 100, 0);
1234
- A = O - o * 100, O = o;
1233
+ const q = this.roundPrecision(O / 100, 0);
1234
+ A = O - q * 100, O = q;
1235
1235
  }
1236
1236
  p = O + A / 60 + W / 3600, b === "W" && (p = p * -1);
1237
1237
  } else
@@ -1244,11 +1244,11 @@ class a {
1244
1244
  M = a.strReplace(M, "LAT");
1245
1245
  const b = M[M.length - 1].toUpperCase();
1246
1246
  M = M.substring(0, M.length - 1).trim();
1247
- const c = M.split(" ").filter((o) => o !== "").map((o) => Math.abs(Number(o)));
1247
+ const c = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
1248
1248
  let [O, A, W] = c;
1249
1249
  if (W = W || 0, A = A || 0, A = A > 60 ? A / Math.pow(10, String(A).length - 2) : A, W = W > 60 ? W / Math.pow(10, String(W).length - 2) : W, O > 90 && !A) {
1250
- const o = this.roundPrecision(O / 100, 0);
1251
- A = O - o * 100, O = o;
1250
+ const q = this.roundPrecision(O / 100, 0);
1251
+ A = O - q * 100, O = q;
1252
1252
  }
1253
1253
  if (p = O + A / 60 + W / 3600, p > 90)
1254
1254
  throw new Error(`latitude out of range: ${M}${b}`);
@@ -1320,7 +1320,7 @@ class t0 {
1320
1320
  return `${M.lat}|${M.lng}|${M.positionTime}|${M.sog}|${M.cog}|${M.hdg}|${M.draught}|${z}|${JSON.stringify(M.meteo || {})}|${M.vendor}|${M.deleted}`;
1321
1321
  }
1322
1322
  static str2Json(M) {
1323
- const [z, p, b, c, O, A, W, o, Y, d, R] = M.split("|");
1323
+ const [z, p, b, c, O, A, W, q, d, Y, R] = M.split("|");
1324
1324
  return {
1325
1325
  lat: Number(z),
1326
1326
  lng: Number(p),
@@ -1330,57 +1330,57 @@ class t0 {
1330
1330
  hdg: Number(A),
1331
1331
  //@ts-ignore
1332
1332
  draught: isNaN(W) ? null : Number(W),
1333
- type: o,
1334
- important: o !== "A",
1335
- meteo: Y ? JSON.parse(Y) : void 0,
1336
- vendor: d,
1333
+ type: q,
1334
+ important: q !== "A",
1335
+ meteo: d ? JSON.parse(d) : void 0,
1336
+ vendor: Y,
1337
1337
  deleted: R === "true"
1338
1338
  };
1339
1339
  }
1340
1340
  static inspectStoppages(M, z = 1, p = !0) {
1341
1341
  const b = M.at(0).positionTime < M.at(-1).positionTime;
1342
- b || M.sort((W, o) => W.positionTime - o.positionTime);
1342
+ b || M.sort((W, q) => W.positionTime - q.positionTime);
1343
1343
  const c = [];
1344
1344
  let O, A;
1345
1345
  for (let W = 0; W < M.length - 1; W++) {
1346
- const o = M[W];
1347
- if (!(p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(o.type))) {
1348
- for (let Y = W + 1; Y < M.length; Y++) {
1349
- const d = M[Y - 1], R = M[Y];
1350
- if (p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(o.type))
1346
+ const q = M[W];
1347
+ if (!(p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))) {
1348
+ for (let d = W + 1; d < M.length; d++) {
1349
+ const Y = M[d - 1], R = M[d];
1350
+ if (p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))
1351
1351
  continue;
1352
- const T = R.positionTime - d.positionTime;
1353
- if (r.calculateDistance(R, d, !0, 4) / (T / 3600) < z)
1354
- O || (O = o), Y === M.length - 1 && (A = R, W = Y);
1352
+ const T = R.positionTime - Y.positionTime;
1353
+ if (r.calculateDistance(R, Y, !0, 4) / (T / 3600) < z)
1354
+ O || (O = q), d === M.length - 1 && (A = R, W = d);
1355
1355
  else {
1356
- O && (A = M[Y - 1], W = Y);
1356
+ O && (A = M[d - 1], W = d);
1357
1357
  break;
1358
1358
  }
1359
1359
  }
1360
1360
  if ((A == null ? void 0 : A.positionTime) > (O == null ? void 0 : O.positionTime) && O) {
1361
- const Y = {
1361
+ const d = {
1362
1362
  start: {
1363
1363
  lat: O.lat,
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
- }, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), R = r.divideAccordingToLng(d);
1378
- Y.distance = r.calculateRouteDistance(R), Y.hours = Math.round(Y.duration / 3600 * 10) / 10, Y.avgSog = Math.round(Y.distance / Y.hours * 10) / 10, c.push(Y);
1377
+ }, Y = M.filter((T) => T.positionTime >= d.start.positionTime && T.positionTime <= d.end.positionTime), R = r.divideAccordingToLng(Y);
1378
+ d.distance = r.calculateRouteDistance(R), d.hours = Math.round(d.duration / 3600 * 10) / 10, d.avgSog = Math.round(d.distance / d.hours * 10) / 10, c.push(d);
1379
1379
  }
1380
1380
  O = void 0, A = void 0;
1381
1381
  }
1382
1382
  }
1383
- return b || M.sort((W, o) => o.positionTime - W.positionTime), c;
1383
+ return b || M.sort((W, q) => q.positionTime - W.positionTime), c;
1384
1384
  }
1385
1385
  /**
1386
1386
  * 计算轨迹摘要
@@ -1389,21 +1389,21 @@ 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((d) => d.positionTime >= b.unix() && d.positionTime <= c.unix());
1393
1393
  let A = 0, W = 0;
1394
1394
  if (O.length > 1)
1395
- for (let Y = 0; Y < O.length - 1; Y++) {
1396
- const d = O[Y], R = O[Y + 1];
1397
- A += r.calculateDistance(d, R, !0, 4), W += Math.abs(R.positionTime - d.positionTime);
1395
+ for (let d = 0; d < O.length - 1; d++) {
1396
+ const Y = O[d], R = O[d + 1];
1397
+ A += r.calculateDistance(Y, R, !0, 4), W += Math.abs(R.positionTime - Y.positionTime);
1398
1398
  }
1399
1399
  A = Math.round(A * 100) / 100, W = Math.round(W / 3600 * 100) / 100;
1400
- const o = W ? Math.round(A / W * 100) / 100 : 0;
1401
- return { distance: A, interval: W, avgSpd: o };
1400
+ const q = W ? Math.round(A / W * 100) / 100 : 0;
1401
+ return { distance: A, interval: W, avgSpd: q };
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
  * 计算航线距离
@@ -1454,8 +1454,8 @@ class r {
1454
1454
  for (let A = 0; A < O.length - 1; A++) {
1455
1455
  const W = { lng: O[A][0], lat: O[A][1] };
1456
1456
  A === 0 && c && (b += this.calculateDistance(c, W, !0, z, p));
1457
- const o = { lng: O[A + 1][0], lat: O[A + 1][1] };
1458
- b += this.calculateDistance(W, o, !0, z, p), c = o;
1457
+ const q = { lng: O[A + 1][0], lat: O[A + 1][1] };
1458
+ b += this.calculateDistance(W, q, !0, z, p), c = q;
1459
1459
  }
1460
1460
  return a.roundPrecision(b, z);
1461
1461
  }
@@ -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
  }
@@ -1484,11 +1484,11 @@ class r {
1484
1484
  * @param units 单位,默认 nm(海里)
1485
1485
  */
1486
1486
  static interpolateCoordinates(M, z, p, b = !0, c = !0, O = "nauticalmiles") {
1487
- const A = [], W = this.calculateBearing(M, z, !1), o = this.calculateDistance(M, z, !1, 8, O);
1487
+ const A = [], W = this.calculateBearing(M, z, !1), q = this.calculateDistance(M, z, !1, 8, O);
1488
1488
  b && A.push({ lng: M.lng, lat: M.lat });
1489
- let Y = 0;
1490
- for (; Y < o; )
1491
- Y += p, Y < o && A.push(this.calculateCoordinate(M, W, Y, O, !1));
1489
+ let d = 0;
1490
+ for (; d < q; )
1491
+ d += p, d < q && A.push(this.calculateCoordinate(M, W, d, O, !1));
1492
1492
  return c && A.push({ lng: z.lng, lat: z.lat }), A;
1493
1493
  }
1494
1494
  /**
@@ -1512,25 +1512,25 @@ class r {
1512
1512
  let O, A;
1513
1513
  for (let W = 0; W < M.length - 1; W++) {
1514
1514
  O = a.convertToStdLng(M[W].lng, 8), A = a.convertToStdLng(M[W + 1].lng, 8), M[W].lat = a.roundPrecision(M[W].lat, 8), M[W + 1].lat = a.roundPrecision(M[W + 1].lat, 8), b.push([O, M[W].lat]);
1515
- const o = O - A;
1516
- if (Math.abs(o) > 180) {
1517
- const Y = a.convertToMonotonicLng2([
1515
+ const q = O - A;
1516
+ if (Math.abs(q) > 180) {
1517
+ const d = a.convertToMonotonicLng2([
1518
1518
  [O, M[W].lat],
1519
1519
  [A, M[W + 1].lat]
1520
1520
  ]);
1521
- let d, R;
1522
- z ? (d = S.lineString(Y), R = S.lineString([
1523
- [o > 0 ? 180 : -180, 89],
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;
1521
+ let Y, R;
1522
+ z ? (Y = t.lineString(d), R = t.lineString([
1523
+ [q > 0 ? 180 : -180, 89],
1524
+ [q > 0 ? 180 : -180, -89]
1525
+ ])) : (Y = t.greatCircle(d[0], d[1]), R = t.greatCircle([q > 0 ? 180 : -180, 89], [q > 0 ? 180 : -180, -89]));
1526
+ const T = t.lineIntersect(Y, 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
+ q > 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
  }
@@ -1592,10 +1592,10 @@ class r {
1592
1592
  static mergeCoordinateToRoute(M, z) {
1593
1593
  M.lng = a.convertToStdLng(M.lng, 8);
1594
1594
  let p = Number.MAX_VALUE, b = 0, c = 0, O, A;
1595
- return z.forEach((W, o) => {
1596
- for (let Y = 0; Y < W.length - 1; Y++) {
1597
- const d = { lng: W[Y][0], lat: W[Y][1] }, R = { lng: W[Y + 1][0], lat: W[Y + 1][1] }, T = this.calculatePointToLineDistance(M, d, R);
1598
- p > T && (p = T, c = Y, b = o, O = this.calculateDistance(d, M), A = this.calculateDistance(R, M));
1595
+ return z.forEach((W, q) => {
1596
+ for (let d = 0; d < W.length - 1; d++) {
1597
+ const Y = { lng: W[d][0], lat: W[d][1] }, R = { lng: W[d + 1][0], lat: W[d + 1][1] }, T = this.calculatePointToLineDistance(M, Y, R);
1598
+ p > T && (p = T, c = d, b = q, O = this.calculateDistance(Y, M), A = this.calculateDistance(R, M));
1599
1599
  }
1600
1600
  }), O !== 0 && A !== 0 ? z[b].splice(c + 1, 0, [M.lng, M.lat]) : O === 0 ? z[b].splice(c, 1, [M.lng, M.lat]) : A === 0 && z[b].splice(c + 1, 1, [M.lng, M.lat]), z;
1601
1601
  }
@@ -1663,11 +1663,11 @@ class r {
1663
1663
  */
1664
1664
  static calculateRangeWaypoints(M, z, p, b = []) {
1665
1665
  const c = this.convertRouteToCoordinates(p, 0), O = this.mergeCoordinatesToWaypoints([M, z], c.length ? c : b), A = O.findIndex(
1666
- (Y) => a.roundPrecision(M.lng, 8) === a.roundPrecision(Y.lng, 8) && a.roundPrecision(M.lat, 8) === a.roundPrecision(Y.lat, 8)
1666
+ (d) => a.roundPrecision(M.lng, 8) === a.roundPrecision(d.lng, 8) && a.roundPrecision(M.lat, 8) === a.roundPrecision(d.lat, 8)
1667
1667
  ), W = O.findIndex(
1668
- (Y) => a.roundPrecision(z.lng, 8) === a.roundPrecision(Y.lng, 8) && a.roundPrecision(z.lat, 8) === a.roundPrecision(Y.lat, 8)
1668
+ (d) => a.roundPrecision(z.lng, 8) === a.roundPrecision(d.lng, 8) && a.roundPrecision(z.lat, 8) === a.roundPrecision(d.lat, 8)
1669
1669
  );
1670
- return O.filter((Y, d) => d >= A && d <= W);
1670
+ return O.filter((d, Y) => Y >= A && Y <= W);
1671
1671
  }
1672
1672
  /**
1673
1673
  * 计算坐标到航路上的最短距离
@@ -1678,8 +1678,8 @@ class r {
1678
1678
  let p = Number.MAX_VALUE, b = 0, c = 0;
1679
1679
  return z.forEach((O, A) => {
1680
1680
  for (let W = 0; W < O.length - 1; W++) {
1681
- const o = { lng: O[W][0], lat: O[W][1] }, Y = { lng: O[W + 1][0], lat: O[W + 1][1] }, d = this.calculatePointToLineDistance(M, o, Y);
1682
- p > d && (p = d, b = W, c = A);
1681
+ const q = { lng: O[W][0], lat: O[W][1] }, d = { lng: O[W + 1][0], lat: O[W + 1][1] }, Y = this.calculatePointToLineDistance(M, q, d);
1682
+ p > Y && (p = Y, b = W, c = A);
1683
1683
  }
1684
1684
  }), { minDist: p, segIndex: c, minIndex: b };
1685
1685
  }
@@ -1698,11 +1698,11 @@ class r {
1698
1698
  let A = !0;
1699
1699
  for (let W = b; W < z.length; W++)
1700
1700
  if (A) {
1701
- const o = [];
1702
- o.push([M.lng, M.lat]);
1703
- for (let Y = c + 1; Y < z[W].length; Y++)
1704
- M.lng === z[W][Y][0] && M.lat === z[W][Y][1] || o.push(z[W][Y]);
1705
- O.push(o), A = !1;
1701
+ const q = [];
1702
+ q.push([M.lng, M.lat]);
1703
+ for (let d = c + 1; d < z[W].length; d++)
1704
+ M.lng === z[W][d][0] && M.lat === z[W][d][1] || q.push(z[W][d]);
1705
+ O.push(q), A = !1;
1706
1706
  } else
1707
1707
  O.push([...z[W]]);
1708
1708
  return O;
@@ -1720,9 +1720,9 @@ class r {
1720
1720
  if (this.calculateDistance(M, A) === 0)
1721
1721
  return z;
1722
1722
  if (this.calculateDistance(M, W) === 0)
1723
- return z.filter((Y, d) => d > 0);
1724
- const o = this.calculatePointToLineDistance(M, A, W);
1725
- p > o && (p = o, b = O);
1723
+ return z.filter((d, Y) => Y > 0);
1724
+ const q = this.calculatePointToLineDistance(M, A, W);
1725
+ p > q && (p = q, b = O);
1726
1726
  }
1727
1727
  M.lng = a.convertToStdLng(M.lng);
1728
1728
  const c = [M];
@@ -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
  /**
@@ -1789,17 +1789,17 @@ class r {
1789
1789
  z.push(M);
1790
1790
  else {
1791
1791
  for (let W = 0; W < z.length - 1; W++) {
1792
- const o = { lng: z[W].lng, lat: z[W].lat }, Y = { lng: z[W + 1].lng, lat: z[W + 1].lat }, d = this.calculatePointToLineDistance(M, o, Y);
1793
- b >= d && (b = d, c = W, O = this.calculateDistance(o, M, !1, 6), A = this.calculateDistance(Y, M, !1, 6));
1792
+ const q = { lng: z[W].lng, lat: z[W].lat }, d = { lng: z[W + 1].lng, lat: z[W + 1].lat }, Y = this.calculatePointToLineDistance(M, q, d);
1793
+ b >= Y && (b = Y, c = W, O = this.calculateDistance(q, M, !1, 6), A = this.calculateDistance(d, M, !1, 6));
1794
1794
  }
1795
1795
  O !== 0 && A !== 0 ? O <= b && c === 0 ? z.unshift(M) : A <= b && c === z.length - 2 ? z.push(M) : z.splice(c + 1, 0, M) : O === 0 ? p ? z.splice(c, 1, M) : z.splice(c + 1, 0, M) : A === 0 && (p ? z.splice(c + 1, 1, M) : z.splice(c + 1, 0, M));
1796
1796
  }
1797
- return z.map((W, o) => {
1797
+ return z.map((W, q) => {
1798
1798
  W.lng = a.convertToStdLng(W.lng);
1799
- const Y = z[o + 1];
1800
- if (Y && ((W.bearing === null || W.bearing === void 0) && ((W.positionTime || 0) > (Y.positionTime || 0) ? W.bearing = this.calculateBearing(Y, W, !0) : W.bearing = this.calculateBearing(W, Y, !0)), W.cog = W.cog || W.bearing, !W.sog && W.positionTime && Y.positionTime)) {
1801
- const d = this.calculateDistance(W, Y, !0), R = Math.abs(Y.positionTime - W.positionTime) / 3600;
1802
- W.sog = a.roundPrecision(d / R, 2);
1799
+ const d = z[q + 1];
1800
+ if (d && ((W.bearing === null || W.bearing === void 0) && ((W.positionTime || 0) > (d.positionTime || 0) ? W.bearing = this.calculateBearing(d, W, !0) : W.bearing = this.calculateBearing(W, d, !0)), W.cog = W.cog || W.bearing, !W.sog && W.positionTime && d.positionTime)) {
1801
+ const Y = this.calculateDistance(W, d, !0), R = Math.abs(d.positionTime - W.positionTime) / 3600;
1802
+ W.sog = a.roundPrecision(Y / R, 2);
1803
1803
  }
1804
1804
  return W;
1805
1805
  });
@@ -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((q) => [q.lng, q.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
  /**
@@ -1864,40 +1864,40 @@ class r {
1864
1864
  static calculateNextCoordinateAlongRoute(M, z, p, b = "nauticalmiles") {
1865
1865
  var R;
1866
1866
  const c = M.speed || 12, O = [];
1867
- let A = [], W = !1, o = 0, Y = 0, d;
1868
- if (z && p.length ? (O.push(M), p.forEach((T, f) => {
1867
+ let A = [], W = !1, q = 0, d = 0, Y;
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++)
1875
- if (d)
1876
- i.push(T[t]);
1872
+ const f = [];
1873
+ let i;
1874
+ for (let S = 0; S < T.length; S++)
1875
+ if (Y)
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 (q += u, q < z)
1881
+ d += u, u && O.push(i), M = i;
1882
1882
  else {
1883
- if (Y = z, o === z)
1884
- d = e, i.push([d.lng, d.lat]);
1883
+ if (d = z, q === z)
1884
+ Y = i, f.push([Y.lng, Y.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 = q - z, B = this.calculateBearing(i, M);
1887
+ Y = this.calculateCoordinate(i, B, Z, b), f.push([Y.lng, Y.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 && !Y && (Y = i);
1893
1893
  }
1894
- })) : (A = p, d = { ...M }), d)
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) {
1894
+ })) : (A = p, Y = { ...M }), Y)
1895
+ if (O.push(Y), Y.distanceFromPrevious = Math.round(d * 1e4) / 1e4, Y.hourFromPrevious = Math.round(d / c * 1e4) / 1e4, ((R = A[0]) == null ? void 0 : R.length) > 1) {
1896
1896
  const T = { lng: A[0][1][0], lat: A[0][1][1] };
1897
- d.bearing = this.calculateBearing(d, T);
1897
+ Y.bearing = this.calculateBearing(Y, T);
1898
1898
  } else
1899
- d.bearing = 0;
1900
- return { coordinate: d, nextRoute: A, prevRoute: O };
1899
+ Y.bearing = 0;
1900
+ return { coordinate: Y, nextRoute: A, prevRoute: O };
1901
1901
  }
1902
1902
  /**
1903
1903
  * 返回最近点及其是否为垂足(最近点不是起点或终点)
@@ -1906,11 +1906,11 @@ 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);
1913
- return { lng: d, lat: R, inline: !(d === O && R === z.lat) && !(d === A && R === p.lat) };
1912
+ ]), q = t.nearestPointOnLine(W, c), d = t.getCoord(q), Y = a.roundPrecision(d[0], 6), R = a.roundPrecision(d[1], 6);
1913
+ return { lng: Y, lat: R, inline: !(Y === O && R === z.lat) && !(Y === A && R === p.lat) };
1914
1914
  }
1915
1915
  /**
1916
1916
  * 将route转coordinate
@@ -1928,8 +1928,8 @@ class r {
1928
1928
  else if (c.bearing === void 0 || c.bearing === null)
1929
1929
  c.bearing = this.calculateBearing(c, W, !0);
1930
1930
  else {
1931
- const o = this.calculateDistance(b, W, !0);
1932
- o && o >= z && (b.bearing = this.calculateBearing(b, W, !0), p.push(b), c = b);
1931
+ const q = this.calculateDistance(b, W, !0);
1932
+ q && q >= z && (b.bearing = this.calculateBearing(b, W, !0), p.push(b), c = b);
1933
1933
  }
1934
1934
  b = W;
1935
1935
  });
@@ -1957,9 +1957,9 @@ class r {
1957
1957
  for (let b = 1; b < z.length; b++) {
1958
1958
  const c = z[b - 1], O = z[b];
1959
1959
  if (O.gcToPrevious) {
1960
- const A = M.findIndex((o) => o.lng === c.lng && o.lat === c.lat), W = M.findIndex((o) => o.lng === O.lng && o.lat === O.lat);
1961
- for (let o = W - 1; o > A; o--)
1962
- M.splice(o, 1);
1960
+ const A = M.findIndex((q) => q.lng === c.lng && q.lat === c.lat), W = M.findIndex((q) => q.lng === O.lng && q.lat === O.lat);
1961
+ for (let q = W - 1; q > A; q--)
1962
+ M.splice(q, 1);
1963
1963
  }
1964
1964
  }
1965
1965
  let p = 0;
@@ -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
@@ -2022,14 +2022,14 @@ class r {
2022
2022
  const b = [];
2023
2023
  for (let c = 1; c < M.length; c++) {
2024
2024
  const O = M[c - 1], A = M[c], W = M[c + 1];
2025
- let o = !1, Y = !1;
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++);
2025
+ let q = !1, d = !1;
2026
+ if ((O.velocity || O.suspend || O.important || O.pilot || c === 1) && (q = !0, b.push(O)), A.gcToPrevious && (q || (q = !0, b.push(O)), d = !0, b.push(A), c++), W) {
2027
+ const Y = r.calculateDistance(O, A, !0), R = r.calculateDistance(A, W, !0), T = r.calculateDistance(O, W, !0), e = (Math.pow(Y, 2) + Math.pow(R, 2) - Math.pow(T, 2)) / (2 * Y * R);
2028
+ Math.round(Math.acos(e) * 180 / Math.PI) < p && T > z && !d && (b.push(A), c++);
2029
2029
  }
2030
2030
  if (c >= M.length - 1) {
2031
- const d = M.at(-1);
2032
- d && b.push(d);
2031
+ const Y = M.at(-1);
2032
+ Y && b.push(Y);
2033
2033
  }
2034
2034
  }
2035
2035
  return b;
@@ -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,15 +2054,15 @@ 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);
2058
- let b = z.find((o) => o.positionTime === p.unix());
2057
+ const p = U.unix(M);
2058
+ let b = z.find((q) => q.positionTime === p.unix());
2059
2059
  if (!b) {
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);
2061
- if (o && Y) {
2062
- const d = r.calculateBearing(o, Y, !0), R = r.calculateDistance(o, Y), T = (p.unix() - o.positionTime) / (Y.positionTime - o.positionTime);
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;
2060
+ const q = (O = (c = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) < p.unix())) == null ? void 0 : c.sort((Y, R) => (Y.positionTime || 0) - (R.positionTime || 0))) == null ? void 0 : O.at(-1), d = (W = (A = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) > p.unix())) == null ? void 0 : A.sort((Y, R) => (Y.positionTime || 0) - (R.positionTime || 0))) == null ? void 0 : W.at(0);
2061
+ if (q && d) {
2062
+ const Y = r.calculateBearing(q, d, !0), R = r.calculateDistance(q, d), T = (p.unix() - q.positionTime) / (d.positionTime - q.positionTime);
2063
+ b = r.calculateCoordinate(q, Y, R * T), b.positionTime = p.unix(), b.utc = p.utc().format(), b.cog = Y, b.sog = Math.round(R / ((d.positionTime - q.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 = q || d, b && (b.utc = U.unix(b == null ? void 0 : b.positionTime).utc().format());
2066
2066
  }
2067
2067
  return b;
2068
2068
  }
@@ -2072,11 +2072,11 @@ class r {
2072
2072
  * @param positions
2073
2073
  */
2074
2074
  static deadReckoningTime(M, z) {
2075
- z = JSON.parse(JSON.stringify(z)), z.sort((o, Y) => (o.positionTime || 0) - (Y.positionTime || 0));
2075
+ z = JSON.parse(JSON.stringify(z)), z.sort((q, d) => (q.positionTime || 0) - (d.positionTime || 0));
2076
2076
  let p = Number.MAX_SAFE_INTEGER, b = Number.MAX_SAFE_INTEGER;
2077
- for (let o = 0; o < z.length - 1; o++) {
2078
- const Y = z[o], d = z[o + 1], R = r.calculatePointToLineDistance(M, Y, d);
2079
- R < p && (p = R, b = o);
2077
+ for (let q = 0; q < z.length - 1; q++) {
2078
+ const d = z[q], Y = z[q + 1], R = r.calculatePointToLineDistance(M, d, Y);
2079
+ R < p && (p = R, b = q);
2080
2080
  }
2081
2081
  const c = z[b], O = z[b + 1], A = r.calculateDistance(c, M), W = r.calculateDistance(O, M);
2082
2082
  if (A === 0)
@@ -2084,10 +2084,10 @@ class r {
2084
2084
  else if (W === 0)
2085
2085
  M = O;
2086
2086
  else {
2087
- const o = c.positionTime || 0, Y = O.positionTime || 0, d = r.calculateDistance(c, O);
2088
- M.positionTime = Math.round(o + (Y - o) * (A / d));
2087
+ const q = c.positionTime || 0, d = O.positionTime || 0, Y = r.calculateDistance(c, O);
2088
+ M.positionTime = Math.round(q + (d - q) * (A / Y));
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
  * 翻转轨迹
@@ -2132,46 +2132,51 @@ class r {
2132
2132
  * @param waypoints 途径点
2133
2133
  * @see https://cirm.org/rtz-xml-schemas
2134
2134
  */
2135
- static waypoints2RTZ10(M, z) {
2136
- const b = [];
2137
- return b.push('<?xml version="1.0" encoding="UTF-8"?>'), b.push('<route xmlns="http://www.cirm.org/RTZ/1/0" version="1.0">'), b.push(` <routeInfo routeName="${r.xmlEscape(M)}"></routeInfo>`), b.push(...r.toRTZWaypoints(z, 6)), b.push("</route>"), b.join(`
2135
+ static waypoints2RTZ10(M, z, p = !0) {
2136
+ const c = [];
2137
+ return c.push('<?xml version="1.0" encoding="UTF-8"?>'), c.push('<route xmlns="http://www.cirm.org/RTZ/1/0" version="1.0">'), c.push(` <routeInfo routeName="${r.xmlEscape(M)}"></routeInfo>`), c.push(...r.toRTZWaypoints(z, 6, p)), c.push("</route>"), c.join(`
2138
2138
  `);
2139
2139
  }
2140
- static toRTZWaypoints(M, z = 6) {
2141
- const p = [];
2142
- p.push(" <waypoints>");
2143
- for (let b = 0; b < M.length; b++) {
2144
- const c = M[b], O = b + 1, A = (c.lat ?? "").toFixed ? c.lat.toFixed(z).padEnd(z + 2, "0") : c.lat, W = (c.lng ?? "").toFixed ? c.lng.toFixed(z).padEnd(z + 2, "0") : c.lng, o = [`id="${O}"`, 'revision="0"'];
2145
- if (c.name && o.push(`name="${r.xmlEscape(c.name)}"`), p.push(` <waypoint ${o.join(" ")}>`), p.push(` <position lat="${r.xmlEscape(A)}" lon="${r.xmlEscape(W)}" />`), b > 0) {
2146
- const d = c.gcToPrevious ? "Orthodrome" : "Loxodrome";
2147
- p.push(` <leg geometryType="${d}" />`);
2140
+ static toRTZWaypoints(M, z = 6, p = !0) {
2141
+ const b = [];
2142
+ b.push(" <waypoints>");
2143
+ for (let c = 0; c < M.length; c++) {
2144
+ const O = M[c], A = c + 1, W = (O.lat ?? "").toFixed ? O.lat.toFixed(z).padEnd(z + 2, "0") : O.lat, q = (O.lng ?? "").toFixed ? O.lng.toFixed(z).padEnd(z + 2, "0") : O.lng, d = [`id="${A}"`, 'revision="0"'];
2145
+ if (O.name && d.push(`name="${r.xmlEscape(O.name)}"`), b.push(` <waypoint ${d.join(" ")}>`), b.push(` <position lat="${r.xmlEscape(W)}" lon="${r.xmlEscape(q)}" />`), c > 0) {
2146
+ const Y = O.gcToPrevious ? "Orthodrome" : "Loxodrome";
2147
+ b.push(` <leg geometryType="${Y}" />`);
2148
2148
  }
2149
- const Y = [];
2150
- if (c.description && Y.push(` <description>${r.xmlEscape(c.description)}</description>`), c.utc)
2151
- Y.push(` <time>${r.xmlEscape(c.utc)}</time>`);
2152
- else if (c.positionTime)
2153
- try {
2154
- Y.push(` <time>${r.xmlEscape(B.unix(c.positionTime).utc().format())}</time>`);
2155
- } catch {
2156
- }
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>");
2149
+ if (p) {
2150
+ const Y = [];
2151
+ if (O.description && Y.push(` <description>${r.xmlEscape(O.description)}</description>`), O.utc)
2152
+ Y.push(` <time>${r.xmlEscape(O.utc)}</time>`);
2153
+ else if (O.positionTime)
2154
+ try {
2155
+ Y.push(` <time>${r.xmlEscape(U.unix(O.positionTime).utc().format())}</time>`);
2156
+ } catch {
2157
+ }
2158
+ O.cog !== void 0 && Y.push(` <cog>${r.xmlEscape(O.cog)}</cog>`), O.sog !== void 0 && Y.push(` <sog>${r.xmlEscape(O.sog)}</sog>`), Y.length && (b.push(" <extensions>"), b.push(...Y), b.push(" </extensions>"));
2159
+ }
2160
+ b.push(" </waypoint>");
2158
2161
  }
2159
- return p.push(" </waypoints>"), p;
2162
+ return b.push(" </waypoints>"), b;
2160
2163
  }
2161
2164
  /**
2162
2165
  * 路径转通用CSV (纯十进制度数、无厂商头、RFC 4180标准)
2163
2166
  * 大部分海图设备/导航软件均可导入此格式
2167
+ * @param name 兼容旧版本
2164
2168
  * @param waypoints 途径点
2165
2169
  * @param options.precision 经纬度小数位数,默认6
2166
2170
  */
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]");
2171
+ static waypoints2CSV(M, z, p) {
2172
+ H.debug("keep name for waypoints2CSV for legacy compatibility only", M);
2173
+ 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), q = z.some((i) => i.arrRad != null), d = z.some((i) => i.speed != null), Y = 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"];
2174
+ c && e.push("Name"), O && e.push("Description"), Y && e.push("Leg"), R && e.push("Bearing[deg]"), T && e.push("Distance[NM]"), d && e.push("Speed[kn]"), A && e.push("PORT XTD[NM]"), W && e.push("STBD XTD[NM]"), q && e.push("Arr.Rad[NM]");
2170
2175
  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(","));
2176
+ f.push(e.map((i) => r.csvEscapeField(i)).join(","));
2177
+ for (let i = 0; i < z.length; i++) {
2178
+ const S = z[i], u = [];
2179
+ 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 ?? ""), Y && 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) : ""), d && 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) : ""), q && u.push(S.arrRad != null ? String(S.arrRad) : ""), f.push(u.map((Z) => r.csvEscapeField(Z)).join(","));
2175
2180
  }
2176
2181
  return f.join(`
2177
2182
  `);
@@ -2213,8 +2218,8 @@ class r {
2213
2218
  static waypoints2NMEA(M) {
2214
2219
  const z = [];
2215
2220
  for (let p = 0; p < M.length; p++) {
2216
- const b = M[p], c = r.decimalToNmeaDm(b.lat, !0), O = r.decimalToNmeaDm(b.lng, !1), A = b.name ? String(b.name).slice(0, 6) : `WPT${(p + 1).toString().padStart(3, "0")}`, W = `GPWPL,${c.dm},${c.dir},${O.dm},${O.dir},${A}`, o = r.nmeaChecksum(W);
2217
- z.push(`$${W}*${o}`);
2221
+ const b = M[p], c = r.decimalToNmeaDm(b.lat, !0), O = r.decimalToNmeaDm(b.lng, !1), A = b.name ? String(b.name).slice(0, 6) : `WPT${(p + 1).toString().padStart(3, "0")}`, W = `GPWPL,${c.dm},${c.dir},${O.dm},${O.dir},${A}`, q = r.nmeaChecksum(W);
2222
+ z.push(`$${W}*${q}`);
2218
2223
  }
2219
2224
  return z.join(`\r
2220
2225
  `);
@@ -2233,19 +2238,19 @@ class r {
2233
2238
  */
2234
2239
  static coordinatesSummary(M, z = 3) {
2235
2240
  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),
2241
+ 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), q = this.calculateRouteDistance(W), Y = t0.inspectStoppages(M, z).reduce(
2242
+ (T, e) => (T.duration += e.duration, T.distance += e.distance, T),
2238
2243
  { hours: 0, distance: 0, spd: 0, duration: 0 }
2239
2244
  );
2240
- 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;
2241
- const R = A ? Math.round((o - d.distance) / (A - d.hours) * 100) / 100 : 0;
2245
+ Y.hours = Math.round(Y.duration / 3600 * 100) / 100, Y.distance = Math.round(Y.distance * 100) / 100, Y.spd = Y.hours ? Math.round(Y.distance / Y.hours * 100) / 100 : 0;
2246
+ const R = A ? Math.round((q - Y.distance) / (A - Y.hours) * 100) / 100 : 0;
2242
2247
  return {
2243
2248
  begin: c.utc().format(),
2244
2249
  end: O.utc().format(),
2245
- distance: Math.round((o - d.distance) * 100) / 100,
2246
- hours: Math.round((A - d.hours) * 100) / 100,
2250
+ distance: Math.round((q - Y.distance) * 100) / 100,
2251
+ hours: Math.round((A - Y.hours) * 100) / 100,
2247
2252
  avgSpeed: R,
2248
- stoppage: d
2253
+ stoppage: Y
2249
2254
  };
2250
2255
  }
2251
2256
  return {
@@ -2266,24 +2271,24 @@ class r {
2266
2271
  * }
2267
2272
  */
2268
2273
  static pickUTCSampleFromSpeed(M, z) {
2269
- var Y, d, R;
2270
- if (!((d = (Y = z == null ? void 0 : z.sample) == null ? void 0 : Y.hours) != null && d.length))
2274
+ var d, Y, R;
2275
+ if (!((Y = (d = z == null ? void 0 : z.sample) == null ? void 0 : d.hours) != null && Y.length))
2271
2276
  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;
2277
+ const p = z.sample.hours.at(0), b = U.utc(M), c = U.utc(z.eta), O = b.isAfter(c) ? c : b;
2273
2278
  let A = z.sample.all.find((T) => T.eta === O.format());
2274
2279
  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;
2280
+ const T = z.sample.all.filter((G) => U.utc(G.eta).isBefore(O)).at(-1), e = this.calculateSubRoute(T, z.route);
2281
+ A = (R = this.calculateNextCoordinateAlongRoute(T, T.speed * O.diff(U(T.etd), "hours", !0), e)) == null ? void 0 : R.coordinate;
2282
+ 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
2283
  A = {
2279
2284
  ...A,
2280
- cFactor: i,
2281
- cog: e,
2285
+ cFactor: f,
2286
+ cog: i,
2282
2287
  speed: T.speed,
2283
- wxFactor: t,
2284
- distanceFromStart: u,
2288
+ wxFactor: S,
2289
+ distanceFromStart: B,
2285
2290
  distanceFromPrevious: Z,
2286
- meteo: l,
2291
+ meteo: u,
2287
2292
  eta: O.format(),
2288
2293
  etd: O.format()
2289
2294
  };
@@ -2307,14 +2312,14 @@ class r {
2307
2312
  */
2308
2313
  static pickUTCSampleFromRoute(M, z, p) {
2309
2314
  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;
2311
- o.speed = z.speed;
2312
- 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;
2314
- const d = this.calculateRangeWaypoints(z, o, p);
2315
+ const b = this.calculateSubRoute(z, p), c = this.calculateRouteDistance(b), O = c / z.speed, A = U.utc(M), W = U(z.etd), q = (T = this.calculateNextCoordinateAlongRoute(z, z.speed * A.diff(U(z.etd), "hours", !0), b)) == null ? void 0 : T.coordinate;
2316
+ q.speed = z.speed;
2317
+ const d = W.clone().add(q.hourFromPrevious, "hour");
2318
+ q.eta = Math.abs(d.diff(A, "second")) < 2 ? A.format() : d.format(), q.etd = q.eta, q.distanceFromStart = Math.round(q.distanceFromPrevious * 100) / 100, q.distanceToGo = Math.round((c - q.distanceFromStart) * 100) / 100, q.timeToGo = Math.round(W.clone().add(O, "hour").diff(U(q.etd), "hour") * 100) / 100;
2319
+ const Y = this.calculateRangeWaypoints(z, q, p);
2315
2320
  return {
2316
- routes: this.generateRouteAccordingToWaypoints(d),
2317
- hour: o
2321
+ routes: this.generateRouteAccordingToWaypoints(Y),
2322
+ hour: q
2318
2323
  };
2319
2324
  }
2320
2325
  /**
@@ -2323,7 +2328,7 @@ class r {
2323
2328
  * @param degree 要素角度,如 swell.degree
2324
2329
  */
2325
2330
  static includedAngle(M, z) {
2326
- Q == null || Q.debug("calculate bearing via: %j", { bearing: M, degree: z });
2331
+ H == null || H.debug("calculate bearing via: %j", { bearing: M, degree: z });
2327
2332
  let p = Math.abs(M % 360 - (z % 360 || 0));
2328
2333
  return p = p > 180 ? 360 - p : p, p;
2329
2334
  }
@@ -2341,80 +2346,80 @@ class V0 {
2341
2346
  */
2342
2347
  static convert2Geojson(M) {
2343
2348
  var p, b, c;
2344
- const z = S.featureCollection([]);
2349
+ const z = t.featureCollection([]);
2345
2350
  for (const O of M) {
2346
2351
  const A = (p = O.history) == null ? void 0 : p[0];
2347
2352
  if (O.forecasts) {
2348
2353
  A && A.wind && (A.wind.kts = A.kts);
2349
2354
  for (const W of O.forecasts) {
2350
- 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], {
2355
+ let q;
2356
+ const d = [], Y = [], R = U(W.date).utc(), T = `${O.name}-${W.model}`;
2357
+ for (const f in W == null ? void 0 : W.hours) {
2358
+ const i = W.hours[f];
2359
+ q = q || i;
2360
+ const S = R.clone().add(Number(f), "hour"), u = t.point([i.lng, i.lat], {
2356
2361
  model: W.model,
2357
2362
  name: O.name,
2358
2363
  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,
2364
+ date: S.format(),
2365
+ hour: Number(f),
2366
+ format: S.format("MMM-DD/HHmm[Z]"),
2367
+ pressure: i.pressure > 1e4 ? a.roundPrecision(i.pressure / 100, 0) : a.roundPrecision(i.pressure, 0),
2368
+ gusts: i.gusts,
2369
+ wind: i.wind || {},
2370
+ movement: i.movement,
2366
2371
  category: T,
2367
2372
  type: "forecast"
2368
2373
  });
2369
- d.push(l), Y.push(l.geometry.coordinates);
2374
+ Y.push(u), d.push(u.geometry.coordinates);
2370
2375
  }
2371
- const f = {
2376
+ const e = {
2372
2377
  kts: void 0,
2373
2378
  deg: void 0
2374
2379
  };
2375
2380
  if (A) {
2376
- const i = B(A.updated).utc();
2377
- 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);
2381
+ const f = U(A.updated).utc();
2382
+ if (q) {
2383
+ const S = r.calculateDistance(A, q), u = U(q.utc || q.updated).diff(f, "h", !0);
2384
+ e.kts = Math.round(S / u * 100) / 100, e.deg = r.calculateBearing(A, q, !0, 0);
2380
2385
  }
2381
- const e = S.point([A.lng, A.lat], {
2386
+ const i = t.point([A.lng, A.lat], {
2382
2387
  model: W.model,
2383
2388
  name: O.name,
2384
2389
  nameCn: O.nameCn,
2385
- date: i.format(),
2390
+ date: f.format(),
2386
2391
  hour: 0,
2387
- format: i.format("MMM-DD/HHmm[Z]"),
2392
+ format: f.format("MMM-DD/HHmm[Z]"),
2388
2393
  pressure: A.pressure > 1e4 ? a.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : a.roundPrecision(A.pressure, 0),
2389
2394
  wind: A.wind,
2390
- movement: f,
2395
+ movement: e,
2391
2396
  category: T,
2392
2397
  type: "forecast",
2393
2398
  important: !0
2394
2399
  // 第一个预报点为重要点
2395
2400
  });
2396
- d.unshift(e), Y.unshift(e.geometry.coordinates);
2401
+ Y.unshift(i), d.unshift(i.geometry.coordinates);
2397
2402
  }
2398
- if (z.features.push(...d), (Y == null ? void 0 : Y.length) > 1) {
2399
- const i = S.lineString(a.convertToMonotonicLng2(Y), {
2403
+ if (z.features.push(...Y), (d == null ? void 0 : d.length) > 1) {
2404
+ const f = t.lineString(a.convertToMonotonicLng2(d), {
2400
2405
  date: (A == null ? void 0 : A.updated) || (R == null ? void 0 : R.format()),
2401
2406
  id: O.id || O.name,
2402
2407
  model: W.model,
2403
2408
  name: O.name,
2404
2409
  category: T,
2405
2410
  type: "forecast",
2406
- movement: f
2411
+ movement: e
2407
2412
  });
2408
- z.features.push(i);
2413
+ z.features.push(f);
2409
2414
  }
2410
2415
  }
2411
2416
  }
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;
2417
+ if (z.features.sort((W, q) => W.properties.type === "forecast" && q.properties.type === "forecast" && W.geometry.type === "Point" && q.geometry.type === "Point" ? U(W.properties.date).valueOf() - U(q.properties.date).valueOf() : 0), (b = O.history) != null && b.length) {
2418
+ const W = [], q = U(A == null ? void 0 : A.updated).utc(), d = U((c = O.history) == null ? void 0 : c.at(-1).updated).utc(), Y = q.diff(d, "h") % 24 > 2 ? 24 : 12;
2414
2419
  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], {
2420
+ const T = U(R.updated).utc(), e = T.isSameOrBefore(q) || T.isSame(d);
2421
+ e && q.add(-Y, "h");
2422
+ const f = t.point([R.lng, R.lat], {
2418
2423
  name: O.name,
2419
2424
  nameCn: O.nameCn,
2420
2425
  date: T.format(),
@@ -2426,12 +2431,12 @@ class V0 {
2426
2431
  category: `${O.name}-history`,
2427
2432
  wind: R.wind,
2428
2433
  movement: R.movement,
2429
- important: f
2434
+ important: e
2430
2435
  });
2431
- z.features.push(i), W.push(i.geometry.coordinates);
2436
+ z.features.push(f), W.push(f.geometry.coordinates);
2432
2437
  }
2433
2438
  if (W.length === 1 && W.push(W[0]), W.length > 1) {
2434
- const R = S.lineString(a.convertToMonotonicLng2(W), {
2439
+ const R = t.lineString(a.convertToMonotonicLng2(W), {
2435
2440
  name: O.name,
2436
2441
  type: "history",
2437
2442
  updated: A == null ? void 0 : A.updated,
@@ -2452,34 +2457,34 @@ class V0 {
2452
2457
  */
2453
2458
  static interpolate(M, z = 3) {
2454
2459
  var c, O, A, W;
2455
- 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
- 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(
2460
- (Z) => Z.geometry.type === "Point" && Z.properties.type === "forecast" && Z.properties.category === `${Y}-${d}`
2460
+ const p = (c = M == null ? void 0 : M.data) == null ? void 0 : c.features.filter((q) => q.geometry.type === "LineString" && q.properties.type === "forecast"), b = [];
2461
+ for (const q of p) {
2462
+ const d = q.properties.name, Y = q.properties.model, R = q.properties.showCircle, T = q.properties.disabled, e = U(q.properties.date).utc();
2463
+ let f = z * 60;
2464
+ const i = (O = M == null ? void 0 : M.data) == null ? void 0 : O.features.filter(
2465
+ (Z) => Z.geometry.type === "Point" && Z.properties.type === "forecast" && Z.properties.category === `${d}-${Y}`
2461
2466
  );
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], {
2466
- name: Y,
2467
- model: d,
2467
+ let S, u = e.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2468
+ for (; S = this.pickIndex(i, u), S <= i.length - 1; ) {
2469
+ if (S > 0) {
2470
+ 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], {
2471
+ name: d,
2472
+ model: Y,
2468
2473
  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),
2474
+ date: u.format(),
2475
+ format: u.format("MMM-DD/HHmm[Z]"),
2476
+ gusts: this.computeNumber(B == null ? void 0 : B.properties.gusts, Z.properties.gusts, G),
2477
+ hour: this.computeNumber(B == null ? void 0 : B.properties.hour, Z.properties.hour, G),
2478
+ movement: this.computeNumber(B == null ? void 0 : B.properties.movement, Z.properties.movement, G),
2479
+ pressure: this.computeNumber(B == null ? void 0 : B.properties.pressure, Z.properties.pressure, G),
2480
+ wind: this.computeNumber(B == null ? void 0 : B.properties.wind, Z.properties.wind, G),
2476
2481
  type: "forecast",
2477
2482
  disabled: T,
2478
2483
  showCircle: R
2479
2484
  });
2480
2485
  b.push($);
2481
2486
  }
2482
- i += z * 60, l = f.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2487
+ f += z * 60, u = e.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2483
2488
  }
2484
2489
  }
2485
2490
  return b;
@@ -2509,26 +2514,26 @@ class V0 {
2509
2514
  const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, b);
2510
2515
  if (c && O) {
2511
2516
  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, {
2517
+ const e = r.calculateDistance(M, c), f = r.calculateDistance(M, O);
2518
+ if (e > 2 * p && f > 2 * p)
2519
+ 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
2520
  from: M,
2516
2521
  t1: c,
2517
2522
  t2: O,
2518
2523
  hr: A
2519
2524
  }), {};
2520
2525
  }
2521
- const o = r.calculateBearing(M, c), Y = r.calculateBearing(c, O), d = Math.abs(o - Y);
2526
+ const q = r.calculateBearing(M, c), d = r.calculateBearing(c, O), Y = Math.abs(q - d);
2522
2527
  let R = 0;
2523
- d < 180 ? R = d + 90 : d >= 180 && (R = d - 90);
2528
+ Y < 180 ? R = Y + 90 : Y >= 180 && (R = Y - 90);
2524
2529
  const T = r.calculateCoordinate(c, R, p);
2525
2530
  return I == null || I.info("[%s] the right tangent position: %j", b.requestId, {
2526
2531
  from: M,
2527
2532
  t1: c,
2528
2533
  t2: O,
2529
2534
  radius: p,
2530
- bearing1: o,
2531
- bearing2: Y,
2535
+ bearing1: q,
2536
+ bearing2: d,
2532
2537
  right: T
2533
2538
  }), { at: T, t1: c, t2: O, hr: Number(A), hours: W };
2534
2539
  }
@@ -2548,17 +2553,17 @@ class V0 {
2548
2553
  const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, b);
2549
2554
  if (c && O) {
2550
2555
  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, {
2556
+ const T = r.calculateDistance(M, c), e = r.calculateDistance(M, O);
2557
+ if (T > 2 * p && e > 2 * p)
2558
+ 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
2559
  from: M,
2555
2560
  t1: c,
2556
2561
  t2: O,
2557
2562
  hr: A
2558
2563
  }), {};
2559
2564
  }
2560
- const o = r.calculateBearing(M, c), Y = r.calculateBearing(c, O), d = r.calculateDistance(M, c);
2561
- return { at: r.calculateCoordinate(c, o - Y + 180, p < d ? p : d), t1: c, t2: O, hr: Number(A), hours: W };
2565
+ const q = r.calculateBearing(M, c), d = r.calculateBearing(c, O), Y = r.calculateDistance(M, c);
2566
+ return { at: r.calculateCoordinate(c, q - d + 180, p < Y ? p : Y), t1: c, t2: O, hr: Number(A), hours: W };
2562
2567
  } else
2563
2568
  return I == null || I.info("[%s] no need drift: %j", b.requestId, { from: M, t1: c, t2: O, hr: A }), {};
2564
2569
  }
@@ -2571,26 +2576,26 @@ class V0 {
2571
2576
  * @private
2572
2577
  */
2573
2578
  static tropicalCenterTwin(M, z = 24, p = {}) {
2574
- var Y, d, R, T, f;
2579
+ var d, Y, R, T, e;
2575
2580
  let b = {};
2576
- (Y = M.forecasts) == null || Y.forEach((i) => {
2577
- b = { ...i.hours, ...b };
2581
+ (d = M.forecasts) == null || d.forEach((f) => {
2582
+ b = { ...f.hours, ...b };
2578
2583
  });
2579
- 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]]);
2584
+ const c = ((Y = M == null ? void 0 : M.history) == null ? void 0 : Y[0]) || (b == null ? void 0 : b[(R = Object.keys(b)) == null ? void 0 : R[0]]);
2580
2585
  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));
2586
+ let O = (T = Object.keys(b || {}).filter((f) => Number(f) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2587
+ O || (O = (e = Object.keys(b || {}).filter((f) => Number(f) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : e.at(-1));
2583
2588
  const A = b == null ? void 0 : b[O || -1];
2584
2589
  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];
2588
- return { t1: c, t2: A, hr: Number(O), hours: o };
2590
+ const W = Object.keys(b || {}).filter((f) => Number(f) <= Number(O)), q = { 0: c };
2591
+ for (const f of W)
2592
+ q[f] = b[f];
2593
+ return { t1: c, t2: A, hr: Number(O), hours: q };
2589
2594
  }
2590
2595
  static pickIndex(M, z) {
2591
2596
  let p = 0;
2592
2597
  for (const b of M) {
2593
- if (B(b.properties.date).isAfter(z))
2598
+ if (U(b.properties.date).isAfter(z))
2594
2599
  return p === 0 ? -1 : p;
2595
2600
  p++;
2596
2601
  }