@idm-plugin/meteo2 0.5.5 → 0.5.6

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
@@ -34,8 +34,8 @@ class m0 {
34
34
  source: Y == null ? void 0 : Y.toLowerCase()
35
35
  },
36
36
  timeout: 3e4
37
- }, X = L(), R = X.valueOf();
38
- A.isBefore(X.subtract(1, "month")) && (U == null || U.warn("[%s] get history meteo on %s: %j", d.requestId, A.format(), q));
37
+ }, a = L(), R = a.valueOf();
38
+ A.isBefore(a.subtract(1, "month")) && (U == null || U.warn("[%s] get history meteo on %s: %j", d.requestId, A.format(), q));
39
39
  const n = "https://aod4idm.idmwx.com/api/ocean/point", o = await k.get(n, q).json(), S = L().valueOf();
40
40
  if (U == null || U.info("[%s] get meteo(cost: %d ms) from %s with options: %j", d.requestId, S - R, n, q), (o == null ? void 0 : o.code) === 0)
41
41
  return {
@@ -69,8 +69,8 @@ class m0 {
69
69
  source: Y == null ? void 0 : Y.toLowerCase()
70
70
  },
71
71
  timeout: 3e4
72
- }, X = L(), R = X.valueOf();
73
- A.isBefore(X.subtract(1, "month")) && (U == null || U.warn("[%s] get history factors on %s: %j", d.requestId, A.format(), q));
72
+ }, a = L(), R = a.valueOf();
73
+ A.isBefore(a.subtract(1, "month")) && (U == null || U.warn("[%s] get history factors on %s: %j", d.requestId, A.format(), q));
74
74
  const n = "https://aod4idm.idmwx.com/api/ocean/factor", o = await k.get(n, q).json(), S = L().valueOf();
75
75
  if (U == null || U.info("[%s] get factors(cost: %d ms) from %s with options: %j", d.requestId, S - R, n, q), (o == null ? void 0 : o.code) === 0)
76
76
  return {
@@ -116,8 +116,8 @@ class m0 {
116
116
  levels: ["surface"]
117
117
  }
118
118
  }).json();
119
- let X = L().valueOf();
120
- U == null || U.info("[%s] get gfs-factors(cost: %d ms) from %s", O.requestId, X - A, Y), A = X;
119
+ let a = L().valueOf();
120
+ U == null || U.info("[%s] get gfs-factors(cost: %d ms) from %s", O.requestId, a - A, Y), A = a;
121
121
  const R = await k.post(Y, {
122
122
  headers: {
123
123
  "Content-Type": "application/json"
@@ -131,7 +131,7 @@ class m0 {
131
131
  levels: ["surface"]
132
132
  }
133
133
  }).json();
134
- X = L().valueOf(), U == null || U.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", O.requestId, X - A, Y);
134
+ a = L().valueOf(), U == null || U.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", O.requestId, a - A, Y);
135
135
  for (let o = 0; o < q.ts.length; o++) {
136
136
  const S = this.populateUVFactor(q["wind_u-surface"][o], q["wind_v-surface"][o], !1, O);
137
137
  S.scale = this.calculateBeaufortWindForceScale(S.speed), d.push({
@@ -269,9 +269,9 @@ var A0 = { exports: {} };
269
269
  throw new RangeError("invalid coordinates");
270
270
  if (90 <= b)
271
271
  return "Etc/GMT";
272
- var d = -1, A = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - b) / 180.00000000000003, X = 0 | A, R = 0 | q, n = 96 * R + 2 * X;
272
+ var d = -1, A = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - b) / 180.00000000000003, a = 0 | A, R = 0 | q, n = 96 * R + 2 * a;
273
273
  for (n = 56 * O.charCodeAt(n) + O.charCodeAt(n + 1) - 1995; n + Y.length < 3136; )
274
- n = 56 * O.charCodeAt(n = 8 * (d = d + n + 1) + 4 * (R = 0 | (q = 2 * (q - R) % 2)) + 2 * (X = 0 | (A = 2 * (A - X) % 2)) + 2304) + O.charCodeAt(n + 1) - 1995;
274
+ n = 56 * O.charCodeAt(n = 8 * (d = d + n + 1) + 4 * (R = 0 | (q = 2 * (q - R) % 2)) + 2 * (a = 0 | (A = 2 * (A - a) % 2)) + 2304) + O.charCodeAt(n + 1) - 1995;
275
275
  return Y[n + Y.length - 3136];
276
276
  }
277
277
  f.exports = M;
@@ -291,15 +291,15 @@ var c0 = { exports: {} };
291
291
  M.version === void 0 && M.default && (M = M.default);
292
292
  var b = "0.5.48", p = {}, O = {}, Y = {}, d = {}, A = {}, q;
293
293
  (!M || typeof M.version != "string") && y("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
294
- var X = M.version.split("."), R = +X[0], n = +X[1];
294
+ var a = M.version.split("."), R = +a[0], n = +a[1];
295
295
  (R < 2 || R === 2 && n < 6) && y("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
296
296
  function o(z) {
297
297
  return z > 96 ? z - 87 : z > 64 ? z - 29 : z - 48;
298
298
  }
299
299
  function S(z) {
300
- var c = 0, W = z.split("."), a = W[0], T = W[1] || "", N = 1, Z, r = 0, t = 1;
301
- for (z.charCodeAt(0) === 45 && (c = 1, t = -1), c; c < a.length; c++)
302
- Z = o(a.charCodeAt(c)), r = 60 * r + Z;
300
+ var c = 0, W = z.split("."), X = W[0], T = W[1] || "", N = 1, Z, r = 0, t = 1;
301
+ for (z.charCodeAt(0) === 45 && (c = 1, t = -1), c; c < X.length; c++)
302
+ Z = o(X.charCodeAt(c)), r = 60 * r + Z;
303
303
  for (c = 0; c < T.length; c++)
304
304
  N = N / 60, Z = o(T.charCodeAt(c)), r += Z * N;
305
305
  return r * t;
@@ -314,17 +314,17 @@ var c0 = { exports: {} };
314
314
  z[c - 1] = 1 / 0;
315
315
  }
316
316
  function u(z, c) {
317
- var W = [], a;
318
- for (a = 0; a < c.length; a++)
319
- W[a] = z[c[a]];
317
+ var W = [], X;
318
+ for (X = 0; X < c.length; X++)
319
+ W[X] = z[c[X]];
320
320
  return W;
321
321
  }
322
322
  function V(z) {
323
- var c = z.split("|"), W = c[2].split(" "), a = c[3].split(""), T = c[4].split(" ");
324
- return i(W), i(a), i(T), l(T, a.length), {
323
+ var c = z.split("|"), W = c[2].split(" "), X = c[3].split(""), T = c[4].split(" ");
324
+ return i(W), i(X), i(T), l(T, X.length), {
325
325
  name: c[0],
326
- abbrs: u(c[1].split(" "), a),
327
- offsets: u(W, a),
326
+ abbrs: u(c[1].split(" "), X),
327
+ offsets: u(W, X),
328
328
  untils: T,
329
329
  population: c[5] | 0
330
330
  };
@@ -340,8 +340,8 @@ var c0 = { exports: {} };
340
340
  return W - 1;
341
341
  if (z >= c[W - 1])
342
342
  return -1;
343
- for (var a, T = 0, N = W - 1; N - T > 1; )
344
- a = Math.floor((T + N) / 2), c[a] <= z ? T = a : N = a;
343
+ for (var X, T = 0, N = W - 1; N - T > 1; )
344
+ X = Math.floor((T + N) / 2), c[X] <= z ? T = X : N = X;
345
345
  return N;
346
346
  }
347
347
  E.prototype = {
@@ -349,9 +349,9 @@ var c0 = { exports: {} };
349
349
  this.name = z.name, this.abbrs = z.abbrs, this.untils = z.untils, this.offsets = z.offsets, this.population = z.population;
350
350
  },
351
351
  _index: function(z) {
352
- var c = +z, W = this.untils, a;
353
- if (a = e(c, W), a >= 0)
354
- return a;
352
+ var c = +z, W = this.untils, X;
353
+ if (X = e(c, W), X >= 0)
354
+ return X;
355
355
  },
356
356
  countries: function() {
357
357
  var z = this.name;
@@ -360,9 +360,9 @@ var c0 = { exports: {} };
360
360
  });
361
361
  },
362
362
  parse: function(z) {
363
- var c = +z, W = this.offsets, a = this.untils, T = a.length - 1, N, Z, r, t;
363
+ var c = +z, W = this.offsets, X = this.untils, T = X.length - 1, N, Z, r, t;
364
364
  for (t = 0; t < T; t++)
365
- if (N = W[t], Z = W[t + 1], r = W[t && t - 1], N < Z && B.moveAmbiguousForward ? N = Z : N > r && B.moveInvalidForward && (N = r), c < a[t] - N * 6e4)
365
+ if (N = W[t], Z = W[t + 1], r = W[t && t - 1], N < Z && B.moveAmbiguousForward ? N = Z : N > r && B.moveInvalidForward && (N = r), c < X[t] - N * 6e4)
366
366
  return W[t];
367
367
  return W[T];
368
368
  },
@@ -390,28 +390,28 @@ var c0 = { exports: {} };
390
390
  this.offsetScore += Math.abs(this.zone.utcOffset(z.at) - z.offset), this.zone.abbr(z.at).replace(/[^A-Z]/g, "") !== z.abbr && this.abbrScore++;
391
391
  };
392
392
  function F(z, c) {
393
- for (var W, a; a = ((c.at - z.at) / 12e4 | 0) * 6e4; )
394
- W = new P(new Date(z.at + a)), W.offset === z.offset ? z = W : c = W;
393
+ for (var W, X; X = ((c.at - z.at) / 12e4 | 0) * 6e4; )
394
+ W = new P(new Date(z.at + X)), W.offset === z.offset ? z = W : c = W;
395
395
  return z;
396
396
  }
397
397
  function C() {
398
- var z = (/* @__PURE__ */ new Date()).getFullYear() - 2, c = new P(new Date(z, 0, 1)), W = c.offset, a = [c], T, N, Z, r;
398
+ var z = (/* @__PURE__ */ new Date()).getFullYear() - 2, c = new P(new Date(z, 0, 1)), W = c.offset, X = [c], T, N, Z, r;
399
399
  for (r = 1; r < 48; r++)
400
- Z = new Date(z, r, 1).getTimezoneOffset(), Z !== W && (N = new P(new Date(z, r, 1)), T = F(c, N), a.push(T), a.push(new P(new Date(T.at + 6e4))), c = N, W = Z);
400
+ Z = new Date(z, r, 1).getTimezoneOffset(), Z !== W && (N = new P(new Date(z, r, 1)), T = F(c, N), X.push(T), X.push(new P(new Date(T.at + 6e4))), c = N, W = Z);
401
401
  for (r = 0; r < 4; r++)
402
- a.push(new P(new Date(z + r, 0, 1))), a.push(new P(new Date(z + r, 6, 1)));
403
- return a;
402
+ X.push(new P(new Date(z + r, 0, 1))), X.push(new P(new Date(z + r, 6, 1)));
403
+ return X;
404
404
  }
405
405
  function Q(z, c) {
406
406
  return z.offsetScore !== c.offsetScore ? z.offsetScore - c.offsetScore : z.abbrScore !== c.abbrScore ? z.abbrScore - c.abbrScore : z.zone.population !== c.zone.population ? c.zone.population - z.zone.population : c.zone.name.localeCompare(z.zone.name);
407
407
  }
408
408
  function h(z, c) {
409
- var W, a;
409
+ var W, X;
410
410
  for (i(c), W = 0; W < c.length; W++)
411
- a = c[W], A[a] = A[a] || {}, A[a][z] = !0;
411
+ X = c[W], A[X] = A[X] || {}, A[X][z] = !0;
412
412
  }
413
413
  function I(z) {
414
- var c = z.length, W = {}, a = [], T = {}, N, Z, r, t;
414
+ var c = z.length, W = {}, X = [], T = {}, N, Z, r, t;
415
415
  for (N = 0; N < c; N++)
416
416
  if (r = z[N].offset, !T.hasOwnProperty(r)) {
417
417
  t = A[r] || {};
@@ -420,8 +420,8 @@ var c0 = { exports: {} };
420
420
  T[r] = !0;
421
421
  }
422
422
  for (N in W)
423
- W.hasOwnProperty(N) && a.push(d[N]);
424
- return a;
423
+ W.hasOwnProperty(N) && X.push(d[N]);
424
+ return X;
425
425
  }
426
426
  function s() {
427
427
  try {
@@ -434,9 +434,9 @@ var c0 = { exports: {} };
434
434
  }
435
435
  } catch {
436
436
  }
437
- var W = C(), a = W.length, T = I(W), N = [], Z, r, t;
437
+ var W = C(), X = W.length, T = I(W), N = [], Z, r, t;
438
438
  for (r = 0; r < T.length; r++) {
439
- for (Z = new m(_(T[r])), t = 0; t < a; t++)
439
+ for (Z = new m(_(T[r])), t = 0; t < X; t++)
440
440
  Z.scoreOffsetAt(W[t]);
441
441
  N.push(Z);
442
442
  }
@@ -449,14 +449,14 @@ var c0 = { exports: {} };
449
449
  return (z || "").toLowerCase().replace(/\//g, "_");
450
450
  }
451
451
  function z0(z) {
452
- var c, W, a, T;
452
+ var c, W, X, T;
453
453
  for (typeof z == "string" && (z = [z]), c = 0; c < z.length; c++)
454
- a = z[c].split("|"), W = a[0], T = K(W), p[T] = z[c], d[T] = W, h(T, a[2].split(" "));
454
+ X = z[c].split("|"), W = X[0], T = K(W), p[T] = z[c], d[T] = W, h(T, X[2].split(" "));
455
455
  }
456
456
  function _(z, c) {
457
457
  z = K(z);
458
- var W = p[z], a;
459
- return W instanceof E ? W : typeof W == "string" ? (W = new E(W), p[z] = W, W) : O[z] && c !== _ && (a = _(O[z], _)) ? (W = p[z] = new E(), W._set(a), W.name = d[z], W) : null;
458
+ var W = p[z], X;
459
+ return W instanceof E ? W : typeof W == "string" ? (W = new E(W), p[z] = W, W) : O[z] && c !== _ && (X = _(O[z], _)) ? (W = p[z] = new E(), W._set(X), W.name = d[z], W) : null;
460
460
  }
461
461
  function q0() {
462
462
  var z, c = [];
@@ -468,17 +468,17 @@ var c0 = { exports: {} };
468
468
  return Object.keys(Y);
469
469
  }
470
470
  function b0(z) {
471
- var c, W, a, T;
471
+ var c, W, X, T;
472
472
  for (typeof z == "string" && (z = [z]), c = 0; c < z.length; c++)
473
- W = z[c].split("|"), a = K(W[0]), T = K(W[1]), O[a] = T, d[a] = W[0], O[T] = a, d[T] = W[1];
473
+ W = z[c].split("|"), X = K(W[0]), T = K(W[1]), O[X] = T, d[X] = W[0], O[T] = X, d[T] = W[1];
474
474
  }
475
475
  function Y0(z) {
476
- var c, W, a, T;
476
+ var c, W, X, T;
477
477
  if (!(!z || !z.length))
478
478
  for (c = 0; c < z.length; c++)
479
- T = z[c].split("|"), W = T[0].toUpperCase(), a = T[1].split(" "), Y[W] = new D(
479
+ T = z[c].split("|"), W = T[0].toUpperCase(), X = T[1].split(" "), Y[W] = new D(
480
480
  W,
481
- a
481
+ X
482
482
  );
483
483
  }
484
484
  function d0(z) {
@@ -488,10 +488,10 @@ var c0 = { exports: {} };
488
488
  if (z = d0(z), !z)
489
489
  return null;
490
490
  var W = z.zones.sort();
491
- return c ? W.map(function(a) {
492
- var T = _(a);
491
+ return c ? W.map(function(X) {
492
+ var T = _(X);
493
493
  return {
494
- name: a,
494
+ name: X,
495
495
  offset: T.utcOffset(/* @__PURE__ */ new Date())
496
496
  };
497
497
  }) : W;
@@ -510,19 +510,19 @@ var c0 = { exports: {} };
510
510
  typeof console < "u" && typeof console.error == "function" && console.error(z);
511
511
  }
512
512
  function B(z) {
513
- var c = Array.prototype.slice.call(arguments, 0, -1), W = arguments[arguments.length - 1], a = M.utc.apply(null, c), T;
514
- return !M.isMoment(z) && x(a) && (T = _(W)) && a.add(T.parse(a), "minutes"), a.tz(W), a;
513
+ var c = Array.prototype.slice.call(arguments, 0, -1), W = arguments[arguments.length - 1], X = M.utc.apply(null, c), T;
514
+ return !M.isMoment(z) && x(X) && (T = _(W)) && X.add(T.parse(X), "minutes"), X.tz(W), X;
515
515
  }
516
516
  B.version = b, B.dataVersion = "", B._zones = p, B._links = O, B._names = d, B._countries = Y, B.add = z0, B.link = b0, B.load = X0, B.zone = _, B.zoneExists = j, B.guess = w, B.names = q0, B.Zone = E, B.unpack = V, B.unpackBase60 = S, B.needsOffset = x, B.moveInvalidForward = !0, B.moveAmbiguousForward = !1, B.countries = o0, B.zonesForCountry = a0;
517
517
  var g = M.fn;
518
518
  M.tz = B, M.defaultZone = null, M.updateOffset = function(z, c) {
519
- var W = M.defaultZone, a;
519
+ var W = M.defaultZone, X;
520
520
  if (z._z === void 0 && (W && x(z) && !z._isUTC && z.isValid() && (z._d = M.utc(z._a)._d, z.utc().add(W.parse(z), "minutes")), z._z = W), z._z)
521
- if (a = z._z.utcOffset(z), Math.abs(a) < 16 && (a = a / 60), z.utcOffset !== void 0) {
521
+ if (X = z._z.utcOffset(z), Math.abs(X) < 16 && (X = X / 60), z.utcOffset !== void 0) {
522
522
  var T = z._z;
523
- z.utcOffset(-a, c), z._z = T;
523
+ z.utcOffset(-X, c), z._z = T;
524
524
  } else
525
- z.zone(a, c);
525
+ z.zone(X, c);
526
526
  }, g.tz = function(z, c) {
527
527
  if (z) {
528
528
  if (typeof z != "string")
@@ -1496,8 +1496,8 @@ class C0 {
1496
1496
  fake: M.fake,
1497
1497
  step: d
1498
1498
  });
1499
- const q = await $(A, M), X = await this.parseWeatherData(q, M, b);
1500
- O ? await this.mergeSegments(O, X) : O = X;
1499
+ const q = await $(A, M), a = await this.parseWeatherData(q, M, b);
1500
+ O ? await this.mergeSegments(O, a) : O = a;
1501
1501
  }
1502
1502
  else {
1503
1503
  const d = await $(M.url, M);
@@ -1527,7 +1527,7 @@ class C0 {
1527
1527
  * @param options
1528
1528
  */
1529
1529
  async marineForecast(M, b = {}) {
1530
- var p, O, Y, d, A, q, X, R;
1530
+ var p, O, Y, d, A, q, a, R;
1531
1531
  try {
1532
1532
  const n = L();
1533
1533
  let o;
@@ -1552,7 +1552,7 @@ class C0 {
1552
1552
  const S = L();
1553
1553
  this.debug && G.info("[%s] fetch marine api (%j) cost: %d ms", b.requestId, M.url, S.diff(n, "ms"));
1554
1554
  const i = await this.mergeMarineData(o), l = i.find((e) => e.model === "ncep_gfswave016"), u = i.find((e) => e.model === "ncep_gfswave025"), V = i.find((e) => e.model === "meteofrance_wave"), E = i.find((e) => e.model === "best_match");
1555
- return (O = (p = E == null ? void 0 : E.hourly) == null ? void 0 : p.wave_height) != null && O.every((e) => e !== null) ? [E] : (d = (Y = V == null ? void 0 : V.hourly) == null ? void 0 : Y.wave_height) != null && d.every((e) => e !== null) ? [V] : (q = (A = l == null ? void 0 : l.hourly) == null ? void 0 : A.wave_height) != null && q.every((e) => e !== null) ? [l] : (R = (X = u == null ? void 0 : u.hourly) == null ? void 0 : X.wave_height) != null && R.every((e) => e !== null) ? [u] : i != null && i.length ? [i[0]] : [];
1555
+ return (O = (p = E == null ? void 0 : E.hourly) == null ? void 0 : p.wave_height) != null && O.every((e) => e !== null) ? [E] : (d = (Y = V == null ? void 0 : V.hourly) == null ? void 0 : Y.wave_height) != null && d.every((e) => e !== null) ? [V] : (q = (A = l == null ? void 0 : l.hourly) == null ? void 0 : A.wave_height) != null && q.every((e) => e !== null) ? [l] : (R = (a = u == null ? void 0 : u.hourly) == null ? void 0 : a.wave_height) != null && R.every((e) => e !== null) ? [u] : i != null && i.length ? [i[0]] : [];
1556
1556
  } catch (n) {
1557
1557
  return G.warn("[%s] marine forecast failed: %s, with %j", b.requestId, n, M), [];
1558
1558
  }
@@ -1565,7 +1565,7 @@ class C0 {
1565
1565
  * @private
1566
1566
  */
1567
1567
  async parseWeatherData(M, b, p = {}) {
1568
- var d, A, q, X, R, n, o, S, i, l;
1568
+ var d, A, q, a, R, n, o, S, i, l;
1569
1569
  const O = [], Y = Math.pow(10, p.precision || 6);
1570
1570
  for (let u = 0; u < M.length; u++) {
1571
1571
  const V = M[u], E = V.utcOffsetSeconds(), e = V.timezone(), D = V.current(), P = V.hourly(), m = V.sixHourly(), F = V.daily(), C = {};
@@ -1590,7 +1590,7 @@ class C0 {
1590
1590
  )
1591
1591
  };
1592
1592
  for (let s = 0; s < P.variablesLength(); s++) {
1593
- const w = (X = (q = (A = P.variables(s).valuesArray()) == null ? void 0 : A.toString()) == null ? void 0 : q.split(",")) == null ? void 0 : X.map((K) => isNaN(K) ? null : Math.round(Number(K) * Y) / Y);
1593
+ const w = (a = (q = (A = P.variables(s).valuesArray()) == null ? void 0 : A.toString()) == null ? void 0 : q.split(",")) == null ? void 0 : a.map((K) => isNaN(K) ? null : Math.round(Number(K) * Y) / Y);
1594
1594
  C.hourly[b.hourly[s]] = w;
1595
1595
  }
1596
1596
  const I = L();
@@ -1645,11 +1645,11 @@ class C0 {
1645
1645
  }
1646
1646
  async mergeMarineData(M) {
1647
1647
  var Y, d, A, q;
1648
- const b = [], p = M.find((X) => X.model === "best_match");
1648
+ const b = [], p = M.find((a) => a.model === "best_match");
1649
1649
  p && b.push(p);
1650
- const O = M.find((X) => X.model === "meteofrance_currents");
1651
- for (const X of M)
1652
- ["best_match", "meteofrance_currents"].includes(X.model) || (X.hourly.ocean_current_velocity = (Y = O == null ? void 0 : O.hourly) == null ? void 0 : Y.ocean_current_velocity, X.hourly.ocean_current_direction = (d = O == null ? void 0 : O.hourly) == null ? void 0 : d.ocean_current_direction, X.hourly.sea_level_height_msl = (A = O == null ? void 0 : O.hourly) == null ? void 0 : A.sea_level_height_msl, X.hourly.sea_surface_temperature = (q = O == null ? void 0 : O.hourly) == null ? void 0 : q.sea_surface_temperature, b.push(X));
1650
+ const O = M.find((a) => a.model === "meteofrance_currents");
1651
+ for (const a of M)
1652
+ ["best_match", "meteofrance_currents"].includes(a.model) || (a.hourly.ocean_current_velocity = (Y = O == null ? void 0 : O.hourly) == null ? void 0 : Y.ocean_current_velocity, a.hourly.ocean_current_direction = (d = O == null ? void 0 : O.hourly) == null ? void 0 : d.ocean_current_direction, a.hourly.sea_level_height_msl = (A = O == null ? void 0 : O.hourly) == null ? void 0 : A.sea_level_height_msl, a.hourly.sea_surface_temperature = (q = O == null ? void 0 : O.hourly) == null ? void 0 : q.sea_surface_temperature, b.push(a));
1653
1653
  return b;
1654
1654
  }
1655
1655
  pickForecastUrl(M, b, p, O = {}) {
@@ -1667,8 +1667,8 @@ class C0 {
1667
1667
  }
1668
1668
  const O = p.reduce((A, q) => (A.includes(q) || A.push(q), A), []), Y = ["best_match", "meteofrance_currents", "meteofrance_wave", "ecmwf_wam025", "ncep_gfswave025", "gwam", "era5_ocean", "ewam", "ncep_gfswave016"];
1669
1669
  return O.sort((A, q) => {
1670
- const X = Y.indexOf(A), R = Y.indexOf(q);
1671
- return X - R;
1670
+ const a = Y.indexOf(A), R = Y.indexOf(q);
1671
+ return a - R;
1672
1672
  }), O;
1673
1673
  }
1674
1674
  /**
@@ -1683,18 +1683,18 @@ class C0 {
1683
1683
  var q;
1684
1684
  const Y = L().utc(), d = M ? L.utc(M) : void 0, A = Y.clone().utc().add(b && ((q = p.models) != null && q.includes("meteofrance_wave")) ? 10 : 15, "day");
1685
1685
  if (M) {
1686
- const X = d.clone().utc().add(O.forecastDays ?? 1, "day");
1687
- X.isAfter(A) ? (X.subtract(1, "year"), d.isAfter(A) ? (d.subtract(1, "year"), p.start_dates = [
1686
+ const a = d.clone().utc().add(O.forecastDays ?? 1, "day");
1687
+ a.isAfter(A) ? (a.subtract(1, "year"), d.isAfter(A) ? (d.subtract(1, "year"), p.start_dates = [
1688
1688
  d.clone().subtract(O.pastDays || 0, "day").utc().format("YYYY-MM-DD")
1689
- ], p.end_dates = [X.utc().format("YYYY-MM-DD")], p.fakes = [!0], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, !0, O)]) : (p.start_dates = [
1689
+ ], p.end_dates = [a.utc().format("YYYY-MM-DD")], p.fakes = [!0], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, !0, O)]) : (p.start_dates = [
1690
1690
  d.clone().subtract(O.pastDays || 0, "day").utc().format("YYYY-MM-DD"),
1691
1691
  A.clone().subtract(1, "year").utc().format("YYYY-MM-DD")
1692
- ], p.end_dates = [A.clone().subtract(1, "day").utc().format("YYYY-MM-DD"), X.utc().format("YYYY-MM-DD")], p.fakes = [!1, !0], p.url = [
1692
+ ], p.end_dates = [A.clone().subtract(1, "day").utc().format("YYYY-MM-DD"), a.utc().format("YYYY-MM-DD")], p.fakes = [!1, !0], p.url = [
1693
1693
  this.pickForecastUrl(b, O.selfHosted ?? !0, !1, O),
1694
1694
  this.pickForecastUrl(b, O.selfHosted ?? !0, !0, O)
1695
1695
  ])) : (p.start_dates = [
1696
1696
  d.clone().subtract(O.pastDays || 0, "day").utc().format("YYYY-MM-DD")
1697
- ], p.end_dates = [X.utc().format("YYYY-MM-DD")], p.fakes = [!1], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, d.isBefore(Y.clone().subtract(30, "day")), O)]);
1697
+ ], p.end_dates = [a.utc().format("YYYY-MM-DD")], p.fakes = [!1], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, d.isBefore(Y.clone().subtract(30, "day")), O)]);
1698
1698
  } else
1699
1699
  p.forecast_days = O.forecastDays, p.past_days = O.pastDays, p.fake = !1, p.url = this.pickForecastUrl(b, O.selfHosted ?? !0, !1, O);
1700
1700
  return p;
@@ -1761,12 +1761,12 @@ class C0 {
1761
1761
  models: ((S = A.weatherModels) == null ? void 0 : S.split(",")) || ["best_match"],
1762
1762
  timezone: "auto"
1763
1763
  };
1764
- let X;
1764
+ let a;
1765
1765
  if (p) {
1766
1766
  const e = this.timezoneOffset(M, b);
1767
- X = L.utc(p).utcOffset(e), X.subtract(e > 0 ? e : -e, "h");
1767
+ a = L.utc(p).utcOffset(e), a.subtract(e > 0 ? e : -e, "h"), A.selfHistory = !(a != null && a.isBefore(L.utc().subtract(120, "days")));
1768
1768
  }
1769
- Y && (q.daily = ((i = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : i.split(",")) || []), X || (A.forecastDays = A.forecastDays || 1, A.pastDays = 0, d = !0), d && (q.hourly = ((l = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : l.split(",")) || []), A.pastDays = A.pastDays || 0, A.pastDays = A.pastDays > 7 ? 7 : A.pastDays < 0 ? 0 : A.pastDays, A.forecastDays = A.forecastDays ?? 1, A.forecastDays = A.forecastDays > 14 ? 14 : A.forecastDays < 0 ? 1 : A.forecastDays, this.prepare(X == null ? void 0 : X.utc().format(), !1, q, A);
1769
+ Y && (q.daily = ((i = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : i.split(",")) || []), a || (A.forecastDays = A.forecastDays || 1, A.pastDays = 0, d = !0), d && (q.hourly = ((l = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : l.split(",")) || []), A.pastDays = A.pastDays || 0, A.pastDays = A.pastDays > 7 ? 7 : A.pastDays < 0 ? 0 : A.pastDays, A.forecastDays = A.forecastDays ?? 1, A.forecastDays = A.forecastDays > 14 ? 14 : A.forecastDays < 0 ? 1 : A.forecastDays, this.prepare(a == null ? void 0 : a.utc().format(), !1, q, A);
1770
1770
  const R = await this.weatherForecast(q, A), n = {
1771
1771
  apikey: this.apikey,
1772
1772
  latitude: M,
@@ -1776,7 +1776,7 @@ class C0 {
1776
1776
  wind_speed_unit: "kn",
1777
1777
  models: this.pickMarineModels(A.marineModels)
1778
1778
  };
1779
- Y && (n.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), X || (A.forecastDays = A.forecastDays || 1, d = !0), d && (n.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), this.prepare(X == null ? void 0 : X.utc().format(), !0, n, A);
1779
+ Y && (n.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), a || (A.forecastDays = A.forecastDays || 1, d = !0), d && (n.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), this.prepare(a == null ? void 0 : a.utc().format(), !0, n, A);
1780
1780
  let o = await this.marineForecast(n, A);
1781
1781
  return (E = (V = (u = o[0]) == null ? void 0 : u.hourly) == null ? void 0 : V.wave_height) != null && E.every((e) => e === null) && (n.models = this.pickMarineModels("best_match,ncep_gfswave025,meteofrance_wave"), o = await this.marineForecast(n, A)), { weather: R, marine: o };
1782
1782
  }
@@ -1806,8 +1806,8 @@ class C0 {
1806
1806
  }) {
1807
1807
  var l, u;
1808
1808
  b = this.toStdLng(b), this.debug && G.info("[%s] spot historical params: %j", q.requestId, { lat: M, lng: b, startDate: p, endDate: O, withMarine: A, options: q });
1809
- const X = this.timezoneOffset(M, b), R = L.utc(p).utcOffset(X), n = L.utc(O).utcOffset(X);
1810
- R.subtract(X > 0 ? X : -X, "h"), n.subtract(X > 0 ? X : -X, "h");
1809
+ const a = this.timezoneOffset(M, b), R = L.utc(p).utcOffset(a), n = L.utc(O).utcOffset(a);
1810
+ R.subtract(a > 0 ? a : -a, "h"), n.subtract(a > 0 ? a : -a, "h");
1811
1811
  const o = {
1812
1812
  apikey: this.apikey,
1813
1813
  latitude: M,
@@ -1857,8 +1857,8 @@ class C0 {
1857
1857
  precision: 6
1858
1858
  }) {
1859
1859
  b = this.toStdLng(b), this.debug && G.info("[%s] spot seasonal params: %j", d.requestId, { lat: M, lng: b, startDate: p, endDate: O, options: d });
1860
- const A = this.timezoneOffset(M, b), q = L.utc(p).utcOffset(A), X = O ? L.utc(O).utcOffset(A) : q.clone().add(1, "month");
1861
- q.subtract(A > 0 ? A : -A, "h"), X.subtract(A > 0 ? A : -A, "h");
1860
+ const A = this.timezoneOffset(M, b), q = L.utc(p).utcOffset(A), a = O ? L.utc(O).utcOffset(A) : q.clone().add(1, "month");
1861
+ q.subtract(A > 0 ? A : -A, "h"), a.subtract(A > 0 ? A : -A, "h");
1862
1862
  const R = {
1863
1863
  apikey: this.apikey,
1864
1864
  latitude: M,
@@ -1868,7 +1868,7 @@ class C0 {
1868
1868
  timezone: "auto",
1869
1869
  url: this.SEASONAL.OM_URL,
1870
1870
  start_date: q.format("YYYY-MM-DD"),
1871
- end_date: X.format("YYYY-MM-DD"),
1871
+ end_date: a.format("YYYY-MM-DD"),
1872
1872
  daily: this.SEASONAL.WEATHER_VARIABLES.DAILY.split(",")
1873
1873
  };
1874
1874
  return Y && (R.six_hourly = this.SEASONAL.WEATHER_VARIABLES.SIX_HOURLY.split(",")), d.memberLength = 4, { weather: await this.weatherForecast(R, d) };
@@ -1900,7 +1900,7 @@ class C0 {
1900
1900
  b = this.toStdLng(b), this.debug && G.info("[%s] spot climate params: %j", Y.requestId, { lat: M, lng: b, startDate: p, endDate: O, options: Y });
1901
1901
  const d = this.timezoneOffset(M, b), A = L.utc(p).utcOffset(d), q = O ? L.utc(O).utcOffset(d) : A.clone().add(1, "day");
1902
1902
  q.subtract(d > 0 ? d : -d, "h"), A.subtract(d > 0 ? d : -d, "h");
1903
- const X = {
1903
+ const a = {
1904
1904
  apikey: this.apikey,
1905
1905
  latitude: M,
1906
1906
  longitude: b,
@@ -1913,7 +1913,7 @@ class C0 {
1913
1913
  end_date: q.format("YYYY-MM-DD"),
1914
1914
  daily: this.CLIMATE.WEATHER_VARIABLES.DAILY.split(",")
1915
1915
  };
1916
- return { weather: await this.weatherForecast(X, Y) };
1916
+ return { weather: await this.weatherForecast(a, Y) };
1917
1917
  }
1918
1918
  async update(M = {}) {
1919
1919
  const b = L.unix(this.METEO2_UPDATE.etime), p = this.METEO2_UPDATE.version, O = L();
@@ -1925,8 +1925,8 @@ class C0 {
1925
1925
  }
1926
1926
  })).json();
1927
1927
  if (A.code === 0) {
1928
- const q = A.data, X = v.standardWeatherModels();
1929
- for (const R of X) {
1928
+ const q = A.data, a = v.standardWeatherModels();
1929
+ for (const R of a) {
1930
1930
  const n = v.autoPickSubCategories(R.alias), S = q.filter((i) => n.includes(i.category)).map((i) => {
1931
1931
  var l, u, V, E, e, D;
1932
1932
  return {
@@ -1993,8 +1993,8 @@ class D0 {
1993
1993
  * @param datum
1994
1994
  * @param options
1995
1995
  */
1996
- async tidesForecast(M, b, p = 7, O = "today", Y = !0, d = !1, A = !1, q = "CD", X = {}) {
1997
- O = O || "today", p = p || 7, b = this.toStdLng(b), this.debug && W0.info("[%s] spot tides forecast params: %j", X.requestId, { lat: M, lng: b, date: O, extremes: Y, heights: d, datums: A, datum: q });
1996
+ async tidesForecast(M, b, p = 7, O = "today", Y = !0, d = !1, A = !1, q = "CD", a = {}) {
1997
+ O = O || "today", p = p || 7, b = this.toStdLng(b), this.debug && W0.info("[%s] spot tides forecast params: %j", a.requestId, { lat: M, lng: b, date: O, extremes: Y, heights: d, datums: A, datum: q });
1998
1998
  let R = `https://www.worldtides.info/api/v3?lat=${M}&lon=${b}&days=${p}&date=${O}&datum=${q}&key=${this.apikey}&localtime`;
1999
1999
  Y && (R = `${R}&extremes`), d && (R = `${R}&heights`), A && (R = `${R}&datums`);
2000
2000
  const o = await (await fetch(R)).json();