@idm-plugin/meteo2 0.3.2 → 0.3.3

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,10 +1,10 @@
1
1
  var n0 = Object.defineProperty;
2
2
  var e0 = (i, M, b) => M in i ? n0(i, M, { enumerable: !0, configurable: !0, writable: !0, value: b }) : i[M] = b;
3
- var H = (i, M, b) => (e0(i, typeof M != "symbol" ? M + "" : M, b), b);
3
+ var v = (i, M, b) => (e0(i, typeof M != "symbol" ? M + "" : M, b), b);
4
4
  import A0 from "@log4js-node/log4js-api";
5
5
  import e from "moment";
6
- import k from "got";
7
- import { fetchWeatherApi as J } from "openmeteo";
6
+ import y from "got";
7
+ import { fetchWeatherApi as k } from "openmeteo";
8
8
  let f;
9
9
  try {
10
10
  f = A0.getLogger("meteo");
@@ -35,7 +35,7 @@ class P0 {
35
35
  timeout: 3e4
36
36
  }, X = e(), n = X.valueOf();
37
37
  O.isBefore(X.subtract(1, "month")) && (f == null || f.warn("[%s] get history meteo on %s: %j", c.requestId, O.format(), o));
38
- const L = "https://aod4idm.idmwx.com/api/ocean/point", a = await k.get(L, o).json(), N = e().valueOf();
38
+ const L = "https://aod4idm.idmwx.com/api/ocean/point", a = await y.get(L, o).json(), N = e().valueOf();
39
39
  if (f == null || f.info("[%s] get meteo(cost: %d ms) from %s with options: %j", c.requestId, N - n, L, o), (a == null ? void 0 : a.code) === 0)
40
40
  return {
41
41
  ...a.data,
@@ -70,7 +70,7 @@ class P0 {
70
70
  timeout: 3e4
71
71
  }, X = e(), n = X.valueOf();
72
72
  O.isBefore(X.subtract(1, "month")) && (f == null || f.warn("[%s] get history factors on %s: %j", c.requestId, O.format(), o));
73
- const L = "https://aod4idm.idmwx.com/api/ocean/factor", a = await k.get(L, o).json(), N = e().valueOf();
73
+ const L = "https://aod4idm.idmwx.com/api/ocean/factor", a = await y.get(L, o).json(), N = e().valueOf();
74
74
  if (f == null || f.info("[%s] get factors(cost: %d ms) from %s with options: %j", c.requestId, N - n, L, o), (a == null ? void 0 : a.code) === 0)
75
75
  return {
76
76
  ...a.data,
@@ -86,7 +86,7 @@ class P0 {
86
86
  const Y = "https://api.windy.com/api/point-forecast/v2", c = [];
87
87
  try {
88
88
  let O = e().valueOf();
89
- const o = await k.post(Y, {
89
+ const o = await y.post(Y, {
90
90
  headers: {
91
91
  "Content-Type": "application/json"
92
92
  },
@@ -117,7 +117,7 @@ class P0 {
117
117
  }).json();
118
118
  let X = e().valueOf();
119
119
  f == null || f.info("[%s] get gfs-factors(cost: %d ms) from %s", A.requestId, X - O, Y), O = X;
120
- const n = await k.post(Y, {
120
+ const n = await y.post(Y, {
121
121
  headers: {
122
122
  "Content-Type": "application/json"
123
123
  },
@@ -157,19 +157,19 @@ class P0 {
157
157
  }
158
158
  const L = [];
159
159
  for (let a = 0; a < n.ts.length; a++) {
160
- const N = this.calculateDouglasScale(n["waves_height-surface"][a], n["waves_direction-surface"][a], n["waves_period-surface"][a]), V = this.calculateDouglasScale(n["wwaves_height-surface"][a], n["wwaves_direction-surface"][a], n["wwaves_period-surface"][a]), E = this.calculateDouglasScale(n["swell1_height-surface"][a], n["swell1_direction-surface"][a], n["swell1_period-surface"][a]), t = this.calculateDouglasScale(n["swell2_height-surface"][a], n["swell2_direction-surface"][a], n["swell2_period-surface"][a]);
160
+ const N = this.calculateDouglasScale(n["waves_height-surface"][a], n["waves_direction-surface"][a], n["waves_period-surface"][a]), t = this.calculateDouglasScale(n["wwaves_height-surface"][a], n["wwaves_direction-surface"][a], n["wwaves_period-surface"][a]), m = this.calculateDouglasScale(n["swell1_height-surface"][a], n["swell1_direction-surface"][a], n["swell1_period-surface"][a]), V = this.calculateDouglasScale(n["swell2_height-surface"][a], n["swell2_direction-surface"][a], n["swell2_period-surface"][a]);
161
161
  L.push({
162
162
  utc: e(n.ts[a]).utc().format(),
163
163
  wave: {
164
164
  sig: N,
165
- wd: V,
166
- swell: E,
167
- swell2: t
165
+ wd: t,
166
+ swell: m,
167
+ swell2: V
168
168
  }
169
169
  });
170
170
  }
171
171
  for (const a of c) {
172
- const N = L.find((V) => V.utc === a.utc);
172
+ const N = L.find((t) => t.utc === a.utc);
173
173
  a.wave = N == null ? void 0 : N.wave;
174
174
  }
175
175
  } catch (O) {
@@ -289,9 +289,9 @@ var W0 = { exports: {} };
289
289
  })(T0, function(M) {
290
290
  M.version === void 0 && M.default && (M = M.default);
291
291
  var b = "0.5.47", p = {}, A = {}, Y = {}, c = {}, O = {}, o;
292
- (!M || typeof M.version != "string") && w("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
292
+ (!M || typeof M.version != "string") && H("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
293
293
  var X = M.version.split("."), n = +X[0], L = +X[1];
294
- (n < 2 || n === 2 && L < 6) && w("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
294
+ (n < 2 || n === 2 && L < 6) && H("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
295
295
  function a(z) {
296
296
  return z > 96 ? z - 87 : z > 64 ? z - 29 : z - 48;
297
297
  }
@@ -303,35 +303,35 @@ var W0 = { exports: {} };
303
303
  T = T / 60, u = a(R.charCodeAt(W)), r += u * T;
304
304
  return r * U;
305
305
  }
306
- function V(z) {
306
+ function t(z) {
307
307
  for (var W = 0; W < z.length; W++)
308
308
  z[W] = N(z[W]);
309
309
  }
310
- function E(z, W) {
310
+ function m(z, W) {
311
311
  for (var q = 0; q < W; q++)
312
312
  z[q] = Math.round((z[q - 1] || 0) + z[q] * 6e4);
313
313
  z[W - 1] = 1 / 0;
314
314
  }
315
- function t(z, W) {
315
+ function V(z, W) {
316
316
  var q = [], d;
317
317
  for (d = 0; d < W.length; d++)
318
318
  q[d] = z[W[d]];
319
319
  return q;
320
320
  }
321
- function v(z) {
321
+ function I(z) {
322
322
  var W = z.split("|"), q = W[2].split(" "), d = W[3].split(""), R = W[4].split(" ");
323
- return V(q), V(d), V(R), E(R, d.length), {
323
+ return t(q), t(d), t(R), m(R, d.length), {
324
324
  name: W[0],
325
- abbrs: t(W[1].split(" "), d),
326
- offsets: t(q, d),
325
+ abbrs: V(W[1].split(" "), d),
326
+ offsets: V(q, d),
327
327
  untils: R,
328
328
  population: W[5] | 0
329
329
  };
330
330
  }
331
- function g(z) {
332
- z && this._set(v(z));
331
+ function w(z) {
332
+ z && this._set(I(z));
333
333
  }
334
- function F(z, W) {
334
+ function j(z, W) {
335
335
  var q = W.length;
336
336
  if (z < W[0])
337
337
  return 0;
@@ -343,13 +343,13 @@ var W0 = { exports: {} };
343
343
  d = Math.floor((R + T) / 2), W[d] <= z ? R = d : T = d;
344
344
  return T;
345
345
  }
346
- g.prototype = {
346
+ w.prototype = {
347
347
  _set: function(z) {
348
348
  this.name = z.name, this.abbrs = z.abbrs, this.untils = z.untils, this.offsets = z.offsets, this.population = z.population;
349
349
  },
350
350
  _index: function(z) {
351
351
  var W = +z, q = this.untils, d;
352
- if (d = F(W, q), d >= 0)
352
+ if (d = j(W, q), d >= 0)
353
353
  return d;
354
354
  },
355
355
  countries: function() {
@@ -369,47 +369,47 @@ var W0 = { exports: {} };
369
369
  return this.abbrs[this._index(z)];
370
370
  },
371
371
  offset: function(z) {
372
- return w("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(z)];
372
+ return H("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(z)];
373
373
  },
374
374
  utcOffset: function(z) {
375
375
  return this.offsets[this._index(z)];
376
376
  }
377
377
  };
378
- function C(z, W) {
378
+ function F(z, W) {
379
379
  this.name = z, this.zones = W;
380
380
  }
381
- function l(z) {
381
+ function Z(z) {
382
382
  var W = z.toTimeString(), q = W.match(/\([a-z ]+\)/i);
383
383
  q && q[0] ? (q = q[0].match(/[A-Z]/g), q = q ? q.join("") : void 0) : (q = W.match(/[A-Z]{3,5}/g), q = q ? q[0] : void 0), q === "GMT" && (q = void 0), this.at = +z, this.abbr = q, this.offset = z.getTimezoneOffset();
384
384
  }
385
- function _(z) {
385
+ function P(z) {
386
386
  this.zone = z, this.offsetScore = 0, this.abbrScore = 0;
387
387
  }
388
- _.prototype.scoreOffsetAt = function(z) {
388
+ P.prototype.scoreOffsetAt = function(z) {
389
389
  this.offsetScore += Math.abs(this.zone.utcOffset(z.at) - z.offset), this.zone.abbr(z.at).replace(/[^A-Z]/g, "") !== z.abbr && this.abbrScore++;
390
390
  };
391
- function m(z, W) {
391
+ function g(z, W) {
392
392
  for (var q, d; d = ((W.at - z.at) / 12e4 | 0) * 6e4; )
393
- q = new l(new Date(z.at + d)), q.offset === z.offset ? z = q : W = q;
393
+ q = new Z(new Date(z.at + d)), q.offset === z.offset ? z = q : W = q;
394
394
  return z;
395
395
  }
396
- function D() {
397
- var z = (/* @__PURE__ */ new Date()).getFullYear() - 2, W = new l(new Date(z, 0, 1)), q = W.offset, d = [W], R, T, u, r;
396
+ function E() {
397
+ var z = (/* @__PURE__ */ new Date()).getFullYear() - 2, W = new Z(new Date(z, 0, 1)), q = W.offset, d = [W], R, T, u, r;
398
398
  for (r = 1; r < 48; r++)
399
- u = new Date(z, r, 1).getTimezoneOffset(), u !== q && (T = new l(new Date(z, r, 1)), R = m(W, T), d.push(R), d.push(new l(new Date(R.at + 6e4))), W = T, q = u);
399
+ u = new Date(z, r, 1).getTimezoneOffset(), u !== q && (T = new Z(new Date(z, r, 1)), R = g(W, T), d.push(R), d.push(new Z(new Date(R.at + 6e4))), W = T, q = u);
400
400
  for (r = 0; r < 4; r++)
401
- d.push(new l(new Date(z + r, 0, 1))), d.push(new l(new Date(z + r, 6, 1)));
401
+ d.push(new Z(new Date(z + r, 0, 1))), d.push(new Z(new Date(z + r, 6, 1)));
402
402
  return d;
403
403
  }
404
- function I(z, W) {
404
+ function h(z, W) {
405
405
  return z.offsetScore !== W.offsetScore ? z.offsetScore - W.offsetScore : z.abbrScore !== W.abbrScore ? z.abbrScore - W.abbrScore : z.zone.population !== W.zone.population ? W.zone.population - z.zone.population : W.zone.name.localeCompare(z.zone.name);
406
406
  }
407
- function s(z, W) {
407
+ function G(z, W) {
408
408
  var q, d;
409
- for (V(W), q = 0; q < W.length; q++)
409
+ for (t(W), q = 0; q < W.length; q++)
410
410
  d = W[q], O[d] = O[d] || {}, O[d][z] = !0;
411
411
  }
412
- function B(z) {
412
+ function s(z) {
413
413
  var W = z.length, q = {}, d = [], R = {}, T, u, r, U;
414
414
  for (T = 0; T < W; T++)
415
415
  if (r = z[T].offset, !R.hasOwnProperty(r)) {
@@ -422,40 +422,40 @@ var W0 = { exports: {} };
422
422
  q.hasOwnProperty(T) && d.push(c[T]);
423
423
  return d;
424
424
  }
425
- function h() {
425
+ function B() {
426
426
  try {
427
427
  var z = Intl.DateTimeFormat().resolvedOptions().timeZone;
428
428
  if (z && z.length > 3) {
429
- var W = c[Q(z)];
429
+ var W = c[C(z)];
430
430
  if (W)
431
431
  return W;
432
- w("Moment Timezone found " + z + " from the Intl api, but did not have that data loaded.");
432
+ H("Moment Timezone found " + z + " from the Intl api, but did not have that data loaded.");
433
433
  }
434
434
  } catch {
435
435
  }
436
- var q = D(), d = q.length, R = B(q), T = [], u, r, U;
436
+ var q = E(), d = q.length, R = s(q), T = [], u, r, U;
437
437
  for (r = 0; r < R.length; r++) {
438
- for (u = new _(G(R[r])), U = 0; U < d; U++)
438
+ for (u = new P(D(R[r])), U = 0; U < d; U++)
439
439
  u.scoreOffsetAt(q[U]);
440
440
  T.push(u);
441
441
  }
442
- return T.sort(I), T.length > 0 ? T[0].zone.name : void 0;
442
+ return T.sort(h), T.length > 0 ? T[0].zone.name : void 0;
443
443
  }
444
444
  function K(z) {
445
- return (!o || z) && (o = h()), o;
445
+ return (!o || z) && (o = B()), o;
446
446
  }
447
- function Q(z) {
447
+ function C(z) {
448
448
  return (z || "").toLowerCase().replace(/\//g, "_");
449
449
  }
450
450
  function z0(z) {
451
451
  var W, q, d, R;
452
452
  for (typeof z == "string" && (z = [z]), W = 0; W < z.length; W++)
453
- d = z[W].split("|"), q = d[0], R = Q(q), p[R] = z[W], c[R] = q, s(R, d[2].split(" "));
453
+ d = z[W].split("|"), q = d[0], R = C(q), p[R] = z[W], c[R] = q, G(R, d[2].split(" "));
454
454
  }
455
- function G(z, W) {
456
- z = Q(z);
455
+ function D(z, W) {
456
+ z = C(z);
457
457
  var q = p[z], d;
458
- return q instanceof g ? q : typeof q == "string" ? (q = new g(q), p[z] = q, q) : A[z] && W !== G && (d = G(A[z], G)) ? (q = p[z] = new g(), q._set(d), q.name = c[z], q) : null;
458
+ return q instanceof w ? q : typeof q == "string" ? (q = new w(q), p[z] = q, q) : A[z] && W !== D && (d = D(A[z], D)) ? (q = p[z] = new w(), q._set(d), q.name = c[z], q) : null;
459
459
  }
460
460
  function o0() {
461
461
  var z, W = [];
@@ -469,13 +469,13 @@ var W0 = { exports: {} };
469
469
  function b0(z) {
470
470
  var W, q, d, R;
471
471
  for (typeof z == "string" && (z = [z]), W = 0; W < z.length; W++)
472
- q = z[W].split("|"), d = Q(q[0]), R = Q(q[1]), A[d] = R, c[d] = q[0], A[R] = d, c[R] = q[1];
472
+ q = z[W].split("|"), d = C(q[0]), R = C(q[1]), A[d] = R, c[d] = q[0], A[R] = d, c[R] = q[1];
473
473
  }
474
474
  function Y0(z) {
475
475
  var W, q, d, R;
476
476
  if (!(!z || !z.length))
477
477
  for (W = 0; W < z.length; W++)
478
- R = z[W].split("|"), q = R[0].toUpperCase(), d = R[1].split(" "), Y[q] = new C(
478
+ R = z[W].split("|"), q = R[0].toUpperCase(), d = R[1].split(" "), Y[q] = new F(
479
479
  q,
480
480
  d
481
481
  );
@@ -488,7 +488,7 @@ var W0 = { exports: {} };
488
488
  return null;
489
489
  var q = z.zones.sort();
490
490
  return W ? q.map(function(d) {
491
- var R = G(d);
491
+ var R = D(d);
492
492
  return {
493
493
  name: d,
494
494
  offset: R.utcOffset(/* @__PURE__ */ new Date())
@@ -499,21 +499,21 @@ var W0 = { exports: {} };
499
499
  z0(z.zones), b0(z.links), Y0(z.countries), S.dataVersion = z.version;
500
500
  }
501
501
  function x(z) {
502
- return x.didShowError || (x.didShowError = !0, w("moment.tz.zoneExists('" + z + "') has been deprecated in favor of !moment.tz.zone('" + z + "')")), !!G(z);
502
+ return x.didShowError || (x.didShowError = !0, H("moment.tz.zoneExists('" + z + "') has been deprecated in favor of !moment.tz.zone('" + z + "')")), !!D(z);
503
503
  }
504
504
  function M0(z) {
505
505
  var W = z._f === "X" || z._f === "x";
506
506
  return !!(z._a && z._tzm === void 0 && !W);
507
507
  }
508
- function w(z) {
508
+ function H(z) {
509
509
  typeof console < "u" && typeof console.error == "function" && console.error(z);
510
510
  }
511
511
  function S(z) {
512
512
  var W = Array.prototype.slice.call(arguments, 0, -1), q = arguments[arguments.length - 1], d = M.utc.apply(null, W), R;
513
- return !M.isMoment(z) && M0(d) && (R = G(q)) && d.add(R.parse(d), "minutes"), d.tz(q), d;
513
+ return !M.isMoment(z) && M0(d) && (R = D(q)) && d.add(R.parse(d), "minutes"), d.tz(q), d;
514
514
  }
515
- S.version = b, S.dataVersion = "", S._zones = p, S._links = A, S._names = c, S._countries = Y, S.add = z0, S.link = b0, S.load = X0, S.zone = G, S.zoneExists = x, S.guess = K, S.names = o0, S.Zone = g, S.unpack = v, S.unpackBase60 = N, S.needsOffset = M0, S.moveInvalidForward = !0, S.moveAmbiguousForward = !1, S.countries = q0, S.zonesForCountry = a0;
516
- var P = M.fn;
515
+ S.version = b, S.dataVersion = "", S._zones = p, S._links = A, S._names = c, S._countries = Y, S.add = z0, S.link = b0, S.load = X0, S.zone = D, S.zoneExists = x, S.guess = K, S.names = o0, S.Zone = w, S.unpack = I, S.unpackBase60 = N, S.needsOffset = M0, S.moveInvalidForward = !0, S.moveAmbiguousForward = !1, S.countries = q0, S.zonesForCountry = a0;
516
+ var _ = M.fn;
517
517
  M.tz = S, M.defaultZone = null, M.updateOffset = function(z, W) {
518
518
  var q = M.defaultZone, d;
519
519
  if (z._z === void 0 && (q && M0(z) && !z._isUTC && z.isValid() && (z._d = M.utc(z._a)._d, z.utc().add(q.parse(z), "minutes")), z._z = q), z._z)
@@ -522,11 +522,11 @@ var W0 = { exports: {} };
522
522
  z.utcOffset(-d, W), z._z = R;
523
523
  } else
524
524
  z.zone(d, W);
525
- }, P.tz = function(z, W) {
525
+ }, _.tz = function(z, W) {
526
526
  if (z) {
527
527
  if (typeof z != "string")
528
528
  throw new Error("Time zone name must be a string, got " + z + " [" + typeof z + "]");
529
- return this._z = G(z), this._z ? M.updateOffset(this, W) : w("Moment Timezone has no data for " + z + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
529
+ return this._z = D(z), this._z ? M.updateOffset(this, W) : H("Moment Timezone has no data for " + z + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
530
530
  }
531
531
  if (this._z)
532
532
  return this._z.name;
@@ -546,11 +546,11 @@ var W0 = { exports: {} };
546
546
  return arguments.length > 0 && (this._z = null), z.apply(this, arguments);
547
547
  };
548
548
  }
549
- P.zoneName = p0(P.zoneName), P.zoneAbbr = p0(P.zoneAbbr), P.utc = O0(P.utc), P.local = O0(P.local), P.utcOffset = R0(P.utcOffset), M.tz.setDefault = function(z) {
550
- return (n < 2 || n === 2 && L < 9) && w("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = z ? G(z) : null, M;
549
+ _.zoneName = p0(_.zoneName), _.zoneAbbr = p0(_.zoneAbbr), _.utc = O0(_.utc), _.local = O0(_.local), _.utcOffset = R0(_.utcOffset), M.tz.setDefault = function(z) {
550
+ return (n < 2 || n === 2 && L < 9) && H("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = z ? D(z) : null, M;
551
551
  };
552
- var y = M.momentProperties;
553
- return Object.prototype.toString.call(y) === "[object Array]" ? (y.push("_z"), y.push("_a")) : y && (y._z = null), M;
552
+ var Q = M.momentProperties;
553
+ return Object.prototype.toString.call(Q) === "[object Array]" ? (Q.push("_z"), Q.push("_a")) : Q && (Q._z = null), M;
554
554
  });
555
555
  })(W0);
556
556
  var S0 = W0.exports;
@@ -1408,13 +1408,13 @@ const N0 = "2025a", U0 = [
1408
1408
  };
1409
1409
  var V0 = S0;
1410
1410
  V0.tz.load(t0);
1411
- let Z;
1411
+ let l;
1412
1412
  try {
1413
- Z = A0.getLogger("meteo2");
1413
+ l = A0.getLogger("meteo2");
1414
1414
  } catch {
1415
1415
  } finally {
1416
1416
  }
1417
- const $ = [
1417
+ const J = [
1418
1418
  {
1419
1419
  rank: 0,
1420
1420
  name: "Best Match",
@@ -1573,7 +1573,7 @@ const $ = [
1573
1573
  categories: "bom_access_global",
1574
1574
  variables: "temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"
1575
1575
  }
1576
- ], j = [
1576
+ ], $ = [
1577
1577
  {
1578
1578
  rank: 0,
1579
1579
  name: "Best Match",
@@ -1694,9 +1694,9 @@ const $ = [
1694
1694
  ];
1695
1695
  class G0 {
1696
1696
  constructor(M, b) {
1697
- H(this, "apikey");
1698
- H(this, "debug");
1699
- H(this, "FORECAST", {
1697
+ v(this, "apikey");
1698
+ v(this, "debug");
1699
+ v(this, "FORECAST", {
1700
1700
  OM_URL: "https://customer-api.open-meteo.com/v1/forecast",
1701
1701
  ORM_URL: "https://meteo2.idmwx.com/v1/forecast",
1702
1702
  OM_HISTORY_URL: "https://customer-historical-forecast-api.open-meteo.com/v1/forecast",
@@ -1713,20 +1713,20 @@ class G0 {
1713
1713
  HOURLY: "wave_height,wave_direction,wave_period,wind_wave_height,wind_wave_direction,wind_wave_period,wind_wave_peak_period,swell_wave_height,swell_wave_direction,swell_wave_period,swell_wave_peak_period,ocean_current_velocity,ocean_current_direction,sea_level_height_msl,sea_surface_temperature"
1714
1714
  }
1715
1715
  });
1716
- H(this, "HISTORICAL", {
1716
+ v(this, "HISTORICAL", {
1717
1717
  OM_URL: "https://customer-archive-api.open-meteo.com/v1/archive",
1718
1718
  WEATHER_VARIABLES: {
1719
1719
  HOURLY: "temperature_2m,apparent_temperature,precipitation,weather_code,pressure_msl,surface_pressure,wind_speed_10m,wind_direction_10m,wind_gusts_10m",
1720
1720
  DAILY: "weather_code,temperature_2m_max,temperature_2m_min,temperature_2m_mean,precipitation_sum,precipitation_hours,wind_speed_10m_max,wind_gusts_10m_max,wind_direction_10m_dominant"
1721
1721
  }
1722
1722
  });
1723
- H(this, "CLIMATE", {
1723
+ v(this, "CLIMATE", {
1724
1724
  OM_URL: "https://customer-climate-api.open-meteo.com/v1/climate",
1725
1725
  WEATHER_VARIABLES: {
1726
1726
  DAILY: "temperature_2m_mean,temperature_2m_max,temperature_2m_min,wind_speed_10m_mean,wind_speed_10m_max,relative_humidity_2m_mean,relative_humidity_2m_max,relative_humidity_2m_min,precipitation_sum"
1727
1727
  }
1728
1728
  });
1729
- H(this, "SEASONAL", {
1729
+ v(this, "SEASONAL", {
1730
1730
  OM_URL: "https://seasonal-api.open-meteo.com/v1/seasonal",
1731
1731
  WEATHER_VARIABLES: {
1732
1732
  DAILY: "temperature_2m_max,temperature_2m_min,precipitation_sum,precipitation_hours,wind_direction_10m_dominant,wind_speed_10m_max",
@@ -1736,28 +1736,28 @@ class G0 {
1736
1736
  this.apikey = M || "smE3JnDLHy3TizVv", this.debug = b;
1737
1737
  }
1738
1738
  async standardWeatherModels() {
1739
- return $.filter((M) => !M.disabled && M.alias);
1739
+ return J.filter((M) => !M.disabled && M.alias);
1740
1740
  }
1741
1741
  async standardMarineModels() {
1742
- return j.filter((M) => !M.disabled && M.alias);
1742
+ return $.filter((M) => !M.disabled && M.alias);
1743
1743
  }
1744
1744
  async autoPickMeteoModel(M = "best_match") {
1745
1745
  var A, Y;
1746
1746
  M = M.toLowerCase();
1747
- let b = $.find((c) => {
1747
+ let b = J.find((c) => {
1748
1748
  var O, o, X;
1749
1749
  return ((O = c.models) == null ? void 0 : O.includes(M)) || ((o = c.alias) == null ? void 0 : o.toLowerCase()) === M || ((X = c.name) == null ? void 0 : X.toLowerCase()) === M;
1750
- }), p = j.find((c) => {
1750
+ }), p = $.find((c) => {
1751
1751
  var O, o, X;
1752
1752
  return ((O = c.models) == null ? void 0 : O.includes(M)) || ((o = c.alias) == null ? void 0 : o.toLowerCase()) === M || ((X = c.name) == null ? void 0 : X.toLowerCase()) === M;
1753
1753
  });
1754
- return b = b || $.find((c) => {
1754
+ return b = b || J.find((c) => {
1755
1755
  var O, o;
1756
1756
  return ((O = c.alias) == null ? void 0 : O.toLowerCase()) === ((o = p == null ? void 0 : p.alias) == null ? void 0 : o.toLowerCase());
1757
- }), p = p || j.find((c) => {
1757
+ }), p = p || $.find((c) => {
1758
1758
  var O, o;
1759
1759
  return ((O = c.alias) == null ? void 0 : O.toLowerCase()) === ((o = b == null ? void 0 : b.alias) == null ? void 0 : o.toLowerCase());
1760
- }), b = b || $[0], p = p || j[0], {
1760
+ }), b = b || J[0], p = p || $[0], {
1761
1761
  weatherModels: (A = b.models) != null && A.includes(M) ? M : b.model,
1762
1762
  marineModels: (Y = p.models) != null && Y.includes(M) ? M : p.model
1763
1763
  };
@@ -1778,24 +1778,24 @@ class G0 {
1778
1778
  for (let c = 0; c < M.start_dates.length; c++) {
1779
1779
  M.start_date = M.start_dates[c], M.end_date = M.end_dates[c], M.fake = M.fakes[c];
1780
1780
  const O = M.url[c];
1781
- this.debug && Z.debug("[%s] fetch weather via %s with %j", b.requestId, O, {
1781
+ this.debug && l.debug("[%s] fetch weather via %s with %j", b.requestId, O, {
1782
1782
  start_date: M.start_date,
1783
1783
  end_date: M.end_date,
1784
1784
  fake: M.fake,
1785
1785
  step: c
1786
1786
  });
1787
- const o = await J(O, M), X = await this.parseWeatherData(o, M, b);
1787
+ const o = await k(O, M), X = await this.parseWeatherData(o, M, b);
1788
1788
  A ? await this.mergeSegments(A, X) : A = X;
1789
1789
  }
1790
1790
  else {
1791
- const c = await J(M.url, M);
1791
+ const c = await k(M.url, M);
1792
1792
  A = await this.parseWeatherData(c, M, b);
1793
1793
  }
1794
1794
  delete M.apikey;
1795
1795
  const Y = e();
1796
- return this.debug && Z.info("[%s] fetch weather api (%j) cost: %d ms", b.requestId, M.url, Y.diff(p, "ms")), A;
1796
+ return this.debug && l.info("[%s] fetch weather api (%j) cost: %d ms", b.requestId, M.url, Y.diff(p, "ms")), A;
1797
1797
  } catch (p) {
1798
- return Z.warn("[%s] weather forecast failed: %s, with %j", b.requestId, p, M), [];
1798
+ return l.warn("[%s] weather forecast failed: %s, with %j", b.requestId, p, M), [];
1799
1799
  }
1800
1800
  }
1801
1801
  /**
@@ -1822,24 +1822,24 @@ class G0 {
1822
1822
  for (let c = 0; c < M.start_dates.length; c++) {
1823
1823
  M.start_date = M.start_dates[c], M.end_date = M.end_dates[c], M.fake = M.fakes[c];
1824
1824
  const O = M.url[c];
1825
- this.debug && Z.debug("[%s] fetch marine via %s with %j", b.requestId, O, {
1825
+ this.debug && l.debug("[%s] fetch marine via %s with %j", b.requestId, O, {
1826
1826
  start_date: M.start_date,
1827
1827
  end_date: M.end_date,
1828
1828
  fake: M.fake,
1829
1829
  step: c
1830
1830
  });
1831
- const o = await J(O, M), X = await this.parseWeatherData(o, M, b);
1831
+ const o = await k(O, M), X = await this.parseWeatherData(o, M, b);
1832
1832
  A ? await this.mergeSegments(A, X) : A = X;
1833
1833
  }
1834
1834
  else {
1835
- const c = await J(M.url, M);
1835
+ const c = await k(M.url, M);
1836
1836
  A = await this.parseWeatherData(c, M, b);
1837
1837
  }
1838
1838
  delete M.apikey;
1839
1839
  const Y = e();
1840
- return this.debug && Z.info("[%s] fetch marine api (%j) cost: %d ms", b.requestId, M.url, Y.diff(p, "ms")), this.mergeMarineData(A);
1840
+ return this.debug && l.info("[%s] fetch marine api (%j) cost: %d ms", b.requestId, M.url, Y.diff(p, "ms")), this.mergeMarineData(A);
1841
1841
  } catch (p) {
1842
- return Z.warn("[%s] marine forecast failed: %s, with %j", b.requestId, p, M), [];
1842
+ return l.warn("[%s] marine forecast failed: %s, with %j", b.requestId, p, M), [];
1843
1843
  }
1844
1844
  }
1845
1845
  /**
@@ -1850,67 +1850,67 @@ class G0 {
1850
1850
  * @private
1851
1851
  */
1852
1852
  async parseWeatherData(M, b, p = {}) {
1853
- var c, O, o, X, n, L, a, N, V;
1853
+ var c, O, o, X, n, L, a, N, t, m;
1854
1854
  const A = [], Y = Math.pow(10, p.precision || 6);
1855
- for (let E = 0; E < M.length; E++) {
1856
- const t = M[E], v = t.utcOffsetSeconds(), g = t.timezone(), F = t.current(), C = t.hourly(), l = t.sixHourly(), _ = t.daily(), m = {};
1857
- if (m.timezone = g || void 0, m.offset = this.prettyTimezoneOffset(v), m.model = b.models[E], F) {
1858
- const D = e();
1859
- m.current = {
1855
+ for (let V = 0; V < M.length; V++) {
1856
+ const I = M[V], w = I.utcOffsetSeconds(), j = I.timezone(), F = I.current(), Z = I.hourly(), P = I.sixHourly(), g = I.daily(), E = {};
1857
+ if (E.timezone = j || void 0, E.offset = this.prettyTimezoneOffset(w), E.model = b.models instanceof Array ? (c = b.models) == null ? void 0 : c[V] : b.models || "best_match", F) {
1858
+ const h = e();
1859
+ E.current = {
1860
1860
  time: e.unix(Number(F.time())).utc().format()
1861
1861
  };
1862
1862
  for (let s = 0; s < F.variablesLength(); s++) {
1863
1863
  const B = F.variables(s).value();
1864
- m.current[b.current[s]] = isNaN(B) ? null : Math.round(B * Y) / Y;
1864
+ E.current[b.current[s]] = isNaN(B) ? null : Math.round(B * Y) / Y;
1865
1865
  }
1866
- const I = e();
1867
- this.debug && Z.debug("[%s] fetch current variables cost: %d ms", p.requestId, I.diff(D, "ms"));
1866
+ const G = e();
1867
+ this.debug && l.debug("[%s] fetch current variables cost: %d ms", p.requestId, G.diff(h, "ms"));
1868
1868
  }
1869
- if (C) {
1870
- const D = e(), I = e.unix(Number(C.time())).add(b.fake ? 1 : 0, "year");
1871
- m.hourly = {
1872
- date: I.utc().format(),
1873
- time: this.range(Number(C.time()), Number(C.timeEnd()), C.interval()).map(
1874
- (B) => e.unix(B).add(b.fake ? 1 : 0, "year").diff(I, "h")
1869
+ if (Z) {
1870
+ const h = e(), G = e.unix(Number(Z.time())).add(b.fake ? 1 : 0, "year");
1871
+ E.hourly = {
1872
+ date: G.utc().format(),
1873
+ time: this.range(Number(Z.time()), Number(Z.timeEnd()), Z.interval()).map(
1874
+ (B) => e.unix(B).add(b.fake ? 1 : 0, "year").diff(G, "h")
1875
1875
  )
1876
1876
  };
1877
- for (let B = 0; B < C.variablesLength(); B++) {
1878
- const h = (o = (O = (c = C.variables(B).valuesArray()) == null ? void 0 : c.toString()) == null ? void 0 : O.split(",")) == null ? void 0 : o.map((K) => isNaN(K) ? null : Math.round(Number(K) * Y) / Y);
1879
- m.hourly[b.hourly[B]] = h;
1877
+ for (let B = 0; B < Z.variablesLength(); B++) {
1878
+ const K = (X = (o = (O = Z.variables(B).valuesArray()) == null ? void 0 : O.toString()) == null ? void 0 : o.split(",")) == null ? void 0 : X.map((C) => isNaN(C) ? null : Math.round(Number(C) * Y) / Y);
1879
+ E.hourly[b.hourly[B]] = K;
1880
1880
  }
1881
1881
  const s = e();
1882
- this.debug && Z.debug("[%s] fetch hourly variables cost: %d ms", p.requestId, s.diff(D, "ms"));
1882
+ this.debug && l.debug("[%s] fetch hourly variables cost: %d ms", p.requestId, s.diff(h, "ms"));
1883
1883
  }
1884
- if (l) {
1885
- const D = e(), I = e.unix(Number(l.time())).add(b.fake ? 1 : 0, "year");
1886
- m.sixHourly = {
1887
- date: I.utc().format(),
1888
- time: this.range(Number(l.time()), Number(l.timeEnd()), l.interval()).map(
1889
- (B) => e.unix(B).add(b.fake ? 1 : 0, "year").diff(I, "h")
1884
+ if (P) {
1885
+ const h = e(), G = e.unix(Number(P.time())).add(b.fake ? 1 : 0, "year");
1886
+ E.sixHourly = {
1887
+ date: G.utc().format(),
1888
+ time: this.range(Number(P.time()), Number(P.timeEnd()), P.interval()).map(
1889
+ (B) => e.unix(B).add(b.fake ? 1 : 0, "year").diff(G, "h")
1890
1890
  )
1891
1891
  };
1892
- for (let B = 0; B < l.variablesLength(); B += p.memberLength ?? 1) {
1893
- const h = (L = (n = (X = l.variables(B).valuesArray()) == null ? void 0 : X.toString()) == null ? void 0 : n.split(",")) == null ? void 0 : L.map((K) => isNaN(K) ? null : Math.round(Number(K) * Y) / Y);
1894
- l.variables(B), m.sixHourly[b.six_hourly[B / (p.memberLength ?? 1)]] = h;
1892
+ for (let B = 0; B < P.variablesLength(); B += p.memberLength ?? 1) {
1893
+ const K = (a = (L = (n = P.variables(B).valuesArray()) == null ? void 0 : n.toString()) == null ? void 0 : L.split(",")) == null ? void 0 : a.map((C) => isNaN(C) ? null : Math.round(Number(C) * Y) / Y);
1894
+ P.variables(B), E.sixHourly[b.six_hourly[B / (p.memberLength ?? 1)]] = K;
1895
1895
  }
1896
1896
  const s = e();
1897
- this.debug && Z.debug("[%s] fetch 6-hourly variables cost: %d ms", p.requestId, s.diff(D, "ms"));
1897
+ this.debug && l.debug("[%s] fetch 6-hourly variables cost: %d ms", p.requestId, s.diff(h, "ms"));
1898
1898
  }
1899
- if (_) {
1900
- const D = e();
1901
- m.daily = {
1902
- time: this.range(Number(_.time()), Number(_.timeEnd()), _.interval()).map(
1899
+ if (g) {
1900
+ const h = e();
1901
+ E.daily = {
1902
+ time: this.range(Number(g.time()), Number(g.timeEnd()), g.interval()).map(
1903
1903
  (s) => e.unix(s).add(b.fake ? 1 : 0, "year").utc().format()
1904
1904
  )
1905
1905
  };
1906
- for (let s = 0; s < _.variablesLength(); s += p.memberLength ?? 1) {
1907
- const B = (V = (N = (a = _.variables(s).valuesArray()) == null ? void 0 : a.toString()) == null ? void 0 : N.split(",")) == null ? void 0 : V.map((h) => isNaN(h) ? null : Math.round(Number(h) * Y) / Y);
1908
- m.daily[b.daily[s / (p.memberLength ?? 1)]] = B;
1906
+ for (let s = 0; s < g.variablesLength(); s += p.memberLength ?? 1) {
1907
+ const B = (m = (t = (N = g.variables(s).valuesArray()) == null ? void 0 : N.toString()) == null ? void 0 : t.split(",")) == null ? void 0 : m.map((K) => isNaN(K) ? null : Math.round(Number(K) * Y) / Y);
1908
+ E.daily[b.daily[s / (p.memberLength ?? 1)]] = B;
1909
1909
  }
1910
- const I = e();
1911
- this.debug && Z.debug("[%s] fetch daily variables cost: %d ms", p.requestId, I.diff(D, "ms"));
1910
+ const G = e();
1911
+ this.debug && l.debug("[%s] fetch daily variables cost: %d ms", p.requestId, G.diff(h, "ms"));
1912
1912
  }
1913
- A.push(m);
1913
+ A.push(E);
1914
1914
  }
1915
1915
  return A;
1916
1916
  }
@@ -2030,8 +2030,8 @@ class G0 {
2030
2030
  precision: 6,
2031
2031
  selfHosted: !0
2032
2032
  }) {
2033
- var N, V, E;
2034
- b = this.toStdLng(b), this.debug && Z.info("[%s] spot forecast params: %j", O.requestId, { lat: M, lng: b, datetime: p, simplify: A, withDaily: Y, withHourly: c, options: O });
2033
+ var N, t, m;
2034
+ b = this.toStdLng(b), this.debug && l.info("[%s] spot forecast params: %j", O.requestId, { lat: M, lng: b, datetime: p, simplify: A, withDaily: Y, withHourly: c, options: O });
2035
2035
  const o = {
2036
2036
  apikey: this.apikey,
2037
2037
  latitude: M,
@@ -2043,10 +2043,10 @@ class G0 {
2043
2043
  };
2044
2044
  let X;
2045
2045
  if (p) {
2046
- const t = this.timezoneOffset(M, b);
2047
- X = e.utc(p).utcOffset(t), X.subtract(t > 0 ? t : -t, "h");
2046
+ const V = this.timezoneOffset(M, b);
2047
+ X = e.utc(p).utcOffset(V), X.subtract(V > 0 ? V : -V, "h");
2048
2048
  }
2049
- Y && (o.daily = ((V = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : V.split(",")) || []), X || (O.forecastDays = O.forecastDays || 1, O.pastDays = 0, c = !0), c && (o.hourly = ((E = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : E.split(",")) || []), O.pastDays = O.pastDays || 0, O.pastDays = O.pastDays > 7 ? 7 : O.pastDays < 0 ? 0 : O.pastDays, O.forecastDays = O.forecastDays ?? 1, O.forecastDays = O.forecastDays > 14 ? 14 : O.forecastDays < 0 ? 1 : O.forecastDays, this.prepare(X == null ? void 0 : X.utc().format(), !1, o, O);
2049
+ Y && (o.daily = ((t = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : t.split(",")) || []), X || (O.forecastDays = O.forecastDays || 1, O.pastDays = 0, c = !0), c && (o.hourly = ((m = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : m.split(",")) || []), O.pastDays = O.pastDays || 0, O.pastDays = O.pastDays > 7 ? 7 : O.pastDays < 0 ? 0 : O.pastDays, O.forecastDays = O.forecastDays ?? 1, O.forecastDays = O.forecastDays > 14 ? 14 : O.forecastDays < 0 ? 1 : O.forecastDays, this.prepare(X == null ? void 0 : X.utc().format(), !1, o, O);
2050
2050
  const n = await this.weatherForecast(o, O), L = {
2051
2051
  apikey: this.apikey,
2052
2052
  latitude: M,
@@ -2084,8 +2084,8 @@ class G0 {
2084
2084
  async spotHistorical(M, b, p, A, Y = !0, c = !0, O = !1, o = {
2085
2085
  precision: 6
2086
2086
  }) {
2087
- var E, t;
2088
- b = this.toStdLng(b), this.debug && Z.info("[%s] spot historical params: %j", o.requestId, { lat: M, lng: b, startDate: p, endDate: A, withMarine: O, options: o });
2087
+ var m, V;
2088
+ b = this.toStdLng(b), this.debug && l.info("[%s] spot historical params: %j", o.requestId, { lat: M, lng: b, startDate: p, endDate: A, withMarine: O, options: o });
2089
2089
  const X = this.timezoneOffset(M, b), n = e.utc(p).utcOffset(X), L = e.utc(A).utcOffset(X);
2090
2090
  n.subtract(X > 0 ? X : -X, "h"), L.subtract(X > 0 ? X : -X, "h");
2091
2091
  const a = {
@@ -2094,7 +2094,7 @@ class G0 {
2094
2094
  longitude: b,
2095
2095
  cell_selection: "sea",
2096
2096
  wind_speed_unit: "kn",
2097
- models: ((E = o.weatherModels) == null ? void 0 : E.split(",")) || ["best_match"],
2097
+ models: ((m = o.weatherModels) == null ? void 0 : m.split(",")) || ["best_match"],
2098
2098
  timezone: "auto",
2099
2099
  url: this.HISTORICAL.OM_URL,
2100
2100
  start_date: n.format("YYYY-MM-DD"),
@@ -2102,25 +2102,25 @@ class G0 {
2102
2102
  };
2103
2103
  Y && (a.daily = this.HISTORICAL.WEATHER_VARIABLES.DAILY.split(",")), c && (a.hourly = this.HISTORICAL.WEATHER_VARIABLES.HOURLY.split(","));
2104
2104
  const N = await this.weatherForecast(a, o);
2105
- let V;
2105
+ let t;
2106
2106
  if (O) {
2107
- const v = {
2107
+ const I = {
2108
2108
  apikey: this.apikey,
2109
2109
  latitude: M,
2110
2110
  longitude: b,
2111
2111
  cell_selection: "sea",
2112
2112
  timezone: "auto",
2113
2113
  wind_speed_unit: "kn",
2114
- models: ((t = o.marineModels) == null ? void 0 : t.split(",")) || ["best_match"],
2114
+ models: ((V = o.marineModels) == null ? void 0 : V.split(",")) || ["best_match"],
2115
2115
  daily: this.FORECAST.MARINE_VARIABLES.DAILY.split(","),
2116
2116
  hourly: this.FORECAST.MARINE_VARIABLES.HOURLY.split(","),
2117
2117
  url: this.FORECAST.OM_MARINE_URL,
2118
2118
  start_date: n.format("YYYY-MM-DD"),
2119
2119
  end_date: L.format("YYYY-MM-DD")
2120
2120
  };
2121
- V = await this.marineForecast(v, o);
2121
+ t = await this.marineForecast(I, o);
2122
2122
  }
2123
- return { weather: N, marine: V };
2123
+ return { weather: N, marine: t };
2124
2124
  }
2125
2125
  /**
2126
2126
  * 季节预报数据
@@ -2136,7 +2136,7 @@ class G0 {
2136
2136
  async spotSeasonal(M, b, p, A, Y = !1, c = {
2137
2137
  precision: 6
2138
2138
  }) {
2139
- b = this.toStdLng(b), this.debug && Z.info("[%s] spot seasonal params: %j", c.requestId, { lat: M, lng: b, startDate: p, endDate: A, options: c });
2139
+ b = this.toStdLng(b), this.debug && l.info("[%s] spot seasonal params: %j", c.requestId, { lat: M, lng: b, startDate: p, endDate: A, options: c });
2140
2140
  const O = this.timezoneOffset(M, b), o = e.utc(p).utcOffset(O), X = A ? e.utc(A).utcOffset(O) : o.clone().add(1, "month");
2141
2141
  o.subtract(O > 0 ? O : -O, "h"), X.subtract(O > 0 ? O : -O, "h");
2142
2142
  const n = {
@@ -2177,7 +2177,7 @@ class G0 {
2177
2177
  precision: 6
2178
2178
  }) {
2179
2179
  var L;
2180
- b = this.toStdLng(b), this.debug && Z.info("[%s] spot climate params: %j", Y.requestId, { lat: M, lng: b, startDate: p, endDate: A, options: Y });
2180
+ b = this.toStdLng(b), this.debug && l.info("[%s] spot climate params: %j", Y.requestId, { lat: M, lng: b, startDate: p, endDate: A, options: Y });
2181
2181
  const c = this.timezoneOffset(M, b), O = e.utc(p).utcOffset(c), o = A ? e.utc(A).utcOffset(c) : O.clone().add(1, "day");
2182
2182
  o.subtract(c > 0 ? c : -c, "h"), O.subtract(c > 0 ? c : -c, "h");
2183
2183
  const X = {
@@ -2197,9 +2197,9 @@ class G0 {
2197
2197
  }
2198
2198
  }
2199
2199
  export {
2200
- j as MARINE_MODELS,
2200
+ $ as MARINE_MODELS,
2201
2201
  P0 as MeteoHelper,
2202
2202
  G0 as MeteoHelper2,
2203
- $ as WEATHER_MODELS,
2203
+ J as WEATHER_MODELS,
2204
2204
  L0 as WindyModel
2205
2205
  };