@idm-plugin/meteo2 0.4.5 → 0.4.7

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
@@ -2,9 +2,9 @@ var L0 = Object.defineProperty;
2
2
  var n0 = (e, M, b) => M in e ? L0(e, M, { enumerable: !0, configurable: !0, writable: !0, value: b }) : e[M] = b;
3
3
  var g = (e, M, b) => (n0(e, typeof M != "symbol" ? M + "" : M, b), b);
4
4
  import M0 from "@log4js-node/log4js-api";
5
- import L from "moment";
6
- import $ from "got";
7
- import { fetchWeatherApi as v } from "openmeteo";
5
+ import n from "moment";
6
+ import v from "got";
7
+ import { fetchWeatherApi as $ } from "openmeteo";
8
8
  import { Meteo2Assist as k } from "@idm-plugin/meteo";
9
9
  let r;
10
10
  try {
@@ -25,24 +25,24 @@ class m0 {
25
25
  */
26
26
  static async queryPointMeteo(M, b, p, O = !1, o = "", Y = {}) {
27
27
  typeof p == "number" && (p = p < 1e12 ? p * 1e3 : p);
28
- const A = L(p), q = {
28
+ const W = n(p), q = {
29
29
  searchParams: {
30
30
  lng: M,
31
31
  lat: b,
32
- ts: A.valueOf(),
32
+ ts: W.valueOf(),
33
33
  params: O ? "watertemp" : void 0,
34
34
  source: o == null ? void 0 : o.toLowerCase()
35
35
  },
36
36
  timeout: 3e4
37
- }, X = L(), R = X.valueOf();
38
- A.isBefore(X.subtract(1, "month")) && (r == null || r.warn("[%s] get history meteo on %s: %j", Y.requestId, A.format(), q));
39
- const T = "https://aod4idm.idmwx.com/api/ocean/point", d = await $.get(T, q).json(), N = L().valueOf();
40
- if (r == null || r.info("[%s] get meteo(cost: %d ms) from %s with options: %j", Y.requestId, N - R, T, q), (d == null ? void 0 : d.code) === 0)
37
+ }, d = n(), R = d.valueOf();
38
+ W.isBefore(d.subtract(1, "month")) && (r == null || r.warn("[%s] get history meteo on %s: %j", Y.requestId, W.format(), q));
39
+ const L = "https://aod4idm.idmwx.com/api/ocean/point", a = await v.get(L, q).json(), N = n().valueOf();
40
+ if (r == null || r.info("[%s] get meteo(cost: %d ms) from %s with options: %j", Y.requestId, N - R, L, q), (a == null ? void 0 : a.code) === 0)
41
41
  return {
42
- ...d.data,
42
+ ...a.data,
43
43
  source: o
44
44
  };
45
- r == null || r.warn("[%s] get meteo failed: %j", Y.requestId, d);
45
+ r == null || r.warn("[%s] get meteo failed: %j", Y.requestId, a);
46
46
  }
47
47
  /**
48
48
  * 点查海洋气象要素(指定要素组合)
@@ -60,24 +60,24 @@ class m0 {
60
60
  */
61
61
  static async queryPointFactor(M, b, p, O = "wind,wave,current,watertemp,visibility", o = "", Y = {}) {
62
62
  typeof p == "number" && (p = p < 1e12 ? p * 1e3 : p);
63
- const A = L(p), q = {
63
+ const W = n(p), q = {
64
64
  searchParams: {
65
65
  lng: M,
66
66
  lat: b,
67
- ts: A.valueOf(),
67
+ ts: W.valueOf(),
68
68
  params: O,
69
69
  source: o == null ? void 0 : o.toLowerCase()
70
70
  },
71
71
  timeout: 3e4
72
- }, X = L(), R = X.valueOf();
73
- A.isBefore(X.subtract(1, "month")) && (r == null || r.warn("[%s] get history factors on %s: %j", Y.requestId, A.format(), q));
74
- const T = "https://aod4idm.idmwx.com/api/ocean/factor", d = await $.get(T, q).json(), N = L().valueOf();
75
- if (r == null || r.info("[%s] get factors(cost: %d ms) from %s with options: %j", Y.requestId, N - R, T, q), (d == null ? void 0 : d.code) === 0)
72
+ }, d = n(), R = d.valueOf();
73
+ W.isBefore(d.subtract(1, "month")) && (r == null || r.warn("[%s] get history factors on %s: %j", Y.requestId, W.format(), q));
74
+ const L = "https://aod4idm.idmwx.com/api/ocean/factor", a = await v.get(L, q).json(), N = n().valueOf();
75
+ if (r == null || r.info("[%s] get factors(cost: %d ms) from %s with options: %j", Y.requestId, N - R, L, q), (a == null ? void 0 : a.code) === 0)
76
76
  return {
77
- ...d.data,
77
+ ...a.data,
78
78
  source: o
79
79
  };
80
- r == null || r.warn("[%s] get factors failed: %j", Y.requestId, d);
80
+ r == null || r.warn("[%s] get factors failed: %j", Y.requestId, a);
81
81
  }
82
82
  /**
83
83
  * @see https://api.windy.com/point-forecast/docs
@@ -86,8 +86,8 @@ class m0 {
86
86
  static async queryWindyPointForecast(M, b, p, O = {}) {
87
87
  const o = "https://api.windy.com/api/point-forecast/v2", Y = [];
88
88
  try {
89
- let A = L().valueOf();
90
- const q = await $.post(o, {
89
+ let W = n().valueOf();
90
+ const q = await v.post(o, {
91
91
  headers: {
92
92
  "Content-Type": "application/json"
93
93
  },
@@ -116,9 +116,9 @@ class m0 {
116
116
  levels: ["surface"]
117
117
  }
118
118
  }).json();
119
- let X = L().valueOf();
120
- r == null || r.info("[%s] get gfs-factors(cost: %d ms) from %s", O.requestId, X - A, o), A = X;
121
- const R = await $.post(o, {
119
+ let d = n().valueOf();
120
+ r == null || r.info("[%s] get gfs-factors(cost: %d ms) from %s", O.requestId, d - W, o), W = d;
121
+ const R = await v.post(o, {
122
122
  headers: {
123
123
  "Content-Type": "application/json"
124
124
  },
@@ -131,36 +131,36 @@ class m0 {
131
131
  levels: ["surface"]
132
132
  }
133
133
  }).json();
134
- X = L().valueOf(), r == null || r.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", O.requestId, X - A, o);
135
- for (let d = 0; d < q.ts.length; d++) {
136
- const N = this.populateUVFactor(q["wind_u-surface"][d], q["wind_v-surface"][d], !1, O);
134
+ d = n().valueOf(), r == null || r.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", O.requestId, d - W, o);
135
+ for (let a = 0; a < q.ts.length; a++) {
136
+ const N = this.populateUVFactor(q["wind_u-surface"][a], q["wind_v-surface"][a], !1, O);
137
137
  N.scale = this.calculateBeaufortWindForceScale(N.speed), Y.push({
138
- utc: L(q.ts[d]).utc().format(),
139
- temp: q["temp-surface"][d] ? Math.round((q["temp-surface"][d] - 273.15) * 100) / 100 : void 0,
140
- dp_temp: q["dewpoint-surface"][d] ? Math.round((q["dewpoint-surface"][d] - 273.15) * 100) / 100 : void 0,
138
+ utc: n(q.ts[a]).utc().format(),
139
+ temp: q["temp-surface"][a] ? Math.round((q["temp-surface"][a] - 273.15) * 100) / 100 : void 0,
140
+ dp_temp: q["dewpoint-surface"][a] ? Math.round((q["dewpoint-surface"][a] - 273.15) * 100) / 100 : void 0,
141
141
  precip: {
142
- inter3h: q["past3hprecip-surface"][d] ? Math.round(q["past3hprecip-surface"][d] * 1e3 * 1e3) / 1e3 : 0,
143
- inter3hSnow: q["past3hsnowprecip-surface"][d] ? Math.round(q["past3hsnowprecip-surface"][d] * 1e3 * 1e3) / 1e3 : 0,
144
- inter3hConv: q["past3hconvprecip-surface"][d] ? Math.round(q["past3hconvprecip-surface"][d] * 1e3 * 1e3) / 1e3 : 0
142
+ inter3h: q["past3hprecip-surface"][a] ? Math.round(q["past3hprecip-surface"][a] * 1e3 * 1e3) / 1e3 : 0,
143
+ inter3hSnow: q["past3hsnowprecip-surface"][a] ? Math.round(q["past3hsnowprecip-surface"][a] * 1e3 * 1e3) / 1e3 : 0,
144
+ inter3hConv: q["past3hconvprecip-surface"][a] ? Math.round(q["past3hconvprecip-surface"][a] * 1e3 * 1e3) / 1e3 : 0
145
145
  },
146
146
  wind: N,
147
147
  gusts: {
148
- speed: Math.round((q["gust-surface"][d] || 0) * 100) / 100,
149
- kts: this.convertMs2Kts(q["gust-surface"][d])
148
+ speed: Math.round((q["gust-surface"][a] || 0) * 100) / 100,
149
+ kts: this.convertMs2Kts(q["gust-surface"][a])
150
150
  },
151
- lclouds: q["lclouds-surface"][d] ? Math.round(q["lclouds-surface"][d] * 100) / 100 : 0,
152
- mclouds: q["mclouds-surface"][d] ? Math.round(q["mclouds-surface"][d] * 100) / 100 : 0,
153
- hclouds: q["hclouds-surface"][d] ? Math.round(q["hclouds-surface"][d] * 100) / 100 : 0,
154
- rh: q["rh-surface"][d] ? Math.round(q["rh-surface"][d] * 100) / 100 : 0,
155
- gh: q["gh-surface"][d] ? Math.round(q["gh-surface"][d] * 100) / 100 : 0,
156
- pressure: Math.round(q["pressure-surface"][d] / 100 * 100) / 100
151
+ lclouds: q["lclouds-surface"][a] ? Math.round(q["lclouds-surface"][a] * 100) / 100 : 0,
152
+ mclouds: q["mclouds-surface"][a] ? Math.round(q["mclouds-surface"][a] * 100) / 100 : 0,
153
+ hclouds: q["hclouds-surface"][a] ? Math.round(q["hclouds-surface"][a] * 100) / 100 : 0,
154
+ rh: q["rh-surface"][a] ? Math.round(q["rh-surface"][a] * 100) / 100 : 0,
155
+ gh: q["gh-surface"][a] ? Math.round(q["gh-surface"][a] * 100) / 100 : 0,
156
+ pressure: Math.round(q["pressure-surface"][a] / 100 * 100) / 100
157
157
  });
158
158
  }
159
- const T = [];
160
- for (let d = 0; d < R.ts.length; d++) {
161
- const N = this.calculateDouglasScale(R["waves_height-surface"][d], R["waves_direction-surface"][d], R["waves_period-surface"][d]), S = this.calculateDouglasScale(R["wwaves_height-surface"][d], R["wwaves_direction-surface"][d], R["wwaves_period-surface"][d]), l = this.calculateDouglasScale(R["swell1_height-surface"][d], R["swell1_direction-surface"][d], R["swell1_period-surface"][d]), V = this.calculateDouglasScale(R["swell2_height-surface"][d], R["swell2_direction-surface"][d], R["swell2_period-surface"][d]);
162
- T.push({
163
- utc: L(R.ts[d]).utc().format(),
159
+ const L = [];
160
+ for (let a = 0; a < R.ts.length; a++) {
161
+ const N = this.calculateDouglasScale(R["waves_height-surface"][a], R["waves_direction-surface"][a], R["waves_period-surface"][a]), S = this.calculateDouglasScale(R["wwaves_height-surface"][a], R["wwaves_direction-surface"][a], R["wwaves_period-surface"][a]), l = this.calculateDouglasScale(R["swell1_height-surface"][a], R["swell1_direction-surface"][a], R["swell1_period-surface"][a]), V = this.calculateDouglasScale(R["swell2_height-surface"][a], R["swell2_direction-surface"][a], R["swell2_period-surface"][a]);
162
+ L.push({
163
+ utc: n(R.ts[a]).utc().format(),
164
164
  wave: {
165
165
  sig: N,
166
166
  wd: S,
@@ -169,12 +169,12 @@ class m0 {
169
169
  }
170
170
  });
171
171
  }
172
- for (const d of Y) {
173
- const N = T.find((S) => S.utc === d.utc);
174
- d.wave = N == null ? void 0 : N.wave;
172
+ for (const a of Y) {
173
+ const N = L.find((S) => S.utc === a.utc);
174
+ a.wave = N == null ? void 0 : N.wave;
175
175
  }
176
- } catch (A) {
177
- r.warn("[%s] get-gfs-factor failed: %s", O.requestId, A);
176
+ } catch (W) {
177
+ r.warn("[%s] get-gfs-factor failed: %s", O.requestId, W);
178
178
  }
179
179
  return Y;
180
180
  }
@@ -186,12 +186,12 @@ class m0 {
186
186
  * @param options
187
187
  */
188
188
  static populateUVFactor(M, b, p = !1, O = {}) {
189
- const o = Math.round(Math.sqrt(Math.pow(M, 2) + Math.pow(b, 2)) * 1e4) / 1e4, { degree: Y, direction: A } = this.calculateUVDirection(M, b, p, O), q = this.convertMs2Kts(o);
189
+ const o = Math.round(Math.sqrt(Math.pow(M, 2) + Math.pow(b, 2)) * 1e4) / 1e4, { degree: Y, direction: W } = this.calculateUVDirection(M, b, p, O), q = this.convertMs2Kts(o);
190
190
  return {
191
191
  speed: o,
192
192
  kts: q,
193
193
  degree: Y,
194
- direction: A,
194
+ direction: W,
195
195
  eastward: Math.round(M * 1e4) / 1e4,
196
196
  northward: Math.round(b * 1e4) / 1e4
197
197
  };
@@ -269,10 +269,10 @@ var A0 = { exports: {} };
269
269
  throw new RangeError("invalid coordinates");
270
270
  if (90 <= b)
271
271
  return "Etc/GMT";
272
- var Y = -1, A = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - b) / 180.00000000000003, X = 0 | A, R = 0 | q, T = 96 * R + 2 * X;
273
- for (T = 56 * O.charCodeAt(T) + O.charCodeAt(T + 1) - 1995; T + o.length < 3136; )
274
- T = 56 * O.charCodeAt(T = 8 * (Y = Y + T + 1) + 4 * (R = 0 | (q = 2 * (q - R) % 2)) + 2 * (X = 0 | (A = 2 * (A - X) % 2)) + 2304) + O.charCodeAt(T + 1) - 1995;
275
- return o[T + o.length - 3136];
272
+ var Y = -1, W = 48 * (180 + p) / 360.00000000000006, q = 24 * (90 - b) / 180.00000000000003, d = 0 | W, R = 0 | q, L = 96 * R + 2 * d;
273
+ for (L = 56 * O.charCodeAt(L) + O.charCodeAt(L + 1) - 1995; L + o.length < 3136; )
274
+ L = 56 * O.charCodeAt(L = 8 * (Y = Y + L + 1) + 4 * (R = 0 | (q = 2 * (q - R) % 2)) + 2 * (d = 0 | (W = 2 * (W - d) % 2)) + 2304) + O.charCodeAt(L + 1) - 1995;
275
+ return o[L + o.length - 3136];
276
276
  }
277
277
  e.exports = M;
278
278
  })(A0);
@@ -286,62 +286,62 @@ var c0 = { exports: {} };
286
286
  //! license : MIT
287
287
  //! github.com/moment/moment-timezone
288
288
  (function(M, b) {
289
- e.exports ? e.exports = b(L) : b(M.moment);
289
+ e.exports ? e.exports = b(n) : b(M.moment);
290
290
  })(e0, function(M) {
291
291
  M.version === void 0 && M.default && (M = M.default);
292
- var b = "0.5.48", p = {}, O = {}, o = {}, Y = {}, A = {}, q;
292
+ var b = "0.5.48", p = {}, O = {}, o = {}, Y = {}, W = {}, q;
293
293
  (!M || typeof M.version != "string") && w("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
294
- var X = M.version.split("."), R = +X[0], T = +X[1];
295
- (R < 2 || R === 2 && T < 6) && w("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
296
- function d(z) {
294
+ var d = M.version.split("."), R = +d[0], L = +d[1];
295
+ (R < 2 || R === 2 && L < 6) && w("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
296
+ function a(z) {
297
297
  return z > 96 ? z - 87 : z > 64 ? z - 29 : z - 48;
298
298
  }
299
299
  function N(z) {
300
- var c = 0, W = z.split("."), a = W[0], n = W[1] || "", i = 1, t, f = 0, B = 1;
301
- for (z.charCodeAt(0) === 45 && (c = 1, B = -1), c; c < a.length; c++)
302
- t = d(a.charCodeAt(c)), f = 60 * f + t;
303
- for (c = 0; c < n.length; c++)
304
- i = i / 60, t = d(n.charCodeAt(c)), f += t * i;
300
+ var A = 0, c = z.split("."), X = c[0], T = c[1] || "", i = 1, t, f = 0, B = 1;
301
+ for (z.charCodeAt(0) === 45 && (A = 1, B = -1), A; A < X.length; A++)
302
+ t = a(X.charCodeAt(A)), f = 60 * f + t;
303
+ for (A = 0; A < T.length; A++)
304
+ i = i / 60, t = a(T.charCodeAt(A)), f += t * i;
305
305
  return f * B;
306
306
  }
307
307
  function S(z) {
308
- for (var c = 0; c < z.length; c++)
309
- z[c] = N(z[c]);
308
+ for (var A = 0; A < z.length; A++)
309
+ z[A] = N(z[A]);
310
310
  }
311
- function l(z, c) {
312
- for (var W = 0; W < c; W++)
313
- z[W] = Math.round((z[W - 1] || 0) + z[W] * 6e4);
314
- z[c - 1] = 1 / 0;
311
+ function l(z, A) {
312
+ for (var c = 0; c < A; c++)
313
+ z[c] = Math.round((z[c - 1] || 0) + z[c] * 6e4);
314
+ z[A - 1] = 1 / 0;
315
315
  }
316
- function V(z, c) {
317
- var W = [], a;
318
- for (a = 0; a < c.length; a++)
319
- W[a] = z[c[a]];
320
- return W;
316
+ function V(z, A) {
317
+ var c = [], X;
318
+ for (X = 0; X < A.length; X++)
319
+ c[X] = z[A[X]];
320
+ return c;
321
321
  }
322
322
  function E(z) {
323
- var c = z.split("|"), W = c[2].split(" "), a = c[3].split(""), n = c[4].split(" ");
324
- return S(W), S(a), S(n), l(n, a.length), {
325
- name: c[0],
326
- abbrs: V(c[1].split(" "), a),
327
- offsets: V(W, a),
328
- untils: n,
329
- population: c[5] | 0
323
+ var A = z.split("|"), c = A[2].split(" "), X = A[3].split(""), T = A[4].split(" ");
324
+ return S(c), S(X), S(T), l(T, X.length), {
325
+ name: A[0],
326
+ abbrs: V(A[1].split(" "), X),
327
+ offsets: V(c, X),
328
+ untils: T,
329
+ population: A[5] | 0
330
330
  };
331
331
  }
332
332
  function h(z) {
333
333
  z && this._set(E(z));
334
334
  }
335
- function y(z, c) {
336
- var W = c.length;
337
- if (z < c[0])
335
+ function y(z, A) {
336
+ var c = A.length;
337
+ if (z < A[0])
338
338
  return 0;
339
- if (W > 1 && c[W - 1] === 1 / 0 && z >= c[W - 2])
340
- return W - 1;
341
- if (z >= c[W - 1])
339
+ if (c > 1 && A[c - 1] === 1 / 0 && z >= A[c - 2])
340
+ return c - 1;
341
+ if (z >= A[c - 1])
342
342
  return -1;
343
- for (var a, n = 0, i = W - 1; i - n > 1; )
344
- a = Math.floor((n + i) / 2), c[a] <= z ? n = a : i = a;
343
+ for (var X, T = 0, i = c - 1; i - T > 1; )
344
+ X = Math.floor((T + i) / 2), A[X] <= z ? T = X : i = X;
345
345
  return i;
346
346
  }
347
347
  h.prototype = {
@@ -349,22 +349,22 @@ 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 = y(c, W), a >= 0)
354
- return a;
352
+ var A = +z, c = this.untils, X;
353
+ if (X = y(A, c), X >= 0)
354
+ return X;
355
355
  },
356
356
  countries: function() {
357
357
  var z = this.name;
358
- return Object.keys(o).filter(function(c) {
359
- return o[c].zones.indexOf(z) !== -1;
358
+ return Object.keys(o).filter(function(A) {
359
+ return o[A].zones.indexOf(z) !== -1;
360
360
  });
361
361
  },
362
362
  parse: function(z) {
363
- var c = +z, W = this.offsets, a = this.untils, n = a.length - 1, i, t, f, B;
364
- for (B = 0; B < n; B++)
365
- if (i = W[B], t = W[B + 1], f = W[B && B - 1], i < t && U.moveAmbiguousForward ? i = t : i > f && U.moveInvalidForward && (i = f), c < a[B] - i * 6e4)
366
- return W[B];
367
- return W[n];
363
+ var A = +z, c = this.offsets, X = this.untils, T = X.length - 1, i, t, f, B;
364
+ for (B = 0; B < T; B++)
365
+ if (i = c[B], t = c[B + 1], f = c[B && B - 1], i < t && U.moveAmbiguousForward ? i = t : i > f && U.moveInvalidForward && (i = f), A < X[B] - i * 6e4)
366
+ return c[B];
367
+ return c[T];
368
368
  },
369
369
  abbr: function(z) {
370
370
  return this.abbrs[this._index(z)];
@@ -376,12 +376,12 @@ var c0 = { exports: {} };
376
376
  return this.offsets[this._index(z)];
377
377
  }
378
378
  };
379
- function _(z, c) {
380
- this.name = z, this.zones = c;
379
+ function _(z, A) {
380
+ this.name = z, this.zones = A;
381
381
  }
382
382
  function I(z) {
383
- var c = z.toTimeString(), W = c.match(/\([a-z ]+\)/i);
384
- W && W[0] ? (W = W[0].match(/[A-Z]/g), W = W ? W.join("") : void 0) : (W = c.match(/[A-Z]{3,5}/g), W = W ? W[0] : void 0), W === "GMT" && (W = void 0), this.at = +z, this.abbr = W, this.offset = z.getTimezoneOffset();
383
+ var A = z.toTimeString(), c = A.match(/\([a-z ]+\)/i);
384
+ c && c[0] ? (c = c[0].match(/[A-Z]/g), c = c ? c.join("") : void 0) : (c = A.match(/[A-Z]{3,5}/g), c = c ? c[0] : void 0), c === "GMT" && (c = void 0), this.at = +z, this.abbr = c, this.offset = z.getTimezoneOffset();
385
385
  }
386
386
  function G(z) {
387
387
  this.zone = z, this.offsetScore = 0, this.abbrScore = 0;
@@ -389,55 +389,55 @@ var c0 = { exports: {} };
389
389
  G.prototype.scoreOffsetAt = function(z) {
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
- function Q(z, c) {
393
- for (var W, a; a = ((c.at - z.at) / 12e4 | 0) * 6e4; )
394
- W = new I(new Date(z.at + a)), W.offset === z.offset ? z = W : c = W;
392
+ function Q(z, A) {
393
+ for (var c, X; X = ((A.at - z.at) / 12e4 | 0) * 6e4; )
394
+ c = new I(new Date(z.at + X)), c.offset === z.offset ? z = c : A = c;
395
395
  return z;
396
396
  }
397
397
  function P() {
398
- var z = (/* @__PURE__ */ new Date()).getFullYear() - 2, c = new I(new Date(z, 0, 1)), W = c.offset, a = [c], n, i, t, f;
398
+ var z = (/* @__PURE__ */ new Date()).getFullYear() - 2, A = new I(new Date(z, 0, 1)), c = A.offset, X = [A], T, i, t, f;
399
399
  for (f = 1; f < 48; f++)
400
- t = new Date(z, f, 1).getTimezoneOffset(), t !== W && (i = new I(new Date(z, f, 1)), n = Q(c, i), a.push(n), a.push(new I(new Date(n.at + 6e4))), c = i, W = t);
400
+ t = new Date(z, f, 1).getTimezoneOffset(), t !== c && (i = new I(new Date(z, f, 1)), T = Q(A, i), X.push(T), X.push(new I(new Date(T.at + 6e4))), A = i, c = t);
401
401
  for (f = 0; f < 4; f++)
402
- a.push(new I(new Date(z + f, 0, 1))), a.push(new I(new Date(z + f, 6, 1)));
403
- return a;
402
+ X.push(new I(new Date(z + f, 0, 1))), X.push(new I(new Date(z + f, 6, 1)));
403
+ return X;
404
404
  }
405
- function H(z, c) {
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);
405
+ function H(z, A) {
406
+ return z.offsetScore !== A.offsetScore ? z.offsetScore - A.offsetScore : z.abbrScore !== A.abbrScore ? z.abbrScore - A.abbrScore : z.zone.population !== A.zone.population ? A.zone.population - z.zone.population : A.zone.name.localeCompare(z.zone.name);
407
407
  }
408
- function m(z, c) {
409
- var W, a;
410
- for (S(c), W = 0; W < c.length; W++)
411
- a = c[W], A[a] = A[a] || {}, A[a][z] = !0;
408
+ function m(z, A) {
409
+ var c, X;
410
+ for (S(A), c = 0; c < A.length; c++)
411
+ X = A[c], W[X] = W[X] || {}, W[X][z] = !0;
412
412
  }
413
413
  function s(z) {
414
- var c = z.length, W = {}, a = [], n = {}, i, t, f, B;
415
- for (i = 0; i < c; i++)
416
- if (f = z[i].offset, !n.hasOwnProperty(f)) {
417
- B = A[f] || {};
414
+ var A = z.length, c = {}, X = [], T = {}, i, t, f, B;
415
+ for (i = 0; i < A; i++)
416
+ if (f = z[i].offset, !T.hasOwnProperty(f)) {
417
+ B = W[f] || {};
418
418
  for (t in B)
419
- B.hasOwnProperty(t) && (W[t] = !0);
420
- n[f] = !0;
419
+ B.hasOwnProperty(t) && (c[t] = !0);
420
+ T[f] = !0;
421
421
  }
422
- for (i in W)
423
- W.hasOwnProperty(i) && a.push(Y[i]);
424
- return a;
422
+ for (i in c)
423
+ c.hasOwnProperty(i) && X.push(Y[i]);
424
+ return X;
425
425
  }
426
426
  function u() {
427
427
  try {
428
428
  var z = Intl.DateTimeFormat().resolvedOptions().timeZone;
429
429
  if (z && z.length > 3) {
430
- var c = Y[C(z)];
431
- if (c)
432
- return c;
430
+ var A = Y[C(z)];
431
+ if (A)
432
+ return A;
433
433
  w("Moment Timezone found " + z + " from the Intl api, but did not have that data loaded.");
434
434
  }
435
435
  } catch {
436
436
  }
437
- var W = P(), a = W.length, n = s(W), i = [], t, f, B;
438
- for (f = 0; f < n.length; f++) {
439
- for (t = new G(K(n[f])), B = 0; B < a; B++)
440
- t.scoreOffsetAt(W[B]);
437
+ var c = P(), X = c.length, T = s(c), i = [], t, f, B;
438
+ for (f = 0; f < T.length; f++) {
439
+ for (t = new G(K(T[f])), B = 0; B < X; B++)
440
+ t.scoreOffsetAt(c[B]);
441
441
  i.push(t);
442
442
  }
443
443
  return i.sort(H), i.length > 0 ? i[0].zone.name : void 0;
@@ -449,52 +449,52 @@ var c0 = { exports: {} };
449
449
  return (z || "").toLowerCase().replace(/\//g, "_");
450
450
  }
451
451
  function z0(z) {
452
- var c, W, a, n;
453
- for (typeof z == "string" && (z = [z]), c = 0; c < z.length; c++)
454
- a = z[c].split("|"), W = a[0], n = C(W), p[n] = z[c], Y[n] = W, m(n, a[2].split(" "));
452
+ var A, c, X, T;
453
+ for (typeof z == "string" && (z = [z]), A = 0; A < z.length; A++)
454
+ X = z[A].split("|"), c = X[0], T = C(c), p[T] = z[A], Y[T] = c, m(T, X[2].split(" "));
455
455
  }
456
- function K(z, c) {
456
+ function K(z, A) {
457
457
  z = C(z);
458
- var W = p[z], a;
459
- return W instanceof h ? W : typeof W == "string" ? (W = new h(W), p[z] = W, W) : O[z] && c !== K && (a = K(O[z], K)) ? (W = p[z] = new h(), W._set(a), W.name = Y[z], W) : null;
458
+ var c = p[z], X;
459
+ return c instanceof h ? c : typeof c == "string" ? (c = new h(c), p[z] = c, c) : O[z] && A !== K && (X = K(O[z], K)) ? (c = p[z] = new h(), c._set(X), c.name = Y[z], c) : null;
460
460
  }
461
461
  function q0() {
462
- var z, c = [];
462
+ var z, A = [];
463
463
  for (z in Y)
464
- Y.hasOwnProperty(z) && (p[z] || p[O[z]]) && Y[z] && c.push(Y[z]);
465
- return c.sort();
464
+ Y.hasOwnProperty(z) && (p[z] || p[O[z]]) && Y[z] && A.push(Y[z]);
465
+ return A.sort();
466
466
  }
467
467
  function o0() {
468
468
  return Object.keys(o);
469
469
  }
470
470
  function b0(z) {
471
- var c, W, a, n;
472
- for (typeof z == "string" && (z = [z]), c = 0; c < z.length; c++)
473
- W = z[c].split("|"), a = C(W[0]), n = C(W[1]), O[a] = n, Y[a] = W[0], O[n] = a, Y[n] = W[1];
471
+ var A, c, X, T;
472
+ for (typeof z == "string" && (z = [z]), A = 0; A < z.length; A++)
473
+ c = z[A].split("|"), X = C(c[0]), T = C(c[1]), O[X] = T, Y[X] = c[0], O[T] = X, Y[T] = c[1];
474
474
  }
475
475
  function Y0(z) {
476
- var c, W, a, n;
476
+ var A, c, X, T;
477
477
  if (!(!z || !z.length))
478
- for (c = 0; c < z.length; c++)
479
- n = z[c].split("|"), W = n[0].toUpperCase(), a = n[1].split(" "), o[W] = new _(
480
- W,
481
- a
478
+ for (A = 0; A < z.length; A++)
479
+ T = z[A].split("|"), c = T[0].toUpperCase(), X = T[1].split(" "), o[c] = new _(
480
+ c,
481
+ X
482
482
  );
483
483
  }
484
484
  function d0(z) {
485
485
  return z = z.toUpperCase(), o[z] || null;
486
486
  }
487
- function a0(z, c) {
487
+ function a0(z, A) {
488
488
  if (z = d0(z), !z)
489
489
  return null;
490
- var W = z.zones.sort();
491
- return c ? W.map(function(a) {
492
- var n = K(a);
490
+ var c = z.zones.sort();
491
+ return A ? c.map(function(X) {
492
+ var T = K(X);
493
493
  return {
494
- name: a,
495
- offset: n.utcOffset(/* @__PURE__ */ new Date())
494
+ name: X,
495
+ offset: T.utcOffset(/* @__PURE__ */ new Date())
496
496
  };
497
- }) : W;
497
+ }) : c;
498
498
  }
499
499
  function X0(z) {
500
500
  z0(z.zones), b0(z.links), Y0(z.countries), U.dataVersion = z.version;
@@ -503,31 +503,31 @@ var c0 = { exports: {} };
503
503
  return j.didShowError || (j.didShowError = !0, w("moment.tz.zoneExists('" + z + "') has been deprecated in favor of !moment.tz.zone('" + z + "')")), !!K(z);
504
504
  }
505
505
  function x(z) {
506
- var c = z._f === "X" || z._f === "x";
507
- return !!(z._a && z._tzm === void 0 && !c);
506
+ var A = z._f === "X" || z._f === "x";
507
+ return !!(z._a && z._tzm === void 0 && !A);
508
508
  }
509
509
  function w(z) {
510
510
  typeof console < "u" && typeof console.error == "function" && console.error(z);
511
511
  }
512
512
  function U(z) {
513
- var c = Array.prototype.slice.call(arguments, 0, -1), W = arguments[arguments.length - 1], a = M.utc.apply(null, c), n;
514
- return !M.isMoment(z) && x(a) && (n = K(W)) && a.add(n.parse(a), "minutes"), a.tz(W), a;
513
+ var A = Array.prototype.slice.call(arguments, 0, -1), c = arguments[arguments.length - 1], X = M.utc.apply(null, A), T;
514
+ return !M.isMoment(z) && x(X) && (T = K(c)) && X.add(T.parse(X), "minutes"), X.tz(c), X;
515
515
  }
516
516
  U.version = b, U.dataVersion = "", U._zones = p, U._links = O, U._names = Y, U._countries = o, U.add = z0, U.link = b0, U.load = X0, U.zone = K, U.zoneExists = j, U.guess = F, U.names = q0, U.Zone = h, U.unpack = E, U.unpackBase60 = N, U.needsOffset = x, U.moveInvalidForward = !0, U.moveAmbiguousForward = !1, U.countries = o0, U.zonesForCountry = a0;
517
517
  var D = M.fn;
518
- M.tz = U, M.defaultZone = null, M.updateOffset = function(z, c) {
519
- var W = M.defaultZone, a;
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) {
522
- var n = z._z;
523
- z.utcOffset(-a, c), z._z = n;
518
+ M.tz = U, M.defaultZone = null, M.updateOffset = function(z, A) {
519
+ var c = M.defaultZone, X;
520
+ if (z._z === void 0 && (c && x(z) && !z._isUTC && z.isValid() && (z._d = M.utc(z._a)._d, z.utc().add(c.parse(z), "minutes")), z._z = c), z._z)
521
+ if (X = z._z.utcOffset(z), Math.abs(X) < 16 && (X = X / 60), z.utcOffset !== void 0) {
522
+ var T = z._z;
523
+ z.utcOffset(-X, A), z._z = T;
524
524
  } else
525
- z.zone(a, c);
526
- }, D.tz = function(z, c) {
525
+ z.zone(X, A);
526
+ }, D.tz = function(z, A) {
527
527
  if (z) {
528
528
  if (typeof z != "string")
529
529
  throw new Error("Time zone name must be a string, got " + z + " [" + typeof z + "]");
530
- return this._z = K(z), this._z ? M.updateOffset(this, c) : w("Moment Timezone has no data for " + z + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
530
+ return this._z = K(z), this._z ? M.updateOffset(this, A) : w("Moment Timezone has no data for " + z + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
531
531
  }
532
532
  if (this._z)
533
533
  return this._z.name;
@@ -548,7 +548,7 @@ var c0 = { exports: {} };
548
548
  };
549
549
  }
550
550
  D.zoneName = p0(D.zoneName), D.zoneAbbr = p0(D.zoneAbbr), D.utc = O0(D.utc), D.local = O0(D.local), D.utcOffset = R0(D.utcOffset), M.tz.setDefault = function(z) {
551
- return (R < 2 || R === 2 && T < 9) && w("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = z ? K(z) : null, M;
551
+ return (R < 2 || R === 2 && L < 9) && w("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = z ? K(z) : null, M;
552
552
  };
553
553
  var J = M.momentProperties;
554
554
  return Object.prototype.toString.call(J) === "[object Array]" ? (J.push("_z"), J.push("_a")) : J && (J._z = null), M;
@@ -1458,7 +1458,7 @@ class C0 {
1458
1458
  }
1459
1459
  });
1460
1460
  g(this, "METEO2_UPDATE", {
1461
- etime: L().unix(),
1461
+ etime: n().unix(),
1462
1462
  version: 0
1463
1463
  });
1464
1464
  this.apikey = M || "smE3JnDLHy3TizVv", this.debug = b;
@@ -1482,27 +1482,27 @@ class C0 {
1482
1482
  */
1483
1483
  async weatherForecast(M, b = {}) {
1484
1484
  try {
1485
- const p = L();
1485
+ const p = n();
1486
1486
  let O;
1487
1487
  if (M.start_dates instanceof Array)
1488
1488
  for (let Y = 0; Y < M.start_dates.length; Y++) {
1489
1489
  M.start_date = M.start_dates[Y], M.end_date = M.end_dates[Y], M.fake = M.fakes[Y];
1490
- const A = M.url[Y];
1491
- this.debug && Z.debug("[%s] fetch weather via %s with %j", b.requestId, A, {
1490
+ const W = M.url[Y];
1491
+ this.debug && Z.debug("[%s] fetch weather via %s with %j", b.requestId, W, {
1492
1492
  start_date: M.start_date,
1493
1493
  end_date: M.end_date,
1494
1494
  fake: M.fake,
1495
1495
  step: Y
1496
1496
  });
1497
- const q = await v(A, M), X = await this.parseWeatherData(q, M, b);
1498
- O ? await this.mergeSegments(O, X) : O = X;
1497
+ const q = await $(W, M), d = await this.parseWeatherData(q, M, b);
1498
+ O ? await this.mergeSegments(O, d) : O = d;
1499
1499
  }
1500
1500
  else {
1501
- const Y = await v(M.url, M);
1501
+ const Y = await $(M.url, M);
1502
1502
  O = await this.parseWeatherData(Y, M, b);
1503
1503
  }
1504
1504
  delete M.apikey;
1505
- const o = L();
1505
+ const o = n();
1506
1506
  return this.debug && Z.info("[%s] fetch weather api (%j) cost: %d ms", b.requestId, M.url, o.diff(p, "ms")), O;
1507
1507
  } catch (p) {
1508
1508
  return Z.warn("[%s] weather forecast failed: %s, with %j", b.requestId, p, M), [];
@@ -1525,33 +1525,38 @@ class C0 {
1525
1525
  * @param options
1526
1526
  */
1527
1527
  async marineForecast(M, b = {}) {
1528
+ var p, O;
1528
1529
  try {
1529
- const p = L();
1530
- let O;
1530
+ const o = n();
1531
+ let Y;
1531
1532
  if (M.start_dates instanceof Array)
1532
- for (let A = 0; A < M.start_dates.length; A++) {
1533
- M.start_date = M.start_dates[A], M.end_date = M.end_dates[A], M.fake = M.fakes[A];
1534
- const q = M.url[A];
1535
- this.debug && Z.debug("[%s] fetch marine via %s with %j", b.requestId, q, {
1533
+ for (let d = 0; d < M.start_dates.length; d++) {
1534
+ M.start_date = M.start_dates[d], M.end_date = M.end_dates[d], M.fake = M.fakes[d];
1535
+ const R = M.url[d];
1536
+ this.debug && Z.debug("[%s] fetch marine via %s with %j", b.requestId, R, {
1536
1537
  start_date: M.start_date,
1537
1538
  end_date: M.end_date,
1538
1539
  fake: M.fake,
1539
- step: A
1540
+ step: d
1540
1541
  });
1541
- const X = await v(q, M), R = await this.parseWeatherData(X, M, b);
1542
- O ? await this.mergeSegments(O, R) : O = R;
1542
+ const L = await $(R, M), a = await this.parseWeatherData(L, M, b);
1543
+ Y ? await this.mergeSegments(Y, a) : Y = a;
1543
1544
  }
1544
1545
  else {
1545
- const A = await v(M.url, M);
1546
- O = await this.parseWeatherData(A, M, b);
1546
+ const d = await $(M.url, M);
1547
+ Y = await this.parseWeatherData(d, M, b);
1547
1548
  }
1548
1549
  delete M.apikey;
1549
- const o = L();
1550
- this.debug && Z.info("[%s] fetch marine api (%j) cost: %d ms", b.requestId, M.url, o.diff(p, "ms"));
1551
- const Y = await this.mergeMarineData(O);
1552
- return ["gfswave", "ncep_gfswave025"].includes(b.marineModels) ? [Y.at(-1)] : Y;
1553
- } catch (p) {
1554
- return Z.warn("[%s] marine forecast failed: %s, with %j", b.requestId, p, M), [];
1550
+ const W = n();
1551
+ this.debug && Z.info("[%s] fetch marine api (%j) cost: %d ms", b.requestId, M.url, W.diff(o, "ms"));
1552
+ const q = await this.mergeMarineData(Y);
1553
+ if (["gfswave", "ncep_gfswave025"].includes(b.marineModels)) {
1554
+ const d = q.find((L) => L.model === "ncep_gfswave016"), R = q.find((L) => L.model === "ncep_gfswave025");
1555
+ return (O = (p = d == null ? void 0 : d.hourly) == null ? void 0 : p.wave_height) != null && O.every((L) => L !== null) ? [d] : [R];
1556
+ } else
1557
+ return q;
1558
+ } catch (o) {
1559
+ return Z.warn("[%s] marine forecast failed: %s, with %j", b.requestId, o, M), [];
1555
1560
  }
1556
1561
  }
1557
1562
  /**
@@ -1562,64 +1567,64 @@ class C0 {
1562
1567
  * @private
1563
1568
  */
1564
1569
  async parseWeatherData(M, b, p = {}) {
1565
- var Y, A, q, X, R, T, d, N, S, l;
1570
+ var Y, W, q, d, R, L, a, N, S, l;
1566
1571
  const O = [], o = Math.pow(10, p.precision || 6);
1567
1572
  for (let V = 0; V < M.length; V++) {
1568
1573
  const E = M[V], h = E.utcOffsetSeconds(), y = E.timezone(), _ = E.current(), I = E.hourly(), G = E.sixHourly(), Q = E.daily(), P = {};
1569
1574
  if (P.timezone = y || void 0, P.offset = this.prettyTimezoneOffset(h), P.model = b.models instanceof Array ? (Y = b.models) == null ? void 0 : Y[V] : b.models || "best_match", _) {
1570
- const H = L();
1575
+ const H = n();
1571
1576
  P.current = {
1572
- time: L.unix(Number(_.time())).utc().format()
1577
+ time: n.unix(Number(_.time())).utc().format()
1573
1578
  };
1574
1579
  for (let s = 0; s < _.variablesLength(); s++) {
1575
1580
  const u = _.variables(s).value();
1576
1581
  P.current[b.current[s]] = isNaN(u) ? null : Math.round(u * o) / o;
1577
1582
  }
1578
- const m = L();
1583
+ const m = n();
1579
1584
  this.debug && Z.debug("[%s] fetch current variables cost: %d ms", p.requestId, m.diff(H, "ms"));
1580
1585
  }
1581
1586
  if (I) {
1582
- const H = L(), m = L.unix(Number(I.time())).add(b.fake ? 1 : 0, "year");
1587
+ const H = n(), m = n.unix(Number(I.time())).add(b.fake ? 1 : 0, "year");
1583
1588
  P.hourly = {
1584
1589
  date: m.utc().format(),
1585
1590
  time: this.range(Number(I.time()), Number(I.timeEnd()), I.interval()).map(
1586
- (u) => L.unix(u).add(b.fake ? 1 : 0, "year").diff(m, "h")
1591
+ (u) => n.unix(u).add(b.fake ? 1 : 0, "year").diff(m, "h")
1587
1592
  )
1588
1593
  };
1589
1594
  for (let u = 0; u < I.variablesLength(); u++) {
1590
- const F = (X = (q = (A = I.variables(u).valuesArray()) == null ? void 0 : A.toString()) == null ? void 0 : q.split(",")) == null ? void 0 : X.map((C) => isNaN(C) ? null : Math.round(Number(C) * o) / o);
1595
+ const F = (d = (q = (W = I.variables(u).valuesArray()) == null ? void 0 : W.toString()) == null ? void 0 : q.split(",")) == null ? void 0 : d.map((C) => isNaN(C) ? null : Math.round(Number(C) * o) / o);
1591
1596
  P.hourly[b.hourly[u]] = F;
1592
1597
  }
1593
- const s = L();
1598
+ const s = n();
1594
1599
  this.debug && Z.debug("[%s] fetch hourly variables cost: %d ms", p.requestId, s.diff(H, "ms"));
1595
1600
  }
1596
1601
  if (G) {
1597
- const H = L(), m = L.unix(Number(G.time())).add(b.fake ? 1 : 0, "year");
1602
+ const H = n(), m = n.unix(Number(G.time())).add(b.fake ? 1 : 0, "year");
1598
1603
  P.sixHourly = {
1599
1604
  date: m.utc().format(),
1600
1605
  time: this.range(Number(G.time()), Number(G.timeEnd()), G.interval()).map(
1601
- (u) => L.unix(u).add(b.fake ? 1 : 0, "year").diff(m, "h")
1606
+ (u) => n.unix(u).add(b.fake ? 1 : 0, "year").diff(m, "h")
1602
1607
  )
1603
1608
  };
1604
1609
  for (let u = 0; u < G.variablesLength(); u += p.memberLength ?? 1) {
1605
- const F = (d = (T = (R = G.variables(u).valuesArray()) == null ? void 0 : R.toString()) == null ? void 0 : T.split(",")) == null ? void 0 : d.map((C) => isNaN(C) ? null : Math.round(Number(C) * o) / o);
1610
+ const F = (a = (L = (R = G.variables(u).valuesArray()) == null ? void 0 : R.toString()) == null ? void 0 : L.split(",")) == null ? void 0 : a.map((C) => isNaN(C) ? null : Math.round(Number(C) * o) / o);
1606
1611
  G.variables(u), P.sixHourly[b.six_hourly[u / (p.memberLength ?? 1)]] = F;
1607
1612
  }
1608
- const s = L();
1613
+ const s = n();
1609
1614
  this.debug && Z.debug("[%s] fetch 6-hourly variables cost: %d ms", p.requestId, s.diff(H, "ms"));
1610
1615
  }
1611
1616
  if (Q) {
1612
- const H = L();
1617
+ const H = n();
1613
1618
  P.daily = {
1614
1619
  time: this.range(Number(Q.time()), Number(Q.timeEnd()), Q.interval()).map(
1615
- (s) => L.unix(s).add(b.fake ? 1 : 0, "year").utc().format()
1620
+ (s) => n.unix(s).add(b.fake ? 1 : 0, "year").utc().format()
1616
1621
  )
1617
1622
  };
1618
1623
  for (let s = 0; s < Q.variablesLength(); s += p.memberLength ?? 1) {
1619
1624
  const u = (l = (S = (N = Q.variables(s).valuesArray()) == null ? void 0 : N.toString()) == null ? void 0 : S.split(",")) == null ? void 0 : l.map((F) => isNaN(F) ? null : Math.round(Number(F) * o) / o);
1620
1625
  P.daily[b.daily[s / (p.memberLength ?? 1)]] = u;
1621
1626
  }
1622
- const m = L();
1627
+ const m = n();
1623
1628
  this.debug && Z.debug("[%s] fetch daily variables cost: %d ms", p.requestId, m.diff(H, "ms"));
1624
1629
  }
1625
1630
  O.push(P);
@@ -1634,23 +1639,23 @@ class C0 {
1634
1639
  if (M[p][O][o] instanceof Array)
1635
1640
  if (o === "time" && O === "hourly") {
1636
1641
  const Y = M[p][O][o].at(-1);
1637
- b[p][O][o] = b[p][O][o].map((A) => A + Y + 1), M[p][O][o].push(...b[p][O][o]);
1642
+ b[p][O][o] = b[p][O][o].map((W) => W + Y + 1), M[p][O][o].push(...b[p][O][o]);
1638
1643
  } else
1639
1644
  M[p][O][o].push(...b[p][O][o]);
1640
1645
  }
1641
1646
  return M;
1642
1647
  }
1643
1648
  async mergeMarineData(M) {
1644
- var o, Y, A, q;
1645
- const b = [], p = M.find((X) => X.model === "best_match");
1649
+ var o, Y, W, q;
1650
+ const b = [], p = M.find((d) => d.model === "best_match");
1646
1651
  p && b.push(p);
1647
- const O = M.find((X) => X.model === "meteofrance_currents");
1648
- for (const X of M)
1649
- ["best_match", "meteofrance_currents"].includes(X.model) || (X.hourly.ocean_current_velocity = (o = O == null ? void 0 : O.hourly) == null ? void 0 : o.ocean_current_velocity, X.hourly.ocean_current_direction = (Y = O == null ? void 0 : O.hourly) == null ? void 0 : Y.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));
1652
+ const O = M.find((d) => d.model === "meteofrance_currents");
1653
+ for (const d of M)
1654
+ ["best_match", "meteofrance_currents"].includes(d.model) || (d.hourly.ocean_current_velocity = (o = O == null ? void 0 : O.hourly) == null ? void 0 : o.ocean_current_velocity, d.hourly.ocean_current_direction = (Y = O == null ? void 0 : O.hourly) == null ? void 0 : Y.ocean_current_direction, d.hourly.sea_level_height_msl = (W = O == null ? void 0 : O.hourly) == null ? void 0 : W.sea_level_height_msl, d.hourly.sea_surface_temperature = (q = O == null ? void 0 : O.hourly) == null ? void 0 : q.sea_surface_temperature, b.push(d));
1650
1655
  return b;
1651
1656
  }
1652
1657
  pickForecastUrl(M, b, p, O = {}) {
1653
- return M ? p ? this.FORECAST.OM_MARINE_URL : b ? O.marineUrl || this.FORECAST.ORM_MARINE_URL : this.FORECAST.OM_MARINE_URL : p ? this.FORECAST.OM_HISTORY_URL : b ? O.weatherUrl || this.FORECAST.ORM_URL : this.FORECAST.OM_URL;
1658
+ return M ? p && !O.noFake ? this.FORECAST.OM_MARINE_URL : b ? O.marineUrl || this.FORECAST.ORM_MARINE_URL : this.FORECAST.OM_MARINE_URL : p && !O.noFake ? this.FORECAST.OM_HISTORY_URL : b ? O.weatherUrl || this.FORECAST.ORM_URL : this.FORECAST.OM_URL;
1654
1659
  }
1655
1660
  pickMarineModels(M) {
1656
1661
  var Y;
@@ -1658,35 +1663,37 @@ class C0 {
1658
1663
  if (!(b != null && b.length))
1659
1664
  return ["best_match"];
1660
1665
  const p = [];
1661
- for (let A = 0; A < b.length; A++) {
1662
- const q = b[A];
1663
- ["ecmwf_wam025", "meteofrance_wave", "ewam", "gwam", "era5_ocean"].includes(q) ? p.push("meteofrance_currents", q) : ["gfswave", "ncep_gfswave025", "ncep_gfswave016"].includes(q) ? p.push("meteofrance_currents", "ncep_gfswave025") : p.push("best_match");
1666
+ for (let W = 0; W < b.length; W++) {
1667
+ const q = b[W];
1668
+ ["ecmwf_wam025", "meteofrance_wave", "ewam", "gwam", "era5_ocean"].includes(q) ? p.push("meteofrance_currents", q) : ["gfswave", "ncep_gfswave025", "ncep_gfswave016"].includes(q) ? p.push("meteofrance_currents", "ncep_gfswave025", "ncep_gfswave016") : p.push("best_match");
1664
1669
  }
1665
- const O = p.reduce((A, q) => (A.includes(q) || A.push(q), A), []), o = ["best_match", "meteofrance_currents", "meteofrance_wave", "ecmwf_wam025", "ncep_gfswave025", "gwam", "era5_ocean", "ewam"];
1666
- return O.sort((A, q) => {
1667
- const X = o.indexOf(A), R = o.indexOf(q);
1668
- return X - R;
1670
+ const O = p.reduce((W, q) => (W.includes(q) || W.push(q), W), []), o = ["best_match", "meteofrance_currents", "meteofrance_wave", "ecmwf_wam025", "ncep_gfswave025", "gwam", "era5_ocean", "ewam"];
1671
+ return O.sort((W, q) => {
1672
+ const d = o.indexOf(W), R = o.indexOf(q);
1673
+ return d - R;
1669
1674
  }), O;
1670
1675
  }
1671
1676
  /**
1672
1677
  * 完善start_hour/end_hour 或者是forecast_days变量,二选一
1673
1678
  * @param datetime 从指定时间开始,不指定时从当前时间开始
1679
+ * @param marine 是否为海洋预报
1674
1680
  * @param params 要查询的要素
1675
1681
  * @param options 请求参数
1676
1682
  * @private
1677
1683
  */
1678
1684
  prepare(M, b, p, O = {}) {
1679
- const o = L().utc(), Y = M ? L.utc(M) : void 0, A = o.clone().utc().add(b ? 9 : 14, "day");
1685
+ var q;
1686
+ const o = n().utc(), Y = M ? n.utc(M) : void 0, W = o.clone().utc().add(b && ((q = p.models) != null && q.includes("meteofrance_wave")) ? 10 : 15, "day");
1680
1687
  if (M) {
1681
- const q = Y.clone().utc().add(O.forecastDays ?? 1, "day");
1682
- q.isAfter(A) ? (q.subtract(1, "year"), Y.isAfter(A) ? (Y.subtract(1, "year"), p.start_dates = [
1688
+ const d = Y.clone().utc().add(O.forecastDays ?? 1, "day");
1689
+ d.isAfter(W) ? (d.subtract(1, "year"), Y.isAfter(W) ? (Y.subtract(1, "year"), p.start_dates = [
1683
1690
  Y.clone().subtract(O.pastDays || 0, "day").utc().format("YYYY-MM-DD")
1684
- ], p.end_dates = [q.utc().format("YYYY-MM-DD")], p.fakes = [!0], p.url = [this.pickForecastUrl(b, !1, !0, O)]) : (p.start_dates = [
1691
+ ], p.end_dates = [d.utc().format("YYYY-MM-DD")], p.fakes = [!0], p.url = [this.pickForecastUrl(b, !1, !0, O)]) : (p.start_dates = [
1685
1692
  Y.clone().subtract(O.pastDays || 0, "day").utc().format("YYYY-MM-DD"),
1686
- A.clone().subtract(1, "year").utc().format("YYYY-MM-DD")
1687
- ], p.end_dates = [A.clone().subtract(1, "day").utc().format("YYYY-MM-DD"), q.utc().format("YYYY-MM-DD")], p.fakes = [!1, !0], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, !1, O), this.pickForecastUrl(b, !1, !0, O)])) : (p.start_dates = [
1693
+ W.clone().subtract(1, "year").utc().format("YYYY-MM-DD")
1694
+ ], p.end_dates = [W.clone().subtract(1, "day").utc().format("YYYY-MM-DD"), d.utc().format("YYYY-MM-DD")], p.fakes = [!1, !0], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, !1, O), this.pickForecastUrl(b, !1, !0, O)])) : (p.start_dates = [
1688
1695
  Y.clone().subtract(O.pastDays || 0, "day").utc().format("YYYY-MM-DD")
1689
- ], p.end_dates = [q.utc().format("YYYY-MM-DD")], p.fakes = [!1], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, Y.isBefore(o.clone().subtract(30, "day")), O)]);
1696
+ ], p.end_dates = [d.utc().format("YYYY-MM-DD")], p.fakes = [!1], p.url = [this.pickForecastUrl(b, O.selfHosted ?? !0, Y.isBefore(o.clone().subtract(30, "day")), O)]);
1690
1697
  } else
1691
1698
  p.forecast_days = O.forecastDays, p.past_days = O.pastDays, p.fake = !1, p.url = this.pickForecastUrl(b, O.selfHosted ?? !0, !1, O);
1692
1699
  return p;
@@ -1697,7 +1704,7 @@ class C0 {
1697
1704
  return Math.round(M * p) / p;
1698
1705
  }
1699
1706
  timezoneOffset(M, b) {
1700
- const p = N0(M, b), O = L().tz(p).utcOffset();
1707
+ const p = N0(M, b), O = n().tz(p).utcOffset();
1701
1708
  return Math.round(O / 60 * 10) / 10;
1702
1709
  }
1703
1710
  /**
@@ -1736,41 +1743,41 @@ class C0 {
1736
1743
  * @param withHourly
1737
1744
  * @param options
1738
1745
  */
1739
- async spotForecast(M, b, p, O = !0, o = !0, Y = !1, A = {
1746
+ async spotForecast(M, b, p, O = !0, o = !0, Y = !1, W = {
1740
1747
  forecastDays: 1,
1741
1748
  pastDays: 0,
1742
1749
  precision: 6,
1743
1750
  selfHosted: !0
1744
1751
  }) {
1745
1752
  var N, S, l;
1746
- b = this.toStdLng(b), this.debug && Z.info("[%s] spot forecast params: %j", A.requestId, { lat: M, lng: b, datetime: p, simplify: O, withDaily: o, withHourly: Y, options: A });
1753
+ b = this.toStdLng(b), this.debug && Z.info("[%s] spot forecast params: %j", W.requestId, { lat: M, lng: b, datetime: p, simplify: O, withDaily: o, withHourly: Y, options: W });
1747
1754
  const q = {
1748
1755
  apikey: this.apikey,
1749
1756
  latitude: M,
1750
1757
  longitude: b,
1751
1758
  cell_selection: "sea",
1752
1759
  wind_speed_unit: "kn",
1753
- models: ((N = A.weatherModels) == null ? void 0 : N.split(",")) || ["best_match"],
1760
+ models: ((N = W.weatherModels) == null ? void 0 : N.split(",")) || ["best_match"],
1754
1761
  timezone: "auto"
1755
1762
  };
1756
- let X;
1763
+ let d;
1757
1764
  if (p) {
1758
1765
  const V = this.timezoneOffset(M, b);
1759
- X = L.utc(p).utcOffset(V), X.subtract(V > 0 ? V : -V, "h");
1766
+ d = n.utc(p).utcOffset(V), d.subtract(V > 0 ? V : -V, "h");
1760
1767
  }
1761
- o && (q.daily = ((S = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : S.split(",")) || []), X || (A.forecastDays = A.forecastDays || 1, A.pastDays = 0, Y = !0), Y && (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);
1762
- const R = await this.weatherForecast(q, A), T = {
1768
+ o && (q.daily = ((S = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : S.split(",")) || []), d || (W.forecastDays = W.forecastDays || 1, W.pastDays = 0, Y = !0), Y && (q.hourly = ((l = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : l.split(",")) || []), W.pastDays = W.pastDays || 0, W.pastDays = W.pastDays > 7 ? 7 : W.pastDays < 0 ? 0 : W.pastDays, W.forecastDays = W.forecastDays ?? 1, W.forecastDays = W.forecastDays > 14 ? 14 : W.forecastDays < 0 ? 1 : W.forecastDays, this.prepare(d == null ? void 0 : d.utc().format(), !1, q, W);
1769
+ const R = await this.weatherForecast(q, W), L = {
1763
1770
  apikey: this.apikey,
1764
1771
  latitude: M,
1765
1772
  longitude: b,
1766
1773
  cell_selection: "sea",
1767
1774
  timezone: "auto",
1768
1775
  wind_speed_unit: "kn",
1769
- models: this.pickMarineModels(A.marineModels)
1776
+ models: this.pickMarineModels(W.marineModels)
1770
1777
  };
1771
- o && (T.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), X || (A.forecastDays = A.forecastDays || 1, Y = !0), Y && (T.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), this.prepare(X == null ? void 0 : X.utc().format(), !0, T, A);
1772
- const d = await this.marineForecast(T, A);
1773
- return { weather: R, marine: d };
1778
+ o && (L.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), d || (W.forecastDays = W.forecastDays || 1, Y = !0), Y && (L.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), this.prepare(d == null ? void 0 : d.utc().format(), !0, L, W);
1779
+ const a = await this.marineForecast(L, W);
1780
+ return { weather: R, marine: a };
1774
1781
  }
1775
1782
  /**
1776
1783
  * 历史再分析数据
@@ -1793,14 +1800,14 @@ class C0 {
1793
1800
  * @param withMarine
1794
1801
  * @param options
1795
1802
  */
1796
- async spotHistorical(M, b, p, O, o = !0, Y = !0, A = !1, q = {
1803
+ async spotHistorical(M, b, p, O, o = !0, Y = !0, W = !1, q = {
1797
1804
  precision: 6
1798
1805
  }) {
1799
1806
  var l, V;
1800
- b = this.toStdLng(b), this.debug && Z.info("[%s] spot historical params: %j", q.requestId, { lat: M, lng: b, startDate: p, endDate: O, withMarine: A, options: q });
1801
- const X = this.timezoneOffset(M, b), R = L.utc(p).utcOffset(X), T = L.utc(O).utcOffset(X);
1802
- R.subtract(X > 0 ? X : -X, "h"), T.subtract(X > 0 ? X : -X, "h");
1803
- const d = {
1807
+ b = this.toStdLng(b), this.debug && Z.info("[%s] spot historical params: %j", q.requestId, { lat: M, lng: b, startDate: p, endDate: O, withMarine: W, options: q });
1808
+ const d = this.timezoneOffset(M, b), R = n.utc(p).utcOffset(d), L = n.utc(O).utcOffset(d);
1809
+ R.subtract(d > 0 ? d : -d, "h"), L.subtract(d > 0 ? d : -d, "h");
1810
+ const a = {
1804
1811
  apikey: this.apikey,
1805
1812
  latitude: M,
1806
1813
  longitude: b,
@@ -1810,12 +1817,12 @@ class C0 {
1810
1817
  timezone: "auto",
1811
1818
  url: this.HISTORICAL.OM_URL,
1812
1819
  start_date: R.format("YYYY-MM-DD"),
1813
- end_date: T.format("YYYY-MM-DD")
1820
+ end_date: L.format("YYYY-MM-DD")
1814
1821
  };
1815
- o && (d.daily = this.HISTORICAL.WEATHER_VARIABLES.DAILY.split(",")), Y && (d.hourly = this.HISTORICAL.WEATHER_VARIABLES.HOURLY.split(","));
1816
- const N = await this.weatherForecast(d, q);
1822
+ o && (a.daily = this.HISTORICAL.WEATHER_VARIABLES.DAILY.split(",")), Y && (a.hourly = this.HISTORICAL.WEATHER_VARIABLES.HOURLY.split(","));
1823
+ const N = await this.weatherForecast(a, q);
1817
1824
  let S;
1818
- if (A) {
1825
+ if (W) {
1819
1826
  const E = {
1820
1827
  apikey: this.apikey,
1821
1828
  latitude: M,
@@ -1828,7 +1835,7 @@ class C0 {
1828
1835
  hourly: this.FORECAST.MARINE_VARIABLES.HOURLY.split(","),
1829
1836
  url: this.FORECAST.OM_MARINE_URL,
1830
1837
  start_date: R.format("YYYY-MM-DD"),
1831
- end_date: T.format("YYYY-MM-DD")
1838
+ end_date: L.format("YYYY-MM-DD")
1832
1839
  };
1833
1840
  S = await this.marineForecast(E, q);
1834
1841
  }
@@ -1849,8 +1856,8 @@ class C0 {
1849
1856
  precision: 6
1850
1857
  }) {
1851
1858
  b = this.toStdLng(b), this.debug && Z.info("[%s] spot seasonal params: %j", Y.requestId, { lat: M, lng: b, startDate: p, endDate: O, options: Y });
1852
- const A = this.timezoneOffset(M, b), q = L.utc(p).utcOffset(A), X = O ? L.utc(O).utcOffset(A) : q.clone().add(1, "month");
1853
- q.subtract(A > 0 ? A : -A, "h"), X.subtract(A > 0 ? A : -A, "h");
1859
+ const W = this.timezoneOffset(M, b), q = n.utc(p).utcOffset(W), d = O ? n.utc(O).utcOffset(W) : q.clone().add(1, "month");
1860
+ q.subtract(W > 0 ? W : -W, "h"), d.subtract(W > 0 ? W : -W, "h");
1854
1861
  const R = {
1855
1862
  apikey: this.apikey,
1856
1863
  latitude: M,
@@ -1860,7 +1867,7 @@ class C0 {
1860
1867
  timezone: "auto",
1861
1868
  url: this.SEASONAL.OM_URL,
1862
1869
  start_date: q.format("YYYY-MM-DD"),
1863
- end_date: X.format("YYYY-MM-DD"),
1870
+ end_date: d.format("YYYY-MM-DD"),
1864
1871
  daily: this.SEASONAL.WEATHER_VARIABLES.DAILY.split(",")
1865
1872
  };
1866
1873
  return o && (R.six_hourly = this.SEASONAL.WEATHER_VARIABLES.SIX_HOURLY.split(",")), Y.memberLength = 4, { weather: await this.weatherForecast(R, Y) };
@@ -1888,46 +1895,46 @@ class C0 {
1888
1895
  async spotClimate(M, b, p, O, o = {
1889
1896
  precision: 6
1890
1897
  }) {
1891
- var T;
1898
+ var L;
1892
1899
  b = this.toStdLng(b), this.debug && Z.info("[%s] spot climate params: %j", o.requestId, { lat: M, lng: b, startDate: p, endDate: O, options: o });
1893
- const Y = this.timezoneOffset(M, b), A = L.utc(p).utcOffset(Y), q = O ? L.utc(O).utcOffset(Y) : A.clone().add(1, "day");
1894
- q.subtract(Y > 0 ? Y : -Y, "h"), A.subtract(Y > 0 ? Y : -Y, "h");
1895
- const X = {
1900
+ const Y = this.timezoneOffset(M, b), W = n.utc(p).utcOffset(Y), q = O ? n.utc(O).utcOffset(Y) : W.clone().add(1, "day");
1901
+ q.subtract(Y > 0 ? Y : -Y, "h"), W.subtract(Y > 0 ? Y : -Y, "h");
1902
+ const d = {
1896
1903
  apikey: this.apikey,
1897
1904
  latitude: M,
1898
1905
  longitude: b,
1899
1906
  cell_selection: "sea",
1900
1907
  wind_speed_unit: "kn",
1901
- models: ((T = o.weatherModels) == null ? void 0 : T.split(",")) || "EC_Earth3P_HR",
1908
+ models: ((L = o.weatherModels) == null ? void 0 : L.split(",")) || "EC_Earth3P_HR",
1902
1909
  timezone: "auto",
1903
1910
  url: this.CLIMATE.OM_URL,
1904
- start_date: A.format("YYYY-MM-DD"),
1911
+ start_date: W.format("YYYY-MM-DD"),
1905
1912
  end_date: q.format("YYYY-MM-DD"),
1906
1913
  daily: this.CLIMATE.WEATHER_VARIABLES.DAILY.split(",")
1907
1914
  };
1908
- return { weather: await this.weatherForecast(X, o) };
1915
+ return { weather: await this.weatherForecast(d, o) };
1909
1916
  }
1910
1917
  async update(M = {}) {
1911
- const b = L.unix(this.METEO2_UPDATE.etime), p = this.METEO2_UPDATE.version, O = L();
1918
+ const b = n.unix(this.METEO2_UPDATE.etime), p = this.METEO2_UPDATE.version, O = n();
1912
1919
  if (!p || b.clone().add(10, "minute").isBefore(O)) {
1913
- const o = M.url || "https://meteo3agent.idmwx.com/api/agents/update", A = await (await fetch(o, {
1920
+ const o = M.url || "https://meteo3agent.idmwx.com/api/agents/update", W = await (await fetch(o, {
1914
1921
  headers: {
1915
1922
  "Content-Type": "application/json",
1916
1923
  Authorization: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNsYmY5M3I0YTAwMDE4Ymx0NWJ4emFwNWMiLCJyb2xlIjoyMDQ3LCJpYXQiOjE2NzA1NTM0NzAsImV4cCI6Mzg3ODA3MzQ3MH0.MxTv0yLGarZCtOSCZfJHMqrXNMNN0-OL4gBGKGcYcc8"
1917
1924
  }
1918
1925
  })).json();
1919
- if (A.code === 0) {
1920
- const q = A.data, X = k.standardWeatherModels();
1921
- for (const R of X) {
1922
- const T = k.autoPickSubCategories(R.alias), N = q.filter((S) => T.includes(S.category)).map((S) => {
1926
+ if (W.code === 0) {
1927
+ const q = W.data, d = k.standardWeatherModels();
1928
+ for (const R of d) {
1929
+ const L = k.autoPickSubCategories(R.alias), N = q.filter((S) => L.includes(S.category)).map((S) => {
1923
1930
  var l, V, E, h, y, _;
1924
1931
  return {
1925
1932
  category: S.category,
1926
1933
  meta: {
1927
- endTime: L.unix((l = S.meta) == null ? void 0 : l.data_end_time).utc().format(),
1928
- availabilityTime: L.unix((V = S.meta) == null ? void 0 : V.last_run_availability_time).utc().format(),
1929
- initialisationTime: L.unix((E = S.meta) == null ? void 0 : E.last_run_initialisation_time).utc().format(),
1930
- modificationTime: L.unix((h = S.meta) == null ? void 0 : h.last_run_modification_time).utc().format(),
1934
+ endTime: n.unix((l = S.meta) == null ? void 0 : l.data_end_time).utc().format(),
1935
+ availabilityTime: n.unix((V = S.meta) == null ? void 0 : V.last_run_availability_time).utc().format(),
1936
+ initialisationTime: n.unix((E = S.meta) == null ? void 0 : E.last_run_initialisation_time).utc().format(),
1937
+ modificationTime: n.unix((h = S.meta) == null ? void 0 : h.last_run_modification_time).utc().format(),
1931
1938
  temporalResolution: Math.round(((y = S.meta) == null ? void 0 : y.temporal_resolution_seconds) / 3600),
1932
1939
  frequency: Math.round(((_ = S.meta) == null ? void 0 : _.update_interval_seconds) / 3600)
1933
1940
  }
@@ -1985,27 +1992,27 @@ class D0 {
1985
1992
  * @param datum
1986
1993
  * @param options
1987
1994
  */
1988
- async tidesForecast(M, b, p = 7, O = "today", o = !0, Y = !1, A = !1, q = "CD", X = {}) {
1989
- 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: o, heights: Y, datums: A, datum: q });
1995
+ async tidesForecast(M, b, p = 7, O = "today", o = !0, Y = !1, W = !1, q = "CD", d = {}) {
1996
+ O = O || "today", p = p || 7, b = this.toStdLng(b), this.debug && W0.info("[%s] spot tides forecast params: %j", d.requestId, { lat: M, lng: b, date: O, extremes: o, heights: Y, datums: W, datum: q });
1990
1997
  let R = `https://www.worldtides.info/api/v3?lat=${M}&lon=${b}&days=${p}&date=${O}&datum=${q}&key=${this.apikey}&localtime`;
1991
- o && (R = `${R}&extremes`), Y && (R = `${R}&heights`), A && (R = `${R}&datums`);
1992
- const d = await (await fetch(R)).json();
1993
- return d.status === 200 ? {
1998
+ o && (R = `${R}&extremes`), Y && (R = `${R}&heights`), W && (R = `${R}&datums`);
1999
+ const a = await (await fetch(R)).json();
2000
+ return a.status === 200 ? {
1994
2001
  rqt: {
1995
2002
  lat: M,
1996
2003
  lng: b
1997
2004
  },
1998
2005
  rsp: {
1999
- lat: d.responseLat,
2000
- lng: d.responseLon
2006
+ lat: a.responseLat,
2007
+ lng: a.responseLon
2001
2008
  },
2002
- atlas: d.atlas,
2003
- datum: d.responseDatum,
2004
- extremes: d.extremes || [],
2005
- heights: d.heights || [],
2006
- stations: d.stations || [],
2007
- datums: d.datums || []
2008
- } : d;
2009
+ atlas: a.atlas,
2010
+ datum: a.responseDatum,
2011
+ extremes: a.extremes || [],
2012
+ heights: a.heights || [],
2013
+ stations: a.stations || [],
2014
+ datums: a.datums || []
2015
+ } : a;
2009
2016
  }
2010
2017
  }
2011
2018
  export {