cos-design 2.4.0 → 3.0.0

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +26 -20
  3. package/dist/components/_shared/visibility.d.ts +3 -0
  4. package/dist/components/audioVisualizer/index.d.ts +9 -0
  5. package/dist/components/aurora/index.d.ts +9 -0
  6. package/dist/components/barcodeScan/index.d.ts +11 -0
  7. package/dist/components/burnAway/index.d.ts +11 -0
  8. package/dist/components/clickSpark/index.d.ts +10 -0
  9. package/dist/components/cursorTrail/index.d.ts +11 -0
  10. package/dist/components/cyberGrid/index.d.ts +11 -0
  11. package/dist/components/diceRoll/index.d.ts +9 -0
  12. package/dist/components/dnaHelix/index.d.ts +9 -0
  13. package/dist/components/electricArc/index.d.ts +8 -0
  14. package/dist/components/gradientFlow/index.d.ts +11 -0
  15. package/dist/components/gravityBalls/index.d.ts +8 -0
  16. package/dist/components/holographicCard/index.d.ts +8 -0
  17. package/dist/components/index.d.ts +68 -0
  18. package/dist/components/liquidGlass/index.d.ts +10 -0
  19. package/dist/components/liquidProgress/index.d.ts +9 -0
  20. package/dist/components/magneticButton/index.d.ts +10 -0
  21. package/dist/components/matrixRain/index.d.ts +6 -0
  22. package/dist/components/mazeGenerator/index.d.ts +9 -0
  23. package/dist/components/newtonCradle/index.d.ts +7 -0
  24. package/dist/components/orbitalChart/index.d.ts +12 -0
  25. package/dist/components/particleNetwork/index.d.ts +2 -0
  26. package/dist/components/progressChest/index.d.ts +11 -0
  27. package/dist/components/radarScan/index.d.ts +9 -0
  28. package/dist/components/redPacketRain/index.d.ts +9 -0
  29. package/dist/components/returnCity/index.d.ts +2 -2
  30. package/dist/components/rippleWater/index.d.ts +9 -0
  31. package/dist/components/scrambleText/index.d.ts +11 -0
  32. package/dist/components/scratchCard/index.d.ts +13 -0
  33. package/dist/components/slotMachine/index.d.ts +9 -0
  34. package/dist/components/smokeFog/index.d.ts +9 -0
  35. package/dist/components/snowfall/index.d.ts +11 -0
  36. package/dist/components/speedometer/index.d.ts +9 -0
  37. package/dist/components/splitReveal/index.d.ts +11 -0
  38. package/dist/components/spotlight/index.d.ts +10 -0
  39. package/dist/components/starfield/index.d.ts +11 -0
  40. package/dist/components/timelinePulse/index.d.ts +8 -0
  41. package/dist/components/waveButton/index.d.ts +1 -3
  42. package/dist/components/waveText/index.d.ts +13 -0
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.css +1 -1
  45. package/dist/index.js +2362 -339
  46. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,57 +1,272 @@
1
- import { forwardRef as e, useCallback as t, useEffect as n, useImperativeHandle as r, useMemo as i, useRef as a, useState as o } from "react";
2
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
3
- import './index.css';var u = {
1
+ import { forwardRef as e, useCallback as t, useEffect as n, useId as r, useImperativeHandle as i, useMemo as a, useRef as o, useState as s } from "react";
2
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import './index.css';var d = {
4
+ barcodeScan: "cos-barcodeScan-aH9Ad",
5
+ content: "cos-content-F73ZD",
6
+ "glitch-skew": "cos-glitch-skew-inh6a",
7
+ placeholder: "cos-placeholder-yYVB8",
8
+ overlay: "cos-overlay-4AiY5",
9
+ scanLine: "cos-scanLine-VBsRv",
10
+ scan: "cos-scan-JD4wO",
11
+ glitchLayer: "cos-glitchLayer-nzkIa",
12
+ flicker: "cos-flicker-P0jQE",
13
+ corners: "cos-corners-1bjak"
14
+ }, f = ({ children: e, scanColor: t = "#22c55e", speed: n = 2.5 }) => /* @__PURE__ */ u("div", {
15
+ className: d.barcodeScan,
16
+ style: {
17
+ "--scan-color": t,
18
+ "--scan-speed": `${n}s`
19
+ },
20
+ children: [
21
+ /* @__PURE__ */ l("div", {
22
+ className: d.content,
23
+ children: e ?? /* @__PURE__ */ l("span", {
24
+ className: d.placeholder,
25
+ children: "SCAN ME"
26
+ })
27
+ }),
28
+ /* @__PURE__ */ u("div", {
29
+ className: d.overlay,
30
+ children: [/* @__PURE__ */ l("div", { className: d.scanLine }), /* @__PURE__ */ l("div", { className: d.glitchLayer })]
31
+ }),
32
+ /* @__PURE__ */ u("div", {
33
+ className: d.corners,
34
+ children: [
35
+ /* @__PURE__ */ l("span", {}),
36
+ /* @__PURE__ */ l("span", {}),
37
+ /* @__PURE__ */ l("span", {}),
38
+ /* @__PURE__ */ l("span", {})
39
+ ]
40
+ })
41
+ ]
42
+ }), p = {
43
+ burnAway: "cos-burnAway-QWIjy",
44
+ stage: "cos-stage-8VIfE",
45
+ text: "cos-text-0guk-",
46
+ canvas: "cos-canvas-Bwc-u",
47
+ trigger: "cos-trigger-UDZqV",
48
+ hint: "cos-hint-XQUfv"
49
+ }, m = ({ text: e = "BURN", fontSize: r = 64, onComplete: i }) => {
50
+ let a = o(null), c = o(null), [d, f] = s(!1), [m, h] = s(!1), g = o(!1), _ = t(() => {
51
+ d || m || f(!0);
52
+ }, [d, m]);
53
+ return n(() => {
54
+ if (!d || m) return;
55
+ let t = a.current, n = c.current;
56
+ if (!t || !n) return;
57
+ let o = t.getBoundingClientRect(), s = window.devicePixelRatio || 1, l = Math.ceil(o.width), u = Math.ceil(o.height);
58
+ n.width = l * s, n.height = u * s, n.style.width = `${l}px`, n.style.height = `${u}px`;
59
+ let f = n.getContext("2d");
60
+ if (!f) return;
61
+ f.scale(s, s);
62
+ let p = document.createElement("canvas");
63
+ p.width = l * s, p.height = u * s;
64
+ let _ = p.getContext("2d");
65
+ if (!_) return;
66
+ _.scale(s, s), _.font = `900 ${r}px system-ui, sans-serif`, _.textAlign = "center", _.textBaseline = "middle", _.fillStyle = "#f8fafc", _.fillText(e, l / 2, u / 2);
67
+ let v = _.getImageData(0, 0, l * s, u * s).data, y = [];
68
+ for (let e = 0; e < u; e += 4) for (let t = 0; t < l; t += 4) v[(Math.floor(e * s) * l * s + Math.floor(t * s)) * 4 + 3] > 128 && y.push({
69
+ x: t,
70
+ y: e,
71
+ vx: (Math.random() - .5) * 2,
72
+ vy: -Math.random() * 3 - 1,
73
+ life: 1,
74
+ maxLife: .6 + Math.random() * .6,
75
+ size: 2 + Math.random() * 3
76
+ });
77
+ let b = 0, x = 0, S = (e, t) => {
78
+ let n = Math.min((e - t) / 16, 2);
79
+ x += n * 16, f.clearRect(0, 0, l, u);
80
+ let r = 0;
81
+ for (let e of y) {
82
+ if (e.life -= n * .012 / e.maxLife, e.life <= 0) continue;
83
+ r++, e.x += e.vx * n, e.y += e.vy * n, e.vy += .04 * n;
84
+ let t = e.life, i = 1 - e.life, a = Math.max(0, 200 - i * 200), o = Math.max(0, 80 - i * 80);
85
+ f.globalAlpha = t, f.fillStyle = `rgb(255,${a},${o})`, f.beginPath(), f.arc(e.x, e.y, e.size * t, 0, Math.PI * 2), f.fill();
86
+ }
87
+ f.globalAlpha = 1, x < 2500 && r > 0 ? b = requestAnimationFrame((t) => S(t, e)) : (h(!0), g.current || (g.current = !0, i?.()));
88
+ };
89
+ return b = requestAnimationFrame((e) => S(e, e)), () => cancelAnimationFrame(b);
90
+ }, [
91
+ d,
92
+ m,
93
+ e,
94
+ r,
95
+ i
96
+ ]), /* @__PURE__ */ u("div", {
97
+ className: p.burnAway,
98
+ children: [
99
+ /* @__PURE__ */ u("div", {
100
+ ref: a,
101
+ className: p.stage,
102
+ children: [!m && /* @__PURE__ */ l("span", {
103
+ className: p.text,
104
+ style: {
105
+ fontSize: r,
106
+ opacity: +!d
107
+ },
108
+ children: e
109
+ }), /* @__PURE__ */ l("canvas", {
110
+ ref: c,
111
+ className: p.canvas
112
+ })]
113
+ }),
114
+ !d && !m && /* @__PURE__ */ l("button", {
115
+ type: "button",
116
+ className: p.trigger,
117
+ onClick: _,
118
+ children: "Ignite"
119
+ }),
120
+ m && /* @__PURE__ */ l("p", {
121
+ className: p.hint,
122
+ children: "Gone."
123
+ })
124
+ ]
125
+ });
126
+ }, h = {
127
+ aurora: "cos-aurora-dJJb8",
128
+ band: "cos-band-S5CoR",
129
+ "aurora-flow": "cos-aurora-flow-wU8TY"
130
+ }, g = [
131
+ "#00ff87",
132
+ "#60efff",
133
+ "#7b2ff7",
134
+ "#f107a3"
135
+ ], _ = ({ width: e = 800, height: t = 500, colors: n = g }) => {
136
+ let r = n.length >= 2 ? n : g;
137
+ return /* @__PURE__ */ l("div", {
138
+ className: h.aurora,
139
+ style: {
140
+ width: e,
141
+ height: t
142
+ },
143
+ children: r.map((e, t) => /* @__PURE__ */ l("div", {
144
+ className: h.band,
145
+ style: {
146
+ "--aurora-color": e,
147
+ "--aurora-delay": `${t * -3}s`,
148
+ "--aurora-duration": `${12 + t * 2}s`
149
+ }
150
+ }, e + t))
151
+ });
152
+ }, v = (e) => {
153
+ let t = () => e(document.hidden);
154
+ return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
155
+ }, y = (e, t, n) => Math.min(n, Math.max(t, e)), b = {
156
+ audioVisualizer: "cos-audioVisualizer-r5dHp",
157
+ canvas: "cos-canvas-UNEea"
158
+ }, x = ({ width: e = 400, height: t = 120, barCount: r = 32, useMic: i = !1 }) => {
159
+ let a = o(null);
160
+ return n(() => {
161
+ let n = a.current;
162
+ if (!n) return;
163
+ let o = window.devicePixelRatio || 1;
164
+ n.width = e * o, n.height = t * o;
165
+ let s = n.getContext("2d");
166
+ if (!s) return;
167
+ s.setTransform(o, 0, 0, o, 0, 0);
168
+ let c = 0, l = document.hidden, u = null, d = null, f = null, p = null, m = 0, h = !1, g = v((e) => {
169
+ l = e;
170
+ });
171
+ (async () => {
172
+ if (!(!i || !navigator.mediaDevices?.getUserMedia)) try {
173
+ if (p = await navigator.mediaDevices.getUserMedia({ audio: !0 }), h) return;
174
+ u = new AudioContext(), d = u.createAnalyser(), d.fftSize = 256, u.createMediaStreamSource(p).connect(d), f = new Uint8Array(d.frequencyBinCount);
175
+ } catch {}
176
+ })();
177
+ let _ = () => {
178
+ if (c = requestAnimationFrame(_), l) return;
179
+ let n = Array(r).fill(0);
180
+ if (d && f) {
181
+ d.getByteFrequencyData(f);
182
+ let e = Math.floor(f.length / r);
183
+ for (let t = 0; t < r; t++) n[t] = f[t * e] / 255;
184
+ } else {
185
+ m += .08;
186
+ for (let e = 0; e < r; e++) n[e] = (Math.sin(m + e * .35) + 1) * .35 + Math.random() * .15;
187
+ }
188
+ s.fillStyle = "#0f172a", s.fillRect(0, 0, e, t);
189
+ let i = (e - 3 * (r - 1)) / r;
190
+ for (let e = 0; e < r; e++) {
191
+ let r = Math.max(4, n[e] * t * .9), a = e * (i + 3), o = t - r, c = s.createLinearGradient(0, o, 0, t);
192
+ c.addColorStop(0, "#a78bfa"), c.addColorStop(1, "#38bdf8"), s.fillStyle = c, s.beginPath(), s.roundRect(a, o, i, r, 2), s.fill();
193
+ }
194
+ };
195
+ return _(), () => {
196
+ h = !0, cancelAnimationFrame(c), g(), p?.getTracks().forEach((e) => e.stop()), u?.close();
197
+ };
198
+ }, [
199
+ r,
200
+ t,
201
+ i,
202
+ e
203
+ ]), /* @__PURE__ */ l("div", {
204
+ className: b.audioVisualizer,
205
+ style: {
206
+ width: e,
207
+ height: t
208
+ },
209
+ children: /* @__PURE__ */ l("canvas", {
210
+ ref: a,
211
+ className: b.canvas,
212
+ style: {
213
+ width: e,
214
+ height: t
215
+ }
216
+ })
217
+ });
218
+ }, S = {
4
219
  canvasClock: "cos-canvasClock-QvdV3",
5
220
  canvasTarget: "cos-canvasTarget-x-odC"
6
- }, d = ({ width: e = 400, height: r = 400 }) => {
7
- let i = a(null), o = Math.min(e, r), s = o / 2 - 16, l = o / 2, d = t((e) => {
8
- e.clearRect(0, 0, o, o), e.save(), e.translate(l, l), e.beginPath(), e.arc(0, 0, s, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = "#d1d5db", e.lineWidth = 2, e.stroke();
221
+ }, ee = ({ width: e = 400, height: r = 400 }) => {
222
+ let i = o(null), a = Math.min(e, r), s = a / 2 - 16, c = a / 2, u = t((e) => {
223
+ e.clearRect(0, 0, a, a), e.save(), e.translate(c, c), e.beginPath(), e.arc(0, 0, s, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = "#d1d5db", e.lineWidth = 2, e.stroke();
9
224
  for (let t = 0; t < 60; t++) {
10
225
  let n = t / 60 * Math.PI * 2, r = s - (t % 5 == 0 ? 14 : 8);
11
226
  e.beginPath(), e.moveTo(Math.cos(n) * r, Math.sin(n) * r), e.lineTo(Math.cos(n) * s, Math.sin(n) * s), e.strokeStyle = t % 5 == 0 ? "#374151" : "#9ca3af", e.lineWidth = t % 5 == 0 ? 2 : 1, e.stroke();
12
227
  }
13
- e.fillStyle = "#111827", e.font = `bold ${Math.floor(o / 22)}px system-ui, sans-serif`, e.textAlign = "center", e.textBaseline = "middle";
228
+ e.fillStyle = "#111827", e.font = `bold ${Math.floor(a / 22)}px system-ui, sans-serif`, e.textAlign = "center", e.textBaseline = "middle";
14
229
  for (let t = 1; t <= 12; t++) {
15
230
  let n = t / 12 * Math.PI * 2 - Math.PI / 2, r = s - 32;
16
231
  e.fillText(String(t), Math.cos(n) * r, Math.sin(n) * r);
17
232
  }
18
- let t = /* @__PURE__ */ new Date(), n = t.getHours() % 12, r = t.getMinutes(), i = t.getSeconds(), a = t.getMilliseconds(), c = (t, n, r, i, a) => {
233
+ let t = /* @__PURE__ */ new Date(), n = t.getHours() % 12, r = t.getMinutes(), i = t.getSeconds(), o = t.getMilliseconds(), l = (t, n, r, i, a) => {
19
234
  e.save(), e.rotate(t), e.beginPath(), e.moveTo(0, r), e.lineTo(n, 0), e.lineTo(0, -r), e.closePath(), e.fillStyle = i, e.shadowColor = a, e.shadowBlur = 4, e.fill(), e.restore();
20
- }, u = (n + r / 60) / 12 * Math.PI * 2 - Math.PI / 2, d = (r + i / 60) / 60 * Math.PI * 2 - Math.PI / 2, f = (i + a / 1e3) / 60 * Math.PI * 2 - Math.PI / 2;
21
- c(u, s * .5, 4, "#111827", "rgb(0 0 0 / 40%)"), c(d, s * .72, 3, "#1e80ff", "rgb(30 128 255 / 40%)"), c(f, s * .85, 2, "#e9686b", "rgb(233 104 107 / 40%)"), e.beginPath(), e.arc(0, 0, 5, 0, Math.PI * 2), e.fillStyle = "#111827", e.fill(), e.restore();
235
+ }, u = (n + r / 60) / 12 * Math.PI * 2 - Math.PI / 2, d = (r + i / 60) / 60 * Math.PI * 2 - Math.PI / 2, f = (i + o / 1e3) / 60 * Math.PI * 2 - Math.PI / 2;
236
+ l(u, s * .5, 4, "#111827", "rgb(0 0 0 / 40%)"), l(d, s * .72, 3, "#1e80ff", "rgb(30 128 255 / 40%)"), l(f, s * .85, 2, "#e9686b", "rgb(233 104 107 / 40%)"), e.beginPath(), e.arc(0, 0, 5, 0, Math.PI * 2), e.fillStyle = "#111827", e.fill(), e.restore();
22
237
  }, [
23
- l,
238
+ c,
24
239
  s,
25
- o
240
+ a
26
241
  ]);
27
242
  return n(() => {
28
243
  let e = i.current;
29
244
  if (!e) return;
30
245
  let t = window.devicePixelRatio || 1;
31
- e.width = o * t, e.height = o * t;
246
+ e.width = a * t, e.height = a * t;
32
247
  let n = e.getContext("2d");
33
248
  if (!n) return;
34
249
  n.setTransform(t, 0, 0, t, 0, 0);
35
- let r = 0, a = () => {
36
- d(n), r = requestAnimationFrame(a);
250
+ let r = 0, o = () => {
251
+ u(n), r = requestAnimationFrame(o);
37
252
  };
38
- return a(), () => cancelAnimationFrame(r);
39
- }, [d, o]), /* @__PURE__ */ c("div", {
40
- className: u.canvasClock,
253
+ return o(), () => cancelAnimationFrame(r);
254
+ }, [u, a]), /* @__PURE__ */ l("div", {
255
+ className: S.canvasClock,
41
256
  style: {
42
- width: o,
43
- height: o
257
+ width: a,
258
+ height: a
44
259
  },
45
- children: /* @__PURE__ */ c("canvas", {
260
+ children: /* @__PURE__ */ l("canvas", {
46
261
  ref: i,
47
- className: u.canvasTarget,
262
+ className: S.canvasTarget,
48
263
  style: {
49
- width: o,
50
- height: o
264
+ width: a,
265
+ height: a
51
266
  }
52
267
  })
53
268
  });
54
- }, f = {
269
+ }, C = {
55
270
  chargeContainer: "cos-chargeContainer-4t9qo",
56
271
  contrast: "cos-contrast-PNep9",
57
272
  hueRotate: "cos-hueRotate-bMJ-k",
@@ -60,58 +275,134 @@ import './index.css';var u = {
60
275
  circle: "cos-circle-m4vwX",
61
276
  circleRotate: "cos-circleRotate-bgFw5",
62
277
  button: "cos-button-myCst"
63
- }, p = (e) => {
64
- let { initQuantity: t = 0, value: r, onChange: i, autoCharge: s = !0, interval: u = 500, step: d = .01 } = e, p = r !== void 0, [m, h] = o(t), g = p ? r : m, _ = a(g);
278
+ }, te = (e) => {
279
+ let { initQuantity: t = 0, value: r, onChange: i, autoCharge: a = !0, interval: c = 500, step: d = .01 } = e, f = o(null), p = r !== void 0, [m, h] = s(() => y(t, 0, 100)), g = y(p ? r : m, 0, 100), _ = o(g), v = o(i);
65
280
  n(() => {
281
+ v.current = i;
282
+ }, [i]), n(() => {
66
283
  _.current = g;
67
284
  }, [g]), n(() => {
68
- if (!s) return;
285
+ let e = f.current;
286
+ if (!e) return;
287
+ let t = () => {
288
+ e.style.setProperty("--charge-h", `${e.clientHeight}px`);
289
+ };
290
+ t();
291
+ let n = new ResizeObserver(t);
292
+ return n.observe(e), () => n.disconnect();
293
+ }, []), n(() => {
294
+ if (!a) return;
69
295
  let e = window.setInterval(() => {
70
- let e = Number((_.current + d).toFixed(2));
71
- p ? i?.(e) : h(e);
72
- }, u);
296
+ if (_.current >= 100) return;
297
+ let e = Math.min(100, Number((_.current + d).toFixed(2)));
298
+ p ? v.current?.(e) : h(e);
299
+ }, c);
73
300
  return () => clearInterval(e);
74
301
  }, [
75
- s,
76
- u,
302
+ a,
303
+ c,
77
304
  p,
78
- i,
79
305
  d
80
306
  ]);
81
- let v = g ? g.toString().padEnd(4, "0") : "0";
82
- return /* @__PURE__ */ c("div", {
83
- className: f.chargeContainer,
84
- children: /* @__PURE__ */ l("div", {
85
- className: f.contrast,
307
+ let b = g.toFixed(2);
308
+ return /* @__PURE__ */ l("div", {
309
+ ref: f,
310
+ className: C.chargeContainer,
311
+ children: /* @__PURE__ */ u("div", {
312
+ className: C.contrast,
86
313
  children: [
87
- /* @__PURE__ */ l("div", {
88
- className: f.text,
89
- children: [v, "%"]
314
+ /* @__PURE__ */ u("div", {
315
+ className: C.text,
316
+ children: [b, "%"]
90
317
  }),
91
- /* @__PURE__ */ c("span", {}),
92
- /* @__PURE__ */ c("span", {}),
93
- /* @__PURE__ */ c("span", {}),
94
- /* @__PURE__ */ c("span", {}),
95
- /* @__PURE__ */ c("span", {}),
96
- /* @__PURE__ */ c("span", {}),
97
- /* @__PURE__ */ c("span", {}),
98
- /* @__PURE__ */ c("span", {}),
99
- /* @__PURE__ */ c("span", {}),
100
- /* @__PURE__ */ c("span", {}),
101
- /* @__PURE__ */ c("span", {}),
102
- /* @__PURE__ */ c("span", {}),
103
- /* @__PURE__ */ c("span", {}),
104
- /* @__PURE__ */ c("span", {}),
105
- /* @__PURE__ */ c("div", { className: f.circle }),
106
- /* @__PURE__ */ c("div", { className: f.button })
318
+ /* @__PURE__ */ l("span", {}),
319
+ /* @__PURE__ */ l("span", {}),
320
+ /* @__PURE__ */ l("span", {}),
321
+ /* @__PURE__ */ l("span", {}),
322
+ /* @__PURE__ */ l("span", {}),
323
+ /* @__PURE__ */ l("span", {}),
324
+ /* @__PURE__ */ l("span", {}),
325
+ /* @__PURE__ */ l("span", {}),
326
+ /* @__PURE__ */ l("span", {}),
327
+ /* @__PURE__ */ l("span", {}),
328
+ /* @__PURE__ */ l("span", {}),
329
+ /* @__PURE__ */ l("span", {}),
330
+ /* @__PURE__ */ l("span", {}),
331
+ /* @__PURE__ */ l("span", {}),
332
+ /* @__PURE__ */ l("span", {}),
333
+ /* @__PURE__ */ l("div", { className: C.circle }),
334
+ /* @__PURE__ */ l("div", { className: C.button })
107
335
  ]
108
336
  })
109
337
  });
110
- }, m = {
338
+ }, w = {
339
+ clickSpark: "cos-clickSpark-db9Om",
340
+ canvas: "cos-canvas-p9fnQ",
341
+ content: "cos-content-7uE4T",
342
+ hint: "cos-hint-UqpWX"
343
+ }, ne = ({ children: e, color: r = "#fbbf24", count: i = 16 }) => {
344
+ let a = o(null), s = o(null), c = o([]), d = o(0), f = t((e, t) => {
345
+ for (let n = 0; n < i; n++) {
346
+ let r = Math.PI * 2 * n / i + Math.random() * .3, a = Math.random() * 4 + 2;
347
+ c.current.push({
348
+ x: e,
349
+ y: t,
350
+ vx: Math.cos(r) * a,
351
+ vy: Math.sin(r) * a,
352
+ alpha: 1,
353
+ size: Math.random() * 3 + 2
354
+ });
355
+ }
356
+ }, [i]);
357
+ return n(() => {
358
+ let e = s.current, t = a.current;
359
+ if (!e || !t) return;
360
+ let n = e.getContext("2d");
361
+ if (!n) return;
362
+ let i = () => {
363
+ let r = window.devicePixelRatio || 1, { width: i, height: a } = t.getBoundingClientRect();
364
+ e.width = i * r, e.height = a * r, n.setTransform(r, 0, 0, r, 0, 0);
365
+ };
366
+ i();
367
+ let o = new ResizeObserver(i);
368
+ o.observe(t);
369
+ let l = document.hidden, u = v((e) => {
370
+ l = e;
371
+ }), f = () => {
372
+ if (d.current = requestAnimationFrame(f), l) return;
373
+ let { width: e, height: i } = t.getBoundingClientRect();
374
+ n.clearRect(0, 0, e, i), c.current = c.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .15, e.alpha -= .03, e.alpha <= 0 ? !1 : (n.beginPath(), n.arc(e.x, e.y, e.size, 0, Math.PI * 2), n.fillStyle = r, n.globalAlpha = e.alpha, n.fill(), n.globalAlpha = 1, !0)));
375
+ };
376
+ return f(), () => {
377
+ cancelAnimationFrame(d.current), o.disconnect(), u();
378
+ };
379
+ }, [r]), /* @__PURE__ */ u("div", {
380
+ ref: a,
381
+ className: w.clickSpark,
382
+ onClick: (e) => {
383
+ let t = a.current?.getBoundingClientRect();
384
+ t && f(e.clientX - t.left, e.clientY - t.top);
385
+ },
386
+ children: [
387
+ /* @__PURE__ */ l("canvas", {
388
+ ref: s,
389
+ className: w.canvas
390
+ }),
391
+ e && /* @__PURE__ */ l("div", {
392
+ className: w.content,
393
+ children: e
394
+ }),
395
+ !e && /* @__PURE__ */ l("p", {
396
+ className: w.hint,
397
+ children: "点击任意位置产生火花"
398
+ })
399
+ ]
400
+ });
401
+ }, T = {
111
402
  confetti: "cos-confetti-MeNtU",
112
403
  canvas: "cos-canvas-0T3Vs",
113
404
  hint: "cos-hint-sGHEi"
114
- }, h = [
405
+ }, re = [
115
406
  "#ff6b6b",
116
407
  "#ffd93d",
117
408
  "#6bcb77",
@@ -119,7 +410,7 @@ import './index.css';var u = {
119
410
  "#a66cff",
120
411
  "#ff85c0",
121
412
  "#38bdf8"
122
- ], g = () => h[Math.floor(Math.random() * h.length)], _ = (e, t, n) => {
413
+ ], ie = () => re[Math.floor(Math.random() * re.length)], ae = (e, t, n) => {
123
414
  let r = e / 2, i = t * .6;
124
415
  return Array.from({ length: n }, () => {
125
416
  let e = (Math.random() - .5) * Math.PI, t = Math.random() * 12 + 6;
@@ -130,67 +421,135 @@ import './index.css';var u = {
130
421
  vy: Math.sin(e) * t - Math.random() * 8,
131
422
  rotation: Math.random() * 360,
132
423
  rotationSpeed: (Math.random() - .5) * 12,
133
- color: g(),
424
+ color: ie(),
134
425
  width: Math.random() * 8 + 4,
135
426
  height: Math.random() * 6 + 3,
136
427
  alpha: 1,
137
428
  gravity: Math.random() * .15 + .12
138
429
  };
139
430
  });
140
- }, v = e(({ width: e = 800, height: i = 400, auto: o = !0, particleCount: s = 120 }, u) => {
141
- let d = a(null), f = a([]), p = a(0), h = t(() => {
142
- f.current.push(..._(e, i, s));
143
- }, [
144
- i,
145
- s,
146
- e
147
- ]);
148
- return r(u, () => ({ burst: h }), [h]), n(() => {
431
+ }, oe = e(({ width: e = 800, height: r = 400, auto: a = !0, particleCount: s = 120 }, c) => {
432
+ let d = o(null), f = o([]), p = o(0), m = o({
433
+ width: e,
434
+ height: r,
435
+ particleCount: s
436
+ });
437
+ m.current = {
438
+ width: e,
439
+ height: r,
440
+ particleCount: s
441
+ };
442
+ let h = t(() => {
443
+ let { width: e, height: t, particleCount: n } = m.current;
444
+ f.current.push(...ae(e, t, n));
445
+ }, []);
446
+ return i(c, () => ({ burst: h }), [h]), n(() => {
447
+ a && h();
448
+ }, [a, h]), n(() => {
149
449
  let t = d.current;
150
450
  if (!t) return;
151
451
  let n = window.devicePixelRatio || 1;
152
- t.width = e * n, t.height = i * n;
153
- let r = t.getContext("2d");
154
- if (!r) return;
155
- r.setTransform(n, 0, 0, n, 0, 0), o && h();
156
- let a = () => {
157
- p.current = requestAnimationFrame(a), r.clearRect(0, 0, e, i), f.current = f.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += e.gravity, e.vx *= .99, e.rotation += e.rotationSpeed, e.alpha -= .008, e.alpha <= 0 || e.y > i + 20 ? !1 : (r.save(), r.translate(e.x, e.y), r.rotate(e.rotation * Math.PI / 180), r.globalAlpha = e.alpha, r.fillStyle = e.color, r.fillRect(-e.width / 2, -e.height / 2, e.width, e.height), r.restore(), !0)));
452
+ t.width = e * n, t.height = r * n;
453
+ let i = t.getContext("2d");
454
+ if (!i) return;
455
+ i.setTransform(n, 0, 0, n, 0, 0);
456
+ let a = document.hidden, o = v((e) => {
457
+ a = e;
458
+ }), s = () => {
459
+ p.current = requestAnimationFrame(s), !a && (i.clearRect(0, 0, e, r), f.current = f.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += e.gravity, e.vx *= .99, e.rotation += e.rotationSpeed, e.alpha -= .008, e.alpha <= 0 || e.y > r + 20 ? !1 : (i.save(), i.translate(e.x, e.y), i.rotate(e.rotation * Math.PI / 180), i.globalAlpha = e.alpha, i.fillStyle = e.color, i.fillRect(-e.width / 2, -e.height / 2, e.width, e.height), i.restore(), !0))));
158
460
  };
159
- return a(), () => cancelAnimationFrame(p.current);
160
- }, [
161
- o,
162
- h,
163
- i,
164
- e
165
- ]), /* @__PURE__ */ l("div", {
166
- className: m.confetti,
461
+ return s(), () => {
462
+ cancelAnimationFrame(p.current), o();
463
+ };
464
+ }, [r, e]), /* @__PURE__ */ u("div", {
465
+ className: T.confetti,
167
466
  style: {
168
467
  width: e,
169
- height: i
468
+ height: r
170
469
  },
171
- children: [/* @__PURE__ */ c("canvas", {
470
+ children: [/* @__PURE__ */ l("canvas", {
172
471
  ref: d,
173
- className: m.canvas,
472
+ className: T.canvas,
174
473
  style: {
175
474
  width: e,
176
- height: i
475
+ height: r
177
476
  },
178
477
  onClick: h
179
- }), /* @__PURE__ */ c("p", {
180
- className: m.hint,
478
+ }), /* @__PURE__ */ l("p", {
479
+ className: T.hint,
181
480
  children: "点击画布再次喷射"
182
481
  })]
183
482
  });
184
483
  });
185
- v.displayName = "Confetti";
186
- var y = {
484
+ oe.displayName = "Confetti";
485
+ var se = {
486
+ cyberGrid: "cos-cyberGrid-VgJwl",
487
+ canvas: "cos-canvas--Mq-O"
488
+ }, ce = ({ width: e = 800, height: t = 500, color: r = "#00f0ff", speed: i = 1 }) => {
489
+ let a = o(null), s = o(0), c = o(0);
490
+ return n(() => {
491
+ let n = a.current;
492
+ if (!n) return;
493
+ let o = window.devicePixelRatio || 1;
494
+ n.width = e * o, n.height = t * o;
495
+ let l = n.getContext("2d");
496
+ if (!l) return;
497
+ l.setTransform(o, 0, 0, o, 0, 0);
498
+ let u = t * .45, d = document.hidden, f = v((e) => {
499
+ d = e;
500
+ }), p = () => {
501
+ if (s.current = requestAnimationFrame(p), d) return;
502
+ c.current = (c.current + i * 1.5) % 40, l.fillStyle = "#050510", l.fillRect(0, 0, e, t);
503
+ let n = l.createLinearGradient(0, 0, 0, u);
504
+ n.addColorStop(0, "#0a0a20"), n.addColorStop(1, "#050510"), l.fillStyle = n, l.fillRect(0, 0, e, u);
505
+ let a = e / 2;
506
+ l.strokeStyle = r, l.shadowColor = r, l.shadowBlur = 8, l.lineWidth = 1;
507
+ for (let n = -12; n <= 12; n++) {
508
+ let r = n / 12 * e * 1.2;
509
+ l.beginPath(), l.moveTo(a + r * .05, u), l.lineTo(a + r, t), l.globalAlpha = .3 + (1 - Math.abs(n) / 12) * .5, l.stroke();
510
+ }
511
+ l.globalAlpha = 1;
512
+ let o = Math.ceil(t / 40) + 2;
513
+ for (let n = 0; n < o; n++) {
514
+ let r = u + (n * 40 + c.current) / (t - u) * (t - u) % (t - u), i = (r - u) / (t - u) * .8;
515
+ l.beginPath(), l.moveTo(0, r), l.lineTo(e, r), l.globalAlpha = i, l.stroke();
516
+ }
517
+ l.shadowBlur = 0, l.globalAlpha = 1;
518
+ let f = l.createRadialGradient(a, u, 0, a, u, e * .4);
519
+ f.addColorStop(0, `${r}33`), f.addColorStop(1, "transparent"), l.fillStyle = f, l.fillRect(0, 0, e, t);
520
+ };
521
+ return p(), () => {
522
+ cancelAnimationFrame(s.current), f();
523
+ };
524
+ }, [
525
+ r,
526
+ t,
527
+ i,
528
+ e
529
+ ]), /* @__PURE__ */ l("div", {
530
+ className: se.cyberGrid,
531
+ style: {
532
+ width: e,
533
+ height: t
534
+ },
535
+ children: /* @__PURE__ */ l("canvas", {
536
+ ref: a,
537
+ className: se.canvas,
538
+ style: {
539
+ width: e,
540
+ height: t
541
+ }
542
+ })
543
+ });
544
+ }, E = {
187
545
  countdown: "cos-countdown-5ZKKP",
188
546
  unit: "cos-unit-dth8N",
189
547
  value: "cos-value-yVzcP",
190
548
  label: "cos-label-pAMEs",
191
549
  ended: "cos-ended-c0dsD",
192
- pulse: "cos-pulse-krQd-"
193
- }, b = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), x = (e) => {
550
+ pulse: "cos-pulse-krQd-",
551
+ invalid: "cos-invalid-d6t-L"
552
+ }, le = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), ue = (e) => {
194
553
  let t = Math.max(0, e - Date.now()), n = Math.floor(t / 1e3);
195
554
  return {
196
555
  total: t,
@@ -199,7 +558,7 @@ var y = {
199
558
  minutes: Math.floor(n % 3600 / 60),
200
559
  seconds: n % 60
201
560
  };
202
- }, S = [
561
+ }, de = [
203
562
  {
204
563
  key: "days",
205
564
  label: "天"
@@ -216,43 +575,347 @@ var y = {
216
575
  key: "seconds",
217
576
  label: "秒"
218
577
  }
219
- ], C = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: s = "#f472b6" }) => {
220
- let u = i(() => b(e), [e]), [, d] = o(0), f = a(!1), p = x(u);
578
+ ], fe = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: i = "#f472b6" }) => {
579
+ let c = a(() => le(e), [e]), d = !Number.isNaN(c), [, f] = s(0), p = o(!1), m = o(t), h = d ? ue(c) : {
580
+ days: 0,
581
+ hours: 0,
582
+ minutes: 0,
583
+ seconds: 0,
584
+ total: 0
585
+ };
221
586
  return n(() => {
222
- f.current = !1;
223
- let e = window.setInterval(() => d((e) => e + 1), 1e3);
587
+ m.current = t;
588
+ }, [t]), n(() => {
589
+ if (!d) return;
590
+ p.current = !1;
591
+ let e = window.setInterval(() => {
592
+ f((e) => e + 1), Date.now() >= c && !p.current && (p.current = !0, m.current?.(), clearInterval(e));
593
+ }, 1e3);
224
594
  return () => clearInterval(e);
225
- }, [u]), n(() => {
226
- p.total <= 0 && !f.current && (f.current = !0, t?.());
227
- }, [p.total, t]), /* @__PURE__ */ l("div", {
228
- className: y.countdown,
229
- style: { "--countdown-color": s },
230
- children: [S.map(({ key: e, label: t }) => /* @__PURE__ */ l("div", {
231
- className: y.unit,
232
- children: [/* @__PURE__ */ c("div", {
233
- className: y.value,
234
- children: String(p[e]).padStart(2, "0")
235
- }), r && /* @__PURE__ */ c("span", {
236
- className: y.label,
595
+ }, [d, c]), d ? /* @__PURE__ */ u("div", {
596
+ className: E.countdown,
597
+ style: { "--countdown-color": i },
598
+ children: [de.map(({ key: e, label: t }) => /* @__PURE__ */ u("div", {
599
+ className: E.unit,
600
+ children: [/* @__PURE__ */ l("div", {
601
+ className: E.value,
602
+ children: String(h[e]).padStart(2, "0")
603
+ }), r && /* @__PURE__ */ l("span", {
604
+ className: E.label,
237
605
  children: t
238
606
  })]
239
- }, e)), p.total <= 0 && /* @__PURE__ */ c("p", {
240
- className: y.ended,
607
+ }, e)), h.total <= 0 && /* @__PURE__ */ l("p", {
608
+ className: E.ended,
241
609
  children: "时间到!"
242
610
  })]
611
+ }) : /* @__PURE__ */ l("div", {
612
+ className: E.countdown,
613
+ children: /* @__PURE__ */ l("p", {
614
+ className: E.invalid,
615
+ children: "无效的目标时间"
616
+ })
243
617
  });
244
- }, w = {
618
+ }, pe = {
619
+ dnaHelix: "cos-dnaHelix-nEQLW",
620
+ canvas: "cos-canvas-uEV8B"
621
+ }, me = ({ width: e = 200, height: t = 360, speed: r = 1, color: i = "#38bdf8" }) => {
622
+ let a = o(null);
623
+ return n(() => {
624
+ let n = a.current;
625
+ if (!n) return;
626
+ let o = window.devicePixelRatio || 1;
627
+ n.width = e * o, n.height = t * o;
628
+ let s = n.getContext("2d");
629
+ if (!s) return;
630
+ s.setTransform(o, 0, 0, o, 0, 0);
631
+ let c = 0, l = 0, u = document.hidden, d = v((e) => {
632
+ u = e;
633
+ }), f = () => {
634
+ if (l = requestAnimationFrame(f), u) return;
635
+ c += .03 * r, s.fillStyle = "#0f172a", s.fillRect(0, 0, e, t);
636
+ let n = e / 2, a = e * .32;
637
+ for (let e = 0; e < 18; e++) {
638
+ let r = e / 17 * (t - 40) + 20, o = c + e * .4, l = n + Math.sin(o) * a, u = n + Math.sin(o + Math.PI) * a, d = Math.cos(o), f = 5 + d * 2;
639
+ s.beginPath(), s.moveTo(l, r), s.lineTo(u, r), s.strokeStyle = `rgb(148 163 184 / ${30 + Math.abs(d) * 30}%)`, s.lineWidth = 1.5, s.stroke(), s.beginPath(), s.arc(l, r, f, 0, Math.PI * 2), s.fillStyle = d > 0 ? i : "#a78bfa", s.fill(), s.beginPath(), s.arc(u, r, f, 0, Math.PI * 2), s.fillStyle = d > 0 ? "#a78bfa" : i, s.fill();
640
+ }
641
+ };
642
+ return f(), () => {
643
+ cancelAnimationFrame(l), d();
644
+ };
645
+ }, [
646
+ i,
647
+ t,
648
+ r,
649
+ e
650
+ ]), /* @__PURE__ */ l("div", {
651
+ className: pe.dnaHelix,
652
+ style: {
653
+ width: e,
654
+ height: t
655
+ },
656
+ children: /* @__PURE__ */ l("canvas", {
657
+ ref: a,
658
+ className: pe.canvas,
659
+ style: {
660
+ width: e,
661
+ height: t
662
+ }
663
+ })
664
+ });
665
+ }, he = {
666
+ electricArc: "cos-electricArc-BFlY3",
667
+ canvas: "cos-canvas-iowDx"
668
+ }, D = (e, t, n, r, i, a) => {
669
+ if (a <= 0) return [[e, t], [n, r]];
670
+ let o = (e + n) / 2, s = (t + r) / 2, c = n - e, l = r - t, u = Math.hypot(c, l) || 1, d = (Math.random() - .5) * i, f = -l / u * d, p = c / u * d, m = D(e, t, o + f, s + p, i * .6, a - 1), h = D(o + f, s + p, n, r, i * .6, a - 1);
671
+ return [...m.slice(0, -1), ...h];
672
+ }, ge = ({ width: e = 320, height: t = 160, color: r = "#67e8f9" }) => {
673
+ let i = o(null);
674
+ return n(() => {
675
+ let n = i.current;
676
+ if (!n) return;
677
+ let a = window.devicePixelRatio || 1;
678
+ n.width = e * a, n.height = t * a;
679
+ let o = n.getContext("2d");
680
+ if (!o) return;
681
+ o.setTransform(a, 0, 0, a, 0, 0);
682
+ let s = t / 2, c = e - 40, l = t / 2, u = 0, d = document.hidden, f = v((e) => {
683
+ d = e;
684
+ }), p = () => {
685
+ if (u = requestAnimationFrame(p), d) return;
686
+ o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t);
687
+ let n = D(40, s, c, l, 40, 5);
688
+ o.beginPath(), n.forEach(([e, t], n) => n === 0 ? o.moveTo(e, t) : o.lineTo(e, t)), o.strokeStyle = r, o.lineWidth = 2, o.shadowColor = r, o.shadowBlur = 12, o.stroke(), o.shadowBlur = 0, o.beginPath(), n.forEach(([e, t], n) => n === 0 ? o.moveTo(e, t) : o.lineTo(e, t)), o.strokeStyle = "#fff", o.lineWidth = .8, o.globalAlpha = .6, o.stroke(), o.globalAlpha = 1, [[40, s], [c, l]].forEach(([e, t]) => {
689
+ o.beginPath(), o.arc(e, t, 6, 0, Math.PI * 2), o.fillStyle = r, o.fill();
690
+ });
691
+ };
692
+ return p(), () => {
693
+ cancelAnimationFrame(u), f();
694
+ };
695
+ }, [
696
+ r,
697
+ t,
698
+ e
699
+ ]), /* @__PURE__ */ l("div", {
700
+ className: he.electricArc,
701
+ style: {
702
+ width: e,
703
+ height: t
704
+ },
705
+ children: /* @__PURE__ */ l("canvas", {
706
+ ref: i,
707
+ className: he.canvas,
708
+ style: {
709
+ width: e,
710
+ height: t
711
+ }
712
+ })
713
+ });
714
+ }, O = {
715
+ cursorTrail: "cos-cursorTrail-fpz5p",
716
+ canvas: "cos-canvas-Iuyp3",
717
+ hint: "cos-hint-9GLHx"
718
+ }, _e = ({ color: e = "#38bdf8", length: t = 20, width: r = 800, height: i = 400 }) => {
719
+ let a = o(null), s = o([]), c = o({
720
+ x: r / 2,
721
+ y: i / 2
722
+ }), d = o(0);
723
+ return n(() => {
724
+ let n = a.current;
725
+ if (!n) return;
726
+ let o = window.devicePixelRatio || 1;
727
+ n.width = r * o, n.height = i * o;
728
+ let l = n.getContext("2d");
729
+ if (!l) return;
730
+ l.setTransform(o, 0, 0, o, 0, 0);
731
+ let u = document.hidden, f = v((e) => {
732
+ u = e;
733
+ }), p = () => {
734
+ if (d.current = requestAnimationFrame(p), u) return;
735
+ let { x: n, y: a } = c.current;
736
+ s.current.unshift({
737
+ x: n,
738
+ y: a,
739
+ life: 1
740
+ }), s.current.length > t && (s.current.length = t), l.fillStyle = "rgb(15 23 42 / 15%)", l.fillRect(0, 0, r, i);
741
+ let o = s.current;
742
+ for (let t = 0; t < o.length; t++) {
743
+ let n = o[t], r = 1 - t / o.length, i = (1 - t / o.length) * 8 + 2;
744
+ l.beginPath(), l.arc(n.x, n.y, i, 0, Math.PI * 2), l.fillStyle = e, l.globalAlpha = r * .8, l.fill();
745
+ }
746
+ l.globalAlpha = 1;
747
+ };
748
+ return p(), () => {
749
+ cancelAnimationFrame(d.current), f();
750
+ };
751
+ }, [
752
+ e,
753
+ i,
754
+ t,
755
+ r
756
+ ]), /* @__PURE__ */ u("div", {
757
+ className: O.cursorTrail,
758
+ style: {
759
+ width: r,
760
+ height: i
761
+ },
762
+ children: [/* @__PURE__ */ l("canvas", {
763
+ ref: a,
764
+ className: O.canvas,
765
+ style: {
766
+ width: r,
767
+ height: i
768
+ },
769
+ onMouseMove: (e) => {
770
+ let t = e.currentTarget.getBoundingClientRect();
771
+ c.current = {
772
+ x: e.clientX - t.left,
773
+ y: e.clientY - t.top
774
+ };
775
+ }
776
+ }), /* @__PURE__ */ l("p", {
777
+ className: O.hint,
778
+ children: "移动鼠标查看粒子轨迹"
779
+ })]
780
+ });
781
+ }, k = {
782
+ diceRoll: "cos-diceRoll-GDwjV",
783
+ scene: "cos-scene-tmnKM",
784
+ cube: "cos-cube-RklEa",
785
+ rolling: "cos-rolling-2ocEq",
786
+ face: "cos-face-10eAF",
787
+ dot: "cos-dot-p5AzF",
788
+ face1: "cos-face1-Ev-x5",
789
+ face2: "cos-face2-2M17p",
790
+ face3: "cos-face3-Wd6T4",
791
+ face4: "cos-face4-RsRwQ",
792
+ face5: "cos-face5-PiJbu",
793
+ face6: "cos-face6-Yp-MX",
794
+ rollBtn: "cos-rollBtn-nXMWJ",
795
+ result: "cos-result-kXzu9"
796
+ }, ve = {
797
+ 1: {
798
+ x: 0,
799
+ y: 0
800
+ },
801
+ 2: {
802
+ x: 0,
803
+ y: 180
804
+ },
805
+ 3: {
806
+ x: 0,
807
+ y: -90
808
+ },
809
+ 4: {
810
+ x: 0,
811
+ y: 90
812
+ },
813
+ 5: {
814
+ x: -90,
815
+ y: 0
816
+ },
817
+ 6: {
818
+ x: 90,
819
+ y: 0
820
+ }
821
+ }, ye = ({ onRoll: e, sides: t = 6 }) => {
822
+ let [n, r] = s(!1), [i, a] = s(1), [o, c] = s({
823
+ x: 0,
824
+ y: 0,
825
+ z: 0
826
+ }), d = () => {
827
+ if (n) return;
828
+ r(!0);
829
+ let i = Math.floor(Math.random() * t) + 1, o = ve[i] ?? ve[1], s = 360 * (3 + Math.floor(Math.random() * 3)), l = 360 * (3 + Math.floor(Math.random() * 3));
830
+ c({
831
+ x: o.x + s,
832
+ y: o.y + l,
833
+ z: Math.random() * 360
834
+ }), window.setTimeout(() => {
835
+ a(i), r(!1), e?.(i);
836
+ }, 1200);
837
+ }, f = (e) => ({
838
+ 1: [[50, 50]],
839
+ 2: [[25, 25], [75, 75]],
840
+ 3: [
841
+ [25, 25],
842
+ [50, 50],
843
+ [75, 75]
844
+ ],
845
+ 4: [
846
+ [25, 25],
847
+ [75, 25],
848
+ [25, 75],
849
+ [75, 75]
850
+ ],
851
+ 5: [
852
+ [25, 25],
853
+ [75, 25],
854
+ [50, 50],
855
+ [25, 75],
856
+ [75, 75]
857
+ ],
858
+ 6: [
859
+ [25, 25],
860
+ [75, 25],
861
+ [25, 50],
862
+ [75, 50],
863
+ [25, 75],
864
+ [75, 75]
865
+ ]
866
+ }[e] ?? []).map(([e, t], n) => /* @__PURE__ */ l("span", {
867
+ className: k.dot,
868
+ style: {
869
+ left: `${e}%`,
870
+ top: `${t}%`
871
+ }
872
+ }, n));
873
+ return /* @__PURE__ */ u("div", {
874
+ className: k.diceRoll,
875
+ children: [
876
+ /* @__PURE__ */ l("div", {
877
+ className: k.scene,
878
+ children: /* @__PURE__ */ l("div", {
879
+ className: `${k.cube} ${n ? k.rolling : ""}`,
880
+ style: { transform: `rotateX(${o.x}deg) rotateY(${o.y}deg) rotateZ(${o.z}deg)` },
881
+ children: [
882
+ 1,
883
+ 2,
884
+ 3,
885
+ 4,
886
+ 5,
887
+ 6
888
+ ].map((e) => /* @__PURE__ */ l("div", {
889
+ className: `${k.face} ${k[`face${e}`]}`,
890
+ children: f(e)
891
+ }, e))
892
+ })
893
+ }),
894
+ /* @__PURE__ */ l("button", {
895
+ type: "button",
896
+ className: k.rollBtn,
897
+ onClick: d,
898
+ disabled: n,
899
+ children: n ? "掷骰中..." : "掷骰子"
900
+ }),
901
+ !n && /* @__PURE__ */ u("p", {
902
+ className: k.result,
903
+ children: ["点数: ", i]
904
+ })
905
+ ]
906
+ });
907
+ }, A = {
245
908
  fireworks: "cos-fireworks-fsSqL",
246
909
  canvas: "cos-canvas-spL8G",
247
910
  hint: "cos-hint-5XDRH"
248
- }, T = [
911
+ }, be = [
249
912
  "#ff6b6b",
250
913
  "#ffd93d",
251
914
  "#6bcb77",
252
915
  "#4d96ff",
253
916
  "#a66cff",
254
917
  "#ff85c0"
255
- ], E = .12, D = 240, O = () => T[Math.floor(Math.random() * T.length)], k = (e, t, n) => {
918
+ ], xe = .12, Se = 240, Ce = () => be[Math.floor(Math.random() * be.length)], we = (e, t, n) => {
256
919
  let r = 60 + Math.floor(Math.random() * 30);
257
920
  return Array.from({ length: r }, () => {
258
921
  let r = Math.random() * Math.PI * 2, i = Math.random() * 4 + 2;
@@ -262,74 +925,76 @@ var y = {
262
925
  vx: Math.cos(r) * i,
263
926
  vy: Math.sin(r) * i,
264
927
  alpha: 1,
265
- color: Math.random() > .3 ? n : O(),
928
+ color: Math.random() > .3 ? n : Ce(),
266
929
  decay: Math.random() * .015 + .01
267
930
  };
268
931
  });
269
- }, A = e(({ width: e = 800, height: i = 500, auto: o = !0 }, s) => {
270
- let u = a(null), d = a([]), f = a(0), p = t((t) => {
932
+ }, Te = e(({ width: e = 800, height: r = 500, auto: a = !0 }, s) => {
933
+ let c = o(null), d = o([]), f = o(0), p = t((t) => {
271
934
  let n = t ?? Math.random() * e * .6 + e * .2;
272
935
  d.current.push({
273
936
  x: n,
274
- y: i,
937
+ y: r,
275
938
  vy: -(Math.random() * 4 + 6),
276
- targetY: Math.random() * i * .35 + i * .15,
277
- color: O(),
939
+ targetY: Math.random() * r * .35 + r * .15,
940
+ color: Ce(),
278
941
  exploded: !1,
279
942
  particles: [],
280
943
  age: 0
281
944
  });
282
- }, [i, e]);
283
- return r(s, () => ({ launch: p }), [p]), n(() => {
284
- let t = u.current;
945
+ }, [r, e]);
946
+ return i(s, () => ({ launch: p }), [p]), n(() => {
947
+ let t = c.current;
285
948
  if (!t) return;
286
949
  let n = window.devicePixelRatio || 1;
287
- t.width = e * n, t.height = i * n;
288
- let r = t.getContext("2d");
289
- if (!r) return;
290
- r.setTransform(n, 0, 0, n, 0, 0);
291
- let a = 0, s = () => {
292
- f.current = requestAnimationFrame(s), r.fillStyle = "rgb(15 23 42 / 25%)", r.fillRect(0, 0, e, i), o && Math.random() < .03 && p(), d.current = d.current.filter((e) => {
950
+ t.width = e * n, t.height = r * n;
951
+ let i = t.getContext("2d");
952
+ if (!i) return;
953
+ i.setTransform(n, 0, 0, n, 0, 0);
954
+ let o = 0, s = document.hidden, l = v((e) => {
955
+ s = e;
956
+ }), u = () => {
957
+ f.current = requestAnimationFrame(u), !s && (i.fillStyle = "rgb(15 23 42 / 25%)", i.fillRect(0, 0, e, r), d.current = d.current.filter((e) => {
293
958
  if (!e.exploded) {
294
- e.age += 1, e.y += e.vy, e.vy += E, r.beginPath(), r.arc(e.x, e.y, 2.5, 0, Math.PI * 2), r.fillStyle = e.color, r.fill();
295
- let t = e.vy >= 0, n = e.y <= e.targetY, i = e.y < 0, a = e.age >= D;
296
- return (t || n || i || a) && (e.exploded = !0, e.particles = k(e.x, e.y, e.color)), !0;
959
+ e.age += 1, e.y += e.vy, e.vy += xe, i.beginPath(), i.arc(e.x, e.y, 2.5, 0, Math.PI * 2), i.fillStyle = e.color, i.fill();
960
+ let t = e.vy >= 0, n = e.y <= e.targetY, r = e.y < 0, a = e.age >= Se;
961
+ return (t || n || r || a) && (e.exploded = !0, e.particles = we(e.x, e.y, e.color)), !0;
297
962
  }
298
- return e.particles = e.particles.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .06, e.alpha -= e.decay, e.alpha <= 0 ? !1 : (r.beginPath(), r.arc(e.x, e.y, 2, 0, Math.PI * 2), r.fillStyle = e.color, r.globalAlpha = e.alpha, r.fill(), r.globalAlpha = 1, !0))), e.particles.length > 0;
299
- });
963
+ return e.particles = e.particles.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .06, e.alpha -= e.decay, e.alpha <= 0 ? !1 : (i.beginPath(), i.arc(e.x, e.y, 2, 0, Math.PI * 2), i.fillStyle = e.color, i.globalAlpha = e.alpha, i.fill(), i.globalAlpha = 1, !0))), e.particles.length > 0;
964
+ }));
300
965
  };
301
- return s(), o && (a = window.setInterval(() => p(), 1200)), () => {
302
- cancelAnimationFrame(f.current), clearInterval(a);
966
+ return u(), a && (o = window.setInterval(() => p(), 1200)), () => {
967
+ cancelAnimationFrame(f.current), clearInterval(o), l();
303
968
  };
304
969
  }, [
305
- o,
306
- i,
970
+ a,
971
+ r,
307
972
  p,
308
973
  e
309
- ]), /* @__PURE__ */ l("div", {
310
- className: w.fireworks,
974
+ ]), /* @__PURE__ */ u("div", {
975
+ className: A.fireworks,
311
976
  style: {
312
977
  width: e,
313
- height: i
978
+ height: r
314
979
  },
315
- children: [/* @__PURE__ */ c("canvas", {
316
- ref: u,
317
- className: w.canvas,
980
+ children: [/* @__PURE__ */ l("canvas", {
981
+ ref: c,
982
+ className: A.canvas,
318
983
  style: {
319
984
  width: e,
320
- height: i
985
+ height: r
321
986
  },
322
987
  onClick: (e) => {
323
988
  let t = e.currentTarget.getBoundingClientRect();
324
989
  p(e.clientX - t.left);
325
990
  }
326
- }), /* @__PURE__ */ c("p", {
327
- className: w.hint,
991
+ }), /* @__PURE__ */ l("p", {
992
+ className: A.hint,
328
993
  children: "点击画布燃放烟花"
329
994
  })]
330
995
  });
331
996
  });
332
- A.displayName = "Fireworks";
997
+ Te.displayName = "Fireworks";
333
998
  var j = {
334
999
  flipCounter: "cos-flipCounter-3LuI0",
335
1000
  digit: "cos-digit-yJRPy",
@@ -342,61 +1007,84 @@ var j = {
342
1007
  isFlipping: "cos-isFlipping-EVEdI",
343
1008
  "fold-top": "cos-fold-top-v-6XJ",
344
1009
  "unfold-bottom": "cos-unfold-bottom-e2gzU"
345
- }, M = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), N = ({ digit: e, color: t, duration: r }) => {
346
- let i = a(e), [u, d] = o(!1), [f, p] = o(e);
1010
+ }, Ee = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), De = ({ digit: e, color: t, duration: r }) => {
1011
+ let i = o(e), [a, d] = s(!1), [f, p] = s(e);
347
1012
  n(() => {
348
1013
  if (e === i.current) return;
349
1014
  p(i.current), d(!0), i.current = e;
350
1015
  let t = window.setTimeout(() => d(!1), r);
351
1016
  return () => clearTimeout(t);
352
1017
  }, [e, r]);
353
- let m = u ? f : e;
354
- return /* @__PURE__ */ c("div", {
1018
+ let m = a ? f : e;
1019
+ return /* @__PURE__ */ l("div", {
355
1020
  className: j.digit,
356
1021
  style: {
357
1022
  "--flip-color": t,
358
1023
  "--flip-duration": `${r}ms`
359
1024
  },
360
- children: /* @__PURE__ */ l("div", {
361
- className: `${j.digitCard} ${u ? j.isFlipping : ""}`,
1025
+ children: /* @__PURE__ */ u("div", {
1026
+ className: `${j.digitCard} ${a ? j.isFlipping : ""}`,
362
1027
  children: [
363
- /* @__PURE__ */ c("div", {
1028
+ /* @__PURE__ */ l("div", {
364
1029
  className: j.staticTop,
365
- children: /* @__PURE__ */ c("span", { children: m })
1030
+ children: /* @__PURE__ */ l("span", { children: m })
366
1031
  }),
367
- /* @__PURE__ */ c("div", {
1032
+ /* @__PURE__ */ l("div", {
368
1033
  className: j.staticBottom,
369
- children: /* @__PURE__ */ c("span", { children: m })
1034
+ children: /* @__PURE__ */ l("span", { children: m })
370
1035
  }),
371
- u && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
1036
+ a && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
372
1037
  className: `${j.flap} ${j.flapTop}`,
373
- children: /* @__PURE__ */ c("span", { children: f })
374
- }), /* @__PURE__ */ c("div", {
1038
+ children: /* @__PURE__ */ l("span", { children: f })
1039
+ }), /* @__PURE__ */ l("div", {
375
1040
  className: `${j.flap} ${j.flapBottom}`,
376
- children: /* @__PURE__ */ c("span", { children: e })
1041
+ children: /* @__PURE__ */ l("span", { children: e })
377
1042
  })] })
378
1043
  ]
379
1044
  })
380
1045
  });
381
- }, P = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
382
- let i = M(e, t).split("");
383
- return /* @__PURE__ */ c("div", {
1046
+ }, Oe = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
1047
+ let i = Ee(e, t).split("");
1048
+ return /* @__PURE__ */ l("div", {
384
1049
  className: j.flipCounter,
385
- children: i.map((e, t) => /* @__PURE__ */ c(N, {
1050
+ children: i.map((e, t) => /* @__PURE__ */ l(De, {
386
1051
  digit: e,
387
1052
  color: n,
388
1053
  duration: r
389
1054
  }, t))
390
1055
  });
391
- }, F = {
1056
+ }, ke = {
1057
+ gradientFlow: "cos-gradientFlow-XhN16",
1058
+ text: "cos-text-ORuqk",
1059
+ flow: "cos-flow-9FzMA"
1060
+ }, Ae = [
1061
+ "#ff00de",
1062
+ "#7c3aed",
1063
+ "#00f0ff",
1064
+ "#38bdf8",
1065
+ "#ff00de"
1066
+ ], je = ({ text: e = "GRADIENT", colors: t = Ae, fontSize: n = 64 }) => {
1067
+ let r = t.length >= 2 ? t.join(", ") : Ae.join(", ");
1068
+ return /* @__PURE__ */ l("div", {
1069
+ className: ke.gradientFlow,
1070
+ children: /* @__PURE__ */ l("h1", {
1071
+ className: ke.text,
1072
+ style: {
1073
+ fontSize: n,
1074
+ backgroundImage: `linear-gradient(90deg, ${r})`
1075
+ },
1076
+ children: e
1077
+ })
1078
+ });
1079
+ }, Me = {
392
1080
  glitchText: "cos-glitchText-dZ-sR",
393
1081
  text: "cos-text-JsPHN",
394
1082
  "glitch-1": "cos-glitch-1-s9pqH",
395
1083
  "glitch-2": "cos-glitch-2-GhFB-"
396
- }, I = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ c("div", {
397
- className: F.glitchText,
398
- children: /* @__PURE__ */ c("h1", {
399
- className: F.text,
1084
+ }, Ne = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ l("div", {
1085
+ className: Me.glitchText,
1086
+ children: /* @__PURE__ */ l("h1", {
1087
+ className: Me.text,
400
1088
  "data-text": e,
401
1089
  style: {
402
1090
  fontSize: i,
@@ -406,66 +1094,403 @@ var j = {
406
1094
  },
407
1095
  children: e
408
1096
  })
409
- }), L = {
410
- matrixRain: "cos-matrixRain-qg9HC",
411
- canvas: "cos-canvas--AvpG",
412
- overlay: "cos-overlay-knj3b",
413
- title: "cos-title-sDfhs",
414
- flicker: "cos-flicker-smHxl",
415
- subtitle: "cos-subtitle-CWheW"
416
- }, R = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", z = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41" }) => {
417
- let o = a(null);
1097
+ }), Pe = {
1098
+ gravityBalls: "cos-gravityBalls-LdwFo",
1099
+ canvas: "cos-canvas-n7esd"
1100
+ }, Fe = [
1101
+ "#38bdf8",
1102
+ "#a78bfa",
1103
+ "#f472b6",
1104
+ "#4ade80",
1105
+ "#fbbf24"
1106
+ ], Ie = ({ width: e = 400, height: t = 300, ballCount: r = 12 }) => {
1107
+ let i = o(null), a = o([]);
418
1108
  return n(() => {
419
- let n = o.current;
420
- if (!n) return;
421
- let a = window.devicePixelRatio || 1;
422
- n.width = e * a, n.height = t * a;
423
- let s = n.getContext("2d");
424
- if (!s) return;
425
- s.setTransform(a, 0, 0, a, 0, 0);
426
- let c = Math.floor(e / 16 * r), l = Array.from({ length: c }, () => Math.random() * -50), u = 0, d = () => {
427
- s.fillStyle = "rgb(0 0 0 / 8%)", s.fillRect(0, 0, e, t), s.fillStyle = i, s.font = "16px monospace", l.forEach((e, n) => {
428
- let a = R[Math.floor(Math.random() * 53)], o = n / r * 16;
429
- s.fillStyle = i, s.fillText(a, o, e * 16), e * 16 > t && Math.random() > .975 && (l[n] = 0), l[n] += 1;
430
- }), u = requestAnimationFrame(d);
431
- };
432
- return d(), () => cancelAnimationFrame(u);
1109
+ a.current = Array.from({ length: r }, () => ({
1110
+ x: Math.random() * (e - 40) + 20,
1111
+ y: t * .5 * Math.random() + 10,
1112
+ vx: (Math.random() - .5) * 4,
1113
+ vy: Math.random() * 2,
1114
+ r: Math.random() * 10 + 8,
1115
+ color: Fe[Math.floor(Math.random() * Fe.length)]
1116
+ }));
1117
+ }, [
1118
+ r,
1119
+ t,
1120
+ e
1121
+ ]), n(() => {
1122
+ let n = i.current;
1123
+ if (!n) return;
1124
+ let r = window.devicePixelRatio || 1;
1125
+ n.width = e * r, n.height = t * r;
1126
+ let o = n.getContext("2d");
1127
+ if (!o) return;
1128
+ o.setTransform(r, 0, 0, r, 0, 0);
1129
+ let s = 0, c = document.hidden, l = v((e) => {
1130
+ c = e;
1131
+ }), u = () => {
1132
+ if (s = requestAnimationFrame(u), c) return;
1133
+ let n = a.current;
1134
+ o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t);
1135
+ for (let r of n) r.vy += .25, r.x += r.vx, r.y += r.vy, r.x - r.r < 0 ? (r.x = r.r, r.vx *= -.99) : r.x + r.r > e && (r.x = e - r.r, r.vx *= -.99), r.y + r.r > t && (r.y = t - r.r, r.vy *= -.99, r.vx *= .99), r.y - r.r < 0 && (r.y = r.r, r.vy *= -.99);
1136
+ for (let e = 0; e < n.length; e++) for (let t = e + 1; t < n.length; t++) {
1137
+ let r = n[e], i = n[t], a = i.x - r.x, o = i.y - r.y, s = Math.hypot(a, o) || .001, c = r.r + i.r;
1138
+ if (s < c) {
1139
+ let e = a / s, t = o / s, n = c - s;
1140
+ r.x -= e * n * .5, r.y -= t * n * .5, i.x += e * n * .5, i.y += t * n * .5;
1141
+ let l = (r.vx - i.vx) * e + (r.vy - i.vy) * t;
1142
+ l > 0 && (r.vx -= l * e, r.vy -= l * t, i.vx += l * e, i.vy += l * t);
1143
+ }
1144
+ }
1145
+ for (let e of n) {
1146
+ o.beginPath(), o.arc(e.x, e.y, e.r, 0, Math.PI * 2);
1147
+ let t = o.createRadialGradient(e.x - e.r * .3, e.y - e.r * .3, 0, e.x, e.y, e.r);
1148
+ t.addColorStop(0, "#fff"), t.addColorStop(.3, e.color), t.addColorStop(1, e.color), o.fillStyle = t, o.fill();
1149
+ }
1150
+ };
1151
+ return u(), () => {
1152
+ cancelAnimationFrame(s), l();
1153
+ };
1154
+ }, [t, e]), /* @__PURE__ */ l("div", {
1155
+ className: Pe.gravityBalls,
1156
+ style: {
1157
+ width: e,
1158
+ height: t
1159
+ },
1160
+ children: /* @__PURE__ */ l("canvas", {
1161
+ ref: i,
1162
+ className: Pe.canvas,
1163
+ style: {
1164
+ width: e,
1165
+ height: t
1166
+ }
1167
+ })
1168
+ });
1169
+ }, M = {
1170
+ wrap: "cos-wrap-r1gGL",
1171
+ card: "cos-card-3W10s",
1172
+ shine: "cos-shine-0xjID",
1173
+ image: "cos-image-AV2XG",
1174
+ placeholder: "cos-placeholder-wuuL3",
1175
+ info: "cos-info-CNR0r"
1176
+ }, Le = ({ title: e = "全息卡片", subtitle: t = "移动鼠标体验 3D 效果", image: n }) => {
1177
+ let r = o(null);
1178
+ return /* @__PURE__ */ l("div", {
1179
+ className: M.wrap,
1180
+ children: /* @__PURE__ */ u("div", {
1181
+ ref: r,
1182
+ className: M.card,
1183
+ onMouseMove: (e) => {
1184
+ let t = r.current;
1185
+ if (!t) return;
1186
+ let n = t.getBoundingClientRect(), i = (e.clientX - n.left) / n.width - .5, a = (e.clientY - n.top) / n.height - .5;
1187
+ t.style.setProperty("--rx", `${-a * 20}deg`), t.style.setProperty("--ry", `${i * 20}deg`), t.style.setProperty("--gx", `${(i + .5) * 100}%`), t.style.setProperty("--gy", `${(a + .5) * 100}%`);
1188
+ },
1189
+ onMouseLeave: () => {
1190
+ let e = r.current;
1191
+ e && (e.style.setProperty("--rx", "0deg"), e.style.setProperty("--ry", "0deg"), e.style.setProperty("--gx", "50%"), e.style.setProperty("--gy", "50%"));
1192
+ },
1193
+ children: [
1194
+ /* @__PURE__ */ l("div", { className: M.shine }),
1195
+ n ? /* @__PURE__ */ l("img", {
1196
+ src: n,
1197
+ alt: e,
1198
+ className: M.image
1199
+ }) : /* @__PURE__ */ l("div", {
1200
+ className: M.placeholder,
1201
+ children: /* @__PURE__ */ l("span", { children: "✦" })
1202
+ }),
1203
+ /* @__PURE__ */ u("div", {
1204
+ className: M.info,
1205
+ children: [/* @__PURE__ */ l("h3", { children: e }), /* @__PURE__ */ l("p", { children: t })]
1206
+ })
1207
+ ]
1208
+ })
1209
+ });
1210
+ }, N = {
1211
+ liquidProgress: "cos-liquidProgress-ABZZA",
1212
+ svg: "cos-svg-YdTvy",
1213
+ track: "cos-track-IhMjO",
1214
+ ring: "cos-ring-6PKMg",
1215
+ fillBg: "cos-fillBg-pwLI1",
1216
+ wave: "cos-wave-CBwgG",
1217
+ label: "cos-label-WYDqS"
1218
+ }, Re = ({ value: e = 0, max: t = 100, size: i = 160, color: a = "#38bdf8" }) => {
1219
+ let s = o(null), c = r().replace(/:/g, ""), d = y(t > 0 ? e / t * 100 : 0, 0, 100), f = 100 - d;
1220
+ return n(() => {
1221
+ let e = 0, t = 0, n = () => {
1222
+ t += .04;
1223
+ let r = s.current;
1224
+ if (r) {
1225
+ let e = f + Math.sin(t) * 2;
1226
+ r.setAttribute("d", `M0,${e} Q25,${e - 4 + Math.sin(t * 1.3) * 3} 50,${e} T100,${e} V100 H0 Z`);
1227
+ }
1228
+ e = requestAnimationFrame(n);
1229
+ };
1230
+ return e = requestAnimationFrame(n), () => cancelAnimationFrame(e);
1231
+ }, [f]), /* @__PURE__ */ u("div", {
1232
+ className: N.liquidProgress,
1233
+ style: {
1234
+ width: i,
1235
+ height: i,
1236
+ "--liquid-color": a
1237
+ },
1238
+ children: [/* @__PURE__ */ u("svg", {
1239
+ viewBox: "0 0 100 100",
1240
+ className: N.svg,
1241
+ children: [
1242
+ /* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", {
1243
+ id: `clip-${c}`,
1244
+ children: /* @__PURE__ */ l("circle", {
1245
+ cx: "50",
1246
+ cy: "50",
1247
+ r: 45
1248
+ })
1249
+ }) }),
1250
+ /* @__PURE__ */ l("circle", {
1251
+ cx: "50",
1252
+ cy: "50",
1253
+ r: 45,
1254
+ className: N.track,
1255
+ strokeWidth: 10,
1256
+ fill: "none"
1257
+ }),
1258
+ /* @__PURE__ */ u("g", {
1259
+ clipPath: `url(#clip-${c})`,
1260
+ children: [/* @__PURE__ */ l("rect", {
1261
+ x: "0",
1262
+ y: "0",
1263
+ width: "100",
1264
+ height: "100",
1265
+ className: N.fillBg
1266
+ }), /* @__PURE__ */ l("path", {
1267
+ ref: s,
1268
+ className: N.wave,
1269
+ d: `M0,${f} Q25,${f - 4} 50,${f} T100,${f} V100 H0 Z`
1270
+ })]
1271
+ }),
1272
+ /* @__PURE__ */ l("circle", {
1273
+ cx: "50",
1274
+ cy: "50",
1275
+ r: 45,
1276
+ className: N.ring,
1277
+ strokeWidth: 10,
1278
+ fill: "none"
1279
+ })
1280
+ ]
1281
+ }), /* @__PURE__ */ u("span", {
1282
+ className: N.label,
1283
+ children: [Math.round(d), "%"]
1284
+ })]
1285
+ });
1286
+ }, P = {
1287
+ liquidGlass: "cos-liquidGlass-Z3bQg",
1288
+ panel: "cos-panel-XYboD",
1289
+ content: "cos-content-MHfkS"
1290
+ }, ze = ({ children: e = "液态玻璃面板", blur: t = 16, borderRadius: n = 20 }) => /* @__PURE__ */ l("div", {
1291
+ className: P.liquidGlass,
1292
+ children: /* @__PURE__ */ l("div", {
1293
+ className: P.panel,
1294
+ style: {
1295
+ "--glass-blur": `${t}px`,
1296
+ "--glass-radius": `${n}px`
1297
+ },
1298
+ children: /* @__PURE__ */ l("div", {
1299
+ className: P.content,
1300
+ children: e
1301
+ })
1302
+ })
1303
+ }), Be = {
1304
+ magneticButton: "cos-magneticButton-GbRkE",
1305
+ btn: "cos-btn--b2BJ"
1306
+ }, Ve = ({ children: e = "磁吸按钮", strength: t = .4, color: n = "#6366f1" }) => {
1307
+ let r = o(null), i = o(null);
1308
+ return /* @__PURE__ */ l("div", {
1309
+ ref: r,
1310
+ className: Be.magneticButton,
1311
+ onMouseMove: (e) => {
1312
+ let n = r.current, a = i.current;
1313
+ if (!n || !a) return;
1314
+ let o = n.getBoundingClientRect(), s = o.left + o.width / 2, c = o.top + o.height / 2, l = (e.clientX - s) * t, u = (e.clientY - c) * t;
1315
+ a.style.transform = `translate(${l}px, ${u}px)`;
1316
+ },
1317
+ onMouseLeave: () => {
1318
+ let e = i.current;
1319
+ e && (e.style.transform = "translate(0, 0)");
1320
+ },
1321
+ children: /* @__PURE__ */ l("button", {
1322
+ ref: i,
1323
+ type: "button",
1324
+ className: Be.btn,
1325
+ style: { "--btn-color": n },
1326
+ children: e
1327
+ })
1328
+ });
1329
+ }, F = {
1330
+ matrixRain: "cos-matrixRain-qg9HC",
1331
+ canvas: "cos-canvas--AvpG",
1332
+ overlay: "cos-overlay-knj3b",
1333
+ title: "cos-title-sDfhs",
1334
+ flicker: "cos-flicker-smHxl",
1335
+ subtitle: "cos-subtitle-CWheW"
1336
+ }, He = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", Ue = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41", showOverlay: a = !0, title: s = "MATRIX", subtitle: c = "数字雨效果" }) => {
1337
+ let d = o(null);
1338
+ return n(() => {
1339
+ let n = d.current;
1340
+ if (!n) return;
1341
+ let a = window.devicePixelRatio || 1;
1342
+ n.width = e * a, n.height = t * a;
1343
+ let o = n.getContext("2d");
1344
+ if (!o) return;
1345
+ o.setTransform(a, 0, 0, a, 0, 0);
1346
+ let s = Math.floor(e / 16 * r), c = Array.from({ length: s }, () => Math.random() * -50), l = 0, u = document.hidden, f = v((e) => {
1347
+ u = e;
1348
+ }), p = () => {
1349
+ l = requestAnimationFrame(p), !u && (o.fillStyle = "rgb(0 0 0 / 8%)", o.fillRect(0, 0, e, t), o.font = "16px monospace", c.forEach((e, n) => {
1350
+ let a = He[Math.floor(Math.random() * 53)], s = n / r * 16;
1351
+ o.fillStyle = i, o.fillText(a, s, e * 16), e * 16 > t && Math.random() > .975 && (c[n] = 0), c[n] += 1;
1352
+ }));
1353
+ };
1354
+ return p(), () => {
1355
+ cancelAnimationFrame(l), f();
1356
+ };
433
1357
  }, [
434
1358
  i,
435
1359
  r,
436
1360
  t,
437
1361
  e
438
- ]), /* @__PURE__ */ l("div", {
439
- className: L.matrixRain,
1362
+ ]), /* @__PURE__ */ u("div", {
1363
+ className: F.matrixRain,
440
1364
  style: {
441
1365
  width: e,
442
1366
  height: t
443
1367
  },
444
- children: [/* @__PURE__ */ c("canvas", {
445
- ref: o,
446
- className: L.canvas,
1368
+ children: [/* @__PURE__ */ l("canvas", {
1369
+ ref: d,
1370
+ className: F.canvas,
447
1371
  style: {
448
1372
  width: e,
449
1373
  height: t
450
1374
  }
451
- }), /* @__PURE__ */ l("div", {
452
- className: L.overlay,
453
- children: [/* @__PURE__ */ c("h2", {
454
- className: L.title,
455
- children: "MATRIX"
456
- }), /* @__PURE__ */ c("p", {
457
- className: L.subtitle,
458
- children: "数字雨效果"
1375
+ }), a && /* @__PURE__ */ u("div", {
1376
+ className: F.overlay,
1377
+ children: [/* @__PURE__ */ l("h2", {
1378
+ className: F.title,
1379
+ children: s
1380
+ }), /* @__PURE__ */ l("p", {
1381
+ className: F.subtitle,
1382
+ children: c
459
1383
  })]
460
1384
  })]
461
1385
  });
462
- }, B = {
1386
+ }, We = {
1387
+ mazeGenerator: "cos-mazeGenerator-QEa0s",
1388
+ canvas: "cos-canvas-emhxb"
1389
+ }, Ge = ({ width: e = 400, height: t = 300, cellSize: r = 20, onGenerated: i }) => {
1390
+ let a = o(null), s = o(i);
1391
+ return n(() => {
1392
+ s.current = i;
1393
+ }, [i]), n(() => {
1394
+ let n = a.current;
1395
+ if (!n) return;
1396
+ let i = window.devicePixelRatio || 1;
1397
+ n.width = e * i, n.height = t * i;
1398
+ let o = n.getContext("2d");
1399
+ if (!o) return;
1400
+ o.setTransform(i, 0, 0, i, 0, 0);
1401
+ let c = Math.floor(e / r), l = Math.floor(t / r), u = Array.from({ length: l }, () => Array.from({ length: c }, () => ({
1402
+ top: !0,
1403
+ right: !0,
1404
+ bottom: !0,
1405
+ left: !0,
1406
+ visited: !1
1407
+ }))), d = [[0, 0]];
1408
+ u[0][0].visited = !0;
1409
+ let f = [
1410
+ [
1411
+ 0,
1412
+ -1,
1413
+ "top"
1414
+ ],
1415
+ [
1416
+ 1,
1417
+ 0,
1418
+ "right"
1419
+ ],
1420
+ [
1421
+ 0,
1422
+ 1,
1423
+ "bottom"
1424
+ ],
1425
+ [
1426
+ -1,
1427
+ 0,
1428
+ "left"
1429
+ ]
1430
+ ], p = {
1431
+ top: "bottom",
1432
+ right: "left",
1433
+ bottom: "top",
1434
+ left: "right"
1435
+ };
1436
+ for (; d.length;) {
1437
+ let [e, t] = d[d.length - 1], n = f.map(([n, r, i]) => {
1438
+ let a = e + n, o = t + r;
1439
+ return a < 0 || o < 0 || a >= c || o >= l || u[o][a].visited ? null : {
1440
+ nx: a,
1441
+ ny: o,
1442
+ wall: i
1443
+ };
1444
+ }).filter(Boolean);
1445
+ if (!n.length) {
1446
+ d.pop();
1447
+ continue;
1448
+ }
1449
+ let r = n[Math.floor(Math.random() * n.length)];
1450
+ u[t][e][r.wall] = !1, u[r.ny][r.nx][p[r.wall]] = !1, u[r.ny][r.nx].visited = !0, d.push([r.nx, r.ny]);
1451
+ }
1452
+ s.current?.(c, l);
1453
+ let m = 0, h = 0, g = c * l * 2, _ = document.hidden, y = v((e) => {
1454
+ _ = e;
1455
+ }), b = () => {
1456
+ if (m = requestAnimationFrame(b), _) return;
1457
+ h = Math.min(g, h + 2), o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t), o.strokeStyle = "#38bdf8", o.lineWidth = 1.5, o.shadowColor = "#38bdf8", o.shadowBlur = 4;
1458
+ let n = 0;
1459
+ for (let e = 0; e < l; e++) for (let t = 0; t < c; t++) {
1460
+ let i = u[e][t], a = t * r, s = e * r;
1461
+ i.top && n++ < h && (o.beginPath(), o.moveTo(a, s), o.lineTo(a + r, s), o.stroke()), i.right && n++ < h && (o.beginPath(), o.moveTo(a + r, s), o.lineTo(a + r, s + r), o.stroke()), e === l - 1 && i.bottom && n++ < h && (o.beginPath(), o.moveTo(a, s + r), o.lineTo(a + r, s + r), o.stroke()), t === 0 && i.left && n++ < h && (o.beginPath(), o.moveTo(a, s), o.lineTo(a, s + r), o.stroke());
1462
+ }
1463
+ o.shadowBlur = 0;
1464
+ };
1465
+ return b(), () => {
1466
+ cancelAnimationFrame(m), y();
1467
+ };
1468
+ }, [
1469
+ r,
1470
+ t,
1471
+ e
1472
+ ]), /* @__PURE__ */ l("div", {
1473
+ className: We.mazeGenerator,
1474
+ style: {
1475
+ width: e,
1476
+ height: t
1477
+ },
1478
+ children: /* @__PURE__ */ l("canvas", {
1479
+ ref: a,
1480
+ className: We.canvas,
1481
+ style: {
1482
+ width: e,
1483
+ height: t
1484
+ }
1485
+ })
1486
+ });
1487
+ }, Ke = {
463
1488
  meteorRain: "cos-meteorRain-v8RNI",
464
1489
  canvas: "cos-canvas-hyFMr"
465
- }, V = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
466
- let i = a(null), o = a([]), s = a(0);
1490
+ }, qe = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
1491
+ let i = o(null), a = o([]), s = o(0);
467
1492
  return n(() => {
468
- o.current = Array.from({ length: r }, () => ({
1493
+ a.current = Array.from({ length: r }, () => ({
469
1494
  x: Math.random() * e,
470
1495
  y: Math.random() * t * .5,
471
1496
  length: Math.random() * 60 + 40,
@@ -481,65 +1506,169 @@ var j = {
481
1506
  if (!n) return;
482
1507
  let r = window.devicePixelRatio || 1;
483
1508
  n.width = e * r, n.height = t * r;
484
- let a = n.getContext("2d");
485
- if (!a) return;
486
- a.setTransform(r, 0, 0, r, 0, 0);
487
- let c = () => {
488
- s.current = requestAnimationFrame(c), a.fillStyle = "rgb(15 23 42 / 15%)", a.fillRect(0, 0, e, t), o.current.forEach((n) => {
1509
+ let o = n.getContext("2d");
1510
+ if (!o) return;
1511
+ o.setTransform(r, 0, 0, r, 0, 0);
1512
+ let c = document.hidden, l = v((e) => {
1513
+ c = e;
1514
+ }), u = () => {
1515
+ s.current = requestAnimationFrame(u), !c && (o.fillStyle = "rgb(15 23 42 / 15%)", o.fillRect(0, 0, e, t), a.current.forEach((n) => {
489
1516
  n.x += n.speed, n.y += n.speed * .6, (n.x > e + n.length || n.y > t + n.length) && (n.x = -n.length, n.y = Math.random() * t * .4, n.length = Math.random() * 60 + 40, n.speed = Math.random() * 6 + 4, n.opacity = Math.random() * .5 + .3);
490
- let r = a.createLinearGradient(n.x, n.y, n.x - n.length, n.y - n.length * .6);
491
- r.addColorStop(0, `rgb(255 255 255 / ${n.opacity})`), r.addColorStop(1, "rgb(255 255 255 / 0)"), a.beginPath(), a.strokeStyle = r, a.lineWidth = 2, a.moveTo(n.x, n.y), a.lineTo(n.x - n.length, n.y - n.length * .6), a.stroke();
492
- });
1517
+ let r = n.x - n.length, i = n.y - n.length * .6;
1518
+ o.beginPath(), o.strokeStyle = `rgb(255 255 255 / ${n.opacity})`, o.lineWidth = 2, o.moveTo(n.x, n.y), o.lineTo(r, i), o.stroke(), o.beginPath(), o.fillStyle = `rgb(255 255 255 / ${Math.min(1, n.opacity + .2)})`, o.arc(n.x, n.y, 1.5, 0, Math.PI * 2), o.fill();
1519
+ }));
493
1520
  };
494
- return c(), () => cancelAnimationFrame(s.current);
495
- }, [t, e]), /* @__PURE__ */ c("div", {
496
- className: B.meteorRain,
1521
+ return u(), () => {
1522
+ cancelAnimationFrame(s.current), l();
1523
+ };
1524
+ }, [t, e]), /* @__PURE__ */ l("div", {
1525
+ className: Ke.meteorRain,
497
1526
  style: {
498
1527
  width: e,
499
1528
  height: t
500
1529
  },
501
- children: /* @__PURE__ */ c("canvas", {
1530
+ children: /* @__PURE__ */ l("canvas", {
502
1531
  ref: i,
503
- className: B.canvas,
1532
+ className: Ke.canvas,
504
1533
  style: {
505
1534
  width: e,
506
1535
  height: t
507
1536
  }
508
1537
  })
509
1538
  });
510
- }, H = {
1539
+ }, I = {
511
1540
  neonText: "cos-neonText-JMP7i",
512
1541
  text: "cos-text-GTO-0",
513
1542
  flicker: "cos-flicker-nXceV",
514
1543
  "neon-flicker": "cos-neon-flicker-uDkmM",
515
1544
  reflection: "cos-reflection-aEYj6"
516
- }, U = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ l("div", {
517
- className: H.neonText,
518
- children: [/* @__PURE__ */ c("h1", {
519
- className: `${H.text} ${r ? H.flicker : ""}`,
1545
+ }, Je = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ u("div", {
1546
+ className: I.neonText,
1547
+ children: [/* @__PURE__ */ l("h1", {
1548
+ className: `${I.text} ${r ? I.flicker : ""}`,
520
1549
  style: {
521
1550
  fontSize: n,
522
1551
  "--neon-color": t
523
1552
  },
524
1553
  children: e
525
- }), /* @__PURE__ */ c("p", {
526
- className: H.reflection,
1554
+ }), /* @__PURE__ */ l("p", {
1555
+ className: I.reflection,
527
1556
  style: {
528
1557
  fontSize: n * .35,
529
1558
  color: t
530
1559
  },
531
1560
  children: e
532
1561
  })]
533
- }), W = {
1562
+ }), L = {
1563
+ newtonCradle: "cos-newtonCradle-mFl-b",
1564
+ frame: "cos-frame-pp818",
1565
+ pendulum: "cos-pendulum-mC9Bq",
1566
+ "swing-left": "cos-swing-left-Mf5fy",
1567
+ "swing-right": "cos-swing-right-gEH1F",
1568
+ string: "cos-string-UpYWC",
1569
+ ball: "cos-ball-sj82r"
1570
+ }, Ye = ({ ballCount: e = 5, color: t = "#38bdf8" }) => {
1571
+ let n = Math.max(2, Math.min(e, 7));
1572
+ return /* @__PURE__ */ l("div", {
1573
+ className: L.newtonCradle,
1574
+ style: { "--ball-color": t },
1575
+ children: /* @__PURE__ */ l("div", {
1576
+ className: L.frame,
1577
+ children: Array.from({ length: n }, (e, t) => /* @__PURE__ */ u("div", {
1578
+ className: L.pendulum,
1579
+ "data-role": t === 0 ? "left" : t === n - 1 ? "right" : "middle",
1580
+ children: [/* @__PURE__ */ l("span", { className: L.string }), /* @__PURE__ */ l("span", { className: L.ball })]
1581
+ }, t))
1582
+ })
1583
+ });
1584
+ }, R = {
1585
+ orbitalChart: "cos-orbitalChart-XLORB",
1586
+ canvas: "cos-canvas-hGVud",
1587
+ legend: "cos-legend-Np9Mm",
1588
+ swatch: "cos-swatch-xEKvA"
1589
+ }, Xe = [
1590
+ {
1591
+ label: "A",
1592
+ value: 30,
1593
+ color: "#38bdf8"
1594
+ },
1595
+ {
1596
+ label: "B",
1597
+ value: 25,
1598
+ color: "#a78bfa"
1599
+ },
1600
+ {
1601
+ label: "C",
1602
+ value: 20,
1603
+ color: "#f472b6"
1604
+ },
1605
+ {
1606
+ label: "D",
1607
+ value: 25,
1608
+ color: "#4ade80"
1609
+ }
1610
+ ], Ze = ({ data: e = Xe, size: t = 240 }) => {
1611
+ let r = o(null);
1612
+ return n(() => {
1613
+ let n = r.current;
1614
+ if (!n || e.length === 0) return;
1615
+ let i = window.devicePixelRatio || 1;
1616
+ n.width = t * i, n.height = t * i;
1617
+ let a = n.getContext("2d");
1618
+ if (!a) return;
1619
+ a.setTransform(i, 0, 0, i, 0, 0);
1620
+ let o = e.reduce((e, t) => e + t.value, 0) || 1, s = t / 2, c = t / 2, l = (t / 2 - 20) / (e.length + 1), u = 0, d = 0, f = document.hidden, p = v((e) => {
1621
+ f = e;
1622
+ }), m = () => {
1623
+ u = requestAnimationFrame(m), !f && (d += .012, a.fillStyle = "#0f172a", a.fillRect(0, 0, t, t), e.forEach((e, t) => {
1624
+ let n = l * (t + 1), r = e.value / o, i = y(Math.round(r * 12) + 1, 1, 16), u = .4 + t * .15;
1625
+ a.beginPath(), a.arc(s, c, n, 0, Math.PI * 2), a.strokeStyle = "rgb(148 163 184 / 15%)", a.lineWidth = 1, a.stroke();
1626
+ for (let t = 0; t < i; t++) {
1627
+ let r = d * u + t / i * Math.PI * 2, o = s + Math.cos(r) * n, l = c + Math.sin(r) * n;
1628
+ a.beginPath(), a.arc(o, l, 4, 0, Math.PI * 2), a.fillStyle = e.color, a.shadowColor = e.color, a.shadowBlur = 6, a.fill(), a.shadowBlur = 0;
1629
+ }
1630
+ }), a.fillStyle = "#e2e8f0", a.font = "12px system-ui", a.textAlign = "center", a.fillText(`${Math.round(e[0]?.value / o * 100) || 0}%`, s, c + 4));
1631
+ };
1632
+ return m(), () => {
1633
+ cancelAnimationFrame(u), p();
1634
+ };
1635
+ }, [e, t]), /* @__PURE__ */ u("div", {
1636
+ className: R.orbitalChart,
1637
+ style: {
1638
+ width: t,
1639
+ height: t
1640
+ },
1641
+ children: [/* @__PURE__ */ l("canvas", {
1642
+ ref: r,
1643
+ className: R.canvas,
1644
+ style: {
1645
+ width: t,
1646
+ height: t
1647
+ }
1648
+ }), /* @__PURE__ */ l("ul", {
1649
+ className: R.legend,
1650
+ children: e.map((e) => /* @__PURE__ */ u("li", { children: [
1651
+ /* @__PURE__ */ l("span", {
1652
+ className: R.swatch,
1653
+ style: { background: e.color }
1654
+ }),
1655
+ e.label,
1656
+ " (",
1657
+ e.value,
1658
+ ")"
1659
+ ] }, e.label))
1660
+ })]
1661
+ });
1662
+ }, z = {
534
1663
  particleNetwork: "cos-particleNetwork-GSZq-",
535
1664
  canvas: "cos-canvas-E-BGP",
536
1665
  hint: "cos-hint-LEO5o"
537
- }, G = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: o = 120, color: s = "#38bdf8" }) => {
538
- let u = a(null), d = a([]), f = a({
1666
+ }, Qe = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: a = 120, repelRadius: s = 150, color: c = "#38bdf8" }) => {
1667
+ let d = o(null), f = o([]), p = o({
539
1668
  x: -1e3,
540
1669
  y: -1e3
541
- }), p = t(() => {
542
- d.current = Array.from({ length: i }, () => ({
1670
+ }), m = t(() => {
1671
+ f.current = Array.from({ length: i }, () => ({
543
1672
  x: Math.random() * e,
544
1673
  y: Math.random() * r,
545
1674
  vx: (Math.random() - .5) * 1.2,
@@ -551,94 +1680,486 @@ var j = {
551
1680
  i,
552
1681
  e
553
1682
  ]);
554
- return n(() => {
555
- p();
556
- }, [p]), n(() => {
557
- let t = u.current;
1683
+ n(() => {
1684
+ m();
1685
+ }, [m]), n(() => {
1686
+ let t = d.current;
558
1687
  if (!t) return;
559
1688
  let n = window.devicePixelRatio || 1;
560
1689
  t.width = e * n, t.height = r * n;
561
1690
  let i = t.getContext("2d");
562
1691
  if (!i) return;
563
1692
  i.setTransform(n, 0, 0, n, 0, 0);
564
- let a = 0, c = () => {
1693
+ let o = 0, l = document.hidden, u = v((e) => {
1694
+ l = e;
1695
+ }), m = () => {
1696
+ if (l) {
1697
+ o = requestAnimationFrame(m);
1698
+ return;
1699
+ }
565
1700
  i.fillStyle = "#0f172a", i.fillRect(0, 0, e, r);
566
- let t = d.current, n = f.current;
1701
+ let t = f.current, n = p.current, u = s * s;
567
1702
  t.forEach((t) => {
568
1703
  t.x += t.vx, t.y += t.vy, (t.x < 0 || t.x > e) && (t.vx *= -1), (t.y < 0 || t.y > r) && (t.vy *= -1);
569
- let i = n.x - t.x, a = n.y - t.y;
570
- Math.sqrt(i * i + a * a) < 150 && (t.vx -= i * 3e-4, t.vy -= a * 3e-4);
1704
+ let i = n.x - t.x, a = n.y - t.y, o = i * i + a * a;
1705
+ if (o < u && o > 0) {
1706
+ let e = Math.sqrt(o);
1707
+ t.vx -= i / e * .15, t.vy -= a / e * .15;
1708
+ }
571
1709
  });
572
1710
  for (let e = 0; e < t.length; e++) for (let n = e + 1; n < t.length; n++) {
573
- let r = t[e].x - t[n].x, a = t[e].y - t[n].y, c = Math.sqrt(r * r + a * a);
574
- c < o && (i.beginPath(), i.moveTo(t[e].x, t[e].y), i.lineTo(t[n].x, t[n].y), i.strokeStyle = s, i.globalAlpha = 1 - c / o, i.lineWidth = .8, i.stroke(), i.globalAlpha = 1);
1711
+ let r = t[e].x - t[n].x, o = t[e].y - t[n].y, s = r * r + o * o;
1712
+ if (s < a * a) {
1713
+ let r = Math.sqrt(s);
1714
+ i.beginPath(), i.moveTo(t[e].x, t[e].y), i.lineTo(t[n].x, t[n].y), i.strokeStyle = c, i.globalAlpha = 1 - r / a, i.lineWidth = .8, i.stroke(), i.globalAlpha = 1;
1715
+ }
575
1716
  }
576
1717
  t.forEach((e) => {
577
- i.beginPath(), i.arc(e.x, e.y, e.radius, 0, Math.PI * 2), i.fillStyle = s, i.fill();
578
- }), a = requestAnimationFrame(c);
1718
+ i.beginPath(), i.arc(e.x, e.y, e.radius, 0, Math.PI * 2), i.fillStyle = c, i.fill();
1719
+ }), o = requestAnimationFrame(m);
1720
+ };
1721
+ return m(), () => {
1722
+ cancelAnimationFrame(o), u();
579
1723
  };
580
- return c(), () => cancelAnimationFrame(a);
581
1724
  }, [
1725
+ c,
1726
+ r,
1727
+ m,
1728
+ a,
582
1729
  s,
1730
+ e
1731
+ ]);
1732
+ let h = (e, t, n) => {
1733
+ p.current = {
1734
+ x: e - n.left,
1735
+ y: t - n.top
1736
+ };
1737
+ }, g = (e) => {
1738
+ h(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect());
1739
+ }, _ = (e) => {
1740
+ let t = e.touches[0];
1741
+ t && h(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
1742
+ }, y = () => {
1743
+ p.current = {
1744
+ x: -1e3,
1745
+ y: -1e3
1746
+ };
1747
+ };
1748
+ return /* @__PURE__ */ u("div", {
1749
+ className: z.particleNetwork,
1750
+ style: {
1751
+ width: e,
1752
+ height: r
1753
+ },
1754
+ children: [/* @__PURE__ */ l("canvas", {
1755
+ ref: d,
1756
+ className: z.canvas,
1757
+ style: {
1758
+ width: e,
1759
+ height: r
1760
+ },
1761
+ onMouseMove: g,
1762
+ onMouseLeave: y,
1763
+ onTouchMove: _,
1764
+ onTouchEnd: y
1765
+ }), /* @__PURE__ */ l("p", {
1766
+ className: z.hint,
1767
+ children: "移动鼠标或手指与粒子互动"
1768
+ })]
1769
+ });
1770
+ }, $e = {
1771
+ smokeFog: "cos-smokeFog-SYlts",
1772
+ canvas: "cos-canvas-iOJV7"
1773
+ }, et = ({ width: e = 800, height: t = 500, density: r = .5 }) => {
1774
+ let i = o(null), a = o([]), s = o(0);
1775
+ return n(() => {
1776
+ let n = Math.floor(20 + r * 40);
1777
+ a.current = Array.from({ length: n }, () => ({
1778
+ x: Math.random() * e,
1779
+ y: Math.random() * t,
1780
+ radius: Math.random() * 80 + 40,
1781
+ vx: (Math.random() - .5) * .4,
1782
+ vy: (Math.random() - .5) * .3 - .1,
1783
+ alpha: Math.random() * .15 + .05
1784
+ }));
1785
+ }, [
583
1786
  r,
584
- p,
585
- o,
1787
+ t,
1788
+ e
1789
+ ]), n(() => {
1790
+ let n = i.current;
1791
+ if (!n) return;
1792
+ let r = window.devicePixelRatio || 1;
1793
+ n.width = e * r, n.height = t * r;
1794
+ let o = n.getContext("2d");
1795
+ if (!o) return;
1796
+ o.setTransform(r, 0, 0, r, 0, 0);
1797
+ let c = 0, l = document.hidden, u = v((e) => {
1798
+ l = e;
1799
+ }), d = () => {
1800
+ if (s.current = requestAnimationFrame(d), l) return;
1801
+ c += .008, o.fillStyle = "#1a1a2e", o.fillRect(0, 0, e, t);
1802
+ let n = o.createRadialGradient(e * .5, t * .3, 0, e * .5, t * .5, e * .7);
1803
+ n.addColorStop(0, "#2d2d44"), n.addColorStop(1, "#1a1a2e"), o.fillStyle = n, o.fillRect(0, 0, e, t), a.current.forEach((n, r) => {
1804
+ n.x += n.vx + Math.sin(c + r) * .15, n.y += n.vy + Math.cos(c * .7 + r * .5) * .1, n.x < -n.radius && (n.x = e + n.radius), n.x > e + n.radius && (n.x = -n.radius), n.y < -n.radius && (n.y = t + n.radius), n.y > t + n.radius && (n.y = -n.radius);
1805
+ let i = o.createRadialGradient(n.x, n.y, 0, n.x, n.y, n.radius);
1806
+ i.addColorStop(0, `rgb(200 200 210 / ${n.alpha})`), i.addColorStop(.5, `rgb(160 160 175 / ${n.alpha * .5})`), i.addColorStop(1, "rgb(160 160 175 / 0)"), o.fillStyle = i, o.beginPath(), o.arc(n.x, n.y, n.radius, 0, Math.PI * 2), o.fill();
1807
+ });
1808
+ };
1809
+ return d(), () => {
1810
+ cancelAnimationFrame(s.current), u();
1811
+ };
1812
+ }, [t, e]), /* @__PURE__ */ l("div", {
1813
+ className: $e.smokeFog,
1814
+ style: {
1815
+ width: e,
1816
+ height: t
1817
+ },
1818
+ children: /* @__PURE__ */ l("canvas", {
1819
+ ref: i,
1820
+ className: $e.canvas,
1821
+ style: {
1822
+ width: e,
1823
+ height: t
1824
+ }
1825
+ })
1826
+ });
1827
+ }, tt = {
1828
+ snowfall: "cos-snowfall-Q-Dhg",
1829
+ canvas: "cos-canvas-bJVF8"
1830
+ }, nt = ({ width: e = 800, height: r = 500, mode: i = "snow", count: a = 120 }) => {
1831
+ let s = o(null), c = o([]), u = o(0), d = t((t) => ({
1832
+ x: Math.random() * e,
1833
+ y: t ?? Math.random() * r,
1834
+ size: i === "sakura" ? Math.random() * 6 + 4 : Math.random() * 3 + 1,
1835
+ speed: Math.random() * 1.5 + .5,
1836
+ drift: (Math.random() - .5) * .8,
1837
+ rotation: Math.random() * Math.PI * 2,
1838
+ rotationSpeed: (Math.random() - .5) * .04,
1839
+ opacity: Math.random() * .6 + .4
1840
+ }), [
1841
+ r,
1842
+ i,
1843
+ e
1844
+ ]);
1845
+ return n(() => {
1846
+ c.current = Array.from({ length: a }, () => d());
1847
+ }, [a, d]), n(() => {
1848
+ let t = s.current;
1849
+ if (!t) return;
1850
+ let n = window.devicePixelRatio || 1;
1851
+ t.width = e * n, t.height = r * n;
1852
+ let a = t.getContext("2d");
1853
+ if (!a) return;
1854
+ a.setTransform(n, 0, 0, n, 0, 0);
1855
+ let o = document.hidden, l = v((e) => {
1856
+ o = e;
1857
+ }), f = (e) => {
1858
+ a.globalAlpha = e.opacity, a.fillStyle = "#fff", a.beginPath(), a.arc(e.x, e.y, e.size, 0, Math.PI * 2), a.fill();
1859
+ }, p = (e) => {
1860
+ a.save(), a.translate(e.x, e.y), a.rotate(e.rotation), a.globalAlpha = e.opacity;
1861
+ let t = e.size;
1862
+ a.fillStyle = "#ffb7c5", a.beginPath(), a.ellipse(0, 0, t, t * .6, 0, 0, Math.PI * 2), a.fill(), a.fillStyle = "#ff8fa3", a.beginPath(), a.ellipse(t * .3, 0, t * .5, t * .35, .5, 0, Math.PI * 2), a.fill(), a.restore();
1863
+ }, m = () => {
1864
+ u.current = requestAnimationFrame(m), !o && (a.fillStyle = i === "sakura" ? "#1a1020" : "#0f172a", a.fillRect(0, 0, e, r), c.current.forEach((e) => {
1865
+ e.y += e.speed, e.x += e.drift + Math.sin(e.y * .02) * .3, e.rotation += e.rotationSpeed, e.y > r + 10 && Object.assign(e, d(-10)), i === "sakura" ? p(e) : f(e);
1866
+ }), a.globalAlpha = 1);
1867
+ };
1868
+ return m(), () => {
1869
+ cancelAnimationFrame(u.current), l();
1870
+ };
1871
+ }, [
1872
+ d,
1873
+ r,
1874
+ i,
586
1875
  e
587
1876
  ]), /* @__PURE__ */ l("div", {
588
- className: W.particleNetwork,
1877
+ className: tt.snowfall,
589
1878
  style: {
590
1879
  width: e,
591
1880
  height: r
592
1881
  },
593
- children: [/* @__PURE__ */ c("canvas", {
594
- ref: u,
595
- className: W.canvas,
1882
+ children: /* @__PURE__ */ l("canvas", {
1883
+ ref: s,
1884
+ className: tt.canvas,
596
1885
  style: {
597
1886
  width: e,
598
1887
  height: r
599
- },
600
- onMouseMove: (e) => {
601
- let t = e.currentTarget.getBoundingClientRect();
602
- f.current = {
603
- x: e.clientX - t.left,
604
- y: e.clientY - t.top
605
- };
606
- },
607
- onMouseLeave: () => {
608
- f.current = {
609
- x: -1e3,
610
- y: -1e3
611
- };
612
1888
  }
613
- }), /* @__PURE__ */ c("p", {
614
- className: W.hint,
615
- children: "移动鼠标与粒子互动"
616
- })]
1889
+ })
617
1890
  });
618
- }, K = {
1891
+ }, rt = {
1892
+ starfield: "cos-starfield-QTwia",
1893
+ canvas: "cos-canvas-C2t3g"
1894
+ }, it = ({ width: e = 800, height: t = 500, starCount: r = 400, speed: i = 1 }) => {
1895
+ let a = o(null), s = o([]), c = o(0);
1896
+ return n(() => {
1897
+ s.current = Array.from({ length: r }, () => ({
1898
+ x: (Math.random() - .5) * e,
1899
+ y: (Math.random() - .5) * t,
1900
+ z: Math.random() * e
1901
+ }));
1902
+ }, [
1903
+ t,
1904
+ r,
1905
+ e
1906
+ ]), n(() => {
1907
+ let n = a.current;
1908
+ if (!n) return;
1909
+ let r = window.devicePixelRatio || 1;
1910
+ n.width = e * r, n.height = t * r;
1911
+ let o = n.getContext("2d");
1912
+ if (!o) return;
1913
+ o.setTransform(r, 0, 0, r, 0, 0);
1914
+ let l = e / 2, u = t / 2, d = document.hidden, f = v((e) => {
1915
+ d = e;
1916
+ }), p = () => {
1917
+ c.current = requestAnimationFrame(p), !d && (o.fillStyle = "rgb(0 0 0 / 25%)", o.fillRect(0, 0, e, t), s.current.forEach((n) => {
1918
+ n.z -= i * 2, n.z <= 0 && (n.x = (Math.random() - .5) * e, n.y = (Math.random() - .5) * t, n.z = e);
1919
+ let r = 128 / n.z, a = n.x * r + l, s = n.y * r + u;
1920
+ if (a < 0 || a >= e || s < 0 || s >= t) return;
1921
+ let c = (1 - n.z / e) * 3, d = (1 - n.z / e) * 255;
1922
+ if (c > .5) {
1923
+ let e = 128 / (n.z + i * 4), t = n.x * e + l, r = n.y * e + u;
1924
+ o.beginPath(), o.strokeStyle = `rgb(${d} ${d} ${d + 30})`, o.lineWidth = c, o.moveTo(t, r), o.lineTo(a, s), o.stroke();
1925
+ } else o.fillStyle = `rgb(${d} ${d} ${d + 30})`, o.fillRect(a, s, c, c);
1926
+ }));
1927
+ };
1928
+ return p(), () => {
1929
+ cancelAnimationFrame(c.current), f();
1930
+ };
1931
+ }, [
1932
+ t,
1933
+ i,
1934
+ r,
1935
+ e
1936
+ ]), /* @__PURE__ */ l("div", {
1937
+ className: rt.starfield,
1938
+ style: {
1939
+ width: e,
1940
+ height: t
1941
+ },
1942
+ children: /* @__PURE__ */ l("canvas", {
1943
+ ref: a,
1944
+ className: rt.canvas,
1945
+ style: {
1946
+ width: e,
1947
+ height: t
1948
+ }
1949
+ })
1950
+ });
1951
+ }, B = {
1952
+ progressChest: "cos-progressChest-Bqcv1",
1953
+ barWrap: "cos-barWrap-E2pnl",
1954
+ barTrack: "cos-barTrack-dKLhs",
1955
+ barFill: "cos-barFill-NZJJe",
1956
+ pct: "cos-pct-D91IU",
1957
+ chest: "cos-chest-YebJO",
1958
+ lid: "cos-lid-K4GSD",
1959
+ open: "cos-open-eWo0Y",
1960
+ lidTop: "cos-lidTop-N-p2g",
1961
+ lock: "cos-lock--0AaQ",
1962
+ body: "cos-body-iqUt3",
1963
+ treasure: "cos-treasure-nx-6S",
1964
+ pop: "cos-pop-uRZvT",
1965
+ label: "cos-label-61hRe"
1966
+ }, at = ({ progress: e = 0, onOpen: t, label: r = "开启宝箱" }) => {
1967
+ let i = o(!1), a = y(e, 0, 100), s = a >= 100;
1968
+ return n(() => {
1969
+ s && !i.current && (i.current = !0, t?.()), s || (i.current = !1);
1970
+ }, [s, t]), /* @__PURE__ */ u("div", {
1971
+ className: B.progressChest,
1972
+ children: [
1973
+ /* @__PURE__ */ u("div", {
1974
+ className: B.barWrap,
1975
+ children: [/* @__PURE__ */ l("div", {
1976
+ className: B.barTrack,
1977
+ children: /* @__PURE__ */ l("div", {
1978
+ className: B.barFill,
1979
+ style: { width: `${a}%` }
1980
+ })
1981
+ }), /* @__PURE__ */ u("span", {
1982
+ className: B.pct,
1983
+ children: [a.toFixed(0), "%"]
1984
+ })]
1985
+ }),
1986
+ /* @__PURE__ */ u("div", {
1987
+ className: `${B.chest} ${s ? B.open : ""}`,
1988
+ children: [/* @__PURE__ */ u("div", {
1989
+ className: B.lid,
1990
+ children: [/* @__PURE__ */ l("div", { className: B.lidTop }), /* @__PURE__ */ l("div", { className: B.lock })]
1991
+ }), /* @__PURE__ */ l("div", {
1992
+ className: B.body,
1993
+ children: s && /* @__PURE__ */ u("div", {
1994
+ className: B.treasure,
1995
+ children: [
1996
+ /* @__PURE__ */ l("span", { children: "💎" }),
1997
+ /* @__PURE__ */ l("span", { children: "✨" }),
1998
+ /* @__PURE__ */ l("span", { children: "🪙" })
1999
+ ]
2000
+ })
2001
+ })]
2002
+ }),
2003
+ /* @__PURE__ */ l("p", {
2004
+ className: B.label,
2005
+ children: s ? "宝箱已开启!" : r
2006
+ })
2007
+ ]
2008
+ });
2009
+ }, ot = {
2010
+ radarScan: "cos-radarScan-PZaG8",
2011
+ canvas: "cos-canvas-fUw5N"
2012
+ }, st = ({ size: e = 300, color: t = "#22d3ee", blipCount: r = 5 }) => {
2013
+ let i = o(null), a = o(0), s = o([]), c = o(0);
2014
+ return n(() => {
2015
+ s.current = Array.from({ length: r }, () => ({
2016
+ angle: Math.random() * Math.PI * 2,
2017
+ dist: Math.random() * .7 + .15,
2018
+ alpha: Math.random() * .5 + .5
2019
+ }));
2020
+ }, [r]), n(() => {
2021
+ let n = i.current;
2022
+ if (!n) return;
2023
+ let r = window.devicePixelRatio || 1;
2024
+ n.width = e * r, n.height = e * r;
2025
+ let o = n.getContext("2d");
2026
+ if (!o) return;
2027
+ o.setTransform(r, 0, 0, r, 0, 0);
2028
+ let l = e / 2, u = e / 2, d = e / 2 - 10, f = document.hidden, p = v((e) => {
2029
+ f = e;
2030
+ }), m = () => {
2031
+ if (c.current = requestAnimationFrame(m), f) return;
2032
+ a.current += .03, o.fillStyle = "rgb(15 23 42 / 25%)", o.fillRect(0, 0, e, e);
2033
+ for (let e = 1; e <= 4; e++) o.beginPath(), o.arc(l, u, d / 4 * e, 0, Math.PI * 2), o.strokeStyle = `${t}33`, o.lineWidth = 1, o.stroke();
2034
+ o.beginPath(), o.moveTo(l, u - d), o.lineTo(l, u + d), o.moveTo(l - d, u), o.lineTo(l + d, u), o.strokeStyle = `${t}44`, o.stroke();
2035
+ let n = a.current, r = o.createConicGradient(n - .5, l, u);
2036
+ r.addColorStop(0, "transparent"), r.addColorStop(.15, `${t}66`), r.addColorStop(.3, "transparent"), o.beginPath(), o.moveTo(l, u), o.arc(l, u, d, n - .5, n), o.closePath(), o.fillStyle = r, o.fill(), o.beginPath(), o.moveTo(l, u), o.lineTo(l + Math.cos(n) * d, u + Math.sin(n) * d), o.strokeStyle = t, o.lineWidth = 2, o.stroke(), s.current.forEach((e) => {
2037
+ let r = e.angle, i = l + Math.cos(r) * d * e.dist, a = u + Math.sin(r) * d * e.dist;
2038
+ Math.abs((n - r + Math.PI) % (Math.PI * 2) - Math.PI) < .3 ? e.alpha = Math.min(1, e.alpha + .05) : e.alpha = Math.max(.2, e.alpha - .01), o.beginPath(), o.arc(i, a, 4, 0, Math.PI * 2), o.fillStyle = t, o.globalAlpha = e.alpha, o.fill(), o.globalAlpha = 1;
2039
+ }), o.beginPath(), o.arc(l, u, d, 0, Math.PI * 2), o.strokeStyle = t, o.lineWidth = 2, o.stroke();
2040
+ };
2041
+ return m(), () => {
2042
+ cancelAnimationFrame(c.current), p();
2043
+ };
2044
+ }, [
2045
+ r,
2046
+ t,
2047
+ e
2048
+ ]), /* @__PURE__ */ l("div", {
2049
+ className: ot.radarScan,
2050
+ style: {
2051
+ width: e,
2052
+ height: e
2053
+ },
2054
+ children: /* @__PURE__ */ l("canvas", {
2055
+ ref: i,
2056
+ className: ot.canvas,
2057
+ style: {
2058
+ width: e,
2059
+ height: e
2060
+ }
2061
+ })
2062
+ });
2063
+ }, V = {
2064
+ redPacketRain: "cos-redPacketRain-eJ7FW",
2065
+ canvas: "cos-canvas-direH",
2066
+ hud: "cos-hud-InqMq",
2067
+ end: "cos-end-u0J7o",
2068
+ hint: "cos-hint-sO6ld"
2069
+ }, ct = ({ duration: e = 1e4, onGrab: r }) => {
2070
+ let i = o(null), a = o([]), c = o(0), d = o(0), f = o(0), [p, m] = s(0), [h, g] = s(!0), _ = t(() => {
2071
+ a.current.push({
2072
+ id: d.current++,
2073
+ x: Math.random() * 350 + 25,
2074
+ y: -60,
2075
+ speed: Math.random() * 2 + 2,
2076
+ rotation: (Math.random() - .5) * .1,
2077
+ amount: [
2078
+ 1,
2079
+ 2,
2080
+ 5,
2081
+ 8,
2082
+ 10,
2083
+ 18,
2084
+ 66,
2085
+ 88
2086
+ ][Math.floor(Math.random() * 8)],
2087
+ grabbed: !1
2088
+ });
2089
+ }, []);
2090
+ return n(() => {
2091
+ let t = i.current;
2092
+ if (!t) return;
2093
+ let n = window.devicePixelRatio || 1;
2094
+ t.width = 400 * n, t.height = 500 * n;
2095
+ let r = t.getContext("2d");
2096
+ if (!r) return;
2097
+ r.setTransform(n, 0, 0, n, 0, 0);
2098
+ let o = document.hidden, s = v((e) => {
2099
+ o = e;
2100
+ }), l = window.setTimeout(() => g(!1), e), u = () => {
2101
+ c.current = requestAnimationFrame(u), !o && (f.current++, h && f.current % 20 == 0 && _(), r.fillStyle = "rgb(15 23 42 / 20%)", r.fillRect(0, 0, 400, 500), a.current = a.current.filter((e) => e.grabbed ? !1 : (e.y += e.speed, e.x += Math.sin(e.y * .02) * .5, r.save(), r.translate(e.x, e.y), r.rotate(e.rotation), r.fillStyle = "#dc2626", r.beginPath(), r.roundRect(-22, -28, 44, 56, 6), r.fill(), r.fillStyle = "#fbbf24", r.beginPath(), r.arc(0, -10, 8, 0, Math.PI * 2), r.fill(), r.fillStyle = "#fde68a", r.font = "bold 12px system-ui", r.textAlign = "center", r.fillText(`¥${e.amount}`, 0, 12), r.restore(), e.y < 560)));
2102
+ };
2103
+ return u(), () => {
2104
+ cancelAnimationFrame(c.current), clearTimeout(l), s();
2105
+ };
2106
+ }, [
2107
+ h,
2108
+ e,
2109
+ _
2110
+ ]), /* @__PURE__ */ u("div", {
2111
+ className: V.redPacketRain,
2112
+ children: [
2113
+ /* @__PURE__ */ l("canvas", {
2114
+ ref: i,
2115
+ className: V.canvas,
2116
+ style: {
2117
+ width: 400,
2118
+ height: 500
2119
+ },
2120
+ onClick: (e) => {
2121
+ let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, i = e.clientY - t.top, o = !1;
2122
+ a.current = a.current.map((e) => e.grabbed || o ? e : Math.abs(n - e.x) < 30 && Math.abs(i - e.y) < 35 ? (o = !0, m((t) => t + e.amount), r?.(e.amount), {
2123
+ ...e,
2124
+ grabbed: !0
2125
+ }) : e);
2126
+ }
2127
+ }),
2128
+ /* @__PURE__ */ u("div", {
2129
+ className: V.hud,
2130
+ children: [/* @__PURE__ */ u("span", { children: ["已抢: ¥", p] }), !h && /* @__PURE__ */ l("span", {
2131
+ className: V.end,
2132
+ children: "红包雨结束"
2133
+ })]
2134
+ }),
2135
+ /* @__PURE__ */ l("p", {
2136
+ className: V.hint,
2137
+ children: "点击红包抢夺"
2138
+ })
2139
+ ]
2140
+ });
2141
+ }, H = {
619
2142
  returnCityContainer: "cos-returnCityContainer-6XTxj",
620
2143
  star: "cos-star-a59Dx",
621
2144
  glassWrap: "cos-glassWrap-golMO",
622
2145
  rotate: "cos-rotate-7X9Jj",
623
2146
  glassItem: "cos-glassItem-OwlFI"
624
- }, q = ({ starCount: e, glassCount: t = 6, glassRadius: r = 150 }) => {
625
- let i = a(null), o = a(null);
2147
+ }, lt = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
2148
+ let i = o(null), a = o(null);
626
2149
  return n(() => {
627
- let n = i.current, a = o.current;
628
- if (!n || !a) return;
629
- let s = [], c = [], l = [], u = e ?? Math.floor(document.documentElement.clientWidth / 20);
630
- for (let e = 0; e < u; e++) {
2150
+ let n = i.current, o = a.current;
2151
+ if (!n || !o) return;
2152
+ let s = [], c = [], l = [], { width: u, height: d } = n.getBoundingClientRect(), f = e ?? Math.max(20, Math.floor(u / 20));
2153
+ for (let e = 0; e < f; e++) {
631
2154
  let e = window.setTimeout(() => {
632
2155
  let e = document.createElement("div");
633
- e.className = K.star;
634
- let t = document.body.clientWidth, r = document.body.clientHeight;
635
- e.style.top = `${Math.random() * r}px`, e.style.left = `${Math.random() * t}px`, n.append(e), c.push(e);
2156
+ e.className = H.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
636
2157
  }, Math.random() * 2e3);
637
2158
  s.push(e);
638
2159
  }
639
2160
  for (let e = 0; e < t; e++) {
640
2161
  let n = document.createElement("div");
641
- n.className = K.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, a.appendChild(n), l.push(n);
2162
+ n.className = H.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, o.appendChild(n), l.push(n);
642
2163
  let i = window.setTimeout(() => {
643
2164
  n.style.top = "0px", n.style.opacity = "1";
644
2165
  }, e * 300);
@@ -651,15 +2172,486 @@ var j = {
651
2172
  e,
652
2173
  t,
653
2174
  r
654
- ]), /* @__PURE__ */ c("div", {
2175
+ ]), /* @__PURE__ */ l("div", {
655
2176
  ref: i,
656
- className: K.returnCityContainer,
657
- children: /* @__PURE__ */ c("div", {
658
- ref: o,
659
- className: K.glassWrap
2177
+ className: H.returnCityContainer,
2178
+ children: /* @__PURE__ */ l("div", {
2179
+ ref: a,
2180
+ className: H.glassWrap
2181
+ })
2182
+ });
2183
+ }, U = {
2184
+ speedometer: "cos-speedometer-INc7F",
2185
+ svg: "cos-svg-HG-lE",
2186
+ track: "cos-track-5-922",
2187
+ valueArc: "cos-valueArc-eJn3E",
2188
+ tick: "cos-tick-vaiJh",
2189
+ needle: "cos-needle-PwRAD",
2190
+ hub: "cos-hub-4WaHw",
2191
+ valueText: "cos-valueText--q4Xi",
2192
+ label: "cos-label-hOPy1"
2193
+ }, W = (e, t, n, r) => {
2194
+ let i = (r - 90) * Math.PI / 180;
2195
+ return {
2196
+ x: e + n * Math.cos(i),
2197
+ y: t + n * Math.sin(i)
2198
+ };
2199
+ }, ut = ({ value: e = 0, max: t = 100, label: n = "SPEED", color: r = "#f97316" }) => {
2200
+ let i = -120 + y(t > 0 ? e / t : 0, 0, 1) * 240, o = a(() => {
2201
+ let e = W(100, 100, 72, -120), t = W(100, 100, 72, 120);
2202
+ return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
2203
+ }, []), s = a(() => {
2204
+ let e = W(100, 100, 72, -120), t = W(100, 100, 72, i), n = +(i - -120 > 180);
2205
+ return `M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`;
2206
+ }, [i]), c = W(100, 100, 58, i);
2207
+ return /* @__PURE__ */ u("div", {
2208
+ className: U.speedometer,
2209
+ style: { "--gauge-color": r },
2210
+ children: [/* @__PURE__ */ u("svg", {
2211
+ viewBox: "0 0 200 130",
2212
+ className: U.svg,
2213
+ children: [
2214
+ /* @__PURE__ */ l("path", {
2215
+ d: o,
2216
+ className: U.track,
2217
+ fill: "none",
2218
+ strokeWidth: "12",
2219
+ strokeLinecap: "round"
2220
+ }),
2221
+ /* @__PURE__ */ l("path", {
2222
+ d: s,
2223
+ className: U.valueArc,
2224
+ fill: "none",
2225
+ strokeWidth: "12",
2226
+ strokeLinecap: "round"
2227
+ }),
2228
+ [
2229
+ -120,
2230
+ -60,
2231
+ 0,
2232
+ 60,
2233
+ 120
2234
+ ].map((e) => {
2235
+ let t = W(100, 100, 58, e), n = W(100, 100, 66, e);
2236
+ return /* @__PURE__ */ l("line", {
2237
+ x1: t.x,
2238
+ y1: t.y,
2239
+ x2: n.x,
2240
+ y2: n.y,
2241
+ className: U.tick
2242
+ }, e);
2243
+ }),
2244
+ /* @__PURE__ */ l("line", {
2245
+ x1: "100",
2246
+ y1: "100",
2247
+ x2: c.x,
2248
+ y2: c.y,
2249
+ className: U.needle
2250
+ }),
2251
+ /* @__PURE__ */ l("circle", {
2252
+ cx: "100",
2253
+ cy: "100",
2254
+ r: "6",
2255
+ className: U.hub
2256
+ }),
2257
+ /* @__PURE__ */ l("text", {
2258
+ x: "100",
2259
+ y: "118",
2260
+ className: U.valueText,
2261
+ children: Math.round(e)
2262
+ })
2263
+ ]
2264
+ }), /* @__PURE__ */ l("span", {
2265
+ className: U.label,
2266
+ children: n
2267
+ })]
2268
+ });
2269
+ }, G = {
2270
+ timelinePulse: "cos-timelinePulse-kcBM6",
2271
+ axis: "cos-axis-9DWis",
2272
+ track: "cos-track-jG-HV",
2273
+ progress: "cos-progress-gf7v1",
2274
+ steps: "cos-steps-Z-40O",
2275
+ step: "cos-step-UO2Ux",
2276
+ dot: "cos-dot-HJEVy",
2277
+ pulse: "cos-pulse-N6FD1",
2278
+ name: "cos-name-7zefJ"
2279
+ }, dt = ({ steps: e = [
2280
+ "Start",
2281
+ "Process",
2282
+ "Review",
2283
+ "Done"
2284
+ ], current: t = 0, color: n = "#22d3ee" }) => {
2285
+ let r = y(t, 0, Math.max(0, e.length - 1)), i = e.length > 1 ? r / (e.length - 1) : 0;
2286
+ return /* @__PURE__ */ l("div", {
2287
+ className: G.timelinePulse,
2288
+ style: {
2289
+ "--pulse-color": n,
2290
+ "--step-count": e.length,
2291
+ "--progress-ratio": i
2292
+ },
2293
+ children: /* @__PURE__ */ u("div", {
2294
+ className: G.axis,
2295
+ children: [
2296
+ /* @__PURE__ */ l("div", { className: G.track }),
2297
+ /* @__PURE__ */ l("div", { className: G.progress }),
2298
+ /* @__PURE__ */ l("ul", {
2299
+ className: G.steps,
2300
+ children: e.map((e, t) => {
2301
+ let n = t < r ? "done" : t === r ? "current" : "pending";
2302
+ return /* @__PURE__ */ u("li", {
2303
+ className: G.step,
2304
+ "data-state": n,
2305
+ children: [/* @__PURE__ */ l("span", { className: G.dot }), /* @__PURE__ */ l("span", {
2306
+ className: G.name,
2307
+ children: e
2308
+ })]
2309
+ }, e + t);
2310
+ })
2311
+ })
2312
+ ]
2313
+ })
2314
+ });
2315
+ }, K = {
2316
+ rippleWater: "cos-rippleWater-wsinI",
2317
+ canvas: "cos-canvas-XOdSF",
2318
+ hint: "cos-hint-0JH5D"
2319
+ }, ft = ({ width: e = 800, height: r = 500, color: i = "#38bdf8" }) => {
2320
+ let a = o(null), s = o([]), c = o(0), d = t((t, n) => {
2321
+ let i = a.current;
2322
+ if (!i) return;
2323
+ let o = i.getBoundingClientRect(), c = t - o.left, l = n - o.top, u = Math.max(e, r) * .45;
2324
+ s.current.push({
2325
+ x: c,
2326
+ y: l,
2327
+ radius: 0,
2328
+ maxRadius: u,
2329
+ alpha: .7
2330
+ });
2331
+ }, [r, e]);
2332
+ return n(() => {
2333
+ let e = a.current;
2334
+ if (!e) return;
2335
+ let t = (e) => d(e.clientX, e.clientY), n = (e) => {
2336
+ let t = e.touches[0];
2337
+ t && d(t.clientX, t.clientY);
2338
+ };
2339
+ return e.addEventListener("click", t), e.addEventListener("touchstart", n, { passive: !0 }), () => {
2340
+ e.removeEventListener("click", t), e.removeEventListener("touchstart", n);
2341
+ };
2342
+ }, [d]), n(() => {
2343
+ let t = a.current;
2344
+ if (!t) return;
2345
+ let n = window.devicePixelRatio || 1;
2346
+ t.width = e * n, t.height = r * n;
2347
+ let o = t.getContext("2d");
2348
+ if (!o) return;
2349
+ o.setTransform(n, 0, 0, n, 0, 0);
2350
+ let l = document.hidden, u = v((e) => {
2351
+ l = e;
2352
+ }), d = () => {
2353
+ if (c.current = requestAnimationFrame(d), l) return;
2354
+ o.fillStyle = "#0c1929", o.fillRect(0, 0, e, r);
2355
+ let t = o.createLinearGradient(0, 0, 0, r);
2356
+ t.addColorStop(0, "#0f2744"), t.addColorStop(1, "#061018"), o.fillStyle = t, o.fillRect(0, 0, e, r), s.current = s.current.filter((e) => (e.radius += 2.5, e.alpha -= .012, e.alpha <= 0 ? !1 : (o.beginPath(), o.arc(e.x, e.y, e.radius, 0, Math.PI * 2), o.strokeStyle = i, o.globalAlpha = e.alpha * (1 - e.radius / e.maxRadius), o.lineWidth = 2, o.stroke(), e.radius > 8 && (o.beginPath(), o.arc(e.x, e.y, e.radius * .6, 0, Math.PI * 2), o.strokeStyle = i, o.globalAlpha = e.alpha * .4, o.lineWidth = 1, o.stroke()), o.globalAlpha = 1, !0)));
2357
+ };
2358
+ return d(), () => {
2359
+ cancelAnimationFrame(c.current), u();
2360
+ };
2361
+ }, [
2362
+ i,
2363
+ r,
2364
+ e
2365
+ ]), /* @__PURE__ */ u("div", {
2366
+ className: K.rippleWater,
2367
+ style: {
2368
+ width: e,
2369
+ height: r
2370
+ },
2371
+ children: [/* @__PURE__ */ l("canvas", {
2372
+ ref: a,
2373
+ className: K.canvas,
2374
+ style: {
2375
+ width: e,
2376
+ height: r
2377
+ }
2378
+ }), /* @__PURE__ */ l("span", {
2379
+ className: K.hint,
2380
+ children: "点击水面产生涟漪"
2381
+ })]
2382
+ });
2383
+ }, q = {
2384
+ scrambleText: "cos-scrambleText-hN4Wm",
2385
+ text: "cos-text-frsHs",
2386
+ cursor: "cos-cursor-3zQOy",
2387
+ blink: "cos-blink-OcKXu"
2388
+ }, pt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", mt = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = pt }) => {
2389
+ let [i, a] = s(""), c = o(0), d = o(0);
2390
+ return n(() => {
2391
+ let n = r.length > 0 ? r : pt, i = e;
2392
+ d.current = performance.now();
2393
+ let o = (e) => {
2394
+ let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
2395
+ a(i.split("").map((e, t) => e === " " ? " " : t < l ? e : n[Math.floor(Math.random() * n.length)]).join("")), s < 1 ? c.current = requestAnimationFrame(o) : a(i);
2396
+ };
2397
+ return c.current = requestAnimationFrame(o), () => cancelAnimationFrame(c.current);
2398
+ }, [
2399
+ e,
2400
+ t,
2401
+ r
2402
+ ]), /* @__PURE__ */ l("div", {
2403
+ className: q.scrambleText,
2404
+ children: /* @__PURE__ */ u("p", {
2405
+ className: q.text,
2406
+ children: [i, /* @__PURE__ */ l("span", { className: q.cursor })]
660
2407
  })
661
2408
  });
662
2409
  }, J = {
2410
+ scratchCard: "cos-scratchCard-McIEK",
2411
+ prize: "cos-prize-X0z5V",
2412
+ canvas: "cos-canvas-JqIlr",
2413
+ hidden: "cos-hidden-Lsfbt"
2414
+ }, ht = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
2415
+ let d = o(null), f = o(!1), p = o(!1), [m, h] = s(!1), g = t((t) => {
2416
+ t.globalCompositeOperation = "source-over", t.fillStyle = e, t.fillRect(0, 0, a, c), t.fillStyle = "rgb(255 255 255 / 30%)", t.font = "bold 16px system-ui, sans-serif", t.textAlign = "center", t.fillText("刮开涂层", a / 2, c / 2);
2417
+ }, [
2418
+ e,
2419
+ c,
2420
+ a
2421
+ ]), _ = t((e) => {
2422
+ if (p.current) return;
2423
+ let t = e.getImageData(0, 0, a, c), n = 0;
2424
+ for (let e = 3; e < t.data.length; e += 4) t.data[e] < 128 && n++;
2425
+ n / (a * c) > .45 && (p.current = !0, h(!0), i?.());
2426
+ }, [
2427
+ c,
2428
+ i,
2429
+ a
2430
+ ]);
2431
+ n(() => {
2432
+ let e = d.current;
2433
+ if (!e) return;
2434
+ let t = window.devicePixelRatio || 1;
2435
+ e.width = a * t, e.height = c * t;
2436
+ let n = e.getContext("2d");
2437
+ n && (n.setTransform(t, 0, 0, t, 0, 0), g(n));
2438
+ }, [
2439
+ g,
2440
+ c,
2441
+ a
2442
+ ]);
2443
+ let v = (e, t) => {
2444
+ let n = d.current;
2445
+ if (!n || p.current) return;
2446
+ let r = n.getContext("2d");
2447
+ r && (r.globalCompositeOperation = "destination-out", r.beginPath(), r.arc(e, t, 20, 0, Math.PI * 2), r.fill(), _(r));
2448
+ }, y = (e) => {
2449
+ let t = d.current;
2450
+ if (!t) return null;
2451
+ let n = t.getBoundingClientRect();
2452
+ if ("touches" in e) {
2453
+ let t = e.touches[0];
2454
+ return {
2455
+ x: t.clientX - n.left,
2456
+ y: t.clientY - n.top
2457
+ };
2458
+ }
2459
+ return {
2460
+ x: e.clientX - n.left,
2461
+ y: e.clientY - n.top
2462
+ };
2463
+ }, b = (e) => {
2464
+ f.current = !0;
2465
+ let t = y(e);
2466
+ t && v(t.x, t.y);
2467
+ }, x = (e) => {
2468
+ if (!f.current) return;
2469
+ let t = y(e);
2470
+ t && v(t.x, t.y);
2471
+ }, S = () => {
2472
+ f.current = !1;
2473
+ };
2474
+ return /* @__PURE__ */ u("div", {
2475
+ className: J.scratchCard,
2476
+ style: {
2477
+ width: a,
2478
+ height: c
2479
+ },
2480
+ children: [/* @__PURE__ */ l("div", {
2481
+ className: J.prize,
2482
+ children: r
2483
+ }), /* @__PURE__ */ l("canvas", {
2484
+ ref: d,
2485
+ className: `${J.canvas} ${m ? J.hidden : ""}`,
2486
+ style: {
2487
+ width: a,
2488
+ height: c
2489
+ },
2490
+ onMouseDown: b,
2491
+ onMouseMove: x,
2492
+ onMouseUp: S,
2493
+ onMouseLeave: S,
2494
+ onTouchStart: b,
2495
+ onTouchMove: x,
2496
+ onTouchEnd: S
2497
+ })]
2498
+ });
2499
+ }, Y = {
2500
+ slotMachine: "cos-slotMachine-P6FyZ",
2501
+ machine: "cos-machine-B066r",
2502
+ reel: "cos-reel-eEpJ3",
2503
+ strip: "cos-strip-L5Z-a",
2504
+ item: "cos-item-WYJ6q",
2505
+ mask: "cos-mask-jdrj3",
2506
+ spinBtn: "cos-spinBtn-DvDE7",
2507
+ result: "cos-result-dLN5b"
2508
+ }, gt = [
2509
+ "🍒",
2510
+ "🍋",
2511
+ "🍊",
2512
+ "🍇",
2513
+ "⭐",
2514
+ "7️⃣"
2515
+ ], _t = (e) => 1 - (1 - e) ** 3, vt = ({ symbols: e = gt, onSpinEnd: r }) => {
2516
+ let [i, a] = s(!1), [c, d] = s([
2517
+ 0,
2518
+ 0,
2519
+ 0
2520
+ ]), [f, p] = s([]), m = o([
2521
+ 0,
2522
+ 0,
2523
+ 0
2524
+ ]), h = t(() => {
2525
+ let t = [];
2526
+ for (let n = 0; n < 20; n++) t.push(...e);
2527
+ return t;
2528
+ }, [e])();
2529
+ return n(() => {
2530
+ let e = m.current;
2531
+ return () => {
2532
+ e.forEach((e) => cancelAnimationFrame(e));
2533
+ };
2534
+ }, []), /* @__PURE__ */ u("div", {
2535
+ className: Y.slotMachine,
2536
+ children: [
2537
+ /* @__PURE__ */ l("div", {
2538
+ className: Y.machine,
2539
+ children: [
2540
+ 0,
2541
+ 1,
2542
+ 2
2543
+ ].map((e) => /* @__PURE__ */ u("div", {
2544
+ className: Y.reel,
2545
+ style: { height: 240 },
2546
+ children: [/* @__PURE__ */ l("div", {
2547
+ className: Y.strip,
2548
+ style: { transform: `translateY(${c[e]}px)` },
2549
+ children: h.map((e, t) => /* @__PURE__ */ l("div", {
2550
+ className: Y.item,
2551
+ style: { height: 80 },
2552
+ children: e
2553
+ }, t))
2554
+ }), /* @__PURE__ */ l("div", { className: Y.mask })]
2555
+ }, e))
2556
+ }),
2557
+ /* @__PURE__ */ l("button", {
2558
+ type: "button",
2559
+ className: Y.spinBtn,
2560
+ onClick: () => {
2561
+ if (i) return;
2562
+ a(!0), p([]);
2563
+ let t = [
2564
+ 0,
2565
+ 1,
2566
+ 2
2567
+ ].map(() => Math.floor(Math.random() * e.length)), n = t.map((t) => -(t + e.length * 10) * 80), o = [...c], s = [
2568
+ 0,
2569
+ 300,
2570
+ 600
2571
+ ], l = performance.now(), u = 0;
2572
+ [
2573
+ 0,
2574
+ 1,
2575
+ 2
2576
+ ].forEach((i) => {
2577
+ let c = s[i], f = (s) => {
2578
+ let h = s - l - c;
2579
+ if (h < 0) {
2580
+ m.current[i] = requestAnimationFrame(f);
2581
+ return;
2582
+ }
2583
+ let g = Math.min(h / 2e3, 1), _ = _t(g), v = o[i] + (n[i] - o[i]) * _;
2584
+ if (d((e) => {
2585
+ let t = [...e];
2586
+ return t[i] = v, t;
2587
+ }), g < 1) m.current[i] = requestAnimationFrame(f);
2588
+ else if (u++, u === 3) {
2589
+ let n = t.map((t) => e[t]);
2590
+ p(n), a(!1), r?.(n);
2591
+ }
2592
+ };
2593
+ m.current[i] = requestAnimationFrame(f);
2594
+ });
2595
+ },
2596
+ disabled: i,
2597
+ children: i ? "旋转中..." : "开始"
2598
+ }),
2599
+ f.length > 0 && !i && /* @__PURE__ */ l("p", {
2600
+ className: Y.result,
2601
+ children: f[0] === f[1] && f[1] === f[2] ? "🎰 大奖!" : `结果: ${f.join(" ")}`
2602
+ })
2603
+ ]
2604
+ });
2605
+ }, X = {
2606
+ splitReveal: "cos-splitReveal-6W8-6",
2607
+ text: "cos-text-miTsj",
2608
+ char: "cos-char-0gPJV",
2609
+ reveal: "cos-reveal-YGzz-",
2610
+ fromTop: "cos-fromTop-YXHUa",
2611
+ fromBottom: "cos-fromBottom-24D6g",
2612
+ fromLeft: "cos-fromLeft-OMiPY",
2613
+ fromRight: "cos-fromRight-EcMOR"
2614
+ }, yt = [
2615
+ "fromTop",
2616
+ "fromBottom",
2617
+ "fromLeft",
2618
+ "fromRight"
2619
+ ], bt = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
2620
+ className: X.splitReveal,
2621
+ children: /* @__PURE__ */ l("h1", {
2622
+ className: X.text,
2623
+ style: { "--reveal-color": n },
2624
+ children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
2625
+ className: `${X.char} ${X[yt[n % yt.length]]}`,
2626
+ style: { animationDelay: `${n * t}ms` },
2627
+ children: e === " " ? "\xA0" : e
2628
+ }, `${e}-${n}`))
2629
+ })
2630
+ }), xt = {
2631
+ spotlight: "cos-spotlight-OddY1",
2632
+ content: "cos-content-5I1Wy",
2633
+ overlay: "cos-overlay-F6CJ5"
2634
+ }, St = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
2635
+ let i = o(null), a = t((e) => {
2636
+ let t = i.current;
2637
+ if (!t) return;
2638
+ let n = t.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top;
2639
+ t.style.setProperty("--spot-x", `${r}px`), t.style.setProperty("--spot-y", `${a}px`);
2640
+ }, []);
2641
+ return /* @__PURE__ */ u("div", {
2642
+ ref: i,
2643
+ className: xt.spotlight,
2644
+ style: {
2645
+ "--spot-radius": `${n}px`,
2646
+ "--dim-color": r
2647
+ },
2648
+ onMouseMove: a,
2649
+ children: [/* @__PURE__ */ l("div", {
2650
+ className: xt.content,
2651
+ children: e
2652
+ }), /* @__PURE__ */ l("div", { className: xt.overlay })]
2653
+ });
2654
+ }, Z = {
663
2655
  turntable: "cos-turntable-dkc32",
664
2656
  wheelWrap: "cos-wheelWrap-n7lhc",
665
2657
  canvas: "cos-canvas-A1-4x",
@@ -667,7 +2659,7 @@ var j = {
667
2659
  spinBtn: "cos-spinBtn-l9JIC",
668
2660
  result: "cos-result-H8q2c",
669
2661
  "fade-in": "cos-fade-in-U9bUC"
670
- }, Y = [
2662
+ }, Ct = [
671
2663
  "#FF6B6B",
672
2664
  "#4ECDC4",
673
2665
  "#FFE66D",
@@ -676,15 +2668,15 @@ var j = {
676
2668
  "#F472B6",
677
2669
  "#34D399",
678
2670
  "#FB923C"
679
- ], X = [
2671
+ ], wt = [
680
2672
  { label: "一等奖" },
681
2673
  { label: "二等奖" },
682
2674
  { label: "三等奖" },
683
2675
  { label: "谢谢参与" },
684
2676
  { label: "优惠券" },
685
2677
  { label: "再来一次" }
686
- ], Z = (e) => 1 - (1 - e) ** 3, ee = ({ prizes: e = X, size: r = 360, spinDuration: i = 4e3, spinRounds: s = 5, buttonText: u = "开始抽奖", onSpinEnd: d }) => {
687
- let f = a(null), p = a(0), m = a(0), h = a(1), [g, _] = o(!1), [v, y] = o(null), b = r + 48, x = (e, t) => t.color ?? Y[e % Y.length], S = t((t) => {
2678
+ ], Tt = (e) => 1 - (1 - e) ** 3, Et = ({ prizes: e = wt, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
2679
+ let f = o(null), p = o(0), m = o(0), h = o(1), [g, _] = s(!1), [v, y] = s(null), b = r + 48, x = (e, t) => t.color ?? Ct[e % Ct.length], S = t((t) => {
688
2680
  let n = f.current;
689
2681
  if (!n) return;
690
2682
  let i = n.getContext("2d");
@@ -714,55 +2706,55 @@ var j = {
714
2706
  }, [b, S]), n(() => () => {
715
2707
  m.current && cancelAnimationFrame(m.current);
716
2708
  }, []);
717
- let C = (t) => {
2709
+ let ee = (t) => {
718
2710
  let n = 360 / e.length, r = (180 / Math.PI * t % 360 + 360) % 360;
719
2711
  return Math.floor((360 - r + n / 2) % 360 / n) % e.length;
720
2712
  };
721
- return /* @__PURE__ */ l("div", {
722
- className: J.turntable,
2713
+ return /* @__PURE__ */ u("div", {
2714
+ className: Z.turntable,
723
2715
  style: {
724
2716
  width: b,
725
2717
  height: b + 80
726
2718
  },
727
- children: [/* @__PURE__ */ l("div", {
728
- className: J.wheelWrap,
2719
+ children: [/* @__PURE__ */ u("div", {
2720
+ className: Z.wheelWrap,
729
2721
  style: {
730
2722
  width: b,
731
2723
  height: b
732
2724
  },
733
2725
  children: [
734
- /* @__PURE__ */ c("div", { className: J.pointer }),
735
- /* @__PURE__ */ c("canvas", {
2726
+ /* @__PURE__ */ l("div", { className: Z.pointer }),
2727
+ /* @__PURE__ */ l("canvas", {
736
2728
  ref: f,
737
- className: J.canvas,
2729
+ className: Z.canvas,
738
2730
  style: {
739
2731
  width: b,
740
2732
  height: b
741
2733
  }
742
2734
  }),
743
- /* @__PURE__ */ c("button", {
2735
+ /* @__PURE__ */ l("button", {
744
2736
  type: "button",
745
- className: J.spinBtn,
2737
+ className: Z.spinBtn,
746
2738
  onClick: () => {
747
2739
  if (g || e.length === 0) return;
748
2740
  _(!0), y(null);
749
- let t = Math.PI * 2 / e.length, n = Math.floor(Math.random() * e.length) * t + t / 2, r = p.current, a = r + s * Math.PI * 2 + (Math.PI * 2 - n) - r % (Math.PI * 2), o = r, c = performance.now(), l = (t) => {
750
- let n = t - c, r = Math.min(n / i, 1), s = Z(r), u = o + (a - o) * s;
2741
+ let t = Math.PI * 2 / e.length, n = Math.floor(Math.random() * e.length) * t + t / 2, r = p.current, o = r + a * Math.PI * 2 + (Math.PI * 2 - n) - r % (Math.PI * 2), s = r, c = performance.now(), l = (t) => {
2742
+ let n = t - c, r = Math.min(n / i, 1), a = Tt(r), u = s + (o - s) * a;
751
2743
  if (p.current = u, S(u), r < 1) m.current = requestAnimationFrame(l);
752
2744
  else {
753
- let t = C(u), n = e[t];
2745
+ let t = ee(u), n = e[t];
754
2746
  p.current = u, _(!1), y(n), d?.(n, t);
755
2747
  }
756
2748
  };
757
2749
  m.current = requestAnimationFrame(l);
758
2750
  },
759
2751
  disabled: g,
760
- children: g ? "抽奖中..." : u
2752
+ children: g ? "抽奖中..." : c
761
2753
  })
762
2754
  ]
763
- }), v && !g && /* @__PURE__ */ l("p", {
764
- className: J.result,
765
- children: ["恭喜获得:", /* @__PURE__ */ c("strong", { children: v.label })]
2755
+ }), v && !g && /* @__PURE__ */ u("p", {
2756
+ className: Z.result,
2757
+ children: ["恭喜获得:", /* @__PURE__ */ l("strong", { children: v.label })]
766
2758
  })]
767
2759
  });
768
2760
  }, Q = {
@@ -773,51 +2765,51 @@ var j = {
773
2765
  prompt: "cos-prompt-Y4hVD",
774
2766
  cursor: "cos-cursor-m8hGi",
775
2767
  blink: "cos-blink-XykM7"
776
- }, te = [
2768
+ }, Dt = [
777
2769
  "Hello, cos-design!",
778
2770
  "欢迎来到组件库 ✨",
779
2771
  "Build something fun 🚀"
780
- ], ne = ({ texts: e = te, speed: t = 100, deleteSpeed: r = 50, pause: i = 2e3 }) => {
781
- let [a, s] = o(""), [u, d] = o(0), [f, p] = o(!1);
2772
+ ], Ot = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
2773
+ let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
782
2774
  return n(() => {
783
- let n = e[u % e.length], o;
784
- if (!f && a === n) o = setTimeout(() => p(!0), i);
785
- else if (f && a === "") o = setTimeout(() => {
2775
+ let n = e[c % e.length], s;
2776
+ if (!f && a === n) s = setTimeout(() => p(!0), i);
2777
+ else if (f && a === "") s = setTimeout(() => {
786
2778
  p(!1), d((t) => (t + 1) % e.length);
787
2779
  }, 0);
788
2780
  else {
789
2781
  let e = f ? n.slice(0, a.length - 1) : n.slice(0, a.length + 1);
790
- o = setTimeout(() => s(e), f ? r : t);
2782
+ s = setTimeout(() => o(e), f ? r : t);
791
2783
  }
792
- return () => clearTimeout(o);
2784
+ return () => clearTimeout(s);
793
2785
  }, [
794
2786
  a,
795
2787
  f,
796
- u,
2788
+ c,
797
2789
  e,
798
2790
  t,
799
2791
  r,
800
2792
  i
801
- ]), /* @__PURE__ */ c("div", {
2793
+ ]), /* @__PURE__ */ l("div", {
802
2794
  className: Q.typewriter,
803
- children: /* @__PURE__ */ l("div", {
2795
+ children: /* @__PURE__ */ u("div", {
804
2796
  className: Q.terminal,
805
- children: [/* @__PURE__ */ l("div", {
2797
+ children: [/* @__PURE__ */ u("div", {
806
2798
  className: Q.dots,
807
2799
  children: [
808
- /* @__PURE__ */ c("span", {}),
809
- /* @__PURE__ */ c("span", {}),
810
- /* @__PURE__ */ c("span", {})
2800
+ /* @__PURE__ */ l("span", {}),
2801
+ /* @__PURE__ */ l("span", {}),
2802
+ /* @__PURE__ */ l("span", {})
811
2803
  ]
812
- }), /* @__PURE__ */ l("p", {
2804
+ }), /* @__PURE__ */ u("p", {
813
2805
  className: Q.text,
814
2806
  children: [
815
- /* @__PURE__ */ c("span", {
2807
+ /* @__PURE__ */ l("span", {
816
2808
  className: Q.prompt,
817
2809
  children: ">"
818
2810
  }),
819
2811
  a,
820
- /* @__PURE__ */ c("span", {
2812
+ /* @__PURE__ */ l("span", {
821
2813
  className: Q.cursor,
822
2814
  children: "|"
823
2815
  })
@@ -825,28 +2817,59 @@ var j = {
825
2817
  })]
826
2818
  })
827
2819
  });
2820
+ }, kt = ({ texts: e = Dt, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
2821
+ let i = e.length > 0 ? e : Dt;
2822
+ return /* @__PURE__ */ l(Ot, {
2823
+ texts: i,
2824
+ speed: t,
2825
+ deleteSpeed: n,
2826
+ pause: r
2827
+ }, i.join("\0"));
828
2828
  }, $ = {
829
2829
  waveButton: "cos-waveButton-Aa7G-",
830
2830
  btn: "cos-btn-WJrEN",
831
2831
  label: "cos-label-9BHOU",
832
2832
  wave: "cos-wave-GycLU",
833
2833
  ripple: "cos-ripple-5ZFpr"
834
- }, re = ({ text: e = "点我试试", onClick: t, color: n = "#38bdf8" }) => /* @__PURE__ */ c("div", {
2834
+ }, At = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
835
2835
  className: $.waveButton,
836
- children: /* @__PURE__ */ l("button", {
2836
+ children: /* @__PURE__ */ u("button", {
837
2837
  type: "button",
838
- className: $.btn,
839
- style: { "--wave-color": n },
840
- onClick: t,
2838
+ className: `${$.btn} ${n ?? ""}`,
2839
+ style: {
2840
+ "--wave-color": t,
2841
+ ...r
2842
+ },
2843
+ ...i,
841
2844
  children: [
842
- /* @__PURE__ */ c("span", { className: $.wave }),
843
- /* @__PURE__ */ c("span", { className: $.wave }),
844
- /* @__PURE__ */ c("span", {
2845
+ /* @__PURE__ */ l("span", { className: $.wave }),
2846
+ /* @__PURE__ */ l("span", { className: $.wave }),
2847
+ /* @__PURE__ */ l("span", {
845
2848
  className: $.label,
846
2849
  children: e
847
2850
  })
848
2851
  ]
849
2852
  })
2853
+ }), jt = {
2854
+ waveText: "cos-waveText-Zy2Tp",
2855
+ text: "cos-text-el-KR",
2856
+ char: "cos-char-Y9-mV",
2857
+ wave: "cos-wave-jVRCz"
2858
+ }, Mt = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
2859
+ className: jt.waveText,
2860
+ children: /* @__PURE__ */ l("h1", {
2861
+ className: jt.text,
2862
+ style: {
2863
+ fontSize: r,
2864
+ "--wave-color": n,
2865
+ "--wave-amp": `${t}px`
2866
+ },
2867
+ children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
2868
+ className: jt.char,
2869
+ style: { animationDelay: `${t * .1}s` },
2870
+ children: e === " " ? "\xA0" : e
2871
+ }, `${e}-${t}`))
2872
+ })
850
2873
  });
851
2874
  //#endregion
852
- export { d as CanvasClock, p as Charge, v as Confetti, C as Countdown, A as Fireworks, P as FlipCounter, I as GlitchText, z as MatrixRain, V as MeteorRain, U as NeonText, G as ParticleNetwork, q as ReturnCity, ee as Turntable, ne as Typewriter, re as WaveButton };
2875
+ export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, ee as CanvasClock, te as Charge, ne as ClickSpark, oe as Confetti, fe as Countdown, _e as CursorTrail, ce as CyberGrid, ye as DiceRoll, me as DnaHelix, ge as ElectricArc, Te as Fireworks, Oe as FlipCounter, Ne as GlitchText, je as GradientFlow, Ie as GravityBalls, Le as HolographicCard, ze as LiquidGlass, Re as LiquidProgress, Ve as MagneticButton, Ue as MatrixRain, Ge as MazeGenerator, qe as MeteorRain, Je as NeonText, Ye as NewtonCradle, Ze as OrbitalChart, Qe as ParticleNetwork, at as ProgressChest, st as RadarScan, ct as RedPacketRain, lt as ReturnCity, ft as RippleWater, mt as ScrambleText, ht as ScratchCard, vt as SlotMachine, et as SmokeFog, nt as Snowfall, ut as Speedometer, bt as SplitReveal, St as Spotlight, it as Starfield, dt as TimelinePulse, Et as Turntable, kt as Typewriter, At as WaveButton, Mt as WaveText };