@idm-plugin/meteo2 1.0.3 → 1.0.5

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
@@ -3,18 +3,18 @@ var l0 = (M, z, b) => z in M ? V0(M, z, { enumerable: !0, configurable: !0, writ
3
3
  var F = (M, z, b) => (l0(M, typeof z != "symbol" ? z + "" : z, b), b);
4
4
  import e0 from "@log4js-node/log4js-api";
5
5
  import i from "moment";
6
- import $ from "got";
6
+ import x from "got";
7
7
  import { fetchWeatherApi as t0 } from "openmeteo";
8
- import { Meteo2Assist as D } from "@idm-plugin/meteo";
9
- import Z0 from "xml2js";
8
+ import { Meteo2Assist as g } from "@idm-plugin/meteo";
9
+ import m0 from "xml2js";
10
10
  import { LaneHelper as f0 } from "@idm-plugin/geo2";
11
- let G;
11
+ let P;
12
12
  try {
13
- G = e0.getLogger("meteo");
13
+ P = e0.getLogger("meteo");
14
14
  } catch {
15
15
  } finally {
16
16
  }
17
- var m0 = /* @__PURE__ */ ((M) => (M.Arome = "arome", M.IconEU = "iconEu", M.GFS = "gfs", M.GFSWave = "gfsWave", M.NamConus = "namConus", M.NamHawaii = "namHawaii", M.NamAlaska = "namAlaska", M.Geos5 = "geos5", M))(m0 || {});
17
+ var Z0 = /* @__PURE__ */ ((M) => (M.Arome = "arome", M.IconEU = "iconEu", M.GFS = "gfs", M.GFSWave = "gfsWave", M.NamConus = "namConus", M.NamHawaii = "namHawaii", M.NamAlaska = "namAlaska", M.Geos5 = "geos5", M))(Z0 || {});
18
18
  class j0 {
19
19
  /**
20
20
  * 点查海洋气象要素(全量)
@@ -37,14 +37,14 @@ class j0 {
37
37
  },
38
38
  timeout: 3e4
39
39
  }, a = i(), n = a.valueOf();
40
- O.isBefore(a.subtract(1, "month")) && (G == null || G.warn("[%s] get history meteo on %s: %j", c.requestId, O.format(), Y));
41
- const X = "https://aod4idm.idmwx.com/api/ocean/point", d = await $.get(X, Y).json(), t = i().valueOf();
42
- if (G == null || G.info("[%s] get meteo(cost: %d ms) from %s with options: %j", c.requestId, t - n, X, Y), (d == null ? void 0 : d.code) === 0)
40
+ O.isBefore(a.subtract(1, "month")) && (P == null || P.warn("[%s] get history meteo on %s: %j", c.requestId, O.format(), Y));
41
+ const X = "https://aod4idm.idmwx.com/api/ocean/point", d = await x.get(X, Y).json(), t = i().valueOf();
42
+ if (P == null || P.info("[%s] get meteo(cost: %d ms) from %s with options: %j", c.requestId, t - n, X, Y), (d == null ? void 0 : d.code) === 0)
43
43
  return {
44
44
  ...d.data,
45
45
  source: A
46
46
  };
47
- G == null || G.warn("[%s] get meteo failed: %j", c.requestId, d);
47
+ P == null || P.warn("[%s] get meteo failed: %j", c.requestId, d);
48
48
  }
49
49
  /**
50
50
  * 点查海洋气象要素(指定要素组合)
@@ -72,14 +72,14 @@ class j0 {
72
72
  },
73
73
  timeout: 3e4
74
74
  }, a = i(), n = a.valueOf();
75
- O.isBefore(a.subtract(1, "month")) && (G == null || G.warn("[%s] get history factors on %s: %j", c.requestId, O.format(), Y));
76
- const X = "https://aod4idm.idmwx.com/api/ocean/factor", d = await $.get(X, Y).json(), t = i().valueOf();
77
- if (G == null || G.info("[%s] get factors(cost: %d ms) from %s with options: %j", c.requestId, t - n, X, Y), (d == null ? void 0 : d.code) === 0)
75
+ O.isBefore(a.subtract(1, "month")) && (P == null || P.warn("[%s] get history factors on %s: %j", c.requestId, O.format(), Y));
76
+ const X = "https://aod4idm.idmwx.com/api/ocean/factor", d = await x.get(X, Y).json(), t = i().valueOf();
77
+ if (P == null || P.info("[%s] get factors(cost: %d ms) from %s with options: %j", c.requestId, t - n, X, Y), (d == null ? void 0 : d.code) === 0)
78
78
  return {
79
79
  ...d.data,
80
80
  source: A
81
81
  };
82
- G == null || G.warn("[%s] get factors failed: %j", c.requestId, d);
82
+ P == null || P.warn("[%s] get factors failed: %j", c.requestId, d);
83
83
  }
84
84
  /**
85
85
  * @see https://api.windy.com/point-forecast/docs
@@ -89,7 +89,7 @@ class j0 {
89
89
  const A = "https://api.windy.com/api/point-forecast/v2", c = [];
90
90
  try {
91
91
  let O = i().valueOf();
92
- const Y = await $.post(A, {
92
+ const Y = await x.post(A, {
93
93
  headers: {
94
94
  "Content-Type": "application/json"
95
95
  },
@@ -119,8 +119,8 @@ class j0 {
119
119
  }
120
120
  }).json();
121
121
  let a = i().valueOf();
122
- G == null || G.info("[%s] get gfs-factors(cost: %d ms) from %s", W.requestId, a - O, A), O = a;
123
- const n = await $.post(A, {
122
+ P == null || P.info("[%s] get gfs-factors(cost: %d ms) from %s", W.requestId, a - O, A), O = a;
123
+ const n = await x.post(A, {
124
124
  headers: {
125
125
  "Content-Type": "application/json"
126
126
  },
@@ -133,7 +133,7 @@ class j0 {
133
133
  levels: ["surface"]
134
134
  }
135
135
  }).json();
136
- a = i().valueOf(), G == null || G.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", W.requestId, a - O, A);
136
+ a = i().valueOf(), P == null || P.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", W.requestId, a - O, A);
137
137
  for (let d = 0; d < Y.ts.length; d++) {
138
138
  const t = this.populateUVFactor(Y["wind_u-surface"][d], Y["wind_v-surface"][d], !1, W);
139
139
  t.scale = this.calculateBeaufortWindForceScale(t.speed), c.push({
@@ -160,14 +160,14 @@ class j0 {
160
160
  }
161
161
  const X = [];
162
162
  for (let d = 0; d < n.ts.length; d++) {
163
- const t = this.calculateDouglasScale(n["waves_height-surface"][d], n["waves_direction-surface"][d], n["waves_period-surface"][d]), r = this.calculateDouglasScale(n["wwaves_height-surface"][d], n["wwaves_direction-surface"][d], n["wwaves_period-surface"][d]), u = this.calculateDouglasScale(n["swell1_height-surface"][d], n["swell1_direction-surface"][d], n["swell1_period-surface"][d]), V = this.calculateDouglasScale(n["swell2_height-surface"][d], n["swell2_direction-surface"][d], n["swell2_period-surface"][d]);
163
+ const t = this.calculateDouglasScale(n["waves_height-surface"][d], n["waves_direction-surface"][d], n["waves_period-surface"][d]), r = this.calculateDouglasScale(n["wwaves_height-surface"][d], n["wwaves_direction-surface"][d], n["wwaves_period-surface"][d]), u = this.calculateDouglasScale(n["swell1_height-surface"][d], n["swell1_direction-surface"][d], n["swell1_period-surface"][d]), s = this.calculateDouglasScale(n["swell2_height-surface"][d], n["swell2_direction-surface"][d], n["swell2_period-surface"][d]);
164
164
  X.push({
165
165
  utc: i(n.ts[d]).utc().format(),
166
166
  wave: {
167
167
  sig: t,
168
168
  wd: r,
169
169
  swell: u,
170
- swell2: V
170
+ swell2: s
171
171
  }
172
172
  });
173
173
  }
@@ -176,7 +176,7 @@ class j0 {
176
176
  d.wave = t == null ? void 0 : t.wave;
177
177
  }
178
178
  } catch (O) {
179
- G.warn("[%s] get-gfs-factor failed: %s", W.requestId, O);
179
+ P.warn("[%s] get-gfs-factor failed: %s", W.requestId, O);
180
180
  }
181
181
  return c;
182
182
  }
@@ -292,19 +292,19 @@ var U0 = { exports: {} };
292
292
  })(E0, function(z) {
293
293
  z.version === void 0 && z.default && (z = z.default);
294
294
  var b = "0.5.48", p = {}, W = {}, A = {}, c = {}, O = {}, Y;
295
- (!z || typeof z.version != "string") && k("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
295
+ (!z || typeof z.version != "string") && J("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
296
296
  var a = z.version.split("."), n = +a[0], X = +a[1];
297
- (n < 2 || n === 2 && X < 6) && k("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + z.version + ". See momentjs.com");
297
+ (n < 2 || n === 2 && X < 6) && J("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + z.version + ". See momentjs.com");
298
298
  function d(o) {
299
299
  return o > 96 ? o - 87 : o > 64 ? o - 29 : o - 48;
300
300
  }
301
301
  function t(o) {
302
- var q = 0, e = o.split("."), R = e[0], T = e[1] || "", s = 1, C, l = 0, h = 1;
302
+ var q = 0, e = o.split("."), R = e[0], T = e[1] || "", B = 1, C, V = 0, h = 1;
303
303
  for (o.charCodeAt(0) === 45 && (q = 1, h = -1), q; q < R.length; q++)
304
- C = d(R.charCodeAt(q)), l = 60 * l + C;
304
+ C = d(R.charCodeAt(q)), V = 60 * V + C;
305
305
  for (q = 0; q < T.length; q++)
306
- s = s / 60, C = d(T.charCodeAt(q)), l += C * s;
307
- return l * h;
306
+ B = B / 60, C = d(T.charCodeAt(q)), V += C * B;
307
+ return V * h;
308
308
  }
309
309
  function r(o) {
310
310
  for (var q = 0; q < o.length; q++)
@@ -315,7 +315,7 @@ var U0 = { exports: {} };
315
315
  o[e] = Math.round((o[e - 1] || 0) + o[e] * 6e4);
316
316
  o[q - 1] = 1 / 0;
317
317
  }
318
- function V(o, q) {
318
+ function s(o, q) {
319
319
  var e = [], R;
320
320
  for (R = 0; R < q.length; R++)
321
321
  e[R] = o[q[R]];
@@ -325,8 +325,8 @@ var U0 = { exports: {} };
325
325
  var q = o.split("|"), e = q[2].split(" "), R = q[3].split(""), T = q[4].split(" ");
326
326
  return r(e), r(R), r(T), u(T, R.length), {
327
327
  name: q[0],
328
- abbrs: V(q[1].split(" "), R),
329
- offsets: V(e, R),
328
+ abbrs: s(q[1].split(" "), R),
329
+ offsets: s(e, R),
330
330
  untils: T,
331
331
  population: q[5] | 0
332
332
  };
@@ -334,7 +334,7 @@ var U0 = { exports: {} };
334
334
  function L(o) {
335
335
  o && this._set(m(o));
336
336
  }
337
- function B(o, q) {
337
+ function U(o, q) {
338
338
  var e = q.length;
339
339
  if (o < q[0])
340
340
  return 0;
@@ -342,9 +342,9 @@ var U0 = { exports: {} };
342
342
  return e - 1;
343
343
  if (o >= q[e - 1])
344
344
  return -1;
345
- for (var R, T = 0, s = e - 1; s - T > 1; )
346
- R = Math.floor((T + s) / 2), q[R] <= o ? T = R : s = R;
347
- return s;
345
+ for (var R, T = 0, B = e - 1; B - T > 1; )
346
+ R = Math.floor((T + B) / 2), q[R] <= o ? T = R : B = R;
347
+ return B;
348
348
  }
349
349
  L.prototype = {
350
350
  _set: function(o) {
@@ -352,7 +352,7 @@ var U0 = { exports: {} };
352
352
  },
353
353
  _index: function(o) {
354
354
  var q = +o, e = this.untils, R;
355
- if (R = B(q, e), R >= 0)
355
+ if (R = U(q, e), R >= 0)
356
356
  return R;
357
357
  },
358
358
  countries: function() {
@@ -362,9 +362,9 @@ var U0 = { exports: {} };
362
362
  });
363
363
  },
364
364
  parse: function(o) {
365
- var q = +o, e = this.offsets, R = this.untils, T = R.length - 1, s, C, l, h;
365
+ var q = +o, e = this.offsets, R = this.untils, T = R.length - 1, B, C, V, h;
366
366
  for (h = 0; h < T; h++)
367
- if (s = e[h], C = e[h + 1], l = e[h && h - 1], s < C && I.moveAmbiguousForward ? s = C : s > l && I.moveInvalidForward && (s = l), q < R[h] - s * 6e4)
367
+ if (B = e[h], C = e[h + 1], V = e[h && h - 1], B < C && I.moveAmbiguousForward ? B = C : B > V && I.moveInvalidForward && (B = V), q < R[h] - B * 6e4)
368
368
  return e[h];
369
369
  return e[T];
370
370
  },
@@ -372,39 +372,39 @@ var U0 = { exports: {} };
372
372
  return this.abbrs[this._index(o)];
373
373
  },
374
374
  offset: function(o) {
375
- return k("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(o)];
375
+ return J("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(o)];
376
376
  },
377
377
  utcOffset: function(o) {
378
378
  return this.offsets[this._index(o)];
379
379
  }
380
380
  };
381
- function E(o, q) {
381
+ function Z(o, q) {
382
382
  this.name = o, this.zones = q;
383
383
  }
384
384
  function N(o) {
385
385
  var q = o.toTimeString(), e = q.match(/\([a-z ]+\)/i);
386
386
  e && e[0] ? (e = e[0].match(/[A-Z]/g), e = e ? e.join("") : void 0) : (e = q.match(/[A-Z]{3,5}/g), e = e ? e[0] : void 0), e === "GMT" && (e = void 0), this.at = +o, this.abbr = e, this.offset = o.getTimezoneOffset();
387
387
  }
388
- function Z(o) {
388
+ function l(o) {
389
389
  this.zone = o, this.offsetScore = 0, this.abbrScore = 0;
390
390
  }
391
- Z.prototype.scoreOffsetAt = function(o) {
391
+ l.prototype.scoreOffsetAt = function(o) {
392
392
  this.offsetScore += Math.abs(this.zone.utcOffset(o.at) - o.offset), this.zone.abbr(o.at).replace(/[^A-Z]/g, "") !== o.abbr && this.abbrScore++;
393
393
  };
394
- function f(o, q) {
394
+ function _(o, q) {
395
395
  for (var e, R; R = ((q.at - o.at) / 12e4 | 0) * 6e4; )
396
396
  e = new N(new Date(o.at + R)), e.offset === o.offset ? o = e : q = e;
397
397
  return o;
398
398
  }
399
- function U() {
400
- var o = (/* @__PURE__ */ new Date()).getFullYear() - 2, q = new N(new Date(o, 0, 1)), e = q.offset, R = [q], T, s, C, l;
401
- for (l = 1; l < 48; l++)
402
- C = new Date(o, l, 1).getTimezoneOffset(), C !== e && (s = new N(new Date(o, l, 1)), T = f(q, s), R.push(T), R.push(new N(new Date(T.at + 6e4))), q = s, e = C);
403
- for (l = 0; l < 4; l++)
404
- R.push(new N(new Date(o + l, 0, 1))), R.push(new N(new Date(o + l, 6, 1)));
399
+ function f() {
400
+ var o = (/* @__PURE__ */ new Date()).getFullYear() - 2, q = new N(new Date(o, 0, 1)), e = q.offset, R = [q], T, B, C, V;
401
+ for (V = 1; V < 48; V++)
402
+ C = new Date(o, V, 1).getTimezoneOffset(), C !== e && (B = new N(new Date(o, V, 1)), T = _(q, B), R.push(T), R.push(new N(new Date(T.at + 6e4))), q = B, e = C);
403
+ for (V = 0; V < 4; V++)
404
+ R.push(new N(new Date(o + V, 0, 1))), R.push(new N(new Date(o + V, 6, 1)));
405
405
  return R;
406
406
  }
407
- function P(o, q) {
407
+ function E(o, q) {
408
408
  return o.offsetScore !== q.offsetScore ? o.offsetScore - q.offsetScore : o.abbrScore !== q.abbrScore ? o.abbrScore - q.abbrScore : o.zone.population !== q.zone.population ? q.zone.population - o.zone.population : q.zone.name.localeCompare(o.zone.name);
409
409
  }
410
410
  function w(o, q) {
@@ -412,40 +412,40 @@ var U0 = { exports: {} };
412
412
  for (r(q), e = 0; e < q.length; e++)
413
413
  R = q[e], O[R] = O[R] || {}, O[R][o] = !0;
414
414
  }
415
- function K(o) {
416
- var q = o.length, e = {}, R = [], T = {}, s, C, l, h;
417
- for (s = 0; s < q; s++)
418
- if (l = o[s].offset, !T.hasOwnProperty(l)) {
419
- h = O[l] || {};
415
+ function D(o) {
416
+ var q = o.length, e = {}, R = [], T = {}, B, C, V, h;
417
+ for (B = 0; B < q; B++)
418
+ if (V = o[B].offset, !T.hasOwnProperty(V)) {
419
+ h = O[V] || {};
420
420
  for (C in h)
421
421
  h.hasOwnProperty(C) && (e[C] = !0);
422
- T[l] = !0;
422
+ T[V] = !0;
423
423
  }
424
- for (s in e)
425
- e.hasOwnProperty(s) && R.push(c[s]);
424
+ for (B in e)
425
+ e.hasOwnProperty(B) && R.push(c[B]);
426
426
  return R;
427
427
  }
428
- function x() {
428
+ function v() {
429
429
  try {
430
430
  var o = Intl.DateTimeFormat().resolvedOptions().timeZone;
431
431
  if (o && o.length > 3) {
432
432
  var q = c[j(o)];
433
433
  if (q)
434
434
  return q;
435
- k("Moment Timezone found " + o + " from the Intl api, but did not have that data loaded.");
435
+ J("Moment Timezone found " + o + " from the Intl api, but did not have that data loaded.");
436
436
  }
437
437
  } catch {
438
438
  }
439
- var e = U(), R = e.length, T = K(e), s = [], C, l, h;
440
- for (l = 0; l < T.length; l++) {
441
- for (C = new Z(g(T[l])), h = 0; h < R; h++)
439
+ var e = f(), R = e.length, T = D(e), B = [], C, V, h;
440
+ for (V = 0; V < T.length; V++) {
441
+ for (C = new l(y(T[V])), h = 0; h < R; h++)
442
442
  C.scoreOffsetAt(e[h]);
443
- s.push(C);
443
+ B.push(C);
444
444
  }
445
- return s.sort(P), s.length > 0 ? s[0].zone.name : void 0;
445
+ return B.sort(E), B.length > 0 ? B[0].zone.name : void 0;
446
446
  }
447
447
  function q0(o) {
448
- return (!Y || o) && (Y = x()), Y;
448
+ return (!Y || o) && (Y = v()), Y;
449
449
  }
450
450
  function j(o) {
451
451
  return (o || "").toLowerCase().replace(/\//g, "_");
@@ -455,10 +455,10 @@ var U0 = { exports: {} };
455
455
  for (typeof o == "string" && (o = [o]), q = 0; q < o.length; q++)
456
456
  R = o[q].split("|"), e = R[0], T = j(e), p[T] = o[q], c[T] = e, w(T, R[2].split(" "));
457
457
  }
458
- function g(o, q) {
458
+ function y(o, q) {
459
459
  o = j(o);
460
460
  var e = p[o], R;
461
- return e instanceof L ? e : typeof e == "string" ? (e = new L(e), p[o] = e, e) : W[o] && q !== g && (R = g(W[o], g)) ? (e = p[o] = new L(), e._set(R), e.name = c[o], e) : null;
461
+ return e instanceof L ? e : typeof e == "string" ? (e = new L(e), p[o] = e, e) : W[o] && q !== y && (R = y(W[o], y)) ? (e = p[o] = new L(), e._set(R), e.name = c[o], e) : null;
462
462
  }
463
463
  function Y0() {
464
464
  var o, q = [];
@@ -474,24 +474,24 @@ var U0 = { exports: {} };
474
474
  for (typeof o == "string" && (o = [o]), q = 0; q < o.length; q++)
475
475
  e = o[q].split("|"), R = j(e[0]), T = j(e[1]), W[R] = T, c[R] = e[0], W[T] = R, c[T] = e[1];
476
476
  }
477
- function X0(o) {
477
+ function R0(o) {
478
478
  var q, e, R, T;
479
479
  if (!(!o || !o.length))
480
480
  for (q = 0; q < o.length; q++)
481
- T = o[q].split("|"), e = T[0].toUpperCase(), R = T[1].split(" "), A[e] = new E(
481
+ T = o[q].split("|"), e = T[0].toUpperCase(), R = T[1].split(" "), A[e] = new Z(
482
482
  e,
483
483
  R
484
484
  );
485
485
  }
486
- function R0(o) {
486
+ function X0(o) {
487
487
  return o = o.toUpperCase(), A[o] || null;
488
488
  }
489
489
  function M0(o, q) {
490
- if (o = R0(o), !o)
490
+ if (o = X0(o), !o)
491
491
  return null;
492
492
  var e = o.zones.sort();
493
493
  return q ? e.map(function(R) {
494
- var T = g(R);
494
+ var T = y(R);
495
495
  return {
496
496
  name: R,
497
497
  offset: T.utcOffset(/* @__PURE__ */ new Date())
@@ -499,24 +499,24 @@ var U0 = { exports: {} };
499
499
  }) : e;
500
500
  }
501
501
  function H(o) {
502
- c0(o.zones), O0(o.links), X0(o.countries), I.dataVersion = o.version;
502
+ c0(o.zones), O0(o.links), R0(o.countries), I.dataVersion = o.version;
503
503
  }
504
504
  function W0(o) {
505
- return W0.didShowError || (W0.didShowError = !0, k("moment.tz.zoneExists('" + o + "') has been deprecated in favor of !moment.tz.zone('" + o + "')")), !!g(o);
505
+ return W0.didShowError || (W0.didShowError = !0, J("moment.tz.zoneExists('" + o + "') has been deprecated in favor of !moment.tz.zone('" + o + "')")), !!y(o);
506
506
  }
507
507
  function o0(o) {
508
508
  var q = o._f === "X" || o._f === "x";
509
509
  return !!(o._a && o._tzm === void 0 && !q);
510
510
  }
511
- function k(o) {
511
+ function J(o) {
512
512
  typeof console < "u" && typeof console.error == "function" && console.error(o);
513
513
  }
514
514
  function I(o) {
515
515
  var q = Array.prototype.slice.call(arguments, 0, -1), e = arguments[arguments.length - 1], R = z.utc.apply(null, q), T;
516
- return !z.isMoment(o) && o0(R) && (T = g(e)) && R.add(T.parse(R), "minutes"), R.tz(e), R;
516
+ return !z.isMoment(o) && o0(R) && (T = y(e)) && R.add(T.parse(R), "minutes"), R.tz(e), R;
517
517
  }
518
- I.version = b, I.dataVersion = "", I._zones = p, I._links = W, I._names = c, I._countries = A, I.add = c0, I.link = O0, I.load = H, I.zone = g, I.zoneExists = W0, I.guess = q0, I.names = Y0, I.Zone = L, I.unpack = m, I.unpackBase60 = t, I.needsOffset = o0, I.moveInvalidForward = !0, I.moveAmbiguousForward = !1, I.countries = p0, I.zonesForCountry = M0;
519
- var y = z.fn;
518
+ I.version = b, I.dataVersion = "", I._zones = p, I._links = W, I._names = c, I._countries = A, I.add = c0, I.link = O0, I.load = H, I.zone = y, I.zoneExists = W0, I.guess = q0, I.names = Y0, I.Zone = L, I.unpack = m, I.unpackBase60 = t, I.needsOffset = o0, I.moveInvalidForward = !0, I.moveAmbiguousForward = !1, I.countries = p0, I.zonesForCountry = M0;
519
+ var K = z.fn;
520
520
  z.tz = I, z.defaultZone = null, z.updateOffset = function(o, q) {
521
521
  var e = z.defaultZone, R;
522
522
  if (o._z === void 0 && (e && o0(o) && !o._isUTC && o.isValid() && (o._d = z.utc(o._a)._d, o.utc().add(e.parse(o), "minutes")), o._z = e), o._z)
@@ -525,11 +525,11 @@ var U0 = { exports: {} };
525
525
  o.utcOffset(-R, q), o._z = T;
526
526
  } else
527
527
  o.zone(R, q);
528
- }, y.tz = function(o, q) {
528
+ }, K.tz = function(o, q) {
529
529
  if (o) {
530
530
  if (typeof o != "string")
531
531
  throw new Error("Time zone name must be a string, got " + o + " [" + typeof o + "]");
532
- return this._z = g(o), this._z ? z.updateOffset(this, q) : k("Moment Timezone has no data for " + o + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
532
+ return this._z = y(o), this._z ? z.updateOffset(this, q) : J("Moment Timezone has no data for " + o + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
533
533
  }
534
534
  if (this._z)
535
535
  return this._z.name;
@@ -549,8 +549,8 @@ var U0 = { exports: {} };
549
549
  return arguments.length > 0 && (this._z = null), o.apply(this, arguments);
550
550
  };
551
551
  }
552
- y.zoneName = d0(y.zoneName), y.zoneAbbr = d0(y.zoneAbbr), y.utc = a0(y.utc), y.local = a0(y.local), y.utcOffset = L0(y.utcOffset), z.tz.setDefault = function(o) {
553
- return (n < 2 || n === 2 && X < 9) && k("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + z.version + "."), z.defaultZone = o ? g(o) : null, z;
552
+ K.zoneName = d0(K.zoneName), K.zoneAbbr = d0(K.zoneAbbr), K.utc = a0(K.utc), K.local = a0(K.local), K.utcOffset = L0(K.utcOffset), z.tz.setDefault = function(o) {
553
+ return (n < 2 || n === 2 && X < 9) && J("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + z.version + "."), z.defaultZone = o ? y(o) : null, z;
554
554
  };
555
555
  var b0 = z.momentProperties;
556
556
  return Object.prototype.toString.call(b0) === "[object Array]" ? (b0.push("_z"), b0.push("_a")) : b0 && (b0._z = null), z;
@@ -1414,19 +1414,19 @@ var y0 = _0;
1414
1414
  y0.tz.load(g0);
1415
1415
  var i0 = {};
1416
1416
  Object.defineProperty(i0, "__esModule", { value: !0 });
1417
- var v = i0.Variable = void 0, u0;
1417
+ var k = i0.Variable = void 0, u0;
1418
1418
  (function(M) {
1419
1419
  M[M.undefined = 0] = "undefined", M[M.apparent_temperature = 1] = "apparent_temperature", M[M.cape = 2] = "cape", M[M.cloud_cover = 3] = "cloud_cover", M[M.cloud_cover_high = 4] = "cloud_cover_high", M[M.cloud_cover_low = 5] = "cloud_cover_low", M[M.cloud_cover_mid = 6] = "cloud_cover_mid", M[M.daylight_duration = 7] = "daylight_duration", M[M.dew_point = 8] = "dew_point", M[M.diffuse_radiation = 9] = "diffuse_radiation", M[M.diffuse_radiation_instant = 10] = "diffuse_radiation_instant", M[M.direct_normal_irradiance = 11] = "direct_normal_irradiance", M[M.direct_normal_irradiance_instant = 12] = "direct_normal_irradiance_instant", M[M.direct_radiation = 13] = "direct_radiation", M[M.direct_radiation_instant = 14] = "direct_radiation_instant", M[M.et0_fao_evapotranspiration = 15] = "et0_fao_evapotranspiration", M[M.evapotranspiration = 16] = "evapotranspiration", M[M.freezing_level_height = 17] = "freezing_level_height", M[M.growing_degree_days = 18] = "growing_degree_days", M[M.is_day = 19] = "is_day", M[M.latent_heat_flux = 20] = "latent_heat_flux", M[M.leaf_wetness_probability = 21] = "leaf_wetness_probability", M[M.lifted_index = 22] = "lifted_index", M[M.lightning_potential = 23] = "lightning_potential", M[M.precipitation = 24] = "precipitation", M[M.precipitation_hours = 25] = "precipitation_hours", M[M.precipitation_probability = 26] = "precipitation_probability", M[M.pressure_msl = 27] = "pressure_msl", M[M.rain = 28] = "rain", M[M.relative_humidity = 29] = "relative_humidity", M[M.runoff = 30] = "runoff", M[M.sensible_heat_flux = 31] = "sensible_heat_flux", M[M.shortwave_radiation = 32] = "shortwave_radiation", M[M.shortwave_radiation_instant = 33] = "shortwave_radiation_instant", M[M.showers = 34] = "showers", M[M.snow_depth = 35] = "snow_depth", M[M.snow_height = 36] = "snow_height", M[M.snowfall = 37] = "snowfall", M[M.snowfall_height = 38] = "snowfall_height", M[M.snowfall_water_equivalent = 39] = "snowfall_water_equivalent", M[M.sunrise = 40] = "sunrise", M[M.sunset = 41] = "sunset", M[M.soil_moisture = 42] = "soil_moisture", M[M.soil_moisture_index = 43] = "soil_moisture_index", M[M.soil_temperature = 44] = "soil_temperature", M[M.surface_pressure = 45] = "surface_pressure", M[M.surface_temperature = 46] = "surface_temperature", M[M.temperature = 47] = "temperature", M[M.terrestrial_radiation = 48] = "terrestrial_radiation", M[M.terrestrial_radiation_instant = 49] = "terrestrial_radiation_instant", M[M.total_column_integrated_water_vapour = 50] = "total_column_integrated_water_vapour", M[M.updraft = 51] = "updraft", M[M.uv_index = 52] = "uv_index", M[M.uv_index_clear_sky = 53] = "uv_index_clear_sky", M[M.vapour_pressure_deficit = 54] = "vapour_pressure_deficit", M[M.visibility = 55] = "visibility", M[M.weather_code = 56] = "weather_code", M[M.wind_direction = 57] = "wind_direction", M[M.wind_gusts = 58] = "wind_gusts", M[M.wind_speed = 59] = "wind_speed", M[M.vertical_velocity = 60] = "vertical_velocity", M[M.geopotential_height = 61] = "geopotential_height", M[M.wet_bulb_temperature = 62] = "wet_bulb_temperature", M[M.river_discharge = 63] = "river_discharge", M[M.wave_height = 64] = "wave_height", M[M.wave_period = 65] = "wave_period", M[M.wave_direction = 66] = "wave_direction", M[M.wind_wave_height = 67] = "wind_wave_height", M[M.wind_wave_period = 68] = "wind_wave_period", M[M.wind_wave_peak_period = 69] = "wind_wave_peak_period", M[M.wind_wave_direction = 70] = "wind_wave_direction", M[M.swell_wave_height = 71] = "swell_wave_height", M[M.swell_wave_period = 72] = "swell_wave_period", M[M.swell_wave_peak_period = 73] = "swell_wave_peak_period", M[M.swell_wave_direction = 74] = "swell_wave_direction", M[M.pm10 = 75] = "pm10", M[M.pm2p5 = 76] = "pm2p5", M[M.dust = 77] = "dust", M[M.aerosol_optical_depth = 78] = "aerosol_optical_depth", M[M.carbon_monoxide = 79] = "carbon_monoxide", M[M.nitrogen_dioxide = 80] = "nitrogen_dioxide", M[M.ammonia = 81] = "ammonia", M[M.ozone = 82] = "ozone", M[M.sulphur_dioxide = 83] = "sulphur_dioxide", M[M.alder_pollen = 84] = "alder_pollen", M[M.birch_pollen = 85] = "birch_pollen", M[M.grass_pollen = 86] = "grass_pollen", M[M.mugwort_pollen = 87] = "mugwort_pollen", M[M.olive_pollen = 88] = "olive_pollen", M[M.ragweed_pollen = 89] = "ragweed_pollen", M[M.european_aqi = 90] = "european_aqi", M[M.european_aqi_pm2p5 = 91] = "european_aqi_pm2p5", M[M.european_aqi_pm10 = 92] = "european_aqi_pm10", M[M.european_aqi_nitrogen_dioxide = 93] = "european_aqi_nitrogen_dioxide", M[M.european_aqi_ozone = 94] = "european_aqi_ozone", M[M.european_aqi_sulphur_dioxide = 95] = "european_aqi_sulphur_dioxide", M[M.us_aqi = 96] = "us_aqi", M[M.us_aqi_pm2p5 = 97] = "us_aqi_pm2p5", M[M.us_aqi_pm10 = 98] = "us_aqi_pm10", M[M.us_aqi_nitrogen_dioxide = 99] = "us_aqi_nitrogen_dioxide", M[M.us_aqi_ozone = 100] = "us_aqi_ozone", M[M.us_aqi_sulphur_dioxide = 101] = "us_aqi_sulphur_dioxide", M[M.us_aqi_carbon_monoxide = 102] = "us_aqi_carbon_monoxide", M[M.sunshine_duration = 103] = "sunshine_duration", M[M.convective_inhibition = 104] = "convective_inhibition", M[M.shortwave_radiation_clear_sky = 105] = "shortwave_radiation_clear_sky", M[M.global_tilted_irradiance = 106] = "global_tilted_irradiance", M[M.global_tilted_irradiance_instant = 107] = "global_tilted_irradiance_instant", M[M.ocean_current_velocity = 108] = "ocean_current_velocity", M[M.ocean_current_direction = 109] = "ocean_current_direction", M[M.cloud_base = 110] = "cloud_base", M[M.cloud_top = 111] = "cloud_top", M[M.mass_density = 112] = "mass_density", M[M.boundary_layer_height = 113] = "boundary_layer_height", M[M.formaldehyde = 114] = "formaldehyde", M[M.glyoxal = 115] = "glyoxal", M[M.non_methane_volatile_organic_compounds = 116] = "non_methane_volatile_organic_compounds", M[M.pm10_wildfires = 117] = "pm10_wildfires", M[M.peroxyacyl_nitrates = 118] = "peroxyacyl_nitrates", M[M.secondary_inorganic_aerosol = 119] = "secondary_inorganic_aerosol", M[M.residential_elementary_carbon = 120] = "residential_elementary_carbon", M[M.total_elementary_carbon = 121] = "total_elementary_carbon", M[M.pm2_5_total_organic_matter = 122] = "pm2_5_total_organic_matter", M[M.sea_salt_aerosol = 123] = "sea_salt_aerosol", M[M.nitrogen_monoxide = 124] = "nitrogen_monoxide", M[M.thunderstorm_probability = 125] = "thunderstorm_probability", M[M.rain_probability = 126] = "rain_probability", M[M.freezing_rain_probability = 127] = "freezing_rain_probability", M[M.ice_pellets_probability = 128] = "ice_pellets_probability", M[M.snowfall_probability = 129] = "snowfall_probability", M[M.carbon_dioxide = 130] = "carbon_dioxide", M[M.methane = 131] = "methane", M[M.sea_level_height_msl = 132] = "sea_level_height_msl", M[M.sea_surface_temperature = 133] = "sea_surface_temperature", M[M.invert_barometer_height = 134] = "invert_barometer_height", M[M.hail = 135] = "hail", M[M.albedo = 136] = "albedo", M[M.precipitation_type = 137] = "precipitation_type", M[M.convective_cloud_base = 138] = "convective_cloud_base", M[M.convective_cloud_top = 139] = "convective_cloud_top", M[M.snow_depth_water_equivalent = 140] = "snow_depth_water_equivalent", M[M.secondary_swell_wave_height = 141] = "secondary_swell_wave_height", M[M.secondary_swell_wave_period = 142] = "secondary_swell_wave_period", M[M.secondary_swell_wave_peak_period = 143] = "secondary_swell_wave_peak_period", M[M.secondary_swell_wave_direction = 144] = "secondary_swell_wave_direction", M[M.tertiary_swell_wave_height = 145] = "tertiary_swell_wave_height", M[M.tertiary_swell_wave_period = 146] = "tertiary_swell_wave_period", M[M.tertiary_swell_wave_peak_period = 147] = "tertiary_swell_wave_peak_period", M[M.tertiary_swell_wave_direction = 148] = "tertiary_swell_wave_direction", M[M.wind_u_component = 149] = "wind_u_component", M[M.wind_v_component = 150] = "wind_v_component", M[M.temperature_max24h = 151] = "temperature_max24h", M[M.temperature_min24h = 152] = "temperature_min24h", M[M.temperature_mean24h = 153] = "temperature_mean24h", M[M.snow_density = 154] = "snow_density", M[M.longwave_radiation = 155] = "longwave_radiation", M[M.sea_ice_cover = 156] = "sea_ice_cover", M[M.k_index = 157] = "k_index", M[M.roughness_length = 158] = "roughness_length", M[M.potential_evapotranspiration = 159] = "potential_evapotranspiration", M[M.wave_peak_period = 160] = "wave_peak_period", M[M.temperature_max6h = 161] = "temperature_max6h", M[M.temperature_min6h = 162] = "temperature_min6h", M[M.lightning_density = 163] = "lightning_density", M[M.sea_ice_thickness = 164] = "sea_ice_thickness", M[M.shortwave_radiation_clear_sky_instant = 165] = "shortwave_radiation_clear_sky_instant", M[M.sea_water_salinity = 166] = "sea_water_salinity";
1420
- })(u0 || (v = i0.Variable = u0 = {}));
1420
+ })(u0 || (k = i0.Variable = u0 = {}));
1421
1421
  var T0 = {};
1422
1422
  Object.defineProperty(T0, "__esModule", { value: !0 });
1423
1423
  var z0 = T0.Aggregation = void 0, N0;
1424
1424
  (function(M) {
1425
1425
  M[M.none = 0] = "none", M[M.minimum = 1] = "minimum", M[M.maximum = 2] = "maximum", M[M.mean = 3] = "mean", M[M.p10 = 4] = "p10", M[M.p25 = 5] = "p25", M[M.median = 6] = "median", M[M.p75 = 7] = "p75", M[M.p90 = 8] = "p90", M[M.dominant = 9] = "dominant", M[M.sum = 10] = "sum", M[M.spread = 11] = "spread", M[M.anomaly = 12] = "anomaly", M[M.sot10 = 13] = "sot10", M[M.sot90 = 14] = "sot90", M[M.efi = 15] = "efi";
1426
1426
  })(N0 || (z0 = T0.Aggregation = N0 = {}));
1427
- let _;
1427
+ let G;
1428
1428
  try {
1429
- _ = e0.getLogger("meteo2");
1429
+ G = e0.getLogger("meteo2");
1430
1430
  } catch {
1431
1431
  } finally {
1432
1432
  }
@@ -1486,20 +1486,20 @@ class Q {
1486
1486
  * 标准大气模式
1487
1487
  */
1488
1488
  async standardWeatherModels() {
1489
- return D.standardWeatherModels();
1489
+ return g.standardWeatherModels();
1490
1490
  }
1491
1491
  /**
1492
1492
  * 标准海洋模式
1493
1493
  */
1494
1494
  async standardMarineModels() {
1495
- return D.standardMarineModels();
1495
+ return g.standardMarineModels();
1496
1496
  }
1497
1497
  /**
1498
1498
  * 自动匹配大气模式和海洋模式
1499
1499
  * @param model0
1500
1500
  */
1501
1501
  async autoPickMeteoModel(z = "best_match") {
1502
- return D.autoPickMeteoModel(z);
1502
+ return g.autoPickMeteoModel(z);
1503
1503
  }
1504
1504
  /**
1505
1505
  * 生成指定范围内的数字序列
@@ -1520,37 +1520,32 @@ class Q {
1520
1520
  * @param options
1521
1521
  */
1522
1522
  async weatherForecast(z, b, p, W, A, c = {}) {
1523
- const { st: O, et: Y, interval: a } = await this.checkTimeInterval(z.start_date, z.end_date, !p && !W && !A, c), n = i();
1523
+ const { st: O, et: Y, interval: a } = await this.checkTimeInterval(z.start_date, z.end_date, !p && !W && !A, c);
1524
+ let n = "";
1525
+ const X = i();
1524
1526
  try {
1525
- if (p) {
1526
- const X = this.SEASONAL.OM_URL;
1527
- return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1528
- } else if (W) {
1529
- const X = this.CLIMATE.OM_URL;
1530
- return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1531
- } else if (A) {
1532
- const X = this.HISTORICAL.OM_URL;
1533
- return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1534
- } else if (!z.start_date && !z.end_date) {
1535
- const X = this.pickForecastUrl(!1, c.selfHosted, !1, c);
1536
- return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1537
- } else if (Y != null && Y.isBefore(n.clone().subtract(240, "day"))) {
1538
- const X = this.pickForecastUrl(!1, !1, !0, c);
1539
- return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1540
- } else if (O != null && O.isAfter(n.clone().add(90, "day"))) {
1541
- const X = O.get("year") - n.get("year") + 1;
1542
- z.start_date = O == null ? void 0 : O.clone().subtract(X, "year").format("YYYY-MM-DD"), z.end_date = Y == null ? void 0 : Y.clone().subtract(X, "year").format("YYYY-MM-DD");
1543
- const d = this.pickForecastUrl(!1, !0, !1, c);
1544
- return await this.tryToFetchWeatherApi(d, z, b, X, c);
1545
- } else {
1546
- const X = this.pickForecastUrl(!1, !0, !1, c);
1547
- return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1527
+ if (p)
1528
+ return n = this.SEASONAL.OM_URL, await this.tryToFetchWeatherApi(n, z, b, 0, c);
1529
+ if (W)
1530
+ return n = this.CLIMATE.OM_URL, await this.tryToFetchWeatherApi(n, z, b, 0, c);
1531
+ if (A)
1532
+ return n = this.HISTORICAL.OM_URL, await this.tryToFetchWeatherApi(n, z, b, 0, c);
1533
+ if (!z.start_date && !z.end_date)
1534
+ return n = this.pickForecastUrl(!1, c.selfHosted, !1, c), await this.tryToFetchWeatherApi(n, z, b, 0, c);
1535
+ {
1536
+ const d = c.selfHostedMaxDays || 240, t = c.fakeForecastMaxDays || 30;
1537
+ if (Y != null && Y.isBefore(X.clone().subtract(d, "day")))
1538
+ return n = this.pickForecastUrl(!1, !1, !0, c), await this.tryToFetchWeatherApi(n, z, b, 0, c);
1539
+ if (O != null && O.isAfter(X.clone().add(t, "day"))) {
1540
+ const r = O.get("year") - X.get("year") + 1;
1541
+ return z.start_date = O == null ? void 0 : O.clone().subtract(r, "year").format("YYYY-MM-DD"), z.end_date = Y == null ? void 0 : Y.clone().subtract(r, "year").format("YYYY-MM-DD"), n = this.pickForecastUrl(!1, !0, !1, c), await this.tryToFetchWeatherApi(n, z, b, r, c);
1542
+ } else
1543
+ return n = this.pickForecastUrl(!1, !0, !1, c), await this.tryToFetchWeatherApi(n, z, b, 0, c);
1548
1544
  }
1549
- } catch (X) {
1550
- const { start_date: d, end_date: t } = await this.matchDateRange(X == null ? void 0 : X.message, a, c);
1551
- z.start_date = d, z.end_date = t, _.info("[%s] retry with extracted date range: %s to %s", c.requestId, d, t);
1552
- const r = p ? this.SEASONAL.OM_URL : this.pickForecastUrl(!1, !0, !1, c);
1553
- return await this.tryToFetchWeatherApi(r, z, b, 0, c);
1545
+ } catch (d) {
1546
+ G.warn("[%s] fetch weather api (%s) failed: %s", c.requestId, n, { message: d == null ? void 0 : d.message, params: z });
1547
+ const { start_date: t, end_date: r } = await this.matchDateRange(d == null ? void 0 : d.message, a, "", c);
1548
+ return z.start_date = t, z.end_date = r, G.info("[%s] retry with extracted date range: %s to %s", c.requestId, t, r), n = p ? this.SEASONAL.OM_URL : W ? this.CLIMATE.OM_URL : A ? this.HISTORICAL.OM_URL : this.pickForecastUrl(!1, !0, !1, c), await this.tryToFetchWeatherApi(n, z, b, 0, c);
1554
1549
  }
1555
1550
  }
1556
1551
  /**
@@ -1563,16 +1558,12 @@ class Q {
1563
1558
  * @private
1564
1559
  */
1565
1560
  async tryToFetchWeatherApi(z, b, p, W = 0, A = {}) {
1566
- try {
1567
- const c = i();
1568
- this.debug && _.info("[%s] fetch weather via %s with %j", A.requestId, z, b);
1569
- const O = await t0(z, b), Y = p ? await p(O, b, A) : await this.parseWeatherData(O, b, W, A);
1570
- delete b.apikey;
1571
- const a = i();
1572
- return this.debug && _.info("[%s] fetch weather api (%s) cost: %d ms", A.requestId, b.url, a.diff(c, "ms")), this.mergeWeatherData(Y);
1573
- } catch (c) {
1574
- throw _.warn("[%s] weather forecast failed: %s, with %j", A.requestId, c, b), c;
1575
- }
1561
+ const c = i();
1562
+ G.debug("[%s] fetch weather via %s with %j", A.requestId, z, b);
1563
+ const O = await t0(z, b), Y = p ? await p(O, b, A) : await this.parseWeatherData(O, b, W, A);
1564
+ delete b.apikey;
1565
+ const a = i();
1566
+ return G.debug("[%s] fetch weather api (%s) cost: %d ms", A.requestId, b.url, a.diff(c, "ms")), this.mergeWeatherData(Y);
1576
1567
  }
1577
1568
  /**
1578
1569
  * 海洋数据
@@ -1590,34 +1581,56 @@ class Q {
1590
1581
  * @param options
1591
1582
  */
1592
1583
  async marineForecast(z, b = {}) {
1593
- var u, V, m, L, B, E, N, Z;
1594
- const { st: p, et: W, interval: A } = await this.checkTimeInterval(z.start_date, z.end_date, !0, b), c = i(), O = [];
1595
- let Y = 0;
1584
+ var s, m, L, U, Z, N, l, _;
1585
+ const { st: p, et: W, interval: A } = await this.checkTimeInterval(z.start_date, z.end_date, !0, b);
1586
+ let c = "";
1587
+ const O = i(), Y = [];
1588
+ let a = 0;
1596
1589
  if (!z.start_date && !z.end_date) {
1597
- const f = this.pickForecastUrl(!0, b.selfHosted, !1, b), U = await this.tryToFetchMarineApi(f, z, b);
1598
- O.push(...U);
1590
+ c = this.pickForecastUrl(!0, b.selfHosted, !1, b);
1591
+ const f = await this.tryToFetchMarineApi(c, z, b);
1592
+ Y.push(...f);
1599
1593
  } else
1600
1594
  for (const f of z.models)
1601
1595
  try {
1602
- if (W != null && W.isBefore(c.clone().subtract(240, "day"))) {
1603
- const U = this.pickForecastUrl(!0, !1, !0, b), P = await this.tryToFetchMarineApi(U, { ...z, models: [f] }, b);
1604
- O.push(...P);
1605
- } else if (p != null && p.isAfter(c.clone().add(90, "day"))) {
1606
- Y = p.get("year") - c.get("year") + 1, z.start_date = p == null ? void 0 : p.clone().subtract(Y, "year").format("YYYY-MM-DD"), z.end_date = W == null ? void 0 : W.clone().subtract(Y, "year").format("YYYY-MM-DD");
1607
- const U = this.pickForecastUrl(!0, !0, !0, b), P = await this.tryToFetchMarineApi(U, { ...z, models: [f] }, b);
1608
- O.push(...P);
1596
+ const E = b.selfHostedMaxDays || 240, w = b.fakeForecastMaxDays || 30;
1597
+ if (W != null && W.isBefore(O.clone().subtract(E, "day"))) {
1598
+ c = this.pickForecastUrl(!0, !1, !0, b);
1599
+ const D = await this.tryToFetchMarineApi(c, { ...z, models: [f] }, b);
1600
+ Y.push(...D);
1601
+ } else if (p != null && p.isAfter(O.clone().add(w, "day"))) {
1602
+ a = p.get("year") - O.get("year") + 1, z.start_date = p == null ? void 0 : p.clone().subtract(a, "year").format("YYYY-MM-DD"), z.end_date = W == null ? void 0 : W.clone().subtract(a, "year").format("YYYY-MM-DD"), c = this.pickForecastUrl(!0, !0, !0, b);
1603
+ const D = await this.tryToFetchMarineApi(c, { ...z, models: [f] }, b);
1604
+ Y.push(...D);
1609
1605
  } else {
1610
- const U = this.pickForecastUrl(!0, !0, !1, b), P = await this.tryToFetchMarineApi(U, { ...z, models: [f] }, b);
1611
- O.push(...P);
1606
+ c = this.pickForecastUrl(!0, !0, !1, b);
1607
+ const D = await this.tryToFetchMarineApi(c, { ...z, models: [f] }, b);
1608
+ Y.push(...D);
1609
+ }
1610
+ } catch (E) {
1611
+ G.warn("[%s] fetch marine api (%s) failed: %j", b.requestId, { message: E == null ? void 0 : E.message, model: f, params: z });
1612
+ const { start_date: w, end_date: D } = await this.matchDateRange(E == null ? void 0 : E.message, A, f, b);
1613
+ G.info("[%s] retry with extracted date range: %s to %s", b.requestId, w, D), c = this.pickForecastUrl(!0, !0, !1, b);
1614
+ try {
1615
+ const v = await this.tryToFetchMarineApi(
1616
+ c,
1617
+ {
1618
+ ...z,
1619
+ start_date: w,
1620
+ end_date: D,
1621
+ models: [f]
1622
+ },
1623
+ b
1624
+ );
1625
+ Y.push(...v);
1626
+ } catch (v) {
1627
+ G.warn("[%s] marine forecast for model %s failed: %s, just ignore", b.requestId, f, v);
1612
1628
  }
1613
- } catch (U) {
1614
- const { start_date: P, end_date: w } = await this.matchDateRange(U == null ? void 0 : U.message, A, b), K = this.pickForecastUrl(!0, !0, !1, b), x = await this.tryToFetchMarineApi(K, { ...z, start_date: P, end_date: w, models: [f] }, b);
1615
- O.push(...x);
1616
1629
  }
1617
- const a = await this.parseWeatherData(O, z, Y, b);
1630
+ const n = await this.parseWeatherData(Y, z, a, b);
1618
1631
  delete z.apikey;
1619
- const n = await this.mergeMarineData(a, p), X = n.find((f) => f.model === "ncep_gfswave016"), d = n.find((f) => f.model === "ncep_gfswave025"), t = n.find((f) => f.model === "meteofrance_wave"), r = n.find((f) => f.model === "best_match");
1620
- return (V = (u = r == null ? void 0 : r.hourly) == null ? void 0 : u.wave_height) != null && V.every((f) => f !== null) ? [r] : (L = (m = t == null ? void 0 : t.hourly) == null ? void 0 : m.wave_height) != null && L.every((f) => f !== null) ? [t] : (E = (B = X == null ? void 0 : X.hourly) == null ? void 0 : B.wave_height) != null && E.every((f) => f !== null) ? [X] : (Z = (N = d == null ? void 0 : d.hourly) == null ? void 0 : N.wave_height) != null && Z.every((f) => f !== null) ? [d] : n != null && n.length ? [n[0]] : [];
1632
+ const X = await this.mergeMarineData(n, p), d = X.find((f) => f.model === "ncep_gfswave016"), t = X.find((f) => f.model === "ncep_gfswave025"), r = X.find((f) => f.model === "meteofrance_wave"), u = X.find((f) => f.model === "best_match");
1633
+ return (m = (s = u == null ? void 0 : u.hourly) == null ? void 0 : s.wave_height) != null && m.every((f) => f !== null) ? [u] : (U = (L = r == null ? void 0 : r.hourly) == null ? void 0 : L.wave_height) != null && U.every((f) => f !== null) ? [r] : (N = (Z = d == null ? void 0 : d.hourly) == null ? void 0 : Z.wave_height) != null && N.every((f) => f !== null) ? [d] : (_ = (l = t == null ? void 0 : t.hourly) == null ? void 0 : l.wave_height) != null && _.every((f) => f !== null) ? [t] : X != null && X.length ? [X[0]] : [];
1621
1634
  }
1622
1635
  /**
1623
1636
  * 尝试调用海洋接口
@@ -1627,14 +1640,10 @@ class Q {
1627
1640
  * @private
1628
1641
  */
1629
1642
  async tryToFetchMarineApi(z, b, p = {}) {
1630
- try {
1631
- const W = i();
1632
- this.debug && _.info("[%s] fetch marine via %s with %j", p.requestId, z, b);
1633
- const A = await t0(z, b), c = i();
1634
- return this.debug && _.info("[%s] fetch weather api (%s) cost: %d ms", p.requestId, b.url, c.diff(W, "ms")), A;
1635
- } catch (W) {
1636
- throw _.warn("[%s] marine forecast failed: %s, with %j", p.requestId, W, b), W;
1637
- }
1643
+ const W = i();
1644
+ G.debug("[%s] fetch marine via %s with %j", p.requestId, z, b);
1645
+ const A = await t0(z, b), c = i();
1646
+ return G.debug("[%s] fetch weather api (%s) cost: %d ms", p.requestId, b.url, c.diff(W, "ms")), A;
1638
1647
  }
1639
1648
  /**
1640
1649
  * 检查时间区间, 并调整为合理范围(不超时90天)
@@ -1646,23 +1655,38 @@ class Q {
1646
1655
  */
1647
1656
  async checkTimeInterval(z, b, p, W = {}) {
1648
1657
  let A, c, O = 1;
1649
- return p ? (z && b && (A = i.utc(z), c = i.utc(b), c.diff(A, "days") > 90 && (c = A.clone().add(90, "d")), O = c.diff(A, "day")), this.debug && _.info("[%s] check time interval: %s to %s, with interval: %d days", W.requestId, A == null ? void 0 : A.format(), c == null ? void 0 : c.format(), O)) : (A = i.utc(z), c = i.utc(b), O = c.diff(A, "day")), { st: A, et: c, interval: O };
1658
+ if (p) {
1659
+ if (z && b) {
1660
+ A = i.utc(z), c = i.utc(b);
1661
+ const Y = W.maxIntervalDays || 90;
1662
+ c.diff(A, "days") > Y && (c = A.clone().add(Y, "d")), O = c.diff(A, "day");
1663
+ }
1664
+ this.debug && G.info("[%s] check time interval: %s to %s, with interval: %d days", W.requestId, A == null ? void 0 : A.format(), c == null ? void 0 : c.format(), O);
1665
+ } else
1666
+ A = i.utc(z), c = i.utc(b), O = c.diff(A, "day");
1667
+ return { st: A, et: c, interval: O };
1650
1668
  }
1651
1669
  /**
1652
1670
  * 从消息中提取时间区间, 并调整为合理范围
1653
1671
  * @param message
1654
1672
  * @param interval
1673
+ * @param model
1655
1674
  * @param options
1656
1675
  * @private
1657
1676
  */
1658
- async matchDateRange(z, b = 1, p = {}) {
1659
- const W = z == null ? void 0 : z.match(/from (\d{4}-\d{2}-\d{2}) to (\d{4}-\d{2}-\d{2})/);
1660
- if (W) {
1661
- const A = i.utc(W[2]), c = W[2], O = A.subtract(b || 1, "day").format("YYYY-MM-DD");
1662
- return _.info("[%s] extract date range from message: %s to %s", p.requestId, O, c), { start_date: O, end_date: c };
1677
+ async matchDateRange(z, b = 1, p = "", W = {}) {
1678
+ const A = z == null ? void 0 : z.match(/from (\d{4}-\d{2}-\d{2}) to (\d{4}-\d{2}-\d{2})/);
1679
+ if (A) {
1680
+ let c = i.utc(A[2]);
1681
+ if (p === "meteofrance_currents") {
1682
+ const a = i.utc().add(W.fakeCurrentMaxDays || 9, "day");
1683
+ c.isAfter(a) && (c = a);
1684
+ }
1685
+ const O = c.format("YYYY-MM-DD"), Y = c.subtract(b || 1, "day").format("YYYY-MM-DD");
1686
+ return G.info("[%s] extract date range from message: %s to %s", W.requestId, Y, O), { start_date: Y, end_date: O };
1663
1687
  } else {
1664
- const A = i.utc().add(7, "day"), c = A.format("YYYY-MM-DD"), O = A.clone().subtract(b, "day").format("YYYY-MM-DD");
1665
- return _.info("[%s] extract date range with interval (%d): %s to %s", p.requestId, b, O, c), { start_date: O, end_date: c };
1688
+ const c = i.utc().add(7, "day"), O = c.format("YYYY-MM-DD"), Y = c.clone().subtract(b, "day").format("YYYY-MM-DD");
1689
+ return G.info("[%s] extract date range with interval (%d): %s to %s", W.requestId, b, Y, O), { start_date: Y, end_date: O };
1666
1690
  }
1667
1691
  }
1668
1692
  /**
@@ -1677,47 +1701,47 @@ class Q {
1677
1701
  var O, Y, a, n, X, d, t;
1678
1702
  const A = [], c = Math.pow(10, W.precision || 6);
1679
1703
  for (let r = 0; r < z.length; r++) {
1680
- const u = z[r], V = u.utcOffsetSeconds(), m = u.timezone(), L = u.current(), B = u.hourly(), E = u.daily(), N = {};
1681
- if (N.timezone = m || void 0, N.offset = Q.prettyTimezoneOffset(V), N.model = b.models instanceof Array ? (O = b.models) == null ? void 0 : O[r] : b.models || "best_match", L) {
1682
- const Z = i();
1704
+ const u = z[r], s = u.utcOffsetSeconds(), m = u.timezone(), L = u.current(), U = u.hourly(), Z = u.daily(), N = {};
1705
+ if (N.timezone = m || void 0, N.offset = Q.prettyTimezoneOffset(s), N.model = b.models instanceof Array ? (O = b.models) == null ? void 0 : O[r] : b.models || "best_match", L) {
1706
+ const l = i();
1683
1707
  N.current = {
1684
1708
  time: i.unix(Number(L.time())).utc().add(p, "year").format()
1685
1709
  };
1686
- for (let U = 0; U < L.variablesLength(); U++) {
1687
- const P = L.variables(U).value();
1688
- N.current[b.current[U]] = isNaN(P) ? null : Math.round(P * c) / c;
1710
+ for (let f = 0; f < L.variablesLength(); f++) {
1711
+ const E = L.variables(f).value();
1712
+ N.current[b.current[f]] = isNaN(E) ? null : Math.round(E * c) / c;
1689
1713
  }
1690
- const f = i();
1691
- this.debug && _.debug("[%s] fetch current variables cost: %d ms", W.requestId, f.diff(Z, "ms"));
1714
+ const _ = i();
1715
+ this.debug && G.debug("[%s] fetch current variables cost: %d ms", W.requestId, _.diff(l, "ms"));
1692
1716
  }
1693
- if (B) {
1694
- const Z = i(), f = i.unix(Number(B.time())).add(p, "year");
1717
+ if (U) {
1718
+ const l = i(), _ = i.unix(Number(U.time())).add(p, "year");
1695
1719
  N.hourly = {
1696
- date: f.utc().format(),
1697
- time: Q.range(Number(B.time()), Number(B.timeEnd()), B.interval()).map(
1698
- (P) => i.unix(P).add(p, "year").diff(f, "h")
1720
+ date: _.utc().format(),
1721
+ time: Q.range(Number(U.time()), Number(U.timeEnd()), U.interval()).map(
1722
+ (E) => i.unix(E).add(p, "year").diff(_, "h")
1699
1723
  )
1700
1724
  };
1701
- for (let P = 0; P < B.variablesLength(); P++) {
1702
- const w = (n = (a = (Y = B.variables(P).valuesArray()) == null ? void 0 : Y.toString()) == null ? void 0 : a.split(",")) == null ? void 0 : n.map((K) => isNaN(K) ? null : Math.round(Number(K) * c) / c);
1703
- N.hourly[b.hourly[P]] = w;
1725
+ for (let E = 0; E < U.variablesLength(); E++) {
1726
+ const w = (n = (a = (Y = U.variables(E).valuesArray()) == null ? void 0 : Y.toString()) == null ? void 0 : a.split(",")) == null ? void 0 : n.map((D) => isNaN(D) ? null : Math.round(Number(D) * c) / c);
1727
+ N.hourly[b.hourly[E]] = w;
1704
1728
  }
1705
- const U = i();
1706
- this.debug && _.debug("[%s] fetch hourly variables cost: %d ms", W.requestId, U.diff(Z, "ms"));
1729
+ const f = i();
1730
+ this.debug && G.debug("[%s] fetch hourly variables cost: %d ms", W.requestId, f.diff(l, "ms"));
1707
1731
  }
1708
- if (E) {
1709
- const Z = i();
1732
+ if (Z) {
1733
+ const l = i();
1710
1734
  N.daily = {
1711
- time: Q.range(Number(E.time()), Number(E.timeEnd()), E.interval()).map(
1712
- (U) => i.unix(U).add(p, "year").utc().format()
1735
+ time: Q.range(Number(Z.time()), Number(Z.timeEnd()), Z.interval()).map(
1736
+ (f) => i.unix(f).add(p, "year").utc().format()
1713
1737
  )
1714
1738
  };
1715
- for (let U = 0; U < E.variablesLength(); U += W.memberLength ?? 1) {
1716
- const P = (t = (d = (X = E.variables(U).valuesArray()) == null ? void 0 : X.toString()) == null ? void 0 : d.split(",")) == null ? void 0 : t.map((w) => isNaN(w) ? null : Math.round(Number(w) * c) / c);
1717
- N.daily[b.daily[U / (W.memberLength ?? 1)]] = P;
1739
+ for (let f = 0; f < Z.variablesLength(); f += W.memberLength ?? 1) {
1740
+ const E = (t = (d = (X = Z.variables(f).valuesArray()) == null ? void 0 : X.toString()) == null ? void 0 : d.split(",")) == null ? void 0 : t.map((w) => isNaN(w) ? null : Math.round(Number(w) * c) / c);
1741
+ N.daily[b.daily[f / (W.memberLength ?? 1)]] = E;
1718
1742
  }
1719
- const f = i();
1720
- this.debug && _.debug("[%s] fetch daily variables cost: %d ms", W.requestId, f.diff(Z, "ms"));
1743
+ const _ = i();
1744
+ this.debug && G.debug("[%s] fetch daily variables cost: %d ms", W.requestId, _.diff(l, "ms"));
1721
1745
  }
1722
1746
  A.push(N);
1723
1747
  }
@@ -1730,25 +1754,25 @@ class Q {
1730
1754
  * @private
1731
1755
  */
1732
1756
  async parseSeasonalDailyVariable(z, b, p = {}) {
1733
- var c, O, Y, a, n, X, d, t, r, u, V, m, L, B, E, N, Z, f, U, P, w, K, x, q0, j, c0, g, Y0;
1757
+ var c, O, Y, a, n, X, d, t, r, u, s, m, L, U, Z, N, l, _, f, E, w, D, v, q0, j, c0, y, Y0;
1734
1758
  const W = [], A = Math.pow(10, p.precision || 6);
1735
1759
  for (let p0 = 0; p0 < z.length; p0++) {
1736
- const O0 = z[p0], X0 = O0.utcOffsetSeconds(), R0 = O0.timezone(), M0 = O0.daily(), H = Array.from({ length: M0.variablesLength() }, (q, e) => M0.variables(e)), W0 = H.filter(
1737
- (q) => (q == null ? void 0 : q.variable()) === v.temperature && (q == null ? void 0 : q.altitude()) === 2 && (q == null ? void 0 : q.aggregation()) === z0.maximum
1760
+ const O0 = z[p0], R0 = O0.utcOffsetSeconds(), X0 = O0.timezone(), M0 = O0.daily(), H = Array.from({ length: M0.variablesLength() }, (q, e) => M0.variables(e)), W0 = H.filter(
1761
+ (q) => (q == null ? void 0 : q.variable()) === k.temperature && (q == null ? void 0 : q.altitude()) === 2 && (q == null ? void 0 : q.aggregation()) === z0.maximum
1738
1762
  ), o0 = H.filter(
1739
- (q) => (q == null ? void 0 : q.variable()) === v.temperature && (q == null ? void 0 : q.altitude()) === 2 && (q == null ? void 0 : q.aggregation()) === z0.minimum
1740
- ), k = H.filter(
1741
- (q) => (q == null ? void 0 : q.variable()) === v.temperature && (q == null ? void 0 : q.altitude()) === 2 && (q == null ? void 0 : q.aggregation()) === z0.mean
1742
- ), I = H.filter((q) => (q == null ? void 0 : q.variable()) === v.precipitation), y = H.filter((q) => (q == null ? void 0 : q.variable()) === v.weather_code), d0 = H.filter(
1743
- (q) => (q == null ? void 0 : q.variable()) === v.wind_speed && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.mean
1763
+ (q) => (q == null ? void 0 : q.variable()) === k.temperature && (q == null ? void 0 : q.altitude()) === 2 && (q == null ? void 0 : q.aggregation()) === z0.minimum
1764
+ ), J = H.filter(
1765
+ (q) => (q == null ? void 0 : q.variable()) === k.temperature && (q == null ? void 0 : q.altitude()) === 2 && (q == null ? void 0 : q.aggregation()) === z0.mean
1766
+ ), I = H.filter((q) => (q == null ? void 0 : q.variable()) === k.precipitation), K = H.filter((q) => (q == null ? void 0 : q.variable()) === k.weather_code), d0 = H.filter(
1767
+ (q) => (q == null ? void 0 : q.variable()) === k.wind_speed && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.mean
1744
1768
  ), a0 = H.filter(
1745
- (q) => (q == null ? void 0 : q.variable()) === v.wind_speed && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.maximum
1769
+ (q) => (q == null ? void 0 : q.variable()) === k.wind_speed && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.maximum
1746
1770
  ), L0 = H.filter(
1747
- (q) => (q == null ? void 0 : q.variable()) === v.wind_gusts && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.maximum
1771
+ (q) => (q == null ? void 0 : q.variable()) === k.wind_gusts && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.maximum
1748
1772
  ), b0 = H.filter(
1749
- (q) => (q == null ? void 0 : q.variable()) === v.wind_direction && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.dominant
1773
+ (q) => (q == null ? void 0 : q.variable()) === k.wind_direction && (q == null ? void 0 : q.altitude()) === 10 && (q == null ? void 0 : q.aggregation()) === z0.dominant
1750
1774
  ), o = {};
1751
- if (o.timezone = R0 || void 0, o.offset = Q.prettyTimezoneOffset(X0), o.model = b.models instanceof Array ? (c = b.models) == null ? void 0 : c[p0] : b.models || "best_match", M0) {
1775
+ if (o.timezone = X0 || void 0, o.offset = Q.prettyTimezoneOffset(R0), o.model = b.models instanceof Array ? (c = b.models) == null ? void 0 : c[p0] : b.models || "best_match", M0) {
1752
1776
  const q = i();
1753
1777
  o.daily = {
1754
1778
  time: Q.range(Number(M0.time()), Number(M0.timeEnd()), M0.interval()).map((R) => i.unix(R).utc().format())
@@ -1757,22 +1781,22 @@ class Q {
1757
1781
  o.daily.temperature_2m_max = (a = (Y = (O = R.valuesArray()) == null ? void 0 : O.toString()) == null ? void 0 : Y.split(",")) == null ? void 0 : a.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1758
1782
  for (const R of o0)
1759
1783
  o.daily.temperature_2m_min = (d = (X = (n = R.valuesArray()) == null ? void 0 : n.toString()) == null ? void 0 : X.split(",")) == null ? void 0 : d.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1760
- for (const R of k)
1784
+ for (const R of J)
1761
1785
  o.daily.temperature_2m_mean = (u = (r = (t = R.valuesArray()) == null ? void 0 : t.toString()) == null ? void 0 : r.split(",")) == null ? void 0 : u.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1762
1786
  for (const R of I)
1763
- o.daily.precipitation_sum = (L = (m = (V = R.valuesArray()) == null ? void 0 : V.toString()) == null ? void 0 : m.split(",")) == null ? void 0 : L.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1764
- for (const R of y)
1765
- o.daily.weather_code = (N = (E = (B = R.valuesArray()) == null ? void 0 : B.toString()) == null ? void 0 : E.split(",")) == null ? void 0 : N.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1787
+ o.daily.precipitation_sum = (L = (m = (s = R.valuesArray()) == null ? void 0 : s.toString()) == null ? void 0 : m.split(",")) == null ? void 0 : L.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1788
+ for (const R of K)
1789
+ o.daily.weather_code = (N = (Z = (U = R.valuesArray()) == null ? void 0 : U.toString()) == null ? void 0 : Z.split(",")) == null ? void 0 : N.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1766
1790
  for (const R of b0)
1767
- o.daily.wind_direction_10m_dominant = (U = (f = (Z = R.valuesArray()) == null ? void 0 : Z.toString()) == null ? void 0 : f.split(",")) == null ? void 0 : U.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1791
+ o.daily.wind_direction_10m_dominant = (f = (_ = (l = R.valuesArray()) == null ? void 0 : l.toString()) == null ? void 0 : _.split(",")) == null ? void 0 : f.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1768
1792
  for (const R of d0)
1769
- o.daily.wind_speed_10m_mean = (K = (w = (P = R.valuesArray()) == null ? void 0 : P.toString()) == null ? void 0 : w.split(",")) == null ? void 0 : K.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1793
+ o.daily.wind_speed_10m_mean = (D = (w = (E = R.valuesArray()) == null ? void 0 : E.toString()) == null ? void 0 : w.split(",")) == null ? void 0 : D.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1770
1794
  for (const R of a0)
1771
- o.daily.wind_speed_10m_max = (j = (q0 = (x = R.valuesArray()) == null ? void 0 : x.toString()) == null ? void 0 : q0.split(",")) == null ? void 0 : j.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1795
+ o.daily.wind_speed_10m_max = (j = (q0 = (v = R.valuesArray()) == null ? void 0 : v.toString()) == null ? void 0 : q0.split(",")) == null ? void 0 : j.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1772
1796
  for (const R of L0)
1773
- o.daily.wind_gusts_10m_max = (Y0 = (g = (c0 = R.valuesArray()) == null ? void 0 : c0.toString()) == null ? void 0 : g.split(",")) == null ? void 0 : Y0.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1797
+ o.daily.wind_gusts_10m_max = (Y0 = (y = (c0 = R.valuesArray()) == null ? void 0 : c0.toString()) == null ? void 0 : y.split(",")) == null ? void 0 : Y0.map((T) => isNaN(T) ? null : Math.round(Number(T) * A) / A);
1774
1798
  const e = i();
1775
- _.debug("[%s] fetch daily variables cost: %d ms", p.requestId, e.diff(q, "ms"));
1799
+ G.debug("[%s] fetch daily variables cost: %d ms", p.requestId, e.diff(q, "ms"));
1776
1800
  }
1777
1801
  W.push(o);
1778
1802
  }
@@ -1823,32 +1847,32 @@ class Q {
1823
1847
  * @private
1824
1848
  */
1825
1849
  async mergeMarineData(z, b) {
1826
- var Y, a, n, X, d, t, r, u, V, m;
1850
+ var Y, a, n, X, d, t, r, u, s, m;
1827
1851
  if (b && (z == null ? void 0 : z.length) > 0) {
1828
- let L = z[0], B = Math.abs((a = i((Y = z[0].hourly) == null ? void 0 : Y.date)) == null ? void 0 : a.diff(b));
1852
+ let L = z[0], U = Math.abs((a = i((Y = z[0].hourly) == null ? void 0 : Y.date)) == null ? void 0 : a.diff(b));
1829
1853
  for (const N of z) {
1830
- const Z = Math.abs((X = i((n = N.hourly) == null ? void 0 : n.date)) == null ? void 0 : X.diff(b));
1831
- Z < B && (B = Z, L = N);
1854
+ const l = Math.abs((X = i((n = N.hourly) == null ? void 0 : n.date)) == null ? void 0 : X.diff(b));
1855
+ l < U && (U = l, L = N);
1832
1856
  }
1833
- const E = (d = L == null ? void 0 : L.hourly) == null ? void 0 : d.date;
1834
- E && z.forEach((N) => {
1835
- N.hourly.date = E;
1857
+ const Z = (d = L == null ? void 0 : L.hourly) == null ? void 0 : d.date;
1858
+ Z && z.forEach((N) => {
1859
+ N.hourly.date = Z;
1836
1860
  });
1837
1861
  } else {
1838
- z.sort((B, E) => {
1839
- var N, Z, f, U;
1840
- return ((Z = i((N = E.hourly) == null ? void 0 : N.date)) == null ? void 0 : Z.valueOf()) - ((U = i((f = B.hourly) == null ? void 0 : f.date)) == null ? void 0 : U.valueOf());
1862
+ z.sort((U, Z) => {
1863
+ var N, l, _, f;
1864
+ return ((l = i((N = Z.hourly) == null ? void 0 : N.date)) == null ? void 0 : l.valueOf()) - ((f = i((_ = U.hourly) == null ? void 0 : _.date)) == null ? void 0 : f.valueOf());
1841
1865
  });
1842
1866
  const L = (t = z == null ? void 0 : z.at(0).hourly) == null ? void 0 : t.date;
1843
- L && z.forEach((B) => {
1844
- B.hourly.date = L;
1867
+ L && z.forEach((U) => {
1868
+ U.hourly.date = L;
1845
1869
  });
1846
1870
  }
1847
1871
  const p = [], W = z.find((L) => L.model === "best_match");
1848
1872
  W && p.push(W);
1849
1873
  const A = z.find((L) => L.model === "meteofrance_currents"), c = z.find((L) => L.model === "ecmwf_wam025"), O = z.find((L) => L.model === "meteofrance_wave");
1850
1874
  for (const L of z)
1851
- ["best_match", "meteofrance_currents"].includes(L.model) || (L.hourly.ocean_current_velocity = (r = A == null ? void 0 : A.hourly) == null ? void 0 : r.ocean_current_velocity, L.hourly.ocean_current_direction = (u = A == null ? void 0 : A.hourly) == null ? void 0 : u.ocean_current_direction, L.hourly.sea_level_height_msl = (V = A == null ? void 0 : A.hourly) == null ? void 0 : V.sea_level_height_msl, L.hourly.sea_surface_temperature = (m = A == null ? void 0 : A.hourly) == null ? void 0 : m.sea_surface_temperature, p.push(L)), L.model === "meteofrance_wave" && c && (L.hourly.time = c.hourly.time, L.hourly.wave_height = c.hourly.wave_height, L.hourly.wave_direction = c.hourly.wave_direction, L.hourly.wave_period = c.hourly.wave_period, L.daily && c.daily && (L.daily.time = c.daily.time, L.daily.wave_height_max = c.daily.wave_height_max, L.daily.wave_direction_dominant = c.daily.wave_direction_dominant, L.daily.wave_period_max = c.daily.wave_period_max)), L.model === "ecmwf_wam025" && O && (L.hourly.swell_wave_height = O.hourly.swell_wave_height, L.hourly.swell_wave_direction = O.hourly.swell_wave_direction, L.hourly.swell_wave_period = O.hourly.swell_wave_period, L.hourly.wind_wave_height = O.hourly.wind_wave_height, L.hourly.wind_wave_direction = O.hourly.wind_wave_direction, L.hourly.wind_wave_period = O.hourly.wind_wave_period, L.daily && O.daily && (L.daily.swell_wave_height_max = O.daily.swell_wave_height_max, L.daily.swell_wave_period_max = O.daily.swell_wave_period_max, L.daily.swell_wave_direction_dominant = O.daily.swell_wave_direction_dominant, L.daily.wind_wave_height_max = O.daily.wind_wave_height_max, L.daily.wind_wave_direction_dominant = O.daily.wind_wave_direction_dominant, L.daily.wind_wave_period_max = O.daily.wind_wave_period_max));
1875
+ ["best_match", "meteofrance_currents"].includes(L.model) || (L.hourly.ocean_current_velocity = (r = A == null ? void 0 : A.hourly) == null ? void 0 : r.ocean_current_velocity, L.hourly.ocean_current_direction = (u = A == null ? void 0 : A.hourly) == null ? void 0 : u.ocean_current_direction, L.hourly.sea_level_height_msl = (s = A == null ? void 0 : A.hourly) == null ? void 0 : s.sea_level_height_msl, L.hourly.sea_surface_temperature = (m = A == null ? void 0 : A.hourly) == null ? void 0 : m.sea_surface_temperature, p.push(L)), L.model === "meteofrance_wave" && c && (L.hourly.time = c.hourly.time, L.hourly.wave_height = c.hourly.wave_height, L.hourly.wave_direction = c.hourly.wave_direction, L.hourly.wave_period = c.hourly.wave_period, L.daily && c.daily && (L.daily.time = c.daily.time, L.daily.wave_height_max = c.daily.wave_height_max, L.daily.wave_direction_dominant = c.daily.wave_direction_dominant, L.daily.wave_period_max = c.daily.wave_period_max)), L.model === "ecmwf_wam025" && O && (L.hourly.swell_wave_height = O.hourly.swell_wave_height, L.hourly.swell_wave_direction = O.hourly.swell_wave_direction, L.hourly.swell_wave_period = O.hourly.swell_wave_period, L.hourly.wind_wave_height = O.hourly.wind_wave_height, L.hourly.wind_wave_direction = O.hourly.wind_wave_direction, L.hourly.wind_wave_period = O.hourly.wind_wave_period, L.daily && O.daily && (L.daily.swell_wave_height_max = O.daily.swell_wave_height_max, L.daily.swell_wave_period_max = O.daily.swell_wave_period_max, L.daily.swell_wave_direction_dominant = O.daily.swell_wave_direction_dominant, L.daily.wind_wave_height_max = O.daily.wind_wave_height_max, L.daily.wind_wave_direction_dominant = O.daily.wind_wave_direction_dominant, L.daily.wind_wave_period_max = O.daily.wind_wave_period_max));
1852
1876
  return p;
1853
1877
  }
1854
1878
  /**
@@ -1967,8 +1991,8 @@ class Q {
1967
1991
  selfHosted: !0,
1968
1992
  maxDays: 14
1969
1993
  }) {
1970
- var r, u, V, m, L, B, E, N;
1971
- b = Q.toStdLng(b), this.debug && _.info("[%s] spot forecast params: %j", O.requestId, { lat: z, lng: b, datetime: p, simplify: W, withDaily: A, withHourly: c, options: O });
1994
+ var r, u, s, m, L, U, Z, N;
1995
+ b = Q.toStdLng(b), this.debug && G.info("[%s] spot forecast params: %j", O.requestId, { lat: z, lng: b, datetime: p, simplify: W, withDaily: A, withHourly: c, options: O });
1972
1996
  const Y = {
1973
1997
  apikey: this.apikey,
1974
1998
  latitude: z,
@@ -1980,7 +2004,7 @@ class Q {
1980
2004
  };
1981
2005
  let a;
1982
2006
  const n = this.timezoneOffset(z, b);
1983
- p && (a = i.utc(p).utcOffset(n), a.subtract(n > 0 ? n : -n, "h")), A && (Y.daily = ((r = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : r.split(",")) || []), a || (O.forecastDays = O.forecastDays || 1, O.pastDays = 0, c = !0), c && (Y.hourly = ((u = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : u.split(",")) || []), O.maxDays = O.maxDays || 14, 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 > O.maxDays ? O.maxDays : O.forecastDays < 0 ? 1 : O.forecastDays, await this.prepare((V = a == null ? void 0 : a.utc()) == null ? void 0 : V.format(), Y, O);
2007
+ p && (a = i.utc(p).utcOffset(n), a.subtract(n > 0 ? n : -n, "h")), A && (Y.daily = ((r = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : r.split(",")) || []), a || (O.forecastDays = O.forecastDays || 1, O.pastDays = 0, c = !0), c && (Y.hourly = ((u = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : u.split(",")) || []), O.maxDays = O.maxDays || 14, 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 > O.maxDays ? O.maxDays : O.forecastDays < 0 ? 1 : O.forecastDays, await this.prepare((s = a == null ? void 0 : a.utc()) == null ? void 0 : s.format(), Y, O);
1984
2008
  const X = await this.weatherForecast(Y, void 0, !1, !1, !1, O), d = {
1985
2009
  apikey: this.apikey,
1986
2010
  latitude: z,
@@ -1992,7 +2016,7 @@ class Q {
1992
2016
  };
1993
2017
  A && (d.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), a || (O.forecastDays = O.forecastDays || 1, c = !0), c && (d.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), await this.prepare((m = a == null ? void 0 : a.utc()) == null ? void 0 : m.format(), d, O);
1994
2018
  let t = await this.marineForecast(d, O);
1995
- return (E = (B = (L = t[0]) == null ? void 0 : L.hourly) == null ? void 0 : B.wave_height) != null && E.every((Z) => Z === null || Z === 0) && (d.models = this.pickMarineModels("best_match,ncep_gfswave025,ecmwf_wam025,meteofrance_wave"), t = await this.marineForecast(d, O)), { weather: X, marine: t, wparams: Y, mparams: d, datetime: (N = a == null ? void 0 : a.utc()) == null ? void 0 : N.format() };
2019
+ return (Z = (U = (L = t[0]) == null ? void 0 : L.hourly) == null ? void 0 : U.wave_height) != null && Z.every((l) => l === null || l === 0) && (d.models = this.pickMarineModels("best_match,ncep_gfswave025,ecmwf_wam025,meteofrance_wave"), t = await this.marineForecast(d, O)), { weather: X, marine: t, wparams: Y, mparams: d, datetime: (N = a == null ? void 0 : a.utc()) == null ? void 0 : N.format() };
1996
2020
  }
1997
2021
  /**
1998
2022
  * 历史再分析数据
@@ -2020,7 +2044,7 @@ class Q {
2020
2044
  async spotHistorical(z, b, p, W, A = !0, c = !0, O = !1, Y = {
2021
2045
  precision: 6
2022
2046
  }) {
2023
- b = Q.toStdLng(b), this.debug && _.info("[%s] spot historical params: %j", Y.requestId, { lat: z, lng: b, startDate: p, endDate: W, withMarine: O, options: Y });
2047
+ b = Q.toStdLng(b), this.debug && G.info("[%s] spot historical params: %j", Y.requestId, { lat: z, lng: b, startDate: p, endDate: W, withMarine: O, options: Y });
2024
2048
  const a = this.timezoneOffset(z, b), n = i.utc(p).utcOffset(a), X = i.utc(W).utcOffset(a);
2025
2049
  n.subtract(a > 0 ? a : -a, "h"), X.subtract(a > 0 ? a : -a, "h");
2026
2050
  const d = 730;
@@ -2036,12 +2060,12 @@ class Q {
2036
2060
  Y
2037
2061
  );
2038
2062
  {
2039
- this.debug && _.info("[%s] splitting historical request into chunks of %d days", Y.requestId, d);
2063
+ this.debug && G.info("[%s] splitting historical request into chunks of %d days", Y.requestId, d);
2040
2064
  const r = [];
2041
2065
  let u = n.clone();
2042
2066
  for (; u.isBefore(X); ) {
2043
- const V = u.clone().add(d, "days"), m = V.isAfter(X) ? X : V;
2044
- this.debug && _.debug("[%s] fetching chunk from %s to %s", Y.requestId, u.format("YYYY-MM-DD"), m.format("YYYY-MM-DD"));
2067
+ const s = u.clone().add(d, "days"), m = s.isAfter(X) ? X : s;
2068
+ this.debug && G.debug("[%s] fetching chunk from %s to %s", Y.requestId, u.format("YYYY-MM-DD"), m.format("YYYY-MM-DD"));
2045
2069
  const L = await this._fetchHistoricalData(
2046
2070
  z,
2047
2071
  b,
@@ -2052,7 +2076,7 @@ class Q {
2052
2076
  O,
2053
2077
  Y
2054
2078
  );
2055
- r.push(L), u = m.clone().add(1, "second"), await new Promise((B) => setTimeout(B, 100));
2079
+ r.push(L), u = m.clone().add(1, "second"), await new Promise((U) => setTimeout(U, 100));
2056
2080
  }
2057
2081
  return this._mergeHistoricalResults(r);
2058
2082
  }
@@ -2133,7 +2157,7 @@ class Q {
2133
2157
  async spotSeasonal(z, b, p, W, A = !1, c = {
2134
2158
  precision: 6
2135
2159
  }) {
2136
- b = Q.toStdLng(b), this.debug && _.info("[%s] spot seasonal params: %j", c.requestId, { lat: z, lng: b, startDate: p, endDate: W, options: c });
2160
+ b = Q.toStdLng(b), this.debug && G.info("[%s] spot seasonal params: %j", c.requestId, { lat: z, lng: b, startDate: p, endDate: W, options: c });
2137
2161
  const O = this.timezoneOffset(z, b), Y = i.utc(p).utcOffset(O), a = W ? i.utc(W).utcOffset(O) : Y.clone().add(1, "month");
2138
2162
  Y.subtract(O > 0 ? O : -O, "h"), a.subtract(O > 0 ? O : -O, "h");
2139
2163
  const n = {
@@ -2173,21 +2197,21 @@ class Q {
2173
2197
  async spotClimate(z, b, p, W, A = {
2174
2198
  precision: 6
2175
2199
  }) {
2176
- b = Q.toStdLng(b), this.debug && _.info("[%s] spot climate params: %j", A.requestId, { lat: z, lng: b, startDate: p, endDate: W, options: A });
2200
+ b = Q.toStdLng(b), this.debug && G.info("[%s] spot climate params: %j", A.requestId, { lat: z, lng: b, startDate: p, endDate: W, options: A });
2177
2201
  const c = this.timezoneOffset(z, b), O = i.utc(p).utcOffset(c), Y = W ? i.utc(W).utcOffset(c) : O.clone().add(1, "day");
2178
2202
  Y.subtract(c > 0 ? c : -c, "h"), O.subtract(c > 0 ? c : -c, "h");
2179
2203
  const a = 730;
2180
2204
  if (Y.diff(O, "days") <= a)
2181
2205
  return await this._fetchClimateData(z, b, O.format("YYYY-MM-DD"), Y.format("YYYY-MM-DD"), A);
2182
2206
  {
2183
- this.debug && _.info("[%s] splitting climate request into chunks of %d days", A.requestId, a);
2207
+ this.debug && G.info("[%s] splitting climate request into chunks of %d days", A.requestId, a);
2184
2208
  const X = [];
2185
2209
  let d = O.clone();
2186
2210
  for (; d.isBefore(Y); ) {
2187
2211
  const t = d.clone().add(a, "days"), r = t.isAfter(Y) ? Y : t;
2188
- this.debug && _.debug("[%s] fetching climate chunk from %s to %s", A.requestId, d.format("YYYY-MM-DD"), r.format("YYYY-MM-DD"));
2212
+ this.debug && G.debug("[%s] fetching climate chunk from %s to %s", A.requestId, d.format("YYYY-MM-DD"), r.format("YYYY-MM-DD"));
2189
2213
  const u = await this._fetchClimateData(z, b, d.format("YYYY-MM-DD"), r.format("YYYY-MM-DD"), A);
2190
- X.push(u), d = r.clone().add(1, "second"), await new Promise((V) => setTimeout(V, 100));
2214
+ X.push(u), d = r.clone().add(1, "second"), await new Promise((s) => setTimeout(s, 100));
2191
2215
  }
2192
2216
  return this._mergeClimateResults(X);
2193
2217
  }
@@ -2245,21 +2269,21 @@ class Q {
2245
2269
  try {
2246
2270
  const O = await c.json();
2247
2271
  if (O.code === 0) {
2248
- const Y = O.data, a = D.standardWeatherModels();
2272
+ const Y = O.data, a = g.standardWeatherModels();
2249
2273
  for (const n of a) {
2250
- const X = D.autoPickSubCategories(n.alias), t = Y.filter((r) => X.includes(r.category)).map((r) => {
2251
- var L, B, E, N, Z, f;
2252
- const u = i.unix((L = r.meta) == null ? void 0 : L.data_end_time).utc(), V = i.unix((B = r.meta) == null ? void 0 : B.last_run_availability_time).utc(), m = u.diff(V, "days");
2274
+ const X = g.autoPickSubCategories(n.alias), t = Y.filter((r) => X.includes(r.category)).map((r) => {
2275
+ var L, U, Z, N, l, _;
2276
+ const u = i.unix((L = r.meta) == null ? void 0 : L.data_end_time).utc(), s = i.unix((U = r.meta) == null ? void 0 : U.last_run_availability_time).utc(), m = u.diff(s, "days");
2253
2277
  return {
2254
2278
  category: r.category,
2255
2279
  meta: {
2256
2280
  endTime: u.format(),
2257
- availabilityTime: V.format(),
2281
+ availabilityTime: s.format(),
2258
2282
  days: m,
2259
- initialisationTime: i.unix((E = r.meta) == null ? void 0 : E.last_run_initialisation_time).utc().format(),
2283
+ initialisationTime: i.unix((Z = r.meta) == null ? void 0 : Z.last_run_initialisation_time).utc().format(),
2260
2284
  modificationTime: i.unix((N = r.meta) == null ? void 0 : N.last_run_modification_time).utc().format(),
2261
- temporalResolution: Math.round(((Z = r.meta) == null ? void 0 : Z.temporal_resolution_seconds) / 3600),
2262
- frequency: Math.round(((f = r.meta) == null ? void 0 : f.update_interval_seconds) / 3600)
2285
+ temporalResolution: Math.round(((l = r.meta) == null ? void 0 : l.temporal_resolution_seconds) / 3600),
2286
+ frequency: Math.round(((_ = r.meta) == null ? void 0 : _.update_interval_seconds) / 3600)
2263
2287
  }
2264
2288
  };
2265
2289
  });
@@ -2268,7 +2292,7 @@ class Q {
2268
2292
  this.METEO2_UPDATE.version = p + 1, this.METEO2_UPDATE.etime = W.unix();
2269
2293
  }
2270
2294
  } catch (O) {
2271
- _.error("[%s] update meteo2 error: %s", z.requestId, O);
2295
+ G.error("[%s] update meteo2 error: %s", z.requestId, O);
2272
2296
  }
2273
2297
  }
2274
2298
  return this.METEO2_UPDATE;
@@ -2368,7 +2392,7 @@ class A0 {
2368
2392
  lng: isNaN(A) ? null : A,
2369
2393
  pressure: isNaN(p) ? null : Math.round(p) || null,
2370
2394
  kts: isNaN(c) ? null : Math.round(c) || null,
2371
- bf: D.beaufort(D.kts2ms(c ?? 0)),
2395
+ bf: g.beaufort(g.kts2ms(c ?? 0)),
2372
2396
  ...S.parseTropicalType(c),
2373
2397
  wind: {
2374
2398
  r7: null,
@@ -2404,7 +2428,7 @@ class A0 {
2404
2428
  wind: {
2405
2429
  datetime: O.format(),
2406
2430
  kts: isNaN(d) ? null : Math.round(d) || null,
2407
- bf: D.beaufort(D.kts2ms(d ?? 0)),
2431
+ bf: g.beaufort(g.kts2ms(d ?? 0)),
2408
2432
  ...S.parseTropicalType(d),
2409
2433
  r7: null,
2410
2434
  r7ne: null,
@@ -2446,50 +2470,50 @@ class A0 {
2446
2470
  return await S.tropicalMovement(A), A;
2447
2471
  }
2448
2472
  static async realtimeForecast() {
2449
- const z = "https://node.windy.com/tc/v2/storms", b = await $.get(z).json(), p = [];
2473
+ const z = "https://node.windy.com/tc/v2/storms", b = await x.get(z).json(), p = [];
2450
2474
  for (const W of b.storms) {
2451
- const A = `https://node.windy.com/tc/v2/storms/${W.id}`, c = await $.get(A).json(), O = await A0.parseTropical(c);
2475
+ const A = `https://node.windy.com/tc/v2/storms/${W.id}`, c = await x.get(A).json(), O = await A0.parseTropical(c);
2452
2476
  p.push(O);
2453
2477
  }
2454
2478
  return p;
2455
2479
  }
2456
2480
  }
2457
- const J = class J {
2481
+ const $ = class $ {
2458
2482
  static async parseHistory(z) {
2459
- const b = `https://hifleet.com/hifleetapi/gettyphooninfo2.do?xuhao=${z}`, p = await $.post(b).text(), W = await J.parser.parseStringPromise(p), A = W.typhoon.position instanceof Array ? W.typhoon.position : [W.typhoon.position], c = [];
2483
+ const b = `https://hifleet.com/hifleetapi/gettyphooninfo2.do?xuhao=${z}`, p = await x.post(b).text(), W = await $.parser.parseStringPromise(p), A = W.typhoon.position instanceof Array ? W.typhoon.position : [W.typhoon.position], c = [];
2460
2484
  for (const O of A) {
2461
- const Y = i(O.updatetime).utcOffset(8).utc().format(), a = Number(O.lat), n = Number(O.lon), X = Number(O.pressure), d = Number(O.windspeed * 3600 / 1852), t = S.parseWindCircle(O.c7quad1 / 1.852), r = S.parseWindCircle(O.c7quad2 / 1.852), u = S.parseWindCircle(O.c7quad3 / 1.852), V = S.parseWindCircle(O.c7quad4 / 1.852), m = S.parseWindCircle(O.c10quad1 / 1.852), L = S.parseWindCircle(O.c10quad2 / 1.852), B = S.parseWindCircle(O.c10quad3 / 1.852), E = S.parseWindCircle(O.c10quad4 / 1.852), N = S.parseWindCircle(O.c12quad1 / 1.852), Z = S.parseWindCircle(O.c12quad2 / 1.852), f = S.parseWindCircle(O.c12quad3 / 1.852), U = S.parseWindCircle(O.c12quad4 / 1.852), { r7: P, r10: w, r12: K } = S.estimateWindRadii(d, a), x = {
2485
+ const Y = i(O.updatetime).utcOffset(8).utc().format(), a = Number(O.lat), n = Number(O.lon), X = Number(O.pressure), d = Number(O.windspeed * 3600 / 1852), t = S.parseWindCircle(O.c7quad1 / 1.852), r = S.parseWindCircle(O.c7quad2 / 1.852), u = S.parseWindCircle(O.c7quad3 / 1.852), s = S.parseWindCircle(O.c7quad4 / 1.852), m = S.parseWindCircle(O.c10quad1 / 1.852), L = S.parseWindCircle(O.c10quad2 / 1.852), U = S.parseWindCircle(O.c10quad3 / 1.852), Z = S.parseWindCircle(O.c10quad4 / 1.852), N = S.parseWindCircle(O.c12quad1 / 1.852), l = S.parseWindCircle(O.c12quad2 / 1.852), _ = S.parseWindCircle(O.c12quad3 / 1.852), f = S.parseWindCircle(O.c12quad4 / 1.852), { r7: E, r10: w, r12: D } = S.estimateWindRadii(d, a), v = {
2462
2486
  updated: Y,
2463
2487
  lat: isNaN(a) ? null : a,
2464
2488
  lng: isNaN(n) ? null : n,
2465
2489
  pressure: isNaN(X) ? null : Math.round(X),
2466
2490
  kts: isNaN(d) ? null : Math.round(d) || null,
2467
- bf: D.beaufort(D.kts2ms(d ?? 0)),
2491
+ bf: g.beaufort(g.kts2ms(d ?? 0)),
2468
2492
  ...S.parseTropicalType(d),
2469
2493
  wind: {
2470
- r7: P,
2494
+ r7: E,
2471
2495
  r7ne: t,
2472
2496
  r7nw: r,
2473
2497
  r7sw: u,
2474
- r7se: V,
2498
+ r7se: s,
2475
2499
  r10: w,
2476
2500
  r10ne: m,
2477
2501
  r10nw: L,
2478
- r10sw: B,
2479
- r10se: E,
2480
- r12: K,
2502
+ r10sw: U,
2503
+ r10se: Z,
2504
+ r12: D,
2481
2505
  r12ne: N,
2482
- r12nw: Z,
2483
- r12sw: f,
2484
- r12se: U
2506
+ r12nw: l,
2507
+ r12sw: _,
2508
+ r12se: f
2485
2509
  }
2486
2510
  };
2487
- c.push(x);
2511
+ c.push(v);
2488
2512
  }
2489
2513
  return c.sort((O, Y) => i(Y.updated).unix() - i(O.updated).unix()), c;
2490
2514
  }
2491
2515
  static async parseForecast(z, b) {
2492
- const p = `https://hifleet.com/hifleetapi/gettyphooforecast.do?xuhao=${z}`, W = await $.post(p).text(), A = await J.parser.parseStringPromise(W), c = A.list.forecast instanceof Array ? A.list.forecast : [A.list.forecast], O = [];
2516
+ const p = `https://hifleet.com/hifleetapi/gettyphooforecast.do?xuhao=${z}`, W = await x.post(p).text(), A = await $.parser.parseStringPromise(W), c = A.list.forecast instanceof Array ? A.list.forecast : [A.list.forecast], O = [];
2493
2517
  for (const Y of c)
2494
2518
  if (Y.xuhao === z) {
2495
2519
  const a = Y.positions.forecastposition instanceof Array ? Y.positions.forecastposition : [Y.positions.forecastposition];
@@ -2499,16 +2523,16 @@ const J = class J {
2499
2523
  for (const d of a) {
2500
2524
  const t = i(d.forecasttime).utcOffset(8).utc(), r = t.diff(b, "hours");
2501
2525
  if (r) {
2502
- const u = Number(d.forelat), V = Number(d.forelon), m = Number(d.forepressure), L = Number(d.forespeed * 3600 / 1852);
2526
+ const u = Number(d.forelat), s = Number(d.forelon), m = Number(d.forepressure), L = Number(d.forespeed * 3600 / 1852);
2503
2527
  n[r] = {
2504
2528
  lat: isNaN(u) ? null : u,
2505
- lng: isNaN(V) ? null : V,
2529
+ lng: isNaN(s) ? null : s,
2506
2530
  pressure: m ? Math.round(m) : null,
2507
2531
  utc: t.format(),
2508
2532
  wind: {
2509
2533
  datetime: t.format(),
2510
2534
  kts: isNaN(L) ? null : Math.round(L),
2511
- bf: D.beaufort(D.kts2ms(L ?? 0)),
2535
+ bf: g.beaufort(g.kts2ms(L ?? 0)),
2512
2536
  ...S.parseTropicalType(L),
2513
2537
  r7: null,
2514
2538
  r7ne: null,
@@ -2544,7 +2568,7 @@ const J = class J {
2544
2568
  }
2545
2569
  static async parseTropical(z) {
2546
2570
  var c, O, Y;
2547
- const b = await J.parseHistory(z.xuhao), p = (c = b.at(0)) == null ? void 0 : c.updated, W = await J.parseForecast(z.xuhao, p ? i(p) : void 0), A = {
2571
+ const b = await $.parseHistory(z.xuhao), p = (c = b.at(0)) == null ? void 0 : c.updated, W = await $.parseForecast(z.xuhao, p ? i(p) : void 0), A = {
2548
2572
  id: (O = z.enname) == null ? void 0 : O.toLowerCase(),
2549
2573
  name: (Y = z.enname) == null ? void 0 : Y.toLowerCase(),
2550
2574
  cnName: z.name,
@@ -2554,17 +2578,17 @@ const J = class J {
2554
2578
  return await S.tropicalMovement(A), A;
2555
2579
  }
2556
2580
  static async realtimeForecast() {
2557
- const z = "https://hifleet.com/hifleetapi/getCurrentTyphoon2.do", b = await $.post(z).text(), p = await J.parser.parseStringPromise(b), W = [], A = p.typhoon.position instanceof Array ? p.typhoon.position : [p.typhoon.position];
2581
+ const z = "https://hifleet.com/hifleetapi/getCurrentTyphoon2.do", b = await x.post(z).text(), p = await $.parser.parseStringPromise(b), W = [], A = p.typhoon.position instanceof Array ? p.typhoon.position : [p.typhoon.position];
2558
2582
  for (const c of A)
2559
2583
  if (c) {
2560
- const O = await J.parseTropical(c);
2584
+ const O = await $.parseTropical(c);
2561
2585
  W.push(O);
2562
2586
  }
2563
2587
  return W;
2564
2588
  }
2565
2589
  };
2566
- F(J, "parser", Z0.Parser({ explicitArray: !1, mergeAttrs: !0, trim: !0 }));
2567
- let n0 = J;
2590
+ F($, "parser", m0.Parser({ explicitArray: !1, mergeAttrs: !0, trim: !0 }));
2591
+ let n0 = $;
2568
2592
  var r0 = /* @__PURE__ */ ((M) => (M.CMA = "CMA", M.CNTW = "CNTW", M.CNHK = "CNHK", M.JMA = "JMA", M.KMA = "KMA", M.ECMWF = "ECMWF", M.NOAA_AT = "NOAA-AT", M.NOAA_CP = "NOAA-CP", M.NOAA_EP = "NOAA-EP", M.UKM = "UKM", M.IMD = "IMD", M.GFS = "GFS", M.BOM_ACCESS = "BOM-ACCESS", M.BOM_BULLETIN_EAST = "BOM-BULLETIN-EAST", M.BOM_BULLETIN_NORTH = "BOM-BULLETIN-NORTH", M.BOM_BULLETIN_WEST = "BOM-BULLETIN-WEST", M.OTHER = "OTHER", M))(r0 || {});
2569
2593
  class S {
2570
2594
  /**
@@ -2688,7 +2712,7 @@ class S {
2688
2712
  const O = (A + c) / 2, Y = p / O, a = Math.pow(Y, W) * Math.exp(1 - Math.pow(Y, W));
2689
2713
  b * Math.sqrt(a) > z ? A = O : c = O;
2690
2714
  }
2691
- return D.kmh2kts(A + c);
2715
+ return g.kmh2kts(A + c);
2692
2716
  }
2693
2717
  /**
2694
2718
  * 基于台风强度推算风圈基础半径的经验公式
@@ -2697,7 +2721,7 @@ class S {
2697
2721
  * @returns 风圈半径对象
2698
2722
  */
2699
2723
  static estimateWindRadii(z, b) {
2700
- const p = D.kts2ms(z), W = S.estimateRMW(p, b), A = S.estimateHollandB(p, W, b), c = S.findWindRadius(17.2, p, W, A), O = S.findWindRadius(28.5, p, W, A), Y = S.findWindRadius(37, p, W, A);
2724
+ const p = g.kts2ms(z), W = S.estimateRMW(p, b), A = S.estimateHollandB(p, W, b), c = S.findWindRadius(17.2, p, W, A), O = S.findWindRadius(28.5, p, W, A), Y = S.findWindRadius(37, p, W, A);
2701
2725
  return {
2702
2726
  r7: c ? Math.round(c) : null,
2703
2727
  r10: O ? Math.round(O) : null,
@@ -2800,5 +2824,5 @@ export {
2800
2824
  M1 as TidesHelper,
2801
2825
  S as TropicalHelper,
2802
2826
  r0 as TropicalModel,
2803
- m0 as WindyModel
2827
+ Z0 as WindyModel
2804
2828
  };