@idm-plugin/geo 1.8.9 → 1.9.1

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,8 +1,8 @@
1
1
  import * as N from "@turf/turf";
2
- import I from "moment";
2
+ import s from "moment";
3
3
  import _ from "@log4js-node/log4js-api";
4
4
  var a0 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function X0(G) {
5
+ function n0(G) {
6
6
  return G && G.__esModule && Object.prototype.hasOwnProperty.call(G, "default") ? G.default : G;
7
7
  }
8
8
  var j = { exports: {} };
@@ -13,275 +13,275 @@ var j = { exports: {} };
13
13
  //! license : MIT
14
14
  //! github.com/moment/moment-timezone
15
15
  (function(M, z) {
16
- G.exports ? G.exports = z(I) : z(M.moment);
16
+ G.exports ? G.exports = z(s) : 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", b = {}, p = {}, c = {}, O = {}, A = {}, o;
19
+ var z = "0.5.48", b = {}, p = {}, c = {}, O = {}, A = {}, W;
20
20
  (!M || typeof M.version != "string") && D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
21
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(o) {
24
+ return o > 96 ? o - 87 : o > 64 ? o - 29 : o - 48;
25
25
  }
26
- function T(W) {
27
- var a = 0, n = W.split("."), R = n[0], i = n[1] || "", B = 1, l, u = 0, V = 1;
28
- for (W.charCodeAt(0) === 45 && (a = 1, V = -1), a; a < R.length; a++)
29
- l = L(R.charCodeAt(a)), u = 60 * u + l;
30
- for (a = 0; a < i.length; a++)
31
- B = B / 60, l = L(i.charCodeAt(a)), u += l * B;
26
+ function T(o) {
27
+ var a = 0, X = o.split("."), R = X[0], e = X[1] || "", B = 1, Z, u = 0, V = 1;
28
+ for (o.charCodeAt(0) === 45 && (a = 1, V = -1), a; a < R.length; a++)
29
+ Z = L(R.charCodeAt(a)), u = 60 * u + Z;
30
+ for (a = 0; a < e.length; a++)
31
+ B = B / 60, Z = L(e.charCodeAt(a)), u += Z * B;
32
32
  return u * V;
33
33
  }
34
- function S(W) {
35
- for (var a = 0; a < W.length; a++)
36
- W[a] = T(W[a]);
34
+ function S(o) {
35
+ for (var a = 0; a < o.length; a++)
36
+ o[a] = T(o[a]);
37
37
  }
38
- function e(W, a) {
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;
38
+ function i(o, a) {
39
+ for (var X = 0; X < a; X++)
40
+ o[X] = Math.round((o[X - 1] || 0) + o[X] * 6e4);
41
+ o[a - 1] = 1 / 0;
42
42
  }
43
- function r(W, a) {
44
- var n = [], R;
43
+ function r(o, a) {
44
+ var X = [], R;
45
45
  for (R = 0; R < a.length; R++)
46
- n[R] = W[a[R]];
47
- return n;
46
+ X[R] = o[a[R]];
47
+ return X;
48
48
  }
49
- function s(W) {
50
- var a = W.split("|"), n = a[2].split(" "), R = a[3].split(""), i = a[4].split(" ");
51
- return S(n), S(R), S(i), e(i, R.length), {
49
+ function l(o) {
50
+ var a = o.split("|"), X = a[2].split(" "), R = a[3].split(""), e = a[4].split(" ");
51
+ return S(X), S(R), S(e), i(e, R.length), {
52
52
  name: a[0],
53
53
  abbrs: r(a[1].split(" "), R),
54
- offsets: r(n, R),
55
- untils: i,
54
+ offsets: r(X, R),
55
+ untils: e,
56
56
  population: a[5] | 0
57
57
  };
58
58
  }
59
- function Z(W) {
60
- W && this._set(s(W));
59
+ function P(o) {
60
+ o && this._set(l(o));
61
61
  }
62
- function P(W, a) {
63
- var n = a.length;
64
- if (W < a[0])
62
+ function E(o, a) {
63
+ var X = a.length;
64
+ if (o < a[0])
65
65
  return 0;
66
- if (n > 1 && a[n - 1] === 1 / 0 && W >= a[n - 2])
67
- return n - 1;
68
- if (W >= a[n - 1])
66
+ if (X > 1 && a[X - 1] === 1 / 0 && o >= a[X - 2])
67
+ return X - 1;
68
+ if (o >= a[X - 1])
69
69
  return -1;
70
- for (var R, i = 0, B = n - 1; B - i > 1; )
71
- R = Math.floor((i + B) / 2), a[R] <= W ? i = R : B = R;
70
+ for (var R, e = 0, B = X - 1; B - e > 1; )
71
+ R = Math.floor((e + B) / 2), a[R] <= o ? e = R : B = R;
72
72
  return B;
73
73
  }
74
- Z.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;
74
+ P.prototype = {
75
+ _set: function(o) {
76
+ this.name = o.name, this.abbrs = o.abbrs, this.untils = o.untils, this.offsets = o.offsets, this.population = o.population;
77
77
  },
78
- _index: function(W) {
79
- var a = +W, n = this.untils, R;
80
- if (R = P(a, n), R >= 0)
78
+ _index: function(o) {
79
+ var a = +o, X = this.untils, R;
80
+ if (R = E(a, X), R >= 0)
81
81
  return R;
82
82
  },
83
83
  countries: function() {
84
- var W = this.name;
84
+ var o = this.name;
85
85
  return Object.keys(c).filter(function(a) {
86
- return c[a].zones.indexOf(W) !== -1;
86
+ return c[a].zones.indexOf(o) !== -1;
87
87
  });
88
88
  },
89
- parse: function(W) {
90
- var a = +W, n = this.offsets, R = this.untils, i = R.length - 1, B, l, u, V;
91
- for (V = 0; V < i; V++)
92
- if (B = n[V], l = n[V + 1], u = n[V && V - 1], B < l && t.moveAmbiguousForward ? B = l : B > u && t.moveInvalidForward && (B = u), a < R[V] - B * 6e4)
93
- return n[V];
94
- return n[i];
89
+ parse: function(o) {
90
+ var a = +o, X = this.offsets, R = this.untils, e = R.length - 1, B, Z, u, V;
91
+ for (V = 0; V < e; V++)
92
+ if (B = X[V], Z = X[V + 1], u = X[V && V - 1], B < Z && t.moveAmbiguousForward ? B = Z : B > u && t.moveInvalidForward && (B = u), a < R[V] - B * 6e4)
93
+ return X[V];
94
+ return X[e];
95
95
  },
96
- abbr: function(W) {
97
- return this.abbrs[this._index(W)];
96
+ abbr: function(o) {
97
+ return this.abbrs[this._index(o)];
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(o) {
100
+ return D("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(o)];
101
101
  },
102
- utcOffset: function(W) {
103
- return this.offsets[this._index(W)];
102
+ utcOffset: function(o) {
103
+ return this.offsets[this._index(o)];
104
104
  }
105
105
  };
106
- function U(W, a) {
107
- this.name = W, this.zones = a;
106
+ function U(o, a) {
107
+ this.name = o, this.zones = a;
108
108
  }
109
- function m(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 m(o) {
110
+ var a = o.toTimeString(), X = a.match(/\([a-z ]+\)/i);
111
+ X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X = a.match(/[A-Z]{3,5}/g), X = X ? X[0] : void 0), X === "GMT" && (X = void 0), this.at = +o, this.abbr = X, this.offset = o.getTimezoneOffset();
112
112
  }
113
- function H(W) {
114
- this.zone = W, this.offsetScore = 0, this.abbrScore = 0;
113
+ function H(o) {
114
+ this.zone = o, 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(o) {
117
+ this.offsetScore += Math.abs(this.zone.utcOffset(o.at) - o.offset), this.zone.abbr(o.at).replace(/[^A-Z]/g, "") !== o.abbr && this.abbrScore++;
118
118
  };
119
- function Q(W, a) {
120
- for (var n, R; R = ((a.at - W.at) / 12e4 | 0) * 6e4; )
121
- n = new m(new Date(W.at + R)), n.offset === W.offset ? W = n : a = n;
122
- return W;
119
+ function Q(o, a) {
120
+ for (var X, R; R = ((a.at - o.at) / 12e4 | 0) * 6e4; )
121
+ X = new m(new Date(o.at + R)), X.offset === o.offset ? o = X : a = X;
122
+ return o;
123
123
  }
124
124
  function F() {
125
- var W = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new m(new Date(W, 0, 1)), n = a.offset, R = [a], i, B, l, u;
125
+ var o = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new m(new Date(o, 0, 1)), X = a.offset, R = [a], e, B, Z, u;
126
126
  for (u = 1; u < 48; u++)
127
- l = new Date(W, u, 1).getTimezoneOffset(), l !== n && (B = new m(new Date(W, u, 1)), i = Q(a, B), R.push(i), R.push(new m(new Date(i.at + 6e4))), a = B, n = l);
127
+ Z = new Date(o, u, 1).getTimezoneOffset(), Z !== X && (B = new m(new Date(o, u, 1)), e = Q(a, B), R.push(e), R.push(new m(new Date(e.at + 6e4))), a = B, X = Z);
128
128
  for (u = 0; u < 4; u++)
129
- R.push(new m(new Date(W + u, 0, 1))), R.push(new m(new Date(W + u, 6, 1)));
129
+ R.push(new m(new Date(o + u, 0, 1))), R.push(new m(new Date(o + u, 6, 1)));
130
130
  return R;
131
131
  }
132
- function M0(W, a) {
133
- return W.offsetScore !== a.offsetScore ? W.offsetScore - a.offsetScore : W.abbrScore !== a.abbrScore ? W.abbrScore - a.abbrScore : W.zone.population !== a.zone.population ? a.zone.population - W.zone.population : a.zone.name.localeCompare(W.zone.name);
132
+ function M0(o, a) {
133
+ return o.offsetScore !== a.offsetScore ? o.offsetScore - a.offsetScore : o.abbrScore !== a.abbrScore ? o.abbrScore - a.abbrScore : o.zone.population !== a.zone.population ? a.zone.population - o.zone.population : a.zone.name.localeCompare(o.zone.name);
134
134
  }
135
- function z0(W, a) {
136
- var n, R;
137
- for (S(a), n = 0; n < a.length; n++)
138
- R = a[n], A[R] = A[R] || {}, A[R][W] = !0;
135
+ function z0(o, a) {
136
+ var X, R;
137
+ for (S(a), X = 0; X < a.length; X++)
138
+ R = a[X], A[R] = A[R] || {}, A[R][o] = !0;
139
139
  }
140
- function b0(W) {
141
- var a = W.length, n = {}, R = [], i = {}, B, l, u, V;
140
+ function b0(o) {
141
+ var a = o.length, X = {}, R = [], e = {}, B, Z, u, V;
142
142
  for (B = 0; B < a; B++)
143
- if (u = W[B].offset, !i.hasOwnProperty(u)) {
143
+ if (u = o[B].offset, !e.hasOwnProperty(u)) {
144
144
  V = A[u] || {};
145
- for (l in V)
146
- V.hasOwnProperty(l) && (n[l] = !0);
147
- i[u] = !0;
145
+ for (Z in V)
146
+ V.hasOwnProperty(Z) && (X[Z] = !0);
147
+ e[u] = !0;
148
148
  }
149
- for (B in n)
150
- n.hasOwnProperty(B) && R.push(O[B]);
149
+ for (B in X)
150
+ X.hasOwnProperty(B) && R.push(O[B]);
151
151
  return R;
152
152
  }
153
153
  function p0() {
154
154
  try {
155
- var W = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
- if (W && W.length > 3) {
157
- var a = O[h(W)];
155
+ var o = Intl.DateTimeFormat().resolvedOptions().timeZone;
156
+ if (o && o.length > 3) {
157
+ var a = O[h(o)];
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 " + o + " from the Intl api, but did not have that data loaded.");
161
161
  }
162
162
  } catch {
163
163
  }
164
- var n = F(), R = n.length, i = b0(n), B = [], l, u, V;
165
- for (u = 0; u < i.length; u++) {
166
- for (l = new H(g(i[u])), V = 0; V < R; V++)
167
- l.scoreOffsetAt(n[V]);
168
- B.push(l);
164
+ var X = F(), R = X.length, e = b0(X), B = [], Z, u, V;
165
+ for (u = 0; u < e.length; u++) {
166
+ for (Z = new H(g(e[u])), V = 0; V < R; V++)
167
+ Z.scoreOffsetAt(X[V]);
168
+ B.push(Z);
169
169
  }
170
170
  return B.sort(M0), B.length > 0 ? B[0].zone.name : void 0;
171
171
  }
172
- function O0(W) {
173
- return (!o || W) && (o = p0()), o;
172
+ function O0(o) {
173
+ return (!W || o) && (W = p0()), W;
174
174
  }
175
- function h(W) {
176
- return (W || "").toLowerCase().replace(/\//g, "_");
175
+ function h(o) {
176
+ return (o || "").toLowerCase().replace(/\//g, "_");
177
177
  }
178
- function k(W) {
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 = h(n), b[i] = W[a], O[i] = n, z0(i, R[2].split(" "));
178
+ function k(o) {
179
+ var a, X, R, e;
180
+ for (typeof o == "string" && (o = [o]), a = 0; a < o.length; a++)
181
+ R = o[a].split("|"), X = R[0], e = h(X), b[e] = o[a], O[e] = X, z0(e, R[2].split(" "));
182
182
  }
183
- function g(W, a) {
184
- W = h(W);
185
- var n = b[W], R;
186
- return n instanceof Z ? n : typeof n == "string" ? (n = new Z(n), b[W] = n, n) : p[W] && a !== g && (R = g(p[W], g)) ? (n = b[W] = new Z(), n._set(R), n.name = O[W], n) : null;
183
+ function g(o, a) {
184
+ o = h(o);
185
+ var X = b[o], R;
186
+ return X instanceof P ? X : typeof X == "string" ? (X = new P(X), b[o] = X, X) : p[o] && a !== g && (R = g(p[o], g)) ? (X = b[o] = new P(), X._set(R), X.name = O[o], X) : null;
187
187
  }
188
188
  function A0() {
189
- var W, a = [];
190
- for (W in O)
191
- O.hasOwnProperty(W) && (b[W] || b[p[W]]) && O[W] && a.push(O[W]);
189
+ var o, a = [];
190
+ for (o in O)
191
+ O.hasOwnProperty(o) && (b[o] || b[p[o]]) && O[o] && a.push(O[o]);
192
192
  return a.sort();
193
193
  }
194
194
  function c0() {
195
195
  return Object.keys(c);
196
196
  }
197
- function v(W) {
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 = h(n[0]), i = h(n[1]), p[R] = i, O[R] = n[0], p[i] = R, O[i] = n[1];
197
+ function v(o) {
198
+ var a, X, R, e;
199
+ for (typeof o == "string" && (o = [o]), a = 0; a < o.length; a++)
200
+ X = o[a].split("|"), R = h(X[0]), e = h(X[1]), p[R] = e, O[R] = X[0], p[e] = R, O[e] = X[1];
201
201
  }
202
- function W0(W) {
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(" "), c[n] = new U(
207
- n,
202
+ function W0(o) {
203
+ var a, X, R, e;
204
+ if (!(!o || !o.length))
205
+ for (a = 0; a < o.length; a++)
206
+ e = o[a].split("|"), X = e[0].toUpperCase(), R = e[1].split(" "), c[X] = new U(
207
+ X,
208
208
  R
209
209
  );
210
210
  }
211
- function o0(W) {
212
- return W = W.toUpperCase(), c[W] || null;
211
+ function o0(o) {
212
+ return o = o.toUpperCase(), c[o] || null;
213
213
  }
214
- function q0(W, a) {
215
- if (W = o0(W), !W)
214
+ function q0(o, a) {
215
+ if (o = o0(o), !o)
216
216
  return null;
217
- var n = W.zones.sort();
218
- return a ? n.map(function(R) {
219
- var i = g(R);
217
+ var X = o.zones.sort();
218
+ return a ? X.map(function(R) {
219
+ var e = g(R);
220
220
  return {
221
221
  name: R,
222
- offset: i.utcOffset(/* @__PURE__ */ new Date())
222
+ offset: e.utcOffset(/* @__PURE__ */ new Date())
223
223
  };
224
- }) : n;
224
+ }) : X;
225
225
  }
226
- function Y0(W) {
227
- k(W.zones), v(W.links), W0(W.countries), t.dataVersion = W.version;
226
+ function Y0(o) {
227
+ k(o.zones), v(o.links), W0(o.countries), t.dataVersion = o.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 $(o) {
230
+ return $.didShowError || ($.didShowError = !0, D("moment.tz.zoneExists('" + o + "') has been deprecated in favor of !moment.tz.zone('" + o + "')")), !!g(o);
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(o) {
233
+ var a = o._f === "X" || o._f === "x";
234
+ return !!(o._a && o._tzm === void 0 && !a);
235
235
  }
236
- function D(W) {
237
- typeof console < "u" && typeof console.error == "function" && console.error(W);
236
+ function D(o) {
237
+ typeof console < "u" && typeof console.error == "function" && console.error(o);
238
238
  }
239
- function t(W) {
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;
239
+ function t(o) {
240
+ var a = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], R = M.utc.apply(null, a), e;
241
+ return !M.isMoment(o) && J(R) && (e = g(X)) && R.add(e.parse(R), "minutes"), R.tz(X), R;
242
242
  }
243
- t.version = z, t.dataVersion = "", t._zones = b, t._links = p, t._names = O, t._countries = c, t.add = k, t.link = v, t.load = Y0, t.zone = g, t.zoneExists = $, t.guess = O0, t.names = A0, t.Zone = Z, t.unpack = s, t.unpackBase60 = T, t.needsOffset = J, t.moveInvalidForward = !0, t.moveAmbiguousForward = !1, t.countries = c0, t.zonesForCountry = q0;
243
+ t.version = z, t.dataVersion = "", t._zones = b, t._links = p, t._names = O, t._countries = c, t.add = k, t.link = v, t.load = Y0, t.zone = g, t.zoneExists = $, t.guess = O0, t.names = A0, t.Zone = P, t.unpack = l, t.unpackBase60 = T, t.needsOffset = J, t.moveInvalidForward = !0, t.moveAmbiguousForward = !1, t.countries = c0, t.zonesForCountry = q0;
244
244
  var C = M.fn;
245
- M.tz = t, M.defaultZone = null, M.updateOffset = function(W, a) {
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;
245
+ M.tz = t, M.defaultZone = null, M.updateOffset = function(o, a) {
246
+ var X = M.defaultZone, R;
247
+ if (o._z === void 0 && (X && J(o) && !o._isUTC && o.isValid() && (o._d = M.utc(o._a)._d, o.utc().add(X.parse(o), "minutes")), o._z = X), o._z)
248
+ if (R = o._z.utcOffset(o), Math.abs(R) < 16 && (R = R / 60), o.utcOffset !== void 0) {
249
+ var e = o._z;
250
+ o.utcOffset(-R, a), o._z = e;
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
+ o.zone(R, a);
253
+ }, C.tz = function(o, a) {
254
+ if (o) {
255
+ if (typeof o != "string")
256
+ throw new Error("Time zone name must be a string, got " + o + " [" + typeof o + "]");
257
+ return this._z = g(o), this._z ? M.updateOffset(this, a) : D("Moment Timezone has no data for " + o + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
258
258
  }
259
259
  if (this._z)
260
260
  return this._z.name;
261
261
  };
262
- function y(W) {
262
+ function y(o) {
263
263
  return function() {
264
- return this._z ? this._z.abbr(this) : W.call(this);
264
+ return this._z ? this._z.abbr(this) : o.call(this);
265
265
  };
266
266
  }
267
- function w(W) {
267
+ function w(o) {
268
268
  return function() {
269
- return this._z = null, W.apply(this, arguments);
269
+ return this._z = null, o.apply(this, arguments);
270
270
  };
271
271
  }
272
- function d0(W) {
272
+ function d0(o) {
273
273
  return function() {
274
- return arguments.length > 0 && (this._z = null), W.apply(this, arguments);
274
+ return arguments.length > 0 && (this._z = null), o.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(o) {
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 = o ? g(o) : null, M;
279
279
  };
280
280
  var K = M.momentProperties;
281
281
  return Object.prototype.toString.call(K) === "[object Array]" ? (K.push("_z"), K.push("_a")) : K && (K._z = null), M;
282
282
  });
283
283
  })(j);
284
- var n0 = j.exports;
284
+ var X0 = j.exports;
285
285
  const R0 = "2025b", L0 = [
286
286
  "Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q|48e5",
287
287
  "Africa/Nairobi|LMT +0230 EAT +0245|-2r.g -2u -30 -2J|012132|-2ua2r.g N6nV.g 3Fbu h1cu dzbJ|47e5",
@@ -1135,7 +1135,7 @@ const R0 = "2025b", L0 = [
1135
1135
  links: T0,
1136
1136
  countries: i0
1137
1137
  };
1138
- var N0 = n0;
1138
+ var N0 = X0;
1139
1139
  N0.tz.load(e0);
1140
1140
  var x = { exports: {} };
1141
1141
  (function(G) {
@@ -1145,23 +1145,23 @@ var x = { exports: {} };
1145
1145
  throw new RangeError("invalid coordinates");
1146
1146
  if (90 <= z)
1147
1147
  return "Etc/GMT";
1148
- var O = -1, A = 48 * (180 + b) / 360.00000000000006, o = 24 * (90 - z) / 180.00000000000003, q = 0 | A, Y = 0 | o, d = 96 * Y + 2 * q;
1148
+ var O = -1, A = 48 * (180 + b) / 360.00000000000006, W = 24 * (90 - z) / 180.00000000000003, q = 0 | A, Y = 0 | W, d = 96 * Y + 2 * q;
1149
1149
  for (d = 56 * p.charCodeAt(d) + p.charCodeAt(d + 1) - 1995; d + c.length < 3136; )
1150
- d = 56 * p.charCodeAt(d = 8 * (O = O + d + 1) + 4 * (Y = 0 | (o = 2 * (o - Y) % 2)) + 2 * (q = 0 | (A = 2 * (A - q) % 2)) + 2304) + p.charCodeAt(d + 1) - 1995;
1150
+ d = 56 * p.charCodeAt(d = 8 * (O = O + d + 1) + 4 * (Y = 0 | (W = 2 * (W - Y) % 2)) + 2 * (q = 0 | (A = 2 * (A - q) % 2)) + 2304) + p.charCodeAt(d + 1) - 1995;
1151
1151
  return c[d + c.length - 3136];
1152
1152
  }
1153
1153
  G.exports = M;
1154
1154
  })(x);
1155
- var f0 = x.exports;
1156
- const S0 = /* @__PURE__ */ X0(f0);
1157
- class X {
1155
+ var S0 = x.exports;
1156
+ const f0 = /* @__PURE__ */ n0(S0);
1157
+ class n {
1158
1158
  /**
1159
1159
  * 基于输入的经度,计算出时区
1160
1160
  * @param lng
1161
1161
  * @param lat
1162
1162
  */
1163
1163
  static guessTimeZoneOffset(M, z) {
1164
- const b = S0(z, M), p = I().tz(b).utcOffset();
1164
+ const b = f0(z, M), p = s().tz(b).utcOffset();
1165
1165
  return this.roundPrecision(p / 60, 1);
1166
1166
  }
1167
1167
  /**
@@ -1179,17 +1179,17 @@ class X {
1179
1179
  * @param format
1180
1180
  */
1181
1181
  static lng2pretty(M, z = 6, b = "H°M′") {
1182
- M = X.convertToStdLng(M, z);
1182
+ M = n.convertToStdLng(M, z);
1183
1183
  let p = "E";
1184
1184
  M < 0 && (p = "W"), M = Math.abs(M), b = b.toUpperCase();
1185
- let c = M * 3600, O, A, o, q, Y, d;
1186
- O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A = X.padNumber(O, 2, 2)), o = c / 60 % 60, b.indexOf("M") !== -1 && (b.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), c = c - o * 60), Y = c / 3600, b.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(3, "0") : d = X.padNumber(Y, 3, 2), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1185
+ let c = M * 3600, O, A, W, q, Y, d;
1186
+ O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A = n.padNumber(O, 2, 2)), W = c / 60 % 60, b.indexOf("M") !== -1 && (b.indexOf("S") !== -1 ? q = n.roundPrecision(W, z).toString().padStart(2, "0") : q = n.padNumber(W, 2, 2), c = c - W * 60), Y = c / 3600, b.indexOf("M") !== -1 ? d = n.roundPrecision(Y, z).toString().padStart(3, "0") : d = n.padNumber(Y, 3, 2), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1187
1187
  const L = `${b.replace(/S+/gi, A).replace(/M+/gi, q).replace(/H+/gi, d)}${p}`;
1188
1188
  return {
1189
1189
  direction: p,
1190
- degree: X.roundPrecision(Y, z),
1191
- minute: X.roundPrecision(o, z),
1192
- second: X.roundPrecision(O, z),
1190
+ degree: n.roundPrecision(Y, z),
1191
+ minute: n.roundPrecision(W, z),
1192
+ second: n.roundPrecision(O, z),
1193
1193
  pretty: L
1194
1194
  };
1195
1195
  }
@@ -1203,64 +1203,64 @@ class X {
1203
1203
  M = M % 180;
1204
1204
  let p = "N";
1205
1205
  M < 0 && (p = "S"), M = Math.abs(M), b = b.toUpperCase();
1206
- let c = M * 3600, O, A, o, q, Y, d;
1207
- O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A = X.padNumber(O, 2, 2)), o = c / 60 % 60, b.indexOf("M") !== -1 && (b.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), c = c - o * 60), Y = c / 3600, b.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(2, "0") : d = X.padNumber(Y, 2, 2), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1206
+ let c = M * 3600, O, A, W, q, Y, d;
1207
+ O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A = n.padNumber(O, 2, 2)), W = c / 60 % 60, b.indexOf("M") !== -1 && (b.indexOf("S") !== -1 ? q = n.roundPrecision(W, z).toString().padStart(2, "0") : q = n.padNumber(W, 2, 2), c = c - W * 60), Y = c / 3600, b.indexOf("M") !== -1 ? d = n.roundPrecision(Y, z).toString().padStart(2, "0") : d = n.padNumber(Y, 2, 2), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1208
1208
  const L = `${b.replace(/S+/gi, A).replace(/M+/gi, q).replace(/H+/gi, d)}${p}`;
1209
1209
  return {
1210
1210
  direction: p,
1211
- degree: X.roundPrecision(Y, z),
1212
- minute: X.roundPrecision(o, z),
1213
- second: X.roundPrecision(O, z),
1211
+ degree: n.roundPrecision(Y, z),
1212
+ minute: n.roundPrecision(W, z),
1213
+ second: n.roundPrecision(O, z),
1214
1214
  pretty: L
1215
1215
  };
1216
1216
  }
1217
1217
  static str2Lng(M, z = 6) {
1218
1218
  let b;
1219
1219
  if (isNaN(M)) {
1220
- M = X.strReplace(M, "LNG");
1220
+ M = n.strReplace(M, "LNG");
1221
1221
  const p = M[M.length - 1].toUpperCase();
1222
1222
  M = M.substring(0, M.length - 1).trim();
1223
1223
  const c = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
1224
- let [O, A, o] = c;
1225
- if (A = A || 0, A = A > 60 ? A / Math.pow(10, String(A).length - 2) : A, o = o || 0, o = o > 60 ? o / Math.pow(10, String(o).length - 2) : o, O > 360 && !A) {
1224
+ let [O, A, W] = c;
1225
+ if (A = A || 0, A = A > 60 ? A / Math.pow(10, String(A).length - 2) : A, W = W || 0, W = W > 60 ? W / Math.pow(10, String(W).length - 2) : W, O > 360 && !A) {
1226
1226
  const q = this.roundPrecision(O / 100, 0);
1227
1227
  A = O - q * 100, O = q;
1228
1228
  }
1229
- b = O + A / 60 + o / 3600, p === "W" && (b = b * -1);
1229
+ b = O + A / 60 + W / 3600, p === "W" && (b = b * -1);
1230
1230
  } else
1231
1231
  b = Number(M);
1232
- return X.convertToStdLng(b, z);
1232
+ return n.convertToStdLng(b, z);
1233
1233
  }
1234
1234
  static str2Lat(M, z = 6) {
1235
1235
  let b;
1236
1236
  if (isNaN(M)) {
1237
- M = X.strReplace(M, "LAT");
1237
+ M = n.strReplace(M, "LAT");
1238
1238
  const p = M[M.length - 1].toUpperCase();
1239
1239
  M = M.substring(0, M.length - 1).trim();
1240
1240
  const c = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
1241
- let [O, A, o] = c;
1242
- if (o = o || 0, A = A || 0, A = A > 60 ? A / Math.pow(10, String(A).length - 2) : A, o = o > 60 ? o / Math.pow(10, String(o).length - 2) : o, O > 90 && !A) {
1241
+ let [O, A, W] = c;
1242
+ if (W = W || 0, A = A || 0, A = A > 60 ? A / Math.pow(10, String(A).length - 2) : A, W = W > 60 ? W / Math.pow(10, String(W).length - 2) : W, O > 90 && !A) {
1243
1243
  const q = this.roundPrecision(O / 100, 0);
1244
1244
  A = O - q * 100, O = q;
1245
1245
  }
1246
- if (b = O + A / 60 + o / 3600, b > 90)
1246
+ if (b = O + A / 60 + W / 3600, b > 90)
1247
1247
  throw new Error(`latitude out of range: ${M}${p}`);
1248
1248
  p === "S" && (b = b * -1);
1249
1249
  } else
1250
1250
  b = Number(M);
1251
- return X.roundPrecision(b, z);
1251
+ return n.roundPrecision(b, z);
1252
1252
  }
1253
1253
  static str2LngOrLat(M, z = 6, b = "LAT") {
1254
- M = X.strReplace(M, b);
1254
+ M = n.strReplace(M, b);
1255
1255
  const p = M[M.length - 1].toUpperCase();
1256
1256
  return ["N", "S"].includes(p) ? {
1257
- lat: X.str2Lat(M, z)
1257
+ lat: n.str2Lat(M, z)
1258
1258
  } : {
1259
- lng: X.str2Lng(M, z)
1259
+ lng: n.str2Lng(M, z)
1260
1260
  };
1261
1261
  }
1262
1262
  static convertToStdLng(M, z = 6) {
1263
- return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), X.roundPrecision(M, z);
1263
+ return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), n.roundPrecision(M, z);
1264
1264
  }
1265
1265
  static roundPrecision(M, z = 6) {
1266
1266
  const b = Number("1".padEnd(z + 1, "0"));
@@ -1303,7 +1303,7 @@ class X {
1303
1303
  * @param dcmPrecision 小数位数
1304
1304
  */
1305
1305
  static padNumber(M, z = 2, b = 2) {
1306
- const p = X.roundPrecision(M - Math.trunc(M), b), c = p >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
1306
+ const p = n.roundPrecision(M - Math.trunc(M), b), c = p >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
1307
1307
  return p >= 1 ? c : b > 0 ? `${c}.${Math.trunc(p * Math.pow(10, b)).toString().padStart(b, "0")}` : c;
1308
1308
  }
1309
1309
  }
@@ -1328,7 +1328,7 @@ class f {
1328
1328
  [z.lng, z.lat]
1329
1329
  ]);
1330
1330
  let O;
1331
- return b ? O = N.rhumbBearing(c.features[0], c.features[1]) : O = N.bearing(c.features[0], c.features[1]), O < 0 && (O += 360), X.roundPrecision(O, p);
1331
+ return b ? O = N.rhumbBearing(c.features[0], c.features[1]) : O = N.bearing(c.features[0], c.features[1]), O < 0 && (O += 360), n.roundPrecision(O, p);
1332
1332
  }
1333
1333
  /**
1334
1334
  * 计算两点间距离
@@ -1340,13 +1340,13 @@ class f {
1340
1340
  * @returns {number}
1341
1341
  */
1342
1342
  static calculateDistance(M, z, b = !0, p = 4, c = "nauticalmiles") {
1343
- M = { ...M }, z = { ...z }, M.lng = X.convertToStdLng(M.lng, p), z.lng = X.convertToStdLng(z.lng, p);
1343
+ M = { ...M }, z = { ...z }, M.lng = n.convertToStdLng(M.lng, p), z.lng = n.convertToStdLng(z.lng, p);
1344
1344
  const O = N.points([
1345
1345
  [M.lng, M.lat],
1346
1346
  [z.lng, z.lat]
1347
1347
  ]);
1348
1348
  let A;
1349
- return b ? A = N.rhumbDistance(O.features[0], O.features[1], { units: c }) : A = N.distance(O.features[0], O.features[1], { units: c }), X.roundPrecision(A, p);
1349
+ return b ? A = N.rhumbDistance(O.features[0], O.features[1], { units: c }) : A = N.distance(O.features[0], O.features[1], { units: c }), n.roundPrecision(A, p);
1350
1350
  }
1351
1351
  /**
1352
1352
  * 计算航线距离
@@ -1358,12 +1358,12 @@ class f {
1358
1358
  let p = 0, c;
1359
1359
  for (const O of M)
1360
1360
  for (let A = 0; A < O.length - 1; A++) {
1361
- const o = { lng: O[A][0], lat: O[A][1] };
1362
- A === 0 && c && (p += this.calculateDistance(c, o, !0, z, b));
1361
+ const W = { lng: O[A][0], lat: O[A][1] };
1362
+ A === 0 && c && (p += this.calculateDistance(c, W, !0, z, b));
1363
1363
  const q = { lng: O[A + 1][0], lat: O[A + 1][1] };
1364
- p += this.calculateDistance(o, q, !0, z, b), c = q;
1364
+ p += this.calculateDistance(W, q, !0, z, b), c = q;
1365
1365
  }
1366
- return X.roundPrecision(p, z);
1366
+ return n.roundPrecision(p, z);
1367
1367
  }
1368
1368
  /**
1369
1369
  * 计算坐标(基于方位角和距离)
@@ -1377,8 +1377,8 @@ class f {
1377
1377
  const O = N.point([M.lng, M.lat]);
1378
1378
  let A;
1379
1379
  c ? A = N.rhumbDestination(O, b, z, { units: p }) : A = N.destination(O, b, z, { units: p });
1380
- const o = A.geometry.coordinates;
1381
- return { lng: X.convertToStdLng(o[0], 8), lat: X.roundPrecision(o[1], 8) };
1380
+ const W = A.geometry.coordinates;
1381
+ return { lng: n.convertToStdLng(W[0], 8), lat: n.roundPrecision(W[1], 8) };
1382
1382
  }
1383
1383
  /**
1384
1384
  * 插值大圆坐标(基于两点方位角和间距)
@@ -1390,17 +1390,18 @@ class f {
1390
1390
  * @param units 单位,默认 nm(海里)
1391
1391
  */
1392
1392
  static interpolateCoordinates(M, z, b, p = !0, c = !0, O = "nauticalmiles") {
1393
- const A = [], o = this.calculateBearing(M, z, !1), q = this.calculateDistance(M, z, !1, 8, O);
1393
+ const A = [], W = this.calculateBearing(M, z, !1), q = this.calculateDistance(M, z, !1, 8, O);
1394
1394
  p && A.push({ lng: M.lng, lat: M.lat });
1395
1395
  let Y = 0;
1396
1396
  for (; Y < q; )
1397
- Y += b, Y < q && A.push(this.calculateCoordinate(M, o, Y, O, !1));
1397
+ Y += b, Y < q && A.push(this.calculateCoordinate(M, W, Y, O, !1));
1398
1398
  return c && A.push({ lng: z.lng, lat: z.lat }), A;
1399
1399
  }
1400
1400
  /**
1401
1401
  * 分组坐标(如相邻两个坐标经度差超180度,需以180为界将坐标分为两组)
1402
- * @param coordinates [{lng, lat}]
1402
+ * @param coordinates
1403
1403
  * @param rhumb
1404
+ * @param deduplicate
1404
1405
  * @example
1405
1406
  * coordinates: [{lng: 160,lat: 30}, {lng: 170, lat: 40},{lng: -170, lat: 40},{lng: -160, lat: 30}]
1406
1407
  * @return [
@@ -1408,38 +1409,38 @@ class f {
1408
1409
  * [[-170,40],[-160,30]]
1409
1410
  * ]
1410
1411
  */
1411
- static divideAccordingToLng(M, z = !1) {
1412
+ static divideAccordingToLng(M, z = !1, b = !0) {
1412
1413
  if ((M == null ? void 0 : M.length) < 2)
1413
1414
  return [];
1414
- M = this.deduplicateCoordinates(M);
1415
- let b = [];
1416
- const p = [];
1417
- let c, O;
1418
- for (let A = 0; A < M.length - 1; A++) {
1419
- c = X.convertToStdLng(M[A].lng, 8), O = X.convertToStdLng(M[A + 1].lng, 8), M[A].lat = X.roundPrecision(M[A].lat, 8), M[A + 1].lat = X.roundPrecision(M[A + 1].lat, 8), b.push([c, M[A].lat]);
1420
- const o = c - O;
1421
- if (Math.abs(o) > 180) {
1422
- const q = X.convertToMonotonicLng2([
1423
- [c, M[A].lat],
1424
- [O, M[A + 1].lat]
1415
+ M = b ? this.deduplicateCoordinates(M) : M;
1416
+ let p = [];
1417
+ const c = [];
1418
+ let O, A;
1419
+ for (let W = 0; W < M.length - 1; W++) {
1420
+ O = n.convertToStdLng(M[W].lng, 8), A = n.convertToStdLng(M[W + 1].lng, 8), M[W].lat = n.roundPrecision(M[W].lat, 8), M[W + 1].lat = n.roundPrecision(M[W + 1].lat, 8), p.push([O, M[W].lat]);
1421
+ const q = O - A;
1422
+ if (Math.abs(q) > 180) {
1423
+ const Y = n.convertToMonotonicLng2([
1424
+ [O, M[W].lat],
1425
+ [A, M[W + 1].lat]
1425
1426
  ]);
1426
- let Y, d;
1427
- z ? (Y = N.lineString(q), d = N.lineString([
1428
- [o > 0 ? 180 : -180, 89],
1429
- [o > 0 ? 180 : -180, -89]
1430
- ])) : (Y = N.greatCircle(q[0], q[1]), d = N.greatCircle([o > 0 ? 180 : -180, 89], [o > 0 ? 180 : -180, -89]));
1431
- const L = N.lineIntersect(Y, d);
1432
- let T;
1433
- if (L.features.length) {
1434
- const S = N.getCoord(L.features[0]);
1435
- T = X.roundPrecision(S[1], 8);
1427
+ let d, L;
1428
+ z ? (d = N.lineString(Y), L = N.lineString([
1429
+ [q > 0 ? 180 : -180, 89],
1430
+ [q > 0 ? 180 : -180, -89]
1431
+ ])) : (d = N.greatCircle(Y[0], Y[1]), L = N.greatCircle([q > 0 ? 180 : -180, 89], [q > 0 ? 180 : -180, -89]));
1432
+ const T = N.lineIntersect(d, L);
1433
+ let S;
1434
+ if (T.features.length) {
1435
+ const i = N.getCoord(T.features[0]);
1436
+ S = n.roundPrecision(i[1], 8);
1436
1437
  } else
1437
- T = M[A].lat;
1438
- o > 0 ? (b.push([180 - 1e-6, T]), p.push([...b]), b = [], b.push([-(180 - 1e-6), T])) : (b.push([-(180 - 1e-6), T]), p.push([...b]), b = [], b.push([180 - 1e-6, T]));
1438
+ S = M[W].lat;
1439
+ q > 0 ? (p.push([180 - 1e-6, S]), c.push([...p]), p = [], p.push([-(180 - 1e-6), S])) : (p.push([-(180 - 1e-6), S]), c.push([...p]), p = [], p.push([180 - 1e-6, S]));
1439
1440
  }
1440
- A === M.length - 2 && b.push([O, M[A + 1].lat]);
1441
+ W === M.length - 2 && p.push([A, M[W + 1].lat]);
1441
1442
  }
1442
- return p.push(b), p;
1443
+ return c.push(p), c;
1443
1444
  }
1444
1445
  /**
1445
1446
  * 去除重复坐标
@@ -1466,10 +1467,10 @@ class f {
1466
1467
  * @param route 航线[[[lng, lat],[lng, lat]]]
1467
1468
  */
1468
1469
  static removeCoordinateFromRoute(M, z) {
1469
- M.lng = X.convertToStdLng(M.lng, 8);
1470
+ M.lng = n.convertToStdLng(M.lng, 8);
1470
1471
  for (const b of z)
1471
1472
  for (let p = b.length - 1; p >= 0; p--)
1472
- X.roundPrecision(b[p][0], 8) === M.lng && X.roundPrecision(b[p][1], 8) === X.roundPrecision(M.lat, 8) && b.splice(p, 1);
1473
+ n.roundPrecision(b[p][0], 8) === M.lng && n.roundPrecision(b[p][1], 8) === n.roundPrecision(M.lat, 8) && b.splice(p, 1);
1473
1474
  return z;
1474
1475
  }
1475
1476
  /**
@@ -1478,9 +1479,9 @@ class f {
1478
1479
  * @param waypoints [{lat, lng}, {lat, lng}]
1479
1480
  */
1480
1481
  static removeCoordinateFromWaypoints(M, z) {
1481
- M.lng = X.convertToStdLng(M.lng, 8);
1482
+ M.lng = n.convertToStdLng(M.lng, 8);
1482
1483
  for (let b = z.length - 1; b >= 0; b--)
1483
- X.roundPrecision(z[b].lng, 8) === M.lng && X.roundPrecision(z[b].lat, 8) === X.roundPrecision(M.lat, 8) && z.splice(b, 1);
1484
+ n.roundPrecision(z[b].lng, 8) === M.lng && n.roundPrecision(z[b].lat, 8) === n.roundPrecision(M.lat, 8) && z.splice(b, 1);
1484
1485
  return z;
1485
1486
  }
1486
1487
  /**
@@ -1495,11 +1496,11 @@ class f {
1495
1496
  * [[[120, 30], [120, 35], [125,40], [130, 37]], [[-150, 40], [-130, 30]]]
1496
1497
  */
1497
1498
  static mergeCoordinateToRoute(M, z) {
1498
- M.lng = X.convertToStdLng(M.lng, 8);
1499
+ M.lng = n.convertToStdLng(M.lng, 8);
1499
1500
  let b = Number.MAX_VALUE, p = 0, c = 0, O, A;
1500
- return z.forEach((o, q) => {
1501
- for (let Y = 0; Y < o.length - 1; Y++) {
1502
- 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
+ return z.forEach((W, q) => {
1502
+ for (let Y = 0; Y < W.length - 1; Y++) {
1503
+ const d = { lng: W[Y][0], lat: W[Y][1] }, L = { lng: W[Y + 1][0], lat: W[Y + 1][1] }, T = this.calculatePointToLineDistance(M, d, L);
1503
1504
  b > T && (b = T, c = Y, p = q, O = this.calculateDistance(d, M), A = this.calculateDistance(L, M));
1504
1505
  }
1505
1506
  }), O !== 0 && A !== 0 ? z[p].splice(c + 1, 0, [M.lng, M.lat]) : O === 0 ? z[p].splice(c, 1, [M.lng, M.lat]) : A === 0 && z[p].splice(c + 1, 1, [M.lng, M.lat]), z;
@@ -1510,7 +1511,7 @@ class f {
1510
1511
  * @param route
1511
1512
  */
1512
1513
  static appendCoordinateToRoute(M, z) {
1513
- M.lng = X.convertToStdLng(M.lng, 8);
1514
+ M.lng = n.convertToStdLng(M.lng, 8);
1514
1515
  const b = f.convertRouteToCoordinates(z);
1515
1516
  return b.push(M), f.divideAccordingToLng(b);
1516
1517
  }
@@ -1548,12 +1549,12 @@ class f {
1548
1549
  if (c === 2)
1549
1550
  return;
1550
1551
  const A = [];
1551
- for (const o of O) {
1552
- if (X.roundPrecision(z.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(o[1], 8)) {
1553
- A.push(o), c === 0 && A.push([M.lng, M.lat]), c = 2;
1552
+ for (const W of O) {
1553
+ if (n.roundPrecision(z.lng, 8) === n.roundPrecision(W[0], 8) && n.roundPrecision(z.lat, 8) === n.roundPrecision(W[1], 8)) {
1554
+ A.push(W), c === 0 && A.push([M.lng, M.lat]), c = 2;
1554
1555
  break;
1555
1556
  }
1556
- c === 1 ? A.push(o) : X.roundPrecision(M.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(o[1], 8) && (c = 1, A.push(o));
1557
+ c === 1 ? A.push(W) : n.roundPrecision(M.lng, 8) === n.roundPrecision(W[0], 8) && n.roundPrecision(M.lat, 8) === n.roundPrecision(W[1], 8) && (c = 1, A.push(W));
1557
1558
  }
1558
1559
  A.length && p.push(A);
1559
1560
  }), p;
@@ -1568,11 +1569,11 @@ class f {
1568
1569
  */
1569
1570
  static calculateRangeWaypoints(M, z, b, p = []) {
1570
1571
  const c = this.convertRouteToCoordinates(b, 0), O = this.mergeCoordinatesToWaypoints([M, z], c.length ? c : p), A = O.findIndex(
1571
- (Y) => X.roundPrecision(M.lng, 8) === X.roundPrecision(Y.lng, 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(Y.lat, 8)
1572
- ), o = O.findIndex(
1573
- (Y) => X.roundPrecision(z.lng, 8) === X.roundPrecision(Y.lng, 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(Y.lat, 8)
1572
+ (Y) => n.roundPrecision(M.lng, 8) === n.roundPrecision(Y.lng, 8) && n.roundPrecision(M.lat, 8) === n.roundPrecision(Y.lat, 8)
1573
+ ), W = O.findIndex(
1574
+ (Y) => n.roundPrecision(z.lng, 8) === n.roundPrecision(Y.lng, 8) && n.roundPrecision(z.lat, 8) === n.roundPrecision(Y.lat, 8)
1574
1575
  );
1575
- return O.filter((Y, d) => d >= A && d <= o);
1576
+ return O.filter((Y, d) => d >= A && d <= W);
1576
1577
  }
1577
1578
  /**
1578
1579
  * 计算坐标到航路上的最短距离
@@ -1582,9 +1583,9 @@ class f {
1582
1583
  static calculateMinDistanceToRoute(M, z) {
1583
1584
  let b = Number.MAX_VALUE, p = 0, c = 0;
1584
1585
  return z.forEach((O, A) => {
1585
- for (let o = 0; o < O.length - 1; o++) {
1586
- const q = { lng: O[o][0], lat: O[o][1] }, Y = { lng: O[o + 1][0], lat: O[o + 1][1] }, d = this.calculatePointToLineDistance(M, q, Y);
1587
- b > d && (b = d, p = o, c = A);
1586
+ for (let W = 0; W < O.length - 1; W++) {
1587
+ const q = { lng: O[W][0], lat: O[W][1] }, Y = { lng: O[W + 1][0], lat: O[W + 1][1] }, d = this.calculatePointToLineDistance(M, q, Y);
1588
+ b > d && (b = d, p = W, c = A);
1588
1589
  }
1589
1590
  }), { minDist: b, segIndex: c, minIndex: p };
1590
1591
  }
@@ -1598,18 +1599,18 @@ class f {
1598
1599
  const b = f.convertRouteToCoordinates(z);
1599
1600
  f.mergeCoordinateToWaypoints(M, b, !0), z = f.divideAccordingToLng(b);
1600
1601
  const { segIndex: p, minIndex: c } = this.calculateMinDistanceToRoute({ ...M }, z);
1601
- M.lng = X.convertToStdLng(M.lng);
1602
+ M.lng = n.convertToStdLng(M.lng);
1602
1603
  const O = [];
1603
1604
  let A = !0;
1604
- for (let o = p; o < z.length; o++)
1605
+ for (let W = p; W < z.length; W++)
1605
1606
  if (A) {
1606
1607
  const q = [];
1607
1608
  q.push([M.lng, M.lat]);
1608
- for (let Y = c + 1; Y < z[o].length; Y++)
1609
- M.lng === z[o][Y][0] && M.lat === z[o][Y][1] || q.push(z[o][Y]);
1609
+ for (let Y = c + 1; Y < z[W].length; Y++)
1610
+ M.lng === z[W][Y][0] && M.lat === z[W][Y][1] || q.push(z[W][Y]);
1610
1611
  O.push(q), A = !1;
1611
1612
  } else
1612
- O.push([...z[o]]);
1613
+ O.push([...z[W]]);
1613
1614
  return O;
1614
1615
  }
1615
1616
  /**
@@ -1621,15 +1622,15 @@ class f {
1621
1622
  static calculateSubWaypoints(M, z) {
1622
1623
  let b = Number.MAX_VALUE, p = 0;
1623
1624
  for (let O = 0; O < z.length - 1; O++) {
1624
- const A = z[O], o = z[O + 1];
1625
+ const A = z[O], W = z[O + 1];
1625
1626
  if (this.calculateDistance(M, A) === 0)
1626
1627
  return z;
1627
- if (this.calculateDistance(M, o) === 0)
1628
+ if (this.calculateDistance(M, W) === 0)
1628
1629
  return z.filter((Y, d) => d > 0);
1629
- const q = this.calculatePointToLineDistance(M, A, o);
1630
+ const q = this.calculatePointToLineDistance(M, A, W);
1630
1631
  b > q && (b = q, p = O);
1631
1632
  }
1632
- M.lng = X.convertToStdLng(M.lng);
1633
+ M.lng = n.convertToStdLng(M.lng);
1633
1634
  const c = [M];
1634
1635
  for (let O = p + 1; O < z.length; O++)
1635
1636
  c.push(z[O]);
@@ -1643,14 +1644,14 @@ class f {
1643
1644
  * @param options
1644
1645
  */
1645
1646
  static calculatePointToLineDistance(M, z, b, p = { units: "nauticalmiles", method: "geodesic" }) {
1646
- M.lng = X.convertToStdLng(M.lng, 8), z = { ...z }, b = { ...b }, z.lng = X.convertToStdLng(z.lng, 8), b.lng = X.convertToStdLng(b.lng, 8);
1647
- const c = X.convertToMonotonicLng([z, b]);
1647
+ M.lng = n.convertToStdLng(M.lng, 8), z = { ...z }, b = { ...b }, z.lng = n.convertToStdLng(z.lng, 8), b.lng = n.convertToStdLng(b.lng, 8);
1648
+ const c = n.convertToMonotonicLng([z, b]);
1648
1649
  z = c[0], b = c[1];
1649
1650
  const O = N.lineString([
1650
1651
  [z.lng, z.lat],
1651
1652
  [b.lng, b.lat]
1652
- ]), A = N.pointToLineDistance(N.point([M.lng, M.lat]), O, p), o = N.pointToLineDistance(N.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), O, p);
1653
- return X.roundPrecision(Math.min(A, o), 6);
1653
+ ]), A = N.pointToLineDistance(N.point([M.lng, M.lat]), O, p), W = N.pointToLineDistance(N.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), O, p);
1654
+ return n.roundPrecision(Math.min(A, W), 6);
1654
1655
  }
1655
1656
  /**
1656
1657
  * 计算途经点的COG, Distance等属性
@@ -1661,7 +1662,7 @@ class f {
1661
1662
  z = this.mergeWaypointsToRoute(M, z);
1662
1663
  for (let b = 0; b < M.length - 1; b++) {
1663
1664
  const p = M[b], c = M[b + 1], O = this.calculateRangeRoute(p, c, z);
1664
- b === 0 && (p.distanceFromPrevious = 0, p.distanceFromStart = 0), c.distanceFromPrevious = this.calculateRouteDistance(O), c.distanceFromStart = X.roundPrecision((p.distanceFromStart || 0) + c.distanceFromPrevious);
1665
+ b === 0 && (p.distanceFromPrevious = 0, p.distanceFromStart = 0), c.distanceFromPrevious = this.calculateRouteDistance(O), c.distanceFromStart = n.roundPrecision((p.distanceFromStart || 0) + c.distanceFromPrevious);
1665
1666
  }
1666
1667
  return M;
1667
1668
  }
@@ -1688,43 +1689,45 @@ class f {
1688
1689
  * [{ lng: 160, lat: 30}, { lng: 170, lat: 40}, {lng: 179, lat: 50}, {lng: -170, lat: 40}, {lng: -160, lat: 30}]
1689
1690
  */
1690
1691
  static mergeCoordinateToWaypoints(M, z, b = !0) {
1691
- M.lng = X.convertToStdLng(M.lng, 8);
1692
+ M.lng = n.convertToStdLng(M.lng, 8);
1692
1693
  let p = Number.MAX_VALUE, c = 0, O = 0, A = 0;
1693
1694
  if (z.length < 2)
1694
1695
  z.push(M);
1695
1696
  else {
1696
- for (let o = 0; o < z.length - 1; o++) {
1697
- 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);
1698
- p >= d && (p = d, c = o, O = this.calculateDistance(q, M, !1, 6), A = this.calculateDistance(Y, M, !1, 6));
1697
+ for (let W = 0; W < z.length - 1; W++) {
1698
+ const q = { lng: z[W].lng, lat: z[W].lat }, Y = { lng: z[W + 1].lng, lat: z[W + 1].lat }, d = this.calculatePointToLineDistance(M, q, Y);
1699
+ p >= d && (p = d, c = W, O = this.calculateDistance(q, M, !1, 6), A = this.calculateDistance(Y, M, !1, 6));
1699
1700
  }
1700
1701
  O !== 0 && A !== 0 ? O <= p && c === 0 ? z.unshift(M) : A <= p && c === z.length - 2 ? z.push(M) : z.splice(c + 1, 0, M) : O === 0 ? b ? z.splice(c, 1, M) : z.splice(c + 1, 0, M) : A === 0 && (b ? z.splice(c + 1, 1, M) : z.splice(c + 1, 0, M));
1701
1702
  }
1702
- return z.map((o, q) => {
1703
- o.lng = X.convertToStdLng(o.lng);
1703
+ return z.map((W, q) => {
1704
+ W.lng = n.convertToStdLng(W.lng);
1704
1705
  const Y = z[q + 1];
1705
- if (Y && (o.bearing || ((o.positionTime || 0) > (Y.positionTime || 0) ? o.bearing = this.calculateBearing(Y, o, !0) : o.bearing = this.calculateBearing(o, Y, !0)), o.cog = o.cog || o.bearing, !o.sog && o.positionTime && Y.positionTime)) {
1706
- const d = this.calculateDistance(o, Y, !0), L = Math.abs(Y.positionTime - o.positionTime) / 3600;
1707
- o.sog = X.roundPrecision(d / L, 2);
1706
+ if (Y && (W.bearing || ((W.positionTime || 0) > (Y.positionTime || 0) ? W.bearing = this.calculateBearing(Y, W, !0) : W.bearing = this.calculateBearing(W, Y, !0)), W.cog = W.cog || W.bearing, !W.sog && W.positionTime && Y.positionTime)) {
1707
+ const d = this.calculateDistance(W, Y, !0), L = Math.abs(Y.positionTime - W.positionTime) / 3600;
1708
+ W.sog = n.roundPrecision(d / L, 2);
1708
1709
  }
1709
- return o;
1710
+ return W;
1710
1711
  });
1711
1712
  }
1712
1713
  /**
1713
1714
  * 生成航线(基于途经点生成大圆/横向航线,并根据是否跨180度分组)
1714
- * @param waypoints [{lng, lat}, {lng: lat, gcToPrevious: true}]
1715
1715
  * @return [[[lng, lat], [lng, lat]]]
1716
+ * @param waypoints
1717
+ * @param rhumb
1718
+ * @param deduplicate
1716
1719
  */
1717
- static generateRouteAccordingToWaypoints(M) {
1718
- const z = [];
1719
- for (let b = 1; b < M.length; b++) {
1720
- const p = M[b - 1], c = M[b];
1721
- if (b === 1 && z.push(p), c.gcToPrevious) {
1722
- const O = this.interpolateCoordinates(p, c, 200, !1, !0, "nauticalmiles");
1723
- z.push(...O);
1720
+ static generateRouteAccordingToWaypoints(M, z = !0, b = !0) {
1721
+ const p = [];
1722
+ for (let c = 1; c < M.length; c++) {
1723
+ const O = M[c - 1], A = M[c];
1724
+ if (c === 1 && p.push(O), A.gcToPrevious) {
1725
+ const W = this.interpolateCoordinates(O, A, 200, !1, !0, "nauticalmiles");
1726
+ p.push(...W);
1724
1727
  } else
1725
- z.push(c);
1728
+ p.push(A);
1726
1729
  }
1727
- return this.divideAccordingToLng(z, !0);
1730
+ return this.divideAccordingToLng(p, z, b);
1728
1731
  }
1729
1732
  /**
1730
1733
  * 最近点(从route中找出距离目标点最近的点)
@@ -1732,8 +1735,8 @@ class f {
1732
1735
  * @param route [[[lng, lat]]]
1733
1736
  */
1734
1737
  static nearestCoordinateInRoute(M, z) {
1735
- const b = N.point([M.lng, M.lat]), c = this.convertRouteToCoordinates(z).map((q) => [q.lng, q.lat]), O = N.lineString(c), A = N.nearestPointOnLine(O, b), o = N.getCoord(A);
1736
- return { lng: X.roundPrecision(o[0], 8), lat: X.roundPrecision(o[1], 8) };
1738
+ const b = N.point([M.lng, M.lat]), c = this.convertRouteToCoordinates(z).map((q) => [q.lng, q.lat]), O = N.lineString(c), A = N.nearestPointOnLine(O, b), W = N.getCoord(A);
1739
+ return { lng: n.roundPrecision(W[0], 8), lat: n.roundPrecision(W[1], 8) };
1737
1740
  }
1738
1741
  /**
1739
1742
  * 计算经过方向上的最后一个waypoint
@@ -1767,32 +1770,32 @@ class f {
1767
1770
  static calculateNextCoordinateAlongRoute(M, z, b, p = "nauticalmiles") {
1768
1771
  var L;
1769
1772
  const c = M.speed || 12, O = [];
1770
- let A = [], o = !1, q = 0, Y = 0, d;
1773
+ let A = [], W = !1, q = 0, Y = 0, d;
1771
1774
  if (z && b.length ? (O.push(M), b.forEach((T, S) => {
1772
- if (o)
1775
+ if (W)
1773
1776
  A.push(T);
1774
1777
  else {
1775
- const e = [];
1778
+ const i = [];
1776
1779
  let r;
1777
- for (let s = 0; s < T.length; s++)
1780
+ for (let l = 0; l < T.length; l++)
1778
1781
  if (d)
1779
- e.push(T[s]);
1782
+ i.push(T[l]);
1780
1783
  else {
1781
- r = { lng: T[s][0], lat: T[s][1] };
1782
- const Z = this.calculateDistance(M, r, !0, 8, p);
1783
- if (q += Z, q < z)
1784
- Y += Z, Z && O.push(r), M = r;
1784
+ r = { lng: T[l][0], lat: T[l][1] };
1785
+ const P = this.calculateDistance(M, r, !0, 8, p);
1786
+ if (q += P, q < z)
1787
+ Y += P, P && O.push(r), M = r;
1785
1788
  else {
1786
1789
  if (Y = z, q === z)
1787
- d = r, e.push([d.lng, d.lat]);
1790
+ d = r, i.push([d.lng, d.lat]);
1788
1791
  else {
1789
- const P = q - z, U = this.calculateBearing(r, M);
1790
- d = this.calculateCoordinate(r, U, P, p), e.push([d.lng, d.lat]), e.push([r.lng, r.lat]);
1792
+ const E = q - z, U = this.calculateBearing(r, M);
1793
+ d = this.calculateCoordinate(r, U, E, p), i.push([d.lng, d.lat]), i.push([r.lng, r.lat]);
1791
1794
  }
1792
- o = !0;
1795
+ W = !0;
1793
1796
  }
1794
1797
  }
1795
- e.length && A.push(e), S === b.length - 1 && !d && (d = r);
1798
+ i.length && A.push(i), S === b.length - 1 && !d && (d = r);
1796
1799
  }
1797
1800
  })) : (A = b, d = { ...M }), d)
1798
1801
  if (O.push(d), d.distanceFromPrevious = Y, d.hourFromPrevious = Math.round(Y / c * 1e4) / 1e4, ((L = A[0]) == null ? void 0 : L.length) > 1) {
@@ -1809,10 +1812,10 @@ class f {
1809
1812
  * @param to {lng, lat}
1810
1813
  */
1811
1814
  static nearestCoordinateInLine(M, z, b) {
1812
- const p = X.convertToStdLng(M.lng, 6), c = N.point([p, M.lat]), O = X.convertToStdLng(z.lng, 6), A = X.convertToStdLng(b.lng, 6), o = N.lineString([
1815
+ const p = n.convertToStdLng(M.lng, 6), c = N.point([p, M.lat]), O = n.convertToStdLng(z.lng, 6), A = n.convertToStdLng(b.lng, 6), W = N.lineString([
1813
1816
  [O, z.lat],
1814
1817
  [A, b.lat]
1815
- ]), q = N.nearestPointOnLine(o, c), Y = N.getCoord(q), d = X.roundPrecision(Y[0], 6), L = X.roundPrecision(Y[1], 6);
1818
+ ]), q = N.nearestPointOnLine(W, c), Y = N.getCoord(q), d = n.roundPrecision(Y[0], 6), L = n.roundPrecision(Y[1], 6);
1816
1819
  return { lng: d, lat: L, inline: !(d === O && L === z.lat) && !(d === A && L === b.lat) };
1817
1820
  }
1818
1821
  /**
@@ -1825,16 +1828,16 @@ class f {
1825
1828
  let p, c;
1826
1829
  return M.forEach((O) => {
1827
1830
  O.forEach((A) => {
1828
- const o = { lng: X.roundPrecision(A[0], 8), lat: X.roundPrecision(A[1], 8) };
1831
+ const W = { lng: n.roundPrecision(A[0], 8), lat: n.roundPrecision(A[1], 8) };
1829
1832
  if (!c)
1830
- b.push(o), c = o;
1833
+ b.push(W), c = W;
1831
1834
  else if (c.bearing === void 0)
1832
- c.bearing = this.calculateBearing(c, o, !0);
1835
+ c.bearing = this.calculateBearing(c, W, !0);
1833
1836
  else {
1834
- const q = this.calculateDistance(p, o, !0);
1835
- q && q >= z && (p.bearing = this.calculateBearing(p, o, !0), b.push(p), c = p);
1837
+ const q = this.calculateDistance(p, W, !0);
1838
+ q && q >= z && (p.bearing = this.calculateBearing(p, W, !0), b.push(p), c = p);
1836
1839
  }
1837
- p = o;
1840
+ p = W;
1838
1841
  });
1839
1842
  }), p && b.push(p), b;
1840
1843
  }
@@ -1860,17 +1863,17 @@ class f {
1860
1863
  for (let p = 1; p < z.length; p++) {
1861
1864
  const c = z[p - 1], O = z[p];
1862
1865
  if (O.gcToPrevious) {
1863
- const A = M.findIndex((q) => q.lng === c.lng && q.lat === c.lat), o = M.findIndex((q) => q.lng === O.lng && q.lat === O.lat);
1864
- for (let q = o - 1; q > A; q--)
1866
+ const A = M.findIndex((q) => q.lng === c.lng && q.lat === c.lat), W = M.findIndex((q) => q.lng === O.lng && q.lat === O.lat);
1867
+ for (let q = W - 1; q > A; q--)
1865
1868
  M.splice(q, 1);
1866
1869
  }
1867
1870
  }
1868
1871
  let b = 0;
1869
1872
  for (let p = 1; p < M.length; p++) {
1870
1873
  const c = M[p - 1], O = M[p];
1871
- O.gcToPrevious ? (c.bearing = this.calculateBearing(c, O, !1), O.distanceFromPrevious = this.calculateDistance(c, O, !1)) : (c.bearing = this.calculateBearing(c, O, !0), O.distanceFromPrevious = this.calculateDistance(c, O, !0)), b = X.roundPrecision(b + O.distanceFromPrevious), O.distanceFromStart = b;
1874
+ O.gcToPrevious ? (c.bearing = this.calculateBearing(c, O, !1), O.distanceFromPrevious = this.calculateDistance(c, O, !1)) : (c.bearing = this.calculateBearing(c, O, !0), O.distanceFromPrevious = this.calculateDistance(c, O, !0)), b = n.roundPrecision(b + O.distanceFromPrevious), O.distanceFromStart = b;
1872
1875
  }
1873
- return M.map((p) => (p.lng = X.convertToStdLng(p.lng), p));
1876
+ return M.map((p) => (p.lng = n.convertToStdLng(p.lng), p));
1874
1877
  }
1875
1878
  /**
1876
1879
  * 计算轨迹中心点
@@ -1879,13 +1882,13 @@ class f {
1879
1882
  static calculateCenter(M) {
1880
1883
  const z = [];
1881
1884
  for (const A of M)
1882
- for (const o of A)
1883
- z.push(o);
1884
- const b = N.featureCollection([]), p = X.convertToMonotonicLng2(z);
1885
+ for (const W of A)
1886
+ z.push(W);
1887
+ const b = N.featureCollection([]), p = n.convertToMonotonicLng2(z);
1885
1888
  for (const A of p)
1886
1889
  b.features.push(N.point(A));
1887
1890
  const O = N.center(b).geometry.coordinates;
1888
- return { lng: X.convertToStdLng(O[0], 8), lat: X.roundPrecision(O[1], 8) };
1891
+ return { lng: n.convertToStdLng(O[0], 8), lat: n.roundPrecision(O[1], 8) };
1889
1892
  }
1890
1893
  /**
1891
1894
  * 计算中心点
@@ -1904,7 +1907,7 @@ class f {
1904
1907
  for (const c of M)
1905
1908
  for (const O of c)
1906
1909
  z.push(O);
1907
- const b = X.convertToMonotonicLng2(z), p = N.lineString(b);
1910
+ const b = n.convertToMonotonicLng2(z), p = N.lineString(b);
1908
1911
  return N.bbox(p);
1909
1912
  }
1910
1913
  /**
@@ -1924,10 +1927,10 @@ class f {
1924
1927
  static simplifyCoordinates(M, z = 1, b = 180) {
1925
1928
  const p = [];
1926
1929
  for (let c = 1; c < M.length; c++) {
1927
- const O = M[c - 1], A = M[c], o = M[c + 1];
1930
+ const O = M[c - 1], A = M[c], W = M[c + 1];
1928
1931
  let q = !1, Y = !1;
1929
- if ((O.velocity || O.suspend || O.important || O.pilot || c === 1) && (q = !0, p.push(O)), A.gcToPrevious && (q || (q = !0, p.push(O)), Y = !0, p.push(A), c++), o) {
1930
- const d = f.calculateDistance(O, A, !0), L = f.calculateDistance(A, o, !0), T = f.calculateDistance(O, o, !0), S = (Math.pow(d, 2) + Math.pow(L, 2) - Math.pow(T, 2)) / (2 * d * L);
1932
+ if ((O.velocity || O.suspend || O.important || O.pilot || c === 1) && (q = !0, p.push(O)), A.gcToPrevious && (q || (q = !0, p.push(O)), Y = !0, p.push(A), c++), W) {
1933
+ const d = f.calculateDistance(O, A, !0), L = f.calculateDistance(A, W, !0), T = f.calculateDistance(O, W, !0), S = (Math.pow(d, 2) + Math.pow(L, 2) - Math.pow(T, 2)) / (2 * d * L);
1931
1934
  Math.round(Math.acos(S) * 180 / Math.PI) < b && T > z && !Y && (p.push(A), c++);
1932
1935
  }
1933
1936
  if (c >= M.length - 1) {
@@ -1944,7 +1947,7 @@ class f {
1944
1947
  * @param waypoints 带时间的轨迹, 单位秒
1945
1948
  */
1946
1949
  static nearestTSPointInWaypoints(M, z, b) {
1947
- const p = I.unix(M), c = b.filter(
1950
+ const p = s.unix(M), c = b.filter(
1948
1951
  (O) => p.clone().subtract(z, "hour").unix() <= (O.positionTime || 0) && p.clone().add(z, "h").unix() >= (O.positionTime || 0)
1949
1952
  );
1950
1953
  return c.sort((O, A) => (O.positionTime || 0) - (A.positionTime || 0)), c.at(-1);
@@ -1955,17 +1958,17 @@ class f {
1955
1958
  * @param positions 带时间(positionTime)的轨迹
1956
1959
  */
1957
1960
  static deadReckoning(M, z) {
1958
- var c, O, A, o;
1961
+ var c, O, A, W;
1959
1962
  M > 1e12 && (M = Math.round(M / 1e3));
1960
- const b = I.unix(M);
1963
+ const b = s.unix(M);
1961
1964
  let p = z.find((q) => q.positionTime === b.unix());
1962
1965
  if (!p) {
1963
- const q = (O = (c = z.filter((d) => (d == null ? void 0 : d.positionTime) < b.unix())) == null ? void 0 : c.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : O.at(-1), Y = (o = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) > b.unix())) == null ? void 0 : A.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : o.at(0);
1966
+ const q = (O = (c = z.filter((d) => (d == null ? void 0 : d.positionTime) < b.unix())) == null ? void 0 : c.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : O.at(-1), Y = (W = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) > b.unix())) == null ? void 0 : A.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : W.at(0);
1964
1967
  if (q && Y) {
1965
1968
  const d = f.calculateBearing(q, Y, !0), L = f.calculateDistance(q, Y), T = (b.unix() - q.positionTime) / (Y.positionTime - q.positionTime);
1966
1969
  p = f.calculateCoordinate(q, d, L * T), p.positionTime = b.unix(), p.utc = b.utc().format(), p.cog = d, p.sog = Math.round(L / ((Y.positionTime - q.positionTime) / 3600) * 100) / 100;
1967
1970
  } else
1968
- p = q || Y, p && (p.utc = I.unix(p == null ? void 0 : p.positionTime).utc().format());
1971
+ p = q || Y, p && (p.utc = s.unix(p == null ? void 0 : p.positionTime).utc().format());
1969
1972
  }
1970
1973
  return p;
1971
1974
  }
@@ -1975,22 +1978,22 @@ class f {
1975
1978
  * @param positions
1976
1979
  */
1977
1980
  static deadReckoningTime(M, z) {
1978
- z = JSON.parse(JSON.stringify(z)), z.sort((q, Y) => q.positionTime - Y.positionTime);
1981
+ z = JSON.parse(JSON.stringify(z)), z.sort((q, Y) => (q.positionTime || 0) - (Y.positionTime || 0));
1979
1982
  let b = Number.MAX_SAFE_INTEGER, p = Number.MAX_SAFE_INTEGER;
1980
1983
  for (let q = 0; q < z.length - 1; q++) {
1981
1984
  const Y = z[q], d = z[q + 1], L = f.calculatePointToLineDistance(M, Y, d);
1982
1985
  L < b && (b = L, p = q);
1983
1986
  }
1984
- const c = z[p], O = z[p + 1], A = f.calculateDistance(c, M), o = f.calculateDistance(O, M);
1987
+ const c = z[p], O = z[p + 1], A = f.calculateDistance(c, M), W = f.calculateDistance(O, M);
1985
1988
  if (A === 0)
1986
1989
  M = c;
1987
- else if (o === 0)
1990
+ else if (W === 0)
1988
1991
  M = O;
1989
1992
  else {
1990
- const q = f.nearestCoordinateInLine(M, c, O), Y = c.positionTime, d = O.positionTime, L = f.calculateDistance(c, q), T = f.calculateDistance(c, O), S = Math.round(Y + (d - Y) * (L / T));
1991
- M.positionTime = S;
1993
+ const q = c.positionTime || 0, Y = O.positionTime || 0, d = f.calculateDistance(c, O);
1994
+ M.positionTime = Math.round(q + (Y - q) * (A / d));
1992
1995
  }
1993
- return M.utc = M.positionTime ? I.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
1996
+ return M.utc = M.positionTime ? s.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
1994
1997
  }
1995
1998
  /**
1996
1999
  * 翻转轨迹
@@ -2019,10 +2022,33 @@ class f {
2019
2022
  `, b += `</route>
2020
2023
  `, b;
2021
2024
  }
2025
+ /**
2026
+ * 路径摘要
2027
+ * @param coordinates 已排序的坐标
2028
+ */
2029
+ static coordinatesSummary(M) {
2030
+ if (M.length > 1) {
2031
+ const z = M[0], b = M[M.length - 1], p = (z == null ? void 0 : z.positionTime) < (b == null ? void 0 : b.positionTime) ? s.unix(z == null ? void 0 : z.positionTime) : s.unix(b == null ? void 0 : b.positionTime), c = (z == null ? void 0 : z.positionTime) > (b == null ? void 0 : b.positionTime) ? s.unix(z == null ? void 0 : z.positionTime) : s.unix(b == null ? void 0 : b.positionTime), O = Math.round(c.diff(p, "hours", !0) * 100) / 100, A = this.generateRouteAccordingToWaypoints(M, !0, !0), W = this.calculateRouteDistance(A), q = O ? Math.round(W / O * 100) / 100 : 0;
2032
+ return {
2033
+ begin: p.utc().format(),
2034
+ end: c.utc().format(),
2035
+ distance: W,
2036
+ hours: O,
2037
+ avgSpeed: q
2038
+ };
2039
+ }
2040
+ return {
2041
+ begin: void 0,
2042
+ end: void 0,
2043
+ distance: 0,
2044
+ hours: 0,
2045
+ avgSpeed: 0
2046
+ };
2047
+ }
2022
2048
  }
2023
- let E;
2049
+ let I;
2024
2050
  try {
2025
- E = _.getLogger("vessel");
2051
+ I = _.getLogger("vessel");
2026
2052
  } catch {
2027
2053
  } finally {
2028
2054
  }
@@ -2038,44 +2064,44 @@ class t0 {
2038
2064
  const A = (b = O.history) == null ? void 0 : b[0];
2039
2065
  if (O.forecasts) {
2040
2066
  A && A.wind && (A.wind.kts = A.kts);
2041
- for (const o of O.forecasts) {
2067
+ for (const W of O.forecasts) {
2042
2068
  let q;
2043
- const Y = [], d = [], L = I(o.date).utc(), T = `${O.name}-${o.model}`;
2044
- for (const e in o == null ? void 0 : o.hours) {
2045
- const r = o.hours[e];
2069
+ const Y = [], d = [], L = s(W.date).utc(), T = `${O.name}-${W.model}`;
2070
+ for (const i in W == null ? void 0 : W.hours) {
2071
+ const r = W.hours[i];
2046
2072
  q = q || r;
2047
- const s = L.clone().add(Number(e), "hour"), Z = N.point([r.lng, r.lat], {
2048
- model: o.model,
2073
+ const l = L.clone().add(Number(i), "hour"), P = N.point([r.lng, r.lat], {
2074
+ model: W.model,
2049
2075
  name: O.name,
2050
- date: s.format(),
2051
- hour: Number(e),
2052
- format: s.format("MMM-DD/HHmm[Z]"),
2053
- pressure: r.pressure > 1e4 ? X.roundPrecision(r.pressure / 100, 0) : X.roundPrecision(r.pressure, 0),
2076
+ date: l.format(),
2077
+ hour: Number(i),
2078
+ format: l.format("MMM-DD/HHmm[Z]"),
2079
+ pressure: r.pressure > 1e4 ? n.roundPrecision(r.pressure / 100, 0) : n.roundPrecision(r.pressure, 0),
2054
2080
  gusts: r.gusts,
2055
2081
  wind: r.wind || {},
2056
2082
  movement: r.movement,
2057
2083
  category: T,
2058
2084
  type: "forecast"
2059
2085
  });
2060
- d.push(Z), Y.push(Z.geometry.coordinates);
2086
+ d.push(P), Y.push(P.geometry.coordinates);
2061
2087
  }
2062
2088
  const S = {
2063
2089
  kts: void 0,
2064
2090
  deg: void 0
2065
2091
  };
2066
2092
  if (A) {
2067
- const e = I(A.updated).utc();
2093
+ const i = s(A.updated).utc();
2068
2094
  if (q) {
2069
- const s = f.calculateDistance(A, q), Z = I(q.utc || q.updated).diff(e, "h", !0);
2070
- S.kts = Math.round(s / Z * 100) / 100, S.deg = f.calculateBearing(A, q, !0, 0);
2095
+ const l = f.calculateDistance(A, q), P = s(q.utc || q.updated).diff(i, "h", !0);
2096
+ S.kts = Math.round(l / P * 100) / 100, S.deg = f.calculateBearing(A, q, !0, 0);
2071
2097
  }
2072
2098
  const r = N.point([A.lng, A.lat], {
2073
- model: o.model,
2099
+ model: W.model,
2074
2100
  name: O.name,
2075
- date: e.format(),
2101
+ date: i.format(),
2076
2102
  hour: 0,
2077
- format: e.format("MMM-DD/HHmm[Z]"),
2078
- pressure: A.pressure > 1e4 ? X.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : X.roundPrecision(A.pressure, 0),
2103
+ format: i.format("MMM-DD/HHmm[Z]"),
2104
+ pressure: A.pressure > 1e4 ? n.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : n.roundPrecision(A.pressure, 0),
2079
2105
  wind: A.wind,
2080
2106
  movement: S,
2081
2107
  category: T,
@@ -2086,29 +2112,29 @@ class t0 {
2086
2112
  d.unshift(r), Y.unshift(r.geometry.coordinates);
2087
2113
  }
2088
2114
  if (z.features.push(...d), (Y == null ? void 0 : Y.length) > 1) {
2089
- const e = N.lineString(X.convertToMonotonicLng2(Y), {
2115
+ const i = N.lineString(n.convertToMonotonicLng2(Y), {
2090
2116
  date: (A == null ? void 0 : A.updated) || (L == null ? void 0 : L.format()),
2091
2117
  id: O.id || O.name,
2092
- model: o.model,
2118
+ model: W.model,
2093
2119
  name: O.name,
2094
2120
  category: T,
2095
2121
  type: "forecast",
2096
2122
  movement: S
2097
2123
  });
2098
- z.features.push(e);
2124
+ z.features.push(i);
2099
2125
  }
2100
2126
  }
2101
2127
  }
2102
- if (z.features.sort((o, q) => o.properties.type === "forecast" && q.properties.type === "forecast" && o.geometry.type === "Point" && q.geometry.type === "Point" ? I(o.properties.date).valueOf() - I(q.properties.date).valueOf() : 0), (p = O.history) != null && p.length) {
2103
- const o = [], q = I(A == null ? void 0 : A.updated).utc(), Y = I((c = O.history) == null ? void 0 : c.at(-1).updated).utc(), d = q.diff(Y, "h") % 24 > 2 ? 24 : 12;
2128
+ if (z.features.sort((W, q) => W.properties.type === "forecast" && q.properties.type === "forecast" && W.geometry.type === "Point" && q.geometry.type === "Point" ? s(W.properties.date).valueOf() - s(q.properties.date).valueOf() : 0), (p = O.history) != null && p.length) {
2129
+ const W = [], q = s(A == null ? void 0 : A.updated).utc(), Y = s((c = O.history) == null ? void 0 : c.at(-1).updated).utc(), d = q.diff(Y, "h") % 24 > 2 ? 24 : 12;
2104
2130
  for (const L of O.history) {
2105
- const T = I(L.updated).utc(), S = T.isSameOrBefore(q) || T.isSame(Y);
2131
+ const T = s(L.updated).utc(), S = T.isSameOrBefore(q) || T.isSame(Y);
2106
2132
  S && q.add(-d, "h");
2107
- const e = N.point([L.lng, L.lat], {
2133
+ const i = N.point([L.lng, L.lat], {
2108
2134
  name: O.name,
2109
2135
  date: T.format(),
2110
2136
  format: T.format("MMM-DD/HHmm[Z]"),
2111
- pressure: L.pressure > 1e4 ? X.roundPrecision(L.pressure / 100, 0) : X.roundPrecision(L.pressure, 0),
2137
+ pressure: L.pressure > 1e4 ? n.roundPrecision(L.pressure / 100, 0) : n.roundPrecision(L.pressure, 0),
2112
2138
  kts: L.kts,
2113
2139
  level: L.type,
2114
2140
  type: "history",
@@ -2117,14 +2143,14 @@ class t0 {
2117
2143
  movement: L.movement,
2118
2144
  important: S
2119
2145
  });
2120
- z.features.push(e), o.push(e.geometry.coordinates);
2146
+ z.features.push(i), W.push(i.geometry.coordinates);
2121
2147
  }
2122
- if (o.length === 1 && o.push(o[0]), o.length > 1) {
2123
- const L = N.lineString(X.convertToMonotonicLng2(o), {
2148
+ if (W.length === 1 && W.push(W[0]), W.length > 1) {
2149
+ const L = N.lineString(n.convertToMonotonicLng2(W), {
2124
2150
  name: O.name,
2125
2151
  type: "history",
2126
2152
  updated: A == null ? void 0 : A.updated,
2127
- pressure: (A == null ? void 0 : A.pressure) > 1e4 ? X.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : X.roundPrecision(A == null ? void 0 : A.pressure, 0),
2153
+ pressure: (A == null ? void 0 : A.pressure) > 1e4 ? n.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : n.roundPrecision(A == null ? void 0 : A.pressure, 0),
2128
2154
  kts: A == null ? void 0 : A.kts,
2129
2155
  level: A == null ? void 0 : A.type
2130
2156
  });
@@ -2140,35 +2166,35 @@ class t0 {
2140
2166
  * @param step
2141
2167
  */
2142
2168
  static interpolate(M, z = 3) {
2143
- var c, O, A, o;
2169
+ var c, O, A, W;
2144
2170
  const b = (c = M == null ? void 0 : M.data) == null ? void 0 : c.features.filter((q) => q.geometry.type === "LineString" && q.properties.type === "forecast"), p = [];
2145
2171
  for (const q of b) {
2146
- const Y = q.properties.name, d = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, S = I(q.properties.date).utc();
2147
- let e = z * 60;
2172
+ const Y = q.properties.name, d = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, S = s(q.properties.date).utc();
2173
+ let i = z * 60;
2148
2174
  const r = (O = M == null ? void 0 : M.data) == null ? void 0 : O.features.filter(
2149
- (P) => P.geometry.type === "Point" && P.properties.type === "forecast" && P.properties.category === `${Y}-${d}`
2175
+ (E) => E.geometry.type === "Point" && E.properties.type === "forecast" && E.properties.category === `${Y}-${d}`
2150
2176
  );
2151
- let s, Z = S.clone().add(e, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2152
- for (; s = this.pickIndex(r, Z), s <= r.length - 1; ) {
2153
- if (s > 0) {
2154
- const P = r[s], U = s === 0 ? void 0 : r[s - 1], m = (e / 60 - ((A = U == null ? void 0 : U.properties) == null ? void 0 : A.hour)) / (P.properties.hour - ((o = U == null ? void 0 : U.properties) == null ? void 0 : o.hour)), H = this.computeNumber(U == null ? void 0 : U.geometry.coordinates[0], P.geometry.coordinates[0], m), Q = this.computeNumber(U == null ? void 0 : U.geometry.coordinates[1], P.geometry.coordinates[1], m), F = N.point([H, Q], {
2177
+ let l, P = S.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2178
+ for (; l = this.pickIndex(r, P), l <= r.length - 1; ) {
2179
+ if (l > 0) {
2180
+ const E = r[l], U = l === 0 ? void 0 : r[l - 1], m = (i / 60 - ((A = U == null ? void 0 : U.properties) == null ? void 0 : A.hour)) / (E.properties.hour - ((W = U == null ? void 0 : U.properties) == null ? void 0 : W.hour)), H = this.computeNumber(U == null ? void 0 : U.geometry.coordinates[0], E.geometry.coordinates[0], m), Q = this.computeNumber(U == null ? void 0 : U.geometry.coordinates[1], E.geometry.coordinates[1], m), F = N.point([H, Q], {
2155
2181
  name: Y,
2156
2182
  model: d,
2157
- category: P == null ? void 0 : P.properties.category,
2158
- date: Z.format(),
2159
- format: Z.format("MMM-DD/HHmm[Z]"),
2160
- gusts: this.computeNumber(U == null ? void 0 : U.properties.gusts, P.properties.gusts, m),
2161
- hour: this.computeNumber(U == null ? void 0 : U.properties.hour, P.properties.hour, m),
2162
- movement: this.computeNumber(U == null ? void 0 : U.properties.movement, P.properties.movement, m),
2163
- pressure: this.computeNumber(U == null ? void 0 : U.properties.pressure, P.properties.pressure, m),
2164
- wind: this.computeNumber(U == null ? void 0 : U.properties.wind, P.properties.wind, m),
2183
+ category: E == null ? void 0 : E.properties.category,
2184
+ date: P.format(),
2185
+ format: P.format("MMM-DD/HHmm[Z]"),
2186
+ gusts: this.computeNumber(U == null ? void 0 : U.properties.gusts, E.properties.gusts, m),
2187
+ hour: this.computeNumber(U == null ? void 0 : U.properties.hour, E.properties.hour, m),
2188
+ movement: this.computeNumber(U == null ? void 0 : U.properties.movement, E.properties.movement, m),
2189
+ pressure: this.computeNumber(U == null ? void 0 : U.properties.pressure, E.properties.pressure, m),
2190
+ wind: this.computeNumber(U == null ? void 0 : U.properties.wind, E.properties.wind, m),
2165
2191
  type: "forecast",
2166
2192
  disabled: T,
2167
2193
  showCircle: L
2168
2194
  });
2169
2195
  p.push(F);
2170
2196
  }
2171
- e += z * 60, Z = S.clone().add(e, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2197
+ i += z * 60, P = S.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2172
2198
  }
2173
2199
  }
2174
2200
  return p;
@@ -2195,12 +2221,12 @@ class t0 {
2195
2221
  * @param options
2196
2222
  */
2197
2223
  static diversionPassageAt(M, z, b, p = {}) {
2198
- const { t1: c, t2: O, hr: A, hours: o } = this.tropicalCenterTwin(z, 24, p);
2224
+ const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, p);
2199
2225
  if (c && O) {
2200
2226
  if (!p.debug) {
2201
- const S = f.calculateDistance(M, c), e = f.calculateDistance(M, O);
2202
- if (S > 2 * b && e > 2 * b)
2203
- return E == null || E.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", p.requestId, S, e, {
2227
+ const S = f.calculateDistance(M, c), i = f.calculateDistance(M, O);
2228
+ if (S > 2 * b && i > 2 * b)
2229
+ return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", p.requestId, S, i, {
2204
2230
  from: M,
2205
2231
  t1: c,
2206
2232
  t2: O,
@@ -2211,7 +2237,7 @@ class t0 {
2211
2237
  let L = 0;
2212
2238
  d < 180 ? L = d + 90 : d >= 180 && (L = d - 90);
2213
2239
  const T = f.calculateCoordinate(c, L, b);
2214
- return E == null || E.info("[%s] the right tangent position: %j", p.requestId, {
2240
+ return I == null || I.info("[%s] the right tangent position: %j", p.requestId, {
2215
2241
  from: M,
2216
2242
  t1: c,
2217
2243
  t2: O,
@@ -2219,7 +2245,7 @@ class t0 {
2219
2245
  bearing1: q,
2220
2246
  bearing2: Y,
2221
2247
  right: T
2222
- }), { at: T, t1: c, t2: O, hr: Number(A), hours: o };
2248
+ }), { at: T, t1: c, t2: O, hr: Number(A), hours: W };
2223
2249
  }
2224
2250
  return {};
2225
2251
  }
@@ -2234,12 +2260,12 @@ class t0 {
2234
2260
  * @param options
2235
2261
  */
2236
2262
  static driftPassageAt(M, z, b, p = {}) {
2237
- const { t1: c, t2: O, hr: A, hours: o } = this.tropicalCenterTwin(z, 24, p);
2263
+ const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, p);
2238
2264
  if (c && O) {
2239
2265
  if (!p.debug) {
2240
2266
  const T = f.calculateDistance(M, c), S = f.calculateDistance(M, O);
2241
2267
  if (T > 2 * b && S > 2 * b)
2242
- return E == null || E.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", p.requestId, T, S, {
2268
+ return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", p.requestId, T, S, {
2243
2269
  from: M,
2244
2270
  t1: c,
2245
2271
  t2: O,
@@ -2247,9 +2273,9 @@ class t0 {
2247
2273
  }), {};
2248
2274
  }
2249
2275
  const q = f.calculateBearing(M, c), Y = f.calculateBearing(c, O), d = f.calculateDistance(M, c);
2250
- return { at: f.calculateCoordinate(c, q - Y + 180, b < d ? b : d), t1: c, t2: O, hr: Number(A), hours: o };
2276
+ return { at: f.calculateCoordinate(c, q - Y + 180, b < d ? b : d), t1: c, t2: O, hr: Number(A), hours: W };
2251
2277
  } else
2252
- return E == null || E.info("[%s] no need drift: %j", p.requestId, { from: M, t1: c, t2: O, hr: A }), {};
2278
+ return I == null || I.info("[%s] no need drift: %j", p.requestId, { from: M, t1: c, t2: O, hr: A }), {};
2253
2279
  }
2254
2280
  /**
2255
2281
  * 获取台风中心点对
@@ -2262,24 +2288,24 @@ class t0 {
2262
2288
  static tropicalCenterTwin(M, z = 24, b = {}) {
2263
2289
  var Y, d, L, T, S;
2264
2290
  let p = {};
2265
- (Y = M.forecasts) == null || Y.forEach((e) => {
2266
- p = { ...e.hours, ...p };
2291
+ (Y = M.forecasts) == null || Y.forEach((i) => {
2292
+ p = { ...i.hours, ...p };
2267
2293
  });
2268
2294
  const c = ((d = M == null ? void 0 : M.history) == null ? void 0 : d[0]) || (p == null ? void 0 : p[(L = Object.keys(p)) == null ? void 0 : L[0]]);
2269
- E == null || E.info("[%s] the first tropical center: %j", b.requestId, c);
2270
- let O = (T = Object.keys(p || {}).filter((e) => Number(e) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2271
- O || (O = (S = Object.keys(p || {}).filter((e) => Number(e) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : S.at(-1));
2295
+ I == null || I.info("[%s] the first tropical center: %j", b.requestId, c);
2296
+ let O = (T = Object.keys(p || {}).filter((i) => Number(i) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2297
+ O || (O = (S = Object.keys(p || {}).filter((i) => Number(i) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : S.at(-1));
2272
2298
  const A = p == null ? void 0 : p[O || -1];
2273
- E == null || E.info("[%s] the second tropical center: %j in %d hrs", b.requestId, A, O);
2274
- const o = Object.keys(p || {}).filter((e) => Number(e) <= Number(O)), q = { 0: c };
2275
- for (const e of o)
2276
- q[e] = p[e];
2299
+ I == null || I.info("[%s] the second tropical center: %j in %d hrs", b.requestId, A, O);
2300
+ const W = Object.keys(p || {}).filter((i) => Number(i) <= Number(O)), q = { 0: c };
2301
+ for (const i of W)
2302
+ q[i] = p[i];
2277
2303
  return { t1: c, t2: A, hr: Number(O), hours: q };
2278
2304
  }
2279
2305
  static pickIndex(M, z) {
2280
2306
  let b = 0;
2281
2307
  for (const p of M) {
2282
- if (I(p.properties.date).isAfter(z))
2308
+ if (s(p.properties.date).isAfter(z))
2283
2309
  return b === 0 ? -1 : b;
2284
2310
  b++;
2285
2311
  }
@@ -2307,7 +2333,7 @@ class V0 {
2307
2333
  return `${M.lat}|${M.lng}|${M.positionTime}|${M.sog}|${M.cog}|${M.hdg}|${M.draught}|${z}|${JSON.stringify(M.meteo || {})}|${M.vendor}|${M.deleted}`;
2308
2334
  }
2309
2335
  static str2Json(M) {
2310
- const [z, b, p, c, O, A, o, q, Y, d, L] = M.split("|");
2336
+ const [z, b, p, c, O, A, W, q, Y, d, L] = M.split("|");
2311
2337
  return {
2312
2338
  lat: Number(z),
2313
2339
  lng: Number(b),
@@ -2316,7 +2342,7 @@ class V0 {
2316
2342
  cog: Number(O),
2317
2343
  hdg: Number(A),
2318
2344
  //@ts-ignore
2319
- draught: isNaN(o) ? null : Number(o),
2345
+ draught: isNaN(W) ? null : Number(W),
2320
2346
  type: q,
2321
2347
  important: q !== "A",
2322
2348
  meteo: Y ? JSON.parse(Y) : void 0,
@@ -2326,21 +2352,21 @@ class V0 {
2326
2352
  }
2327
2353
  static inspectStoppages(M, z = 1, b = !0) {
2328
2354
  const p = M.at(0).positionTime < M.at(-1).positionTime;
2329
- p || M.sort((o, q) => o.positionTime - q.positionTime);
2355
+ p || M.sort((W, q) => W.positionTime - q.positionTime);
2330
2356
  const c = [];
2331
2357
  let O, A;
2332
- for (let o = 0; o < M.length - 1; o++) {
2333
- const q = M[o];
2358
+ for (let W = 0; W < M.length - 1; W++) {
2359
+ const q = M[W];
2334
2360
  if (!(b && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))) {
2335
- for (let Y = o + 1; Y < M.length; Y++) {
2361
+ for (let Y = W + 1; Y < M.length; Y++) {
2336
2362
  const d = M[Y - 1], L = M[Y];
2337
2363
  if (b && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))
2338
2364
  continue;
2339
2365
  const T = L.positionTime - d.positionTime;
2340
2366
  if (f.calculateDistance(L, d, !0, 4) / (T / 3600) < z)
2341
- O || (O = q), Y === M.length - 1 && (A = L, o = Y);
2367
+ O || (O = q), Y === M.length - 1 && (A = L, W = Y);
2342
2368
  else {
2343
- O && (A = M[Y - 1], o = Y);
2369
+ O && (A = M[Y - 1], W = Y);
2344
2370
  break;
2345
2371
  }
2346
2372
  }
@@ -2351,14 +2377,14 @@ class V0 {
2351
2377
  lng: O.lng,
2352
2378
  sog: O.sog,
2353
2379
  positionTime: O.positionTime,
2354
- utc: I.unix(O.positionTime).utc().format()
2380
+ utc: s.unix(O.positionTime).utc().format()
2355
2381
  },
2356
2382
  end: {
2357
2383
  lat: A.lat,
2358
2384
  lng: A.lng,
2359
2385
  sog: A.sog,
2360
2386
  positionTime: A.positionTime,
2361
- utc: I.unix(A.positionTime).utc().format()
2387
+ utc: s.unix(A.positionTime).utc().format()
2362
2388
  },
2363
2389
  duration: A.positionTime - O.positionTime
2364
2390
  }, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), L = f.divideAccordingToLng(d);
@@ -2367,12 +2393,12 @@ class V0 {
2367
2393
  O = void 0, A = void 0;
2368
2394
  }
2369
2395
  }
2370
- return p || M.sort((o, q) => q.positionTime - o.positionTime), c;
2396
+ return p || M.sort((W, q) => q.positionTime - W.positionTime), c;
2371
2397
  }
2372
2398
  }
2373
2399
  export {
2374
2400
  V0 as AisHelper,
2375
2401
  f as LaneHelper,
2376
- X as LngLatHelper,
2402
+ n as LngLatHelper,
2377
2403
  t0 as TropicalHelper
2378
2404
  };