@idm-plugin/geo 1.7.8 → 1.8.0

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
@@ -16,39 +16,39 @@ var j = { exports: {} };
16
16
  E.exports ? E.exports = z(m) : z(M.moment);
17
17
  })(a0, function(M) {
18
18
  M.version === void 0 && M.default && (M = M.default);
19
- var z = "0.5.48", p = {}, O = {}, A = {}, b = {}, c = {}, o;
19
+ var z = "0.5.48", p = {}, O = {}, A = {}, b = {}, W = {}, o;
20
20
  (!M || typeof M.version != "string") && D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
21
21
  var q = M.version.split("."), Y = +q[0], d = +q[1];
22
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 L(W) {
24
- return W > 96 ? W - 87 : W > 64 ? W - 29 : W - 48;
23
+ function L(c) {
24
+ return c > 96 ? c - 87 : c > 64 ? c - 29 : c - 48;
25
25
  }
26
- function T(W) {
27
- var a = 0, n = W.split("."), R = n[0], i = n[1] || "", S = 1, V, B = 0, t = 1;
28
- for (W.charCodeAt(0) === 45 && (a = 1, t = -1), a; a < R.length; a++)
29
- V = L(R.charCodeAt(a)), B = 60 * B + V;
26
+ function T(c) {
27
+ var a = 0, n = c.split("."), R = n[0], i = n[1] || "", r = 1, V, U = 0, t = 1;
28
+ for (c.charCodeAt(0) === 45 && (a = 1, t = -1), a; a < R.length; a++)
29
+ V = L(R.charCodeAt(a)), U = 60 * U + V;
30
30
  for (a = 0; a < i.length; a++)
31
- S = S / 60, V = L(i.charCodeAt(a)), B += V * S;
32
- return B * t;
31
+ r = r / 60, V = L(i.charCodeAt(a)), U += V * r;
32
+ return U * t;
33
33
  }
34
- function U(W) {
35
- for (var a = 0; a < W.length; a++)
36
- W[a] = T(W[a]);
34
+ function f(c) {
35
+ for (var a = 0; a < c.length; a++)
36
+ c[a] = T(c[a]);
37
37
  }
38
- function r(W, a) {
38
+ function S(c, a) {
39
39
  for (var n = 0; n < a; n++)
40
- W[n] = Math.round((W[n - 1] || 0) + W[n] * 6e4);
41
- W[a - 1] = 1 / 0;
40
+ c[n] = Math.round((c[n - 1] || 0) + c[n] * 6e4);
41
+ c[a - 1] = 1 / 0;
42
42
  }
43
- function s(W, a) {
43
+ function s(c, a) {
44
44
  var n = [], R;
45
45
  for (R = 0; R < a.length; R++)
46
- n[R] = W[a[R]];
46
+ n[R] = c[a[R]];
47
47
  return n;
48
48
  }
49
- function P(W) {
50
- var a = W.split("|"), n = a[2].split(" "), R = a[3].split(""), i = a[4].split(" ");
51
- return U(n), U(R), U(i), r(i, R.length), {
49
+ function P(c) {
50
+ var a = c.split("|"), n = a[2].split(" "), R = a[3].split(""), i = a[4].split(" ");
51
+ return f(n), f(R), f(i), S(i, R.length), {
52
52
  name: a[0],
53
53
  abbrs: s(a[1].split(" "), R),
54
54
  offsets: s(n, R),
@@ -56,165 +56,165 @@ var j = { exports: {} };
56
56
  population: a[5] | 0
57
57
  };
58
58
  }
59
- function I(W) {
60
- W && this._set(P(W));
59
+ function I(c) {
60
+ c && this._set(P(c));
61
61
  }
62
- function l(W, a) {
62
+ function l(c, a) {
63
63
  var n = a.length;
64
- if (W < a[0])
64
+ if (c < a[0])
65
65
  return 0;
66
- if (n > 1 && a[n - 1] === 1 / 0 && W >= a[n - 2])
66
+ if (n > 1 && a[n - 1] === 1 / 0 && c >= a[n - 2])
67
67
  return n - 1;
68
- if (W >= a[n - 1])
68
+ if (c >= a[n - 1])
69
69
  return -1;
70
- for (var R, i = 0, S = n - 1; S - i > 1; )
71
- R = Math.floor((i + S) / 2), a[R] <= W ? i = R : S = R;
72
- return S;
70
+ for (var R, i = 0, r = n - 1; r - i > 1; )
71
+ R = Math.floor((i + r) / 2), a[R] <= c ? i = R : r = R;
72
+ return r;
73
73
  }
74
74
  I.prototype = {
75
- _set: function(W) {
76
- this.name = W.name, this.abbrs = W.abbrs, this.untils = W.untils, this.offsets = W.offsets, this.population = W.population;
75
+ _set: function(c) {
76
+ this.name = c.name, this.abbrs = c.abbrs, this.untils = c.untils, this.offsets = c.offsets, this.population = c.population;
77
77
  },
78
- _index: function(W) {
79
- var a = +W, n = this.untils, R;
78
+ _index: function(c) {
79
+ var a = +c, n = this.untils, R;
80
80
  if (R = l(a, n), R >= 0)
81
81
  return R;
82
82
  },
83
83
  countries: function() {
84
- var W = this.name;
84
+ var c = this.name;
85
85
  return Object.keys(A).filter(function(a) {
86
- return A[a].zones.indexOf(W) !== -1;
86
+ return A[a].zones.indexOf(c) !== -1;
87
87
  });
88
88
  },
89
- parse: function(W) {
90
- var a = +W, n = this.offsets, R = this.untils, i = R.length - 1, S, V, B, t;
89
+ parse: function(c) {
90
+ var a = +c, n = this.offsets, R = this.untils, i = R.length - 1, r, V, U, t;
91
91
  for (t = 0; t < i; t++)
92
- if (S = n[t], V = n[t + 1], B = n[t && t - 1], S < V && u.moveAmbiguousForward ? S = V : S > B && u.moveInvalidForward && (S = B), a < R[t] - S * 6e4)
92
+ if (r = n[t], V = n[t + 1], U = n[t && t - 1], r < V && u.moveAmbiguousForward ? r = V : r > U && u.moveInvalidForward && (r = U), a < R[t] - r * 6e4)
93
93
  return n[t];
94
94
  return n[i];
95
95
  },
96
- abbr: function(W) {
97
- return this.abbrs[this._index(W)];
96
+ abbr: function(c) {
97
+ return this.abbrs[this._index(c)];
98
98
  },
99
- offset: function(W) {
100
- return D("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(W)];
99
+ offset: function(c) {
100
+ return D("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(c)];
101
101
  },
102
- utcOffset: function(W) {
103
- return this.offsets[this._index(W)];
102
+ utcOffset: function(c) {
103
+ return this.offsets[this._index(c)];
104
104
  }
105
105
  };
106
- function f(W, a) {
107
- this.name = W, this.zones = a;
106
+ function B(c, a) {
107
+ this.name = c, this.zones = a;
108
108
  }
109
- function G(W) {
110
- var a = W.toTimeString(), n = a.match(/\([a-z ]+\)/i);
111
- n && n[0] ? (n = n[0].match(/[A-Z]/g), n = n ? n.join("") : void 0) : (n = a.match(/[A-Z]{3,5}/g), n = n ? n[0] : void 0), n === "GMT" && (n = void 0), this.at = +W, this.abbr = n, this.offset = W.getTimezoneOffset();
109
+ function G(c) {
110
+ var a = c.toTimeString(), n = a.match(/\([a-z ]+\)/i);
111
+ n && n[0] ? (n = n[0].match(/[A-Z]/g), n = n ? n.join("") : void 0) : (n = a.match(/[A-Z]{3,5}/g), n = n ? n[0] : void 0), n === "GMT" && (n = void 0), this.at = +c, this.abbr = n, this.offset = c.getTimezoneOffset();
112
112
  }
113
- function H(W) {
114
- this.zone = W, this.offsetScore = 0, this.abbrScore = 0;
113
+ function H(c) {
114
+ this.zone = c, this.offsetScore = 0, this.abbrScore = 0;
115
115
  }
116
- H.prototype.scoreOffsetAt = function(W) {
117
- this.offsetScore += Math.abs(this.zone.utcOffset(W.at) - W.offset), this.zone.abbr(W.at).replace(/[^A-Z]/g, "") !== W.abbr && this.abbrScore++;
116
+ H.prototype.scoreOffsetAt = function(c) {
117
+ this.offsetScore += Math.abs(this.zone.utcOffset(c.at) - c.offset), this.zone.abbr(c.at).replace(/[^A-Z]/g, "") !== c.abbr && this.abbrScore++;
118
118
  };
119
- function Q(W, a) {
120
- for (var n, R; R = ((a.at - W.at) / 12e4 | 0) * 6e4; )
121
- n = new G(new Date(W.at + R)), n.offset === W.offset ? W = n : a = n;
122
- return W;
119
+ function Q(c, a) {
120
+ for (var n, R; R = ((a.at - c.at) / 12e4 | 0) * 6e4; )
121
+ n = new G(new Date(c.at + R)), n.offset === c.offset ? c = n : a = n;
122
+ return c;
123
123
  }
124
124
  function F() {
125
- var W = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new G(new Date(W, 0, 1)), n = a.offset, R = [a], i, S, V, B;
126
- for (B = 1; B < 48; B++)
127
- V = new Date(W, B, 1).getTimezoneOffset(), V !== n && (S = new G(new Date(W, B, 1)), i = Q(a, S), R.push(i), R.push(new G(new Date(i.at + 6e4))), a = S, n = V);
128
- for (B = 0; B < 4; B++)
129
- R.push(new G(new Date(W + B, 0, 1))), R.push(new G(new Date(W + B, 6, 1)));
125
+ var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new G(new Date(c, 0, 1)), n = a.offset, R = [a], i, r, V, U;
126
+ for (U = 1; U < 48; U++)
127
+ V = new Date(c, U, 1).getTimezoneOffset(), V !== n && (r = new G(new Date(c, U, 1)), i = Q(a, r), R.push(i), R.push(new G(new Date(i.at + 6e4))), a = r, n = V);
128
+ for (U = 0; U < 4; U++)
129
+ R.push(new G(new Date(c + U, 0, 1))), R.push(new G(new Date(c + U, 6, 1)));
130
130
  return R;
131
131
  }
132
- function M0(W, a) {
133
- return W.offsetScore !== a.offsetScore ? W.offsetScore - a.offsetScore : W.abbrScore !== a.abbrScore ? W.abbrScore - a.abbrScore : W.zone.population !== a.zone.population ? a.zone.population - W.zone.population : a.zone.name.localeCompare(W.zone.name);
132
+ function M0(c, a) {
133
+ return c.offsetScore !== a.offsetScore ? c.offsetScore - a.offsetScore : c.abbrScore !== a.abbrScore ? c.abbrScore - a.abbrScore : c.zone.population !== a.zone.population ? a.zone.population - c.zone.population : a.zone.name.localeCompare(c.zone.name);
134
134
  }
135
- function z0(W, a) {
135
+ function z0(c, a) {
136
136
  var n, R;
137
- for (U(a), n = 0; n < a.length; n++)
138
- R = a[n], c[R] = c[R] || {}, c[R][W] = !0;
137
+ for (f(a), n = 0; n < a.length; n++)
138
+ R = a[n], W[R] = W[R] || {}, W[R][c] = !0;
139
139
  }
140
- function b0(W) {
141
- var a = W.length, n = {}, R = [], i = {}, S, V, B, t;
142
- for (S = 0; S < a; S++)
143
- if (B = W[S].offset, !i.hasOwnProperty(B)) {
144
- t = c[B] || {};
140
+ function b0(c) {
141
+ var a = c.length, n = {}, R = [], i = {}, r, V, U, t;
142
+ for (r = 0; r < a; r++)
143
+ if (U = c[r].offset, !i.hasOwnProperty(U)) {
144
+ t = W[U] || {};
145
145
  for (V in t)
146
146
  t.hasOwnProperty(V) && (n[V] = !0);
147
- i[B] = !0;
147
+ i[U] = !0;
148
148
  }
149
- for (S in n)
150
- n.hasOwnProperty(S) && R.push(b[S]);
149
+ for (r in n)
150
+ n.hasOwnProperty(r) && R.push(b[r]);
151
151
  return R;
152
152
  }
153
153
  function p0() {
154
154
  try {
155
- var W = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
- if (W && W.length > 3) {
157
- var a = b[K(W)];
155
+ var c = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
+ if (c && c.length > 3) {
157
+ var a = b[K(c)];
158
158
  if (a)
159
159
  return a;
160
- D("Moment Timezone found " + W + " from the Intl api, but did not have that data loaded.");
160
+ D("Moment Timezone found " + c + " from the Intl api, but did not have that data loaded.");
161
161
  }
162
162
  } catch {
163
163
  }
164
- var n = F(), R = n.length, i = b0(n), S = [], V, B, t;
165
- for (B = 0; B < i.length; B++) {
166
- for (V = new H(g(i[B])), t = 0; t < R; t++)
164
+ var n = F(), R = n.length, i = b0(n), r = [], V, U, t;
165
+ for (U = 0; U < i.length; U++) {
166
+ for (V = new H(g(i[U])), t = 0; t < R; t++)
167
167
  V.scoreOffsetAt(n[t]);
168
- S.push(V);
168
+ r.push(V);
169
169
  }
170
- return S.sort(M0), S.length > 0 ? S[0].zone.name : void 0;
170
+ return r.sort(M0), r.length > 0 ? r[0].zone.name : void 0;
171
171
  }
172
- function O0(W) {
173
- return (!o || W) && (o = p0()), o;
172
+ function O0(c) {
173
+ return (!o || c) && (o = p0()), o;
174
174
  }
175
- function K(W) {
176
- return (W || "").toLowerCase().replace(/\//g, "_");
175
+ function K(c) {
176
+ return (c || "").toLowerCase().replace(/\//g, "_");
177
177
  }
178
- function k(W) {
178
+ function k(c) {
179
179
  var a, n, R, i;
180
- for (typeof W == "string" && (W = [W]), a = 0; a < W.length; a++)
181
- R = W[a].split("|"), n = R[0], i = K(n), p[i] = W[a], b[i] = n, z0(i, R[2].split(" "));
180
+ for (typeof c == "string" && (c = [c]), a = 0; a < c.length; a++)
181
+ R = c[a].split("|"), n = R[0], i = K(n), p[i] = c[a], b[i] = n, z0(i, R[2].split(" "));
182
182
  }
183
- function g(W, a) {
184
- W = K(W);
185
- var n = p[W], R;
186
- return n instanceof I ? n : typeof n == "string" ? (n = new I(n), p[W] = n, n) : O[W] && a !== g && (R = g(O[W], g)) ? (n = p[W] = new I(), n._set(R), n.name = b[W], n) : null;
183
+ function g(c, a) {
184
+ c = K(c);
185
+ var n = p[c], R;
186
+ return n instanceof I ? n : typeof n == "string" ? (n = new I(n), p[c] = n, n) : O[c] && a !== g && (R = g(O[c], g)) ? (n = p[c] = new I(), n._set(R), n.name = b[c], n) : null;
187
187
  }
188
188
  function A0() {
189
- var W, a = [];
190
- for (W in b)
191
- b.hasOwnProperty(W) && (p[W] || p[O[W]]) && b[W] && a.push(b[W]);
189
+ var c, a = [];
190
+ for (c in b)
191
+ b.hasOwnProperty(c) && (p[c] || p[O[c]]) && b[c] && a.push(b[c]);
192
192
  return a.sort();
193
193
  }
194
194
  function c0() {
195
195
  return Object.keys(A);
196
196
  }
197
- function v(W) {
197
+ function v(c) {
198
198
  var a, n, R, i;
199
- for (typeof W == "string" && (W = [W]), a = 0; a < W.length; a++)
200
- n = W[a].split("|"), R = K(n[0]), i = K(n[1]), O[R] = i, b[R] = n[0], O[i] = R, b[i] = n[1];
199
+ for (typeof c == "string" && (c = [c]), a = 0; a < c.length; a++)
200
+ n = c[a].split("|"), R = K(n[0]), i = K(n[1]), O[R] = i, b[R] = n[0], O[i] = R, b[i] = n[1];
201
201
  }
202
- function W0(W) {
202
+ function W0(c) {
203
203
  var a, n, R, i;
204
- if (!(!W || !W.length))
205
- for (a = 0; a < W.length; a++)
206
- i = W[a].split("|"), n = i[0].toUpperCase(), R = i[1].split(" "), A[n] = new f(
204
+ if (!(!c || !c.length))
205
+ for (a = 0; a < c.length; a++)
206
+ i = c[a].split("|"), n = i[0].toUpperCase(), R = i[1].split(" "), A[n] = new B(
207
207
  n,
208
208
  R
209
209
  );
210
210
  }
211
- function o0(W) {
212
- return W = W.toUpperCase(), A[W] || null;
211
+ function o0(c) {
212
+ return c = c.toUpperCase(), A[c] || null;
213
213
  }
214
- function q0(W, a) {
215
- if (W = o0(W), !W)
214
+ function q0(c, a) {
215
+ if (c = o0(c), !c)
216
216
  return null;
217
- var n = W.zones.sort();
217
+ var n = c.zones.sort();
218
218
  return a ? n.map(function(R) {
219
219
  var i = g(R);
220
220
  return {
@@ -223,59 +223,59 @@ var j = { exports: {} };
223
223
  };
224
224
  }) : n;
225
225
  }
226
- function Y0(W) {
227
- k(W.zones), v(W.links), W0(W.countries), u.dataVersion = W.version;
226
+ function Y0(c) {
227
+ k(c.zones), v(c.links), W0(c.countries), u.dataVersion = c.version;
228
228
  }
229
- function $(W) {
230
- return $.didShowError || ($.didShowError = !0, D("moment.tz.zoneExists('" + W + "') has been deprecated in favor of !moment.tz.zone('" + W + "')")), !!g(W);
229
+ function $(c) {
230
+ return $.didShowError || ($.didShowError = !0, D("moment.tz.zoneExists('" + c + "') has been deprecated in favor of !moment.tz.zone('" + c + "')")), !!g(c);
231
231
  }
232
- function J(W) {
233
- var a = W._f === "X" || W._f === "x";
234
- return !!(W._a && W._tzm === void 0 && !a);
232
+ function J(c) {
233
+ var a = c._f === "X" || c._f === "x";
234
+ return !!(c._a && c._tzm === void 0 && !a);
235
235
  }
236
- function D(W) {
237
- typeof console < "u" && typeof console.error == "function" && console.error(W);
236
+ function D(c) {
237
+ typeof console < "u" && typeof console.error == "function" && console.error(c);
238
238
  }
239
- function u(W) {
239
+ function u(c) {
240
240
  var a = Array.prototype.slice.call(arguments, 0, -1), n = arguments[arguments.length - 1], R = M.utc.apply(null, a), i;
241
- return !M.isMoment(W) && J(R) && (i = g(n)) && R.add(i.parse(R), "minutes"), R.tz(n), R;
241
+ return !M.isMoment(c) && J(R) && (i = g(n)) && R.add(i.parse(R), "minutes"), R.tz(n), R;
242
242
  }
243
243
  u.version = z, u.dataVersion = "", u._zones = p, u._links = O, u._names = b, u._countries = A, u.add = k, u.link = v, u.load = Y0, u.zone = g, u.zoneExists = $, u.guess = O0, u.names = A0, u.Zone = I, u.unpack = P, u.unpackBase60 = T, u.needsOffset = J, u.moveInvalidForward = !0, u.moveAmbiguousForward = !1, u.countries = c0, u.zonesForCountry = q0;
244
244
  var C = M.fn;
245
- M.tz = u, M.defaultZone = null, M.updateOffset = function(W, a) {
245
+ M.tz = u, M.defaultZone = null, M.updateOffset = function(c, a) {
246
246
  var n = M.defaultZone, R;
247
- if (W._z === void 0 && (n && J(W) && !W._isUTC && W.isValid() && (W._d = M.utc(W._a)._d, W.utc().add(n.parse(W), "minutes")), W._z = n), W._z)
248
- if (R = W._z.utcOffset(W), Math.abs(R) < 16 && (R = R / 60), W.utcOffset !== void 0) {
249
- var i = W._z;
250
- W.utcOffset(-R, a), W._z = i;
247
+ if (c._z === void 0 && (n && J(c) && !c._isUTC && c.isValid() && (c._d = M.utc(c._a)._d, c.utc().add(n.parse(c), "minutes")), c._z = n), c._z)
248
+ if (R = c._z.utcOffset(c), Math.abs(R) < 16 && (R = R / 60), c.utcOffset !== void 0) {
249
+ var i = c._z;
250
+ c.utcOffset(-R, a), c._z = i;
251
251
  } else
252
- W.zone(R, a);
253
- }, C.tz = function(W, a) {
254
- if (W) {
255
- if (typeof W != "string")
256
- throw new Error("Time zone name must be a string, got " + W + " [" + typeof W + "]");
257
- return this._z = g(W), this._z ? M.updateOffset(this, a) : D("Moment Timezone has no data for " + W + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
252
+ c.zone(R, a);
253
+ }, C.tz = function(c, a) {
254
+ if (c) {
255
+ if (typeof c != "string")
256
+ throw new Error("Time zone name must be a string, got " + c + " [" + typeof c + "]");
257
+ return this._z = g(c), this._z ? M.updateOffset(this, a) : D("Moment Timezone has no data for " + c + ". 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 y(W) {
262
+ function y(c) {
263
263
  return function() {
264
- return this._z ? this._z.abbr(this) : W.call(this);
264
+ return this._z ? this._z.abbr(this) : c.call(this);
265
265
  };
266
266
  }
267
- function w(W) {
267
+ function w(c) {
268
268
  return function() {
269
- return this._z = null, W.apply(this, arguments);
269
+ return this._z = null, c.apply(this, arguments);
270
270
  };
271
271
  }
272
- function d0(W) {
272
+ function d0(c) {
273
273
  return function() {
274
- return arguments.length > 0 && (this._z = null), W.apply(this, arguments);
274
+ return arguments.length > 0 && (this._z = null), c.apply(this, arguments);
275
275
  };
276
276
  }
277
- C.zoneName = y(C.zoneName), C.zoneAbbr = y(C.zoneAbbr), C.utc = w(C.utc), C.local = w(C.local), C.utcOffset = d0(C.utcOffset), M.tz.setDefault = function(W) {
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 = W ? g(W) : null, M;
277
+ C.zoneName = y(C.zoneName), C.zoneAbbr = y(C.zoneAbbr), C.utc = w(C.utc), C.local = w(C.local), C.utcOffset = d0(C.utcOffset), M.tz.setDefault = function(c) {
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 = c ? g(c) : null, M;
279
279
  };
280
280
  var h = M.momentProperties;
281
281
  return Object.prototype.toString.call(h) === "[object Array]" ? (h.push("_z"), h.push("_a")) : h && (h._z = null), M;
@@ -1145,9 +1145,9 @@ var x = { exports: {} };
1145
1145
  throw new RangeError("invalid coordinates");
1146
1146
  if (90 <= z)
1147
1147
  return "Etc/GMT";
1148
- var b = -1, c = 48 * (180 + p) / 360.00000000000006, o = 24 * (90 - z) / 180.00000000000003, q = 0 | c, Y = 0 | o, d = 96 * Y + 2 * q;
1148
+ var b = -1, W = 48 * (180 + p) / 360.00000000000006, o = 24 * (90 - z) / 180.00000000000003, q = 0 | W, Y = 0 | o, d = 96 * Y + 2 * q;
1149
1149
  for (d = 56 * O.charCodeAt(d) + O.charCodeAt(d + 1) - 1995; d + A.length < 3136; )
1150
- d = 56 * O.charCodeAt(d = 8 * (b = b + d + 1) + 4 * (Y = 0 | (o = 2 * (o - Y) % 2)) + 2 * (q = 0 | (c = 2 * (c - q) % 2)) + 2304) + O.charCodeAt(d + 1) - 1995;
1150
+ d = 56 * O.charCodeAt(d = 8 * (b = b + d + 1) + 4 * (Y = 0 | (o = 2 * (o - Y) % 2)) + 2 * (q = 0 | (W = 2 * (W - q) % 2)) + 2304) + O.charCodeAt(d + 1) - 1995;
1151
1151
  return A[d + A.length - 3136];
1152
1152
  }
1153
1153
  E.exports = M;
@@ -1177,9 +1177,9 @@ class X {
1177
1177
  z = z < 6 ? 6 : z, M = X.convertToStdLng(M, z);
1178
1178
  let O = "E";
1179
1179
  M < 0 && (O = "W"), M = Math.abs(M), p = p.toUpperCase();
1180
- let A = M * 3600, b, c, o, q, Y, d;
1181
- b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), Y = A / 3600, p.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(3, "0") : d = X.padNumber(Y, 3, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1182
- const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, d)}${O}`;
1180
+ let A = M * 3600, b, W, o, q, Y, d;
1181
+ b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), Y = A / 3600, p.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(3, "0") : d = X.padNumber(Y, 3, 2), Number(W) >= 60 && (q = Number(q) + 1, W = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1182
+ const L = `${p.replace(/S+/gi, W).replace(/M+/gi, q).replace(/H+/gi, d)}${O}`;
1183
1183
  return {
1184
1184
  direction: O,
1185
1185
  degree: X.roundPrecision(Y, z),
@@ -1198,9 +1198,9 @@ class X {
1198
1198
  z = z < 6 ? 6 : z, M = M % 180;
1199
1199
  let O = "N";
1200
1200
  M < 0 && (O = "S"), M = Math.abs(M), p = p.toUpperCase();
1201
- let A = M * 3600, b, c, o, q, Y, d;
1202
- b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), Y = A / 3600, p.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(2, "0") : d = X.padNumber(Y, 2, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1203
- const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, d)}${O}`;
1201
+ let A = M * 3600, b, W, o, q, Y, d;
1202
+ b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), Y = A / 3600, p.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(2, "0") : d = X.padNumber(Y, 2, 2), Number(W) >= 60 && (q = Number(q) + 1, W = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1203
+ const L = `${p.replace(/S+/gi, W).replace(/M+/gi, q).replace(/H+/gi, d)}${O}`;
1204
1204
  return {
1205
1205
  direction: O,
1206
1206
  degree: X.roundPrecision(Y, z),
@@ -1216,12 +1216,12 @@ class X {
1216
1216
  const O = M[M.length - 1].toUpperCase();
1217
1217
  M = M.substring(0, M.length - 1).trim();
1218
1218
  const A = M.split(" ").filter((o) => o !== "").map((o) => Math.abs(Number(o)));
1219
- let [b, c] = A;
1220
- if (c = c > 60 ? c / Math.pow(10, String(c).length - 2) : c, b > 360 && !c) {
1219
+ let [b, W] = A;
1220
+ if (W = W > 60 ? W / Math.pow(10, String(W).length - 2) : W, b > 360 && !W) {
1221
1221
  const o = this.roundPrecision(b / 100, 0);
1222
- c = b - o * 100, b = o;
1222
+ W = b - o * 100, b = o;
1223
1223
  }
1224
- p = b + (c ?? 0) / 60, O === "W" && (p = p * -1);
1224
+ p = b + (W ?? 0) / 60, O === "W" && (p = p * -1);
1225
1225
  } else
1226
1226
  p = Number(M);
1227
1227
  return X.convertToStdLng(p, z);
@@ -1233,12 +1233,12 @@ class X {
1233
1233
  const O = M[M.length - 1].toUpperCase();
1234
1234
  M = M.substring(0, M.length - 1).trim();
1235
1235
  const A = M.split(" ").filter((o) => o !== "").map((o) => Math.abs(Number(o)));
1236
- let [b, c] = A;
1237
- if (c = c > 60 ? c / Math.pow(10, String(c).length - 2) : c, b > 90 && !c) {
1236
+ let [b, W] = A;
1237
+ if (W = W > 60 ? W / Math.pow(10, String(W).length - 2) : W, b > 90 && !W) {
1238
1238
  const o = this.roundPrecision(b / 100, 0);
1239
- c = b - o * 100, b = o;
1239
+ W = b - o * 100, b = o;
1240
1240
  }
1241
- if (p = b + (c ?? 0) / 60, p > 90)
1241
+ if (p = b + (W ?? 0) / 60, p > 90)
1242
1242
  throw new Error(`latitude out of range: ${M}${O}`);
1243
1243
  O === "S" && (p = p * -1);
1244
1244
  } else
@@ -1343,8 +1343,8 @@ class N {
1343
1343
  [M.lng, M.lat],
1344
1344
  [z.lng, z.lat]
1345
1345
  ]);
1346
- let c;
1347
- return p ? c = e.rhumbDistance(b.features[0], b.features[1], { units: A }) : c = e.distance(b.features[0], b.features[1], { units: A }), X.roundPrecision(c, O);
1346
+ let W;
1347
+ return p ? W = e.rhumbDistance(b.features[0], b.features[1], { units: A }) : W = e.distance(b.features[0], b.features[1], { units: A }), X.roundPrecision(W, O);
1348
1348
  }
1349
1349
  /**
1350
1350
  * 计算航线距离
@@ -1355,10 +1355,10 @@ class N {
1355
1355
  static calculateRouteDistance(M, z = 4, p = "nauticalmiles") {
1356
1356
  let O = 0, A;
1357
1357
  for (const b of M)
1358
- for (let c = 0; c < b.length - 1; c++) {
1359
- const o = { lng: b[c][0], lat: b[c][1] };
1360
- c === 0 && A && (O += this.calculateDistance(A, o, !0, z, p));
1361
- const q = { lng: b[c + 1][0], lat: b[c + 1][1] };
1358
+ for (let W = 0; W < b.length - 1; W++) {
1359
+ const o = { lng: b[W][0], lat: b[W][1] };
1360
+ W === 0 && A && (O += this.calculateDistance(A, o, !0, z, p));
1361
+ const q = { lng: b[W + 1][0], lat: b[W + 1][1] };
1362
1362
  O += this.calculateDistance(o, q, !0, z, p), A = q;
1363
1363
  }
1364
1364
  return X.roundPrecision(O, z);
@@ -1373,9 +1373,9 @@ class N {
1373
1373
  */
1374
1374
  static calculateCoordinate(M, z, p, O = "nauticalmiles", A = !0) {
1375
1375
  const b = e.point([M.lng, M.lat]);
1376
- let c;
1377
- A ? c = e.rhumbDestination(b, p, z, { units: O }) : c = e.destination(b, p, z, { units: O });
1378
- const o = c.geometry.coordinates;
1376
+ let W;
1377
+ A ? W = e.rhumbDestination(b, p, z, { units: O }) : W = e.destination(b, p, z, { units: O });
1378
+ const o = W.geometry.coordinates;
1379
1379
  return { lng: X.convertToStdLng(o[0], 8), lat: X.roundPrecision(o[1], 8) };
1380
1380
  }
1381
1381
  /**
@@ -1388,12 +1388,12 @@ class N {
1388
1388
  * @param units 单位,默认 nm(海里)
1389
1389
  */
1390
1390
  static interpolateCoordinates(M, z, p, O = !0, A = !0, b = "nauticalmiles") {
1391
- const c = [], o = this.calculateBearing(M, z, !1), q = this.calculateDistance(M, z, !1, 8, b);
1392
- O && c.push({ lng: M.lng, lat: M.lat });
1391
+ const W = [], o = this.calculateBearing(M, z, !1), q = this.calculateDistance(M, z, !1, 8, b);
1392
+ O && W.push({ lng: M.lng, lat: M.lat });
1393
1393
  let Y = 0;
1394
1394
  for (; Y < q; )
1395
- Y += p, Y < q && c.push(this.calculateCoordinate(M, o, Y, b, !1));
1396
- return A && c.push({ lng: z.lng, lat: z.lat }), c;
1395
+ Y += p, Y < q && W.push(this.calculateCoordinate(M, o, Y, b, !1));
1396
+ return A && W.push({ lng: z.lng, lat: z.lat }), W;
1397
1397
  }
1398
1398
  /**
1399
1399
  * 分组坐标(如相邻两个坐标经度差超180度,需以180为界将坐标分为两组)
@@ -1413,13 +1413,13 @@ class N {
1413
1413
  let p = [];
1414
1414
  const O = [];
1415
1415
  let A, b;
1416
- for (let c = 0; c < M.length - 1; c++) {
1417
- A = X.convertToStdLng(M[c].lng, 8), b = X.convertToStdLng(M[c + 1].lng, 8), M[c].lat = X.roundPrecision(M[c].lat, 8), M[c + 1].lat = X.roundPrecision(M[c + 1].lat, 8), p.push([A, M[c].lat]);
1416
+ for (let W = 0; W < M.length - 1; W++) {
1417
+ A = X.convertToStdLng(M[W].lng, 8), b = X.convertToStdLng(M[W + 1].lng, 8), M[W].lat = X.roundPrecision(M[W].lat, 8), M[W + 1].lat = X.roundPrecision(M[W + 1].lat, 8), p.push([A, M[W].lat]);
1418
1418
  const o = A - b;
1419
1419
  if (Math.abs(o) > 180) {
1420
1420
  const q = X.convertToMonotonicLng2([
1421
- [A, M[c].lat],
1422
- [b, M[c + 1].lat]
1421
+ [A, M[W].lat],
1422
+ [b, M[W + 1].lat]
1423
1423
  ]);
1424
1424
  let Y, d;
1425
1425
  z ? (Y = e.lineString(q), d = e.lineString([
@@ -1429,13 +1429,13 @@ class N {
1429
1429
  const L = e.lineIntersect(Y, d);
1430
1430
  let T;
1431
1431
  if (L.features.length) {
1432
- const U = e.getCoord(L.features[0]);
1433
- T = X.roundPrecision(U[1], 8);
1432
+ const f = e.getCoord(L.features[0]);
1433
+ T = X.roundPrecision(f[1], 8);
1434
1434
  } else
1435
- T = M[c].lat;
1435
+ T = M[W].lat;
1436
1436
  o > 0 ? (p.push([180 - 1e-6, T]), O.push([...p]), p = [], p.push([-(180 - 1e-6), T])) : (p.push([-(180 - 1e-6), T]), O.push([...p]), p = [], p.push([180 - 1e-6, T]));
1437
1437
  }
1438
- c === M.length - 2 && p.push([b, M[c + 1].lat]);
1438
+ W === M.length - 2 && p.push([b, M[W + 1].lat]);
1439
1439
  }
1440
1440
  return O.push(p), O;
1441
1441
  }
@@ -1446,7 +1446,7 @@ class N {
1446
1446
  static deduplicateRoute(M) {
1447
1447
  const z = [];
1448
1448
  for (const p of M) {
1449
- const O = p.reduce((A, b) => (A.findIndex((c) => c[0] === b[0] && c[1] === b[1]) === -1 && A.push(b), A), []);
1449
+ const O = p.reduce((A, b) => (A.findIndex((W) => W[0] === b[0] && W[1] === b[1]) === -1 && A.push(b), A), []);
1450
1450
  z.push(O);
1451
1451
  }
1452
1452
  return z;
@@ -1494,13 +1494,13 @@ class N {
1494
1494
  */
1495
1495
  static mergeCoordinateToRoute(M, z) {
1496
1496
  M.lng = X.convertToStdLng(M.lng, 8);
1497
- let p = Number.MAX_VALUE, O = 0, A = 0, b, c;
1497
+ let p = Number.MAX_VALUE, O = 0, A = 0, b, W;
1498
1498
  return z.forEach((o, q) => {
1499
1499
  for (let Y = 0; Y < o.length - 1; Y++) {
1500
1500
  const d = { lng: o[Y][0], lat: o[Y][1] }, L = { lng: o[Y + 1][0], lat: o[Y + 1][1] }, T = this.calculatePointToLineDistance(M, d, L);
1501
- p > T && (p = T, A = Y, O = q, b = this.calculateDistance(d, M), c = this.calculateDistance(L, M));
1501
+ p > T && (p = T, A = Y, O = q, b = this.calculateDistance(d, M), W = this.calculateDistance(L, M));
1502
1502
  }
1503
- }), b !== 0 && c !== 0 ? z[O].splice(A + 1, 0, [M.lng, M.lat]) : b === 0 ? z[O].splice(A, 1, [M.lng, M.lat]) : c === 0 && z[O].splice(A + 1, 1, [M.lng, M.lat]), z;
1503
+ }), b !== 0 && W !== 0 ? z[O].splice(A + 1, 0, [M.lng, M.lat]) : b === 0 ? z[O].splice(A, 1, [M.lng, M.lat]) : W === 0 && z[O].splice(A + 1, 1, [M.lng, M.lat]), z;
1504
1504
  }
1505
1505
  /**
1506
1506
  * 向Route尾加1个坐标
@@ -1545,15 +1545,15 @@ class N {
1545
1545
  return p.forEach((b) => {
1546
1546
  if (A === 2)
1547
1547
  return;
1548
- const c = [];
1548
+ const W = [];
1549
1549
  for (const o of b) {
1550
1550
  if (X.roundPrecision(z.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(o[1], 8)) {
1551
- c.push(o), A === 0 && c.push([M.lng, M.lat]), A = 2;
1551
+ W.push(o), A === 0 && W.push([M.lng, M.lat]), A = 2;
1552
1552
  break;
1553
1553
  }
1554
- A === 1 ? c.push(o) : X.roundPrecision(M.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(o[1], 8) && (A = 1, c.push(o));
1554
+ A === 1 ? W.push(o) : X.roundPrecision(M.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(o[1], 8) && (A = 1, W.push(o));
1555
1555
  }
1556
- c.length && O.push(c);
1556
+ W.length && O.push(W);
1557
1557
  }), O;
1558
1558
  }
1559
1559
  /**
@@ -1565,12 +1565,12 @@ class N {
1565
1565
  * @return [{lng, lat}]
1566
1566
  */
1567
1567
  static calculateRangeWaypoints(M, z, p, O = []) {
1568
- const A = this.convertRouteToCoordinates(p, 0), b = this.mergeCoordinatesToWaypoints([M, z], A.length ? A : O), c = b.findIndex(
1568
+ const A = this.convertRouteToCoordinates(p, 0), b = this.mergeCoordinatesToWaypoints([M, z], A.length ? A : O), W = b.findIndex(
1569
1569
  (Y) => X.roundPrecision(M.lng, 8) === X.roundPrecision(Y.lng, 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(Y.lat, 8)
1570
1570
  ), o = b.findIndex(
1571
1571
  (Y) => X.roundPrecision(z.lng, 8) === X.roundPrecision(Y.lng, 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(Y.lat, 8)
1572
1572
  );
1573
- return b.filter((Y, d) => d >= c && d <= o);
1573
+ return b.filter((Y, d) => d >= W && d <= o);
1574
1574
  }
1575
1575
  /**
1576
1576
  * 计算坐标到航路上的最短距离
@@ -1579,10 +1579,10 @@ class N {
1579
1579
  */
1580
1580
  static calculateMinDistanceToRoute(M, z) {
1581
1581
  let p = Number.MAX_VALUE, O = 0, A = 0;
1582
- return z.forEach((b, c) => {
1582
+ return z.forEach((b, W) => {
1583
1583
  for (let o = 0; o < b.length - 1; o++) {
1584
1584
  const q = { lng: b[o][0], lat: b[o][1] }, Y = { lng: b[o + 1][0], lat: b[o + 1][1] }, d = this.calculatePointToLineDistance(M, q, Y);
1585
- p > d && (p = d, O = o, A = c);
1585
+ p > d && (p = d, O = o, A = W);
1586
1586
  }
1587
1587
  }), { minDist: p, segIndex: A, minIndex: O };
1588
1588
  }
@@ -1598,14 +1598,14 @@ class N {
1598
1598
  const { segIndex: O, minIndex: A } = this.calculateMinDistanceToRoute({ ...M }, z);
1599
1599
  M.lng = X.convertToStdLng(M.lng);
1600
1600
  const b = [];
1601
- let c = !0;
1601
+ let W = !0;
1602
1602
  for (let o = O; o < z.length; o++)
1603
- if (c) {
1603
+ if (W) {
1604
1604
  const q = [];
1605
1605
  q.push([M.lng, M.lat]);
1606
1606
  for (let Y = A + 1; Y < z[o].length; Y++)
1607
1607
  M.lng === z[o][Y][0] && M.lat === z[o][Y][1] || q.push(z[o][Y]);
1608
- b.push(q), c = !1;
1608
+ b.push(q), W = !1;
1609
1609
  } else
1610
1610
  b.push([...z[o]]);
1611
1611
  return b;
@@ -1619,12 +1619,12 @@ class N {
1619
1619
  static calculateSubWaypoints(M, z) {
1620
1620
  let p = Number.MAX_VALUE, O = 0;
1621
1621
  for (let b = 0; b < z.length - 1; b++) {
1622
- const c = z[b], o = z[b + 1];
1623
- if (this.calculateDistance(M, c) === 0)
1622
+ const W = z[b], o = z[b + 1];
1623
+ if (this.calculateDistance(M, W) === 0)
1624
1624
  return z;
1625
1625
  if (this.calculateDistance(M, o) === 0)
1626
1626
  return z.filter((Y, d) => d > 0);
1627
- const q = this.calculatePointToLineDistance(M, c, o);
1627
+ const q = this.calculatePointToLineDistance(M, W, o);
1628
1628
  p > q && (p = q, O = b);
1629
1629
  }
1630
1630
  M.lng = X.convertToStdLng(M.lng);
@@ -1647,8 +1647,8 @@ class N {
1647
1647
  const b = e.lineString([
1648
1648
  [z.lng, z.lat],
1649
1649
  [p.lng, p.lat]
1650
- ]), c = e.pointToLineDistance(e.point([M.lng, M.lat]), b, O), o = e.pointToLineDistance(e.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), b, O);
1651
- return X.roundPrecision(Math.min(c, o), 6);
1650
+ ]), W = e.pointToLineDistance(e.point([M.lng, M.lat]), b, O), o = e.pointToLineDistance(e.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), b, O);
1651
+ return X.roundPrecision(Math.min(W, o), 6);
1652
1652
  }
1653
1653
  /**
1654
1654
  * 计算途经点的COG, Distance等属性
@@ -1687,15 +1687,15 @@ class N {
1687
1687
  */
1688
1688
  static mergeCoordinateToWaypoints(M, z, p = !0) {
1689
1689
  M.lng = X.convertToStdLng(M.lng, 8);
1690
- let O = Number.MAX_VALUE, A = 0, b = 0, c = 0;
1690
+ let O = Number.MAX_VALUE, A = 0, b = 0, W = 0;
1691
1691
  if (z.length < 2)
1692
1692
  z.push(M);
1693
1693
  else {
1694
1694
  for (let o = 0; o < z.length - 1; o++) {
1695
1695
  const q = { lng: z[o].lng, lat: z[o].lat }, Y = { lng: z[o + 1].lng, lat: z[o + 1].lat }, d = this.calculatePointToLineDistance(M, q, Y);
1696
- O >= d && (O = d, A = o, b = this.calculateDistance(q, M, !1, 6), c = this.calculateDistance(Y, M, !1, 6));
1696
+ O >= d && (O = d, A = o, b = this.calculateDistance(q, M, !1, 6), W = this.calculateDistance(Y, M, !1, 6));
1697
1697
  }
1698
- b !== 0 && c !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : c < O || c === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p ? z.splice(A, 1, M) : z.splice(A + 1, 0, M) : c === 0 && (p ? z.splice(A + 1, 1, M) : z.splice(A + 1, 0, M));
1698
+ b !== 0 && W !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : W < O || W === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p ? z.splice(A, 1, M) : z.splice(A + 1, 0, M) : W === 0 && (p ? z.splice(A + 1, 1, M) : z.splice(A + 1, 0, M));
1699
1699
  }
1700
1700
  return z.map((o, q) => {
1701
1701
  o.lng = X.convertToStdLng(o.lng);
@@ -1730,7 +1730,7 @@ class N {
1730
1730
  * @param route [[[lng, lat]]]
1731
1731
  */
1732
1732
  static nearestCoordinateInRoute(M, z) {
1733
- const p = e.point([M.lng, M.lat]), A = this.convertRouteToCoordinates(z).map((q) => [q.lng, q.lat]), b = e.lineString(A), c = e.nearestPointOnLine(b, p), o = e.getCoord(c);
1733
+ const p = e.point([M.lng, M.lat]), A = this.convertRouteToCoordinates(z).map((q) => [q.lng, q.lat]), b = e.lineString(A), W = e.nearestPointOnLine(b, p), o = e.getCoord(W);
1734
1734
  return { lng: X.roundPrecision(o[0], 8), lat: X.roundPrecision(o[1], 8) };
1735
1735
  }
1736
1736
  /**
@@ -1765,16 +1765,16 @@ class N {
1765
1765
  static calculateNextCoordinateAlongRoute(M, z, p, O = "nauticalmiles") {
1766
1766
  var L;
1767
1767
  const A = M.speed || 12, b = [];
1768
- let c = [], o = !1, q = 0, Y = 0, d;
1769
- if (z && p.length ? (b.push(M), p.forEach((T, U) => {
1768
+ let W = [], o = !1, q = 0, Y = 0, d;
1769
+ if (z && p.length ? (b.push(M), p.forEach((T, f) => {
1770
1770
  if (o)
1771
- c.push(T);
1771
+ W.push(T);
1772
1772
  else {
1773
- const r = [];
1773
+ const S = [];
1774
1774
  let s;
1775
1775
  for (let P = 0; P < T.length; P++)
1776
1776
  if (d)
1777
- r.push(T[P]);
1777
+ S.push(T[P]);
1778
1778
  else {
1779
1779
  s = { lng: T[P][0], lat: T[P][1] };
1780
1780
  const I = this.calculateDistance(M, s, !0, 8, O);
@@ -1782,23 +1782,23 @@ class N {
1782
1782
  Y += I, I && b.push(s), M = s;
1783
1783
  else {
1784
1784
  if (Y = z, q === z)
1785
- d = s, r.push([d.lng, d.lat]);
1785
+ d = s, S.push([d.lng, d.lat]);
1786
1786
  else {
1787
- const l = q - z, f = this.calculateBearing(s, M);
1788
- d = this.calculateCoordinate(s, f, l, O), r.push([d.lng, d.lat]), r.push([s.lng, s.lat]);
1787
+ const l = q - z, B = this.calculateBearing(s, M);
1788
+ d = this.calculateCoordinate(s, B, l, O), S.push([d.lng, d.lat]), S.push([s.lng, s.lat]);
1789
1789
  }
1790
1790
  o = !0;
1791
1791
  }
1792
1792
  }
1793
- r.length && c.push(r), U === p.length - 1 && !d && (d = s);
1793
+ S.length && W.push(S), f === p.length - 1 && !d && (d = s);
1794
1794
  }
1795
- })) : (c = p, d = { ...M }), d)
1796
- if (b.push(d), d.distanceFromPrevious = Y, d.hourFromPrevious = Math.round(Y / A * 1e4) / 1e4, ((L = c[0]) == null ? void 0 : L.length) > 1) {
1797
- const T = { lng: c[0][1][0], lat: c[0][1][1] };
1795
+ })) : (W = p, d = { ...M }), d)
1796
+ if (b.push(d), d.distanceFromPrevious = Y, d.hourFromPrevious = Math.round(Y / A * 1e4) / 1e4, ((L = W[0]) == null ? void 0 : L.length) > 1) {
1797
+ const T = { lng: W[0][1][0], lat: W[0][1][1] };
1798
1798
  d.bearing = this.calculateBearing(d, T);
1799
1799
  } else
1800
1800
  d.bearing = 0;
1801
- return { coordinate: d, nextRoute: c, prevRoute: b };
1801
+ return { coordinate: d, nextRoute: W, prevRoute: b };
1802
1802
  }
1803
1803
  /**
1804
1804
  * 返回最近点及其是否为垂足(最近点不是起点或终点)
@@ -1807,11 +1807,11 @@ class N {
1807
1807
  * @param to {lng, lat}
1808
1808
  */
1809
1809
  static nearestCoordinateInLine(M, z, p) {
1810
- const O = X.convertToStdLng(M.lng, 6), A = e.point([O, M.lat]), b = X.convertToStdLng(z.lng, 6), c = X.convertToStdLng(p.lng, 6), o = e.lineString([
1810
+ const O = X.convertToStdLng(M.lng, 6), A = e.point([O, M.lat]), b = X.convertToStdLng(z.lng, 6), W = X.convertToStdLng(p.lng, 6), o = e.lineString([
1811
1811
  [b, z.lat],
1812
- [c, p.lat]
1812
+ [W, p.lat]
1813
1813
  ]), q = e.nearestPointOnLine(o, A), Y = e.getCoord(q), d = X.roundPrecision(Y[0], 6), L = X.roundPrecision(Y[1], 6);
1814
- return { lng: d, lat: L, inline: !(d === b && L === z.lat) && !(d === c && L === p.lat) };
1814
+ return { lng: d, lat: L, inline: !(d === b && L === z.lat) && !(d === W && L === p.lat) };
1815
1815
  }
1816
1816
  /**
1817
1817
  * 将route转coordinate
@@ -1822,8 +1822,8 @@ class N {
1822
1822
  const p = [];
1823
1823
  let O, A;
1824
1824
  return M.forEach((b) => {
1825
- b.forEach((c) => {
1826
- const o = { lng: X.roundPrecision(c[0], 8), lat: X.roundPrecision(c[1], 8) };
1825
+ b.forEach((W) => {
1826
+ const o = { lng: X.roundPrecision(W[0], 8), lat: X.roundPrecision(W[1], 8) };
1827
1827
  if (!A)
1828
1828
  p.push(o), A = o;
1829
1829
  else if (A.bearing === void 0)
@@ -1858,8 +1858,8 @@ class N {
1858
1858
  for (let O = 1; O < z.length; O++) {
1859
1859
  const A = z[O - 1], b = z[O];
1860
1860
  if (b.gcToPrevious) {
1861
- const c = M.findIndex((q) => q.lng === A.lng && q.lat === A.lat), o = M.findIndex((q) => q.lng === b.lng && q.lat === b.lat);
1862
- for (let q = o - 1; q > c; q--)
1861
+ const W = M.findIndex((q) => q.lng === A.lng && q.lat === A.lat), o = M.findIndex((q) => q.lng === b.lng && q.lat === b.lat);
1862
+ for (let q = o - 1; q > W; q--)
1863
1863
  M.splice(q, 1);
1864
1864
  }
1865
1865
  }
@@ -1876,12 +1876,12 @@ class N {
1876
1876
  */
1877
1877
  static calculateCenter(M) {
1878
1878
  const z = [];
1879
- for (const c of M)
1880
- for (const o of c)
1879
+ for (const W of M)
1880
+ for (const o of W)
1881
1881
  z.push(o);
1882
1882
  const p = e.featureCollection([]), O = X.convertToMonotonicLng2(z);
1883
- for (const c of O)
1884
- p.features.push(e.point(c));
1883
+ for (const W of O)
1884
+ p.features.push(e.point(W));
1885
1885
  const b = e.center(p).geometry.coordinates;
1886
1886
  return { lng: X.convertToStdLng(b[0], 8), lat: X.roundPrecision(b[1], 8) };
1887
1887
  }
@@ -1922,11 +1922,11 @@ class N {
1922
1922
  static simplifyCoordinates(M, z = 1, p = 180) {
1923
1923
  const O = [];
1924
1924
  for (let A = 1; A < M.length; A++) {
1925
- const b = M[A - 1], c = M[A], o = M[A + 1];
1925
+ const b = M[A - 1], W = M[A], o = M[A + 1];
1926
1926
  let q = !1, Y = !1;
1927
- if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (q = !0, O.push(b)), c.gcToPrevious && (q || (q = !0, O.push(b)), Y = !0, O.push(c), A++), o) {
1928
- const d = N.calculateDistance(b, c, !0), L = N.calculateDistance(c, o, !0), T = N.calculateDistance(b, o, !0), U = (Math.pow(d, 2) + Math.pow(L, 2) - Math.pow(T, 2)) / (2 * d * L);
1929
- Math.round(Math.acos(U) * 180 / Math.PI) < p && T > z && !Y && (O.push(c), A++);
1927
+ if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (q = !0, O.push(b)), W.gcToPrevious && (q || (q = !0, O.push(b)), Y = !0, O.push(W), A++), o) {
1928
+ const d = N.calculateDistance(b, W, !0), L = N.calculateDistance(W, o, !0), T = N.calculateDistance(b, o, !0), f = (Math.pow(d, 2) + Math.pow(L, 2) - Math.pow(T, 2)) / (2 * d * L);
1929
+ Math.round(Math.acos(f) * 180 / Math.PI) < p && T > z && !Y && (O.push(W), A++);
1930
1930
  }
1931
1931
  if (A >= M.length - 1) {
1932
1932
  const d = M.at(-1);
@@ -1945,7 +1945,7 @@ class N {
1945
1945
  const O = m.unix(M), A = p.filter(
1946
1946
  (b) => O.clone().subtract(z, "hour").unix() <= (b.positionTime || 0) && O.clone().add(z, "h").unix() >= (b.positionTime || 0)
1947
1947
  );
1948
- return A.sort((b, c) => (b.positionTime || 0) - (c.positionTime || 0)), A.at(-1);
1948
+ return A.sort((b, W) => (b.positionTime || 0) - (W.positionTime || 0)), A.at(-1);
1949
1949
  }
1950
1950
  /**
1951
1951
  * 推测船位
@@ -1953,12 +1953,12 @@ class N {
1953
1953
  * @param positions 带时间(positionTime)的轨迹
1954
1954
  */
1955
1955
  static deadReckoning(M, z) {
1956
- var A, b, c, o;
1956
+ var A, b, W, o;
1957
1957
  M > 1e12 && (M = Math.round(M / 1e3));
1958
1958
  const p = m.unix(M);
1959
1959
  let O = z.find((q) => q.positionTime === p.unix());
1960
1960
  if (!O) {
1961
- const q = (b = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) < p.unix())) == null ? void 0 : A.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : b.at(-1), Y = (o = (c = z.filter((d) => (d == null ? void 0 : d.positionTime) > p.unix())) == null ? void 0 : c.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : o.at(0);
1961
+ const q = (b = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) < p.unix())) == null ? void 0 : A.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : b.at(-1), Y = (o = (W = z.filter((d) => (d == null ? void 0 : d.positionTime) > p.unix())) == null ? void 0 : W.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : o.at(0);
1962
1962
  if (q && Y) {
1963
1963
  const d = N.calculateBearing(q, Y, !0), L = N.calculateDistance(q, Y), T = (p.unix() - q.positionTime) / (Y.positionTime - q.positionTime);
1964
1964
  O = N.calculateCoordinate(q, d, L * T), O.positionTime = p.unix(), O.utc = p.utc().format(), O.cog = d, O.sog = Math.round(L / ((Y.positionTime - q.positionTime) / 3600) * 100) / 100;
@@ -1979,14 +1979,14 @@ class N {
1979
1979
  const Y = z[q], d = z[q + 1], L = N.calculatePointToLineDistance(M, Y, d);
1980
1980
  L < p && (p = L, O = q);
1981
1981
  }
1982
- const A = z[O], b = z[O + 1], c = N.calculateDistance(A, M), o = N.calculateDistance(b, M);
1983
- if (c === 0)
1982
+ const A = z[O], b = z[O + 1], W = N.calculateDistance(A, M), o = N.calculateDistance(b, M);
1983
+ if (W === 0)
1984
1984
  M = A;
1985
1985
  else if (o === 0)
1986
1986
  M = b;
1987
1987
  else {
1988
- const q = N.nearestCoordinateInLine(M, A, b), Y = A.positionTime, d = b.positionTime, L = N.calculateDistance(A, q), T = N.calculateDistance(A, b), U = Math.round(Y + (d - Y) * (L / T));
1989
- M.positionTime = U;
1988
+ const q = N.nearestCoordinateInLine(M, A, b), Y = A.positionTime, d = b.positionTime, L = N.calculateDistance(A, q), T = N.calculateDistance(A, b), f = Math.round(Y + (d - Y) * (L / T));
1989
+ M.positionTime = f;
1990
1990
  }
1991
1991
  return M.utc = M.positionTime ? m.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
1992
1992
  }
@@ -2021,86 +2021,94 @@ class t0 {
2021
2021
  for (const O of M) {
2022
2022
  if (O.forecasts) {
2023
2023
  const A = (p = O.history) == null ? void 0 : p[0];
2024
- A && A.wind && (A.wind.spd = A.spd, A.wind.kts = A.kts);
2024
+ A && A.wind && (A.wind.kts = A.kts);
2025
2025
  for (const b of O.forecasts) {
2026
- const c = [], o = m(b.date).utc(), q = `${O.name}-${b.model}`;
2027
- if (A) {
2028
- const Y = m(A.updated).utc(), d = e.point([A.lng, A.lat], {
2026
+ let W;
2027
+ const o = [], q = m(b.date).utc(), Y = `${O.name}-${b.model}`;
2028
+ for (const L in b == null ? void 0 : b.hours) {
2029
+ const T = b.hours[L];
2030
+ W = W || T;
2031
+ const f = q.clone().add(Number(L), "hour"), S = e.point([T.lng, T.lat], {
2029
2032
  model: b.model,
2030
2033
  name: O.name,
2031
- date: Y.format(),
2032
- hour: 0,
2033
- format: Y.format("MMM-DD/HHmm[Z]"),
2034
- pressure: A.pressure > 1e4 ? X.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : X.roundPrecision(A.pressure, 0),
2035
- wind: A.wind,
2036
- movement: A.movement,
2037
- category: q,
2034
+ date: f.format(),
2035
+ hour: Number(L),
2036
+ format: f.format("MMM-DD/HHmm[Z]"),
2037
+ pressure: T.pressure > 1e4 ? X.roundPrecision(T.pressure / 100, 0) : X.roundPrecision(T.pressure, 0),
2038
+ gusts: T.gusts,
2039
+ wind: T.wind || {},
2040
+ movement: T.movement,
2041
+ category: Y,
2038
2042
  type: "forecast"
2039
2043
  });
2040
- z.features.push(d), c.push(d.geometry.coordinates);
2044
+ z.features.push(S), o.push(S.geometry.coordinates);
2041
2045
  }
2042
- for (const Y in b == null ? void 0 : b.hours) {
2043
- const d = b.hours[Y];
2044
- d.wind.spd = d.wind.spd || d.wind.speed;
2045
- const L = o.clone().add(Number(Y), "hour"), T = e.point([d.lng, d.lat], {
2046
+ const d = {
2047
+ kts: void 0,
2048
+ deg: void 0
2049
+ };
2050
+ if (A) {
2051
+ const L = m(A.updated).utc();
2052
+ if (W) {
2053
+ const f = N.calculateDistance(A, W), S = m(W.utc || W.updated).diff(L, "h", !0);
2054
+ d.kts = Math.round(f / S * 100) / 100, d.deg = N.calculateBearing(A, W, !0, 0);
2055
+ }
2056
+ const T = e.point([A.lng, A.lat], {
2046
2057
  model: b.model,
2047
2058
  name: O.name,
2048
2059
  date: L.format(),
2049
- hour: Number(Y),
2060
+ hour: 0,
2050
2061
  format: L.format("MMM-DD/HHmm[Z]"),
2051
- pressure: d.pressure > 1e4 ? X.roundPrecision(d.pressure / 100, 0) : X.roundPrecision(d.pressure, 0),
2052
- gusts: d.gusts,
2053
- wind: d.wind || {},
2054
- movement: d.movement,
2055
- category: q,
2062
+ pressure: A.pressure > 1e4 ? X.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : X.roundPrecision(A.pressure, 0),
2063
+ wind: A.wind,
2064
+ movement: d,
2065
+ category: Y,
2056
2066
  type: "forecast"
2057
2067
  });
2058
- z.features.push(T), c.push(T.geometry.coordinates);
2068
+ z.features.push(T), o.push(T.geometry.coordinates);
2059
2069
  }
2060
- if ((c == null ? void 0 : c.length) > 1) {
2061
- const Y = e.lineString(X.convertToMonotonicLng2(c), {
2070
+ if ((o == null ? void 0 : o.length) > 1) {
2071
+ const L = e.lineString(X.convertToMonotonicLng2(o), {
2062
2072
  date: b.date,
2063
2073
  id: O.id || O.name,
2064
2074
  model: b.model,
2065
2075
  name: O.name,
2066
- category: q,
2067
- type: "forecast"
2076
+ category: Y,
2077
+ type: "forecast",
2078
+ movement: d
2068
2079
  });
2069
- z.features.push(Y);
2080
+ z.features.push(L);
2070
2081
  }
2071
2082
  }
2072
2083
  }
2073
2084
  if (O.history) {
2074
2085
  const A = [];
2075
- for (const c of O.history) {
2076
- const o = m(c.updated).utc(), q = e.point([c.lng, c.lat], {
2086
+ for (const W of O.history) {
2087
+ const o = m(W.updated).utc(), q = e.point([W.lng, W.lat], {
2077
2088
  name: O.name,
2078
2089
  date: o.format(),
2079
2090
  format: o.format("MMM-DD/HHmm[Z]"),
2080
- pressure: c.pressure > 1e4 ? X.roundPrecision(c.pressure / 100, 0) : X.roundPrecision(c.pressure, 0),
2081
- spd: c.speed || c.spd,
2082
- kts: c.kts,
2083
- source: c.source,
2084
- level: c.type,
2091
+ pressure: W.pressure > 1e4 ? X.roundPrecision(W.pressure / 100, 0) : X.roundPrecision(W.pressure, 0),
2092
+ kts: W.kts,
2093
+ level: W.type,
2085
2094
  type: "history",
2086
2095
  category: `${O.name}-history`,
2087
- wind: c.wind
2096
+ wind: W.wind,
2097
+ movement: W.movement
2088
2098
  });
2089
2099
  z.features.push(q), A.push(q.geometry.coordinates);
2090
2100
  }
2091
2101
  const b = O.history[0];
2092
2102
  if (A.length === 1 && A.push(A[0]), A.length > 1) {
2093
- const c = e.lineString(X.convertToMonotonicLng2(A), {
2103
+ const W = e.lineString(X.convertToMonotonicLng2(A), {
2094
2104
  name: O.name,
2095
2105
  type: "history",
2096
2106
  updated: b == null ? void 0 : b.updated,
2097
2107
  pressure: (b == null ? void 0 : b.pressure) > 1e4 ? X.roundPrecision((b == null ? void 0 : b.pressure) / 100, 0) : X.roundPrecision(b == null ? void 0 : b.pressure, 0),
2098
- spd: (b == null ? void 0 : b.speed) || (b == null ? void 0 : b.spd),
2099
2108
  kts: b == null ? void 0 : b.kts,
2100
- source: b == null ? void 0 : b.source,
2101
2109
  level: b == null ? void 0 : b.type
2102
2110
  });
2103
- z.features.push(c);
2111
+ z.features.push(W);
2104
2112
  }
2105
2113
  }
2106
2114
  }
@@ -2112,35 +2120,35 @@ class t0 {
2112
2120
  * @param step
2113
2121
  */
2114
2122
  static interpolate(M, z = 3) {
2115
- var A, b, c, o;
2123
+ var A, b, W, o;
2116
2124
  const p = (A = M == null ? void 0 : M.data) == null ? void 0 : A.features.filter((q) => q.geometry.type === "LineString" && q.properties.type === "forecast"), O = [];
2117
2125
  for (const q of p) {
2118
- const Y = q.properties.name, d = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, U = m(q.properties.date).utc();
2119
- let r = z * 60 - (U.get("hour") * 60 + U.get("minute")) % (z * 60);
2126
+ const Y = q.properties.name, d = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, f = m(q.properties.date).utc();
2127
+ let S = z * 60 - (f.get("hour") * 60 + f.get("minute")) % (z * 60);
2120
2128
  const s = (b = M == null ? void 0 : M.data) == null ? void 0 : b.features.filter(
2121
2129
  (l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${Y}-${d}`
2122
2130
  );
2123
- let P, I = U.clone().add(r, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2131
+ let P, I = f.clone().add(S, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2124
2132
  for (; P = this.pickIndex(s, I), P <= s.length - 1; ) {
2125
2133
  if (P > 0) {
2126
- const l = s[P], f = P === 0 ? void 0 : s[P - 1], G = (r / 60 - ((c = f == null ? void 0 : f.properties) == null ? void 0 : c.hour)) / (l.properties.hour - ((o = f == null ? void 0 : f.properties) == null ? void 0 : o.hour)), H = this.computeNumber(f == null ? void 0 : f.geometry.coordinates[0], l.geometry.coordinates[0], G), Q = this.computeNumber(f == null ? void 0 : f.geometry.coordinates[1], l.geometry.coordinates[1], G), F = e.point([H, Q], {
2134
+ const l = s[P], B = P === 0 ? void 0 : s[P - 1], G = (S / 60 - ((W = B == null ? void 0 : B.properties) == null ? void 0 : W.hour)) / (l.properties.hour - ((o = B == null ? void 0 : B.properties) == null ? void 0 : o.hour)), H = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[0], l.geometry.coordinates[0], G), Q = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[1], l.geometry.coordinates[1], G), F = e.point([H, Q], {
2127
2135
  name: Y,
2128
2136
  model: d,
2129
2137
  category: l == null ? void 0 : l.properties.category,
2130
2138
  date: I.format(),
2131
2139
  format: I.format("MMM-DD/HHmm[Z]"),
2132
- gusts: this.computeNumber(f == null ? void 0 : f.properties.gusts, l.properties.gusts, G),
2133
- hour: this.computeNumber(f == null ? void 0 : f.properties.hour, l.properties.hour, G),
2134
- movement: this.computeNumber(f == null ? void 0 : f.properties.movement, l.properties.movement, G),
2135
- pressure: this.computeNumber(f == null ? void 0 : f.properties.pressure, l.properties.pressure, G),
2136
- wind: this.computeNumber(f == null ? void 0 : f.properties.wind, l.properties.wind, G),
2140
+ gusts: this.computeNumber(B == null ? void 0 : B.properties.gusts, l.properties.gusts, G),
2141
+ hour: this.computeNumber(B == null ? void 0 : B.properties.hour, l.properties.hour, G),
2142
+ movement: this.computeNumber(B == null ? void 0 : B.properties.movement, l.properties.movement, G),
2143
+ pressure: this.computeNumber(B == null ? void 0 : B.properties.pressure, l.properties.pressure, G),
2144
+ wind: this.computeNumber(B == null ? void 0 : B.properties.wind, l.properties.wind, G),
2137
2145
  type: "forecast",
2138
2146
  disabled: T,
2139
2147
  showCircle: L
2140
2148
  });
2141
2149
  O.push(F);
2142
2150
  }
2143
- r += z * 60, I = U.clone().add(r, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2151
+ S += z * 60, I = f.clone().add(S, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2144
2152
  }
2145
2153
  }
2146
2154
  return O;
@@ -2167,16 +2175,16 @@ class t0 {
2167
2175
  * @param options
2168
2176
  */
2169
2177
  static diversionPassageAt(M, z, p, O = {}) {
2170
- const { t1: A, t2: b, hr: c, hours: o } = this.tropicalCenterTwin(z, 24, O);
2178
+ const { t1: A, t2: b, hr: W, hours: o } = this.tropicalCenterTwin(z, 24, O);
2171
2179
  if (A && b) {
2172
2180
  if (!O.debug) {
2173
- const U = N.calculateDistance(M, A), r = N.calculateDistance(M, b);
2174
- if (U > 2 * p && r > 2 * p)
2175
- return Z == null || Z.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", O.requestId, U, r, {
2181
+ const f = N.calculateDistance(M, A), S = N.calculateDistance(M, b);
2182
+ if (f > 2 * p && S > 2 * p)
2183
+ return Z == null || Z.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", O.requestId, f, S, {
2176
2184
  from: M,
2177
2185
  t1: A,
2178
2186
  t2: b,
2179
- hr: c
2187
+ hr: W
2180
2188
  }), {};
2181
2189
  }
2182
2190
  const q = N.calculateBearing(M, A), Y = N.calculateBearing(A, b), d = Math.abs(q - Y);
@@ -2191,7 +2199,7 @@ class t0 {
2191
2199
  bearing1: q,
2192
2200
  bearing2: Y,
2193
2201
  right: T
2194
- }), { at: T, t1: A, t2: b, hr: Number(c), hours: o };
2202
+ }), { at: T, t1: A, t2: b, hr: Number(W), hours: o };
2195
2203
  }
2196
2204
  return {};
2197
2205
  }
@@ -2206,22 +2214,22 @@ class t0 {
2206
2214
  * @param options
2207
2215
  */
2208
2216
  static driftPassageAt(M, z, p, O = {}) {
2209
- const { t1: A, t2: b, hr: c, hours: o } = this.tropicalCenterTwin(z, 24, O);
2217
+ const { t1: A, t2: b, hr: W, hours: o } = this.tropicalCenterTwin(z, 24, O);
2210
2218
  if (A && b) {
2211
2219
  if (!O.debug) {
2212
- const T = N.calculateDistance(M, A), U = N.calculateDistance(M, b);
2213
- if (T > 2 * p && U > 2 * p)
2214
- return Z == null || Z.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", O.requestId, T, U, {
2220
+ const T = N.calculateDistance(M, A), f = N.calculateDistance(M, b);
2221
+ if (T > 2 * p && f > 2 * p)
2222
+ return Z == null || Z.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", O.requestId, T, f, {
2215
2223
  from: M,
2216
2224
  t1: A,
2217
2225
  t2: b,
2218
- hr: c
2226
+ hr: W
2219
2227
  }), {};
2220
2228
  }
2221
2229
  const q = N.calculateBearing(M, A), Y = N.calculateBearing(A, b), d = N.calculateDistance(M, A);
2222
- return { at: N.calculateCoordinate(A, q - Y + 180, p < d ? p : d), t1: A, t2: b, hr: Number(c), hours: o };
2230
+ return { at: N.calculateCoordinate(A, q - Y + 180, p < d ? p : d), t1: A, t2: b, hr: Number(W), hours: o };
2223
2231
  } else
2224
- return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: c }), {};
2232
+ return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: W }), {};
2225
2233
  }
2226
2234
  /**
2227
2235
  * 获取台风中心点对
@@ -2232,21 +2240,21 @@ class t0 {
2232
2240
  * @private
2233
2241
  */
2234
2242
  static tropicalCenterTwin(M, z = 24, p = {}) {
2235
- var Y, d, L, T, U;
2243
+ var Y, d, L, T, f;
2236
2244
  let O = {};
2237
- (Y = M.forecasts) == null || Y.forEach((r) => {
2238
- O = { ...r.hours, ...O };
2245
+ (Y = M.forecasts) == null || Y.forEach((S) => {
2246
+ O = { ...S.hours, ...O };
2239
2247
  });
2240
2248
  const A = ((d = M == null ? void 0 : M.history) == null ? void 0 : d[0]) || (O == null ? void 0 : O[(L = Object.keys(O)) == null ? void 0 : L[0]]);
2241
2249
  Z == null || Z.info("[%s] the first tropical center: %j", p.requestId, A);
2242
- let b = (T = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2243
- b || (b = (U = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : U.at(-1));
2244
- const c = O == null ? void 0 : O[b || -1];
2245
- Z == null || Z.info("[%s] the second tropical center: %j in %d hrs", p.requestId, c, b);
2246
- const o = Object.keys(O || {}).filter((r) => Number(r) <= Number(b)), q = { 0: A };
2247
- for (const r of o)
2248
- q[r] = O[r];
2249
- return { t1: A, t2: c, hr: Number(b), hours: q };
2250
+ let b = (T = Object.keys(O || {}).filter((S) => Number(S) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2251
+ b || (b = (f = Object.keys(O || {}).filter((S) => Number(S) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : f.at(-1));
2252
+ const W = O == null ? void 0 : O[b || -1];
2253
+ Z == null || Z.info("[%s] the second tropical center: %j in %d hrs", p.requestId, W, b);
2254
+ const o = Object.keys(O || {}).filter((S) => Number(S) <= Number(b)), q = { 0: A };
2255
+ for (const S of o)
2256
+ q[S] = O[S];
2257
+ return { t1: A, t2: W, hr: Number(b), hours: q };
2250
2258
  }
2251
2259
  static pickIndex(M, z) {
2252
2260
  let p = 0;
@@ -2279,14 +2287,14 @@ class V0 {
2279
2287
  return `${M.lat}|${M.lng}|${M.positionTime}|${M.sog}|${M.cog}|${M.hdg}|${M.draught}|${z}|${JSON.stringify(M.meteo || {})}|${M.vendor}|${M.deleted}`;
2280
2288
  }
2281
2289
  static str2Json(M) {
2282
- const [z, p, O, A, b, c, o, q, Y, d, L] = M.split("|");
2290
+ const [z, p, O, A, b, W, o, q, Y, d, L] = M.split("|");
2283
2291
  return {
2284
2292
  lat: Number(z),
2285
2293
  lng: Number(p),
2286
2294
  positionTime: Number(O),
2287
2295
  sog: Number(A),
2288
2296
  cog: Number(b),
2289
- hdg: Number(c),
2297
+ hdg: Number(W),
2290
2298
  //@ts-ignore
2291
2299
  draught: isNaN(o) ? null : Number(o),
2292
2300
  type: q,
@@ -2300,7 +2308,7 @@ class V0 {
2300
2308
  const O = M.at(0).positionTime < M.at(-1).positionTime;
2301
2309
  O || M.sort((o, q) => o.positionTime - q.positionTime);
2302
2310
  const A = [];
2303
- let b, c;
2311
+ let b, W;
2304
2312
  for (let o = 0; o < M.length - 1; o++) {
2305
2313
  const q = M[o];
2306
2314
  if (!(p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))) {
@@ -2310,13 +2318,13 @@ class V0 {
2310
2318
  continue;
2311
2319
  const T = L.positionTime - d.positionTime;
2312
2320
  if (N.calculateDistance(L, d, !0, 4) / (T / 3600) < z)
2313
- b || (b = q), Y === M.length - 1 && (c = L, o = Y);
2321
+ b || (b = q), Y === M.length - 1 && (W = L, o = Y);
2314
2322
  else {
2315
- b && (c = M[Y - 1], o = Y);
2323
+ b && (W = M[Y - 1], o = Y);
2316
2324
  break;
2317
2325
  }
2318
2326
  }
2319
- if ((c == null ? void 0 : c.positionTime) > (b == null ? void 0 : b.positionTime) && b) {
2327
+ if ((W == null ? void 0 : W.positionTime) > (b == null ? void 0 : b.positionTime) && b) {
2320
2328
  const Y = {
2321
2329
  start: {
2322
2330
  lat: b.lat,
@@ -2326,17 +2334,17 @@ class V0 {
2326
2334
  utc: m.unix(b.positionTime).utc().format()
2327
2335
  },
2328
2336
  end: {
2329
- lat: c.lat,
2330
- lng: c.lng,
2331
- sog: c.sog,
2332
- positionTime: c.positionTime,
2333
- utc: m.unix(c.positionTime).utc().format()
2337
+ lat: W.lat,
2338
+ lng: W.lng,
2339
+ sog: W.sog,
2340
+ positionTime: W.positionTime,
2341
+ utc: m.unix(W.positionTime).utc().format()
2334
2342
  },
2335
- duration: c.positionTime - b.positionTime
2343
+ duration: W.positionTime - b.positionTime
2336
2344
  }, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), L = N.divideAccordingToLng(d);
2337
2345
  Y.distance = N.calculateRouteDistance(L), Y.hours = Math.round(Y.duration / 3600 * 10) / 10, Y.avgSog = Math.round(Y.distance / Y.hours * 10) / 10, A.push(Y);
2338
2346
  }
2339
- b = void 0, c = void 0;
2347
+ b = void 0, W = void 0;
2340
2348
  }
2341
2349
  }
2342
2350
  return O || M.sort((o, q) => q.positionTime - o.positionTime), A;