@cos-design/weather-background 3.5.3 → 3.5.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
@@ -1,57 +1,308 @@
1
- import { useEffect as e, useRef as t, useState as n } from "react";
2
- import { bindVisibilityPause as r } from "@cos-design/shared";
3
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
- import './index.css';//#region src/components/weatherBackground/live-weather.ts
5
- var o = 39, s = {
1
+ import { useEffect as e, useMemo as t, useRef as n, useState as r } from "react";
2
+ import { bindVisibilityPause as i, useCanvasBox as a } from "@cos-design/shared";
3
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import './index.css';//#region src/components/weatherBackground/day-cycle.ts
5
+ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
6
+ let t = e.replace("#", "").trim(), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
7
+ if (n.length !== 6) return [
8
+ 80,
9
+ 140,
10
+ 200
11
+ ];
12
+ let r = Number.parseInt(n, 16);
13
+ return Number.isNaN(r) ? [
14
+ 80,
15
+ 140,
16
+ 200
17
+ ] : [
18
+ r >> 16 & 255,
19
+ r >> 8 & 255,
20
+ r & 255
21
+ ];
22
+ }, u = ([e, t, n]) => {
23
+ let r = (e) => Math.min(255, Math.max(0, Math.round(e))).toString(16).padStart(2, "0");
24
+ return `#${r(e)}${r(t)}${r(n)}`;
25
+ }, d = (e, t, n) => e + (t - e) * n, f = (e, t, n) => [
26
+ d(e[0], t[0], n),
27
+ d(e[1], t[1], n),
28
+ d(e[2], t[2], n)
29
+ ], p = (e, t, n) => u(f(l(e), l(t), c(n))), m = (e) => {
30
+ let t = c(e);
31
+ return t * t * (3 - 2 * t);
32
+ }, h = (e = Date.now()) => {
33
+ let t = new Date(e), n = new Date(t);
34
+ n.setHours(6, 0, 0, 0);
35
+ let r = new Date(t);
36
+ return r.setHours(18, 0, 0, 0), {
37
+ sunrise: n.getTime(),
38
+ sunset: r.getTime()
39
+ };
40
+ }, g = (e, t = /* @__PURE__ */ new Date()) => {
41
+ let n = e.trim().match(/^(\d{1,2}):(\d{2})$/);
42
+ if (!n) return null;
43
+ let r = Number(n[1]), i = Number(n[2]);
44
+ if (r < 0 || r > 23 || i < 0 || i > 59) return null;
45
+ let a = new Date(t);
46
+ return a.setHours(r, i, 0, 0), a.getTime();
47
+ }, _ = (e, t = /* @__PURE__ */ new Date()) => g(e ?? "14:00", t) ?? g("14:00", t), v = (e, t) => {
48
+ let { sunrise: n, sunset: r } = t;
49
+ if (!(r > n)) {
50
+ let t = h(e);
51
+ n = t.sunrise, r = t.sunset;
52
+ }
53
+ let i = Math.max(1, r - n), a = n + 1440 * 60 * 1e3, o = r - 1440 * 60 * 1e3, s = e >= n && e < r, l;
54
+ if (s) l = c((e - n) / i);
55
+ else if (e >= r) {
56
+ let t = Math.max(1, a - r);
57
+ l = c((e - r) / t);
58
+ } else {
59
+ let t = Math.max(1, n - o);
60
+ l = c((e - o) / t);
61
+ }
62
+ let u = s ? Math.sin(Math.PI * l) : 0, d = Math.abs(e - n), f = Math.abs(e - r), p = c(1 - Math.min(d, f) / 45e5);
63
+ return {
64
+ isDay: s,
65
+ arcProgress: l,
66
+ elevation: u,
67
+ twilight: p
68
+ };
69
+ }, y = (e, t, n) => {
70
+ let r = c(n), i = Math.sin(Math.PI * r);
71
+ return {
72
+ x: e * (.1 + .8 * r),
73
+ y: t * (.58 - .4 * i)
74
+ };
75
+ }, b = "#e8895c", x = "#f3c98a", S = "#2a1f4a", C = "#c4784a", w = (e, t, n) => {
76
+ if (n.isDay) {
77
+ let t = m(n.elevation), r = (1 - t) * .72;
78
+ return [p(p(e[0], b, r), "#1a2438", (1 - t) * .12), p(p(e[1], x, r * .85), "#3a4558", (1 - t) * .08)];
79
+ }
80
+ let r = n.twilight;
81
+ return [p(t[0], p(S, b, .35), r * .55), p(t[1], p(C, x, .4), r * .7)];
82
+ }, ee = (e, t, n) => {
83
+ let r = e.createLinearGradient(0, 0, 0, t);
84
+ return r.addColorStop(0, n[0]), r.addColorStop(1, n[1]), r;
85
+ }, T = (e) => {
86
+ if (!e.isDay) return {
87
+ scale: .92 + e.twilight * .06,
88
+ alpha: .75 + e.twilight * .2
89
+ };
90
+ let t = e.elevation;
91
+ return {
92
+ scale: .82 + t * .22,
93
+ alpha: .65 + t * .35
94
+ };
95
+ }, E = 2, D = [
96
+ "",
97
+ "薄雾",
98
+ "中雾",
99
+ "浓雾"
100
+ ], O = (e) => Math.min(3, Math.max(1, Math.round(e))), k = (e) => {
101
+ let t = O(e);
102
+ return `${t} · ${D[t]}`;
103
+ }, A = (e) => e === "fog", j = (e, t) => {
104
+ let n = O(t);
105
+ return n === 1 ? {
106
+ ...e,
107
+ fogBanks: 3,
108
+ haze: .06,
109
+ cloudAlpha: Math.min(e.cloudAlpha, .28),
110
+ sun: "soft"
111
+ } : n === 3 ? {
112
+ ...e,
113
+ fogBanks: 12,
114
+ haze: .3,
115
+ cloudAlpha: .42,
116
+ sun: "dim"
117
+ } : {
118
+ ...e,
119
+ fogBanks: 5,
120
+ haze: .11,
121
+ cloudAlpha: .32,
122
+ sun: "dim"
123
+ };
124
+ }, M = (e) => {
125
+ let t = O(e);
126
+ return t === 1 ? .45 : t === 3 ? .95 : .65;
127
+ }, N = (e) => e === 45 ? 2 : e === 48 ? 3 : null, P = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, F = 2, I = [
128
+ "",
129
+ "细雹",
130
+ "密雹",
131
+ "巨雹"
132
+ ], L = (e) => Math.min(3, Math.max(1, Math.round(e))), R = (e) => {
133
+ let t = L(e);
134
+ return `${t} · ${I[t]}`;
135
+ }, z = (e) => e === "hail", B = (e) => {
136
+ let t = L(e);
137
+ return t === 1 ? {
138
+ count: 75,
139
+ sizeMin: .85,
140
+ sizeMax: 2.1,
141
+ speedMul: .88
142
+ } : t === 3 ? {
143
+ count: 210,
144
+ sizeMin: 2.4,
145
+ sizeMax: 5.6,
146
+ speedMul: 1.22
147
+ } : {
148
+ count: 145,
149
+ sizeMin: 1.4,
150
+ sizeMax: 3.8,
151
+ speedMul: 1
152
+ };
153
+ }, V = (e) => e === 96 ? 2 : e === 99 ? 3 : null, te = 1, H = 10, U = 5, W = 5, G = (e) => Math.min(10, Math.max(1, Math.round(e))), K = (e, t, n) => e + (t - e) * n, q = (e) => {
154
+ let t = G(e);
155
+ return t <= 2 ? 1 : t <= 4 ? 2 : t <= 6 ? 3 : t <= 8 ? 4 : 5;
156
+ }, ne = [
157
+ "毛毛雨",
158
+ "小雨",
159
+ "中雨",
160
+ "暴雨",
161
+ "特大暴雨"
162
+ ], re = [
163
+ "毛毛雪",
164
+ "小雪",
165
+ "中雪",
166
+ "暴雪",
167
+ "特大暴雪"
168
+ ], ie = (e, t) => {
169
+ let n = q(e);
170
+ return (t === "rain" ? ne : re)[n - 1];
171
+ }, ae = (e, t) => `${G(e)} · ${ie(e, t)}`, oe = ["", ...ne], se = ["", ...re], J = (e) => e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? "rain" : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? "snow" : e, ce = (e) => e === "rain" || e === "lightRain" || e === "moderateRain" || e === "heavyRain", le = (e) => e === "snow" || e === "lightSnow" || e === "moderateSnow" || e === "heavySnow", ue = (e) => ce(e) || e === "thunderstorm" || e === "sleet", de = (e) => le(e) || e === "sleet", fe = (e, t = 5) => e === "lightRain" ? 3 : e === "moderateRain" ? 5 : e === "heavyRain" ? 8 : G(t), pe = (e, t = 5) => e === "lightSnow" ? 3 : e === "moderateSnow" ? 5 : e === "heavySnow" ? 8 : G(t), Y = (e, t) => t === "rain" ? e <= 2 ? "lightRain" : e === 3 ? "moderateRain" : "heavyRain" : e <= 2 ? "lightSnow" : e === 3 ? "moderateSnow" : "heavySnow", me = (e, t = 5, n = 5) => e === "rain" ? Y(q(t), "rain") : e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? Y(q(fe(e)), "rain") : e === "snow" ? Y(q(n), "snow") : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? Y(q(pe(e)), "snow") : e, he = (e, t) => {
172
+ let n = (G(t) - 1) / 9;
173
+ return {
174
+ count: Math.round(K(35, 340, n)),
175
+ speed: K(5.5, 16, n),
176
+ wind: K(-.4, -3.2, n),
177
+ alpha: K(.28, .62, n),
178
+ splash: G(t) >= 5
179
+ };
180
+ }, ge = (e) => {
181
+ let t = (G(e) - 1) / 9;
182
+ return Math.round(K(30, 360, t));
183
+ }, _e = (e) => [51, 56].includes(e) ? 2 : [
184
+ 61,
185
+ 66,
186
+ 80
187
+ ].includes(e) ? 3 : [
188
+ 53,
189
+ 55,
190
+ 57,
191
+ 63,
192
+ 81
193
+ ].includes(e) ? 5 : [65, 67].includes(e) ? 8 : [82].includes(e) ? 10 : [95].includes(e) ? 7 : null, ve = (e) => [77].includes(e) ? 2 : [71, 85].includes(e) ? 3 : [73].includes(e) ? 5 : [75].includes(e) ? 8 : [86].includes(e) ? 10 : null, ye = 2, be = [
194
+ "",
195
+ "轻霾",
196
+ "中霾",
197
+ "重霾"
198
+ ], X = (e) => Math.min(3, Math.max(1, Math.round(e))), xe = (e) => {
199
+ let t = X(e);
200
+ return `${t} · ${be[t]}`;
201
+ }, Se = (e) => e === "smog", Ce = (e, t) => {
202
+ let n = X(t);
203
+ return n === 1 ? {
204
+ ...e,
205
+ fogBanks: 5,
206
+ haze: .16,
207
+ cloudAlpha: Math.min(e.cloudAlpha, .28),
208
+ sun: "soft"
209
+ } : n === 3 ? {
210
+ ...e,
211
+ fogBanks: 16,
212
+ haze: .48,
213
+ cloudAlpha: .42,
214
+ sun: "dim"
215
+ } : {
216
+ ...e,
217
+ fogBanks: 12,
218
+ haze: .34,
219
+ cloudAlpha: .35,
220
+ sun: "dim"
221
+ };
222
+ }, we = (e) => {
223
+ let t = X(e);
224
+ return t === 1 ? .55 : t === 3 ? 1.05 : .85;
225
+ }, Te = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, Ee = {
6
226
  0: "sunny",
7
227
  1: "sunny",
8
228
  2: "partlyCloudy",
9
229
  3: "overcast",
10
230
  45: "fog",
11
231
  48: "fog",
12
- 51: "lightRain",
13
- 53: "moderateRain",
14
- 55: "moderateRain",
15
- 56: "lightRain",
16
- 57: "moderateRain",
17
- 61: "lightRain",
18
- 63: "moderateRain",
19
- 65: "heavyRain",
20
- 66: "lightRain",
21
- 67: "heavyRain",
22
- 71: "lightSnow",
23
- 73: "moderateSnow",
24
- 75: "heavySnow",
25
- 77: "lightSnow",
26
- 80: "lightRain",
27
- 81: "moderateRain",
28
- 82: "heavyRain",
29
- 85: "lightSnow",
30
- 86: "heavySnow",
232
+ 51: "rain",
233
+ 53: "rain",
234
+ 55: "rain",
235
+ 56: "rain",
236
+ 57: "rain",
237
+ 61: "rain",
238
+ 63: "rain",
239
+ 65: "rain",
240
+ 66: "rain",
241
+ 67: "rain",
242
+ 80: "rain",
243
+ 81: "rain",
244
+ 82: "rain",
245
+ 71: "snow",
246
+ 73: "snow",
247
+ 75: "snow",
248
+ 77: "snow",
249
+ 85: "snow",
250
+ 86: "snow",
31
251
  95: "thunderstorm",
32
252
  96: "hail",
33
253
  99: "hail"
34
- }, c = (e, t = 0) => {
35
- let n = s[e] ?? "overcast";
36
- return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >= o ? "gale" : n;
37
- }, l = {
254
+ }, De = (e) => J(Ee[e] ?? "overcast"), Oe = {
38
255
  weather: null,
256
+ rainLevel: null,
257
+ snowLevel: null,
258
+ fogLevel: null,
259
+ hailLevel: null,
260
+ smogLevel: null,
39
261
  status: "idle",
40
262
  error: null,
41
263
  current: null
42
- }, u = {
264
+ }, ke = {
43
265
  weather: null,
266
+ rainLevel: null,
267
+ snowLevel: null,
268
+ fogLevel: null,
269
+ hailLevel: null,
270
+ smogLevel: null,
44
271
  status: "locating",
45
272
  error: null,
46
273
  current: null
47
- }, d = {
274
+ }, Ae = {
48
275
  weather: null,
276
+ rainLevel: null,
277
+ snowLevel: null,
278
+ fogLevel: null,
279
+ hailLevel: null,
280
+ smogLevel: null,
49
281
  status: "fetching",
50
282
  error: null,
51
283
  current: null
52
- }, f = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), p = (t = !0, r) => {
53
- let i = f(r), a = i ? r.latitude : null, o = i ? r.longitude : null, s = t ? i ? d : u : l, p = `${t}:${a},${o}`, [m, h] = n(s), [g, _] = n(p);
54
- return g !== p && (_(p), h((e) => t && e.weather ? {
284
+ }, je = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), Z = (e) => {
285
+ if (typeof e != "string" || !e) return null;
286
+ let t = Date.parse(e);
287
+ return Number.isFinite(t) ? t : null;
288
+ }, Me = (e) => {
289
+ if (typeof e != "string" || !e) return null;
290
+ let t = e.match(/T(\d{2}):(\d{2})/);
291
+ return t ? `${t[1]}:${t[2]}` : null;
292
+ }, Ne = (e, t) => {
293
+ if (e) try {
294
+ let t = new Intl.DateTimeFormat("en-GB", {
295
+ timeZone: e,
296
+ hour: "2-digit",
297
+ minute: "2-digit",
298
+ hour12: !1
299
+ }).formatToParts(/* @__PURE__ */ new Date()), n = t.find((e) => e.type === "hour")?.value, r = t.find((e) => e.type === "minute")?.value;
300
+ if (n != null && r != null) return `${n.padStart(2, "0")}:${r.padStart(2, "0")}`;
301
+ } catch {}
302
+ return t ?? null;
303
+ }, Pe = (t = !0, n) => {
304
+ let i = je(n), a = i ? n.latitude : null, o = i ? n.longitude : null, s = t ? i ? Ae : ke : Oe, c = `${t}:${a},${o}`, [l, u] = r(s), [d, f] = r(c);
305
+ return d !== c && (f(c), u((e) => t && e.weather ? {
55
306
  ...s,
56
307
  weather: e.weather,
57
308
  current: e.current
@@ -62,29 +313,52 @@ var o = 39, s = {
62
313
  let i = new URLSearchParams({
63
314
  latitude: String(t),
64
315
  longitude: String(r),
65
- current: "weather_code,wind_speed_10m,is_day"
316
+ current: "weather_code,wind_speed_10m,is_day,visibility",
317
+ daily: "sunrise,sunset",
318
+ timezone: "auto",
319
+ forecast_days: "1"
66
320
  }), a = await fetch(`https://api.open-meteo.com/v1/forecast?${i}`, { signal: n.signal });
67
321
  if (!a.ok) throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);
68
322
  let o = await a.json(), s = Number(o?.current?.weather_code);
69
323
  if (Number.isNaN(s)) throw Error("Open-Meteo 返回数据缺少 weather_code");
70
- let l = Number(o?.current?.wind_speed_10m ?? 0);
324
+ let c = Number(o?.current?.wind_speed_10m ?? 0), l = Z(o?.daily?.sunrise?.[0]), d = Z(o?.daily?.sunset?.[0]), f = typeof o?.timezone == "string" ? o.timezone : null, p = Me(o?.current?.time) ?? Ne(f), m = De(s), h = _e(s), g = ve(s), _ = o?.current?.visibility, v = _ != null && Number.isFinite(Number(_)) ? Number(_) : null, y = m === "fog" ? P(v) ?? N(s) ?? 2 : null, b = m === "hail" ? V(s) ?? 2 : null, x = m === "smog" ? Te(v) ?? 2 : null;
71
325
  if (e) return;
72
- h({
73
- weather: c(s, l),
326
+ u({
327
+ weather: m,
328
+ rainLevel: h,
329
+ snowLevel: g,
330
+ fogLevel: y,
331
+ hailLevel: b,
332
+ smogLevel: x,
74
333
  status: "success",
75
334
  error: null,
76
335
  current: {
77
336
  weatherCode: s,
78
- windSpeed: l,
337
+ windSpeed: c,
79
338
  isDay: o?.current?.is_day === 1,
80
339
  latitude: t,
81
- longitude: r
340
+ longitude: r,
341
+ timezone: f,
342
+ localTime: p,
343
+ visibility: v,
344
+ rainLevel: h,
345
+ snowLevel: g,
346
+ fogLevel: y,
347
+ hailLevel: b,
348
+ smogLevel: x,
349
+ sunrise: l,
350
+ sunset: d
82
351
  }
83
352
  });
84
353
  } catch (t) {
85
354
  if (e || t instanceof DOMException && t.name === "AbortError") return;
86
- h({
355
+ u({
87
356
  weather: null,
357
+ rainLevel: null,
358
+ snowLevel: null,
359
+ fogLevel: null,
360
+ hailLevel: null,
361
+ smogLevel: null,
88
362
  status: "error",
89
363
  error: t instanceof Error ? t.message : "天气获取失败",
90
364
  current: null
@@ -94,8 +368,13 @@ var o = 39, s = {
94
368
  return a != null && o != null ? (r(a, o), () => {
95
369
  e = !0, n.abort();
96
370
  }) : typeof navigator > "u" || !navigator.geolocation ? (Promise.resolve().then(() => {
97
- e || h({
371
+ e || u({
98
372
  weather: null,
373
+ rainLevel: null,
374
+ snowLevel: null,
375
+ fogLevel: null,
376
+ hailLevel: null,
377
+ smogLevel: null,
99
378
  status: "error",
100
379
  error: "当前环境不支持定位",
101
380
  current: null
@@ -103,13 +382,18 @@ var o = 39, s = {
103
382
  }), () => {
104
383
  e = !0;
105
384
  }) : (navigator.geolocation.getCurrentPosition(({ coords: t }) => {
106
- e || (h((e) => ({
385
+ e || (u((e) => ({
107
386
  ...e,
108
387
  status: "fetching"
109
388
  })), r(t.latitude, t.longitude));
110
389
  }, (t) => {
111
- e || h({
390
+ e || u({
112
391
  weather: null,
392
+ rainLevel: null,
393
+ snowLevel: null,
394
+ fogLevel: null,
395
+ hailLevel: null,
396
+ smogLevel: null,
113
397
  status: "error",
114
398
  error: t.message || "定位失败",
115
399
  current: null
@@ -124,50 +408,158 @@ var o = 39, s = {
124
408
  t,
125
409
  a,
126
410
  o
127
- ]), m;
128
- };
411
+ ]), l;
412
+ }, Fe = async (e, t, n) => {
413
+ let r = new URLSearchParams({
414
+ latitude: String(e),
415
+ longitude: String(t),
416
+ daily: "sunrise,sunset",
417
+ timezone: "auto",
418
+ forecast_days: "1"
419
+ }), i = await fetch(`https://api.open-meteo.com/v1/forecast?${r}`, { signal: n });
420
+ if (!i.ok) return null;
421
+ let a = await i.json(), o = Z(a?.daily?.sunrise?.[0]), s = Z(a?.daily?.sunset?.[0]);
422
+ return o == null || s == null ? null : {
423
+ sunrise: o,
424
+ sunset: s
425
+ };
426
+ }, Ie = (t) => {
427
+ let n = je(t), i = n ? t.latitude : null, a = n ? t.longitude : null, o = `${i},${a}`, [s, c] = r(null), [l, u] = r(o);
428
+ return l !== o && (u(o), c(null)), e(() => {
429
+ if (i == null || a == null) return;
430
+ let e = !1, t = new AbortController();
431
+ return Fe(i, a, t.signal).then((t) => {
432
+ e || c(t);
433
+ }).catch(() => {
434
+ e || c(null);
435
+ }), () => {
436
+ e = !0, t.abort();
437
+ };
438
+ }, [i, a]), n ? s : null;
439
+ }, Le = 3, Re = (e) => Math.min(12, Math.max(0, Math.round(e))), ze = (e) => Math.max(0, Re(e) - 2), Be = .55, Ve = [
440
+ 0,
441
+ 3,
442
+ 8,
443
+ 16,
444
+ 24,
445
+ 33,
446
+ 44,
447
+ 55,
448
+ 68,
449
+ 81,
450
+ 95,
451
+ 110,
452
+ 125
453
+ ], He = [
454
+ 1,
455
+ 5,
456
+ 11,
457
+ 19,
458
+ 28,
459
+ 38,
460
+ 49,
461
+ 61,
462
+ 74,
463
+ 88,
464
+ 102,
465
+ 117,
466
+ Infinity
467
+ ], Q = (e, t, n = 0, r = 0) => {
468
+ let i = t.gustiness, a = t.wander, o = n * .0017 + r * .0024, s = e * Be, c = Math.sin(s * .007 + o), l = Math.sin(s * .021 + 1.37 + o * 1.4), u = Math.sin(s * .055 + 2.8 + o * .6), d = 1 + (.5 * c + .35 * l + .15 * u) * (.25 + i * .75), f = Math.sin(s * .012 + o * .8);
469
+ f > .72 && (d += (f - .72) * (.8 + i * 2.4)), Math.sin(s * .0095 + .6 + o) < -.55 && (d *= .45 + i * .2), d = Math.max(.12, Math.min(2.25, d));
470
+ let p = a * (.55 * Math.sin(s * .0088 + o) + .3 * Math.sin(s * .026 + 1.9 + o * 1.1) + .15 * Math.sin(s * .063 + .4));
471
+ return {
472
+ intensity: d,
473
+ angle: p,
474
+ ux: Math.cos(p),
475
+ uy: Math.sin(p)
476
+ };
477
+ }, Ue = (e) => {
478
+ let t = Re(e);
479
+ if (t <= 0) return {
480
+ count: 0,
481
+ alphaMul: 0
482
+ };
483
+ let n = Math.min(1, (t / 9) ** 1.15);
484
+ return {
485
+ count: Math.floor(3 + n * n * 50),
486
+ alphaMul: .1 + n * .9
487
+ };
488
+ }, We = (e) => Ve[Re(e)] ?? 16, Ge = (e) => {
489
+ let t = Math.max(0, e);
490
+ for (let e = 0; e < He.length; e++) if (t <= He[e]) return e;
491
+ return 12;
492
+ }, Ke = (e) => {
493
+ let t = Ge(e), n = ze(t), r = We(n), i = Math.max(.04, Math.min(r / 16, 4.2)), { alphaMul: a } = Ue(n), o = i ** .82, s = Math.min(1, (n / 8) ** 1.1), c = (.04 + s * .32) * Math.PI;
494
+ return {
495
+ speedKmh: e,
496
+ level: t,
497
+ visualLevel: n,
498
+ scale: i,
499
+ cloud: .28 + i * .72,
500
+ rain: o,
501
+ snowDrift: -(.04 + o * .28),
502
+ hail: .4 + o * .85,
503
+ fog: .32 + o * .58,
504
+ streak: .55 + o * .95,
505
+ streakVisibility: a,
506
+ gustiness: s,
507
+ wander: c
508
+ };
509
+ }, qe = (e) => e.live && e.liveWindKmh != null && Number.isFinite(e.liveWindKmh) ? Math.max(0, e.liveWindKmh) : We(e.windLevel);
129
510
  //#endregion
130
511
  //#region src/components/weatherBackground/scene/draw-atmosphere.ts
131
- function m(e) {
132
- let t = e.activeWeather === "gale" ? 7 : 1;
133
- for (let n of e.state.clouds) n.x += n.speed * t, n.x - 140 * n.scale > e.width && (n.x = -160 * n.scale), e.ctx.drawImage(n.sprite, n.x + n.ox, n.y + n.oy);
512
+ function Je(e) {
513
+ let t = e.windMotion.cloud, { intensity: n, angle: r, uy: i } = e.windField, a = -Math.cos(r);
514
+ for (let r of e.state.clouds) {
515
+ let o = Math.abs(r.speed) * t * n;
516
+ r.x += o * a, r.y += o * i * .12, r.y < -80 && (r.y = -80), r.y > e.height * .55 && (r.y = e.height * .55), r.x - 140 * r.scale > e.width && (r.x = -160 * r.scale), r.x + 180 * r.scale < 0 && (r.x = e.width + 40 * r.scale), e.ctx.drawImage(r.sprite, r.x + r.ox, r.y + r.oy);
517
+ }
134
518
  }
135
- function h(e) {
519
+ function Ye(e) {
136
520
  let t = e.fogSprite;
137
521
  if (!t || e.state.fogBanks.length === 0) return;
138
- let { canvas: n, baseR: r } = t;
139
- for (let t of e.state.fogBanks) t.x += t.speed, t.speed > 0 && t.x - t.rw > e.width && (t.x = -t.rw), t.speed < 0 && t.x + t.rw < 0 && (t.x = e.width + t.rw), e.ctx.save(), e.ctx.translate(t.x, t.y), e.ctx.scale(t.rw / r, t.rh / r), e.ctx.globalAlpha = t.alpha, e.ctx.drawImage(n, -r, -r), e.ctx.restore();
522
+ let { canvas: n, baseR: r } = t, i = e.windMotion.fog, { intensity: a, angle: o, uy: s } = e.windField, c = -Math.cos(o);
523
+ for (let t of e.state.fogBanks) {
524
+ let o = Math.abs(t.speed) * i * a;
525
+ t.x += o * c, t.y += o * s * .1, t.y < e.height * .02 && (t.y = e.height * .02), t.y > e.height * .95 && (t.y = e.height * .95), c < 0 && t.x + t.rw < 0 && (t.x = e.width + t.rw), c > 0 && t.x - t.rw > e.width && (t.x = -t.rw), e.ctx.save(), e.ctx.translate(t.x, t.y), e.ctx.scale(t.rw / r, t.rh / r), e.ctx.globalAlpha = t.alpha, e.ctx.drawImage(n, -r, -r), e.ctx.restore();
526
+ }
140
527
  }
141
- function g(e) {
528
+ function Xe(e) {
142
529
  if (e.cfg.haze <= 0) return;
143
530
  let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
144
531
  e.activeNight && (t = e.activeWeather === "smog" ? "82, 74, 54" : "116, 128, 145"), e.ctx.fillStyle = `rgba(${t}, ${e.cfg.haze})`, e.ctx.fillRect(0, 0, e.width, e.height);
145
532
  }
146
533
  //#endregion
147
534
  //#region src/components/weatherBackground/lightning.ts
148
- function _(e, t, n, r, i, a) {
535
+ function Ze(e, t, n, r, i, a) {
149
536
  if (a <= 0) return [[e, t], [n, r]];
150
- let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = _(e, t, o, s, i * .55, a - 1), l = _(o, s, n, r, i * .55, a - 1);
537
+ let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = Ze(e, t, o, s, i * .55, a - 1), l = Ze(o, s, n, r, i * .55, a - 1);
151
538
  return [...c.slice(0, -1), ...l];
152
539
  }
153
540
  //#endregion
154
541
  //#region src/components/weatherBackground/scene/draw-effects.ts
155
- function v(e) {
156
- if (e.state.windStreaks.length !== 0) for (let t of e.state.windStreaks) {
157
- t.x += t.speed, t.wave += .04, t.x - t.length > e.width && (t.x = -t.length - Math.random() * e.width * .3, t.y = Math.random() * e.height);
158
- let n = Math.sin(t.wave) * 8, r = t.x + t.length;
159
- if (e.ctx.beginPath(), e.ctx.moveTo(t.x, t.y), e.ctx.bezierCurveTo(t.x + t.length * .3, t.y + n, t.x + t.length * .7, t.y - n, r, t.y), e.ctx.strokeStyle = `rgba(235, 244, 250, ${t.alpha})`, e.ctx.lineWidth = t.width, e.ctx.lineCap = "round", e.ctx.stroke(), t.length > 100) {
160
- let r = t.x + t.length * .58, i = t.y - n * .4;
161
- e.ctx.save(), e.ctx.translate(r, i), e.ctx.rotate(t.wave * 2), e.ctx.beginPath(), e.ctx.ellipse(0, 0, 4, 1.6, 0, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(91, 76, 52, ${t.alpha * 1.6})`, e.ctx.fill(), e.ctx.restore();
542
+ function Qe(e) {
543
+ if (e.state.windStreaks.length === 0) return;
544
+ let t = e.windMotion.streak, n = e.windMotion.streakVisibility;
545
+ if (n <= .02) return;
546
+ let r = e.state.t;
547
+ for (let i of e.state.windStreaks) {
548
+ let a = Q(r + i.phase * 18, e.windMotion, i.x, i.y), o = a.intensity * (.55 + .45 * e.windField.intensity), s = a.angle * .65 + e.windField.angle * .35, c = -1 * Math.cos(s), l = Math.sin(s), u = i.speed * t * o;
549
+ i.x += u * c, i.y += u * l * .45, i.wave += .03 + o * .025, (i.x < -i.length - 40 || i.x > e.width + i.length + 40) && (i.x = c < 0 ? e.width + i.length + Math.random() * e.width * .25 : -i.length - Math.random() * e.width * .25, i.y = Math.random() * e.height), i.y < -20 && (i.y = e.height + 10), i.y > e.height + 20 && (i.y = -10);
550
+ let d = 5 + o * 5, f = Math.sin(i.wave) * d, p = i.length * (.85 + o * .2), m = i.x + c * p, h = i.y + l * p * .45, g = i.alpha * n * Math.min(1.35, .55 + o * .55);
551
+ if (e.ctx.beginPath(), e.ctx.moveTo(i.x, i.y), e.ctx.bezierCurveTo(i.x + c * p * .3, i.y + l * p * .3 * .45 + f, i.x + c * p * .7, i.y + l * p * .7 * .45 - f, m, h), e.ctx.strokeStyle = `rgba(235, 244, 250, ${g})`, e.ctx.lineWidth = i.width * (.85 + o * .2), e.ctx.lineCap = "round", e.ctx.stroke(), i.length > 70 && n > .45 && o > .7) {
552
+ let t = i.x + c * p * .58, n = i.y + l * p * .58 * .45 - f * .4;
553
+ e.ctx.save(), e.ctx.translate(t, n), e.ctx.rotate(s + i.wave * 2), e.ctx.beginPath(), e.ctx.ellipse(0, 0, 4, 1.6, 0, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(91, 76, 52, ${g * 1.4})`, e.ctx.fill(), e.ctx.restore();
162
554
  }
163
555
  }
164
556
  }
165
- function y(e) {
557
+ function $e(e) {
166
558
  if (e.cfg.lightning) {
167
559
  if (e.state.t >= e.state.nextStrike) {
168
560
  e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
169
561
  let t = e.width * (.15 + Math.random() * .7);
170
- e.state.boltPoints = _(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
562
+ e.state.boltPoints = Ze(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
171
563
  }
172
564
  if (e.state.boltLife > 0) {
173
565
  --e.state.boltLife;
@@ -179,7 +571,7 @@ function y(e) {
179
571
  }
180
572
  //#endregion
181
573
  //#region src/components/weatherBackground/sprites/hail.ts
182
- var b = 3.2, x = (e) => {
574
+ var et = 3.2, tt = (e) => {
183
575
  let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
184
576
  n.width = t, n.height = t;
185
577
  let r = n.getContext("2d"), i = t / 2, a = t / 2, o = 9 + Math.floor(Math.random() * 5), s = Array.from({ length: o }, (t, n) => {
@@ -212,10 +604,11 @@ var b = 3.2, x = (e) => {
212
604
  r.beginPath(), r.arc(n, o, e * (.1 + Math.random() * .08), 0, Math.PI * 2), r.fillStyle = "rgba(255, 255, 255, 0.55)", r.fill();
213
605
  }
214
606
  return r.beginPath(), r.ellipse(i - e * .34, a - e * .36, e * .24, e * .17, -.35, 0, Math.PI * 2), r.fillStyle = "rgba(255, 255, 255, 0.78)", r.fill(), n;
215
- }, S = (e = 16) => Array.from({ length: e }, () => x(b)), C = (e) => e[Math.floor(Math.random() * e.length)], w = (e, t, n, r, i = !0) => {
216
- e.r = 1.4 + Math.random() ** 1.35 * 3.4, e.x = Math.random() * (t + 260) - 130 + (Math.random() - .5) * 40, e.y = i ? -e.r - Math.random() * n * .55 : Math.random() * n, e.vx = -1.2 - Math.random() * 4.8 + (Math.random() - .5) * 1.2, e.vy = 5.5 + Math.random() * 11, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = .11 + Math.random() * .14, e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite = C(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
217
- }, T = (e, t, n) => {
218
- let r = {
607
+ }, nt = (e = 16) => Array.from({ length: e }, () => tt(et)), rt = (e) => e[Math.floor(Math.random() * e.length)], it = (e, t, n, r, i = !0, a, o = 1) => {
608
+ let s = a?.min ?? 1.4, c = a?.max ?? 4.8;
609
+ e.r = s + Math.random() ** 1.35 * (c - s), e.x = Math.random() * (t + 260) - 130 + (Math.random() - .5) * 40, e.y = i ? -e.r - Math.random() * n * .55 : Math.random() * n, e.vx = (-1.2 - Math.random() * 4.8 + (Math.random() - .5) * 1.2) * o, e.vy = (5.5 + Math.random() * 11) * o, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = (.11 + Math.random() * .14) * (.9 + o * .1), e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite = rt(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
610
+ }, at = (e, t, n, r, i = 1) => {
611
+ let a = {
219
612
  x: 0,
220
613
  y: 0,
221
614
  r: 2,
@@ -233,21 +626,21 @@ var b = 3.2, x = (e) => {
233
626
  rotation: 0,
234
627
  rotationSpeed: 0
235
628
  };
236
- return w(r, e, t, n, Math.random() < .72), r;
629
+ return it(a, e, t, n, Math.random() < .72, r, i), a;
237
630
  };
238
631
  //#endregion
239
632
  //#region src/components/weatherBackground/scene/draw-precipitation.ts
240
- function E(e) {
633
+ function ot(e) {
241
634
  if (!e.cfg.rain) return;
242
- let { wind: t, alpha: n, splash: r } = e.cfg.rain;
243
- e.ctx.strokeStyle = `rgba(214, 228, 240, ${n})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
244
- for (let n of e.state.drops) {
245
- let i = Math.hypot(t, n.speed) || 1, a = t / i, o = n.speed / i;
246
- e.ctx.moveTo(n.x, n.y), e.ctx.lineTo(n.x + a * n.len, n.y + o * n.len), n.x += t, n.y += n.speed, n.y > e.height && (r && Math.random() < .3 && e.state.splashes.length < 60 && e.state.splashes.push({
247
- x: n.x,
635
+ let { alpha: t, splash: n } = e.cfg.rain, r = e.cfg.rain.wind * e.windMotion.rain, { intensity: i, angle: a, uy: o } = e.windField, s = r * i * Math.cos(a), c = Math.abs(r) * i * o * .35;
636
+ e.ctx.strokeStyle = `rgba(214, 228, 240, ${t})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
637
+ for (let t of e.state.drops) {
638
+ let r = t.speed + c, i = Math.hypot(s, r) || 1, a = s / i, o = r / i;
639
+ e.ctx.moveTo(t.x, t.y), e.ctx.lineTo(t.x + a * t.len, t.y + o * t.len), t.x += s, t.y += r, t.y > e.height && (n && Math.random() < .3 && e.state.splashes.length < 60 && e.state.splashes.push({
640
+ x: t.x,
248
641
  r: 1,
249
642
  alpha: .5
250
- }), n.y = -n.len, n.x = Math.random() * (e.width + 160) - 80);
643
+ }), t.y = -t.len, t.x = Math.random() * (e.width + 160) - 80);
251
644
  }
252
645
  e.ctx.stroke();
253
646
  for (let t = e.state.splashes.length - 1; t >= 0; t--) {
@@ -259,58 +652,71 @@ function E(e) {
259
652
  e.ctx.beginPath(), e.ctx.ellipse(n.x, e.height - 3, n.r, n.r * .35, 0, Math.PI, Math.PI * 2), e.ctx.strokeStyle = `rgba(214, 228, 240, ${n.alpha})`, e.ctx.lineWidth = 1, e.ctx.stroke();
260
653
  }
261
654
  }
262
- function D(e) {
655
+ function st(e) {
656
+ let t = e.windMotion.snowDrift, { intensity: n, angle: r, uy: i } = e.windField, a = t * n * Math.cos(r), o = Math.abs(t) * n * i * .4;
263
657
  for (let t of e.state.flakes) {
264
- t.y += t.speed, t.x += Math.sin(e.state.t * .02 + t.phase) * (.3 + t.size * .08) + t.drift, t.rotation += t.rotationSpeed, t.y - t.drawSize > e.height && (t.y = -t.drawSize, t.x = Math.random() * e.width, t.phase = Math.random() * Math.PI * 2, t.drift = (Math.random() - .5) * .4, t.opacity = .55 + Math.random() * .45), t.x > e.width + 20 && (t.x = -20), t.x < -20 && (t.x = e.width + 20);
658
+ t.y += t.speed + o, t.x += Math.sin(e.state.t * .02 + t.phase) * (.3 + t.size * .08) + t.drift + a, t.rotation += t.rotationSpeed, t.y - t.drawSize > e.height && (t.y = -t.drawSize, t.x = Math.random() * e.width, t.phase = Math.random() * Math.PI * 2, t.drift = (Math.random() - .5) * .4, t.opacity = .55 + Math.random() * .45), t.x > e.width + 20 && (t.x = -20), t.x < -20 && (t.x = e.width + 20);
265
659
  let n = t.drawSize / 2;
266
660
  e.ctx.save(), e.ctx.globalAlpha = t.opacity, e.ctx.translate(t.x, t.y), e.ctx.rotate(t.rotation), e.ctx.drawImage(t.sprite, -n, -n, t.drawSize, t.drawSize), e.ctx.restore();
267
661
  }
268
662
  }
269
- function O(e) {
663
+ function ct(e) {
270
664
  if (e.state.hailstones.length === 0) return;
271
- let t = e.state.hailPool;
272
- for (let n of e.state.hailstones) {
273
- if (n.delay > 0) {
274
- --n.delay;
665
+ let t = e.state.hailPool, n = e.windMotion.hail, r = e.state.t, i = e.windField;
666
+ for (let a of e.state.hailstones) {
667
+ if (a.delay > 0) {
668
+ --a.delay;
275
669
  continue;
276
670
  }
277
- let r = n.x, i = n.y;
278
- if (n.vy += n.gravity, n.vx += n.gust * .004 + (Math.random() - .5) * .06, n.x += n.vx + Math.sin(e.state.t * .028 + n.phase) * .35, n.y += n.vy, e.ctx.beginPath(), e.ctx.moveTo(r, i), e.ctx.lineTo(n.x, n.y), e.ctx.strokeStyle = `rgba(225, 239, 250, ${n.opacity * .18})`, e.ctx.lineWidth = n.r * .35, e.ctx.stroke(), n.y + n.r >= e.height) if (n.bounces < n.maxBounces) n.y = e.height - n.r, n.vy *= -(.22 + Math.random() * .28), n.vx = n.vx * (.55 + Math.random() * .25) + (Math.random() - .5) * 1.6, n.bounces += 1;
671
+ let o = Q(r + a.phase * 12, e.windMotion, a.x, a.y), s = o.intensity * (.4 + .6 * i.intensity), c = o.angle * .5 + i.angle * .5, l = e.windMotion.snowDrift * .45 * s * Math.cos(c), u = Math.abs(e.windMotion.snowDrift) * s * Math.sin(c) * .2, d = a.x, f = a.y;
672
+ if (a.vy += a.gravity + u * .02, a.vx += a.gust * .004 * n * s + l + (Math.random() - .5) * .08 * n * s, a.x += a.vx + Math.sin(r * .028 + a.phase) * .35, a.y += a.vy, e.ctx.beginPath(), e.ctx.moveTo(d, f), e.ctx.lineTo(a.x, a.y), e.ctx.strokeStyle = `rgba(225, 239, 250, ${a.opacity * .18})`, e.ctx.lineWidth = a.r * .35, e.ctx.stroke(), a.y + a.r >= e.height) if (a.bounces < a.maxBounces) a.y = e.height - a.r, a.vy *= -(.22 + Math.random() * .28), a.vx = a.vx * (.55 + Math.random() * .25) + (Math.random() - .5) * 1.6, a.bounces += 1;
279
673
  else {
280
- w(n, e.width, e.height, t, !0);
674
+ it(a, e.width, e.height, t, !0, e.hailSpec ? {
675
+ min: e.hailSpec.sizeMin,
676
+ max: e.hailSpec.sizeMax
677
+ } : void 0, e.hailSpec?.speedMul ?? 1);
281
678
  continue;
282
679
  }
283
- let a = n.drawSize / 2;
284
- n.rotation += n.rotationSpeed, e.ctx.save(), e.ctx.globalAlpha = n.opacity, e.ctx.translate(n.x, n.y), e.ctx.rotate(n.rotation), e.ctx.drawImage(n.sprite, -a, -a, n.drawSize, n.drawSize), e.ctx.restore();
680
+ let p = a.drawSize / 2;
681
+ a.rotation += a.rotationSpeed, e.ctx.save(), e.ctx.globalAlpha = a.opacity, e.ctx.translate(a.x, a.y), e.ctx.rotate(a.rotation), e.ctx.drawImage(a.sprite, -p, -p, a.drawSize, a.drawSize), e.ctx.restore();
285
682
  }
286
683
  }
287
684
  //#endregion
288
685
  //#region src/components/weatherBackground/scene/draw-sky.ts
289
- function k(e) {
686
+ function lt(e) {
290
687
  e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
291
688
  }
292
- function A(e) {
293
- if (e.state.stars.length !== 0) for (let t of e.state.stars) {
294
- let n = .35 + (Math.sin(e.state.t * t.speed + t.phase) + 1) * .325;
295
- e.ctx.beginPath(), e.ctx.arc(t.x, t.y, t.r, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(226, 235, 255, ${n})`, e.ctx.fill();
689
+ function ut(e) {
690
+ if (e.state.stars.length === 0) return;
691
+ let t = 1;
692
+ if (e.dayCycle) {
693
+ if (e.dayCycle.isDay) return;
694
+ t = .35 + (1 - e.dayCycle.twilight) * .65;
695
+ } else if (!e.activeNight) return;
696
+ for (let n of e.state.stars) {
697
+ let r = .35 + (Math.sin(e.state.t * n.speed + n.phase) + 1) * .325;
698
+ e.ctx.beginPath(), e.ctx.arc(n.x, n.y, n.r, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(226, 235, 255, ${r * t})`, e.ctx.fill();
296
699
  }
297
700
  }
298
- function j(e) {
701
+ function dt(e) {
299
702
  let t = e.celestial;
300
703
  if (!t) return;
301
- let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = t.half * o, c = s * 2;
302
- n.drawImage(t.canvas, r - s, i - s, c, c);
704
+ let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = e.dayCycle ? T(e.dayCycle) : {
705
+ scale: 1,
706
+ alpha: 1
707
+ }, c = t.half * o * s.scale, l = c * 2;
708
+ n.save(), n.globalAlpha = s.alpha, n.drawImage(t.canvas, r - c, i - c, l, l), n.restore();
303
709
  }
304
- function M(e) {
710
+ function ft(e) {
305
711
  if (e.activeNight) {
306
- A(e), j(e);
712
+ ut(e), dt(e);
307
713
  return;
308
714
  }
309
- j(e);
715
+ dt(e);
310
716
  }
311
717
  //#endregion
312
718
  //#region src/components/weatherBackground/configs.ts
313
- var N = {
719
+ var pt = {
314
720
  sunny: {
315
721
  sky: ["#4a9fe0", "#c8e8fb"],
316
722
  sun: "full",
@@ -362,6 +768,29 @@ var N = {
362
768
  snowCount: 0,
363
769
  lightning: !1
364
770
  },
771
+ rain: {
772
+ sky: ["#55637a", "#7e8ba0"],
773
+ sun: "none",
774
+ cloudCount: 8,
775
+ cloudColor: [
776
+ 51,
777
+ 65,
778
+ 85
779
+ ],
780
+ cloudAlpha: .65,
781
+ cloudSpread: .26,
782
+ rain: {
783
+ count: 150,
784
+ speed: 10,
785
+ wind: -1.5,
786
+ alpha: .5,
787
+ splash: !0
788
+ },
789
+ fogBanks: 0,
790
+ haze: .06,
791
+ snowCount: 0,
792
+ lightning: !1
793
+ },
365
794
  lightRain: {
366
795
  sky: ["#6b7a8f", "#9aa7b8"],
367
796
  sun: "none",
@@ -619,9 +1048,7 @@ var N = {
619
1048
  snowCount: 160,
620
1049
  lightning: !1
621
1050
  }
622
- };
623
- N.snow = N.moderateSnow;
624
- var P = {
1051
+ }, mt = {
625
1052
  sunny: {
626
1053
  sky: ["#0b1a33", "#27476e"],
627
1054
  stars: 110
@@ -634,6 +1061,10 @@ var P = {
634
1061
  sky: ["#181f2a", "#333e4e"],
635
1062
  stars: 0
636
1063
  },
1064
+ rain: {
1065
+ sky: ["#11161f", "#242c3a"],
1066
+ stars: 0
1067
+ },
637
1068
  lightRain: {
638
1069
  sky: ["#151b26", "#2b3442"],
639
1070
  stars: 0
@@ -654,6 +1085,10 @@ var P = {
654
1085
  sky: ["#1c222b", "#3a434e"],
655
1086
  stars: 0
656
1087
  },
1088
+ snow: {
1089
+ sky: ["#131a26", "#333f4f"],
1090
+ stars: 8
1091
+ },
657
1092
  lightSnow: {
658
1093
  sky: ["#161e2b", "#3a4656"],
659
1094
  stars: 20
@@ -681,21 +1116,15 @@ var P = {
681
1116
  gale: {
682
1117
  sky: ["#101a26", "#2e3d4d"],
683
1118
  stars: 30
684
- },
685
- snow: {
686
- sky: ["#131a26", "#333f4f"],
687
- stars: 8
688
1119
  }
689
- };
690
- P.snow = P.moderateSnow;
691
- var F = ([e, t, n]) => [
1120
+ }, ht = ([e, t, n]) => [
692
1121
  Math.round(e * .3 + 18),
693
1122
  Math.round(t * .3 + 24),
694
1123
  Math.round(n * .3 + 42)
695
1124
  ];
696
1125
  //#endregion
697
1126
  //#region src/components/weatherBackground/sprites/cloud.ts
698
- function I(e, t, n, r) {
1127
+ function gt(e, t, n, r) {
699
1128
  let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
700
1129
  for (let n of t) {
701
1130
  let t = n.dx * e, r = n.dy * e, i = n.r * e;
@@ -714,12 +1143,12 @@ function I(e, t, n, r) {
714
1143
  oy: f
715
1144
  };
716
1145
  }
717
- function L(e, t, n, r, i) {
1146
+ function _t(e, t, n, r, i) {
718
1147
  let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
719
1148
  dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
720
1149
  dy: (Math.random() - .5) * 14,
721
1150
  r: 22 + Math.random() * 20
722
- })), { sprite: c, ox: l, oy: u } = I(a, s, r, i);
1151
+ })), { sprite: c, ox: l, oy: u } = gt(a, s, r, i);
723
1152
  return {
724
1153
  x: Math.random() * (e + 240) - 120,
725
1154
  y: t * .06 + Math.random() * t * n,
@@ -731,7 +1160,7 @@ function L(e, t, n, r, i) {
731
1160
  oy: u
732
1161
  };
733
1162
  }
734
- function R(e, t = 120) {
1163
+ function vt(e, t = 120) {
735
1164
  let n = t * 2, r = document.createElement("canvas");
736
1165
  r.width = n, r.height = n;
737
1166
  let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
@@ -742,7 +1171,7 @@ function R(e, t = 120) {
742
1171
  }
743
1172
  //#endregion
744
1173
  //#region src/components/weatherBackground/sprites/celestial.ts
745
- function z(e, t) {
1174
+ function yt(e, t) {
746
1175
  let n = e.sun;
747
1176
  if (n === "none") return null;
748
1177
  let r = n === "full" ? 1 : n === "soft" ? .62 : .32, i = t * (n === "full" ? .72 : n === "soft" ? .62 : .5), a = t * (n === "full" ? 7.2 : n === "soft" ? 5.2 : 3.6), o = a;
@@ -770,7 +1199,7 @@ function z(e, t) {
770
1199
  breathAmp: .018
771
1200
  };
772
1201
  }
773
- function B(e, t, n) {
1202
+ function bt(e, t, n) {
774
1203
  if (e.sun === "none") return null;
775
1204
  let r = t * .82, i = e.sun === "dim", a = i ? .45 : 1, o = r * (i ? 4.2 : 6.2), s = Math.ceil(Math.max(o, r * 2.6, r * 1.35) + 2), c = s * 2, l = document.createElement("canvas");
776
1205
  l.width = c, l.height = c;
@@ -824,12 +1253,12 @@ function B(e, t, n) {
824
1253
  }
825
1254
  //#endregion
826
1255
  //#region src/components/weatherBackground/sprites/snow.ts
827
- var V = (e) => {
1256
+ var xt = (e) => {
828
1257
  let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
829
1258
  n.width = t, n.height = t;
830
1259
  let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
831
1260
  return i.addColorStop(0, "rgba(255, 255, 255, 1)"), i.addColorStop(.6, "rgba(255, 255, 255, 0.85)"), i.addColorStop(1, "rgba(255, 255, 255, 0)"), r.fillStyle = i, r.fillRect(0, 0, t, t), n;
832
- }, H = (e) => {
1261
+ }, St = (e) => {
833
1262
  let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
834
1263
  n.width = t, n.height = t;
835
1264
  let r = n.getContext("2d");
@@ -856,22 +1285,22 @@ var V = (e) => {
856
1285
  r.closePath(), r.stroke();
857
1286
  }
858
1287
  return n;
859
- }, U = () => ({
1288
+ }, Ct = () => ({
860
1289
  dots: [
861
1290
  1.2,
862
1291
  1.6,
863
1292
  2,
864
1293
  2.3
865
- ].map((e) => V(e)),
1294
+ ].map((e) => xt(e)),
866
1295
  crystals: [
867
1296
  2.6,
868
1297
  3.2,
869
1298
  3.8,
870
1299
  4.4,
871
1300
  5
872
- ].map((e) => H(e * 2.4))
873
- }), W = (e) => e[Math.floor(Math.random() * e.length)], G = (e, t, n, r) => {
874
- let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = W(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
1301
+ ].map((e) => St(e * 2.4))
1302
+ }), wt = (e) => e[Math.floor(Math.random() * e.length)], Tt = (e, t, n, r) => {
1303
+ let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = wt(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
875
1304
  return {
876
1305
  x: Math.random() * e,
877
1306
  y: r ?? Math.random() * t,
@@ -885,17 +1314,25 @@ var V = (e) => {
885
1314
  sprite: o,
886
1315
  drawSize: s
887
1316
  };
888
- }, K = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
889
- function q(e) {
890
- let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = N[i], s = P[i], c = a ? s.sky : o.sky, l = a ? F(o.cloudColor) : o.cloudColor, u = n * .72, d = r * .26, f = Math.min(n, r) * .09, p = t.createLinearGradient(0, 0, 0, r);
891
- p.addColorStop(0, c[0]), p.addColorStop(1, c[1]);
892
- let m = a ? Array.from({ length: s.stars }, () => ({
893
- x: Math.random() * n,
894
- y: Math.random() * r * .72,
895
- r: .4 + Math.random() * 1.1,
896
- phase: Math.random() * Math.PI * 2,
897
- speed: .015 + Math.random() * .035
898
- })) : [], h = [
1317
+ }, Et = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
1318
+ function Dt(e) {
1319
+ let { ctx: t, width: n, height: r, activeWeather: i, dayCycleTimes: a = null, sceneTimeMs: o, liveClock: s = !1, windMotion: c, rainLevel: l = 5, snowLevel: u = 5, hailLevel: d = 2, fogLevel: f = 2, smogLevel: p = 2 } = e, m = pt[i], h = (() => {
1320
+ let e = m;
1321
+ return ue(i) && e.rain && (e = {
1322
+ ...e,
1323
+ rain: he(e.rain, l)
1324
+ }), de(i) && (e = {
1325
+ ...e,
1326
+ snowCount: ge(u),
1327
+ fogBanks: u >= 7 ? Math.max(e.fogBanks, 3) : e.fogBanks,
1328
+ haze: u >= 7 ? Math.max(e.haze, .12) : e.haze
1329
+ }), A(i) && (e = j(e, f)), Se(i) && (e = Ce(e, p)), e;
1330
+ })(), g = mt[i], _ = a ?? null, b = _ ? v(s ? Date.now() : o, _) : null, x = b ? !b.isDay : !1, S = b ? w(h.sky, g.sky, b) : x ? g.sky : h.sky, C = x ? ht(h.cloudColor) : h.cloudColor, T = Math.min(n, r) * .09, E = n * .72, D = r * .26;
1331
+ if (b) {
1332
+ let e = y(n, r, b.arcProgress);
1333
+ E = e.x, D = e.y;
1334
+ }
1335
+ let O = ee(t, r, S), k = [
899
1336
  {
900
1337
  dx: -.32,
901
1338
  dy: .08,
@@ -916,138 +1353,199 @@ function q(e) {
916
1353
  dy: .24,
917
1354
  r: .07
918
1355
  }
919
- ], g = a ? B(o, f, h) : z(o, f), _ = Array.from({ length: o.cloudCount }, () => L(n, r, o.cloudSpread, l, o.cloudAlpha)), v = o.rain ? Array.from({ length: o.rain.count }, () => ({
1356
+ ], N = yt(h, T), P = bt(h, T, k), F = x ? P : N, I = x || _ != null ? Array.from({ length: g.stars }, () => ({
1357
+ x: Math.random() * n,
1358
+ y: Math.random() * r * .72,
1359
+ r: .4 + Math.random() * 1.1,
1360
+ phase: Math.random() * Math.PI * 2,
1361
+ speed: .015 + Math.random() * .035
1362
+ })) : [], L = Array.from({ length: h.cloudCount }, () => _t(n, r, h.cloudSpread, C, h.cloudAlpha)), R = h.rain ? Array.from({ length: h.rain.count }, () => ({
920
1363
  x: Math.random() * (n + 160) - 80,
921
1364
  y: Math.random() * r,
922
1365
  len: 8 + Math.random() * 10,
923
- speed: o.rain.speed * (.75 + Math.random() * .5)
924
- })) : [], y = [], b = Array.from({ length: o.fogBanks }, (e, t) => ({
1366
+ speed: h.rain.speed * (.75 + Math.random() * .5)
1367
+ })) : [], V = [], te = Array.from({ length: h.fogBanks }, (e, t) => ({
925
1368
  x: Math.random() * n,
926
- y: t / Math.max(o.fogBanks - 1, 1) * r * .9 + r * .05,
1369
+ y: t / Math.max(h.fogBanks - 1, 1) * r * .9 + r * .05,
927
1370
  rw: n * (.25 + Math.random() * .3),
928
1371
  rh: r * (.08 + Math.random() * .08),
929
1372
  speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
930
- alpha: .16 + Math.random() * .14
931
- })), x = o.fogBanks > 0 ? R(K(i, a)) : null, C = o.snowCount > 0 ? U() : null, w = C == null ? [] : Array.from({ length: o.snowCount }, () => G(n, r, C)), E = i === "hail" ? S() : null, D = E == null ? [] : Array.from({ length: 145 }, () => T(n, r, E)), O = i === "gale" ? Array.from({ length: 46 }, () => ({
932
- x: Math.random() * n,
933
- y: Math.random() * r,
934
- length: 45 + Math.random() * 130,
935
- speed: 8 + Math.random() * 10,
936
- wave: Math.random() * Math.PI * 2,
937
- alpha: .12 + Math.random() * .3,
938
- width: .6 + Math.random() * 1.2
939
- })) : [], k = [], A = 120 + Math.random() * 240;
1373
+ alpha: (.1 + Math.random() * .1) * (A(i) ? M(f) : Se(i) ? we(p) : 1)
1374
+ })), H = h.fogBanks > 0 ? vt(Et(i, x)) : null, U = h.snowCount > 0 ? Ct() : null, W = U == null ? [] : Array.from({ length: h.snowCount }, () => Tt(n, r, U)), G = z(i) ? B(d) : null, K = G == null ? null : nt(), q = K != null && G != null ? Array.from({ length: G.count }, () => at(n, r, K, {
1375
+ min: G.sizeMin,
1376
+ max: G.sizeMax
1377
+ }, G.speedMul)) : [], ne = (() => {
1378
+ let { count: e } = Ue(c.visualLevel);
1379
+ return e <= 0 ? [] : Array.from({ length: e }, () => ({
1380
+ x: Math.random() * n,
1381
+ y: Math.random() * r,
1382
+ length: 35 + Math.random() * 120,
1383
+ speed: 6 + Math.random() * 10,
1384
+ wave: Math.random() * Math.PI * 2,
1385
+ alpha: .1 + Math.random() * .28,
1386
+ width: .5 + Math.random() * 1.1,
1387
+ phase: Math.random() * Math.PI * 2
1388
+ }));
1389
+ })(), re = [], ie = 120 + Math.random() * 240;
940
1390
  return {
941
- sky: c,
942
- cloudRgb: l,
943
- cfg: o,
944
- sunX: u,
945
- sunY: d,
946
- sunR: f,
947
- skyGradient: p,
948
- celestial: g,
949
- fogSprite: x,
1391
+ sky: S,
1392
+ cloudRgb: C,
1393
+ cfg: h,
1394
+ sunX: E,
1395
+ sunY: D,
1396
+ sunR: T,
1397
+ skyGradient: O,
1398
+ celestial: F,
1399
+ sunSprite: N,
1400
+ moonSprite: P,
1401
+ fogSprite: H,
1402
+ dayCycleTimes: _,
1403
+ dayCycle: b,
1404
+ sceneTimeMs: o,
1405
+ liveClock: s,
1406
+ hailSpec: G,
950
1407
  state: {
951
- stars: m,
952
- moonCraters: h,
953
- clouds: _,
954
- drops: v,
955
- splashes: y,
956
- fogBanks: b,
957
- flakes: w,
958
- hailstones: D,
959
- hailPool: E ?? [],
960
- windStreaks: O,
1408
+ stars: I,
1409
+ moonCraters: k,
1410
+ clouds: L,
1411
+ drops: R,
1412
+ splashes: V,
1413
+ fogBanks: te,
1414
+ flakes: W,
1415
+ hailstones: q,
1416
+ hailPool: K ?? [],
1417
+ windStreaks: ne,
961
1418
  t: 0,
962
1419
  flashAlpha: 0,
963
1420
  boltLife: 0,
964
- boltPoints: k,
965
- nextStrike: A
1421
+ boltPoints: re,
1422
+ nextStrike: ie
966
1423
  }
967
1424
  };
968
1425
  }
1426
+ function Ot(e, t) {
1427
+ if (!e.dayCycleTimes) return;
1428
+ let n = v(e.liveClock ? t ?? Date.now() : e.sceneTimeMs, e.dayCycleTimes), r = mt[e.activeWeather], i = w(e.cfg.sky, r.sky, n), a = y(e.width, e.height, n.arcProgress);
1429
+ e.dayCycle = n, e.activeNight = !n.isDay, e.sky = i, e.skyGradient = ee(e.ctx, e.height, i), e.sunX = a.x, e.sunY = a.y, e.celestial = n.isDay ? e.sunSprite : e.moonSprite;
1430
+ }
969
1431
  //#endregion
970
1432
  //#region src/components/weatherBackground/scene/create-weather-scene.ts
971
- function J(e, t) {
972
- t && (e.state.t += 1), k(e), M(e), m(e), h(e), g(e), E(e), D(e), O(e), v(e), y(e);
1433
+ function kt(e, t) {
1434
+ t && (e.state.t += 1), e.windField = Q(e.state.t, e.windMotion), e.dayCycleTimes && Ot(e, e.liveClock ? Date.now() : e.sceneTimeMs), lt(e), ft(e), Je(e), Ye(e), Xe(e), ot(e), st(e), ct(e), Qe(e), $e(e);
973
1435
  }
974
- function Y(e) {
975
- let { ctx: t, width: n, height: i, activeWeather: a, activeNight: o } = e, s = {
1436
+ function At(e) {
1437
+ let { ctx: t, width: n, height: r, activeWeather: a, activeNight: o, windMotion: s } = e, c = Dt(e), l = {
976
1438
  ctx: t,
977
1439
  width: n,
978
- height: i,
1440
+ height: r,
979
1441
  activeWeather: a,
980
- activeNight: o,
981
- ...q(e)
1442
+ activeNight: c.dayCycle ? !c.dayCycle.isDay : o,
1443
+ windMotion: s,
1444
+ windField: Q(0, s),
1445
+ ...c
982
1446
  };
983
- if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return J(s, !1), () => void 0;
984
- let c = 0, l = document.hidden, u = r((e) => {
985
- l = e;
986
- }), d = () => {
987
- c = requestAnimationFrame(d), !l && J(s, !0);
1447
+ if (l.dayCycleTimes && Ot(l, l.liveClock ? Date.now() : l.sceneTimeMs), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return kt(l, !1), () => void 0;
1448
+ let u = 0, d = document.hidden, f = i((e) => {
1449
+ d = e;
1450
+ }), p = () => {
1451
+ u = requestAnimationFrame(p), !d && kt(l, !0);
988
1452
  };
989
- return d(), () => {
990
- cancelAnimationFrame(c), u();
1453
+ return p(), () => {
1454
+ cancelAnimationFrame(u), f();
991
1455
  };
992
1456
  }
993
- var X = {
1457
+ var $ = {
994
1458
  weatherBackground: "cos-weatherBackground-Mnm22",
995
1459
  canvas: "cos-canvas-nvqMt",
996
1460
  loadingOverlay: "cos-loadingOverlay-O58B7",
997
1461
  loadingSpinner: "cos-loadingSpinner-NQ9yG",
998
1462
  "weather-loading-spin": "cos-weather-loading-spin-IPFWZ"
999
- }, Z = ({ width: n = 800, height: r = 450, weather: o = "sunny", night: s = !1, live: c = !1, latitude: l, longitude: u, onLiveWeather: d, loading: f = !1 }) => {
1000
- let m = t(null), h = p(c, l != null && u != null ? {
1001
- latitude: l,
1002
- longitude: u
1003
- } : void 0), g = c && h.weather ? h.weather : o, _ = c && h.current ? !h.current.isDay : s, v = f || c && (h.status === "locating" || h.status === "fetching"), y = t(d);
1463
+ }, jt = ({ width: r, height: i, fill: c = !1, weather: l = "partlyCloudy", time: u = "14:00", live: d = !1, latitude: f, longitude: p, windLevel: m = 3, rainLevel: g = 5, snowLevel: y = 5, hailLevel: b = 2, fogLevel: x = 2, smogLevel: S = 2, onLiveWeather: C, loading: w = !1, ariaLabel: ee, loadingText: T = "天气加载中…" }) => {
1464
+ let { hostRef: E, width: D, height: O, hostStyle: k } = a({
1465
+ fill: c,
1466
+ width: r,
1467
+ height: i,
1468
+ defaultWidth: 800,
1469
+ defaultHeight: 450
1470
+ }), A = n(null), j = Pe(d, f != null && p != null ? {
1471
+ latitude: f,
1472
+ longitude: p
1473
+ } : void 0), M = J(d && j.weather ? j.weather : l), N = d && j.rainLevel != null ? j.rainLevel : g, P = d && j.snowLevel != null ? j.snowLevel : y, F = d && j.fogLevel != null ? j.fogLevel : x, I = d && j.hailLevel != null ? j.hailLevel : b, L = d && j.smogLevel != null ? j.smogLevel : S, R = me(M, N, P), z = _(u), B = j.current?.sunrise ?? null, V = j.current?.sunset ?? null, te = j.current?.windSpeed ?? null, H = t(() => d && B != null && V != null ? {
1474
+ sunrise: B,
1475
+ sunset: V
1476
+ } : h(z), [
1477
+ d,
1478
+ B,
1479
+ V,
1480
+ z
1481
+ ]), U = qe({
1482
+ live: d,
1483
+ windLevel: m,
1484
+ liveWindKmh: te
1485
+ }), W = t(() => Ke(U), [U]), G = d && j.current ? !j.current.isDay : !v(z, H).isDay, K = w || d && (j.status === "locating" || j.status === "fetching"), q = n(C);
1004
1486
  return e(() => {
1005
- y.current = d;
1487
+ q.current = C;
1006
1488
  }), e(() => {
1007
- h.weather && y.current?.(h.weather);
1008
- }, [h.weather]), e(() => {
1009
- let e = m.current;
1489
+ j.weather && q.current?.(J(j.weather));
1490
+ }, [j.weather]), e(() => {
1491
+ let e = A.current;
1010
1492
  if (!e) return;
1011
1493
  let t = window.devicePixelRatio || 1;
1012
- e.width = n * t, e.height = r * t;
1013
- let i = e.getContext("2d");
1014
- if (i) return i.setTransform(t, 0, 0, t, 0, 0), Y({
1015
- ctx: i,
1016
- width: n,
1017
- height: r,
1018
- activeWeather: g,
1019
- activeNight: _
1494
+ e.width = D * t, e.height = O * t;
1495
+ let n = e.getContext("2d");
1496
+ if (n) return n.setTransform(t, 0, 0, t, 0, 0), At({
1497
+ ctx: n,
1498
+ width: D,
1499
+ height: O,
1500
+ activeWeather: R,
1501
+ activeNight: G,
1502
+ dayCycleTimes: H,
1503
+ sceneTimeMs: z,
1504
+ liveClock: d,
1505
+ windMotion: W,
1506
+ rainLevel: N,
1507
+ snowLevel: P,
1508
+ fogLevel: F,
1509
+ hailLevel: I,
1510
+ smogLevel: L
1020
1511
  });
1021
1512
  }, [
1022
- _,
1023
- g,
1024
- r,
1025
- n
1026
- ]), /* @__PURE__ */ a("div", {
1027
- className: X.weatherBackground,
1028
- style: {
1029
- width: n,
1030
- height: r
1031
- },
1032
- children: [/* @__PURE__ */ i("canvas", {
1033
- ref: m,
1034
- className: X.canvas,
1513
+ G,
1514
+ R,
1515
+ H,
1516
+ N,
1517
+ P,
1518
+ F,
1519
+ I,
1520
+ L,
1521
+ O,
1522
+ d,
1523
+ z,
1524
+ D,
1525
+ W
1526
+ ]), /* @__PURE__ */ s("div", {
1527
+ ref: E,
1528
+ className: $.weatherBackground,
1529
+ style: k,
1530
+ children: [/* @__PURE__ */ o("canvas", {
1531
+ ref: A,
1532
+ className: $.canvas,
1035
1533
  style: {
1036
- width: n,
1037
- height: r
1534
+ width: D,
1535
+ height: O
1038
1536
  },
1039
1537
  role: "img",
1040
- "aria-label": `天气背景:${g}${_ ? "(夜间)" : ""}`
1041
- }), v && /* @__PURE__ */ a("div", {
1042
- className: X.loadingOverlay,
1538
+ "aria-label": ee ?? `天气背景:${M}${G ? "(夜间)" : ""},${W.level}级风`
1539
+ }), K && /* @__PURE__ */ s("div", {
1540
+ className: $.loadingOverlay,
1043
1541
  role: "status",
1044
1542
  "aria-live": "polite",
1045
- children: [/* @__PURE__ */ i("div", {
1046
- className: X.loadingSpinner,
1543
+ children: [/* @__PURE__ */ o("div", {
1544
+ className: $.loadingSpinner,
1047
1545
  "aria-hidden": !0
1048
- }), /* @__PURE__ */ i("span", { children: "天气加载中…" })]
1546
+ }), /* @__PURE__ */ o("span", { children: T })]
1049
1547
  })]
1050
1548
  });
1051
1549
  };
1052
1550
  //#endregion
1053
- export { Z as WeatherBackground, Z as default, c as mapWmoCodeToWeatherType, p as useLiveWeather };
1551
+ export { E as DEFAULT_FOG_LEVEL, F as DEFAULT_HAIL_LEVEL, U as DEFAULT_RAIN_LEVEL, ye as DEFAULT_SMOG_LEVEL, W as DEFAULT_SNOW_LEVEL, Le as DEFAULT_WIND_LEVEL, D as FOG_LEVEL_LABELS, I as HAIL_LEVEL_LABELS, H as MAX_PRECIP_LEVEL, te as MIN_PRECIP_LEVEL, oe as RAIN_LEVEL_LABELS, be as SMOG_LEVEL_LABELS, se as SNOW_LEVEL_LABELS, jt as WeatherBackground, jt as default, Ke as buildWindMotion, O as clampFogLevel, L as clampHailLevel, G as clampPrecipLevel, X as clampSmogLevel, M as fogBankAlphaScale, P as fogLevelFromVisibility, N as fogLevelFromWmo, k as formatFogLevel, R as formatHailLevel, Ne as formatLocalHm, ae as formatPrecipLevel, xe as formatSmogLevel, V as hailLevelFromWmo, B as hailSpec, j as intensifyFogConfig, he as intensifyRainConfig, Ce as intensifySmogConfig, ge as intensifySnowCount, ce as isRainWeather, le as isSnowWeather, Ge as kmhToWindLevel, De as mapWmoCodeToWeatherType, J as normalizeWeatherType, q as precipBand, ie as precipLabel, fe as rainLevelFromWeather, _e as rainLevelFromWmo, me as resolveSceneWeather, Q as sampleWindField, we as smogBankAlphaScale, Te as smogLevelFromVisibility, pe as snowLevelFromWeather, ve as snowLevelFromWmo, A as supportsFogLevel, z as supportsHailLevel, ue as supportsRainLevel, Se as supportsSmogLevel, de as supportsSnowLevel, Pe as useLiveWeather, Ie as useSunTimes, ze as visualWindLevel, We as windLevelToKmh, Ue as windStreakSpec };