@idm-plugin/geo 2.3.2 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import * as T from "@turf/turf";
2
- import b from "moment";
2
+ import x from "moment";
3
3
  import z from "@log4js-node/log4js-api";
4
4
  import "moment-timezone";
5
5
  import V from "tz-lookup";
6
6
  import J from "shpjs";
7
- class d {
7
+ class h {
8
8
  /**
9
9
  * 基于输入的经度,计算出时区
10
10
  * @param lng
11
11
  * @param lat
12
12
  */
13
13
  static guessTimeZoneOffset(t, e) {
14
- t = d.convertToStdLng(t);
15
- const n = V(e, t), s = b().tz(n).utcOffset();
16
- return d.roundPrecision(s / 60, 1);
14
+ t = h.convertToStdLng(t);
15
+ const n = V(e, t), s = x().tz(n).utcOffset();
16
+ return h.roundPrecision(s / 60, 1);
17
17
  }
18
18
  /**
19
19
  * 将时间offset转换为时区,例如:8.5 => +08:30
@@ -30,18 +30,18 @@ class d {
30
30
  * @param format
31
31
  */
32
32
  static lng2pretty(t, e = 6, n = "H°M′") {
33
- t = d.convertToStdLng(t, 6);
33
+ t = h.convertToStdLng(t, 6);
34
34
  let s = "E";
35
35
  t < 0 && (s = "W"), t = Math.abs(t), n = n.toUpperCase();
36
36
  let o = t * 3600, r, i, c, a, l, u;
37
- r = o % 3600 % 60, n.indexOf("S") !== -1 && (o = o - r, i = d.padNumber(r, 2, 2)), c = o / 60 % 60, n.indexOf("M") !== -1 && (n.indexOf("S") !== -1 ? a = d.roundPrecision(c, e).toString().padStart(2, "0") : a = d.padNumber(c, 2, 3), o = o - c * 60), l = o / 3600, n.indexOf("M") !== -1 ? u = d.roundPrecision(l, e).toString().padStart(3, "0") : u = d.padNumber(l, 3, 6), Number(i) >= 60 && (a = Number(a) + 1, i = 0), Number(a) >= 60 && (u = Number(u) + 1, a = 0);
38
- const m = `${n.replace(/S+/gi, i).replace(/M+/gi, a).replace(/H+/gi, u)}${s}`;
37
+ r = o % 3600 % 60, n.indexOf("S") !== -1 && (o = o - r, i = h.padNumber(r, 2, 2)), c = o / 60 % 60, n.indexOf("M") !== -1 && (n.indexOf("S") !== -1 ? a = h.roundPrecision(c, e).toString().padStart(2, "0") : a = h.padNumber(c, 2, 3), o = o - c * 60), l = o / 3600, n.indexOf("M") !== -1 ? u = h.roundPrecision(l, e).toString().padStart(3, "0") : u = h.padNumber(l, 3, 6), Number(i) >= 60 && (a = Number(a) + 1, i = 0), Number(a) >= 60 && (u = Number(u) + 1, a = 0);
38
+ const g = `${n.replace(/S+/gi, i).replace(/M+/gi, a).replace(/H+/gi, u)}${s}`;
39
39
  return {
40
40
  direction: s,
41
- degree: d.roundPrecision(l, e),
42
- minute: d.roundPrecision(c, e),
43
- second: d.roundPrecision(r, e),
44
- pretty: m,
41
+ degree: h.roundPrecision(l, e),
42
+ minute: h.roundPrecision(c, e),
43
+ second: h.roundPrecision(r, e),
44
+ pretty: g,
45
45
  S: i,
46
46
  M: a,
47
47
  H: u
@@ -58,14 +58,14 @@ class d {
58
58
  let s = "N";
59
59
  t < 0 && (s = "S"), t = Math.abs(t), n = n.toUpperCase();
60
60
  let o = t * 3600, r, i, c, a, l, u;
61
- r = o % 3600 % 60, n.indexOf("S") !== -1 && (o = o - r, i = d.padNumber(r, 2, 2)), c = o / 60 % 60, n.indexOf("M") !== -1 && (n.indexOf("S") !== -1 ? a = d.roundPrecision(c, e).toString().padStart(2, "0") : a = d.padNumber(c, 2, 3), o = o - c * 60), l = o / 3600, n.indexOf("M") !== -1 ? u = d.roundPrecision(l, e).toString().padStart(2, "0") : u = d.padNumber(l, 2, 6), Number(i) >= 60 && (a = Number(a) + 1, i = 0), Number(a) >= 60 && (u = Number(u) + 1, a = 0);
62
- const m = `${n.replace(/S+/gi, i).replace(/M+/gi, a).replace(/H+/gi, u)}${s}`;
61
+ r = o % 3600 % 60, n.indexOf("S") !== -1 && (o = o - r, i = h.padNumber(r, 2, 2)), c = o / 60 % 60, n.indexOf("M") !== -1 && (n.indexOf("S") !== -1 ? a = h.roundPrecision(c, e).toString().padStart(2, "0") : a = h.padNumber(c, 2, 3), o = o - c * 60), l = o / 3600, n.indexOf("M") !== -1 ? u = h.roundPrecision(l, e).toString().padStart(2, "0") : u = h.padNumber(l, 2, 6), Number(i) >= 60 && (a = Number(a) + 1, i = 0), Number(a) >= 60 && (u = Number(u) + 1, a = 0);
62
+ const g = `${n.replace(/S+/gi, i).replace(/M+/gi, a).replace(/H+/gi, u)}${s}`;
63
63
  return {
64
64
  direction: s,
65
- degree: d.roundPrecision(l, e),
66
- minute: d.roundPrecision(c, e),
67
- second: d.roundPrecision(r, e),
68
- pretty: m,
65
+ degree: h.roundPrecision(l, e),
66
+ minute: h.roundPrecision(c, e),
67
+ second: h.roundPrecision(r, e),
68
+ pretty: g,
69
69
  S: i,
70
70
  M: a,
71
71
  H: u
@@ -74,7 +74,7 @@ class d {
74
74
  static str2Lng(t, e = 6) {
75
75
  let n;
76
76
  if (isNaN(t)) {
77
- t = d.strReplace(t, "LNG");
77
+ t = h.strReplace(t, "LNG");
78
78
  const s = t[t.length - 1].toUpperCase();
79
79
  t = t.substring(0, t.length - 1).trim();
80
80
  const o = t.split(" ").filter((a) => a !== "").map((a) => Math.abs(Number(a)));
@@ -86,12 +86,12 @@ class d {
86
86
  n = r + i / 60 + c / 3600, s === "W" && (n = n * -1);
87
87
  } else
88
88
  n = Number(t);
89
- return d.convertToStdLng(n, e);
89
+ return h.convertToStdLng(n, e);
90
90
  }
91
91
  static str2Lat(t, e = 6) {
92
92
  let n;
93
93
  if (isNaN(t)) {
94
- t = d.strReplace(t, "LAT");
94
+ t = h.strReplace(t, "LAT");
95
95
  const s = t[t.length - 1].toUpperCase();
96
96
  t = t.substring(0, t.length - 1).trim();
97
97
  const o = t.split(" ").filter((a) => a !== "").map((a) => Math.abs(Number(a)));
@@ -105,19 +105,19 @@ class d {
105
105
  s === "S" && (n = n * -1);
106
106
  } else
107
107
  n = Number(t);
108
- return d.roundPrecision(n, e);
108
+ return h.roundPrecision(n, e);
109
109
  }
110
110
  static str2LngOrLat(t, e = 6, n = "LAT") {
111
- t = d.strReplace(t, n);
111
+ t = h.strReplace(t, n);
112
112
  const s = t[t.length - 1].toUpperCase();
113
113
  return ["N", "S"].includes(s) ? {
114
- lat: d.str2Lat(t, e)
114
+ lat: h.str2Lat(t, e)
115
115
  } : {
116
- lng: d.str2Lng(t, e)
116
+ lng: h.str2Lng(t, e)
117
117
  };
118
118
  }
119
119
  static convertToStdLng(t, e = 6) {
120
- return t > 180 ? (t = t % 360, t = t > 180 ? t - 360 : t) : t < -180 && (t = t % 360, t = t < -180 ? t + 360 : t), d.roundPrecision(t, e);
120
+ return t > 180 ? (t = t % 360, t = t > 180 ? t - 360 : t) : t < -180 && (t = t % 360, t = t < -180 ? t + 360 : t), h.roundPrecision(t, e);
121
121
  }
122
122
  static roundPrecision(t, e = 6) {
123
123
  const n = Number("1".padEnd(e + 1, "0"));
@@ -160,7 +160,7 @@ class d {
160
160
  * @param dcmPrecision 小数位数
161
161
  */
162
162
  static padNumber(t, e = 2, n = 2) {
163
- const s = d.roundPrecision(t - Math.trunc(t), n), o = s >= 1 ? Math.trunc(t + 1).toString().padStart(e, "0") : Math.trunc(t).toString().padStart(e, "0");
163
+ const s = h.roundPrecision(t - Math.trunc(t), n), o = s >= 1 ? Math.trunc(t + 1).toString().padStart(e, "0") : Math.trunc(t).toString().padStart(e, "0");
164
164
  return s >= 1 ? o : n > 0 ? `${o}.${Math.trunc(s * Math.pow(10, n)).toString().padStart(n, "0")}` : o;
165
165
  }
166
166
  }
@@ -170,7 +170,7 @@ class K {
170
170
  return `${t.lat}|${t.lng}|${t.positionTime}|${t.sog}|${t.cog}|${t.hdg}|${t.draught}|${e}|${JSON.stringify(t.meteo || {})}|${t.vendor}|${t.deleted}`;
171
171
  }
172
172
  static str2Json(t) {
173
- const [e, n, s, o, r, i, c, a, l, u, m] = t.split("|");
173
+ const [e, n, s, o, r, i, c, a, l, u, g] = t.split("|");
174
174
  return {
175
175
  lat: Number(e),
176
176
  lng: Number(n),
@@ -184,7 +184,7 @@ class K {
184
184
  important: a !== "A",
185
185
  meteo: l ? JSON.parse(l) : void 0,
186
186
  vendor: u,
187
- deleted: m === "true"
187
+ deleted: g === "true"
188
188
  };
189
189
  }
190
190
  static inspectStoppages(t, e = 1, n = !0) {
@@ -198,12 +198,12 @@ class K {
198
198
  const a = t[c];
199
199
  if (!(n && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(a.type))) {
200
200
  for (let l = c + 1; l < t.length; l++) {
201
- const u = t[l - 1], m = t[l];
201
+ const u = t[l - 1], g = t[l];
202
202
  if (n && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(a.type))
203
203
  continue;
204
- const h = m.positionTime - u.positionTime;
205
- if (v.calculateDistance(m, u, !0, 4) / (h / 3600) < e)
206
- r || (r = a), l === t.length - 1 && (i = m, c = l);
204
+ const d = g.positionTime - u.positionTime;
205
+ if (b.calculateDistance(g, u, !0, 4) / (d / 3600) < e)
206
+ r || (r = a), l === t.length - 1 && (i = g, c = l);
207
207
  else {
208
208
  r && (i = t[l - 1], c = l);
209
209
  break;
@@ -216,18 +216,18 @@ class K {
216
216
  lng: r.lng,
217
217
  sog: r.sog,
218
218
  positionTime: r.positionTime,
219
- utc: b.unix(r.positionTime).utc().format()
219
+ utc: x.unix(r.positionTime).utc().format()
220
220
  },
221
221
  end: {
222
222
  lat: i.lat,
223
223
  lng: i.lng,
224
224
  sog: i.sog,
225
225
  positionTime: i.positionTime,
226
- utc: b.unix(i.positionTime).utc().format()
226
+ utc: x.unix(i.positionTime).utc().format()
227
227
  },
228
228
  duration: i.positionTime - r.positionTime
229
- }, u = t.filter((h) => h.positionTime >= l.start.positionTime && h.positionTime <= l.end.positionTime), m = v.divideAccordingToLng(u);
230
- l.distance = v.calculateRouteDistance(m), l.hours = Math.round(l.duration / 3600 * 10) / 10, l.hours && (l.avgSog = Math.round(l.distance / l.hours * 10) / 10, o.push(l));
229
+ }, u = t.filter((d) => d.positionTime >= l.start.positionTime && d.positionTime <= l.end.positionTime), g = b.divideAccordingToLng(u);
230
+ l.distance = b.calculateRouteDistance(g), l.hours = Math.round(l.duration / 3600 * 10) / 10, l.hours && (l.avgSog = Math.round(l.distance / l.hours * 10) / 10, o.push(l));
231
231
  }
232
232
  r = void 0, i = void 0;
233
233
  }
@@ -241,21 +241,21 @@ class K {
241
241
  * @param etm
242
242
  */
243
243
  static inspectSummary(t, e, n) {
244
- const s = b(e), o = b(n), r = t.filter((l) => l.positionTime >= s.unix() && l.positionTime <= o.unix());
244
+ const s = x(e), o = x(n), r = t.filter((l) => l.positionTime >= s.unix() && l.positionTime <= o.unix());
245
245
  let i = 0, c = 0;
246
246
  if (r.length > 1)
247
247
  for (let l = 0; l < r.length - 1; l++) {
248
- const u = r[l], m = r[l + 1];
249
- i += v.calculateDistance(u, m, !0, 4), c += Math.abs(m.positionTime - u.positionTime);
248
+ const u = r[l], g = r[l + 1];
249
+ i += b.calculateDistance(u, g, !0, 4), c += Math.abs(g.positionTime - u.positionTime);
250
250
  }
251
251
  i = Math.round(i * 100) / 100, c = Math.round(c / 3600 * 100) / 100;
252
252
  const a = c ? Math.round(i / c * 100) / 100 : 0;
253
253
  return { distance: i, interval: c, avgSpd: a };
254
254
  }
255
255
  }
256
- let X;
256
+ let Z;
257
257
  try {
258
- X = z.getLogger("meteo");
258
+ Z = z.getLogger("meteo");
259
259
  } catch {
260
260
  } finally {
261
261
  }
@@ -278,25 +278,25 @@ function Q(C) {
278
278
  function _(C) {
279
279
  const t = new TextEncoder(), e = [], n = [];
280
280
  let s = 0;
281
- for (const h of C) {
282
- const p = t.encode(h.name), f = Q(h.data), g = new Uint8Array(30 + p.length), y = new DataView(g.buffer);
283
- y.setUint32(0, 67324752, !0), y.setUint16(4, 20, !0), y.setUint16(8, 0, !0), y.setUint32(14, f, !0), y.setUint32(18, h.data.length, !0), y.setUint32(22, h.data.length, !0), y.setUint16(26, p.length, !0), g.set(p, 30), e.push({ nameBytes: p, data: h.data, crc: f, offset: s }), s += g.length + h.data.length, n.push(g, h.data);
281
+ for (const d of C) {
282
+ const p = t.encode(d.name), f = Q(d.data), m = new Uint8Array(30 + p.length), S = new DataView(m.buffer);
283
+ S.setUint32(0, 67324752, !0), S.setUint16(4, 20, !0), S.setUint16(8, 0, !0), S.setUint32(14, f, !0), S.setUint32(18, d.data.length, !0), S.setUint32(22, d.data.length, !0), S.setUint16(26, p.length, !0), m.set(p, 30), e.push({ nameBytes: p, data: d.data, crc: f, offset: s }), s += m.length + d.data.length, n.push(m, d.data);
284
284
  }
285
285
  const o = s, r = [];
286
286
  let i = 0;
287
- for (const h of e) {
288
- const p = new Uint8Array(46 + h.nameBytes.length), f = new DataView(p.buffer);
289
- f.setUint32(0, 33639248, !0), f.setUint16(4, 20, !0), f.setUint16(6, 20, !0), f.setUint16(10, 0, !0), f.setUint32(16, h.crc, !0), f.setUint32(20, h.data.length, !0), f.setUint32(24, h.data.length, !0), f.setUint16(28, h.nameBytes.length, !0), f.setUint32(42, h.offset, !0), p.set(h.nameBytes, 46), i += p.length, r.push(p);
287
+ for (const d of e) {
288
+ const p = new Uint8Array(46 + d.nameBytes.length), f = new DataView(p.buffer);
289
+ f.setUint32(0, 33639248, !0), f.setUint16(4, 20, !0), f.setUint16(6, 20, !0), f.setUint16(10, 0, !0), f.setUint32(16, d.crc, !0), f.setUint32(20, d.data.length, !0), f.setUint32(24, d.data.length, !0), f.setUint16(28, d.nameBytes.length, !0), f.setUint32(42, d.offset, !0), p.set(d.nameBytes, 46), i += p.length, r.push(p);
290
290
  }
291
291
  const c = new Uint8Array(22), a = new DataView(c.buffer);
292
292
  a.setUint32(0, 101010256, !0), a.setUint16(8, e.length, !0), a.setUint16(10, e.length, !0), a.setUint32(12, i, !0), a.setUint32(16, o, !0);
293
- const l = n.reduce((h, p) => h + p.length, 0) + i + 22, u = new Uint8Array(l);
294
- let m = 0;
295
- for (const h of n)
296
- u.set(h, m), m += h.length;
297
- for (const h of r)
298
- u.set(h, m), m += h.length;
299
- return u.set(c, m), u;
293
+ const l = n.reduce((d, p) => d + p.length, 0) + i + 22, u = new Uint8Array(l);
294
+ let g = 0;
295
+ for (const d of n)
296
+ u.set(d, g), g += d.length;
297
+ for (const d of r)
298
+ u.set(d, g), g += d.length;
299
+ return u.set(c, g), u;
300
300
  }
301
301
  function G(C) {
302
302
  let t = "", e = C;
@@ -304,7 +304,7 @@ function G(C) {
304
304
  t = String.fromCharCode(65 + e % 26) + t, e = Math.floor(e / 26) - 1;
305
305
  return t;
306
306
  }
307
- class v {
307
+ class b {
308
308
  /**
309
309
  * 计算方位角
310
310
  * @param from 坐标 {lng, lat}
@@ -319,7 +319,7 @@ class v {
319
319
  [e.lng, e.lat]
320
320
  ]);
321
321
  let r;
322
- return n ? r = T.rhumbBearing(o.features[0], o.features[1]) : r = T.bearing(o.features[0], o.features[1]), r < 0 && (r += 360), d.roundPrecision(r, s);
322
+ return n ? r = T.rhumbBearing(o.features[0], o.features[1]) : r = T.bearing(o.features[0], o.features[1]), r < 0 && (r += 360), h.roundPrecision(r, s);
323
323
  }
324
324
  /**
325
325
  * 计算两点间距离
@@ -331,13 +331,13 @@ class v {
331
331
  * @returns {number}
332
332
  */
333
333
  static calculateDistance(t, e, n = !0, s = 4, o = "nauticalmiles") {
334
- t = { ...t }, e = { ...e }, t.lng = d.convertToStdLng(t.lng, s), e.lng = d.convertToStdLng(e.lng, s);
334
+ t = { ...t }, e = { ...e }, t.lng = h.convertToStdLng(t.lng, s), e.lng = h.convertToStdLng(e.lng, s);
335
335
  const r = T.points([
336
336
  [t.lng, t.lat],
337
337
  [e.lng, e.lat]
338
338
  ]);
339
339
  let i;
340
- return n ? i = T.rhumbDistance(r.features[0], r.features[1], { units: o }) : i = T.distance(r.features[0], r.features[1], { units: o }), d.roundPrecision(i, s);
340
+ return n ? i = T.rhumbDistance(r.features[0], r.features[1], { units: o }) : i = T.distance(r.features[0], r.features[1], { units: o }), h.roundPrecision(i, s);
341
341
  }
342
342
  /**
343
343
  * 计算航线距离
@@ -354,7 +354,7 @@ class v {
354
354
  const a = { lng: r[i + 1][0], lat: r[i + 1][1] };
355
355
  s += this.calculateDistance(c, a, !0, e, n), o = a;
356
356
  }
357
- return d.roundPrecision(s, e);
357
+ return h.roundPrecision(s, e);
358
358
  }
359
359
  /**
360
360
  * 计算坐标(基于方位角和距离)
@@ -369,7 +369,7 @@ class v {
369
369
  let i;
370
370
  o ? i = T.rhumbDestination(r, n, e, { units: s }) : i = T.destination(r, n, e, { units: s });
371
371
  const c = i.geometry.coordinates;
372
- return { lng: d.convertToStdLng(c[0], 8), lat: d.roundPrecision(c[1], 8) };
372
+ return { lng: h.convertToStdLng(c[0], 8), lat: h.roundPrecision(c[1], 8) };
373
373
  }
374
374
  /**
375
375
  * 插值大圆坐标(基于两点方位角和间距)
@@ -408,23 +408,23 @@ class v {
408
408
  const o = [];
409
409
  let r, i;
410
410
  for (let c = 0; c < t.length - 1; c++) {
411
- r = d.convertToStdLng(t[c].lng, 8), i = d.convertToStdLng(t[c + 1].lng, 8), t[c].lat = d.roundPrecision(t[c].lat, 8), t[c + 1].lat = d.roundPrecision(t[c + 1].lat, 8), s.push([r, t[c].lat]);
411
+ r = h.convertToStdLng(t[c].lng, 8), i = h.convertToStdLng(t[c + 1].lng, 8), t[c].lat = h.roundPrecision(t[c].lat, 8), t[c + 1].lat = h.roundPrecision(t[c + 1].lat, 8), s.push([r, t[c].lat]);
412
412
  const a = r - i;
413
413
  if (Math.abs(a) > 180) {
414
- const l = d.convertToMonotonicLng2([
414
+ const l = h.convertToMonotonicLng2([
415
415
  [r, t[c].lat],
416
416
  [i, t[c + 1].lat]
417
417
  ]);
418
- let u, m;
419
- e ? (u = T.lineString(l), m = T.lineString([
418
+ let u, g;
419
+ e ? (u = T.lineString(l), g = T.lineString([
420
420
  [a > 0 ? 180 : -180, 89],
421
421
  [a > 0 ? 180 : -180, -89]
422
- ])) : (u = T.greatCircle(l[0], l[1]), m = T.greatCircle([a > 0 ? 180 : -180, 89], [a > 0 ? 180 : -180, -89]));
423
- const h = T.lineIntersect(u, m);
422
+ ])) : (u = T.greatCircle(l[0], l[1]), g = T.greatCircle([a > 0 ? 180 : -180, 89], [a > 0 ? 180 : -180, -89]));
423
+ const d = T.lineIntersect(u, g);
424
424
  let p;
425
- if (h.features.length) {
426
- const f = T.getCoord(h.features[0]);
427
- p = d.roundPrecision(f[1], 8);
425
+ if (d.features.length) {
426
+ const f = T.getCoord(d.features[0]);
427
+ p = h.roundPrecision(f[1], 8);
428
428
  } else
429
429
  p = t[c].lat;
430
430
  a > 0 ? (s.push([180 - 1e-6, p]), o.push([...s]), s = [], s.push([-(180 - 1e-6), p])) : (s.push([-(180 - 1e-6), p]), o.push([...s]), s = [], s.push([180 - 1e-6, p]));
@@ -458,10 +458,10 @@ class v {
458
458
  * @param route 航线[[[lng, lat],[lng, lat]]]
459
459
  */
460
460
  static removeCoordinateFromRoute(t, e) {
461
- t.lng = d.convertToStdLng(t.lng, 8);
461
+ t.lng = h.convertToStdLng(t.lng, 8);
462
462
  for (const n of e)
463
463
  for (let s = n.length - 1; s >= 0; s--)
464
- d.roundPrecision(n[s][0], 8) === t.lng && d.roundPrecision(n[s][1], 8) === d.roundPrecision(t.lat, 8) && n.splice(s, 1);
464
+ h.roundPrecision(n[s][0], 8) === t.lng && h.roundPrecision(n[s][1], 8) === h.roundPrecision(t.lat, 8) && n.splice(s, 1);
465
465
  return e;
466
466
  }
467
467
  /**
@@ -470,9 +470,9 @@ class v {
470
470
  * @param waypoints [{lat, lng}, {lat, lng}]
471
471
  */
472
472
  static removeCoordinateFromWaypoints(t, e) {
473
- t.lng = d.convertToStdLng(t.lng, 8);
473
+ t.lng = h.convertToStdLng(t.lng, 8);
474
474
  for (let n = e.length - 1; n >= 0; n--)
475
- d.roundPrecision(e[n].lng, 8) === t.lng && d.roundPrecision(e[n].lat, 8) === d.roundPrecision(t.lat, 8) && e.splice(n, 1);
475
+ h.roundPrecision(e[n].lng, 8) === t.lng && h.roundPrecision(e[n].lat, 8) === h.roundPrecision(t.lat, 8) && e.splice(n, 1);
476
476
  return e;
477
477
  }
478
478
  /**
@@ -487,12 +487,12 @@ class v {
487
487
  * [[[120, 30], [120, 35], [125,40], [130, 37]], [[-150, 40], [-130, 30]]]
488
488
  */
489
489
  static mergeCoordinateToRoute(t, e) {
490
- t.lng = d.convertToStdLng(t.lng, 8);
490
+ t.lng = h.convertToStdLng(t.lng, 8);
491
491
  let n = Number.MAX_VALUE, s = 0, o = 0, r, i;
492
492
  return e.forEach((c, a) => {
493
493
  for (let l = 0; l < c.length - 1; l++) {
494
- const u = { lng: c[l][0], lat: c[l][1] }, m = { lng: c[l + 1][0], lat: c[l + 1][1] }, h = this.calculatePointToLineDistance(t, u, m);
495
- n > h && (n = h, o = l, s = a, r = this.calculateDistance(u, t), i = this.calculateDistance(m, t));
494
+ const u = { lng: c[l][0], lat: c[l][1] }, g = { lng: c[l + 1][0], lat: c[l + 1][1] }, d = this.calculatePointToLineDistance(t, u, g);
495
+ n > d && (n = d, o = l, s = a, r = this.calculateDistance(u, t), i = this.calculateDistance(g, t));
496
496
  }
497
497
  }), r !== 0 && i !== 0 ? e[s].splice(o + 1, 0, [t.lng, t.lat]) : r === 0 ? e[s].splice(o, 1, [t.lng, t.lat]) : i === 0 && e[s].splice(o + 1, 1, [t.lng, t.lat]), e;
498
498
  }
@@ -502,9 +502,9 @@ class v {
502
502
  * @param route
503
503
  */
504
504
  static appendCoordinateToRoute(t, e) {
505
- t.lng = d.convertToStdLng(t.lng, 8);
506
- const n = v.convertRouteToCoordinates(e);
507
- return n.push(t), v.divideAccordingToLng(n);
505
+ t.lng = h.convertToStdLng(t.lng, 8);
506
+ const n = b.convertRouteToCoordinates(e);
507
+ return n.push(t), b.divideAccordingToLng(n);
508
508
  }
509
509
  /**
510
510
  * 向route头加1个坐标
@@ -512,8 +512,8 @@ class v {
512
512
  * @param route
513
513
  */
514
514
  static unshiftCoordinateToRoute(t, e) {
515
- const n = v.convertRouteToCoordinates(e);
516
- return n.unshift(t), v.divideAccordingToLng(n);
515
+ const n = b.convertRouteToCoordinates(e);
516
+ return n.unshift(t), b.divideAccordingToLng(n);
517
517
  }
518
518
  /**
519
519
  * 合并多个waypoints进航线
@@ -541,11 +541,11 @@ class v {
541
541
  return;
542
542
  const i = [];
543
543
  for (const c of r) {
544
- if (d.roundPrecision(e.lng, 8) === d.roundPrecision(c[0], 8) && d.roundPrecision(e.lat, 8) === d.roundPrecision(c[1], 8)) {
544
+ if (h.roundPrecision(e.lng, 8) === h.roundPrecision(c[0], 8) && h.roundPrecision(e.lat, 8) === h.roundPrecision(c[1], 8)) {
545
545
  i.push(c), o === 0 && i.push([t.lng, t.lat]), o = 2;
546
546
  break;
547
547
  }
548
- o === 1 ? i.push(c) : d.roundPrecision(t.lng, 8) === d.roundPrecision(c[0], 8) && d.roundPrecision(t.lat, 8) === d.roundPrecision(c[1], 8) && (o = 1, i.push(c));
548
+ o === 1 ? i.push(c) : h.roundPrecision(t.lng, 8) === h.roundPrecision(c[0], 8) && h.roundPrecision(t.lat, 8) === h.roundPrecision(c[1], 8) && (o = 1, i.push(c));
549
549
  }
550
550
  i.length && s.push(i);
551
551
  }), s;
@@ -560,9 +560,9 @@ class v {
560
560
  */
561
561
  static calculateRangeWaypoints(t, e, n, s = []) {
562
562
  const o = this.convertRouteToCoordinates(n, 0), r = this.mergeCoordinatesToWaypoints([t, e], o.length ? o : s), i = r.findIndex(
563
- (l) => d.roundPrecision(t.lng, 8) === d.roundPrecision(l.lng, 8) && d.roundPrecision(t.lat, 8) === d.roundPrecision(l.lat, 8)
563
+ (l) => h.roundPrecision(t.lng, 8) === h.roundPrecision(l.lng, 8) && h.roundPrecision(t.lat, 8) === h.roundPrecision(l.lat, 8)
564
564
  ), c = r.findIndex(
565
- (l) => d.roundPrecision(e.lng, 8) === d.roundPrecision(l.lng, 8) && d.roundPrecision(e.lat, 8) === d.roundPrecision(l.lat, 8)
565
+ (l) => h.roundPrecision(e.lng, 8) === h.roundPrecision(l.lng, 8) && h.roundPrecision(e.lat, 8) === h.roundPrecision(l.lat, 8)
566
566
  );
567
567
  return r.filter((l, u) => u >= i && u <= c);
568
568
  }
@@ -587,10 +587,10 @@ class v {
587
587
  * @return [[[lng, lat]]]
588
588
  */
589
589
  static calculateSubRoute(t, e) {
590
- const n = v.convertRouteToCoordinates(e);
591
- v.mergeCoordinateToWaypoints(t, n, !0), e = v.divideAccordingToLng(n);
590
+ const n = b.convertRouteToCoordinates(e);
591
+ b.mergeCoordinateToWaypoints(t, n, !0), e = b.divideAccordingToLng(n);
592
592
  const { segIndex: s, minIndex: o } = this.calculateMinDistanceToRoute({ ...t }, e);
593
- t.lng = d.convertToStdLng(t.lng);
593
+ t.lng = h.convertToStdLng(t.lng);
594
594
  const r = [];
595
595
  let i = !0;
596
596
  for (let c = s; c < e.length; c++)
@@ -621,7 +621,7 @@ class v {
621
621
  const a = this.calculatePointToLineDistance(t, i, c);
622
622
  n > a && (n = a, s = r);
623
623
  }
624
- t.lng = d.convertToStdLng(t.lng);
624
+ t.lng = h.convertToStdLng(t.lng);
625
625
  const o = [t];
626
626
  for (let r = s + 1; r < e.length; r++)
627
627
  o.push(e[r]);
@@ -635,14 +635,14 @@ class v {
635
635
  * @param options
636
636
  */
637
637
  static calculatePointToLineDistance(t, e, n, s = { units: "nauticalmiles", method: "geodesic" }) {
638
- t.lng = d.convertToStdLng(t.lng, 8), e = { ...e }, n = { ...n }, e.lng = d.convertToStdLng(e.lng, 8), n.lng = d.convertToStdLng(n.lng, 8);
639
- const o = d.convertToMonotonicLng([e, n]);
638
+ t.lng = h.convertToStdLng(t.lng, 8), e = { ...e }, n = { ...n }, e.lng = h.convertToStdLng(e.lng, 8), n.lng = h.convertToStdLng(n.lng, 8);
639
+ const o = h.convertToMonotonicLng([e, n]);
640
640
  e = o[0], n = o[1];
641
641
  const r = T.lineString([
642
642
  [e.lng, e.lat],
643
643
  [n.lng, n.lat]
644
644
  ]), i = T.pointToLineDistance(T.point([t.lng, t.lat]), r, s), c = T.pointToLineDistance(T.point([t.lng > 0 ? t.lng - 360 : t.lng + 360, t.lat]), r, s);
645
- return d.roundPrecision(Math.min(i, c), 6);
645
+ return h.roundPrecision(Math.min(i, c), 6);
646
646
  }
647
647
  /**
648
648
  * 计算途经点的COG, Distance等属性
@@ -653,7 +653,7 @@ class v {
653
653
  e = this.mergeWaypointsToRoute(t, e);
654
654
  for (let n = 0; n < t.length - 1; n++) {
655
655
  const s = t[n], o = t[n + 1], r = this.calculateRangeRoute(s, o, e);
656
- n === 0 && (s.distanceFromPrevious = 0, s.distanceFromStart = 0), o.distanceFromPrevious = this.calculateRouteDistance(r), o.distanceFromStart = d.roundPrecision((s.distanceFromStart || 0) + o.distanceFromPrevious);
656
+ n === 0 && (s.distanceFromPrevious = 0, s.distanceFromStart = 0), o.distanceFromPrevious = this.calculateRouteDistance(r), o.distanceFromStart = h.roundPrecision((s.distanceFromStart || 0) + o.distanceFromPrevious);
657
657
  }
658
658
  return t;
659
659
  }
@@ -680,7 +680,7 @@ class v {
680
680
  * [{ lng: 160, lat: 30}, { lng: 170, lat: 40}, {lng: 179, lat: 50}, {lng: -170, lat: 40}, {lng: -160, lat: 30}]
681
681
  */
682
682
  static mergeCoordinateToWaypoints(t, e, n = !0) {
683
- t.lng = d.convertToStdLng(t.lng, 8);
683
+ t.lng = h.convertToStdLng(t.lng, 8);
684
684
  let s = Number.MAX_VALUE, o = 0, r = 0, i = 0;
685
685
  if (e.length < 2)
686
686
  e.push(t);
@@ -692,11 +692,11 @@ class v {
692
692
  r !== 0 && i !== 0 ? r <= s && o === 0 ? e.unshift(t) : i <= s && o === e.length - 2 ? e.push(t) : e.splice(o + 1, 0, t) : r === 0 ? n ? e.splice(o, 1, t) : e.splice(o + 1, 0, t) : i === 0 && (n ? e.splice(o + 1, 1, t) : e.splice(o + 1, 0, t));
693
693
  }
694
694
  return e.map((c, a) => {
695
- c.lng = d.convertToStdLng(c.lng);
695
+ c.lng = h.convertToStdLng(c.lng);
696
696
  const l = e[a + 1];
697
697
  if (l && ((c.bearing === null || c.bearing === void 0) && ((c.positionTime || 0) > (l.positionTime || 0) ? c.bearing = this.calculateBearing(l, c, !0) : c.bearing = this.calculateBearing(c, l, !0)), c.cog = c.cog || c.bearing, !c.sog && c.positionTime && l.positionTime)) {
698
- const u = this.calculateDistance(c, l, !0), m = Math.abs(l.positionTime - c.positionTime) / 3600;
699
- c.sog = d.roundPrecision(u / m, 2);
698
+ const u = this.calculateDistance(c, l, !0), g = Math.abs(l.positionTime - c.positionTime) / 3600;
699
+ c.sog = h.roundPrecision(u / g, 2);
700
700
  }
701
701
  return c;
702
702
  });
@@ -727,7 +727,7 @@ class v {
727
727
  */
728
728
  static nearestCoordinateInRoute(t, e) {
729
729
  const n = T.point([t.lng, t.lat]), o = this.convertRouteToCoordinates(e).map((a) => [a.lng, a.lat]), r = T.lineString(o), i = T.nearestPointOnLine(r, n), c = T.getCoord(i);
730
- return { lng: d.roundPrecision(c[0], 8), lat: d.roundPrecision(c[1], 8) };
730
+ return { lng: h.roundPrecision(c[0], 8), lat: h.roundPrecision(c[1], 8) };
731
731
  }
732
732
  /**
733
733
  * 计算经过方向上的最后一个waypoint
@@ -759,39 +759,39 @@ class v {
759
759
  * @return { coordinate: {lng, lat}, route: [[[lng, lat]]]}
760
760
  */
761
761
  static calculateNextCoordinateAlongRoute(t, e, n, s = "nauticalmiles") {
762
- var m;
762
+ var g;
763
763
  const o = t.speed || 12, r = [];
764
764
  let i = [], c = !1, a = 0, l = 0, u;
765
- if (e && n.length ? (r.push(t), n.forEach((h, p) => {
765
+ if (e && n.length ? (r.push(t), n.forEach((d, p) => {
766
766
  if (c)
767
- i.push(h);
767
+ i.push(d);
768
768
  else {
769
769
  const f = [];
770
- let g;
771
- for (let y = 0; y < h.length; y++)
770
+ let m;
771
+ for (let S = 0; S < d.length; S++)
772
772
  if (u)
773
- f.push(h[y]);
773
+ f.push(d[S]);
774
774
  else {
775
- g = { lng: h[y][0], lat: h[y][1] };
776
- const x = this.calculateDistance(t, g, !0, 8, s);
777
- if (a += x, a < e)
778
- l += x, x && r.push(g), t = g;
775
+ m = { lng: d[S][0], lat: d[S][1] };
776
+ const v = this.calculateDistance(t, m, !0, 8, s);
777
+ if (a += v, a < e)
778
+ l += v, v && r.push(m), t = m;
779
779
  else {
780
780
  if (l = e, a === e)
781
- u = g, f.push([u.lng, u.lat]);
781
+ u = m, f.push([u.lng, u.lat]);
782
782
  else {
783
- const P = a - e, S = this.calculateBearing(g, t);
784
- u = this.calculateCoordinate(g, S, P, s), f.push([u.lng, u.lat]), f.push([g.lng, g.lat]);
783
+ const P = a - e, y = this.calculateBearing(m, t);
784
+ u = this.calculateCoordinate(m, y, P, s), f.push([u.lng, u.lat]), f.push([m.lng, m.lat]);
785
785
  }
786
786
  c = !0;
787
787
  }
788
788
  }
789
- f.length && i.push(f), p === n.length - 1 && !u && (u = g);
789
+ f.length && i.push(f), p === n.length - 1 && !u && (u = m);
790
790
  }
791
791
  })) : (i = n, u = { ...t }), u)
792
- if (r.push(u), u.distanceFromPrevious = Math.round(l * 1e4) / 1e4, u.hourFromPrevious = Math.round(l / o * 1e4) / 1e4, ((m = i[0]) == null ? void 0 : m.length) > 1) {
793
- const h = { lng: i[0][1][0], lat: i[0][1][1] };
794
- u.bearing = this.calculateBearing(u, h);
792
+ if (r.push(u), u.distanceFromPrevious = Math.round(l * 1e4) / 1e4, u.hourFromPrevious = Math.round(l / o * 1e4) / 1e4, ((g = i[0]) == null ? void 0 : g.length) > 1) {
793
+ const d = { lng: i[0][1][0], lat: i[0][1][1] };
794
+ u.bearing = this.calculateBearing(u, d);
795
795
  } else
796
796
  u.bearing = 0;
797
797
  return { coordinate: u, nextRoute: i, prevRoute: r };
@@ -803,11 +803,11 @@ class v {
803
803
  * @param to {lng, lat}
804
804
  */
805
805
  static nearestCoordinateInLine(t, e, n) {
806
- const s = d.convertToStdLng(t.lng, 6), o = T.point([s, t.lat]), r = d.convertToStdLng(e.lng, 6), i = d.convertToStdLng(n.lng, 6), c = T.lineString([
806
+ const s = h.convertToStdLng(t.lng, 6), o = T.point([s, t.lat]), r = h.convertToStdLng(e.lng, 6), i = h.convertToStdLng(n.lng, 6), c = T.lineString([
807
807
  [r, e.lat],
808
808
  [i, n.lat]
809
- ]), a = T.nearestPointOnLine(c, o), l = T.getCoord(a), u = d.roundPrecision(l[0], 6), m = d.roundPrecision(l[1], 6);
810
- return { lng: u, lat: m, inline: !(u === r && m === e.lat) && !(u === i && m === n.lat) };
809
+ ]), a = T.nearestPointOnLine(c, o), l = T.getCoord(a), u = h.roundPrecision(l[0], 6), g = h.roundPrecision(l[1], 6);
810
+ return { lng: u, lat: g, inline: !(u === r && g === e.lat) && !(u === i && g === n.lat) };
811
811
  }
812
812
  /**
813
813
  * 将route转coordinate
@@ -819,7 +819,7 @@ class v {
819
819
  let s, o;
820
820
  return t.forEach((r) => {
821
821
  r.forEach((i) => {
822
- const c = { lng: d.roundPrecision(i[0], 8), lat: d.roundPrecision(i[1], 8) };
822
+ const c = { lng: h.roundPrecision(i[0], 8), lat: h.roundPrecision(i[1], 8) };
823
823
  if (!o)
824
824
  n.push(c), o = c;
825
825
  else if (o.bearing === void 0 || o.bearing === null)
@@ -862,9 +862,9 @@ class v {
862
862
  let n = 0;
863
863
  for (let s = 1; s < t.length; s++) {
864
864
  const o = t[s - 1], r = t[s];
865
- r.gcToPrevious ? (o.bearing = this.calculateBearing(o, r, !1), r.distanceFromPrevious = this.calculateDistance(o, r, !1)) : (o.bearing = this.calculateBearing(o, r, !0), r.distanceFromPrevious = this.calculateDistance(o, r, !0)), n = d.roundPrecision(n + r.distanceFromPrevious), r.distanceFromStart = n;
865
+ r.gcToPrevious ? (o.bearing = this.calculateBearing(o, r, !1), r.distanceFromPrevious = this.calculateDistance(o, r, !1)) : (o.bearing = this.calculateBearing(o, r, !0), r.distanceFromPrevious = this.calculateDistance(o, r, !0)), n = h.roundPrecision(n + r.distanceFromPrevious), r.distanceFromStart = n;
866
866
  }
867
- return t.map((s) => (s.lng = d.convertToStdLng(s.lng), s));
867
+ return t.map((s) => (s.lng = h.convertToStdLng(s.lng), s));
868
868
  }
869
869
  /**
870
870
  * 计算轨迹中心点
@@ -875,11 +875,11 @@ class v {
875
875
  for (const i of t)
876
876
  for (const c of i)
877
877
  e.push(c);
878
- const n = T.featureCollection([]), s = d.convertToMonotonicLng2(e);
878
+ const n = T.featureCollection([]), s = h.convertToMonotonicLng2(e);
879
879
  for (const i of s)
880
880
  n.features.push(T.point(i));
881
881
  const r = T.center(n).geometry.coordinates;
882
- return { lng: d.convertToStdLng(r[0], 8), lat: d.roundPrecision(r[1], 8) };
882
+ return { lng: h.convertToStdLng(r[0], 8), lat: h.roundPrecision(r[1], 8) };
883
883
  }
884
884
  /**
885
885
  * 计算中心点
@@ -898,7 +898,7 @@ class v {
898
898
  for (const o of t)
899
899
  for (const r of o)
900
900
  e.push(r);
901
- const n = d.convertToMonotonicLng2(e), s = T.lineString(n);
901
+ const n = h.convertToMonotonicLng2(e), s = T.lineString(n);
902
902
  return T.bbox(s);
903
903
  }
904
904
  /**
@@ -921,8 +921,8 @@ class v {
921
921
  const r = t[o - 1], i = t[o], c = t[o + 1];
922
922
  let a = !1, l = !1;
923
923
  if ((r.velocity || r.suspend || r.important || r.pilot || o === 1) && (a = !0, s.push(r)), i.gcToPrevious && (a || (a = !0, s.push(r)), l = !0, s.push(i), o++), c) {
924
- const u = v.calculateDistance(r, i, !0), m = v.calculateDistance(i, c, !0), h = v.calculateDistance(r, c, !0), p = (Math.pow(u, 2) + Math.pow(m, 2) - Math.pow(h, 2)) / (2 * u * m);
925
- Math.round(Math.acos(p) * 180 / Math.PI) < n && h > e && !l && (s.push(i), o++);
924
+ const u = b.calculateDistance(r, i, !0), g = b.calculateDistance(i, c, !0), d = b.calculateDistance(r, c, !0), p = (Math.pow(u, 2) + Math.pow(g, 2) - Math.pow(d, 2)) / (2 * u * g);
925
+ Math.round(Math.acos(p) * 180 / Math.PI) < n && d > e && !l && (s.push(i), o++);
926
926
  }
927
927
  if (o >= t.length - 1) {
928
928
  const u = t.at(-1);
@@ -938,7 +938,7 @@ class v {
938
938
  * @param waypoints 带时间的轨迹, 单位秒
939
939
  */
940
940
  static nearestTSPointInWaypoints(t, e, n) {
941
- const s = b.unix(t), o = n.filter(
941
+ const s = x.unix(t), o = n.filter(
942
942
  (r) => s.clone().subtract(e, "hour").unix() <= (r.positionTime || 0) && s.clone().add(e, "h").unix() >= (r.positionTime || 0)
943
943
  );
944
944
  return o.sort((r, i) => (r.positionTime || 0) - (i.positionTime || 0)), o.at(-1);
@@ -951,15 +951,15 @@ class v {
951
951
  static deadReckoning(t, e) {
952
952
  var o, r, i, c;
953
953
  t > 1e12 && (t = Math.round(t / 1e3));
954
- const n = b.unix(t);
954
+ const n = x.unix(t);
955
955
  let s = e.find((a) => a.positionTime === n.unix());
956
956
  if (!s) {
957
- const a = (r = (o = e.filter((u) => (u == null ? void 0 : u.positionTime) < n.unix())) == null ? void 0 : o.sort((u, m) => (u.positionTime || 0) - (m.positionTime || 0))) == null ? void 0 : r.at(-1), l = (c = (i = e.filter((u) => (u == null ? void 0 : u.positionTime) > n.unix())) == null ? void 0 : i.sort((u, m) => (u.positionTime || 0) - (m.positionTime || 0))) == null ? void 0 : c.at(0);
957
+ const a = (r = (o = e.filter((u) => (u == null ? void 0 : u.positionTime) < n.unix())) == null ? void 0 : o.sort((u, g) => (u.positionTime || 0) - (g.positionTime || 0))) == null ? void 0 : r.at(-1), l = (c = (i = e.filter((u) => (u == null ? void 0 : u.positionTime) > n.unix())) == null ? void 0 : i.sort((u, g) => (u.positionTime || 0) - (g.positionTime || 0))) == null ? void 0 : c.at(0);
958
958
  if (a && l) {
959
- const u = v.calculateBearing(a, l, !0), m = v.calculateDistance(a, l), h = (n.unix() - a.positionTime) / (l.positionTime - a.positionTime);
960
- s = v.calculateCoordinate(a, u, m * h), s.positionTime = n.unix(), s.utc = n.utc().format(), s.cog = u, s.sog = Math.round(m / ((l.positionTime - a.positionTime) / 3600) * 100) / 100;
959
+ const u = b.calculateBearing(a, l, !0), g = b.calculateDistance(a, l), d = (n.unix() - a.positionTime) / (l.positionTime - a.positionTime);
960
+ s = b.calculateCoordinate(a, u, g * d), s.positionTime = n.unix(), s.utc = n.utc().format(), s.cog = u, s.sog = Math.round(g / ((l.positionTime - a.positionTime) / 3600) * 100) / 100;
961
961
  } else
962
- s = a || l, s && (s.utc = b.unix(s == null ? void 0 : s.positionTime).utc().format());
962
+ s = a || l, s && (s.utc = x.unix(s == null ? void 0 : s.positionTime).utc().format());
963
963
  }
964
964
  return s;
965
965
  }
@@ -972,19 +972,19 @@ class v {
972
972
  e = JSON.parse(JSON.stringify(e)), e.sort((a, l) => (a.positionTime || 0) - (l.positionTime || 0));
973
973
  let n = Number.MAX_SAFE_INTEGER, s = Number.MAX_SAFE_INTEGER;
974
974
  for (let a = 0; a < e.length - 1; a++) {
975
- const l = e[a], u = e[a + 1], m = v.calculatePointToLineDistance(t, l, u);
976
- m < n && (n = m, s = a);
975
+ const l = e[a], u = e[a + 1], g = b.calculatePointToLineDistance(t, l, u);
976
+ g < n && (n = g, s = a);
977
977
  }
978
- const o = e[s], r = e[s + 1], i = v.calculateDistance(o, t), c = v.calculateDistance(r, t);
978
+ const o = e[s], r = e[s + 1], i = b.calculateDistance(o, t), c = b.calculateDistance(r, t);
979
979
  if (i === 0)
980
980
  t = o;
981
981
  else if (c === 0)
982
982
  t = r;
983
983
  else {
984
- const a = o.positionTime || 0, l = r.positionTime || 0, u = v.calculateDistance(o, r);
984
+ const a = o.positionTime || 0, l = r.positionTime || 0, u = b.calculateDistance(o, r);
985
985
  t.positionTime = Math.round(a + (l - a) * (i / u));
986
986
  }
987
- return t.utc = t.positionTime ? b.unix(t.positionTime).utc().format() : void 0, t.positionTime ? t : void 0;
987
+ return t.utc = t.positionTime ? x.unix(t.positionTime).utc().format() : void 0, t.positionTime ? t : void 0;
988
988
  }
989
989
  /**
990
990
  * 翻转轨迹
@@ -1020,7 +1020,7 @@ class v {
1020
1020
  */
1021
1021
  static waypoints2RTZ(t, e) {
1022
1022
  const s = [];
1023
- return s.push('<?xml version="1.0" encoding="UTF-8"?>'), s.push('<route xmlns="http://www.cirm.org/RTZ/1/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2">'), s.push(` <routeInfo routeName="${v.xmlEscape(t)}"></routeInfo>`), s.push(...v.toRTZWaypoints(e, 6)), s.push("</route>"), s.join(`
1023
+ return s.push('<?xml version="1.0" encoding="UTF-8"?>'), s.push('<route xmlns="http://www.cirm.org/RTZ/1/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2">'), s.push(` <routeInfo routeName="${b.xmlEscape(t)}"></routeInfo>`), s.push(...b.toRTZWaypoints(e, 6)), s.push("</route>"), s.join(`
1024
1024
  `) + `
1025
1025
  `;
1026
1026
  }
@@ -1032,7 +1032,7 @@ class v {
1032
1032
  */
1033
1033
  static waypoints2RTZ10(t, e, n = !0) {
1034
1034
  const o = [];
1035
- return o.push('<?xml version="1.0" encoding="UTF-8"?>'), o.push('<route xmlns="http://www.cirm.org/RTZ/1/0" version="1.0">'), o.push(` <routeInfo routeName="${v.xmlEscape(t)}"></routeInfo>`), o.push(...v.toRTZWaypoints(e, 6, n)), o.push("</route>"), o.join(`
1035
+ return o.push('<?xml version="1.0" encoding="UTF-8"?>'), o.push('<route xmlns="http://www.cirm.org/RTZ/1/0" version="1.0">'), o.push(` <routeInfo routeName="${b.xmlEscape(t)}"></routeInfo>`), o.push(...b.toRTZWaypoints(e, 6, n)), o.push("</route>"), o.join(`
1036
1036
  `) + `
1037
1037
  `;
1038
1038
  }
@@ -1041,20 +1041,20 @@ class v {
1041
1041
  s.push(" <waypoints>");
1042
1042
  for (let o = 0; o < t.length; o++) {
1043
1043
  const r = t[o], i = o + 1, c = (r.lat ?? "").toFixed ? r.lat.toFixed(e).padEnd(e + 2, "0") : r.lat, a = (r.lng ?? "").toFixed ? r.lng.toFixed(e).padEnd(e + 2, "0") : r.lng, l = [`id="${i}"`, 'revision="0"'];
1044
- if (r.name && l.push(`name="${v.xmlEscape(r.name)}"`), s.push(` <waypoint ${l.join(" ")}>`), s.push(` <position lat="${v.xmlEscape(c)}" lon="${v.xmlEscape(a)}" />`), o > 0) {
1044
+ if (r.name && l.push(`name="${b.xmlEscape(r.name)}"`), s.push(` <waypoint ${l.join(" ")}>`), s.push(` <position lat="${b.xmlEscape(c)}" lon="${b.xmlEscape(a)}" />`), o > 0) {
1045
1045
  const u = r.gcToPrevious ? "Orthodrome" : "Loxodrome";
1046
1046
  s.push(` <leg geometryType="${u}" />`);
1047
1047
  }
1048
1048
  if (n) {
1049
1049
  const u = [];
1050
- if (r.description && u.push(` <description>${v.xmlEscape(r.description)}</description>`), r.utc)
1051
- u.push(` <time>${v.xmlEscape(r.utc)}</time>`);
1050
+ if (r.description && u.push(` <description>${b.xmlEscape(r.description)}</description>`), r.utc)
1051
+ u.push(` <time>${b.xmlEscape(r.utc)}</time>`);
1052
1052
  else if (r.positionTime)
1053
1053
  try {
1054
- u.push(` <time>${v.xmlEscape(b.unix(r.positionTime).utc().format())}</time>`);
1054
+ u.push(` <time>${b.xmlEscape(x.unix(r.positionTime).utc().format())}</time>`);
1055
1055
  } catch {
1056
1056
  }
1057
- r.cog !== void 0 && u.push(` <cog>${v.xmlEscape(r.cog)}</cog>`), r.sog !== void 0 && u.push(` <sog>${v.xmlEscape(r.sog)}</sog>`), u.length && (s.push(" <extensions>"), s.push(...u), s.push(" </extensions>"));
1057
+ r.cog !== void 0 && u.push(` <cog>${b.xmlEscape(r.cog)}</cog>`), r.sog !== void 0 && u.push(` <sog>${b.xmlEscape(r.sog)}</sog>`), u.length && (s.push(" <extensions>"), s.push(...u), s.push(" </extensions>"));
1058
1058
  }
1059
1059
  s.push(" </waypoint>");
1060
1060
  }
@@ -1068,14 +1068,14 @@ class v {
1068
1068
  * @param options.precision 经纬度小数位数,默认6
1069
1069
  */
1070
1070
  static waypoints2CSV(t, e, n) {
1071
- X.debug("keep name for waypoints2CSV for legacy compatibility only", t);
1072
- const s = (n == null ? void 0 : n.precision) ?? 6, o = e.some((g) => g.name), r = e.some((g) => g.description), i = e.some((g) => g.port != null), c = e.some((g) => g.stbd != null), a = e.some((g) => g.arrRad != null), l = e.some((g) => g.speed != null), u = e.some((g, y) => y > 0 && g.gcToPrevious != null), m = e.some((g) => g.bearing != null), h = e.some((g) => g.distanceFromPrevious != null), p = ["WPT No.", "Latitude", "Longitude"];
1073
- o && p.push("Name"), r && p.push("Description"), u && p.push("Leg"), m && p.push("Bearing[deg]"), h && p.push("Distance[NM]"), l && p.push("Speed[kn]"), i && p.push("PORT XTD[NM]"), c && p.push("STBD XTD[NM]"), a && p.push("Arr.Rad[NM]");
1071
+ Z.debug("keep name for waypoints2CSV for legacy compatibility only", t);
1072
+ const s = (n == null ? void 0 : n.precision) ?? 6, o = e.some((m) => m.name), r = e.some((m) => m.description), i = e.some((m) => m.port != null), c = e.some((m) => m.stbd != null), a = e.some((m) => m.arrRad != null), l = e.some((m) => m.speed != null), u = e.some((m, S) => S > 0 && m.gcToPrevious != null), g = e.some((m) => m.bearing != null), d = e.some((m) => m.distanceFromPrevious != null), p = ["WPT No.", "Latitude", "Longitude"];
1073
+ o && p.push("Name"), r && p.push("Description"), u && p.push("Leg"), g && p.push("Bearing[deg]"), d && p.push("Distance[NM]"), l && p.push("Speed[kn]"), i && p.push("PORT XTD[NM]"), c && p.push("STBD XTD[NM]"), a && p.push("Arr.Rad[NM]");
1074
1074
  const f = [];
1075
- f.push(p.map((g) => v.csvEscapeField(g)).join(","));
1076
- for (let g = 0; g < e.length; g++) {
1077
- const y = e[g], x = [];
1078
- x.push((g + 1).toString()), x.push(y.lat.toFixed(s)), x.push(y.lng.toFixed(s)), o && x.push(y.name ?? ""), r && x.push(y.description ?? ""), u && x.push(g === 0 ? "" : y.gcToPrevious ? "GC" : "RL"), m && x.push(y.bearing != null ? String(y.bearing) : ""), h && x.push(y.distanceFromPrevious != null ? String(y.distanceFromPrevious) : ""), l && x.push(y.speed != null ? String(y.speed) : ""), i && x.push(y.port != null ? String(y.port) : ""), c && x.push(y.stbd != null ? String(y.stbd) : ""), a && x.push(y.arrRad != null ? String(y.arrRad) : ""), f.push(x.map((P) => v.csvEscapeField(P)).join(","));
1075
+ f.push(p.map((m) => b.csvEscapeField(m)).join(","));
1076
+ for (let m = 0; m < e.length; m++) {
1077
+ const S = e[m], v = [];
1078
+ v.push((m + 1).toString()), v.push(S.lat.toFixed(s)), v.push(S.lng.toFixed(s)), o && v.push(S.name ?? ""), r && v.push(S.description ?? ""), u && v.push(m === 0 ? "" : S.gcToPrevious ? "GC" : "RL"), g && v.push(S.bearing != null ? String(S.bearing) : ""), d && v.push(S.distanceFromPrevious != null ? String(S.distanceFromPrevious) : ""), l && v.push(S.speed != null ? String(S.speed) : ""), i && v.push(S.port != null ? String(S.port) : ""), c && v.push(S.stbd != null ? String(S.stbd) : ""), a && v.push(S.arrRad != null ? String(S.arrRad) : ""), f.push(v.map((P) => b.csvEscapeField(P)).join(","));
1079
1079
  }
1080
1080
  return f.join(`
1081
1081
  `);
@@ -1088,13 +1088,13 @@ class v {
1088
1088
  * @param options.precision 经纬度分钟小数位数,默认3
1089
1089
  */
1090
1090
  static waypoints2JRCCSV(t, e, n) {
1091
- const s = (n == null ? void 0 : n.precision) ?? 3, o = e.some((f) => f.name), r = e.some((f) => f.port != null), i = e.some((f) => f.stbd != null), c = e.some((f) => f.arrRad != null), a = e.some((f) => f.speed != null), l = e.some((f, g) => g > 0 && f.gcToPrevious != null), u = e.some((f) => f.rot != null), m = e.some((f) => f.turnRad != null), h = ["// WPT No.", "LAT", "", "", "LON", "", ""];
1092
- r && h.push("PORT[NM]"), i && h.push("STBD[NM]"), c && h.push("Arr. Rad[NM]"), a && h.push("Speed[kn]"), l && h.push("Sail(RL/GC)"), u && h.push("ROT[deg/min]"), m && h.push("Turn Rad[NM]"), o && h.push("Name");
1091
+ const s = (n == null ? void 0 : n.precision) ?? 3, o = e.some((f) => f.name), r = e.some((f) => f.port != null), i = e.some((f) => f.stbd != null), c = e.some((f) => f.arrRad != null), a = e.some((f) => f.speed != null), l = e.some((f, m) => m > 0 && f.gcToPrevious != null), u = e.some((f) => f.rot != null), g = e.some((f) => f.turnRad != null), d = ["// WPT No.", "LAT", "", "", "LON", "", ""];
1092
+ r && d.push("PORT[NM]"), i && d.push("STBD[NM]"), c && d.push("Arr. Rad[NM]"), a && d.push("Speed[kn]"), l && d.push("Sail(RL/GC)"), u && d.push("ROT[deg/min]"), g && d.push("Turn Rad[NM]"), o && d.push("Name");
1093
1093
  const p = [];
1094
- p.push("// ROUTE SHEET exported by JRC ECDIS."), p.push("// <<NOTE>>This strings // indicate comment column/cells. You can edit freely."), p.push(`// ${v.xmlEscape(t)}`), p.push(h.join(","));
1094
+ p.push("// ROUTE SHEET exported by JRC ECDIS."), p.push("// <<NOTE>>This strings // indicate comment column/cells. You can edit freely."), p.push(`// ${b.xmlEscape(t)}`), p.push(d.join(","));
1095
1095
  for (let f = 0; f < e.length; f++) {
1096
- const g = e[f], y = String(f).padStart(3, "0"), x = d.lat2pretty(g.lat, 6), P = d.lng2pretty(g.lng, 6), S = x.degree, M = Number(x.minute).toFixed(s), k = x.direction, U = P.degree, E = Number(P.minute).toFixed(s), B = P.direction, $ = [y, String(S), M, k, String(U), E, B];
1097
- r && $.push(f === 0 ? "***" : g.port != null ? String(g.port) : "***"), i && $.push(f === 0 ? "***" : g.stbd != null ? String(g.stbd) : "***"), c && $.push(f === 0 ? "***" : g.arrRad != null ? String(g.arrRad) : "***"), a && $.push(f === 0 ? "***" : g.speed != null ? Number(g.speed).toFixed(1).padStart(5, "0") : "***"), l && $.push(f === 0 ? "***" : g.gcToPrevious ? "GC" : "RL"), u && $.push(f === 0 ? "***" : g.rot != null ? String(g.rot) : "***"), m && $.push(f === 0 ? "***" : g.turnRad != null ? String(g.turnRad) : "***"), o && $.push(g.name ?? ""), p.push($.join(","));
1096
+ const m = e[f], S = String(f).padStart(3, "0"), v = h.lat2pretty(m.lat, 6), P = h.lng2pretty(m.lng, 6), y = v.degree, N = Number(v.minute).toFixed(s), $ = v.direction, E = P.degree, F = Number(P.minute).toFixed(s), R = P.direction, D = [S, String(y), N, $, String(E), F, R];
1097
+ r && D.push(f === 0 ? "***" : m.port != null ? String(m.port) : "***"), i && D.push(f === 0 ? "***" : m.stbd != null ? String(m.stbd) : "***"), c && D.push(f === 0 ? "***" : m.arrRad != null ? String(m.arrRad) : "***"), a && D.push(f === 0 ? "***" : m.speed != null ? Number(m.speed).toFixed(1).padStart(5, "0") : "***"), l && D.push(f === 0 ? "***" : m.gcToPrevious ? "GC" : "RL"), u && D.push(f === 0 ? "***" : m.rot != null ? String(m.rot) : "***"), g && D.push(f === 0 ? "***" : m.turnRad != null ? String(m.turnRad) : "***"), o && D.push(m.name ?? ""), p.push(D.join(","));
1098
1098
  }
1099
1099
  return p.join(`
1100
1100
  `);
@@ -1111,26 +1111,26 @@ class v {
1111
1111
  * @returns Uint8Array 二进制数据,可直接用于 new Blob([result], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
1112
1112
  */
1113
1113
  static waypoints2XLSX(t, e, n) {
1114
- const s = (n == null ? void 0 : n.precision) ?? 6, o = t || "Route", r = e.some((N) => N.name), i = e.some((N) => N.description), c = e.some((N) => N.port != null), a = e.some((N) => N.stbd != null), l = e.some((N) => N.arrRad != null), u = e.some((N) => N.speed != null), m = e.some((N, O) => O > 0 && N.gcToPrevious != null), h = e.some((N) => N.bearing != null), p = e.some((N) => N.distanceFromPrevious != null), f = ["WPT No.", "Latitude", "Longitude"];
1115
- r && f.push("Name"), i && f.push("Description"), m && f.push("Leg"), h && f.push("Bearing[deg]"), p && f.push("Distance[NM]"), u && f.push("Speed[kn]"), c && f.push("PORT XTD[NM]"), a && f.push("STBD XTD[NM]"), l && f.push("Arr.Rad[NM]");
1116
- const g = (N) => N == null ? "" : String(N).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1117
- let x = `<row r="1">${f.map((N, O) => `<c r="${G(O)}1" s="1" t="inlineStr"><is><t>${g(N)}</t></is></c>`).join("")}</row>`;
1118
- for (let N = 0; N < e.length; N++) {
1119
- const O = e[N], W = N + 2, j = [], Z = (q, L) => j.push(`<c r="${G(q)}${W}"><v>${L}</v></c>`), w = (q, L) => j.push(`<c r="${G(q)}${W}" t="inlineStr"><is><t>${g(L)}</t></is></c>`), A = (q, L) => {
1120
- L != null ? Z(q, L) : w(q, "");
1114
+ const s = (n == null ? void 0 : n.precision) ?? 6, o = t || "Route", r = e.some((M) => M.name), i = e.some((M) => M.description), c = e.some((M) => M.port != null), a = e.some((M) => M.stbd != null), l = e.some((M) => M.arrRad != null), u = e.some((M) => M.speed != null), g = e.some((M, A) => A > 0 && M.gcToPrevious != null), d = e.some((M) => M.bearing != null), p = e.some((M) => M.distanceFromPrevious != null), f = ["WPT No.", "Latitude", "Longitude"];
1115
+ r && f.push("Name"), i && f.push("Description"), g && f.push("Leg"), d && f.push("Bearing[deg]"), p && f.push("Distance[NM]"), u && f.push("Speed[kn]"), c && f.push("PORT XTD[NM]"), a && f.push("STBD XTD[NM]"), l && f.push("Arr.Rad[NM]");
1116
+ const m = (M) => M == null ? "" : String(M).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1117
+ let v = `<row r="1">${f.map((M, A) => `<c r="${G(A)}1" s="1" t="inlineStr"><is><t>${m(M)}</t></is></c>`).join("")}</row>`;
1118
+ for (let M = 0; M < e.length; M++) {
1119
+ const A = e[M], j = M + 2, U = [], X = (L, q) => U.push(`<c r="${G(L)}${j}"><v>${q}</v></c>`), B = (L, q) => U.push(`<c r="${G(L)}${j}" t="inlineStr"><is><t>${m(q)}</t></is></c>`), w = (L, q) => {
1120
+ q != null ? X(L, q) : B(L, "");
1121
1121
  };
1122
- Z(0, N + 1), w(1, d.lat2pretty(O.lat, s).pretty), w(2, d.lng2pretty(O.lng, s).pretty);
1123
- let D = 3;
1124
- r && (w(D, O.name ?? ""), D++), i && (w(D, O.description ?? ""), D++), m && (w(D, N === 0 ? "" : O.gcToPrevious ? "GC" : "RL"), D++), h && (A(D, O.bearing), D++), p && (A(D, O.distanceFromPrevious), D++), u && (A(D, O.speed), D++), c && (A(D, O.port), D++), a && (A(D, O.stbd), D++), l && (A(D, O.arrRad), D++), x += `<row r="${W}">${j.join("")}</row>`;
1122
+ X(0, M + 1), B(1, h.lat2pretty(A.lat, s).pretty), B(2, h.lng2pretty(A.lng, s).pretty);
1123
+ let I = 3;
1124
+ r && (B(I, A.name ?? ""), I++), i && (B(I, A.description ?? ""), I++), g && (B(I, M === 0 ? "" : A.gcToPrevious ? "GC" : "RL"), I++), d && (w(I, A.bearing), I++), p && (w(I, A.distanceFromPrevious), I++), u && (w(I, A.speed), I++), c && (w(I, A.port), I++), a && (w(I, A.stbd), I++), l && (w(I, A.arrRad), I++), v += `<row r="${j}">${U.join("")}</row>`;
1125
1125
  }
1126
- const P = "0." + "0".repeat(s), S = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>' + x + "</sheetData></worksheet>", M = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>', k = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>', U = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="' + g(o) + '" sheetId="1" r:id="rId1"/></sheets></workbook>', E = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>', B = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><numFmts count="1"><numFmt numFmtId="164" formatCode="' + P + '"/></numFmts><fonts count="2"><font><sz val="11"/><name val="Arial"/></font><font><b/><sz val="11"/><name val="Arial"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="2"><border><left/><right/><top/><bottom/><diagonal/></border><border><bottom style="thin"><color auto="1"/></bottom></border></borders><cellStyleXfs count="1"><xf/></cellStyleXfs><cellXfs count="3"><xf/><xf fontId="1" fillId="0" borderId="1" applyFont="1" applyBorder="1"/><xf numFmtId="164" fontId="0" applyNumberFormat="1"/></cellXfs></styleSheet>', $ = new TextEncoder();
1126
+ const P = "0." + "0".repeat(s), y = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>' + v + "</sheetData></worksheet>", N = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>', $ = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>', E = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="' + m(o) + '" sheetId="1" r:id="rId1"/></sheets></workbook>', F = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>', R = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><numFmts count="1"><numFmt numFmtId="164" formatCode="' + P + '"/></numFmts><fonts count="2"><font><sz val="11"/><name val="Arial"/></font><font><b/><sz val="11"/><name val="Arial"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="2"><border><left/><right/><top/><bottom/><diagonal/></border><border><bottom style="thin"><color auto="1"/></bottom></border></borders><cellStyleXfs count="1"><xf/></cellStyleXfs><cellXfs count="3"><xf/><xf fontId="1" fillId="0" borderId="1" applyFont="1" applyBorder="1"/><xf numFmtId="164" fontId="0" applyNumberFormat="1"/></cellXfs></styleSheet>', D = new TextEncoder();
1127
1127
  return _([
1128
- { name: "[Content_Types].xml", data: $.encode(M) },
1129
- { name: "_rels/.rels", data: $.encode(k) },
1130
- { name: "xl/workbook.xml", data: $.encode(U) },
1131
- { name: "xl/_rels/workbook.xml.rels", data: $.encode(E) },
1132
- { name: "xl/worksheets/sheet1.xml", data: $.encode(S) },
1133
- { name: "xl/styles.xml", data: $.encode(B) }
1128
+ { name: "[Content_Types].xml", data: D.encode(N) },
1129
+ { name: "_rels/.rels", data: D.encode($) },
1130
+ { name: "xl/workbook.xml", data: D.encode(E) },
1131
+ { name: "xl/_rels/workbook.xml.rels", data: D.encode(F) },
1132
+ { name: "xl/worksheets/sheet1.xml", data: D.encode(y) },
1133
+ { name: "xl/styles.xml", data: D.encode(R) }
1134
1134
  ]);
1135
1135
  }
1136
1136
  /**
@@ -1170,7 +1170,7 @@ class v {
1170
1170
  static waypoints2NMEA(t) {
1171
1171
  const e = [];
1172
1172
  for (let n = 0; n < t.length; n++) {
1173
- const s = t[n], o = v.decimalToNmeaDm(s.lat, !0), r = v.decimalToNmeaDm(s.lng, !1), i = s.name ? String(s.name).slice(0, 6) : `WPT${(n + 1).toString().padStart(3, "0")}`, c = `GPWPL,${o.dm},${o.dir},${r.dm},${r.dir},${i}`, a = v.nmeaChecksum(c);
1173
+ const s = t[n], o = b.decimalToNmeaDm(s.lat, !0), r = b.decimalToNmeaDm(s.lng, !1), i = s.name ? String(s.name).slice(0, 6) : `WPT${(n + 1).toString().padStart(3, "0")}`, c = `GPWPL,${o.dm},${o.dir},${r.dm},${r.dir},${i}`, a = b.nmeaChecksum(c);
1174
1174
  e.push(`$${c}*${a}`);
1175
1175
  }
1176
1176
  return e.join(`\r
@@ -1190,18 +1190,18 @@ class v {
1190
1190
  */
1191
1191
  static coordinatesSummary(t, e = 3) {
1192
1192
  if (t.length > 1) {
1193
- const n = t[0], s = t[t.length - 1], o = (n == null ? void 0 : n.positionTime) < (s == null ? void 0 : s.positionTime) ? b.unix(n == null ? void 0 : n.positionTime) : b.unix(s == null ? void 0 : s.positionTime), r = (n == null ? void 0 : n.positionTime) > (s == null ? void 0 : s.positionTime) ? b.unix(n == null ? void 0 : n.positionTime) : b.unix(s == null ? void 0 : s.positionTime), i = Math.round(r.diff(o, "hours", !0) * 100) / 100, c = this.generateRouteAccordingToWaypoints(t, !0, !0), a = this.calculateRouteDistance(c), u = K.inspectStoppages(t, e).reduce(
1194
- (h, p) => (h.duration += p.duration, h.distance += p.distance, h),
1193
+ const n = t[0], s = t[t.length - 1], o = (n == null ? void 0 : n.positionTime) < (s == null ? void 0 : s.positionTime) ? x.unix(n == null ? void 0 : n.positionTime) : x.unix(s == null ? void 0 : s.positionTime), r = (n == null ? void 0 : n.positionTime) > (s == null ? void 0 : s.positionTime) ? x.unix(n == null ? void 0 : n.positionTime) : x.unix(s == null ? void 0 : s.positionTime), i = Math.round(r.diff(o, "hours", !0) * 100) / 100, c = this.generateRouteAccordingToWaypoints(t, !0, !0), a = this.calculateRouteDistance(c), u = K.inspectStoppages(t, e).reduce(
1194
+ (d, p) => (d.duration += p.duration, d.distance += p.distance, d),
1195
1195
  { hours: 0, distance: 0, spd: 0, duration: 0 }
1196
1196
  );
1197
1197
  u.hours = Math.round(u.duration / 3600 * 100) / 100, u.distance = Math.round(u.distance * 100) / 100, u.spd = u.hours ? Math.round(u.distance / u.hours * 100) / 100 : 0;
1198
- const m = i ? Math.round((a - u.distance) / (i - u.hours) * 100) / 100 : 0;
1198
+ const g = i ? Math.round((a - u.distance) / (i - u.hours) * 100) / 100 : 0;
1199
1199
  return {
1200
1200
  begin: o.utc().format(),
1201
1201
  end: r.utc().format(),
1202
1202
  distance: Math.round((a - u.distance) * 100) / 100,
1203
1203
  hours: Math.round((i - u.hours) * 100) / 100,
1204
- avgSpeed: m,
1204
+ avgSpeed: g,
1205
1205
  stoppage: u
1206
1206
  };
1207
1207
  }
@@ -1223,24 +1223,24 @@ class v {
1223
1223
  * }
1224
1224
  */
1225
1225
  static pickUTCSampleFromSpeed(t, e) {
1226
- var l, u, m;
1226
+ var l, u, g;
1227
1227
  if (!((u = (l = e == null ? void 0 : e.sample) == null ? void 0 : l.hours) != null && u.length))
1228
1228
  return { routes: [], hour: void 0 };
1229
- const n = e.sample.hours.at(0), s = b.utc(t), o = b.utc(e.eta), r = s.isAfter(o) ? o : s;
1230
- let i = e.sample.all.find((h) => h.eta === r.format());
1229
+ const n = e.sample.hours.at(0), s = x.utc(t), o = x.utc(e.eta), r = s.isAfter(o) ? o : s;
1230
+ let i = e.sample.all.find((d) => d.eta === r.format());
1231
1231
  if (!i) {
1232
- const h = e.sample.all.filter((M) => b.utc(M.eta).isBefore(r)).at(-1), p = this.calculateSubRoute(h, e.route);
1233
- i = (m = this.calculateNextCoordinateAlongRoute(h, h.speed * r.diff(b(h.etd), "hours", !0), p)) == null ? void 0 : m.coordinate;
1234
- const { cFactor: f, cog: g, wxFactor: y, meteo: x } = h, P = Math.round(i.distanceFromPrevious * 1e4) / 1e4, S = Math.round((P + h.distanceFromStart) * 1e4) / 1e4;
1232
+ const d = e.sample.all.filter((N) => x.utc(N.eta).isBefore(r)).at(-1), p = this.calculateSubRoute(d, e.route);
1233
+ i = (g = this.calculateNextCoordinateAlongRoute(d, d.speed * r.diff(x(d.etd), "hours", !0), p)) == null ? void 0 : g.coordinate;
1234
+ const { cFactor: f, cog: m, wxFactor: S, meteo: v } = d, P = Math.round(i.distanceFromPrevious * 1e4) / 1e4, y = Math.round((P + d.distanceFromStart) * 1e4) / 1e4;
1235
1235
  i = {
1236
1236
  ...i,
1237
1237
  cFactor: f,
1238
- cog: g,
1239
- speed: h.speed,
1240
- wxFactor: y,
1241
- distanceFromStart: S,
1238
+ cog: m,
1239
+ speed: d.speed,
1240
+ wxFactor: S,
1241
+ distanceFromStart: y,
1242
1242
  distanceFromPrevious: P,
1243
- meteo: x,
1243
+ meteo: v,
1244
1244
  eta: r.format(),
1245
1245
  etd: r.format()
1246
1246
  };
@@ -1263,11 +1263,11 @@ class v {
1263
1263
  * }
1264
1264
  */
1265
1265
  static pickUTCSampleFromRoute(t, e, n) {
1266
- var h;
1267
- const s = this.calculateSubRoute(e, n), o = this.calculateRouteDistance(s), r = o / e.speed, i = b.utc(t), c = b(e.etd), a = (h = this.calculateNextCoordinateAlongRoute(e, e.speed * i.diff(b(e.etd), "hours", !0), s)) == null ? void 0 : h.coordinate;
1266
+ var d;
1267
+ const s = this.calculateSubRoute(e, n), o = this.calculateRouteDistance(s), r = o / e.speed, i = x.utc(t), c = x(e.etd), a = (d = this.calculateNextCoordinateAlongRoute(e, e.speed * i.diff(x(e.etd), "hours", !0), s)) == null ? void 0 : d.coordinate;
1268
1268
  a.speed = e.speed;
1269
1269
  const l = c.clone().add(a.hourFromPrevious, "hour");
1270
- a.eta = Math.abs(l.diff(i, "second")) < 2 ? i.format() : l.format(), a.etd = a.eta, a.distanceFromStart = Math.round(a.distanceFromPrevious * 100) / 100, a.distanceToGo = Math.round((o - a.distanceFromStart) * 100) / 100, a.timeToGo = Math.round(c.clone().add(r, "hour").diff(b(a.etd), "hour") * 100) / 100;
1270
+ a.eta = Math.abs(l.diff(i, "second")) < 2 ? i.format() : l.format(), a.etd = a.eta, a.distanceFromStart = Math.round(a.distanceFromPrevious * 100) / 100, a.distanceToGo = Math.round((o - a.distanceFromStart) * 100) / 100, a.timeToGo = Math.round(c.clone().add(r, "hour").diff(x(a.etd), "hour") * 100) / 100;
1271
1271
  const u = this.calculateRangeWaypoints(e, a, n);
1272
1272
  return {
1273
1273
  routes: this.generateRouteAccordingToWaypoints(u),
@@ -1280,14 +1280,86 @@ class v {
1280
1280
  * @param degree 要素角度,如 swell.degree
1281
1281
  */
1282
1282
  static includedAngle(t, e) {
1283
- X == null || X.debug("calculate bearing via: %j", { bearing: t, degree: e });
1283
+ Z == null || Z.debug("calculate bearing via: %j", { bearing: t, degree: e });
1284
1284
  let n = Math.abs(t % 360 - (e % 360 || 0));
1285
1285
  return n = n > 180 ? 360 - n : n, n;
1286
1286
  }
1287
+ /**
1288
+ * 判断路径是否与ECA区域相交
1289
+ * @param path
1290
+ * @param ecaZones
1291
+ * @see https://osshz.idmwx.com/layers/other/eca-zones.json
1292
+ * @return 返回相交的区域
1293
+ * [
1294
+ * {
1295
+ * distance: number,
1296
+ * waypoints: Coordinate[],
1297
+ * name: string
1298
+ * }
1299
+ * ]
1300
+ * 如果没有相交区域,返回空数组。
1301
+ */
1302
+ static async intersectInECA(t, e) {
1303
+ var o, r;
1304
+ const s = (e instanceof Array ? e : e.features).filter((i) => {
1305
+ var c, a;
1306
+ return ((c = i.geometry) == null ? void 0 : c.type) === "Polygon" && !((a = i.properties) != null && a.disabled);
1307
+ });
1308
+ if (t != null && t.length) {
1309
+ let i = t;
1310
+ t.some((u) => u instanceof Array) ? t = this.convertRouteToCoordinates(t) : i = this.divideAccordingToLng(t);
1311
+ const c = i.map((u) => T.lineString(u)), a = [], l = s.map((u) => ({
1312
+ polygon: u,
1313
+ bbox: T.bbox(u)
1314
+ // [minX, minY, maxX, maxY]
1315
+ }));
1316
+ for (const u of c) {
1317
+ const g = u.geometry.coordinates, d = this.convertRouteToCoordinates([g]), p = T.bbox(u);
1318
+ for (const { polygon: f, bbox: m } of l) {
1319
+ if (p[0] > m[2] || p[2] < m[0] || p[1] > m[3] || p[3] < m[1])
1320
+ continue;
1321
+ let S = [];
1322
+ const v = T.lineIntersect(u, f);
1323
+ (o = v == null ? void 0 : v.features) != null && o.length && (S = T.getCoords(v.features).map((N) => {
1324
+ const $ = T.getCoord(N);
1325
+ return { lng: $[0], lat: $[1] };
1326
+ }));
1327
+ const P = [...d];
1328
+ if (S.length > 0)
1329
+ for (const y of S)
1330
+ this.mergeCoordinateToWaypoints(y, P, !0);
1331
+ for (let y = 0; y < P.length - 1; y++) {
1332
+ const N = P[y], $ = P[y + 1], E = this.calculateRangeWaypoints(N, $, [], P), F = this.divideAccordingToLng(E);
1333
+ for (const R of F) {
1334
+ const D = [
1335
+ Math.min(R[0][0], R[R.length - 1][0]),
1336
+ Math.min(R[0][1], R[R.length - 1][1]),
1337
+ Math.max(R[0][0], R[R.length - 1][0]),
1338
+ Math.max(R[0][1], R[R.length - 1][1])
1339
+ ];
1340
+ if (D[0] > m[2] || D[2] < m[0] || D[1] > m[3] || D[3] < m[1])
1341
+ continue;
1342
+ const M = T.lineString(R);
1343
+ if (T.booleanContains(f, M)) {
1344
+ const A = R.map((U) => ({ lng: U[0], lat: U[1] })), j = this.calculateRouteDistance([R]);
1345
+ a.push({
1346
+ distance: j,
1347
+ waypoints: A,
1348
+ eca: (r = f == null ? void 0 : f.properties) == null ? void 0 : r.name
1349
+ });
1350
+ }
1351
+ }
1352
+ }
1353
+ }
1354
+ }
1355
+ return a;
1356
+ }
1357
+ return [];
1358
+ }
1287
1359
  }
1288
- let I;
1360
+ let k;
1289
1361
  try {
1290
- I = z.getLogger("vessel");
1362
+ k = z.getLogger("vessel");
1291
1363
  } catch {
1292
1364
  } finally {
1293
1365
  }
@@ -1305,60 +1377,60 @@ class it {
1305
1377
  i && i.wind && (i.wind.kts = i.kts);
1306
1378
  for (const c of r.forecasts) {
1307
1379
  let a;
1308
- const l = [], u = [], m = b(c.date).utc(), h = `${r.name}-${c.model}`;
1380
+ const l = [], u = [], g = x(c.date).utc(), d = `${r.name}-${c.model}`;
1309
1381
  for (const f in c == null ? void 0 : c.hours) {
1310
- const g = c.hours[f];
1311
- a = a || g;
1312
- const y = m.clone().add(Number(f), "hour"), x = T.point([g.lng, g.lat], {
1382
+ const m = c.hours[f];
1383
+ a = a || m;
1384
+ const S = g.clone().add(Number(f), "hour"), v = T.point([m.lng, m.lat], {
1313
1385
  model: c.model,
1314
1386
  name: r.name,
1315
1387
  nameCn: r.nameCn,
1316
- date: y.format(),
1388
+ date: S.format(),
1317
1389
  hour: Number(f),
1318
- format: y.format("MMM-DD/HHmm[Z]"),
1319
- pressure: g.pressure > 1e4 ? d.roundPrecision(g.pressure / 100, 0) : d.roundPrecision(g.pressure, 0),
1320
- gusts: g.gusts,
1321
- wind: g.wind || {},
1322
- movement: g.movement,
1323
- category: h,
1390
+ format: S.format("MMM-DD/HHmm[Z]"),
1391
+ pressure: m.pressure > 1e4 ? h.roundPrecision(m.pressure / 100, 0) : h.roundPrecision(m.pressure, 0),
1392
+ gusts: m.gusts,
1393
+ wind: m.wind || {},
1394
+ movement: m.movement,
1395
+ category: d,
1324
1396
  type: "forecast"
1325
1397
  });
1326
- u.push(x), l.push(x.geometry.coordinates);
1398
+ u.push(v), l.push(v.geometry.coordinates);
1327
1399
  }
1328
1400
  const p = {
1329
1401
  kts: void 0,
1330
1402
  deg: void 0
1331
1403
  };
1332
1404
  if (i) {
1333
- const f = b(i.updated).utc();
1405
+ const f = x(i.updated).utc();
1334
1406
  if (a) {
1335
- const y = v.calculateDistance(i, a), x = b(a.utc || a.updated).diff(f, "h", !0);
1336
- p.kts = Math.round(y / x * 100) / 100, p.deg = v.calculateBearing(i, a, !0, 0);
1407
+ const S = b.calculateDistance(i, a), v = x(a.utc || a.updated).diff(f, "h", !0);
1408
+ p.kts = Math.round(S / v * 100) / 100, p.deg = b.calculateBearing(i, a, !0, 0);
1337
1409
  }
1338
- const g = T.point([i.lng, i.lat], {
1410
+ const m = T.point([i.lng, i.lat], {
1339
1411
  model: c.model,
1340
1412
  name: r.name,
1341
1413
  nameCn: r.nameCn,
1342
1414
  date: f.format(),
1343
1415
  hour: 0,
1344
1416
  format: f.format("MMM-DD/HHmm[Z]"),
1345
- pressure: i.pressure > 1e4 ? d.roundPrecision((i == null ? void 0 : i.pressure) / 100, 0) : d.roundPrecision(i.pressure, 0),
1417
+ pressure: i.pressure > 1e4 ? h.roundPrecision((i == null ? void 0 : i.pressure) / 100, 0) : h.roundPrecision(i.pressure, 0),
1346
1418
  wind: i.wind,
1347
1419
  movement: p,
1348
- category: h,
1420
+ category: d,
1349
1421
  type: "forecast",
1350
1422
  important: !0
1351
1423
  // 第一个预报点为重要点
1352
1424
  });
1353
- u.unshift(g), l.unshift(g.geometry.coordinates);
1425
+ u.unshift(m), l.unshift(m.geometry.coordinates);
1354
1426
  }
1355
1427
  if (e.features.push(...u), (l == null ? void 0 : l.length) > 1) {
1356
- const f = T.lineString(d.convertToMonotonicLng2(l), {
1357
- date: (i == null ? void 0 : i.updated) || (m == null ? void 0 : m.format()),
1428
+ const f = T.lineString(h.convertToMonotonicLng2(l), {
1429
+ date: (i == null ? void 0 : i.updated) || (g == null ? void 0 : g.format()),
1358
1430
  id: r.id || r.name,
1359
1431
  model: c.model,
1360
1432
  name: r.name,
1361
- category: h,
1433
+ category: d,
1362
1434
  type: "forecast",
1363
1435
  movement: p
1364
1436
  });
@@ -1366,37 +1438,37 @@ class it {
1366
1438
  }
1367
1439
  }
1368
1440
  }
1369
- if (e.features.sort((c, a) => c.properties.type === "forecast" && a.properties.type === "forecast" && c.geometry.type === "Point" && a.geometry.type === "Point" ? b(c.properties.date).valueOf() - b(a.properties.date).valueOf() : 0), (s = r.history) != null && s.length) {
1370
- const c = [], a = b(i == null ? void 0 : i.updated).utc(), l = b((o = r.history) == null ? void 0 : o.at(-1).updated).utc(), u = a.diff(l, "h") % 24 > 2 ? 24 : 12;
1371
- for (const m of r.history) {
1372
- const h = b(m.updated).utc(), p = h.isSameOrBefore(a) || h.isSame(l);
1441
+ if (e.features.sort((c, a) => c.properties.type === "forecast" && a.properties.type === "forecast" && c.geometry.type === "Point" && a.geometry.type === "Point" ? x(c.properties.date).valueOf() - x(a.properties.date).valueOf() : 0), (s = r.history) != null && s.length) {
1442
+ const c = [], a = x(i == null ? void 0 : i.updated).utc(), l = x((o = r.history) == null ? void 0 : o.at(-1).updated).utc(), u = a.diff(l, "h") % 24 > 2 ? 24 : 12;
1443
+ for (const g of r.history) {
1444
+ const d = x(g.updated).utc(), p = d.isSameOrBefore(a) || d.isSame(l);
1373
1445
  p && a.add(-u, "h");
1374
- const f = T.point([m.lng, m.lat], {
1446
+ const f = T.point([g.lng, g.lat], {
1375
1447
  name: r.name,
1376
1448
  nameCn: r.nameCn,
1377
- date: h.format(),
1378
- format: h.format("MMM-DD/HHmm[Z]"),
1379
- pressure: m.pressure > 1e4 ? d.roundPrecision(m.pressure / 100, 0) : d.roundPrecision(m.pressure, 0),
1380
- kts: m.kts,
1381
- level: m.type,
1449
+ date: d.format(),
1450
+ format: d.format("MMM-DD/HHmm[Z]"),
1451
+ pressure: g.pressure > 1e4 ? h.roundPrecision(g.pressure / 100, 0) : h.roundPrecision(g.pressure, 0),
1452
+ kts: g.kts,
1453
+ level: g.type,
1382
1454
  type: "history",
1383
1455
  category: `${r.name}-history`,
1384
- wind: m.wind,
1385
- movement: m.movement,
1456
+ wind: g.wind,
1457
+ movement: g.movement,
1386
1458
  important: p
1387
1459
  });
1388
1460
  e.features.push(f), c.push(f.geometry.coordinates);
1389
1461
  }
1390
1462
  if (c.length === 1 && c.push(c[0]), c.length > 1) {
1391
- const m = T.lineString(d.convertToMonotonicLng2(c), {
1463
+ const g = T.lineString(h.convertToMonotonicLng2(c), {
1392
1464
  name: r.name,
1393
1465
  type: "history",
1394
1466
  updated: i == null ? void 0 : i.updated,
1395
- pressure: (i == null ? void 0 : i.pressure) > 1e4 ? d.roundPrecision((i == null ? void 0 : i.pressure) / 100, 0) : d.roundPrecision(i == null ? void 0 : i.pressure, 0),
1467
+ pressure: (i == null ? void 0 : i.pressure) > 1e4 ? h.roundPrecision((i == null ? void 0 : i.pressure) / 100, 0) : h.roundPrecision(i == null ? void 0 : i.pressure, 0),
1396
1468
  kts: i == null ? void 0 : i.kts,
1397
1469
  level: i == null ? void 0 : i.type
1398
1470
  });
1399
- e.features.push(m);
1471
+ e.features.push(g);
1400
1472
  }
1401
1473
  }
1402
1474
  }
@@ -1411,32 +1483,32 @@ class it {
1411
1483
  var o, r, i, c;
1412
1484
  const n = (o = t == null ? void 0 : t.data) == null ? void 0 : o.features.filter((a) => a.geometry.type === "LineString" && a.properties.type === "forecast"), s = [];
1413
1485
  for (const a of n) {
1414
- const l = a.properties.name, u = a.properties.model, m = a.properties.showCircle, h = a.properties.disabled, p = b(a.properties.date).utc();
1486
+ const l = a.properties.name, u = a.properties.model, g = a.properties.showCircle, d = a.properties.disabled, p = x(a.properties.date).utc();
1415
1487
  let f = e * 60;
1416
- const g = (r = t == null ? void 0 : t.data) == null ? void 0 : r.features.filter(
1488
+ const m = (r = t == null ? void 0 : t.data) == null ? void 0 : r.features.filter(
1417
1489
  (P) => P.geometry.type === "Point" && P.properties.type === "forecast" && P.properties.category === `${l}-${u}`
1418
1490
  );
1419
- let y, x = p.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
1420
- for (; y = this.pickIndex(g, x), y <= g.length - 1; ) {
1421
- if (y > 0) {
1422
- const P = g[y], S = y === 0 ? void 0 : g[y - 1], M = (f / 60 - ((i = S == null ? void 0 : S.properties) == null ? void 0 : i.hour)) / (P.properties.hour - ((c = S == null ? void 0 : S.properties) == null ? void 0 : c.hour)), k = this.computeNumber(S == null ? void 0 : S.geometry.coordinates[0], P.geometry.coordinates[0], M), U = this.computeNumber(S == null ? void 0 : S.geometry.coordinates[1], P.geometry.coordinates[1], M), E = T.point([k, U], {
1491
+ let S, v = p.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
1492
+ for (; S = this.pickIndex(m, v), S <= m.length - 1; ) {
1493
+ if (S > 0) {
1494
+ const P = m[S], y = S === 0 ? void 0 : m[S - 1], N = (f / 60 - ((i = y == null ? void 0 : y.properties) == null ? void 0 : i.hour)) / (P.properties.hour - ((c = y == null ? void 0 : y.properties) == null ? void 0 : c.hour)), $ = this.computeNumber(y == null ? void 0 : y.geometry.coordinates[0], P.geometry.coordinates[0], N), E = this.computeNumber(y == null ? void 0 : y.geometry.coordinates[1], P.geometry.coordinates[1], N), F = T.point([$, E], {
1423
1495
  name: l,
1424
1496
  model: u,
1425
1497
  category: P == null ? void 0 : P.properties.category,
1426
- date: x.format(),
1427
- format: x.format("MMM-DD/HHmm[Z]"),
1428
- gusts: this.computeNumber(S == null ? void 0 : S.properties.gusts, P.properties.gusts, M),
1429
- hour: this.computeNumber(S == null ? void 0 : S.properties.hour, P.properties.hour, M),
1430
- movement: this.computeNumber(S == null ? void 0 : S.properties.movement, P.properties.movement, M),
1431
- pressure: this.computeNumber(S == null ? void 0 : S.properties.pressure, P.properties.pressure, M),
1432
- wind: this.computeNumber(S == null ? void 0 : S.properties.wind, P.properties.wind, M),
1498
+ date: v.format(),
1499
+ format: v.format("MMM-DD/HHmm[Z]"),
1500
+ gusts: this.computeNumber(y == null ? void 0 : y.properties.gusts, P.properties.gusts, N),
1501
+ hour: this.computeNumber(y == null ? void 0 : y.properties.hour, P.properties.hour, N),
1502
+ movement: this.computeNumber(y == null ? void 0 : y.properties.movement, P.properties.movement, N),
1503
+ pressure: this.computeNumber(y == null ? void 0 : y.properties.pressure, P.properties.pressure, N),
1504
+ wind: this.computeNumber(y == null ? void 0 : y.properties.wind, P.properties.wind, N),
1433
1505
  type: "forecast",
1434
- disabled: h,
1435
- showCircle: m
1506
+ disabled: d,
1507
+ showCircle: g
1436
1508
  });
1437
- s.push(E);
1509
+ s.push(F);
1438
1510
  }
1439
- f += e * 60, x = p.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
1511
+ f += e * 60, v = p.clone().add(f, "minute").set({ minute: 0, second: 0, millisecond: 0 });
1440
1512
  }
1441
1513
  }
1442
1514
  return s;
@@ -1466,28 +1538,28 @@ class it {
1466
1538
  const { t1: o, t2: r, hr: i, hours: c } = this.tropicalCenterTwin(e, 24, s);
1467
1539
  if (o && r) {
1468
1540
  if (!s.debug) {
1469
- const p = v.calculateDistance(t, o), f = v.calculateDistance(t, r);
1541
+ const p = b.calculateDistance(t, o), f = b.calculateDistance(t, r);
1470
1542
  if (p > 2 * n && f > 2 * n)
1471
- return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", s.requestId, p, f, {
1543
+ return k == null || k.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", s.requestId, p, f, {
1472
1544
  from: t,
1473
1545
  t1: o,
1474
1546
  t2: r,
1475
1547
  hr: i
1476
1548
  }), {};
1477
1549
  }
1478
- const a = v.calculateBearing(t, o), l = v.calculateBearing(o, r), u = Math.abs(a - l);
1479
- let m = 0;
1480
- u < 180 ? m = u + 90 : u >= 180 && (m = u - 90);
1481
- const h = v.calculateCoordinate(o, m, n);
1482
- return I == null || I.info("[%s] the right tangent position: %j", s.requestId, {
1550
+ const a = b.calculateBearing(t, o), l = b.calculateBearing(o, r), u = Math.abs(a - l);
1551
+ let g = 0;
1552
+ u < 180 ? g = u + 90 : u >= 180 && (g = u - 90);
1553
+ const d = b.calculateCoordinate(o, g, n);
1554
+ return k == null || k.info("[%s] the right tangent position: %j", s.requestId, {
1483
1555
  from: t,
1484
1556
  t1: o,
1485
1557
  t2: r,
1486
1558
  radius: n,
1487
1559
  bearing1: a,
1488
1560
  bearing2: l,
1489
- right: h
1490
- }), { at: h, t1: o, t2: r, hr: Number(i), hours: c };
1561
+ right: d
1562
+ }), { at: d, t1: o, t2: r, hr: Number(i), hours: c };
1491
1563
  }
1492
1564
  return {};
1493
1565
  }
@@ -1505,19 +1577,19 @@ class it {
1505
1577
  const { t1: o, t2: r, hr: i, hours: c } = this.tropicalCenterTwin(e, 24, s);
1506
1578
  if (o && r) {
1507
1579
  if (!s.debug) {
1508
- const h = v.calculateDistance(t, o), p = v.calculateDistance(t, r);
1509
- if (h > 2 * n && p > 2 * n)
1510
- return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", s.requestId, h, p, {
1580
+ const d = b.calculateDistance(t, o), p = b.calculateDistance(t, r);
1581
+ if (d > 2 * n && p > 2 * n)
1582
+ return k == null || k.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", s.requestId, d, p, {
1511
1583
  from: t,
1512
1584
  t1: o,
1513
1585
  t2: r,
1514
1586
  hr: i
1515
1587
  }), {};
1516
1588
  }
1517
- const a = v.calculateBearing(t, o), l = v.calculateBearing(o, r), u = v.calculateDistance(t, o);
1518
- return { at: v.calculateCoordinate(o, a - l + 180, n < u ? n : u), t1: o, t2: r, hr: Number(i), hours: c };
1589
+ const a = b.calculateBearing(t, o), l = b.calculateBearing(o, r), u = b.calculateDistance(t, o);
1590
+ return { at: b.calculateCoordinate(o, a - l + 180, n < u ? n : u), t1: o, t2: r, hr: Number(i), hours: c };
1519
1591
  } else
1520
- return I == null || I.info("[%s] no need drift: %j", s.requestId, { from: t, t1: o, t2: r, hr: i }), {};
1592
+ return k == null || k.info("[%s] no need drift: %j", s.requestId, { from: t, t1: o, t2: r, hr: i }), {};
1521
1593
  }
1522
1594
  /**
1523
1595
  * 获取台风中心点对
@@ -1528,17 +1600,17 @@ class it {
1528
1600
  * @private
1529
1601
  */
1530
1602
  static tropicalCenterTwin(t, e = 24, n = {}) {
1531
- var l, u, m, h, p;
1603
+ var l, u, g, d, p;
1532
1604
  let s = {};
1533
1605
  (l = t.forecasts) == null || l.forEach((f) => {
1534
1606
  s = { ...f.hours, ...s };
1535
1607
  });
1536
- const o = ((u = t == null ? void 0 : t.history) == null ? void 0 : u[0]) || (s == null ? void 0 : s[(m = Object.keys(s)) == null ? void 0 : m[0]]);
1537
- I == null || I.info("[%s] the first tropical center: %j", n.requestId, o);
1538
- let r = (h = Object.keys(s || {}).filter((f) => Number(f) <= (e < 0 ? 24 : e))) == null ? void 0 : h.at(-1);
1608
+ const o = ((u = t == null ? void 0 : t.history) == null ? void 0 : u[0]) || (s == null ? void 0 : s[(g = Object.keys(s)) == null ? void 0 : g[0]]);
1609
+ k == null || k.info("[%s] the first tropical center: %j", n.requestId, o);
1610
+ let r = (d = Object.keys(s || {}).filter((f) => Number(f) <= (e < 0 ? 24 : e))) == null ? void 0 : d.at(-1);
1539
1611
  r || (r = (p = Object.keys(s || {}).filter((f) => Number(f) <= (e < 0 ? 24 : 2 * e))) == null ? void 0 : p.at(-1));
1540
1612
  const i = s == null ? void 0 : s[r || -1];
1541
- I == null || I.info("[%s] the second tropical center: %j in %d hrs", n.requestId, i, r);
1613
+ k == null || k.info("[%s] the second tropical center: %j in %d hrs", n.requestId, i, r);
1542
1614
  const c = Object.keys(s || {}).filter((f) => Number(f) <= Number(r)), a = { 0: o };
1543
1615
  for (const f of c)
1544
1616
  a[f] = s[f];
@@ -1547,7 +1619,7 @@ class it {
1547
1619
  static pickIndex(t, e) {
1548
1620
  let n = 0;
1549
1621
  for (const s of t) {
1550
- if (b(s.properties.date).isAfter(e))
1622
+ if (x(s.properties.date).isAfter(e))
1551
1623
  return n === 0 ? -1 : n;
1552
1624
  n++;
1553
1625
  }
@@ -1583,9 +1655,9 @@ typeof globalThis < "u" && typeof globalThis.Buffer > "u" && (globalThis.Buffer
1583
1655
  throw new TypeError("Buffer.from: unsupported source type");
1584
1656
  }
1585
1657
  });
1586
- let R;
1658
+ let O;
1587
1659
  try {
1588
- R = z.getLogger("meteo");
1660
+ O = z.getLogger("meteo");
1589
1661
  } catch {
1590
1662
  } finally {
1591
1663
  }
@@ -1595,7 +1667,7 @@ function H() {
1595
1667
  const { JSDOM: C } = require("jsdom"), { DOMParser: t } = new C("").window;
1596
1668
  return new t();
1597
1669
  }
1598
- class F {
1670
+ class W {
1599
1671
  /**
1600
1672
  * Buffer to ArrayBuffer
1601
1673
  * 将 Node.js Buffer 转换为独立的 ArrayBuffer(byteOffset=0)。
@@ -1614,10 +1686,10 @@ class F {
1614
1686
  * @param options 步数、单位等选项
1615
1687
  */
1616
1688
  static drawCircle(t, e, n, s = {}) {
1617
- const o = (s == null ? void 0 : s.steps) ?? 64, r = (s == null ? void 0 : s.units) ?? "nauticalmiles", i = (s == null ? void 0 : s.properties) ?? {}, c = T.point([t, e]), a = T.destination(c, n, 90, { units: r }), l = b.utc();
1689
+ const o = (s == null ? void 0 : s.steps) ?? 64, r = (s == null ? void 0 : s.units) ?? "nauticalmiles", i = (s == null ? void 0 : s.properties) ?? {}, c = T.point([t, e]), a = T.destination(c, n, 90, { units: r }), l = x.utc();
1618
1690
  i.id = (s == null ? void 0 : s.id) || l.valueOf().toString();
1619
1691
  const u = "circle";
1620
- return i.name = (s == null ? void 0 : s.name) || `${u}_${l.format()}`, i.radius = n, i.center = [t, e], i.end = a.geometry.coordinates.map((m) => d.roundPrecision(m, 9)), i.units = r, i.steps = o, i.shape = "circle", R.info("[%s] draw circle with %j", s == null ? void 0 : s.requestId, i), T.circle(c, n, { steps: o, units: r, properties: i });
1692
+ return i.name = (s == null ? void 0 : s.name) || `${u}_${l.format()}`, i.radius = n, i.center = [t, e], i.end = a.geometry.coordinates.map((g) => h.roundPrecision(g, 9)), i.units = r, i.steps = o, i.shape = "circle", O.info("[%s] draw circle with %j", s == null ? void 0 : s.requestId, i), T.circle(c, n, { steps: o, units: r, properties: i });
1621
1693
  }
1622
1694
  /**
1623
1695
  * 基于turf画矩形,返回GeoJSON Feature<Polygon>
@@ -1626,11 +1698,11 @@ class F {
1626
1698
  * @param options 选项
1627
1699
  */
1628
1700
  static drawRect(t, e, n = {}) {
1629
- const s = (n == null ? void 0 : n.properties) ?? {}, o = b.utc();
1701
+ const s = (n == null ? void 0 : n.properties) ?? {}, o = x.utc();
1630
1702
  s.id = (n == null ? void 0 : n.id) || o.valueOf().toString();
1631
1703
  const r = "rect";
1632
- s.name = (n == null ? void 0 : n.name) || `${r}_${o.format()}`, s.start = t.map((l) => d.roundPrecision(l, 9)), s.end = e.map((l) => d.roundPrecision(l, 9)), s.shape = "rect", R.info("[%s] draw rect with %j", n == null ? void 0 : n.requestId, s);
1633
- const [i, c] = d.convertToMonotonicLng2([t, e]), a = [Math.min(i[0], c[0]), Math.min(i[1], c[1]), Math.max(i[0], c[0]), Math.max(i[1], c[1])];
1704
+ s.name = (n == null ? void 0 : n.name) || `${r}_${o.format()}`, s.start = t.map((l) => h.roundPrecision(l, 9)), s.end = e.map((l) => h.roundPrecision(l, 9)), s.shape = "rect", O.info("[%s] draw rect with %j", n == null ? void 0 : n.requestId, s);
1705
+ const [i, c] = h.convertToMonotonicLng2([t, e]), a = [Math.min(i[0], c[0]), Math.min(i[1], c[1]), Math.max(i[0], c[0]), Math.max(i[1], c[1])];
1634
1706
  return T.bboxPolygon(a, { properties: s });
1635
1707
  }
1636
1708
  /**
@@ -1641,11 +1713,11 @@ class F {
1641
1713
  * @returns
1642
1714
  */
1643
1715
  static drawLine(t, e = {}) {
1644
- const n = (e == null ? void 0 : e.properties) ?? {}, s = b.utc();
1716
+ const n = (e == null ? void 0 : e.properties) ?? {}, s = x.utc();
1645
1717
  n.id = (e == null ? void 0 : e.id) || s.valueOf().toString();
1646
1718
  const o = "line";
1647
- n.name = (e == null ? void 0 : e.name) || `${o}_${s.format()}`, n.shape = "line", R.info("[%s] draw line with %j", e == null ? void 0 : e.requestId, n);
1648
- const r = d.convertToMonotonicLng2(t);
1719
+ n.name = (e == null ? void 0 : e.name) || `${o}_${s.format()}`, n.shape = "line", O.info("[%s] draw line with %j", e == null ? void 0 : e.requestId, n);
1720
+ const r = h.convertToMonotonicLng2(t);
1649
1721
  return T.lineString(r, n);
1650
1722
  }
1651
1723
  /**
@@ -1655,11 +1727,11 @@ class F {
1655
1727
  * @returns
1656
1728
  */
1657
1729
  static drawPolygon(t, e = {}) {
1658
- const n = (e == null ? void 0 : e.properties) ?? {}, s = b.utc();
1730
+ const n = (e == null ? void 0 : e.properties) ?? {}, s = x.utc();
1659
1731
  n.id = (e == null ? void 0 : e.id) || s.valueOf().toString();
1660
1732
  const o = "polygon";
1661
- n.name = (e == null ? void 0 : e.name) || `${o}_${s.format()}`, n.coordinates = t.map((i) => i.map((c) => d.roundPrecision(c, 9))), n.shape = "polygon", R.info("[%s] draw polygon with %j", e == null ? void 0 : e.requestId, n);
1662
- const r = d.convertToMonotonicLng2(t);
1733
+ n.name = (e == null ? void 0 : e.name) || `${o}_${s.format()}`, n.coordinates = t.map((i) => i.map((c) => h.roundPrecision(c, 9))), n.shape = "polygon", O.info("[%s] draw polygon with %j", e == null ? void 0 : e.requestId, n);
1734
+ const r = h.convertToMonotonicLng2(t);
1663
1735
  return T.polygon([r], n);
1664
1736
  }
1665
1737
  /**
@@ -1670,10 +1742,10 @@ class F {
1670
1742
  * @returns
1671
1743
  */
1672
1744
  static drawPoint(t, e, n = {}) {
1673
- const s = (n == null ? void 0 : n.properties) ?? {}, o = b.utc();
1745
+ const s = (n == null ? void 0 : n.properties) ?? {}, o = x.utc();
1674
1746
  s.id = (n == null ? void 0 : n.id) || o.valueOf().toString();
1675
1747
  const r = "point";
1676
- return s.name = (n == null ? void 0 : n.name) || `${r}_${o.format()}`, s.shape = "point", R.info("[%s] draw point with %j", n == null ? void 0 : n.requestId, s), T.point([e, t], s);
1748
+ return s.name = (n == null ? void 0 : n.name) || `${r}_${o.format()}`, s.shape = "point", O.info("[%s] draw point with %j", n == null ? void 0 : n.requestId, s), T.point([e, t], s);
1677
1749
  }
1678
1750
  /**
1679
1751
  * 解析ORM GeoJSON Feature (圆), 返回FeatureCollection
@@ -1684,10 +1756,10 @@ class F {
1684
1756
  */
1685
1757
  static parseCircle(t, e = {}) {
1686
1758
  var s, o;
1687
- R.info("[%s] parse circle with %j", e == null ? void 0 : e.requestId, t.properties);
1759
+ O.info("[%s] parse circle with %j", e == null ? void 0 : e.requestId, t.properties);
1688
1760
  const n = t.properties || {};
1689
1761
  if (n.shape == "circle") {
1690
- const r = b.utc();
1762
+ const r = x.utc();
1691
1763
  n.id = (n == null ? void 0 : n.id) || r.valueOf().toString();
1692
1764
  const i = n == null ? void 0 : n.id, c = ((s = n == null ? void 0 : n.center) == null ? void 0 : s.length) == 2 ? T.point(n.center) : T.centroid(t);
1693
1765
  let a = "center";
@@ -1699,12 +1771,12 @@ class F {
1699
1771
  u = T.pointToLineDistance(c, p, { units: l });
1700
1772
  }
1701
1773
  a = "end";
1702
- const m = ((o = n == null ? void 0 : n.end) == null ? void 0 : o.length) == 2 ? T.point(n.end) : T.destination(c, u, 90, { units: l });
1703
- m.properties = { id: `${a}_${i}`, parentId: i, name: a, radius: u, units: l };
1704
- const h = T.lineString([c.geometry.coordinates, m.geometry.coordinates]);
1705
- return a = "edge", h.properties = { id: `${a}_${i}`, parentId: i, name: a, radius: u, units: l }, T.featureCollection([c, m, h, t]);
1774
+ const g = ((o = n == null ? void 0 : n.end) == null ? void 0 : o.length) == 2 ? T.point(n.end) : T.destination(c, u, 90, { units: l });
1775
+ g.properties = { id: `${a}_${i}`, parentId: i, name: a, radius: u, units: l };
1776
+ const d = T.lineString([c.geometry.coordinates, g.geometry.coordinates]);
1777
+ return a = "edge", d.properties = { id: `${a}_${i}`, parentId: i, name: a, radius: u, units: l }, T.featureCollection([c, g, d, t]);
1706
1778
  } else
1707
- return R.warn("[%s] not a orm-std circle, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1779
+ return O.warn("[%s] not a orm-std circle, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1708
1780
  }
1709
1781
  /**
1710
1782
  * 解析ORM GeoJSON Feature (矩形), 返回FeatureCollection
@@ -1714,10 +1786,10 @@ class F {
1714
1786
  * 如果feature是矩形,则返回矩形的四个顶点和矩形Feature
1715
1787
  */
1716
1788
  static parseRect(t, e = {}) {
1717
- R.info("[%s] parse rect with %j", e == null ? void 0 : e.requestId, t.properties);
1789
+ O.info("[%s] parse rect with %j", e == null ? void 0 : e.requestId, t.properties);
1718
1790
  const n = t.properties || {};
1719
1791
  if (n.shape == "rect") {
1720
- const s = b.utc();
1792
+ const s = x.utc();
1721
1793
  n.id = (n == null ? void 0 : n.id) || s.valueOf().toString();
1722
1794
  const o = n == null ? void 0 : n.id, r = t.geometry.coordinates[0], c = ["sw", "nw", "ne", "se"].map((a, l) => {
1723
1795
  const u = T.point(r[l]);
@@ -1725,7 +1797,7 @@ class F {
1725
1797
  });
1726
1798
  return T.featureCollection([...c, t]);
1727
1799
  } else
1728
- return R.warn("[%s] not a orm-std rect, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1800
+ return O.warn("[%s] not a orm-std rect, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1729
1801
  }
1730
1802
  /**
1731
1803
  * 解析ORM GeoJSON Feature (线), 返回FeatureCollection
@@ -1735,10 +1807,10 @@ class F {
1735
1807
  * 如果feature是线,则返回所有坐标点(首为start、尾为end、中间为point_N)以及线Feature
1736
1808
  */
1737
1809
  static parseLine(t, e = {}) {
1738
- R.info("[%s] parse line with %j", e == null ? void 0 : e.requestId, t.properties);
1810
+ O.info("[%s] parse line with %j", e == null ? void 0 : e.requestId, t.properties);
1739
1811
  const n = t.properties || {};
1740
1812
  if (n.shape == "line") {
1741
- const s = b.utc();
1813
+ const s = x.utc();
1742
1814
  n.id = (n == null ? void 0 : n.id) || s.valueOf().toString();
1743
1815
  const o = n == null ? void 0 : n.id, i = t.geometry.coordinates.map((c, a) => {
1744
1816
  const l = `point_${a}`, u = T.point(c);
@@ -1746,7 +1818,7 @@ class F {
1746
1818
  });
1747
1819
  return T.featureCollection([...i, t]);
1748
1820
  } else
1749
- return R.warn("[%s] not a orm-std line, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1821
+ return O.warn("[%s] not a orm-std line, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1750
1822
  }
1751
1823
  /**
1752
1824
  * 解析ORM GeoJSON Feature (多边形), 返回FeatureCollection
@@ -1756,10 +1828,10 @@ class F {
1756
1828
  * 如果feature是多边形,则返回多边形的顶点和多边形Feature
1757
1829
  */
1758
1830
  static parsePolygon(t, e = {}) {
1759
- R.info("[%s] parse polygon with %j", e == null ? void 0 : e.requestId, t.properties);
1831
+ O.info("[%s] parse polygon with %j", e == null ? void 0 : e.requestId, t.properties);
1760
1832
  const n = t.properties || {};
1761
1833
  if (n.shape == "polygon") {
1762
- const s = b.utc();
1834
+ const s = x.utc();
1763
1835
  n.id = (n == null ? void 0 : n.id) || s.valueOf().toString();
1764
1836
  const o = n == null ? void 0 : n.id, i = t.geometry.coordinates[0].map((c, a) => {
1765
1837
  const l = T.point(c), u = `corner_${a}`;
@@ -1767,7 +1839,7 @@ class F {
1767
1839
  });
1768
1840
  return T.featureCollection([...i, t]);
1769
1841
  } else
1770
- return R.warn("[%s] not a orm-std polygon, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1842
+ return O.warn("[%s] not a orm-std polygon, just return the original feature", e == null ? void 0 : e.requestId), T.featureCollection([t]);
1771
1843
  }
1772
1844
  // ---------------------------------------------------------------------------
1773
1845
  // ZIP / KMZ 内部工具
@@ -1789,12 +1861,12 @@ class F {
1789
1861
  * 使用 Central Directory 解析,避免 Data Descriptor 导致的大小不准问题。
1790
1862
  */
1791
1863
  static async _parseZipEntries(t) {
1792
- var m;
1864
+ var g;
1793
1865
  const e = new Uint8Array(t), n = e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength), s = new DataView(n), o = new Uint8Array(n), r = /* @__PURE__ */ new Map();
1794
1866
  let i = -1;
1795
- for (let h = n.byteLength - 22; h >= 0; h--)
1796
- if (s.getUint32(h, !0) === 101010256) {
1797
- i = h;
1867
+ for (let d = n.byteLength - 22; d >= 0; d--)
1868
+ if (s.getUint32(d, !0) === 101010256) {
1869
+ i = d;
1798
1870
  break;
1799
1871
  }
1800
1872
  if (i < 0)
@@ -1806,33 +1878,33 @@ class F {
1806
1878
  for (; l < u; ) {
1807
1879
  if (s.getUint32(l, !0) !== 33639248)
1808
1880
  throw new Error(`Invalid ZIP file: Central Directory signature mismatch at offset ${l}`);
1809
- const p = s.getUint16(l + 10, !0), f = s.getUint32(l + 20, !0), g = s.getUint16(l + 28, !0), y = s.getUint16(l + 30, !0), x = s.getUint16(l + 32, !0), P = s.getUint32(l + 42, !0), S = o.slice(l + 46, l + 46 + g), M = new TextDecoder().decode(S), k = s.getUint16(P + 26, !0), U = s.getUint16(P + 28, !0), E = P + 30 + k + U, B = o.slice(E, E + f);
1881
+ const p = s.getUint16(l + 10, !0), f = s.getUint32(l + 20, !0), m = s.getUint16(l + 28, !0), S = s.getUint16(l + 30, !0), v = s.getUint16(l + 32, !0), P = s.getUint32(l + 42, !0), y = o.slice(l + 46, l + 46 + m), N = new TextDecoder().decode(y), $ = s.getUint16(P + 26, !0), E = s.getUint16(P + 28, !0), F = P + 30 + $ + E, R = o.slice(F, F + f);
1810
1882
  if (p === 0)
1811
- r.set(M, B);
1883
+ r.set(N, R);
1812
1884
  else if (p === 8) {
1813
1885
  if (typeof DecompressionStream < "u") {
1814
- const $ = new DecompressionStream("deflate-raw"), N = $.writable.getWriter(), O = $.readable.getReader();
1815
- N.write(B), N.close();
1816
- const W = [];
1817
- let j = 0;
1886
+ const D = new DecompressionStream("deflate-raw"), M = D.writable.getWriter(), A = D.readable.getReader();
1887
+ M.write(R), M.close();
1888
+ const j = [];
1889
+ let U = 0;
1818
1890
  for (; ; ) {
1819
- const { done: A, value: D } = await O.read();
1820
- if (A)
1891
+ const { done: w, value: I } = await A.read();
1892
+ if (w)
1821
1893
  break;
1822
- W.push(D), j += D.length;
1894
+ j.push(I), U += I.length;
1823
1895
  }
1824
- const Z = new Uint8Array(j);
1825
- let w = 0;
1826
- for (const A of W)
1827
- Z.set(A, w), w += A.length;
1828
- r.set(M, Z);
1829
- } else if (typeof process < "u" && ((m = process.versions) != null && m.node))
1896
+ const X = new Uint8Array(U);
1897
+ let B = 0;
1898
+ for (const w of j)
1899
+ X.set(w, B), B += w.length;
1900
+ r.set(N, X);
1901
+ } else if (typeof process < "u" && ((g = process.versions) != null && g.node))
1830
1902
  try {
1831
- r.set(M, F._inflateRawSync(B));
1903
+ r.set(N, W._inflateRawSync(R));
1832
1904
  } catch {
1833
1905
  }
1834
1906
  }
1835
- l += 46 + g + y + x;
1907
+ l += 46 + m + S + v;
1836
1908
  }
1837
1909
  return r;
1838
1910
  }
@@ -1847,41 +1919,41 @@ class F {
1847
1919
  */
1848
1920
  static async convertKML2GeoJSON(t, e = {}) {
1849
1921
  var i, c;
1850
- R.info("[%s] convert kml to geojson", e == null ? void 0 : e.requestId);
1922
+ O.info("[%s] convert kml to geojson", e == null ? void 0 : e.requestId);
1851
1923
  const s = H().parseFromString(t, "application/xml"), o = Array.from(s.querySelectorAll("Placemark")), r = [];
1852
1924
  for (const a of o) {
1853
1925
  const l = {}, u = Array.from(a.querySelectorAll("ExtendedData > Data"));
1854
- for (const S of u) {
1855
- const M = S.getAttribute("name"), k = (c = (i = S.querySelector("value")) == null ? void 0 : i.textContent) == null ? void 0 : c.trim();
1856
- M && k !== void 0 && k !== null && (l[M] = k);
1926
+ for (const y of u) {
1927
+ const N = y.getAttribute("name"), $ = (c = (i = y.querySelector("value")) == null ? void 0 : i.textContent) == null ? void 0 : c.trim();
1928
+ N && $ !== void 0 && $ !== null && (l[N] = $);
1857
1929
  }
1858
- const m = b.utc(), h = Object.keys(l).find((S) => S.toLowerCase().indexOf("name") !== -1), p = h ? l[h] : void 0, f = `${m.valueOf().toString()}_${Math.random().toString(36).slice(2, 8)}`, g = (S) => S.trim().split(/[\s\n]+/).filter((M) => M.length > 0).map((M) => {
1859
- const k = M.split(",").map(Number);
1860
- return [k[0], k[1]];
1861
- }), y = a.querySelector("LineString > coordinates");
1862
- if (y) {
1863
- const S = g(y.textContent || "");
1864
- if (S.length >= 2) {
1865
- const M = T.lineString(S, { ...l, shape: "line", id: f, name: p });
1866
- r.push(M);
1930
+ const g = x.utc(), d = Object.keys(l).find((y) => y.toLowerCase().indexOf("name") !== -1), p = d ? l[d] : void 0, f = `${g.valueOf().toString()}_${Math.random().toString(36).slice(2, 8)}`, m = (y) => y.trim().split(/[\s\n]+/).filter((N) => N.length > 0).map((N) => {
1931
+ const $ = N.split(",").map(Number);
1932
+ return [$[0], $[1]];
1933
+ }), S = a.querySelector("LineString > coordinates");
1934
+ if (S) {
1935
+ const y = m(S.textContent || "");
1936
+ if (y.length >= 2) {
1937
+ const N = T.lineString(y, { ...l, shape: "line", id: f, name: p });
1938
+ r.push(N);
1867
1939
  }
1868
1940
  continue;
1869
1941
  }
1870
- const x = a.querySelector("Polygon outerBoundaryIs LinearRing > coordinates");
1871
- if (x) {
1872
- const S = g(x.textContent || "");
1873
- if (S.length >= 4) {
1874
- const M = S[0][0] === S[S.length - 1][0] && S[0][1] === S[S.length - 1][1] ? S : [...S, S[0]], k = T.polygon([M], { ...l, shape: "polygon", id: f, name: p });
1875
- r.push(k);
1942
+ const v = a.querySelector("Polygon outerBoundaryIs LinearRing > coordinates");
1943
+ if (v) {
1944
+ const y = m(v.textContent || "");
1945
+ if (y.length >= 4) {
1946
+ const N = y[0][0] === y[y.length - 1][0] && y[0][1] === y[y.length - 1][1] ? y : [...y, y[0]], $ = T.polygon([N], { ...l, shape: "polygon", id: f, name: p });
1947
+ r.push($);
1876
1948
  }
1877
1949
  continue;
1878
1950
  }
1879
1951
  const P = a.querySelector("Point > coordinates");
1880
1952
  if (P) {
1881
- const S = g(P.textContent || "");
1882
- if (S.length >= 1) {
1883
- const M = T.point(S[0], { ...l, shape: "point", id: f, name: p });
1884
- r.push(M);
1953
+ const y = m(P.textContent || "");
1954
+ if (y.length >= 1) {
1955
+ const N = T.point(y[0], { ...l, shape: "point", id: f, name: p });
1956
+ r.push(N);
1885
1957
  }
1886
1958
  continue;
1887
1959
  }
@@ -1899,12 +1971,12 @@ class F {
1899
1971
  */
1900
1972
  static async convertKMZ2GeoJSON(t, e = {}) {
1901
1973
  var r;
1902
- R.info("[%s] convert kmz to geojson (async)", e == null ? void 0 : e.requestId), typeof Buffer < "u" && Buffer.isBuffer(t) && (t = F.toArrayBuffer(t));
1903
- const n = await F._parseZipEntries(t), s = n.get("doc.kml") ?? ((r = [...n.entries()].find(([i]) => i.toLowerCase().endsWith(".kml"))) == null ? void 0 : r[1]);
1974
+ O.info("[%s] convert kmz to geojson (async)", e == null ? void 0 : e.requestId), typeof Buffer < "u" && Buffer.isBuffer(t) && (t = W.toArrayBuffer(t));
1975
+ const n = await W._parseZipEntries(t), s = n.get("doc.kml") ?? ((r = [...n.entries()].find(([i]) => i.toLowerCase().endsWith(".kml"))) == null ? void 0 : r[1]);
1904
1976
  if (!s)
1905
- return R.warn("[%s] no .kml file found in kmz", e == null ? void 0 : e.requestId), T.featureCollection([]);
1977
+ return O.warn("[%s] no .kml file found in kmz", e == null ? void 0 : e.requestId), T.featureCollection([]);
1906
1978
  const o = new TextDecoder().decode(s);
1907
- return F.convertKML2GeoJSON(o, e);
1979
+ return W.convertKML2GeoJSON(o, e);
1908
1980
  }
1909
1981
  /**
1910
1982
  * 将 ZIP 文件中所有 .kml 文件合并转换为一个 GeoJSON FeatureCollection(异步)。
@@ -1916,15 +1988,15 @@ class F {
1916
1988
  * @param options
1917
1989
  */
1918
1990
  static async convertZIP2GeoJSON(t, e = {}) {
1919
- R.info("[%s] convert zip to geojson (async)", e == null ? void 0 : e.requestId), typeof Buffer < "u" && Buffer.isBuffer(t) && (t = F.toArrayBuffer(t));
1920
- const n = await F._parseZipEntries(t), s = [];
1991
+ O.info("[%s] convert zip to geojson (async)", e == null ? void 0 : e.requestId), typeof Buffer < "u" && Buffer.isBuffer(t) && (t = W.toArrayBuffer(t));
1992
+ const n = await W._parseZipEntries(t), s = [];
1921
1993
  for (const [o, r] of n) {
1922
1994
  if (!o.toLowerCase().endsWith(".kml"))
1923
1995
  continue;
1924
- const i = new TextDecoder().decode(r), c = await F.convertKML2GeoJSON(i, e);
1996
+ const i = new TextDecoder().decode(r), c = await W.convertKML2GeoJSON(i, e);
1925
1997
  s.push(...c.features);
1926
1998
  }
1927
- return s.length === 0 ? (R.warn("[%s] no .kml files found in zip", e == null ? void 0 : e.requestId), this.convertSHP2GeoJSON(t, e)) : T.featureCollection(s);
1999
+ return s.length === 0 ? (O.warn("[%s] no .kml files found in zip", e == null ? void 0 : e.requestId), this.convertSHP2GeoJSON(t, e)) : T.featureCollection(s);
1928
2000
  }
1929
2001
  /**
1930
2002
  * 将 Shapefile ZIP(含 .shp/.shx/.dbf/.prj)转换为 GeoJSON FeatureCollection。
@@ -1935,12 +2007,12 @@ class F {
1935
2007
  * @param options
1936
2008
  */
1937
2009
  static async convertSHP2GeoJSON(t, e = {}) {
1938
- R.info("[%s] convert shp zip to geojson", e == null ? void 0 : e.requestId);
2010
+ O.info("[%s] convert shp zip to geojson", e == null ? void 0 : e.requestId);
1939
2011
  try {
1940
- typeof Buffer < "u" && Buffer.isBuffer(t) && (t = F.toArrayBuffer(t));
2012
+ typeof Buffer < "u" && Buffer.isBuffer(t) && (t = W.toArrayBuffer(t));
1941
2013
  const n = await J(t);
1942
2014
  if (Array.isArray(n)) {
1943
- const s = n.flatMap((c) => c.features || []), o = b.utc(), r = (e == null ? void 0 : e.id) || o.valueOf().toString(), i = {
2015
+ const s = n.flatMap((c) => c.features || []), o = x.utc(), r = (e == null ? void 0 : e.id) || o.valueOf().toString(), i = {
1944
2016
  Point: "point",
1945
2017
  MultiPoint: "point",
1946
2018
  LineString: "line",
@@ -1952,20 +2024,20 @@ class F {
1952
2024
  var p;
1953
2025
  const l = ((p = c.geometry) == null ? void 0 : p.type) || "", u = i[l] || l.toLowerCase();
1954
2026
  c.properties = c.properties || {}, c.properties.shape = u, c.properties.parentId = r, c.properties.id = `${r}_${a}`;
1955
- const m = Object.keys(c.properties).find((f) => f.toLowerCase().indexOf("name") !== -1), h = m ? c.properties[m] : void 0;
1956
- c.properties.name = h || `${u}_${o.format()}_${a}`;
2027
+ const g = Object.keys(c.properties).find((f) => f.toLowerCase().indexOf("name") !== -1), d = g ? c.properties[g] : void 0;
2028
+ c.properties.name = d || `${u}_${o.format()}_${a}`;
1957
2029
  }), T.featureCollection(s);
1958
2030
  }
1959
2031
  return n;
1960
2032
  } catch (n) {
1961
- return R.warn("[%s] failed to convert shp zip: %s", e == null ? void 0 : e.requestId, n), T.featureCollection([]);
2033
+ return O.warn("[%s] failed to convert shp zip: %s", e == null ? void 0 : e.requestId, n), T.featureCollection([]);
1962
2034
  }
1963
2035
  }
1964
2036
  }
1965
2037
  export {
1966
2038
  K as AisHelper,
1967
- F as GeoJsonHelper,
1968
- v as LaneHelper,
1969
- d as LngLatHelper,
2039
+ W as GeoJsonHelper,
2040
+ b as LaneHelper,
2041
+ h as LngLatHelper,
1970
2042
  it as TropicalHelper
1971
2043
  };