@idm-plugin/geo 1.6.8 → 1.6.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
@@ -1,4 +1,4 @@
1
- import * as i from "@turf/turf";
1
+ import * as e from "@turf/turf";
2
2
  import C from "moment";
3
3
  import _ from "@log4js-node/log4js-api";
4
4
  var X0 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
@@ -18,57 +18,57 @@ var j = { exports: {} };
18
18
  M.version === void 0 && M.default && (M = M.default);
19
19
  var z = "0.5.45", p = {}, O = {}, A = {}, b = {}, W = {}, q;
20
20
  (!M || typeof M.version != "string") && D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
21
- var o = M.version.split("."), R = +o[0], Y = +o[1];
22
- (R < 2 || R === 2 && Y < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
21
+ var o = M.version.split("."), d = +o[0], Y = +o[1];
22
+ (d < 2 || d === 2 && Y < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
23
23
  function L(c) {
24
24
  return c > 96 ? c - 87 : c > 64 ? c - 29 : c - 48;
25
25
  }
26
- function e(c) {
27
- var d = 0, X = c.split("."), n = X[0], T = X[1] || "", f = 1, t, B = 0, V = 1;
28
- for (c.charCodeAt(0) === 45 && (d = 1, V = -1), d; d < n.length; d++)
29
- t = L(n.charCodeAt(d)), B = 60 * B + t;
30
- for (d = 0; d < T.length; d++)
31
- f = f / 60, t = L(T.charCodeAt(d)), B += t * f;
32
- return B * V;
26
+ function i(c) {
27
+ var X = 0, a = c.split("."), n = a[0], T = a[1] || "", f = 1, t, S = 0, V = 1;
28
+ for (c.charCodeAt(0) === 45 && (X = 1, V = -1), X; X < n.length; X++)
29
+ t = L(n.charCodeAt(X)), S = 60 * S + t;
30
+ for (X = 0; X < T.length; X++)
31
+ f = f / 60, t = L(T.charCodeAt(X)), S += t * f;
32
+ return S * V;
33
33
  }
34
- function u(c) {
35
- for (var d = 0; d < c.length; d++)
36
- c[d] = e(c[d]);
34
+ function U(c) {
35
+ for (var X = 0; X < c.length; X++)
36
+ c[X] = i(c[X]);
37
37
  }
38
- function S(c, d) {
39
- for (var X = 0; X < d; X++)
40
- c[X] = Math.round((c[X - 1] || 0) + c[X] * 6e4);
41
- c[d - 1] = 1 / 0;
38
+ function r(c, X) {
39
+ for (var a = 0; a < X; a++)
40
+ c[a] = Math.round((c[a - 1] || 0) + c[a] * 6e4);
41
+ c[X - 1] = 1 / 0;
42
42
  }
43
- function s(c, d) {
44
- var X = [], n;
45
- for (n = 0; n < d.length; n++)
46
- X[n] = c[d[n]];
47
- return X;
43
+ function s(c, X) {
44
+ var a = [], n;
45
+ for (n = 0; n < X.length; n++)
46
+ a[n] = c[X[n]];
47
+ return a;
48
48
  }
49
49
  function P(c) {
50
- var d = c.split("|"), X = d[2].split(" "), n = d[3].split(""), T = d[4].split(" ");
51
- return u(X), u(n), u(T), S(T, n.length), {
52
- name: d[0],
53
- abbrs: s(d[1].split(" "), n),
54
- offsets: s(X, n),
50
+ var X = c.split("|"), a = X[2].split(" "), n = X[3].split(""), T = X[4].split(" ");
51
+ return U(a), U(n), U(T), r(T, n.length), {
52
+ name: X[0],
53
+ abbrs: s(X[1].split(" "), n),
54
+ offsets: s(a, n),
55
55
  untils: T,
56
- population: d[5] | 0
56
+ population: X[5] | 0
57
57
  };
58
58
  }
59
59
  function G(c) {
60
60
  c && this._set(P(c));
61
61
  }
62
- function l(c, d) {
63
- var X = d.length;
64
- if (c < d[0])
62
+ function l(c, X) {
63
+ var a = X.length;
64
+ if (c < X[0])
65
65
  return 0;
66
- if (X > 1 && d[X - 1] === 1 / 0 && c >= d[X - 2])
67
- return X - 1;
68
- if (c >= d[X - 1])
66
+ if (a > 1 && X[a - 1] === 1 / 0 && c >= X[a - 2])
67
+ return a - 1;
68
+ if (c >= X[a - 1])
69
69
  return -1;
70
- for (var n, T = 0, f = X - 1; f - T > 1; )
71
- n = Math.floor((T + f) / 2), d[n] <= c ? T = n : f = n;
70
+ for (var n, T = 0, f = a - 1; f - T > 1; )
71
+ n = Math.floor((T + f) / 2), X[n] <= c ? T = n : f = n;
72
72
  return f;
73
73
  }
74
74
  G.prototype = {
@@ -76,22 +76,22 @@ var j = { exports: {} };
76
76
  this.name = c.name, this.abbrs = c.abbrs, this.untils = c.untils, this.offsets = c.offsets, this.population = c.population;
77
77
  },
78
78
  _index: function(c) {
79
- var d = +c, X = this.untils, n;
80
- if (n = l(d, X), n >= 0)
79
+ var X = +c, a = this.untils, n;
80
+ if (n = l(X, a), n >= 0)
81
81
  return n;
82
82
  },
83
83
  countries: function() {
84
84
  var c = this.name;
85
- return Object.keys(A).filter(function(d) {
86
- return A[d].zones.indexOf(c) !== -1;
85
+ return Object.keys(A).filter(function(X) {
86
+ return A[X].zones.indexOf(c) !== -1;
87
87
  });
88
88
  },
89
89
  parse: function(c) {
90
- var d = +c, X = this.offsets, n = this.untils, T = n.length - 1, f, t, B, V;
90
+ var X = +c, a = this.offsets, n = this.untils, T = n.length - 1, f, t, S, V;
91
91
  for (V = 0; V < T; V++)
92
- if (f = X[V], t = X[V + 1], B = X[V && V - 1], f < t && U.moveAmbiguousForward ? f = t : f > B && U.moveInvalidForward && (f = B), d < n[V] - f * 6e4)
93
- return X[V];
94
- return X[T];
92
+ if (f = a[V], t = a[V + 1], S = a[V && V - 1], f < t && u.moveAmbiguousForward ? f = t : f > S && u.moveInvalidForward && (f = S), X < n[V] - f * 6e4)
93
+ return a[V];
94
+ return a[T];
95
95
  },
96
96
  abbr: function(c) {
97
97
  return this.abbrs[this._index(c)];
@@ -103,12 +103,12 @@ var j = { exports: {} };
103
103
  return this.offsets[this._index(c)];
104
104
  }
105
105
  };
106
- function N(c, d) {
107
- this.name = c, this.zones = d;
106
+ function B(c, X) {
107
+ this.name = c, this.zones = X;
108
108
  }
109
109
  function I(c) {
110
- var d = c.toTimeString(), X = d.match(/\([a-z ]+\)/i);
111
- X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X = d.match(/[A-Z]{3,5}/g), X = X ? X[0] : void 0), X === "GMT" && (X = void 0), this.at = +c, this.abbr = X, this.offset = c.getTimezoneOffset();
110
+ var X = c.toTimeString(), a = X.match(/\([a-z ]+\)/i);
111
+ a && a[0] ? (a = a[0].match(/[A-Z]/g), a = a ? a.join("") : void 0) : (a = X.match(/[A-Z]{3,5}/g), a = a ? a[0] : void 0), a === "GMT" && (a = void 0), this.at = +c, this.abbr = a, this.offset = c.getTimezoneOffset();
112
112
  }
113
113
  function H(c) {
114
114
  this.zone = c, this.offsetScore = 0, this.abbrScore = 0;
@@ -116,55 +116,55 @@ var j = { exports: {} };
116
116
  H.prototype.scoreOffsetAt = function(c) {
117
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(c, d) {
120
- for (var X, n; n = ((d.at - c.at) / 12e4 | 0) * 6e4; )
121
- X = new I(new Date(c.at + n)), X.offset === c.offset ? c = X : d = X;
119
+ function Q(c, X) {
120
+ for (var a, n; n = ((X.at - c.at) / 12e4 | 0) * 6e4; )
121
+ a = new I(new Date(c.at + n)), a.offset === c.offset ? c = a : X = a;
122
122
  return c;
123
123
  }
124
124
  function F() {
125
- var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, d = new I(new Date(c, 0, 1)), X = d.offset, n = [d], T, f, t, B;
126
- for (B = 1; B < 48; B++)
127
- t = new Date(c, B, 1).getTimezoneOffset(), t !== X && (f = new I(new Date(c, B, 1)), T = Q(d, f), n.push(T), n.push(new I(new Date(T.at + 6e4))), d = f, X = t);
128
- for (B = 0; B < 4; B++)
129
- n.push(new I(new Date(c + B, 0, 1))), n.push(new I(new Date(c + B, 6, 1)));
125
+ var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, X = new I(new Date(c, 0, 1)), a = X.offset, n = [X], T, f, t, S;
126
+ for (S = 1; S < 48; S++)
127
+ t = new Date(c, S, 1).getTimezoneOffset(), t !== a && (f = new I(new Date(c, S, 1)), T = Q(X, f), n.push(T), n.push(new I(new Date(T.at + 6e4))), X = f, a = t);
128
+ for (S = 0; S < 4; S++)
129
+ n.push(new I(new Date(c + S, 0, 1))), n.push(new I(new Date(c + S, 6, 1)));
130
130
  return n;
131
131
  }
132
- function M0(c, d) {
133
- return c.offsetScore !== d.offsetScore ? c.offsetScore - d.offsetScore : c.abbrScore !== d.abbrScore ? c.abbrScore - d.abbrScore : c.zone.population !== d.zone.population ? d.zone.population - c.zone.population : d.zone.name.localeCompare(c.zone.name);
132
+ function M0(c, X) {
133
+ return c.offsetScore !== X.offsetScore ? c.offsetScore - X.offsetScore : c.abbrScore !== X.abbrScore ? c.abbrScore - X.abbrScore : c.zone.population !== X.zone.population ? X.zone.population - c.zone.population : X.zone.name.localeCompare(c.zone.name);
134
134
  }
135
- function z0(c, d) {
136
- var X, n;
137
- for (u(d), X = 0; X < d.length; X++)
138
- n = d[X], W[n] = W[n] || {}, W[n][c] = !0;
135
+ function z0(c, X) {
136
+ var a, n;
137
+ for (U(X), a = 0; a < X.length; a++)
138
+ n = X[a], W[n] = W[n] || {}, W[n][c] = !0;
139
139
  }
140
140
  function b0(c) {
141
- var d = c.length, X = {}, n = [], T = {}, f, t, B, V;
142
- for (f = 0; f < d; f++)
143
- if (B = c[f].offset, !T.hasOwnProperty(B)) {
144
- V = W[B] || {};
141
+ var X = c.length, a = {}, n = [], T = {}, f, t, S, V;
142
+ for (f = 0; f < X; f++)
143
+ if (S = c[f].offset, !T.hasOwnProperty(S)) {
144
+ V = W[S] || {};
145
145
  for (t in V)
146
- V.hasOwnProperty(t) && (X[t] = !0);
147
- T[B] = !0;
146
+ V.hasOwnProperty(t) && (a[t] = !0);
147
+ T[S] = !0;
148
148
  }
149
- for (f in X)
150
- X.hasOwnProperty(f) && n.push(b[f]);
149
+ for (f in a)
150
+ a.hasOwnProperty(f) && n.push(b[f]);
151
151
  return n;
152
152
  }
153
153
  function p0() {
154
154
  try {
155
155
  var c = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
156
  if (c && c.length > 3) {
157
- var d = b[K(c)];
158
- if (d)
159
- return d;
157
+ var X = b[K(c)];
158
+ if (X)
159
+ return X;
160
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 X = F(), n = X.length, T = b0(X), f = [], t, B, V;
165
- for (B = 0; B < T.length; B++) {
166
- for (t = new H(g(T[B])), V = 0; V < n; V++)
167
- t.scoreOffsetAt(X[V]);
164
+ var a = F(), n = a.length, T = b0(a), f = [], t, S, V;
165
+ for (S = 0; S < T.length; S++) {
166
+ for (t = new H(g(T[S])), V = 0; V < n; V++)
167
+ t.scoreOffsetAt(a[V]);
168
168
  f.push(t);
169
169
  }
170
170
  return f.sort(M0), f.length > 0 ? f[0].zone.name : void 0;
@@ -176,85 +176,85 @@ var j = { exports: {} };
176
176
  return (c || "").toLowerCase().replace(/\//g, "_");
177
177
  }
178
178
  function k(c) {
179
- var d, X, n, T;
180
- for (typeof c == "string" && (c = [c]), d = 0; d < c.length; d++)
181
- n = c[d].split("|"), X = n[0], T = K(X), p[T] = c[d], b[T] = X, z0(T, n[2].split(" "));
179
+ var X, a, n, T;
180
+ for (typeof c == "string" && (c = [c]), X = 0; X < c.length; X++)
181
+ n = c[X].split("|"), a = n[0], T = K(a), p[T] = c[X], b[T] = a, z0(T, n[2].split(" "));
182
182
  }
183
- function g(c, d) {
183
+ function g(c, X) {
184
184
  c = K(c);
185
- var X = p[c], n;
186
- return X instanceof G ? X : typeof X == "string" ? (X = new G(X), p[c] = X, X) : O[c] && d !== g && (n = g(O[c], g)) ? (X = p[c] = new G(), X._set(n), X.name = b[c], X) : null;
185
+ var a = p[c], n;
186
+ return a instanceof G ? a : typeof a == "string" ? (a = new G(a), p[c] = a, a) : O[c] && X !== g && (n = g(O[c], g)) ? (a = p[c] = new G(), a._set(n), a.name = b[c], a) : null;
187
187
  }
188
188
  function A0() {
189
- var c, d = [];
189
+ var c, X = [];
190
190
  for (c in b)
191
- b.hasOwnProperty(c) && (p[c] || p[O[c]]) && b[c] && d.push(b[c]);
192
- return d.sort();
191
+ b.hasOwnProperty(c) && (p[c] || p[O[c]]) && b[c] && X.push(b[c]);
192
+ return X.sort();
193
193
  }
194
194
  function c0() {
195
195
  return Object.keys(A);
196
196
  }
197
197
  function v(c) {
198
- var d, X, n, T;
199
- for (typeof c == "string" && (c = [c]), d = 0; d < c.length; d++)
200
- X = c[d].split("|"), n = K(X[0]), T = K(X[1]), O[n] = T, b[n] = X[0], O[T] = n, b[T] = X[1];
198
+ var X, a, n, T;
199
+ for (typeof c == "string" && (c = [c]), X = 0; X < c.length; X++)
200
+ a = c[X].split("|"), n = K(a[0]), T = K(a[1]), O[n] = T, b[n] = a[0], O[T] = n, b[T] = a[1];
201
201
  }
202
202
  function W0(c) {
203
- var d, X, n, T;
203
+ var X, a, n, T;
204
204
  if (!(!c || !c.length))
205
- for (d = 0; d < c.length; d++)
206
- T = c[d].split("|"), X = T[0].toUpperCase(), n = T[1].split(" "), A[X] = new N(
207
- X,
205
+ for (X = 0; X < c.length; X++)
206
+ T = c[X].split("|"), a = T[0].toUpperCase(), n = T[1].split(" "), A[a] = new B(
207
+ a,
208
208
  n
209
209
  );
210
210
  }
211
211
  function q0(c) {
212
212
  return c = c.toUpperCase(), A[c] || null;
213
213
  }
214
- function o0(c, d) {
214
+ function o0(c, X) {
215
215
  if (c = q0(c), !c)
216
216
  return null;
217
- var X = c.zones.sort();
218
- return d ? X.map(function(n) {
217
+ var a = c.zones.sort();
218
+ return X ? a.map(function(n) {
219
219
  var T = g(n);
220
220
  return {
221
221
  name: n,
222
222
  offset: T.utcOffset(/* @__PURE__ */ new Date())
223
223
  };
224
- }) : X;
224
+ }) : a;
225
225
  }
226
226
  function Y0(c) {
227
- k(c.zones), v(c.links), W0(c.countries), U.dataVersion = c.version;
227
+ k(c.zones), v(c.links), W0(c.countries), u.dataVersion = c.version;
228
228
  }
229
229
  function $(c) {
230
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
232
  function J(c) {
233
- var d = c._f === "X" || c._f === "x";
234
- return !!(c._a && c._tzm === void 0 && !d);
233
+ var X = c._f === "X" || c._f === "x";
234
+ return !!(c._a && c._tzm === void 0 && !X);
235
235
  }
236
236
  function D(c) {
237
237
  typeof console < "u" && typeof console.error == "function" && console.error(c);
238
238
  }
239
- function U(c) {
240
- var d = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], n = M.utc.apply(null, d), T;
241
- return !M.isMoment(c) && J(n) && (T = g(X)) && n.add(T.parse(n), "minutes"), n.tz(X), n;
239
+ function u(c) {
240
+ var X = Array.prototype.slice.call(arguments, 0, -1), a = arguments[arguments.length - 1], n = M.utc.apply(null, X), T;
241
+ return !M.isMoment(c) && J(n) && (T = g(a)) && n.add(T.parse(n), "minutes"), n.tz(a), n;
242
242
  }
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 = G, U.unpack = P, U.unpackBase60 = e, U.needsOffset = J, U.moveInvalidForward = !0, U.moveAmbiguousForward = !1, U.countries = c0, U.zonesForCountry = o0;
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 = G, u.unpack = P, u.unpackBase60 = i, u.needsOffset = J, u.moveInvalidForward = !0, u.moveAmbiguousForward = !1, u.countries = c0, u.zonesForCountry = o0;
244
244
  var m = M.fn;
245
- M.tz = U, M.defaultZone = null, M.updateOffset = function(c, d) {
246
- var X = M.defaultZone, n;
247
- if (c._z === void 0 && (X && J(c) && !c._isUTC && c.isValid() && (c._d = M.utc(c._a)._d, c.utc().add(X.parse(c), "minutes")), c._z = X), c._z)
245
+ M.tz = u, M.defaultZone = null, M.updateOffset = function(c, X) {
246
+ var a = M.defaultZone, n;
247
+ if (c._z === void 0 && (a && J(c) && !c._isUTC && c.isValid() && (c._d = M.utc(c._a)._d, c.utc().add(a.parse(c), "minutes")), c._z = a), c._z)
248
248
  if (n = c._z.utcOffset(c), Math.abs(n) < 16 && (n = n / 60), c.utcOffset !== void 0) {
249
249
  var T = c._z;
250
- c.utcOffset(-n, d), c._z = T;
250
+ c.utcOffset(-n, X), c._z = T;
251
251
  } else
252
- c.zone(n, d);
253
- }, m.tz = function(c, d) {
252
+ c.zone(n, X);
253
+ }, m.tz = function(c, X) {
254
254
  if (c) {
255
255
  if (typeof c != "string")
256
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, d) : D("Moment Timezone has no data for " + c + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
257
+ return this._z = g(c), this._z ? M.updateOffset(this, X) : 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;
@@ -275,7 +275,7 @@ var j = { exports: {} };
275
275
  };
276
276
  }
277
277
  m.zoneName = y(m.zoneName), m.zoneAbbr = y(m.zoneAbbr), m.utc = w(m.utc), m.local = w(m.local), m.utcOffset = d0(m.utcOffset), M.tz.setDefault = function(c) {
278
- return (R < 2 || R === 2 && Y < 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;
278
+ return (d < 2 || d === 2 && Y < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = 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;
@@ -1144,16 +1144,16 @@ var x = { exports: {} };
1144
1144
  throw new RangeError("invalid coordinates");
1145
1145
  if (90 <= z)
1146
1146
  return "Etc/GMT";
1147
- var b = -1, W = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - z) / 180.00000000000003, o = 0 | W, R = 0 | q, Y = 96 * R + 2 * o;
1147
+ var b = -1, W = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - z) / 180.00000000000003, o = 0 | W, d = 0 | q, Y = 96 * d + 2 * o;
1148
1148
  for (Y = 56 * O.charCodeAt(Y) + O.charCodeAt(Y + 1) - 1995; Y + A.length < 3136; )
1149
- Y = 56 * O.charCodeAt(Y = 8 * (b = b + Y + 1) + 4 * (R = 0 | (q = 2 * (q - R) % 2)) + 2 * (o = 0 | (W = 2 * (W - o) % 2)) + 2304) + O.charCodeAt(Y + 1) - 1995;
1149
+ Y = 56 * O.charCodeAt(Y = 8 * (b = b + Y + 1) + 4 * (d = 0 | (q = 2 * (q - d) % 2)) + 2 * (o = 0 | (W = 2 * (W - o) % 2)) + 2304) + O.charCodeAt(Y + 1) - 1995;
1150
1150
  return A[Y + A.length - 3136];
1151
1151
  }
1152
1152
  E.exports = M;
1153
1153
  })(x);
1154
1154
  var N0 = x.exports;
1155
1155
  const B0 = /* @__PURE__ */ a0(N0);
1156
- class a {
1156
+ class R {
1157
1157
  /**
1158
1158
  * 基于输入的经度,计算出时区
1159
1159
  * @param lng
@@ -1173,17 +1173,17 @@ class a {
1173
1173
  return p = p > 9 ? p : `0${p}`, z = z > 9 ? z : `0${z}`, M > 0 ? `+${z}:${p}` : `-${z}:${p}`;
1174
1174
  }
1175
1175
  static lng2pretty(M, z = 6, p = "H°M′") {
1176
- z = z < 6 ? 6 : z, M = a.convertToStdLng(M, z);
1176
+ z = z < 6 ? 6 : z, M = R.convertToStdLng(M, z);
1177
1177
  let O = "E";
1178
1178
  M < 0 && (O = "W"), M = Math.abs(M), p = p.toUpperCase();
1179
- let A = M * 3600, b, W, q, o, R, Y;
1180
- b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = a.padNumber(b, 2, 2)), q = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = a.roundPrecision(q, z).toString().padStart(2, "0") : o = a.padNumber(q, 2, 2), A = A - q * 60), R = A / 3600, p.indexOf("M") !== -1 ? Y = a.roundPrecision(R, z).toString().padStart(3, "0") : Y = a.padNumber(R, 3, 2), Number(W) >= 60 && (o = Number(o) + 1, W = 0), Number(o) >= 60 && (Y = Number(Y) + 1, o = 0);
1179
+ let A = M * 3600, b, W, q, o, d, Y;
1180
+ b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = R.padNumber(b, 2, 2)), q = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = R.roundPrecision(q, z).toString().padStart(2, "0") : o = R.padNumber(q, 2, 2), A = A - q * 60), d = A / 3600, p.indexOf("M") !== -1 ? Y = R.roundPrecision(d, z).toString().padStart(3, "0") : Y = R.padNumber(d, 3, 2), Number(W) >= 60 && (o = Number(o) + 1, W = 0), Number(o) >= 60 && (Y = Number(Y) + 1, o = 0);
1181
1181
  const L = `${p.replace(/S+/gi, W).replace(/M+/gi, o).replace(/H+/gi, Y)}${O}`;
1182
1182
  return {
1183
1183
  direction: O,
1184
- degree: a.roundPrecision(R, z),
1185
- minute: a.roundPrecision(q, z),
1186
- second: a.roundPrecision(b, z),
1184
+ degree: R.roundPrecision(d, z),
1185
+ minute: R.roundPrecision(q, z),
1186
+ second: R.roundPrecision(b, z),
1187
1187
  pretty: L
1188
1188
  };
1189
1189
  }
@@ -1197,21 +1197,21 @@ class a {
1197
1197
  z = z < 6 ? 6 : z, M = M % 180;
1198
1198
  let O = "N";
1199
1199
  M < 0 && (O = "S"), M = Math.abs(M), p = p.toUpperCase();
1200
- let A = M * 3600, b, W, q, o, R, Y;
1201
- b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = a.padNumber(b, 2, 2)), q = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = a.roundPrecision(q, z).toString().padStart(2, "0") : o = a.padNumber(q, 2, 2), A = A - q * 60), R = A / 3600, p.indexOf("M") !== -1 ? Y = a.roundPrecision(R, z).toString().padStart(2, "0") : Y = a.padNumber(R, 2, 2), Number(W) >= 60 && (o = Number(o) + 1, W = 0), Number(o) >= 60 && (Y = Number(Y) + 1, o = 0);
1200
+ let A = M * 3600, b, W, q, o, d, Y;
1201
+ b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, W = R.padNumber(b, 2, 2)), q = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? o = R.roundPrecision(q, z).toString().padStart(2, "0") : o = R.padNumber(q, 2, 2), A = A - q * 60), d = A / 3600, p.indexOf("M") !== -1 ? Y = R.roundPrecision(d, z).toString().padStart(2, "0") : Y = R.padNumber(d, 2, 2), Number(W) >= 60 && (o = Number(o) + 1, W = 0), Number(o) >= 60 && (Y = Number(Y) + 1, o = 0);
1202
1202
  const L = `${p.replace(/S+/gi, W).replace(/M+/gi, o).replace(/H+/gi, Y)}${O}`;
1203
1203
  return {
1204
1204
  direction: O,
1205
- degree: a.roundPrecision(R, z),
1206
- minute: a.roundPrecision(q, z),
1207
- second: a.roundPrecision(b, z),
1205
+ degree: R.roundPrecision(d, z),
1206
+ minute: R.roundPrecision(q, z),
1207
+ second: R.roundPrecision(b, z),
1208
1208
  pretty: L
1209
1209
  };
1210
1210
  }
1211
1211
  static str2Lng(M, z = 6) {
1212
1212
  let p;
1213
1213
  if (isNaN(M)) {
1214
- M = a.strReplace(M, "LNG");
1214
+ M = R.strReplace(M, "LNG");
1215
1215
  const O = M[M.length - 1].toUpperCase();
1216
1216
  M = M.substring(0, M.length - 1).trim();
1217
1217
  const A = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
@@ -1223,12 +1223,12 @@ class a {
1223
1223
  p = b + (W ?? 0) / 60, O === "W" && (p = p * -1);
1224
1224
  } else
1225
1225
  p = Number(M);
1226
- return a.convertToStdLng(p, z);
1226
+ return R.convertToStdLng(p, z);
1227
1227
  }
1228
1228
  static str2Lat(M, z = 6) {
1229
1229
  let p;
1230
1230
  if (isNaN(M)) {
1231
- M = a.strReplace(M, "LAT");
1231
+ M = R.strReplace(M, "LAT");
1232
1232
  const O = M[M.length - 1].toUpperCase();
1233
1233
  M = M.substring(0, M.length - 1).trim();
1234
1234
  const A = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
@@ -1242,19 +1242,19 @@ class a {
1242
1242
  O === "S" && (p = p * -1);
1243
1243
  } else
1244
1244
  p = Number(M);
1245
- return a.roundPrecision(p, z);
1245
+ return R.roundPrecision(p, z);
1246
1246
  }
1247
1247
  static str2LngOrLat(M, z = 6, p = "LAT") {
1248
- M = a.strReplace(M, p);
1248
+ M = R.strReplace(M, p);
1249
1249
  const O = M[M.length - 1].toUpperCase();
1250
1250
  return ["N", "S"].includes(O) ? {
1251
- lat: a.str2Lat(M, z)
1251
+ lat: R.str2Lat(M, z)
1252
1252
  } : {
1253
- lng: a.str2Lng(M, z)
1253
+ lng: R.str2Lng(M, z)
1254
1254
  };
1255
1255
  }
1256
1256
  static convertToStdLng(M, z = 6) {
1257
- return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), a.roundPrecision(M, z);
1257
+ return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), R.roundPrecision(M, z);
1258
1258
  }
1259
1259
  static roundPrecision(M, z = 4) {
1260
1260
  if (typeof M == "number") {
@@ -1300,7 +1300,7 @@ class a {
1300
1300
  * @param dcmPrecision 小数位数
1301
1301
  */
1302
1302
  static padNumber(M, z = 2, p = 2) {
1303
- const O = a.roundPrecision(M - Math.trunc(M), p), A = O >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
1303
+ const O = R.roundPrecision(M - Math.trunc(M), p), A = O >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
1304
1304
  return O >= 1 ? A : `${A}.${Math.trunc(O * Math.pow(10, p)).toString().padStart(p, "0")}`;
1305
1305
  }
1306
1306
  }
@@ -1310,7 +1310,7 @@ try {
1310
1310
  } catch {
1311
1311
  } finally {
1312
1312
  }
1313
- class r {
1313
+ class N {
1314
1314
  /**
1315
1315
  * 计算方位角
1316
1316
  * @param from 坐标 {lng, lat}
@@ -1320,12 +1320,12 @@ class r {
1320
1320
  * @returns {number} 单位度
1321
1321
  */
1322
1322
  static calculateBearing(M, z, p = !0, O = 4) {
1323
- const A = i.points([
1323
+ const A = e.points([
1324
1324
  [M.lng, M.lat],
1325
1325
  [z.lng, z.lat]
1326
1326
  ]);
1327
1327
  let b;
1328
- return p ? b = i.rhumbBearing(A.features[0], A.features[1]) : b = i.bearing(A.features[0], A.features[1]), b < 0 && (b += 360), a.roundPrecision(b, O);
1328
+ return p ? b = e.rhumbBearing(A.features[0], A.features[1]) : b = e.bearing(A.features[0], A.features[1]), b < 0 && (b += 360), R.roundPrecision(b, O);
1329
1329
  }
1330
1330
  /**
1331
1331
  * 计算两点间距离
@@ -1337,13 +1337,13 @@ class r {
1337
1337
  * @returns {number}
1338
1338
  */
1339
1339
  static calculateDistance(M, z, p = !0, O = 4, A = "nauticalmiles") {
1340
- M = { ...M }, z = { ...z }, M.lng = a.convertToStdLng(M.lng, O), z.lng = a.convertToStdLng(z.lng, O);
1341
- const b = i.points([
1340
+ M = { ...M }, z = { ...z }, M.lng = R.convertToStdLng(M.lng, O), z.lng = R.convertToStdLng(z.lng, O);
1341
+ const b = e.points([
1342
1342
  [M.lng, M.lat],
1343
1343
  [z.lng, z.lat]
1344
1344
  ]);
1345
1345
  let W;
1346
- return p ? W = i.rhumbDistance(b.features[0], b.features[1], { units: A }) : W = i.distance(b.features[0], b.features[1], { units: A }), a.roundPrecision(W, O);
1346
+ return p ? W = e.rhumbDistance(b.features[0], b.features[1], { units: A }) : W = e.distance(b.features[0], b.features[1], { units: A }), R.roundPrecision(W, O);
1347
1347
  }
1348
1348
  /**
1349
1349
  * 计算航线距离
@@ -1360,7 +1360,7 @@ class r {
1360
1360
  const o = { lng: b[W + 1][0], lat: b[W + 1][1] };
1361
1361
  O += this.calculateDistance(q, o, !0, z, p), A = o;
1362
1362
  }
1363
- return a.roundPrecision(O, z);
1363
+ return R.roundPrecision(O, z);
1364
1364
  }
1365
1365
  /**
1366
1366
  * 计算坐标(基于方位角和距离)
@@ -1371,11 +1371,11 @@ class r {
1371
1371
  * @param rhumb
1372
1372
  */
1373
1373
  static calculateCoordinate(M, z, p, O = "nauticalmiles", A = !0) {
1374
- const b = i.point([M.lng, M.lat]);
1374
+ const b = e.point([M.lng, M.lat]);
1375
1375
  let W;
1376
- A ? W = i.rhumbDestination(b, p, z, { units: O }) : W = i.destination(b, p, z, { units: O });
1376
+ A ? W = e.rhumbDestination(b, p, z, { units: O }) : W = e.destination(b, p, z, { units: O });
1377
1377
  const q = W.geometry.coordinates;
1378
- return { lng: a.convertToStdLng(q[0], 8), lat: a.roundPrecision(q[1], 8) };
1378
+ return { lng: R.convertToStdLng(q[0], 8), lat: R.roundPrecision(q[1], 8) };
1379
1379
  }
1380
1380
  /**
1381
1381
  * 插值大圆坐标(基于两点方位角和间距)
@@ -1389,9 +1389,9 @@ class r {
1389
1389
  static interpolateCoordinates(M, z, p, O = !0, A = !0, b = "nauticalmiles") {
1390
1390
  const W = [], q = this.calculateBearing(M, z, !1), o = this.calculateDistance(M, z, !1, 8, b);
1391
1391
  O && W.push({ lng: M.lng, lat: M.lat });
1392
- let R = 0;
1393
- for (; R < o; )
1394
- R += p, R < o && W.push(this.calculateCoordinate(M, q, R, b, !1));
1392
+ let d = 0;
1393
+ for (; d < o; )
1394
+ d += p, d < o && W.push(this.calculateCoordinate(M, q, d, b, !1));
1395
1395
  return A && W.push({ lng: z.lng, lat: z.lat }), W;
1396
1396
  }
1397
1397
  /**
@@ -1413,26 +1413,26 @@ class r {
1413
1413
  const O = [];
1414
1414
  let A, b;
1415
1415
  for (let W = 0; W < M.length - 1; W++) {
1416
- A = a.convertToStdLng(M[W].lng, 8), b = a.convertToStdLng(M[W + 1].lng, 8), M[W].lat = a.roundPrecision(M[W].lat, 8), M[W + 1].lat = a.roundPrecision(M[W + 1].lat, 8), p.push([A, M[W].lat]);
1416
+ A = R.convertToStdLng(M[W].lng, 8), b = R.convertToStdLng(M[W + 1].lng, 8), M[W].lat = R.roundPrecision(M[W].lat, 8), M[W + 1].lat = R.roundPrecision(M[W + 1].lat, 8), p.push([A, M[W].lat]);
1417
1417
  const q = A - b;
1418
1418
  if (Math.abs(q) > 180) {
1419
- const o = a.convertToMonotonicLng2([
1419
+ const o = R.convertToMonotonicLng2([
1420
1420
  [A, M[W].lat],
1421
1421
  [b, M[W + 1].lat]
1422
1422
  ]);
1423
- let R, Y;
1424
- z ? (R = i.lineString(o), Y = i.lineString([
1423
+ let d, Y;
1424
+ z ? (d = e.lineString(o), Y = e.lineString([
1425
1425
  [q > 0 ? 180 : -180, 89],
1426
1426
  [q > 0 ? 180 : -180, -89]
1427
- ])) : (R = i.greatCircle(o[0], o[1]), Y = i.greatCircle([q > 0 ? 180 : -180, 89], [q > 0 ? 180 : -180, -89]));
1428
- const L = i.lineIntersect(R, Y);
1429
- let e;
1427
+ ])) : (d = e.greatCircle(o[0], o[1]), Y = e.greatCircle([q > 0 ? 180 : -180, 89], [q > 0 ? 180 : -180, -89]));
1428
+ const L = e.lineIntersect(d, Y);
1429
+ let i;
1430
1430
  if (L.features.length) {
1431
- const u = i.getCoord(L.features[0]);
1432
- e = a.roundPrecision(u[1], 8);
1431
+ const U = e.getCoord(L.features[0]);
1432
+ i = R.roundPrecision(U[1], 8);
1433
1433
  } else
1434
- e = M[W].lat;
1435
- q > 0 ? (p.push([180 - 1e-6, e]), O.push([...p]), p = [], p.push([-(180 - 1e-6), e])) : (p.push([-(180 - 1e-6), e]), O.push([...p]), p = [], p.push([180 - 1e-6, e]));
1434
+ i = M[W].lat;
1435
+ q > 0 ? (p.push([180 - 1e-6, i]), O.push([...p]), p = [], p.push([-(180 - 1e-6), i])) : (p.push([-(180 - 1e-6), i]), O.push([...p]), p = [], p.push([180 - 1e-6, i]));
1436
1436
  }
1437
1437
  W === M.length - 2 && p.push([b, M[W + 1].lat]);
1438
1438
  }
@@ -1463,10 +1463,10 @@ class r {
1463
1463
  * @param route 航线[[[lng, lat],[lng, lat]]]
1464
1464
  */
1465
1465
  static removeCoordinateFromRoute(M, z) {
1466
- M.lng = a.convertToStdLng(M.lng, 8);
1466
+ M.lng = R.convertToStdLng(M.lng, 8);
1467
1467
  for (const p of z)
1468
1468
  for (let O = p.length - 1; O >= 0; O--)
1469
- a.roundPrecision(p[O][0], 8) === M.lng && a.roundPrecision(p[O][1], 8) === a.roundPrecision(M.lat, 8) && p.splice(O, 1);
1469
+ R.roundPrecision(p[O][0], 8) === M.lng && R.roundPrecision(p[O][1], 8) === R.roundPrecision(M.lat, 8) && p.splice(O, 1);
1470
1470
  return z;
1471
1471
  }
1472
1472
  /**
@@ -1475,9 +1475,9 @@ class r {
1475
1475
  * @param waypoints [{lat, lng}, {lat, lng}]
1476
1476
  */
1477
1477
  static removeCoordinateFromWaypoints(M, z) {
1478
- M.lng = a.convertToStdLng(M.lng, 8);
1478
+ M.lng = R.convertToStdLng(M.lng, 8);
1479
1479
  for (let p = z.length - 1; p >= 0; p--)
1480
- a.roundPrecision(z[p].lng, 8) === M.lng && a.roundPrecision(z[p].lat, 8) === a.roundPrecision(M.lat, 8) && z.splice(p, 1);
1480
+ R.roundPrecision(z[p].lng, 8) === M.lng && R.roundPrecision(z[p].lat, 8) === R.roundPrecision(M.lat, 8) && z.splice(p, 1);
1481
1481
  return z;
1482
1482
  }
1483
1483
  /**
@@ -1492,12 +1492,12 @@ class r {
1492
1492
  * [[[120, 30], [120, 35], [125,40], [130, 37]], [[-150, 40], [-130, 30]]]
1493
1493
  */
1494
1494
  static mergeCoordinateToRoute(M, z) {
1495
- M.lng = a.convertToStdLng(M.lng, 8);
1495
+ M.lng = R.convertToStdLng(M.lng, 8);
1496
1496
  let p = Number.MAX_VALUE, O = 0, A = 0, b, W;
1497
1497
  return z.forEach((q, o) => {
1498
- for (let R = 0; R < q.length - 1; R++) {
1499
- const Y = { lng: q[R][0], lat: q[R][1] }, L = { lng: q[R + 1][0], lat: q[R + 1][1] }, e = this.calculatePointToLineDistance(M, Y, L);
1500
- p > e && (p = e, A = R, O = o, b = this.calculateDistance(Y, M), W = this.calculateDistance(L, M));
1498
+ for (let d = 0; d < q.length - 1; d++) {
1499
+ const Y = { lng: q[d][0], lat: q[d][1] }, L = { lng: q[d + 1][0], lat: q[d + 1][1] }, i = this.calculatePointToLineDistance(M, Y, L);
1500
+ p > i && (p = i, A = d, O = o, b = this.calculateDistance(Y, M), W = this.calculateDistance(L, M));
1501
1501
  }
1502
1502
  }), 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;
1503
1503
  }
@@ -1507,9 +1507,9 @@ class r {
1507
1507
  * @param route
1508
1508
  */
1509
1509
  static appendCoordinateToRoute(M, z) {
1510
- M.lng = a.convertToStdLng(M.lng, 8);
1511
- const p = r.convertRouteToCoordinates(z);
1512
- return p.push(M), r.divideAccordingToLng(p);
1510
+ M.lng = R.convertToStdLng(M.lng, 8);
1511
+ const p = N.convertRouteToCoordinates(z);
1512
+ return p.push(M), N.divideAccordingToLng(p);
1513
1513
  }
1514
1514
  /**
1515
1515
  * 向route头加1个坐标
@@ -1517,8 +1517,8 @@ class r {
1517
1517
  * @param route
1518
1518
  */
1519
1519
  static unshiftCoordinateToRoute(M, z) {
1520
- const p = r.convertRouteToCoordinates(z);
1521
- return p.unshift(M), r.divideAccordingToLng(p);
1520
+ const p = N.convertRouteToCoordinates(z);
1521
+ return p.unshift(M), N.divideAccordingToLng(p);
1522
1522
  }
1523
1523
  /**
1524
1524
  * 合并多个waypoints进航线
@@ -1546,11 +1546,11 @@ class r {
1546
1546
  return;
1547
1547
  const W = [];
1548
1548
  for (const q of b) {
1549
- if (a.roundPrecision(z.lng, 8) === a.roundPrecision(q[0], 8) && a.roundPrecision(z.lat, 8) === a.roundPrecision(q[1], 8)) {
1549
+ if (R.roundPrecision(z.lng, 8) === R.roundPrecision(q[0], 8) && R.roundPrecision(z.lat, 8) === R.roundPrecision(q[1], 8)) {
1550
1550
  W.push(q), A === 0 && W.push([M.lng, M.lat]), A = 2;
1551
1551
  break;
1552
1552
  }
1553
- A === 1 ? W.push(q) : a.roundPrecision(M.lng, 8) === a.roundPrecision(q[0], 8) && a.roundPrecision(M.lat, 8) === a.roundPrecision(q[1], 8) && (A = 1, W.push(q));
1553
+ A === 1 ? W.push(q) : R.roundPrecision(M.lng, 8) === R.roundPrecision(q[0], 8) && R.roundPrecision(M.lat, 8) === R.roundPrecision(q[1], 8) && (A = 1, W.push(q));
1554
1554
  }
1555
1555
  W.length && O.push(W);
1556
1556
  }), O;
@@ -1565,11 +1565,11 @@ class r {
1565
1565
  */
1566
1566
  static calculateRangeWaypoints(M, z, p, O = []) {
1567
1567
  const A = this.convertRouteToCoordinates(p, 0), b = this.mergeCoordinatesToWaypoints([M, z, ...O], A), W = b.findIndex(
1568
- (R) => a.roundPrecision(M.lng, 8) === a.roundPrecision(R.lng, 8) && a.roundPrecision(M.lat, 8) === a.roundPrecision(R.lat, 8)
1568
+ (d) => R.roundPrecision(M.lng, 8) === R.roundPrecision(d.lng, 8) && R.roundPrecision(M.lat, 8) === R.roundPrecision(d.lat, 8)
1569
1569
  ), q = b.findIndex(
1570
- (R) => a.roundPrecision(z.lng, 8) === a.roundPrecision(R.lng, 8) && a.roundPrecision(z.lat, 8) === a.roundPrecision(R.lat, 8)
1570
+ (d) => R.roundPrecision(z.lng, 8) === R.roundPrecision(d.lng, 8) && R.roundPrecision(z.lat, 8) === R.roundPrecision(d.lat, 8)
1571
1571
  );
1572
- return b.filter((R, Y) => Y >= W && Y <= q);
1572
+ return b.filter((d, Y) => Y >= W && Y <= q);
1573
1573
  }
1574
1574
  /**
1575
1575
  * 计算坐标到航路上的最短距离
@@ -1580,7 +1580,7 @@ class r {
1580
1580
  let p = Number.MAX_VALUE, O = 0, A = 0;
1581
1581
  return z.forEach((b, W) => {
1582
1582
  for (let q = 0; q < b.length - 1; q++) {
1583
- const o = { lng: b[q][0], lat: b[q][1] }, R = { lng: b[q + 1][0], lat: b[q + 1][1] }, Y = this.calculatePointToLineDistance(M, o, R);
1583
+ const o = { lng: b[q][0], lat: b[q][1] }, d = { lng: b[q + 1][0], lat: b[q + 1][1] }, Y = this.calculatePointToLineDistance(M, o, d);
1584
1584
  p > Y && (p = Y, O = q, A = W);
1585
1585
  }
1586
1586
  }), { minDist: p, segIndex: A, minIndex: O };
@@ -1592,18 +1592,18 @@ class r {
1592
1592
  * @return [[[lng, lat]]]
1593
1593
  */
1594
1594
  static calculateSubRoute(M, z) {
1595
- const p = r.convertRouteToCoordinates(z);
1596
- r.mergeCoordinateToWaypoints(M, p, !0), z = r.divideAccordingToLng(p);
1595
+ const p = N.convertRouteToCoordinates(z);
1596
+ N.mergeCoordinateToWaypoints(M, p, !0), z = N.divideAccordingToLng(p);
1597
1597
  const { segIndex: O, minIndex: A } = this.calculateMinDistanceToRoute({ ...M }, z);
1598
- M.lng = a.convertToStdLng(M.lng);
1598
+ M.lng = R.convertToStdLng(M.lng);
1599
1599
  const b = [];
1600
1600
  let W = !0;
1601
1601
  for (let q = O; q < z.length; q++)
1602
1602
  if (W) {
1603
1603
  const o = [];
1604
1604
  o.push([M.lng, M.lat]);
1605
- for (let R = A + 1; R < z[q].length; R++)
1606
- M.lng === z[q][R][0] && M.lat === z[q][R][1] || o.push(z[q][R]);
1605
+ for (let d = A + 1; d < z[q].length; d++)
1606
+ M.lng === z[q][d][0] && M.lat === z[q][d][1] || o.push(z[q][d]);
1607
1607
  b.push(o), W = !1;
1608
1608
  } else
1609
1609
  b.push([...z[q]]);
@@ -1622,11 +1622,11 @@ class r {
1622
1622
  if (this.calculateDistance(M, W) === 0)
1623
1623
  return z;
1624
1624
  if (this.calculateDistance(M, q) === 0)
1625
- return z.filter((R, Y) => Y > 0);
1625
+ return z.filter((d, Y) => Y > 0);
1626
1626
  const o = this.calculatePointToLineDistance(M, W, q);
1627
1627
  p > o && (p = o, O = b);
1628
1628
  }
1629
- M.lng = a.convertToStdLng(M.lng);
1629
+ M.lng = R.convertToStdLng(M.lng);
1630
1630
  const A = [M];
1631
1631
  for (let b = O + 1; b < z.length; b++)
1632
1632
  A.push(z[b]);
@@ -1640,14 +1640,14 @@ class r {
1640
1640
  * @param options
1641
1641
  */
1642
1642
  static calculatePointToLineDistance(M, z, p, O = { units: "nauticalmiles", method: "geodesic" }) {
1643
- M.lng = a.convertToStdLng(M.lng, 8), z = { ...z }, p = { ...p }, z.lng = a.convertToStdLng(z.lng, 8), p.lng = a.convertToStdLng(p.lng, 8);
1644
- const A = a.convertToMonotonicLng([z, p]);
1643
+ M.lng = R.convertToStdLng(M.lng, 8), z = { ...z }, p = { ...p }, z.lng = R.convertToStdLng(z.lng, 8), p.lng = R.convertToStdLng(p.lng, 8);
1644
+ const A = R.convertToMonotonicLng([z, p]);
1645
1645
  z = A[0], p = A[1];
1646
- const b = i.lineString([
1646
+ const b = e.lineString([
1647
1647
  [z.lng, z.lat],
1648
1648
  [p.lng, p.lat]
1649
- ]), W = i.pointToLineDistance(i.point([M.lng, M.lat]), b, O), q = i.pointToLineDistance(i.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), b, O);
1650
- return a.roundPrecision(Math.min(W, q), 6);
1649
+ ]), W = e.pointToLineDistance(e.point([M.lng, M.lat]), b, O), q = e.pointToLineDistance(e.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), b, O);
1650
+ return R.roundPrecision(Math.min(W, q), 6);
1651
1651
  }
1652
1652
  /**
1653
1653
  * 计算途经点的COG, Distance等属性
@@ -1658,7 +1658,7 @@ class r {
1658
1658
  z = this.mergeWaypointsToRoute(M, z);
1659
1659
  for (let p = 0; p < M.length - 1; p++) {
1660
1660
  const O = M[p], A = M[p + 1], b = this.calculateRangeRoute(O, A, z);
1661
- p === 0 && (O.distanceFromPrevious = 0, O.distanceFromStart = 0), A.distanceFromPrevious = this.calculateRouteDistance(b), A.distanceFromStart = a.roundPrecision((O.distanceFromStart || 0) + A.distanceFromPrevious);
1661
+ p === 0 && (O.distanceFromPrevious = 0, O.distanceFromStart = 0), A.distanceFromPrevious = this.calculateRouteDistance(b), A.distanceFromStart = R.roundPrecision((O.distanceFromStart || 0) + A.distanceFromPrevious);
1662
1662
  }
1663
1663
  return M;
1664
1664
  }
@@ -1685,18 +1685,18 @@ class r {
1685
1685
  * [{ lng: 160, lat: 30}, { lng: 170, lat: 40}, {lng: 179, lat: 50}, {lng: -170, lat: 40}, {lng: -160, lat: 30}]
1686
1686
  */
1687
1687
  static mergeCoordinateToWaypoints(M, z, p = !0) {
1688
- M.lng = a.convertToStdLng(M.lng, 8);
1688
+ M.lng = R.convertToStdLng(M.lng, 8);
1689
1689
  let O = Number.MAX_VALUE, A = 0, b = 0, W = 0;
1690
1690
  if (z.length < 2)
1691
1691
  z.push(M);
1692
1692
  else {
1693
1693
  for (let q = 0; q < z.length - 1; q++) {
1694
- const o = { lng: z[q].lng, lat: z[q].lat }, R = { lng: z[q + 1].lng, lat: z[q + 1].lat }, Y = this.calculatePointToLineDistance(M, o, R);
1695
- O >= Y && (O = Y, A = q, b = this.calculateDistance(o, M, !1, 6), W = this.calculateDistance(R, M, !1, 6));
1694
+ const o = { lng: z[q].lng, lat: z[q].lat }, d = { lng: z[q + 1].lng, lat: z[q + 1].lat }, Y = this.calculatePointToLineDistance(M, o, d);
1695
+ O >= Y && (O = Y, A = q, b = this.calculateDistance(o, M, !1, 6), W = this.calculateDistance(d, M, !1, 6));
1696
1696
  }
1697
1697
  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));
1698
1698
  }
1699
- return z.map((q) => (q.lng = a.convertToStdLng(q.lng), q));
1699
+ return z.map((q) => (q.lng = R.convertToStdLng(q.lng), q));
1700
1700
  }
1701
1701
  /**
1702
1702
  * 生成航线(基于途经点生成大圆/横向航线,并根据是否跨180度分组)
@@ -1721,8 +1721,8 @@ class r {
1721
1721
  * @param route [[[lng, lat]]]
1722
1722
  */
1723
1723
  static nearestCoordinateInRoute(M, z) {
1724
- const p = i.point([M.lng, M.lat]), A = this.convertRouteToCoordinates(z).map((o) => [o.lng, o.lat]), b = i.lineString(A), W = i.nearestPointOnLine(b, p), q = i.getCoord(W);
1725
- return { lng: a.roundPrecision(q[0], 8), lat: a.roundPrecision(q[1], 8) };
1724
+ const p = e.point([M.lng, M.lat]), A = this.convertRouteToCoordinates(z).map((o) => [o.lng, o.lat]), b = e.lineString(A), W = e.nearestPointOnLine(b, p), q = e.getCoord(W);
1725
+ return { lng: R.roundPrecision(q[0], 8), lat: R.roundPrecision(q[1], 8) };
1726
1726
  }
1727
1727
  /**
1728
1728
  * 计算经过方向上的最后一个waypoint
@@ -1756,37 +1756,37 @@ class r {
1756
1756
  static calculateNextCoordinateAlongRoute(M, z, p, O = "nauticalmiles") {
1757
1757
  var L;
1758
1758
  const A = M.speed || 12, b = [];
1759
- let W = [], q = !1, o = 0, R = 0, Y;
1760
- if (z && p.length ? (b.push(M), p.forEach((e, u) => {
1759
+ let W = [], q = !1, o = 0, d = 0, Y;
1760
+ if (z && p.length ? (b.push(M), p.forEach((i, U) => {
1761
1761
  if (q)
1762
- W.push(e);
1762
+ W.push(i);
1763
1763
  else {
1764
- const S = [];
1764
+ const r = [];
1765
1765
  let s;
1766
- for (let P = 0; P < e.length; P++)
1766
+ for (let P = 0; P < i.length; P++)
1767
1767
  if (Y)
1768
- S.push(e[P]);
1768
+ r.push(i[P]);
1769
1769
  else {
1770
- s = { lng: e[P][0], lat: e[P][1] };
1770
+ s = { lng: i[P][0], lat: i[P][1] };
1771
1771
  const G = this.calculateDistance(M, s, !0, 8, O);
1772
1772
  if (o += G, o < z)
1773
- R += G, b.push(s), M = s;
1773
+ d += G, b.push(s), M = s;
1774
1774
  else {
1775
- if (R = z, o === z)
1776
- Y = s, S.push([Y.lng, Y.lat]);
1775
+ if (d = z, o === z)
1776
+ Y = s, r.push([Y.lng, Y.lat]);
1777
1777
  else {
1778
- const l = o - z, N = this.calculateBearing(s, M);
1779
- Y = this.calculateCoordinate(s, N, l, O), S.push([Y.lng, Y.lat]), S.push([s.lng, s.lat]);
1778
+ const l = o - z, B = this.calculateBearing(s, M);
1779
+ Y = this.calculateCoordinate(s, B, l, O), r.push([Y.lng, Y.lat]), r.push([s.lng, s.lat]);
1780
1780
  }
1781
1781
  q = !0;
1782
1782
  }
1783
1783
  }
1784
- S.length && W.push(S), u === p.length - 1 && !Y && (Y = s);
1784
+ r.length && W.push(r), U === p.length - 1 && !Y && (Y = s);
1785
1785
  }
1786
1786
  })) : (W = p, Y = { ...M }), Y)
1787
- if (b.push(Y), Y.distanceFromPrevious = R, Y.hourFromPrevious = Math.round(R / A * 1e4) / 1e4, ((L = W[0]) == null ? void 0 : L.length) > 1) {
1788
- const e = { lng: W[0][1][0], lat: W[0][1][1] };
1789
- Y.bearing = this.calculateBearing(Y, e);
1787
+ if (b.push(Y), Y.distanceFromPrevious = d, Y.hourFromPrevious = Math.round(d / A * 1e4) / 1e4, ((L = W[0]) == null ? void 0 : L.length) > 1) {
1788
+ const i = { lng: W[0][1][0], lat: W[0][1][1] };
1789
+ Y.bearing = this.calculateBearing(Y, i);
1790
1790
  } else
1791
1791
  Y.bearing = 0;
1792
1792
  return { coordinate: Y, nextRoute: W, prevRoute: b };
@@ -1798,10 +1798,10 @@ class r {
1798
1798
  * @param to {lng, lat}
1799
1799
  */
1800
1800
  static nearestCoordinateInLine(M, z, p) {
1801
- const O = a.convertToStdLng(M.lng, 6), A = i.point([O, M.lat]), b = a.convertToStdLng(z.lng, 6), W = a.convertToStdLng(p.lng, 6), q = i.lineString([
1801
+ const O = R.convertToStdLng(M.lng, 6), A = e.point([O, M.lat]), b = R.convertToStdLng(z.lng, 6), W = R.convertToStdLng(p.lng, 6), q = e.lineString([
1802
1802
  [b, z.lat],
1803
1803
  [W, p.lat]
1804
- ]), o = i.nearestPointOnLine(q, A), R = i.getCoord(o), Y = a.roundPrecision(R[0], 6), L = a.roundPrecision(R[1], 6);
1804
+ ]), o = e.nearestPointOnLine(q, A), d = e.getCoord(o), Y = R.roundPrecision(d[0], 6), L = R.roundPrecision(d[1], 6);
1805
1805
  return { lng: Y, lat: L, inline: !(Y === b && L === z.lat) && !(Y === W && L === p.lat) };
1806
1806
  }
1807
1807
  /**
@@ -1814,7 +1814,7 @@ class r {
1814
1814
  let O, A;
1815
1815
  return M.forEach((b) => {
1816
1816
  b.forEach((W) => {
1817
- const q = { lng: a.roundPrecision(W[0], 8), lat: a.roundPrecision(W[1], 8) };
1817
+ const q = { lng: R.roundPrecision(W[0], 8), lat: R.roundPrecision(W[1], 8) };
1818
1818
  if (!A)
1819
1819
  p.push(q), A = q;
1820
1820
  else if (A.bearing === void 0)
@@ -1857,9 +1857,9 @@ class r {
1857
1857
  let p = 0;
1858
1858
  for (let O = 1; O < M.length; O++) {
1859
1859
  const A = M[O - 1], b = M[O];
1860
- b.gcToPrevious ? (A.bearing = this.calculateBearing(A, b, !1), b.distanceFromPrevious = this.calculateDistance(A, b, !1)) : (A.bearing = this.calculateBearing(A, b, !0), b.distanceFromPrevious = this.calculateDistance(A, b, !0)), p = a.roundPrecision(p + b.distanceFromPrevious), b.distanceFromStart = p;
1860
+ b.gcToPrevious ? (A.bearing = this.calculateBearing(A, b, !1), b.distanceFromPrevious = this.calculateDistance(A, b, !1)) : (A.bearing = this.calculateBearing(A, b, !0), b.distanceFromPrevious = this.calculateDistance(A, b, !0)), p = R.roundPrecision(p + b.distanceFromPrevious), b.distanceFromStart = p;
1861
1861
  }
1862
- return M.map((O) => (O.lng = a.convertToStdLng(O.lng), O));
1862
+ return M.map((O) => (O.lng = R.convertToStdLng(O.lng), O));
1863
1863
  }
1864
1864
  /**
1865
1865
  * 计算轨迹中心点
@@ -1870,11 +1870,11 @@ class r {
1870
1870
  for (const W of M)
1871
1871
  for (const q of W)
1872
1872
  z.push(q);
1873
- const p = i.featureCollection([]), O = a.convertToMonotonicLng2(z);
1873
+ const p = e.featureCollection([]), O = R.convertToMonotonicLng2(z);
1874
1874
  for (const W of O)
1875
- p.features.push(i.point(W));
1876
- const b = i.center(p).geometry.coordinates;
1877
- return { lng: a.convertToStdLng(b[0], 8), lat: a.roundPrecision(b[1], 8) };
1875
+ p.features.push(e.point(W));
1876
+ const b = e.center(p).geometry.coordinates;
1877
+ return { lng: R.convertToStdLng(b[0], 8), lat: R.roundPrecision(b[1], 8) };
1878
1878
  }
1879
1879
  /**
1880
1880
  * 计算中心点
@@ -1893,8 +1893,8 @@ class r {
1893
1893
  for (const A of M)
1894
1894
  for (const b of A)
1895
1895
  z.push(b);
1896
- const p = a.convertToMonotonicLng2(z), O = i.lineString(p);
1897
- return i.bbox(O);
1896
+ const p = R.convertToMonotonicLng2(z), O = e.lineString(p);
1897
+ return e.bbox(O);
1898
1898
  }
1899
1899
  /**
1900
1900
  * 计算BBox
@@ -1914,10 +1914,10 @@ class r {
1914
1914
  const O = [];
1915
1915
  for (let A = 1; A < M.length; A++) {
1916
1916
  const b = M[A - 1], W = M[A], q = M[A + 1];
1917
- let o = !1, R = !1;
1918
- if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (o = !0, O.push(b)), W.gcToPrevious && (o || (o = !0, O.push(b)), R = !0, O.push(W), A++), q) {
1919
- const Y = r.calculateDistance(b, W, !0), L = r.calculateDistance(W, q, !0), e = r.calculateDistance(b, q, !0), u = (Math.pow(Y, 2) + Math.pow(L, 2) - Math.pow(e, 2)) / (2 * Y * L);
1920
- Math.round(Math.acos(u) * 180 / Math.PI) < p && e > z && !R && (O.push(W), A++);
1917
+ let o = !1, d = !1;
1918
+ if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (o = !0, O.push(b)), W.gcToPrevious && (o || (o = !0, O.push(b)), d = !0, O.push(W), A++), q) {
1919
+ const Y = N.calculateDistance(b, W, !0), L = N.calculateDistance(W, q, !0), i = N.calculateDistance(b, q, !0), U = (Math.pow(Y, 2) + Math.pow(L, 2) - Math.pow(i, 2)) / (2 * Y * L);
1920
+ Math.round(Math.acos(U) * 180 / Math.PI) < p && i > z && !d && (O.push(W), A++);
1921
1921
  }
1922
1922
  if (A >= M.length - 1) {
1923
1923
  const Y = M.at(-1);
@@ -1949,15 +1949,38 @@ class r {
1949
1949
  const p = C.unix(M);
1950
1950
  let O = z.find((o) => o.positionTime === p.unix());
1951
1951
  if (!O) {
1952
- const o = (b = (A = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) < p.unix())) == null ? void 0 : A.sort((Y, L) => (Y.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : b.at(-1), R = (q = (W = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) > p.unix())) == null ? void 0 : W.sort((Y, L) => (Y.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : q.at(0);
1953
- if (o && R) {
1954
- const Y = r.calculateBearing(o, R, !0), L = r.calculateDistance(o, R), e = (p.unix() - o.positionTime) / (R.positionTime - o.positionTime);
1955
- O = r.calculateCoordinate(o, Y, L * e), O.positionTime = p.unix(), O.utc = p.format(), O.cog = Y, O.sog = Math.round(L / ((R.positionTime - o.positionTime) / 3600) * 100) / 100;
1952
+ const o = (b = (A = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) < p.unix())) == null ? void 0 : A.sort((Y, L) => (Y.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : b.at(-1), d = (q = (W = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) > p.unix())) == null ? void 0 : W.sort((Y, L) => (Y.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : q.at(0);
1953
+ if (o && d) {
1954
+ const Y = N.calculateBearing(o, d, !0), L = N.calculateDistance(o, d), i = (p.unix() - o.positionTime) / (d.positionTime - o.positionTime);
1955
+ O = N.calculateCoordinate(o, Y, L * i), O.positionTime = p.unix(), O.utc = p.format(), O.cog = Y, O.sog = Math.round(L / ((d.positionTime - o.positionTime) / 3600) * 100) / 100;
1956
1956
  } else
1957
- O = o || R, O && (O.utc = C.unix(O == null ? void 0 : O.positionTime).utc().format());
1957
+ O = o || d, O && (O.utc = C.unix(O == null ? void 0 : O.positionTime).utc().format());
1958
1958
  }
1959
1959
  return O;
1960
1960
  }
1961
+ /**
1962
+ * 推测船位时间
1963
+ * @param coordinate
1964
+ * @param positions
1965
+ */
1966
+ static deadReckoningTime(M, z) {
1967
+ z = JSON.parse(JSON.stringify(z)), z.sort((o, d) => o.positionTime - d.positionTime);
1968
+ let p = Number.MAX_SAFE_INTEGER, O = Number.MAX_SAFE_INTEGER;
1969
+ for (let o = 0; o < z.length - 1; o++) {
1970
+ const d = z[o], Y = z[o + 1], L = N.calculatePointToLineDistance(M, d, Y);
1971
+ L < p && (p = L, O = o);
1972
+ }
1973
+ const A = z[O], b = z[O + 1], W = N.calculateDistance(A, M), q = N.calculateDistance(b, M);
1974
+ if (W === 0)
1975
+ M = A;
1976
+ else if (q === 0)
1977
+ M = b;
1978
+ else {
1979
+ const o = N.nearestCoordinateInLine(M, A, b), d = A.positionTime, Y = b.positionTime, L = N.calculateDistance(A, o), i = N.calculateDistance(A, b), U = Math.round(d + (Y - d) * (L / i));
1980
+ M.positionTime = U;
1981
+ }
1982
+ return M.utc = M.positionTime ? C.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
1983
+ }
1961
1984
  /**
1962
1985
  * 翻转轨迹
1963
1986
  * @param route
@@ -1985,7 +2008,7 @@ class V0 {
1985
2008
  */
1986
2009
  static convert2Geojson(M) {
1987
2010
  var p;
1988
- const z = i.featureCollection([]);
2011
+ const z = e.featureCollection([]);
1989
2012
  for (const O of M) {
1990
2013
  if (O.forecasts) {
1991
2014
  const A = (p = O.history) == null ? void 0 : p[0];
@@ -1993,39 +2016,39 @@ class V0 {
1993
2016
  for (const b of O.forecasts) {
1994
2017
  const W = [], q = C(b.date).utc(), o = `${O.name}-${b.model}`;
1995
2018
  if (A) {
1996
- const R = C(A.updated).utc(), Y = i.point([A.lng, A.lat], {
2019
+ const d = C(A.updated).utc(), Y = e.point([A.lng, A.lat], {
1997
2020
  model: b.model,
1998
2021
  name: O.name,
1999
- date: R.format(),
2022
+ date: d.format(),
2000
2023
  hour: 0,
2001
- format: R.format("MMM-DD/HHmm[Z]"),
2002
- pressure: A.pressure > 1e4 ? a.roundPrecision(A.pressure / 100, 0) : a.roundPrecision(A.pressure, 0),
2024
+ format: d.format("MMM-DD/HHmm[Z]"),
2025
+ pressure: A.pressure > 1e4 ? R.roundPrecision(A.pressure / 100, 0) : R.roundPrecision(A.pressure, 0),
2003
2026
  wind: A == null ? void 0 : A.wind,
2004
2027
  category: o,
2005
2028
  type: "forecast"
2006
2029
  });
2007
2030
  z.features.push(Y), W.push(Y.geometry.coordinates);
2008
2031
  }
2009
- for (const R in b == null ? void 0 : b.hours) {
2010
- const Y = b.hours[R];
2032
+ for (const d in b == null ? void 0 : b.hours) {
2033
+ const Y = b.hours[d];
2011
2034
  Y.wind.spd = Y.wind.spd || Y.wind.speed;
2012
- const L = q.clone().add(Number(R), "hour"), e = i.point([Y.lng, Y.lat], {
2035
+ const L = q.clone().add(Number(d), "hour"), i = e.point([Y.lng, Y.lat], {
2013
2036
  model: b.model,
2014
2037
  name: O.name,
2015
2038
  date: L.format(),
2016
- hour: Number(R),
2039
+ hour: Number(d),
2017
2040
  format: L.format("MMM-DD/HHmm[Z]"),
2018
- pressure: Y.pressure > 1e4 ? a.roundPrecision(Y.pressure / 100, 0) : a.roundPrecision(Y.pressure, 0),
2041
+ pressure: Y.pressure > 1e4 ? R.roundPrecision(Y.pressure / 100, 0) : R.roundPrecision(Y.pressure, 0),
2019
2042
  gusts: Y.gusts,
2020
2043
  wind: Y.wind || {},
2021
2044
  movement: Y.movement,
2022
2045
  category: o,
2023
2046
  type: "forecast"
2024
2047
  });
2025
- z.features.push(e), W.push(e.geometry.coordinates);
2048
+ z.features.push(i), W.push(i.geometry.coordinates);
2026
2049
  }
2027
2050
  if ((W == null ? void 0 : W.length) > 1) {
2028
- const R = i.lineString(a.convertToMonotonicLng2(W), {
2051
+ const d = e.lineString(R.convertToMonotonicLng2(W), {
2029
2052
  date: b.date,
2030
2053
  id: O.id || O.name,
2031
2054
  model: b.model,
@@ -2033,18 +2056,18 @@ class V0 {
2033
2056
  category: o,
2034
2057
  type: "forecast"
2035
2058
  });
2036
- z.features.push(R);
2059
+ z.features.push(d);
2037
2060
  }
2038
2061
  }
2039
2062
  }
2040
2063
  if (O.history) {
2041
2064
  const A = [];
2042
2065
  for (const W of O.history) {
2043
- const q = C(W.updated).utc(), o = i.point([W.lng, W.lat], {
2066
+ const q = C(W.updated).utc(), o = e.point([W.lng, W.lat], {
2044
2067
  name: O.name,
2045
2068
  date: q.format(),
2046
2069
  format: q.format("MMM-DD/HHmm[Z]"),
2047
- pressure: W.pressure > 1e4 ? a.roundPrecision(W.pressure / 100, 0) : a.roundPrecision(W.pressure, 0),
2070
+ pressure: W.pressure > 1e4 ? R.roundPrecision(W.pressure / 100, 0) : R.roundPrecision(W.pressure, 0),
2048
2071
  spd: W.speed || W.spd,
2049
2072
  kts: W.kts,
2050
2073
  source: W.source,
@@ -2057,11 +2080,11 @@ class V0 {
2057
2080
  }
2058
2081
  const b = O.history[0];
2059
2082
  if (A.length === 1 && A.push(A[0]), A.length > 1) {
2060
- const W = i.lineString(a.convertToMonotonicLng2(A), {
2083
+ const W = e.lineString(R.convertToMonotonicLng2(A), {
2061
2084
  name: O.name,
2062
2085
  type: "history",
2063
2086
  updated: b == null ? void 0 : b.updated,
2064
- pressure: (b == null ? void 0 : b.pressure) > 1e4 ? a.roundPrecision((b == null ? void 0 : b.pressure) / 100, 0) : a.roundPrecision(b == null ? void 0 : b.pressure, 0),
2087
+ pressure: (b == null ? void 0 : b.pressure) > 1e4 ? R.roundPrecision((b == null ? void 0 : b.pressure) / 100, 0) : R.roundPrecision(b == null ? void 0 : b.pressure, 0),
2065
2088
  spd: (b == null ? void 0 : b.speed) || (b == null ? void 0 : b.spd),
2066
2089
  kts: b == null ? void 0 : b.kts,
2067
2090
  source: b == null ? void 0 : b.source,
@@ -2082,32 +2105,32 @@ class V0 {
2082
2105
  var A, b, W, q;
2083
2106
  const p = (A = M == null ? void 0 : M.data) == null ? void 0 : A.features.filter((o) => o.geometry.type === "LineString" && o.properties.type === "forecast"), O = [];
2084
2107
  for (const o of p) {
2085
- const R = o.properties.name, Y = o.properties.model, L = o.properties.showCircle, e = o.properties.disabled, u = C(o.properties.date).utc();
2086
- let S = z * 60 - (u.get("hour") * 60 + u.get("minute")) % (z * 60);
2108
+ const d = o.properties.name, Y = o.properties.model, L = o.properties.showCircle, i = o.properties.disabled, U = C(o.properties.date).utc();
2109
+ let r = z * 60 - (U.get("hour") * 60 + U.get("minute")) % (z * 60);
2087
2110
  const s = (b = M == null ? void 0 : M.data) == null ? void 0 : b.features.filter(
2088
- (l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${R}-${Y}`
2111
+ (l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${d}-${Y}`
2089
2112
  );
2090
- let P, G = u.clone().add(S, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2113
+ let P, G = U.clone().add(r, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2091
2114
  for (; P = this.pickIndex(s, G), P <= s.length - 1; ) {
2092
2115
  if (P > 0) {
2093
- const l = s[P], N = P === 0 ? void 0 : s[P - 1], I = (S / 60 - ((W = N == null ? void 0 : N.properties) == null ? void 0 : W.hour)) / (l.properties.hour - ((q = N == null ? void 0 : N.properties) == null ? void 0 : q.hour)), H = this.computeNumber(N == null ? void 0 : N.geometry.coordinates[0], l.geometry.coordinates[0], I), Q = this.computeNumber(N == null ? void 0 : N.geometry.coordinates[1], l.geometry.coordinates[1], I), F = i.point([H, Q], {
2094
- name: R,
2116
+ const l = s[P], B = P === 0 ? void 0 : s[P - 1], I = (r / 60 - ((W = B == null ? void 0 : B.properties) == null ? void 0 : W.hour)) / (l.properties.hour - ((q = B == null ? void 0 : B.properties) == null ? void 0 : q.hour)), H = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[0], l.geometry.coordinates[0], I), Q = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[1], l.geometry.coordinates[1], I), F = e.point([H, Q], {
2117
+ name: d,
2095
2118
  model: Y,
2096
2119
  category: l == null ? void 0 : l.properties.category,
2097
2120
  date: G.format(),
2098
2121
  format: G.format("MMM-DD/HHmm[Z]"),
2099
- gusts: this.computeNumber(N == null ? void 0 : N.properties.gusts, l.properties.gusts, I),
2100
- hour: this.computeNumber(N == null ? void 0 : N.properties.hour, l.properties.hour, I),
2101
- movement: this.computeNumber(N == null ? void 0 : N.properties.movement, l.properties.movement, I),
2102
- pressure: this.computeNumber(N == null ? void 0 : N.properties.pressure, l.properties.pressure, I),
2103
- wind: this.computeNumber(N == null ? void 0 : N.properties.wind, l.properties.wind, I),
2122
+ gusts: this.computeNumber(B == null ? void 0 : B.properties.gusts, l.properties.gusts, I),
2123
+ hour: this.computeNumber(B == null ? void 0 : B.properties.hour, l.properties.hour, I),
2124
+ movement: this.computeNumber(B == null ? void 0 : B.properties.movement, l.properties.movement, I),
2125
+ pressure: this.computeNumber(B == null ? void 0 : B.properties.pressure, l.properties.pressure, I),
2126
+ wind: this.computeNumber(B == null ? void 0 : B.properties.wind, l.properties.wind, I),
2104
2127
  type: "forecast",
2105
- disabled: e,
2128
+ disabled: i,
2106
2129
  showCircle: L
2107
2130
  });
2108
2131
  O.push(F);
2109
2132
  }
2110
- S += z * 60, G = u.clone().add(S, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2133
+ r += z * 60, G = U.clone().add(r, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2111
2134
  }
2112
2135
  }
2113
2136
  return O;
@@ -2137,28 +2160,28 @@ class V0 {
2137
2160
  const { t1: A, t2: b, hr: W, hours: q } = this.tropicalCenterTwin(z, 24, O);
2138
2161
  if (A && b) {
2139
2162
  if (!O.debug) {
2140
- const u = r.calculateDistance(M, A), S = r.calculateDistance(M, b);
2141
- if (u > 2 * p && S > 2 * p)
2142
- 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, S, {
2163
+ const U = N.calculateDistance(M, A), r = N.calculateDistance(M, b);
2164
+ if (U > 2 * p && r > 2 * p)
2165
+ 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, {
2143
2166
  from: M,
2144
2167
  t1: A,
2145
2168
  t2: b,
2146
2169
  hr: W
2147
2170
  }), {};
2148
2171
  }
2149
- const o = r.calculateBearing(M, A), R = r.calculateBearing(A, b), Y = Math.abs(o - R);
2172
+ const o = N.calculateBearing(M, A), d = N.calculateBearing(A, b), Y = Math.abs(o - d);
2150
2173
  let L = 0;
2151
2174
  Y < 180 ? L = Y + 90 : Y >= 180 && (L = Y - 90);
2152
- const e = r.calculateCoordinate(A, L, p);
2175
+ const i = N.calculateCoordinate(A, L, p);
2153
2176
  return Z == null || Z.info("[%s] the right tangent position: %j", O.requestId, {
2154
2177
  from: M,
2155
2178
  t1: A,
2156
2179
  t2: b,
2157
2180
  radius: p,
2158
2181
  bearing1: o,
2159
- bearing2: R,
2160
- right: e
2161
- }), { at: e, t1: A, t2: b, hr: Number(W), hours: q };
2182
+ bearing2: d,
2183
+ right: i
2184
+ }), { at: i, t1: A, t2: b, hr: Number(W), hours: q };
2162
2185
  }
2163
2186
  return {};
2164
2187
  }
@@ -2176,17 +2199,17 @@ class V0 {
2176
2199
  const { t1: A, t2: b, hr: W, hours: q } = this.tropicalCenterTwin(z, 24, O);
2177
2200
  if (A && b) {
2178
2201
  if (!O.debug) {
2179
- const e = r.calculateDistance(M, A), u = r.calculateDistance(M, b);
2180
- if (e > 2 * p && u > 2 * p)
2181
- return Z == null || Z.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", O.requestId, e, u, {
2202
+ const i = N.calculateDistance(M, A), U = N.calculateDistance(M, b);
2203
+ if (i > 2 * p && U > 2 * p)
2204
+ return Z == null || Z.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", O.requestId, i, U, {
2182
2205
  from: M,
2183
2206
  t1: A,
2184
2207
  t2: b,
2185
2208
  hr: W
2186
2209
  }), {};
2187
2210
  }
2188
- const o = r.calculateBearing(M, A), R = r.calculateBearing(A, b), Y = r.calculateDistance(M, A);
2189
- return { at: r.calculateCoordinate(A, o - R + 180, p < Y ? p : Y), t1: A, t2: b, hr: Number(W), hours: q };
2211
+ const o = N.calculateBearing(M, A), d = N.calculateBearing(A, b), Y = N.calculateDistance(M, A);
2212
+ return { at: N.calculateCoordinate(A, o - d + 180, p < Y ? p : Y), t1: A, t2: b, hr: Number(W), hours: q };
2190
2213
  } else
2191
2214
  return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: W }), {};
2192
2215
  }
@@ -2199,20 +2222,20 @@ class V0 {
2199
2222
  * @private
2200
2223
  */
2201
2224
  static tropicalCenterTwin(M, z = 24, p = {}) {
2202
- var R, Y, L, e, u;
2225
+ var d, Y, L, i, U;
2203
2226
  let O = {};
2204
- (R = M.forecasts) == null || R.forEach((S) => {
2205
- O = { ...S.hours, ...O };
2227
+ (d = M.forecasts) == null || d.forEach((r) => {
2228
+ O = { ...r.hours, ...O };
2206
2229
  });
2207
2230
  const A = ((Y = M == null ? void 0 : M.history) == null ? void 0 : Y[0]) || (O == null ? void 0 : O[(L = Object.keys(O)) == null ? void 0 : L[0]]);
2208
2231
  Z == null || Z.info("[%s] the first tropical center: %j", p.requestId, A);
2209
- let b = (e = Object.keys(O || {}).filter((S) => Number(S) <= (z < 0 ? 24 : z))) == null ? void 0 : e.at(-1);
2210
- b || (b = (u = Object.keys(O || {}).filter((S) => Number(S) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : u.at(-1));
2232
+ let b = (i = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : z))) == null ? void 0 : i.at(-1);
2233
+ b || (b = (U = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : U.at(-1));
2211
2234
  const W = O == null ? void 0 : O[b || -1];
2212
2235
  Z == null || Z.info("[%s] the second tropical center: %j in %d hrs", p.requestId, W, b);
2213
- const q = Object.keys(O || {}).filter((S) => Number(S) <= Number(b)), o = { 0: A };
2214
- for (const S of q)
2215
- o[S] = O[S];
2236
+ const q = Object.keys(O || {}).filter((r) => Number(r) <= Number(b)), o = { 0: A };
2237
+ for (const r of q)
2238
+ o[r] = O[r];
2216
2239
  return { t1: A, t2: W, hr: Number(b), hours: o };
2217
2240
  }
2218
2241
  static pickIndex(M, z) {
@@ -2246,7 +2269,7 @@ class t0 {
2246
2269
  return `${M.lat}|${M.lng}|${M.positionTime}|${M.sog}|${M.cog}|${M.hdg}|${M.draught}|${z}|${JSON.stringify(M.meteo || {})}|${M.vendor}|${M.deleted}`;
2247
2270
  }
2248
2271
  static str2Json(M) {
2249
- const [z, p, O, A, b, W, q, o, R, Y, L] = M.split("|");
2272
+ const [z, p, O, A, b, W, q, o, d, Y, L] = M.split("|");
2250
2273
  return {
2251
2274
  lat: Number(z),
2252
2275
  lng: Number(p),
@@ -2257,7 +2280,7 @@ class t0 {
2257
2280
  //@ts-ignore
2258
2281
  draught: isNaN(q) ? null : Number(q),
2259
2282
  type: o,
2260
- meteo: R ? JSON.parse(R) : void 0,
2283
+ meteo: d ? JSON.parse(d) : void 0,
2261
2284
  vendor: Y,
2262
2285
  deleted: L === "true"
2263
2286
  };
@@ -2272,8 +2295,8 @@ class t0 {
2272
2295
  const W = b;
2273
2296
  let q = M.at(-1);
2274
2297
  for (let o = A + 1; o < M.length; o++) {
2275
- const R = M[o];
2276
- if (R.sog = R.sog || 0, R.sog <= z) {
2298
+ const d = M[o];
2299
+ if (d.sog = d.sog || 0, d.sog <= z) {
2277
2300
  A = o;
2278
2301
  continue;
2279
2302
  } else {
@@ -2298,7 +2321,7 @@ class t0 {
2298
2321
  utc: C.unix(q.positionTime).utc().format()
2299
2322
  },
2300
2323
  duration: q.positionTime - W.positionTime,
2301
- distance: r.calculateDistance(W, q, !0, 4),
2324
+ distance: N.calculateDistance(W, q, !0, 4),
2302
2325
  avgSog: 0
2303
2326
  };
2304
2327
  o.avgSog = Math.round(o.distance / (o.duration / 3600) * 100) / 100, O.push(o);
@@ -2310,7 +2333,7 @@ class t0 {
2310
2333
  }
2311
2334
  export {
2312
2335
  t0 as AisHelper,
2313
- r as LaneHelper,
2314
- a as LngLatHelper,
2336
+ N as LaneHelper,
2337
+ R as LngLatHelper,
2315
2338
  V0 as TropicalHelper
2316
2339
  };