@idm-plugin/geo 1.7.8 → 1.7.9

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,38 +16,38 @@ 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++)
26
+ function T(c) {
27
+ var a = 0, n = c.split("."), R = n[0], i = n[1] || "", S = 1, V, B = 0, t = 1;
28
+ for (c.charCodeAt(0) === 45 && (a = 1, t = -1), a; a < R.length; a++)
29
29
  V = L(R.charCodeAt(a)), B = 60 * B + V;
30
30
  for (a = 0; a < i.length; a++)
31
31
  S = S / 60, V = L(i.charCodeAt(a)), B += V * S;
32
32
  return B * t;
33
33
  }
34
- function U(W) {
35
- for (var a = 0; a < W.length; a++)
36
- W[a] = T(W[a]);
34
+ function U(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 r(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(" ");
49
+ function P(c) {
50
+ var a = c.split("|"), n = a[2].split(" "), R = a[3].split(""), i = a[4].split(" ");
51
51
  return U(n), U(R), U(i), r(i, R.length), {
52
52
  name: a[0],
53
53
  abbrs: s(a[1].split(" "), R),
@@ -56,92 +56,92 @@ 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
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;
71
+ R = Math.floor((i + S) / 2), a[R] <= c ? i = R : S = R;
72
72
  return S;
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, S, V, B, t;
91
91
  for (t = 0; t < i; t++)
92
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)
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 f(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;
125
+ var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new G(new Date(c, 0, 1)), n = a.offset, R = [a], i, S, V, B;
126
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);
127
+ V = new Date(c, B, 1).getTimezoneOffset(), V !== n && (S = new G(new Date(c, B, 1)), i = Q(a, S), R.push(i), R.push(new G(new Date(i.at + 6e4))), a = S, n = V);
128
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)));
129
+ R.push(new G(new Date(c + B, 0, 1))), R.push(new G(new Date(c + B, 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
137
  for (U(a), n = 0; n < a.length; n++)
138
- R = a[n], c[R] = c[R] || {}, c[R][W] = !0;
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;
140
+ function b0(c) {
141
+ var a = c.length, n = {}, R = [], i = {}, S, V, B, t;
142
142
  for (S = 0; S < a; S++)
143
- if (B = W[S].offset, !i.hasOwnProperty(B)) {
144
- t = c[B] || {};
143
+ if (B = c[S].offset, !i.hasOwnProperty(B)) {
144
+ t = W[B] || {};
145
145
  for (V in t)
146
146
  t.hasOwnProperty(V) && (n[V] = !0);
147
147
  i[B] = !0;
@@ -152,12 +152,12 @@ var j = { exports: {} };
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
  }
@@ -169,52 +169,52 @@ var j = { exports: {} };
169
169
  }
170
170
  return S.sort(M0), S.length > 0 ? S[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 f(
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([
@@ -1432,10 +1432,10 @@ class N {
1432
1432
  const U = e.getCoord(L.features[0]);
1433
1433
  T = X.roundPrecision(U[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,10 +1765,10 @@ 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;
1768
+ let W = [], o = !1, q = 0, Y = 0, d;
1769
1769
  if (z && p.length ? (b.push(M), p.forEach((T, U) => {
1770
1770
  if (o)
1771
- c.push(T);
1771
+ W.push(T);
1772
1772
  else {
1773
1773
  const r = [];
1774
1774
  let s;
@@ -1790,15 +1790,15 @@ class N {
1790
1790
  o = !0;
1791
1791
  }
1792
1792
  }
1793
- r.length && c.push(r), U === p.length - 1 && !d && (d = s);
1793
+ r.length && W.push(r), U === 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), 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(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,8 +1979,8 @@ 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;
@@ -2021,9 +2021,9 @@ 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}`;
2026
+ const W = [], o = m(b.date).utc(), q = `${O.name}-${b.model}`;
2027
2027
  if (A) {
2028
2028
  const Y = m(A.updated).utc(), d = e.point([A.lng, A.lat], {
2029
2029
  model: b.model,
@@ -2037,12 +2037,10 @@ class t0 {
2037
2037
  category: q,
2038
2038
  type: "forecast"
2039
2039
  });
2040
- z.features.push(d), c.push(d.geometry.coordinates);
2040
+ z.features.push(d), W.push(d.geometry.coordinates);
2041
2041
  }
2042
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], {
2043
+ const d = b.hours[Y], L = o.clone().add(Number(Y), "hour"), T = e.point([d.lng, d.lat], {
2046
2044
  model: b.model,
2047
2045
  name: O.name,
2048
2046
  date: L.format(),
@@ -2055,10 +2053,10 @@ class t0 {
2055
2053
  category: q,
2056
2054
  type: "forecast"
2057
2055
  });
2058
- z.features.push(T), c.push(T.geometry.coordinates);
2056
+ z.features.push(T), W.push(T.geometry.coordinates);
2059
2057
  }
2060
- if ((c == null ? void 0 : c.length) > 1) {
2061
- const Y = e.lineString(X.convertToMonotonicLng2(c), {
2058
+ if ((W == null ? void 0 : W.length) > 1) {
2059
+ const Y = e.lineString(X.convertToMonotonicLng2(W), {
2062
2060
  date: b.date,
2063
2061
  id: O.id || O.name,
2064
2062
  model: b.model,
@@ -2072,35 +2070,32 @@ class t0 {
2072
2070
  }
2073
2071
  if (O.history) {
2074
2072
  const A = [];
2075
- for (const c of O.history) {
2076
- const o = m(c.updated).utc(), q = e.point([c.lng, c.lat], {
2073
+ for (const W of O.history) {
2074
+ const o = m(W.updated).utc(), q = e.point([W.lng, W.lat], {
2077
2075
  name: O.name,
2078
2076
  date: o.format(),
2079
2077
  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,
2078
+ pressure: W.pressure > 1e4 ? X.roundPrecision(W.pressure / 100, 0) : X.roundPrecision(W.pressure, 0),
2079
+ kts: W.kts,
2080
+ level: W.type,
2085
2081
  type: "history",
2086
2082
  category: `${O.name}-history`,
2087
- wind: c.wind
2083
+ wind: W.wind,
2084
+ movement: W.movement
2088
2085
  });
2089
2086
  z.features.push(q), A.push(q.geometry.coordinates);
2090
2087
  }
2091
2088
  const b = O.history[0];
2092
2089
  if (A.length === 1 && A.push(A[0]), A.length > 1) {
2093
- const c = e.lineString(X.convertToMonotonicLng2(A), {
2090
+ const W = e.lineString(X.convertToMonotonicLng2(A), {
2094
2091
  name: O.name,
2095
2092
  type: "history",
2096
2093
  updated: b == null ? void 0 : b.updated,
2097
2094
  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
2095
  kts: b == null ? void 0 : b.kts,
2100
- source: b == null ? void 0 : b.source,
2101
2096
  level: b == null ? void 0 : b.type
2102
2097
  });
2103
- z.features.push(c);
2098
+ z.features.push(W);
2104
2099
  }
2105
2100
  }
2106
2101
  }
@@ -2112,7 +2107,7 @@ class t0 {
2112
2107
  * @param step
2113
2108
  */
2114
2109
  static interpolate(M, z = 3) {
2115
- var A, b, c, o;
2110
+ var A, b, W, o;
2116
2111
  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
2112
  for (const q of p) {
2118
2113
  const Y = q.properties.name, d = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, U = m(q.properties.date).utc();
@@ -2123,7 +2118,7 @@ class t0 {
2123
2118
  let P, I = U.clone().add(r, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2124
2119
  for (; P = this.pickIndex(s, I), P <= s.length - 1; ) {
2125
2120
  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], {
2121
+ const l = s[P], f = P === 0 ? void 0 : s[P - 1], G = (r / 60 - ((W = f == null ? void 0 : f.properties) == null ? void 0 : W.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], {
2127
2122
  name: Y,
2128
2123
  model: d,
2129
2124
  category: l == null ? void 0 : l.properties.category,
@@ -2167,7 +2162,7 @@ class t0 {
2167
2162
  * @param options
2168
2163
  */
2169
2164
  static diversionPassageAt(M, z, p, O = {}) {
2170
- const { t1: A, t2: b, hr: c, hours: o } = this.tropicalCenterTwin(z, 24, O);
2165
+ const { t1: A, t2: b, hr: W, hours: o } = this.tropicalCenterTwin(z, 24, O);
2171
2166
  if (A && b) {
2172
2167
  if (!O.debug) {
2173
2168
  const U = N.calculateDistance(M, A), r = N.calculateDistance(M, b);
@@ -2176,7 +2171,7 @@ class t0 {
2176
2171
  from: M,
2177
2172
  t1: A,
2178
2173
  t2: b,
2179
- hr: c
2174
+ hr: W
2180
2175
  }), {};
2181
2176
  }
2182
2177
  const q = N.calculateBearing(M, A), Y = N.calculateBearing(A, b), d = Math.abs(q - Y);
@@ -2191,7 +2186,7 @@ class t0 {
2191
2186
  bearing1: q,
2192
2187
  bearing2: Y,
2193
2188
  right: T
2194
- }), { at: T, t1: A, t2: b, hr: Number(c), hours: o };
2189
+ }), { at: T, t1: A, t2: b, hr: Number(W), hours: o };
2195
2190
  }
2196
2191
  return {};
2197
2192
  }
@@ -2206,7 +2201,7 @@ class t0 {
2206
2201
  * @param options
2207
2202
  */
2208
2203
  static driftPassageAt(M, z, p, O = {}) {
2209
- const { t1: A, t2: b, hr: c, hours: o } = this.tropicalCenterTwin(z, 24, O);
2204
+ const { t1: A, t2: b, hr: W, hours: o } = this.tropicalCenterTwin(z, 24, O);
2210
2205
  if (A && b) {
2211
2206
  if (!O.debug) {
2212
2207
  const T = N.calculateDistance(M, A), U = N.calculateDistance(M, b);
@@ -2215,13 +2210,13 @@ class t0 {
2215
2210
  from: M,
2216
2211
  t1: A,
2217
2212
  t2: b,
2218
- hr: c
2213
+ hr: W
2219
2214
  }), {};
2220
2215
  }
2221
2216
  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 };
2217
+ return { at: N.calculateCoordinate(A, q - Y + 180, p < d ? p : d), t1: A, t2: b, hr: Number(W), hours: o };
2223
2218
  } else
2224
- return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: c }), {};
2219
+ return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: W }), {};
2225
2220
  }
2226
2221
  /**
2227
2222
  * 获取台风中心点对
@@ -2241,12 +2236,12 @@ class t0 {
2241
2236
  Z == null || Z.info("[%s] the first tropical center: %j", p.requestId, A);
2242
2237
  let b = (T = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2243
2238
  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);
2239
+ const W = O == null ? void 0 : O[b || -1];
2240
+ Z == null || Z.info("[%s] the second tropical center: %j in %d hrs", p.requestId, W, b);
2246
2241
  const o = Object.keys(O || {}).filter((r) => Number(r) <= Number(b)), q = { 0: A };
2247
2242
  for (const r of o)
2248
2243
  q[r] = O[r];
2249
- return { t1: A, t2: c, hr: Number(b), hours: q };
2244
+ return { t1: A, t2: W, hr: Number(b), hours: q };
2250
2245
  }
2251
2246
  static pickIndex(M, z) {
2252
2247
  let p = 0;
@@ -2279,14 +2274,14 @@ class V0 {
2279
2274
  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
2275
  }
2281
2276
  static str2Json(M) {
2282
- const [z, p, O, A, b, c, o, q, Y, d, L] = M.split("|");
2277
+ const [z, p, O, A, b, W, o, q, Y, d, L] = M.split("|");
2283
2278
  return {
2284
2279
  lat: Number(z),
2285
2280
  lng: Number(p),
2286
2281
  positionTime: Number(O),
2287
2282
  sog: Number(A),
2288
2283
  cog: Number(b),
2289
- hdg: Number(c),
2284
+ hdg: Number(W),
2290
2285
  //@ts-ignore
2291
2286
  draught: isNaN(o) ? null : Number(o),
2292
2287
  type: q,
@@ -2300,7 +2295,7 @@ class V0 {
2300
2295
  const O = M.at(0).positionTime < M.at(-1).positionTime;
2301
2296
  O || M.sort((o, q) => o.positionTime - q.positionTime);
2302
2297
  const A = [];
2303
- let b, c;
2298
+ let b, W;
2304
2299
  for (let o = 0; o < M.length - 1; o++) {
2305
2300
  const q = M[o];
2306
2301
  if (!(p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))) {
@@ -2310,13 +2305,13 @@ class V0 {
2310
2305
  continue;
2311
2306
  const T = L.positionTime - d.positionTime;
2312
2307
  if (N.calculateDistance(L, d, !0, 4) / (T / 3600) < z)
2313
- b || (b = q), Y === M.length - 1 && (c = L, o = Y);
2308
+ b || (b = q), Y === M.length - 1 && (W = L, o = Y);
2314
2309
  else {
2315
- b && (c = M[Y - 1], o = Y);
2310
+ b && (W = M[Y - 1], o = Y);
2316
2311
  break;
2317
2312
  }
2318
2313
  }
2319
- if ((c == null ? void 0 : c.positionTime) > (b == null ? void 0 : b.positionTime) && b) {
2314
+ if ((W == null ? void 0 : W.positionTime) > (b == null ? void 0 : b.positionTime) && b) {
2320
2315
  const Y = {
2321
2316
  start: {
2322
2317
  lat: b.lat,
@@ -2326,17 +2321,17 @@ class V0 {
2326
2321
  utc: m.unix(b.positionTime).utc().format()
2327
2322
  },
2328
2323
  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()
2324
+ lat: W.lat,
2325
+ lng: W.lng,
2326
+ sog: W.sog,
2327
+ positionTime: W.positionTime,
2328
+ utc: m.unix(W.positionTime).utc().format()
2334
2329
  },
2335
- duration: c.positionTime - b.positionTime
2330
+ duration: W.positionTime - b.positionTime
2336
2331
  }, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), L = N.divideAccordingToLng(d);
2337
2332
  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
2333
  }
2339
- b = void 0, c = void 0;
2334
+ b = void 0, W = void 0;
2340
2335
  }
2341
2336
  }
2342
2337
  return O || M.sort((o, q) => q.positionTime - o.positionTime), A;