cos-design 3.0.2 → 3.1.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.
- package/CHANGELOG.md +44 -0
- package/README.md +28 -9
- package/dist/components/canvasClock/index.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +302 -296
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.1.0] - 2026-06-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Playground **快速开始** 页面(`#/quickstart`)与仓库根目录 `QUICKSTART.md`
|
|
13
|
+
- 组件页 **实时编辑代码**(`react-live`),修改后预览立即更新
|
|
14
|
+
- 各组件 **配置参数** 表格,由 `pnpm extract-props` 从源码自动生成
|
|
15
|
+
- 顶栏 **GitHub** 图标外链仓库
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- 组件页「编辑代码」打开时自动滚动至编辑器
|
|
20
|
+
- 配置参数展示在页面底部(预览 / 编辑区下方)
|
|
21
|
+
- README 增加快速开始入口与使用注意摘要
|
|
22
|
+
|
|
23
|
+
## [3.0.4] - 2026-06-23
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- `Charge` 恢复 gooey 充电动效,移除错误的 `clip-path` 裁剪
|
|
28
|
+
- 气泡上升至圆环融合点后淡出消失,不再继续上飘或被硬切边截断
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- `Charge` 演示页移除浮层控件,仅保留纯充电动画
|
|
33
|
+
|
|
34
|
+
## [3.0.3] - 2026-06-23
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- `Charge` 电量数值与绿色充电动效同步,通过 `clip-path` 绑定 `--charge-pct`
|
|
39
|
+
- `Turntable` 旋转动画结束后增加 `cancelled` 守卫,避免卸载后 `setState`
|
|
40
|
+
- `Countdown` 目标时间已过期时立即触发 `onEnd`
|
|
41
|
+
- `MazeGenerator` 迷宫绘制完成后停止 rAF 循环
|
|
42
|
+
- `ProgressChest` / `ScratchCard` / `RedPacketRain` 回调改用 ref,避免闭包陈旧
|
|
43
|
+
- Playground 复制代码按钮卸载时清理 `setTimeout`
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- `Charge` 演示页支持滑块调节电量与自动充电开关
|
|
48
|
+
- `CanvasClock` 补充宽高 props 说明(始终渲染为正方形)
|
|
49
|
+
- 移除未引用的 `home/`、`demo-layout/` 页面与 `public/models/bantha` 资源
|
|
50
|
+
- README 分类名称与 Playground 统一为「背景动效」
|
|
51
|
+
|
|
8
52
|
## [3.0.2] - 2026-06-23
|
|
9
53
|
|
|
10
54
|
### Changed
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://react.dev/)
|
|
11
11
|
[](https://www.typescriptlang.org/)
|
|
12
12
|
|
|
13
|
-
[在线预览](https://github.
|
|
13
|
+
[在线预览](https://jiaxiantao.github.io/cos-design/) · [快速开始](./QUICKSTART.md) · [v3.0 发布博客](./website-content/cos-design-v3-release.md) · [完整指南](./website-content/cos-design-intro.md) · [更新日志](./CHANGELOG.md)
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -33,12 +33,18 @@
|
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## 快速开始
|
|
37
|
+
|
|
38
|
+
> 完整说明见 **[QUICKSTART.md](./QUICKSTART.md)** · Playground 内访问 **#/quickstart**
|
|
39
|
+
|
|
40
|
+
### 安装
|
|
37
41
|
|
|
38
42
|
```bash
|
|
39
43
|
pnpm add cos-design
|
|
40
44
|
```
|
|
41
45
|
|
|
46
|
+
### 最简示例
|
|
47
|
+
|
|
42
48
|
```tsx
|
|
43
49
|
import { Fireworks, ScrambleText, ScratchCard } from 'cos-design';
|
|
44
50
|
|
|
@@ -55,12 +61,22 @@ export default function Page() {
|
|
|
55
61
|
|
|
56
62
|
无需手动引入 CSS,样式自动注入。完整 TypeScript 类型开箱即用。
|
|
57
63
|
|
|
64
|
+
### 使用注意(摘要)
|
|
65
|
+
|
|
66
|
+
| 注意点 | 说明 |
|
|
67
|
+
| -------- | --------------------------------------------------------------- |
|
|
68
|
+
| **SSR** | Canvas 组件需在 Next.js 等框架中 `dynamic(..., { ssr: false })` |
|
|
69
|
+
| **尺寸** | Canvas 组件需明确 `width` / `height`,父容器也应有可见高度 |
|
|
70
|
+
| **密度** | 建议每页「一个强背景 + 若干局部交互」,避免多 Canvas 抢性能 |
|
|
71
|
+
| **权限** | `AudioVisualizer` 开启麦克风时需 HTTPS 与用户授权 |
|
|
72
|
+
| **省电** | 标签页隐藏时,多数 Canvas 动画自动暂停 |
|
|
73
|
+
|
|
58
74
|
---
|
|
59
75
|
|
|
60
76
|
## 组件一览(49 个 · 6 大分类)
|
|
61
77
|
|
|
62
78
|
<details open>
|
|
63
|
-
<summary><strong
|
|
79
|
+
<summary><strong>背景动效</strong> — 9 个 · 动态场景与粒子背景</summary>
|
|
64
80
|
|
|
65
81
|
<br>
|
|
66
82
|
|
|
@@ -211,6 +227,8 @@ npx --yes pnpm@9 dev # 启动 Playground
|
|
|
211
227
|
|
|
212
228
|
## 使用注意
|
|
213
229
|
|
|
230
|
+
详见 [QUICKSTART.md](./QUICKSTART.md)。以下为高频场景摘要:
|
|
231
|
+
|
|
214
232
|
**Canvas 组件请客户端渲染**(依赖 `window` / `canvas` / `requestAnimationFrame`):
|
|
215
233
|
|
|
216
234
|
```tsx
|
|
@@ -225,12 +243,13 @@ const Fireworks = dynamic(() => import('cos-design').then((m) => m.Fireworks), {
|
|
|
225
243
|
|
|
226
244
|
## 文档
|
|
227
245
|
|
|
228
|
-
| 文档
|
|
229
|
-
|
|
|
230
|
-
| [
|
|
231
|
-
| [
|
|
232
|
-
| [
|
|
233
|
-
| [
|
|
246
|
+
| 文档 | 内容 |
|
|
247
|
+
| ----------------------------------------------------------- | -------------------------------- |
|
|
248
|
+
| [快速开始](./QUICKSTART.md) | 安装、用法、注意事项与常见问题 |
|
|
249
|
+
| [v3.0 发布博客](./website-content/cos-design-v3-release.md) | 重大升级解读、分类体系、技术实现 |
|
|
250
|
+
| [完整介绍与实践指南](./website-content/cos-design-intro.md) | 架构、使用规则、组件详解 |
|
|
251
|
+
| [CHANGELOG](./CHANGELOG.md) | 版本更新记录 |
|
|
252
|
+
| [CONTRIBUTING](./CONTRIBUTING.md) | 参与贡献指南 |
|
|
234
253
|
|
|
235
254
|
---
|
|
236
255
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={barcodeScan:`cos-barcodeScan-aH9Ad`,content:`cos-content-F73ZD`,"glitch-skew":`cos-glitch-skew-inh6a`,placeholder:`cos-placeholder-yYVB8`,overlay:`cos-overlay-4AiY5`,scanLine:`cos-scanLine-VBsRv`,scan:`cos-scan-JD4wO`,glitchLayer:`cos-glitchLayer-nzkIa`,flicker:`cos-flicker-P0jQE`,corners:`cos-corners-1bjak`},d=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:u.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:u.content,children:e??(0,l.jsx)(`span`,{className:u.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:u.overlay,children:[(0,l.jsx)(`div`,{className:u.scanLine}),(0,l.jsx)(`div`,{className:u.glitchLayer})]}),(0,l.jsxs)(`div`,{className:u.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),f={burnAway:`cos-burnAway-QWIjy`,stage:`cos-stage-8VIfE`,text:`cos-text-0guk-`,canvas:`cos-canvas-Bwc-u`,trigger:`cos-trigger-UDZqV`,hint:`cos-hint-XQUfv`},p=({text:e=`BURN`,fontSize:t=64,onComplete:n})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1),d=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{a||s||o(!0)},[a,s]);return(0,c.useEffect)(()=>{if(!a||s)return;let n=r.current,o=i.current;if(!n||!o)return;let c=n.getBoundingClientRect(),l=window.devicePixelRatio||1,f=Math.ceil(c.width),m=Math.ceil(c.height);o.width=f*l,o.height=m*l,o.style.width=`${f}px`,o.style.height=`${m}px`;let h=o.getContext(`2d`);if(!h)return;h.scale(l,l);let g=document.createElement(`canvas`);g.width=f*l,g.height=m*l;let _=g.getContext(`2d`);if(!_)return;_.scale(l,l),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,f/2,m/2);let v=_.getImageData(0,0,f*l,m*l).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<f;t+=4)v[(Math.floor(e*l)*f*l+Math.floor(t*l))*4+3]>128&&y.push({x:t,y:e,vx:(Math.random()-.5)*2,vy:-Math.random()*3-1,life:1,maxLife:.6+Math.random()*.6,size:2+Math.random()*3});let b=0,x=0,S=!1,C=(e,t)=>{if(S)return;let n=Math.min((e-t)/16,2);x+=n*16,h.clearRect(0,0,f,m);let r=0;for(let e of y){if(e.life-=n*.012/e.maxLife,e.life<=0)continue;r++,e.x+=e.vx*n,e.y+=e.vy*n,e.vy+=.04*n;let t=e.life,i=1-e.life,a=Math.max(0,200-i*200),o=Math.max(0,80-i*80);h.globalAlpha=t,h.fillStyle=`rgb(255,${a},${o})`,h.beginPath(),h.arc(e.x,e.y,e.size*t,0,Math.PI*2),h.fill()}h.globalAlpha=1,x<2500&&r>0?b=requestAnimationFrame(t=>C(t,e)):S||(u(!0),d.current||(d.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[a,s,e,t]),(0,l.jsxs)(`div`,{className:f.burnAway,children:[(0,l.jsxs)(`div`,{ref:r,className:f.stage,children:[!s&&(0,l.jsx)(`span`,{className:f.text,style:{fontSize:t,opacity:+!a},children:e}),(0,l.jsx)(`canvas`,{ref:i,className:f.canvas})]}),!a&&!s&&(0,l.jsx)(`button`,{type:`button`,className:f.trigger,onClick:m,children:`Ignite`}),s&&(0,l.jsx)(`p`,{className:f.hint,children:`Gone.`})]})},m={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},h=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],g=({width:e=800,height:t=500,colors:n=h})=>{let r=n.length>=2?n:h;return(0,l.jsx)(`div`,{className:m.aurora,style:{width:e,height:t},children:r.map((e,t)=>(0,l.jsx)(`div`,{className:m.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`}},e+t))})},_=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},v=(e,t,n)=>Math.min(n,Math.max(t,e)),y={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},b=({width:e=400,height:t=120,barCount:n=32,useMic:r=!1})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=null,d=null,f=null,p=null,m=0,h=!1,g=_(e=>{l=e});(async()=>{if(!(!r||!navigator.mediaDevices?.getUserMedia))try{if(p=await navigator.mediaDevices.getUserMedia({audio:!0}),h){p.getTracks().forEach(e=>e.stop()),p=null;return}u=new AudioContext,d=u.createAnalyser(),d.fftSize=256,u.createMediaStreamSource(p).connect(d),f=new Uint8Array(d.frequencyBinCount)}catch{}})();let v=()=>{if(c=requestAnimationFrame(v),l)return;let r=Array(n).fill(0);if(d&&f){d.getByteFrequencyData(f);let e=Math.floor(f.length/n);for(let t=0;t<n;t++)r[t]=f[t*e]/255}else{m+=.08;for(let e=0;e<n;e++)r[e]=(Math.sin(m+e*.35)+1)*.35+Math.random()*.15}s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=(e-3*(n-1))/n;for(let e=0;e<n;e++){let n=Math.max(4,r[e]*t*.9),a=e*(i+3),o=t-n,c=s.createLinearGradient(0,o,0,t);c.addColorStop(0,`#a78bfa`),c.addColorStop(1,`#38bdf8`),s.fillStyle=c,s.beginPath(),s.roundRect(a,o,i,n,2),s.fill()}};return v(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:y.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:y.canvas,style:{width:e,height:t}})})},x={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},S=({width:e=400,height:t=400})=>{let n=(0,c.useRef)(null),r=Math.min(e,t),i=r/2-16,a=r/2,o=(0,c.useCallback)(e=>{e.clearRect(0,0,r,r),e.save(),e.translate(a,a),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#fff`,e.fill(),e.strokeStyle=`#d1d5db`,e.lineWidth=2,e.stroke();for(let t=0;t<60;t++){let n=t/60*Math.PI*2,r=i-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(n)*r,Math.sin(n)*r),e.lineTo(Math.cos(n)*i,Math.sin(n)*i),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(r/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let n=t/12*Math.PI*2-Math.PI/2,r=i-32;e.fillText(String(t),Math.cos(n)*r,Math.sin(n)*r)}let t=new Date,n=t.getHours()%12,o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds(),l=(t,n,r,i,a)=>{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()},u=(n+o/60)/12*Math.PI*2-Math.PI/2,d=(o+s/60)/60*Math.PI*2-Math.PI/2,f=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(u,i*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(d,i*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(f,i*.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()},[a,i,r]);return(0,c.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=r*t;let i=e.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=0,s=document.hidden,c=_(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:x.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:x.canvasTarget,style:{width:r,height:r}})})},C={chargeContainer:`cos-chargeContainer-4t9qo`,contrast:`cos-contrast-PNep9`,hueRotate:`cos-hueRotate-bMJ-k`,text:`cos-text-2k7eH`,moveUp:`cos-moveUp-1Vz9j`,circle:`cos-circle-m4vwX`,circleRotate:`cos-circleRotate-bgFw5`,button:`cos-button-myCst`},ee=e=>{let{initQuantity:t=0,value:n,onChange:r,autoCharge:i=!0,interval:a=500,step:o=.01}=e,s=(0,c.useRef)(null),u=n!==void 0,[d,f]=(0,c.useState)(()=>v(t,0,100)),p=v(u?n:d,0,100),m=(0,c.useRef)(p),h=(0,c.useRef)(r);(0,c.useEffect)(()=>{h.current=r},[r]),(0,c.useEffect)(()=>{m.current=p},[p]),(0,c.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{e.style.setProperty(`--charge-h`,`${e.clientHeight}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{if(m.current>=100)return;let e=Math.min(100,Number((m.current+o).toFixed(2)));u?h.current?.(e):f(e)},a);return()=>clearInterval(e)},[i,a,u,o]);let g=p.toFixed(2);return(0,l.jsx)(`div`,{ref:s,className:C.chargeContainer,children:(0,l.jsxs)(`div`,{className:C.contrast,children:[(0,l.jsxs)(`div`,{className:C.text,children:[g,`%`]}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`div`,{className:C.circle}),(0,l.jsx)(`div`,{className:C.button})]})})},w={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},te=({children:e,color:t=`#fbbf24`,count:n=16})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)((e,t)=>{for(let r=0;r<n;r++){let i=Math.PI*2*r/n+Math.random()*.3,o=Math.random()*4+2;a.current.push({x:e,y:t,vx:Math.cos(i)*o,vy:Math.sin(i)*o,alpha:1,size:Math.random()*3+2})}},[n]);return(0,c.useEffect)(()=>{let e=i.current,n=r.current;if(!e||!n)return;let s=e.getContext(`2d`);if(!s)return;let c=()=>{let t=window.devicePixelRatio||1,{width:r,height:i}=n.getBoundingClientRect();e.width=r*t,e.height=i*t,s.setTransform(t,0,0,t,0,0)};c();let l=new ResizeObserver(c);l.observe(n);let u=document.hidden,d=_(e=>{u=e}),f=()=>{if(o.current=requestAnimationFrame(f),u)return;let{width:e,height:r}=n.getBoundingClientRect();s.clearRect(0,0,e,r),a.current=a.current.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.15,e.alpha-=.03,e.alpha<=0?!1:(s.beginPath(),s.arc(e.x,e.y,e.size,0,Math.PI*2),s.fillStyle=t,s.globalAlpha=e.alpha,s.fill(),s.globalAlpha=1,!0)))};return f(),()=>{cancelAnimationFrame(o.current),l.disconnect(),d()}},[t]),(0,l.jsxs)(`div`,{ref:r,className:w.clickSpark,onClick:e=>{let t=r.current?.getBoundingClientRect();t&&s(e.clientX-t.left,e.clientY-t.top)},children:[(0,l.jsx)(`canvas`,{ref:i,className:w.canvas}),e&&(0,l.jsx)(`div`,{className:w.content,children:e}),!e&&(0,l.jsx)(`p`,{className:w.hint,children:`点击任意位置产生火花`})]})},T={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},ne=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],re=()=>ne[Math.floor(Math.random()*ne.length)],ie=(e,t,n)=>{let r=e/2,i=t*.6;return Array.from({length:n},()=>{let e=(Math.random()-.5)*Math.PI,t=Math.random()*12+6;return{x:r+(Math.random()-.5)*40,y:i,vx:Math.cos(e)*t,vy:Math.sin(e)*t-Math.random()*8,rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*12,color:re(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},ae=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120},i)=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)({width:e,height:t,particleCount:r});u.current={width:e,height:t,particleCount:r};let d=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=u.current;o.current.push(...ie(e,t,n))},[]);return(0,c.useImperativeHandle)(i,()=>({burst:d}),[d]),(0,c.useEffect)(()=>{n&&d()},[n,d]),(0,c.useEffect)(()=>{let n=a.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{s.current=requestAnimationFrame(u),!c&&(i.clearRect(0,0,e,t),o.current=o.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>t+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))))};return u(),()=>{cancelAnimationFrame(s.current),l()}},[t,e]),(0,l.jsxs)(`div`,{className:T.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:T.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:T.hint,children:`点击画布再次喷射`})]})});ae.displayName=`Confetti`;var oe={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},se=({width:e=800,height:t=500,color:n=`#00f0ff`,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=i.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=t*.45,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(a.current=requestAnimationFrame(p),d)return;o.current=(o.current+r*1.5)%40,l.fillStyle=`#050510`,l.fillRect(0,0,e,t);let i=l.createLinearGradient(0,0,0,u);i.addColorStop(0,`#0a0a20`),i.addColorStop(1,`#050510`),l.fillStyle=i,l.fillRect(0,0,e,u);let s=e/2;l.strokeStyle=n,l.shadowColor=n,l.shadowBlur=8,l.lineWidth=1;for(let n=-12;n<=12;n++){let r=n/12*e*1.2;l.beginPath(),l.moveTo(s+r*.05,u),l.lineTo(s+r,t),l.globalAlpha=.3+(1-Math.abs(n)/12)*.5,l.stroke()}l.globalAlpha=1;let c=Math.ceil(t/40)+2;for(let n=0;n<c;n++){let r=u+(n*40+o.current)/(t-u)*(t-u)%(t-u),i=(r-u)/(t-u)*.8;l.beginPath(),l.moveTo(0,r),l.lineTo(e,r),l.globalAlpha=i,l.stroke()}l.shadowBlur=0,l.globalAlpha=1;let f=l.createRadialGradient(s,u,0,s,u,e*.4);f.addColorStop(0,`${n}33`),f.addColorStop(1,`transparent`),l.fillStyle=f,l.fillRect(0,0,e,t)};return p(),()=>{cancelAnimationFrame(a.current),f()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:oe.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:oe.canvas,style:{width:e,height:t}})})},E={countdown:`cos-countdown-5ZKKP`,unit:`cos-unit-dth8N`,value:`cos-value-yVzcP`,label:`cos-label-pAMEs`,ended:`cos-ended-c0dsD`,pulse:`cos-pulse-krQd-`,invalid:`cos-invalid-d6t-L`},ce=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),le=e=>{let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);return{total:t,days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:n%60}},ue=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],de=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>ce(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?le(i):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{u.current=t},[t]),(0,c.useEffect)(()=>{if(!a)return;s.current=!1;let e=window.setInterval(()=>{o(e=>e+1),Date.now()>=i&&!s.current&&(s.current=!0,u.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[a,i]),a?(0,l.jsxs)(`div`,{className:E.countdown,style:{"--countdown-color":r},children:[ue.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:E.unit,children:[(0,l.jsx)(`div`,{className:E.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:E.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:E.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:E.countdown,children:(0,l.jsx)(`p`,{className:E.invalid,children:`无效的目标时间`})})},fe={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},pe=({width:e=200,height:t=360,speed:n=1,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=0,u=document.hidden,d=_(e=>{u=e}),f=()=>{if(l=requestAnimationFrame(f),u)return;c+=.03*n,s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=e/2,a=e*.32;for(let e=0;e<18;e++){let n=e/17*(t-40)+20,o=c+e*.4,l=i+Math.sin(o)*a,u=i+Math.sin(o+Math.PI)*a,d=Math.cos(o),f=5+d*2;s.beginPath(),s.moveTo(l,n),s.lineTo(u,n),s.strokeStyle=`rgb(148 163 184 / ${30+Math.abs(d)*30}%)`,s.lineWidth=1.5,s.stroke(),s.beginPath(),s.arc(l,n,f,0,Math.PI*2),s.fillStyle=d>0?r:`#a78bfa`,s.fill(),s.beginPath(),s.arc(u,n,f,0,Math.PI*2),s.fillStyle=d>0?`#a78bfa`:r,s.fill()}};return f(),()=>{cancelAnimationFrame(l),d()}},[r,t,n,e]),(0,l.jsx)(`div`,{className:fe.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:fe.canvas,style:{width:e,height:t}})})},me={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},D=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];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);return[...m.slice(0,-1),...h]},he=({width:e=320,height:t=160,color:n=`#67e8f9`})=>{let r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=r.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=t/2,c=e-40,l=t/2,u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=D(40,s,c,l,40,5);o.beginPath(),r.forEach(([e,t],n)=>n===0?o.moveTo(e,t):o.lineTo(e,t)),o.strokeStyle=n,o.lineWidth=2,o.shadowColor=n,o.shadowBlur=12,o.stroke(),o.shadowBlur=0,o.beginPath(),r.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])=>{o.beginPath(),o.arc(e,t,6,0,Math.PI*2),o.fillStyle=n,o.fill()})};return p(),()=>{cancelAnimationFrame(u),f()}},[n,t,e]),(0,l.jsx)(`div`,{className:me.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:me.canvas,style:{width:e,height:t}})})},O={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},ge=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:n/2,y:r/2}),s=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let c=i.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=n*l,c.height=r*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=document.hidden,f=_(e=>{d=e}),p=()=>{if(s.current=requestAnimationFrame(p),d)return;let{x:i,y:c}=o.current;a.current.unshift({x:i,y:c,life:1}),a.current.length>t&&(a.current.length=t),u.fillStyle=`rgb(15 23 42 / 15%)`,u.fillRect(0,0,n,r);let l=a.current;for(let t=0;t<l.length;t++){let n=l[t],r=1-t/l.length,i=(1-t/l.length)*8+2;u.beginPath(),u.arc(n.x,n.y,i,0,Math.PI*2),u.fillStyle=e,u.globalAlpha=r*.8,u.fill()}u.globalAlpha=1};return p(),()=>{cancelAnimationFrame(s.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:O.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:i,className:O.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();o.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:O.hint,children:`移动鼠标查看粒子轨迹`})]})},k={diceRoll:`cos-diceRoll-GDwjV`,scene:`cos-scene-tmnKM`,cube:`cos-cube-RklEa`,rolling:`cos-rolling-2ocEq`,face:`cos-face-10eAF`,dot:`cos-dot-p5AzF`,face1:`cos-face1-Ev-x5`,face2:`cos-face2-2M17p`,face3:`cos-face3-Wd6T4`,face4:`cos-face4-RsRwQ`,face5:`cos-face5-PiJbu`,face6:`cos-face6-Yp-MX`,rollBtn:`cos-rollBtn-nXMWJ`,result:`cos-result-kXzu9`},_e={1:{x:0,y:0},2:{x:0,y:180},3:{x:0,y:-90},4:{x:0,y:90},5:{x:-90,y:0},6:{x:90,y:0}},ve=({onRoll:e,sides:t=6})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)(1),[o,s]=(0,c.useState)({x:0,y:0,z:0}),u=(0,c.useRef)(e),d=(0,c.useRef)(0);(0,c.useEffect)(()=>{u.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(d.current),[]);let f=()=>{if(n)return;r(!0);let e=Math.floor(Math.random()*t)+1,i=_e[e]??_e[1],o=360*(3+Math.floor(Math.random()*3)),c=360*(3+Math.floor(Math.random()*3));s({x:i.x+o,y:i.y+c,z:Math.random()*360}),clearTimeout(d.current),d.current=window.setTimeout(()=>{a(e),r(!1),u.current?.(e)},1200)},p=e=>({1:[[50,50]],2:[[25,25],[75,75]],3:[[25,25],[50,50],[75,75]],4:[[25,25],[75,25],[25,75],[75,75]],5:[[25,25],[75,25],[50,50],[25,75],[75,75]],6:[[25,25],[75,25],[25,50],[75,50],[25,75],[75,75]]}[e]??[]).map(([e,t],n)=>(0,l.jsx)(`span`,{className:k.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:k.diceRoll,children:[(0,l.jsx)(`div`,{className:k.scene,children:(0,l.jsx)(`div`,{className:`${k.cube} ${n?k.rolling:``}`,style:{transform:`rotateX(${o.x}deg) rotateY(${o.y}deg) rotateZ(${o.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${k.face} ${k[`face${e}`]}`,children:p(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:k.rollBtn,onClick:f,disabled:n,children:n?`掷骰中...`:`掷骰子`}),!n&&(0,l.jsxs)(`p`,{className:k.result,children:[`点数: `,i]})]})},A={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},ye=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],be=.12,xe=240,Se=()=>ye[Math.floor(Math.random()*ye.length)],Ce=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:Se(),decay:Math.random()*.015+.01}})},we=(0,c.forwardRef)(({width:e=800,height:t=500,auto:n=!0},r)=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(n=>{let r=n??Math.random()*e*.6+e*.2;a.current.push({x:r,y:t,vy:-(Math.random()*4+6),targetY:Math.random()*t*.35+t*.15,color:Se(),exploded:!1,particles:[],age:0})},[t,e]);return(0,c.useImperativeHandle)(r,()=>({launch:s}),[s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(l.fillStyle=`rgb(15 23 42 / 25%)`,l.fillRect(0,0,e,t),a.current=a.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=be,l.beginPath(),l.arc(e.x,e.y,2.5,0,Math.PI*2),l.fillStyle=e.color,l.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=xe;return(t||n||r||i)&&(e.exploded=!0,e.particles=Ce(e.x,e.y,e.color)),!0}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:(l.beginPath(),l.arc(e.x,e.y,2,0,Math.PI*2),l.fillStyle=e.color,l.globalAlpha=e.alpha,l.fill(),l.globalAlpha=1,!0))),e.particles.length>0}))};return p(),n&&(u=window.setInterval(()=>s(),1200)),()=>{cancelAnimationFrame(o.current),clearInterval(u),f()}},[n,t,s,e]),(0,l.jsxs)(`div`,{className:A.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:A.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:A.hint,children:`点击画布燃放烟花`})]})});we.displayName=`Fireworks`;var j={flipCounter:`cos-flipCounter-3LuI0`,digit:`cos-digit-yJRPy`,digitCard:`cos-digitCard-zZUzt`,staticTop:`cos-staticTop-aLQcm`,staticBottom:`cos-staticBottom-9y0gu`,flap:`cos-flap-i3YKR`,flapTop:`cos-flapTop-70z-k`,flapBottom:`cos-flapBottom-zhMZe`,isFlipping:`cos-isFlipping-EVEdI`,"fold-top":`cos-fold-top-v-6XJ`,"unfold-bottom":`cos-unfold-bottom-e2gzU`},Te=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Ee=({digit:e,color:t,duration:n})=>{let r=(0,c.useRef)(e),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(e);(0,c.useEffect)(()=>{if(e===r.current)return;s(r.current),a(!0),r.current=e;let t=window.setTimeout(()=>a(!1),n);return()=>clearTimeout(t)},[e,n]);let u=i?o:e;return(0,l.jsx)(`div`,{className:j.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${j.digitCard} ${i?j.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:j.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:j.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${j.flap} ${j.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${j.flap} ${j.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},De=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=Te(e,t).split(``);return(0,l.jsx)(`div`,{className:j.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Ee,{digit:e,color:n,duration:r},t))})},Oe={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},ke=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],Ae=({text:e=`GRADIENT`,colors:t=ke,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):ke.join(`, `);return(0,l.jsx)(`div`,{className:Oe.gradientFlow,children:(0,l.jsx)(`h1`,{className:Oe.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},je={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Me=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:je.glitchText,children:(0,l.jsx)(`h1`,{className:je.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Ne={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Pe=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Fe=({width:e=400,height:t=300,ballCount:n=12})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*(e-40)+20,y:t*.5*Math.random()+10,vx:(Math.random()-.5)*4,vy:Math.random()*2,r:Math.random()*10+8,color:Pe[Math.floor(Math.random()*Pe.length)]}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let a=window.devicePixelRatio||1;n.width=e*a,n.height=t*a;let o=n.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=0,c=document.hidden,l=_(e=>{c=e}),u=()=>{if(s=requestAnimationFrame(u),c)return;let n=i.current;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);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);for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){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;if(s<c){let e=a/s,t=o/s,n=c-s;r.x-=e*n*.5,r.y-=t*n*.5,i.x+=e*n*.5,i.y+=t*n*.5;let l=(r.vx-i.vx)*e+(r.vy-i.vy)*t;l>0&&(r.vx-=l*e,r.vy-=l*t,i.vx+=l*e,i.vy+=l*t)}}for(let e of n){o.beginPath(),o.arc(e.x,e.y,e.r,0,Math.PI*2);let t=o.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r);t.addColorStop(0,`#fff`),t.addColorStop(.3,e.color),t.addColorStop(1,e.color),o.fillStyle=t,o.fill()}};return u(),()=>{cancelAnimationFrame(s),l()}},[t,e]),(0,l.jsx)(`div`,{className:Ne.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Ne.canvas,style:{width:e,height:t}})})},M={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Ie=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:M.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:M.card,onMouseMove:e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=(e.clientX-n.left)/n.width-.5,a=(e.clientY-n.top)/n.height-.5;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}%`)},onMouseLeave:()=>{let e=r.current;e&&(e.style.setProperty(`--rx`,`0deg`),e.style.setProperty(`--ry`,`0deg`),e.style.setProperty(`--gx`,`50%`),e.style.setProperty(`--gy`,`50%`))},children:[(0,l.jsx)(`div`,{className:M.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:M.image}):(0,l.jsx)(`div`,{className:M.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:M.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},N={liquidProgress:`cos-liquidProgress-ABZZA`,svg:`cos-svg-YdTvy`,track:`cos-track-IhMjO`,ring:`cos-ring-6PKMg`,fillBg:`cos-fillBg-pwLI1`,wave:`cos-wave-CBwgG`,label:`cos-label-WYDqS`},Le=({value:e=0,max:t=100,size:n=160,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useId)().replace(/:/g,``),o=v(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=_(e=>{n=e}),a=()=>{if(!n){t+=.04;let e=i.current;if(e){let n=s+Math.sin(t)*2;e.setAttribute(`d`,`M0,${n} Q25,${n-4+Math.sin(t*1.3)*3} 50,${n} T100,${n} V100 H0 Z`)}}e=requestAnimationFrame(a)};return e=requestAnimationFrame(a),()=>{cancelAnimationFrame(e),r()}},[s]),(0,l.jsxs)(`div`,{className:N.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:N.svg,children:[(0,l.jsx)(`defs`,{children:(0,l.jsx)(`clipPath`,{id:`clip-${a}`,children:(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45})})}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:N.track,strokeWidth:10,fill:`none`}),(0,l.jsxs)(`g`,{clipPath:`url(#clip-${a})`,children:[(0,l.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,className:N.fillBg}),(0,l.jsx)(`path`,{ref:i,className:N.wave,d:`M0,${s} Q25,${s-4} 50,${s} T100,${s} V100 H0 Z`})]}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:N.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:N.label,children:[Math.round(o),`%`]})]})},P={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},Re=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:P.liquidGlass,children:(0,l.jsx)(`div`,{className:P.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:P.content,children:e})})}),ze={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},Be=({children:e=`磁吸按钮`,strength:t=.4,color:n=`#6366f1`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,l.jsx)(`div`,{ref:r,className:ze.magneticButton,onMouseMove:e=>{let n=r.current,a=i.current;if(!n||!a)return;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;a.style.transform=`translate(${l}px, ${u}px)`},onMouseLeave:()=>{let e=i.current;e&&(e.style.transform=`translate(0, 0)`)},children:(0,l.jsx)(`button`,{ref:i,type:`button`,className:ze.btn,style:{"--btn-color":n},children:e})})},F={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},Ve=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,He=({width:e=800,height:t=500,density:n=.6,color:r=`#00ff41`,showOverlay:i=!0,title:a=`MATRIX`,subtitle:o=`数字雨效果`})=>{let s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=s.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=Math.floor(e/16*n),l=Array.from({length:c},()=>Math.random()*-50),u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{u=requestAnimationFrame(p),!d&&(o.fillStyle=`rgb(0 0 0 / 8%)`,o.fillRect(0,0,e,t),o.font=`16px monospace`,l.forEach((e,i)=>{let a=Ve[Math.floor(Math.random()*53)],s=i/n*16;o.fillStyle=r,o.fillText(a,s,e*16),e*16>t&&Math.random()>.975&&(l[i]=0),l[i]+=1}))};return p(),()=>{cancelAnimationFrame(u),f()}},[r,n,t,e]),(0,l.jsxs)(`div`,{className:F.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:F.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:F.overlay,children:[(0,l.jsx)(`h2`,{className:F.title,children:a}),(0,l.jsx)(`p`,{className:F.subtitle,children:o})]})]})},Ue={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},We=({width:e=400,height:t=300,cellSize:n=20,onGenerated:r})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(r);return(0,c.useEffect)(()=>{a.current=r},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let o=window.devicePixelRatio||1;r.width=e*o,r.height=t*o;let s=r.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=Math.floor(e/n),l=Math.floor(t/n),u=Array.from({length:l},()=>Array.from({length:c},()=>({top:!0,right:!0,bottom:!0,left:!0,visited:!1}))),d=[[0,0]];u[0][0].visited=!0;let f=[[0,-1,`top`],[1,0,`right`],[0,1,`bottom`],[-1,0,`left`]],p={top:`bottom`,right:`left`,bottom:`top`,left:`right`};for(;d.length;){let[e,t]=d[d.length-1],n=f.map(([n,r,i])=>{let a=e+n,o=t+r;return a<0||o<0||a>=c||o>=l||u[o][a].visited?null:{nx:a,ny:o,wall:i}}).filter(Boolean);if(!n.length){d.pop();continue}let r=n[Math.floor(Math.random()*n.length)];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])}a.current?.(c,l);let m=0,h=0,g=c*l*2,v=document.hidden,y=_(e=>{v=e}),b=()=>{if(m=requestAnimationFrame(b),v)return;h=Math.min(g,h+2),s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t),s.strokeStyle=`#38bdf8`,s.lineWidth=1.5,s.shadowColor=`#38bdf8`,s.shadowBlur=4;let r=0;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let i=u[e][t],a=t*n,o=e*n;i.top&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a+n,o),s.stroke()),i.right&&r++<h&&(s.beginPath(),s.moveTo(a+n,o),s.lineTo(a+n,o+n),s.stroke()),e===l-1&&i.bottom&&r++<h&&(s.beginPath(),s.moveTo(a,o+n),s.lineTo(a+n,o+n),s.stroke()),t===0&&i.left&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a,o+n),s.stroke())}s.shadowBlur=0};return b(),()=>{cancelAnimationFrame(m),y()}},[n,t,e]),(0,l.jsx)(`div`,{className:Ue.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Ue.canvas,style:{width:e,height:t}})})},Ge={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},Ke=({width:e=800,height:t=500,meteorCount:n=8})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[t,n,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{a.current=requestAnimationFrame(u),!c&&(s.fillStyle=`rgb(15 23 42 / 15%)`,s.fillRect(0,0,e,t),i.current.forEach(n=>{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);let r=n.x-n.length,i=n.y-n.length*.6;s.beginPath(),s.strokeStyle=`rgb(255 255 255 / ${n.opacity})`,s.lineWidth=2,s.moveTo(n.x,n.y),s.lineTo(r,i),s.stroke(),s.beginPath(),s.fillStyle=`rgb(255 255 255 / ${Math.min(1,n.opacity+.2)})`,s.arc(n.x,n.y,1.5,0,Math.PI*2),s.fill()}))};return u(),()=>{cancelAnimationFrame(a.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:Ge.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Ge.canvas,style:{width:e,height:t}})})},I={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},qe=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:I.neonText,children:[(0,l.jsx)(`h1`,{className:`${I.text} ${r?I.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:I.reflection,style:{fontSize:n*.35,color:t},children:e})]}),L={newtonCradle:`cos-newtonCradle-mFl-b`,frame:`cos-frame-pp818`,pendulum:`cos-pendulum-mC9Bq`,"swing-left":`cos-swing-left-Mf5fy`,"swing-right":`cos-swing-right-gEH1F`,string:`cos-string-UpYWC`,ball:`cos-ball-sj82r`},Je=({ballCount:e=5,color:t=`#38bdf8`})=>{let n=Math.max(2,Math.min(e,7));return(0,l.jsx)(`div`,{className:L.newtonCradle,style:{"--ball-color":t},children:(0,l.jsx)(`div`,{className:L.frame,children:Array.from({length:n},(e,t)=>(0,l.jsxs)(`div`,{className:L.pendulum,"data-role":t===0?`left`:t===n-1?`right`:`middle`,children:[(0,l.jsx)(`span`,{className:L.string}),(0,l.jsx)(`span`,{className:L.ball})]},t))})})},R={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},Ye=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],Xe=({data:e=Ye,size:t=240})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let r=n.current;if(!r||e.length===0)return;let i=window.devicePixelRatio||1;r.width=t*i,r.height=t*i;let a=r.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0);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=_(e=>{f=e}),m=()=>{if(u=requestAnimationFrame(m),f)return;d+=.012,a.fillStyle=`#0f172a`,a.fillRect(0,0,t,t),e.forEach((e,t)=>{let n=l*(t+1),r=e.value/o,i=v(Math.round(r*12)+1,1,16),u=.4+t*.15;a.beginPath(),a.arc(s,c,n,0,Math.PI*2),a.strokeStyle=`rgb(148 163 184 / 15%)`,a.lineWidth=1,a.stroke();for(let t=0;t<i;t++){let r=d*u+t/i*Math.PI*2,o=s+Math.cos(r)*n,l=c+Math.sin(r)*n;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}});let n=e.reduce((e,t)=>t.value>e.value?t:e,e[0]),r=Math.round(n.value/o*100);a.fillStyle=`#e2e8f0`,a.font=`bold 14px system-ui`,a.textAlign=`center`,a.fillText(`${r}%`,s,c+2),a.font=`10px system-ui`,a.fillStyle=`#94a3b8`,a.fillText(n.label,s,c+16)};return m(),()=>{cancelAnimationFrame(u),p()}},[e,t]),(0,l.jsxs)(`div`,{className:R.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:R.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:R.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:R.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},z={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},Ze=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)({x:-1e3,y:-1e3}),d=(0,c.useCallback)(()=>{s.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[t,n,e]);(0,c.useEffect)(()=>{d()},[d]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let c=window.devicePixelRatio||1;n.width=e*c,n.height=t*c;let l=n.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=0,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(f){d=requestAnimationFrame(m);return}l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let n=s.current,o=u.current,c=i*i;n.forEach(n=>{n.x+=n.vx,n.y+=n.vy,(n.x<0||n.x>e)&&(n.vx*=-1),(n.y<0||n.y>t)&&(n.vy*=-1);let r=o.x-n.x,i=o.y-n.y,a=r*r+i*i;if(a<c&&a>0){let e=Math.sqrt(a);n.vx-=r/e*.15,n.vy-=i/e*.15}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let i=n[e].x-n[t].x,o=n[e].y-n[t].y,s=i*i+o*o;if(s<r*r){let i=Math.sqrt(s);l.beginPath(),l.moveTo(n[e].x,n[e].y),l.lineTo(n[t].x,n[t].y),l.strokeStyle=a,l.globalAlpha=1-i/r,l.lineWidth=.8,l.stroke(),l.globalAlpha=1}}n.forEach(e=>{l.beginPath(),l.arc(e.x,e.y,e.radius,0,Math.PI*2),l.fillStyle=a,l.fill()}),d=requestAnimationFrame(m)};return m(),()=>{cancelAnimationFrame(d),p()}},[a,t,d,r,i,e]);let f=(e,t,n)=>{u.current={x:e-n.left,y:t-n.top}},p=e=>{f(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},m=e=>{let t=e.touches[0];t&&f(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},h=()=>{u.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:z.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:z.canvas,style:{width:e,height:t},onMouseMove:p,onMouseLeave:h,onTouchMove:m,onTouchEnd:h}),(0,l.jsx)(`p`,{className:z.hint,children:`移动鼠标或手指与粒子互动`})]})},Qe={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},$e=({width:e=800,height:t=500,density:n=.5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=Math.floor(20+n*40);i.current=Array.from({length:r},()=>({x:Math.random()*e,y:Math.random()*t,radius:Math.random()*80+40,vx:(Math.random()-.5)*.4,vy:(Math.random()-.5)*.3-.1,alpha:Math.random()*.15+.05}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c+=.008,s.fillStyle=`#1a1a2e`,s.fillRect(0,0,e,t);let n=s.createRadialGradient(e*.5,t*.3,0,e*.5,t*.5,e*.7);n.addColorStop(0,`#2d2d44`),n.addColorStop(1,`#1a1a2e`),s.fillStyle=n,s.fillRect(0,0,e,t),i.current.forEach((n,r)=>{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);let i=s.createRadialGradient(n.x,n.y,0,n.x,n.y,n.radius);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)`),s.fillStyle=i,s.beginPath(),s.arc(n.x,n.y,n.radius,0,Math.PI*2),s.fill()})};return d(),()=>{cancelAnimationFrame(a.current),u()}},[t,e]),(0,l.jsx)(`div`,{className:Qe.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Qe.canvas,style:{width:e,height:t}})})},et={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},tt=({width:e=800,height:t=500,mode:n=`snow`,count:r=120})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(r=>({x:Math.random()*e,y:r??Math.random()*t,size:n===`sakura`?Math.random()*6+4:Math.random()*3+1,speed:Math.random()*1.5+.5,drift:(Math.random()-.5)*.8,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,opacity:Math.random()*.6+.4}),[t,n,e]);return(0,c.useEffect)(()=>{a.current=Array.from({length:r},()=>s())},[r,s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=document.hidden,d=_(e=>{u=e}),f=e=>{l.globalAlpha=e.opacity,l.fillStyle=`#fff`,l.beginPath(),l.arc(e.x,e.y,e.size,0,Math.PI*2),l.fill()},p=e=>{l.save(),l.translate(e.x,e.y),l.rotate(e.rotation),l.globalAlpha=e.opacity;let t=e.size;l.fillStyle=`#ffb7c5`,l.beginPath(),l.ellipse(0,0,t,t*.6,0,0,Math.PI*2),l.fill(),l.fillStyle=`#ff8fa3`,l.beginPath(),l.ellipse(t*.3,0,t*.5,t*.35,.5,0,Math.PI*2),l.fill(),l.restore()},m=()=>{o.current=requestAnimationFrame(m),!u&&(l.fillStyle=n===`sakura`?`#1a1020`:`#0f172a`,l.fillRect(0,0,e,t),a.current.forEach(e=>{e.y+=e.speed,e.x+=e.drift+Math.sin(e.y*.02)*.3,e.rotation+=e.rotationSpeed,e.y>t+10&&Object.assign(e,s(-10)),n===`sakura`?p(e):f(e)}),l.globalAlpha=1)};return m(),()=>{cancelAnimationFrame(o.current),d()}},[s,t,n,e]),(0,l.jsx)(`div`,{className:et.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:et.canvas,style:{width:e,height:t}})})},nt={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},rt=({width:e=800,height:t=500,starCount:n=400,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({x:(Math.random()-.5)*e,y:(Math.random()-.5)*t,z:Math.random()*e}))},[t,n,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=t*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(c.fillStyle=`rgb(0 0 0 / 25%)`,c.fillRect(0,0,e,t),a.current.forEach(n=>{n.z-=r*2,n.z<=0&&(n.x=(Math.random()-.5)*e,n.y=(Math.random()-.5)*t,n.z=e);let i=128/n.z,a=n.x*i+l,o=n.y*i+u;if(a<0||a>=e||o<0||o>=t)return;let s=(1-n.z/e)*3,d=(1-n.z/e)*255;if(s>.5){let e=128/(n.z+r*4),t=n.x*e+l,i=n.y*e+u;c.beginPath(),c.strokeStyle=`rgb(${d} ${d} ${d+30})`,c.lineWidth=s,c.moveTo(t,i),c.lineTo(a,o),c.stroke()}else c.fillStyle=`rgb(${d} ${d} ${d+30})`,c.fillRect(a,o,s,s)}))};return p(),()=>{cancelAnimationFrame(o.current),f()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:nt.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:nt.canvas,style:{width:e,height:t}})})},B={progressChest:`cos-progressChest-Bqcv1`,barWrap:`cos-barWrap-E2pnl`,barTrack:`cos-barTrack-dKLhs`,barFill:`cos-barFill-NZJJe`,pct:`cos-pct-D91IU`,chest:`cos-chest-YebJO`,lid:`cos-lid-K4GSD`,open:`cos-open-eWo0Y`,lidTop:`cos-lidTop-N-p2g`,lock:`cos-lock--0AaQ`,body:`cos-body-iqUt3`,treasure:`cos-treasure-nx-6S`,pop:`cos-pop-uRZvT`,label:`cos-label-61hRe`},it=({progress:e=0,onOpen:t,label:n=`开启宝箱`})=>{let r=(0,c.useRef)(!1),i=v(e,0,100),a=i>=100;return(0,c.useEffect)(()=>{a&&!r.current&&(r.current=!0,t?.()),a||(r.current=!1)},[a,t]),(0,l.jsxs)(`div`,{className:B.progressChest,children:[(0,l.jsxs)(`div`,{className:B.barWrap,children:[(0,l.jsx)(`div`,{className:B.barTrack,children:(0,l.jsx)(`div`,{className:B.barFill,style:{width:`${i}%`}})}),(0,l.jsxs)(`span`,{className:B.pct,children:[i.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${B.chest} ${a?B.open:``}`,children:[(0,l.jsxs)(`div`,{className:B.lid,children:[(0,l.jsx)(`div`,{className:B.lidTop}),(0,l.jsx)(`div`,{className:B.lock})]}),(0,l.jsx)(`div`,{className:B.body,children:a&&(0,l.jsxs)(`div`,{className:B.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:B.label,children:a?`宝箱已开启!`:n})]})},at={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},ot=({size:e=300,color:t=`#22d3ee`,blipCount:n=5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(0),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({angle:Math.random()*Math.PI*2,dist:Math.random()*.7+.15,alpha:Math.random()*.5+.5}))},[n]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=e*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=e/2,d=e/2-10,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(o.current=requestAnimationFrame(m),f)return;i.current+=.03,c.fillStyle=`rgb(15 23 42 / 25%)`,c.fillRect(0,0,e,e);for(let e=1;e<=4;e++)c.beginPath(),c.arc(l,u,d/4*e,0,Math.PI*2),c.strokeStyle=`${t}33`,c.lineWidth=1,c.stroke();c.beginPath(),c.moveTo(l,u-d),c.lineTo(l,u+d),c.moveTo(l-d,u),c.lineTo(l+d,u),c.strokeStyle=`${t}44`,c.stroke();let n=i.current,r=c.createConicGradient(n-.5,l,u);r.addColorStop(0,`transparent`),r.addColorStop(.15,`${t}66`),r.addColorStop(.3,`transparent`),c.beginPath(),c.moveTo(l,u),c.arc(l,u,d,n-.5,n),c.closePath(),c.fillStyle=r,c.fill(),c.beginPath(),c.moveTo(l,u),c.lineTo(l+Math.cos(n)*d,u+Math.sin(n)*d),c.strokeStyle=t,c.lineWidth=2,c.stroke(),a.current.forEach(e=>{let r=e.angle,i=l+Math.cos(r)*d*e.dist,a=u+Math.sin(r)*d*e.dist;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),c.beginPath(),c.arc(i,a,4,0,Math.PI*2),c.fillStyle=t,c.globalAlpha=e.alpha,c.fill(),c.globalAlpha=1}),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=t,c.lineWidth=2,c.stroke()};return m(),()=>{cancelAnimationFrame(o.current),p()}},[n,t,e]),(0,l.jsx)(`div`,{className:at.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:at.canvas,style:{width:e,height:e}})})},V={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},st=({duration:e=1e4,onGrab:t})=>{let n=(0,c.useRef)(null),r=(0,c.useRef)([]),i=(0,c.useRef)(0),a=(0,c.useRef)(0),o=(0,c.useRef)(0),[s,u]=(0,c.useState)(0),[d,f]=(0,c.useState)(!0),p=(0,c.useRef)(!0);(0,c.useEffect)(()=>{p.current=d},[d]);let m=(0,c.useCallback)(()=>{r.current.push({id:a.current++,x:Math.random()*350+25,y:-60,speed:Math.random()*2+2,rotation:(Math.random()-.5)*.1,amount:[1,2,5,8,10,18,66,88][Math.floor(Math.random()*8)],grabbed:!1})},[]);return(0,c.useEffect)(()=>{let t=n.current;if(!t)return;let a=window.devicePixelRatio||1;t.width=400*a,t.height=500*a;let s=t.getContext(`2d`);if(!s)return;s.setTransform(a,0,0,a,0,0);let c=document.hidden,l=_(e=>{c=e}),u=window.setTimeout(()=>{p.current=!1,f(!1)},e),d=()=>{i.current=requestAnimationFrame(d),!c&&(o.current++,p.current&&o.current%20==0&&m(),s.fillStyle=`rgb(15 23 42 / 20%)`,s.fillRect(0,0,400,500),r.current=r.current.filter(e=>e.grabbed?!1:(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5,s.save(),s.translate(e.x,e.y),s.rotate(e.rotation),s.fillStyle=`#dc2626`,s.beginPath(),s.roundRect(-22,-28,44,56,6),s.fill(),s.fillStyle=`#fbbf24`,s.beginPath(),s.arc(0,-10,8,0,Math.PI*2),s.fill(),s.fillStyle=`#fde68a`,s.font=`bold 12px system-ui`,s.textAlign=`center`,s.fillText(`¥${e.amount}`,0,12),s.restore(),e.y<560)))};return d(),()=>{cancelAnimationFrame(i.current),clearTimeout(u),l()}},[e,m]),(0,l.jsxs)(`div`,{className:V.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:n,className:V.canvas,style:{width:400,height:500},onClick:e=>{let n=e.currentTarget.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top,o=!1;r.current=r.current.map(e=>e.grabbed||o?e:Math.abs(i-e.x)<30&&Math.abs(a-e.y)<35?(o=!0,u(t=>t+e.amount),t?.(e.amount),{...e,grabbed:!0}):e)}}),(0,l.jsxs)(`div`,{className:V.hud,children:[(0,l.jsxs)(`span`,{children:[`已抢: ¥`,s]}),!d&&(0,l.jsx)(`span`,{className:V.end,children:`红包雨结束`})]}),(0,l.jsx)(`p`,{className:V.hint,children:`点击红包抢夺`})]})},H={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},ct=({starCount:e,glassCount:t=8,glassRadius:n=150})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=r.current,o=i.current;if(!a||!o)return;let s=[],c=[],l=[],{width:u,height:d}=a.getBoundingClientRect(),f=e??Math.max(20,Math.floor(u/20));for(let e=0;e<f;e++){let e=window.setTimeout(()=>{let e=document.createElement(`div`);e.className=H.star,e.style.top=`${Math.random()*d}px`,e.style.left=`${Math.random()*u}px`,a.append(e),c.push(e)},Math.random()*2e3);s.push(e)}for(let e=0;e<t;e++){let r=document.createElement(`div`);r.className=H.glassItem,r.style.transform=`rotateY(${360/t*e}deg) translateZ(${n}px)`,o.appendChild(r),l.push(r);let i=window.setTimeout(()=>{r.style.top=`0px`,r.style.opacity=`1`},e*300);s.push(i)}return()=>{s.forEach(clearTimeout),c.forEach(e=>e.remove()),l.forEach(e=>e.remove())}},[e,t,n]),(0,l.jsx)(`div`,{ref:r,className:H.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:H.glassWrap})})},U={speedometer:`cos-speedometer-INc7F`,svg:`cos-svg-HG-lE`,track:`cos-track-5-922`,valueArc:`cos-valueArc-eJn3E`,tick:`cos-tick-vaiJh`,needle:`cos-needle-PwRAD`,hub:`cos-hub-4WaHw`,valueText:`cos-valueText--q4Xi`,label:`cos-label-hOPy1`},W=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},lt=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+v(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=W(100,100,72,-120),t=W(100,100,72,120);return`M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`},[]),o=(0,c.useMemo)(()=>{let e=W(100,100,72,-120),t=W(100,100,72,i),n=+(i- -120>180);return`M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`},[i]),s=W(100,100,58,i);return(0,l.jsxs)(`div`,{className:U.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:U.svg,children:[(0,l.jsx)(`path`,{d:a,className:U.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:U.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=W(100,100,58,e),n=W(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:U.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:U.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:U.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:U.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:U.label,children:n})]})},G={timelinePulse:`cos-timelinePulse-kcBM6`,axis:`cos-axis-9DWis`,track:`cos-track-jG-HV`,progress:`cos-progress-gf7v1`,steps:`cos-steps-Z-40O`,step:`cos-step-UO2Ux`,dot:`cos-dot-HJEVy`,pulse:`cos-pulse-N6FD1`,name:`cos-name-7zefJ`},ut=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=v(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:G.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:G.axis,children:[(0,l.jsx)(`div`,{className:G.track}),(0,l.jsx)(`div`,{className:G.progress}),(0,l.jsx)(`ul`,{className:G.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:G.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:G.dot}),(0,l.jsx)(`span`,{className:G.name,children:e})]},e+t)})})]})})},K={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},dt=({width:e=800,height:t=500,color:n=`#38bdf8`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0),o=(0,c.useCallback)((n,a)=>{let o=r.current;if(!o)return;let s=o.getBoundingClientRect(),c=n-s.left,l=a-s.top,u=Math.max(e,t)*.45;i.current.push({x:c,y:l,radius:0,maxRadius:u,alpha:.7})},[t,e]);return(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>o(e.clientX,e.clientY),n=e=>{let t=e.touches[0];t&&o(t.clientX,t.clientY)};return e.addEventListener(`click`,t),e.addEventListener(`touchstart`,n,{passive:!0}),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`touchstart`,n)}},[o]),(0,c.useEffect)(()=>{let o=r.current;if(!o)return;let s=window.devicePixelRatio||1;o.width=e*s,o.height=t*s;let c=o.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c.fillStyle=`#0c1929`,c.fillRect(0,0,e,t);let r=c.createLinearGradient(0,0,0,t);r.addColorStop(0,`#0f2744`),r.addColorStop(1,`#061018`),c.fillStyle=r,c.fillRect(0,0,e,t),i.current=i.current.filter(e=>(e.radius+=2.5,e.alpha-=.012,e.alpha<=0?!1:(c.beginPath(),c.arc(e.x,e.y,e.radius,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*(1-e.radius/e.maxRadius),c.lineWidth=2,c.stroke(),e.radius>8&&(c.beginPath(),c.arc(e.x,e.y,e.radius*.6,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*.4,c.lineWidth=1,c.stroke()),c.globalAlpha=1,!0)))};return d(),()=>{cancelAnimationFrame(a.current),u()}},[n,t,e]),(0,l.jsxs)(`div`,{className:K.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:r,className:K.canvas,style:{width:e,height:t}}),(0,l.jsx)(`span`,{className:K.hint,children:`点击水面产生涟漪`})]})},ft={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},pt=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,mt=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=pt})=>{let[r,i]=(0,c.useState)(``),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=n.length>0?n:pt,s=e;o.current=performance.now();let c=e=>{let n=e-o.current,l=Math.min(n/t,1),u=Math.floor(l*s.length);i(s.split(``).map((e,t)=>e===` `?` `:t<u?e:r[Math.floor(Math.random()*r.length)]).join(``)),l<1?a.current=requestAnimationFrame(c):i(s)};return a.current=requestAnimationFrame(c),()=>cancelAnimationFrame(a.current)},[e,t,n]),(0,l.jsx)(`div`,{className:ft.scrambleText,children:(0,l.jsxs)(`p`,{className:ft.text,children:[r,(0,l.jsx)(`span`,{className:ft.cursor})]})})},q={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},ht=({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,onReveal:n,width:r=300,height:i=180})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(!1),s=(0,c.useRef)(!1),[u,d]=(0,c.useState)(!1),f=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,r,i),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(`刮开涂层`,r/2,i/2)},[e,i,r]),p=(0,c.useCallback)(e=>{if(s.current)return;let t=e.getContext(`2d`);if(!t)return;let r=t.getImageData(0,0,e.width,e.height),i=0;for(let e=3;e<r.data.length;e+=4)r.data[e]<128&&i++;i/(e.width*e.height)>.45&&(s.current=!0,d(!0),n?.())},[n]);(0,c.useEffect)(()=>{let e=a.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=i*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),f(n))},[f,i,r]);let m=(e,t)=>{let n=a.current;if(!n||s.current)return;let r=n.getContext(`2d`);r&&(r.globalCompositeOperation=`destination-out`,r.beginPath(),r.arc(e,t,20,0,Math.PI*2),r.fill(),p(n))},h=e=>{let t=a.current;if(!t)return null;let n=t.getBoundingClientRect();if(`touches`in e){let t=e.touches[0];return{x:t.clientX-n.left,y:t.clientY-n.top}}return{x:e.clientX-n.left,y:e.clientY-n.top}},g=e=>{o.current=!0;let t=h(e);t&&m(t.x,t.y)},_=e=>{if(!o.current)return;let t=h(e);t&&m(t.x,t.y)},v=()=>{o.current=!1};return(0,l.jsxs)(`div`,{className:q.scratchCard,style:{width:r,height:i},children:[(0,l.jsx)(`div`,{className:q.prize,children:t}),(0,l.jsx)(`canvas`,{ref:a,className:`${q.canvas} ${u?q.hidden:``}`,style:{width:r,height:i},onMouseDown:g,onMouseMove:_,onMouseUp:v,onMouseLeave:v,onTouchStart:g,onTouchMove:_,onTouchEnd:v})]})},J={slotMachine:`cos-slotMachine-P6FyZ`,machine:`cos-machine-B066r`,reel:`cos-reel-eEpJ3`,strip:`cos-strip-L5Z-a`,item:`cos-item-WYJ6q`,mask:`cos-mask-jdrj3`,spinBtn:`cos-spinBtn-DvDE7`,result:`cos-result-dLN5b`},gt=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],_t=e=>1-(1-e)**3,vt=({symbols:e=gt,onSpinEnd:t})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)([0,0,0]),[o,s]=(0,c.useState)([]),u=(0,c.useRef)(0),d=(0,c.useRef)(t),f=(0,c.useRef)(null);(0,c.useEffect)(()=>{d.current=t},[t]);let p=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<20;n++)t.push(...e);return t},[e])();return(0,c.useEffect)(()=>()=>{f.current&&(f.current.cancelled=!0),cancelAnimationFrame(u.current)},[]),(0,l.jsxs)(`div`,{className:J.slotMachine,children:[(0,l.jsx)(`div`,{className:J.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:J.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:J.strip,style:{transform:`translateY(${i[e]}px)`},children:p.map((e,t)=>(0,l.jsx)(`div`,{className:J.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:J.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:J.spinBtn,onClick:()=>{if(n)return;r(!0),s([]);let t=[0,1,2].map(()=>Math.floor(Math.random()*e.length)),o=t.map(t=>-(t-1+e.length*10)*80),c=[...i],l=2e3,p=[0,300,600],m=performance.now(),h={cancelled:!1};f.current=h;let g=n=>{if(!h.cancelled){if(a(c.map((e,t)=>{let r=n-m-p[t];if(r<0)return e;let i=_t(Math.min(r/l,1));return e+(o[t]-e)*i})),!p.every(e=>n-m-e>=l))u.current=requestAnimationFrame(g);else if(!h.cancelled){let n=t.map(t=>e[t]);s(n),r(!1),d.current?.(n)}}};u.current=requestAnimationFrame(g)},disabled:n,children:n?`旋转中...`:`开始`}),o.length>0&&!n&&(0,l.jsx)(`p`,{className:J.result,children:o[0]===o[1]&&o[1]===o[2]?`🎰 大奖!`:`结果: ${o.join(` `)}`})]})},Y={splitReveal:`cos-splitReveal-6W8-6`,text:`cos-text-miTsj`,char:`cos-char-0gPJV`,reveal:`cos-reveal-YGzz-`,fromTop:`cos-fromTop-YXHUa`,fromBottom:`cos-fromBottom-24D6g`,fromLeft:`cos-fromLeft-OMiPY`,fromRight:`cos-fromRight-EcMOR`},yt=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],bt=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:Y.splitReveal,children:(0,l.jsx)(`h1`,{className:Y.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${Y.char} ${Y[yt[n%yt.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),xt={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},St=({children:e,radius:t=120,dimColor:n=`rgba(0, 0, 0, 0.85)`})=>{let r=(0,c.useRef)(null),i=(0,c.useCallback)(e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top;t.style.setProperty(`--spot-x`,`${i}px`),t.style.setProperty(`--spot-y`,`${a}px`)},[]);return(0,l.jsxs)(`div`,{ref:r,className:xt.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:xt.content,children:e}),(0,l.jsx)(`div`,{className:xt.overlay})]})},X={turntable:`cos-turntable-dkc32`,wheelWrap:`cos-wheelWrap-n7lhc`,canvas:`cos-canvas-A1-4x`,pointer:`cos-pointer-Rk1S9`,spinBtn:`cos-spinBtn-l9JIC`,result:`cos-result-H8q2c`,"fade-in":`cos-fade-in-U9bUC`},Ct=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],wt=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Tt=e=>1-(1-e)**3,Et=({prizes:e=wt,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,onSpinEnd:a})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(null),g=(0,c.useRef)(a),_=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=a},[a]);let v=t+48,y=(e,t)=>t.color??Ct[e%Ct.length],b=(0,c.useCallback)(n=>{let r=o.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=v/2,s=t/2,c=Math.PI*2/e.length;i.clearRect(0,0,v,v),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*c-Math.PI/2,a=r+c,o=y(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,s,r,a),i.closePath(),i.fillStyle=o,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+c/2),i.textAlign=`right`,i.fillStyle=`#fff`,i.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,i.shadowColor=`rgb(0 0 0 / 30%)`,i.shadowBlur=4,i.fillText(e.label,s-18,6),i.restore()}),i.beginPath(),i.arc(0,0,s,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,s-4,0,Math.PI*2),i.strokeStyle=`#f59e0b`,i.lineWidth=2,i.stroke(),i.restore(),i.save(),i.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(s+14),r=Math.sin(t)*(s+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[v,e,t]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;d.current=t,e.width=v*t,e.height=v*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),b(s.current)},[v,b]),(0,c.useEffect)(()=>()=>{_.current&&(_.current.cancelled=!0),u.current&&cancelAnimationFrame(u.current)},[]);let x=t=>{let n=360/e.length,r=(180/Math.PI*t%360+360)%360;return Math.floor((360-r+n/2)%360/n)%e.length};return(0,l.jsxs)(`div`,{className:X.turntable,style:{width:v,height:v+80},children:[(0,l.jsxs)(`div`,{className:X.wheelWrap,style:{width:v,height:v},children:[(0,l.jsx)(`div`,{className:X.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:X.canvas,style:{width:v,height:v}}),(0,l.jsx)(`button`,{type:`button`,className:X.spinBtn,onClick:()=>{if(f||e.length===0)return;p(!0),h(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,a=s.current,o=a+r*Math.PI*2+(Math.PI*2-i)-a%(Math.PI*2),c=a,l=performance.now(),d={cancelled:!1};_.current=d;let m=t=>{if(d.cancelled)return;let r=t-l,i=Math.min(r/n,1),a=Tt(i),f=c+(o-c)*a;if(s.current=f,b(f),i<1)u.current=requestAnimationFrame(m);else{let t=x(f),n=e[t];s.current=f,p(!1),h(n),g.current?.(n,t)}};u.current=requestAnimationFrame(m)},disabled:f,children:f?`抽奖中...`:i})]}),m&&!f&&(0,l.jsxs)(`p`,{className:X.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Z={typewriter:`cos-typewriter-7UhOL`,terminal:`cos-terminal-NWNVN`,dots:`cos-dots-oulNg`,text:`cos-text-ICV5T`,prompt:`cos-prompt-Y4hVD`,cursor:`cos-cursor-m8hGi`,blink:`cos-blink-XykM7`},Dt=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Ot=({texts:e,speed:t,deleteSpeed:n,pause:r})=>{let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let c=e[o%e.length],l;if(!u&&i===c)l=setTimeout(()=>d(!0),r);else if(u&&i===``)l=setTimeout(()=>{d(!1),s(t=>(t+1)%e.length)},0);else{let e=u?c.slice(0,i.length-1):c.slice(0,i.length+1);l=setTimeout(()=>a(e),u?n:t)}return()=>clearTimeout(l)},[i,u,o,e,t,n,r]),(0,l.jsx)(`div`,{className:Z.typewriter,children:(0,l.jsxs)(`div`,{className:Z.terminal,children:[(0,l.jsxs)(`div`,{className:Z.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Z.text,children:[(0,l.jsx)(`span`,{className:Z.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Z.cursor,children:`|`})]})]})})},kt=({texts:e=Dt,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Dt;return(0,l.jsx)(Ot,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},Q={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},At=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:Q.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${Q.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:Q.wave}),(0,l.jsx)(`span`,{className:Q.wave}),(0,l.jsx)(`span`,{className:Q.label,children:e})]})}),$={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},jt=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:$.waveText,children:(0,l.jsx)(`h1`,{className:$.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:$.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=b,exports.Aurora=g,exports.BarcodeScan=d,exports.BurnAway=p,exports.CanvasClock=S,exports.Charge=ee,exports.ClickSpark=te,exports.Confetti=ae,exports.Countdown=de,exports.CursorTrail=ge,exports.CyberGrid=se,exports.DiceRoll=ve,exports.DnaHelix=pe,exports.ElectricArc=he,exports.Fireworks=we,exports.FlipCounter=De,exports.GlitchText=Me,exports.GradientFlow=Ae,exports.GravityBalls=Fe,exports.HolographicCard=Ie,exports.LiquidGlass=Re,exports.LiquidProgress=Le,exports.MagneticButton=Be,exports.MatrixRain=He,exports.MazeGenerator=We,exports.MeteorRain=Ke,exports.NeonText=qe,exports.NewtonCradle=Je,exports.OrbitalChart=Xe,exports.ParticleNetwork=Ze,exports.ProgressChest=it,exports.RadarScan=ot,exports.RedPacketRain=st,exports.ReturnCity=ct,exports.RippleWater=dt,exports.ScrambleText=mt,exports.ScratchCard=ht,exports.SlotMachine=vt,exports.SmokeFog=$e,exports.Snowfall=tt,exports.Speedometer=lt,exports.SplitReveal=bt,exports.Spotlight=St,exports.Starfield=rt,exports.TimelinePulse=ut,exports.Turntable=Et,exports.Typewriter=kt,exports.WaveButton=At,exports.WaveText=jt;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={barcodeScan:`cos-barcodeScan-aH9Ad`,content:`cos-content-F73ZD`,"glitch-skew":`cos-glitch-skew-inh6a`,placeholder:`cos-placeholder-yYVB8`,overlay:`cos-overlay-4AiY5`,scanLine:`cos-scanLine-VBsRv`,scan:`cos-scan-JD4wO`,glitchLayer:`cos-glitchLayer-nzkIa`,flicker:`cos-flicker-P0jQE`,corners:`cos-corners-1bjak`},d=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:u.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:u.content,children:e??(0,l.jsx)(`span`,{className:u.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:u.overlay,children:[(0,l.jsx)(`div`,{className:u.scanLine}),(0,l.jsx)(`div`,{className:u.glitchLayer})]}),(0,l.jsxs)(`div`,{className:u.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),f={burnAway:`cos-burnAway-QWIjy`,stage:`cos-stage-8VIfE`,text:`cos-text-0guk-`,canvas:`cos-canvas-Bwc-u`,trigger:`cos-trigger-UDZqV`,hint:`cos-hint-XQUfv`},p=({text:e=`BURN`,fontSize:t=64,onComplete:n})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1),d=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{a||s||o(!0)},[a,s]);return(0,c.useEffect)(()=>{if(!a||s)return;let n=r.current,o=i.current;if(!n||!o)return;let c=n.getBoundingClientRect(),l=window.devicePixelRatio||1,f=Math.ceil(c.width),m=Math.ceil(c.height);o.width=f*l,o.height=m*l,o.style.width=`${f}px`,o.style.height=`${m}px`;let h=o.getContext(`2d`);if(!h)return;h.scale(l,l);let g=document.createElement(`canvas`);g.width=f*l,g.height=m*l;let _=g.getContext(`2d`);if(!_)return;_.scale(l,l),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,f/2,m/2);let v=_.getImageData(0,0,f*l,m*l).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<f;t+=4)v[(Math.floor(e*l)*f*l+Math.floor(t*l))*4+3]>128&&y.push({x:t,y:e,vx:(Math.random()-.5)*2,vy:-Math.random()*3-1,life:1,maxLife:.6+Math.random()*.6,size:2+Math.random()*3});let b=0,x=0,S=!1,C=(e,t)=>{if(S)return;let n=Math.min((e-t)/16,2);x+=n*16,h.clearRect(0,0,f,m);let r=0;for(let e of y){if(e.life-=n*.012/e.maxLife,e.life<=0)continue;r++,e.x+=e.vx*n,e.y+=e.vy*n,e.vy+=.04*n;let t=e.life,i=1-e.life,a=Math.max(0,200-i*200),o=Math.max(0,80-i*80);h.globalAlpha=t,h.fillStyle=`rgb(255,${a},${o})`,h.beginPath(),h.arc(e.x,e.y,e.size*t,0,Math.PI*2),h.fill()}h.globalAlpha=1,x<2500&&r>0?b=requestAnimationFrame(t=>C(t,e)):S||(u(!0),d.current||(d.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[a,s,e,t]),(0,l.jsxs)(`div`,{className:f.burnAway,children:[(0,l.jsxs)(`div`,{ref:r,className:f.stage,children:[!s&&(0,l.jsx)(`span`,{className:f.text,style:{fontSize:t,opacity:+!a},children:e}),(0,l.jsx)(`canvas`,{ref:i,className:f.canvas})]}),!a&&!s&&(0,l.jsx)(`button`,{type:`button`,className:f.trigger,onClick:m,children:`Ignite`}),s&&(0,l.jsx)(`p`,{className:f.hint,children:`Gone.`})]})},m={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},h=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],g=({width:e=800,height:t=500,colors:n=h})=>{let r=n.length>=2?n:h;return(0,l.jsx)(`div`,{className:m.aurora,style:{width:e,height:t},children:r.map((e,t)=>(0,l.jsx)(`div`,{className:m.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`}},e+t))})},_=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},v=(e,t,n)=>Math.min(n,Math.max(t,e)),y={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},b=({width:e=400,height:t=120,barCount:n=32,useMic:r=!1})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=null,d=null,f=null,p=null,m=0,h=!1,g=_(e=>{l=e});(async()=>{if(!(!r||!navigator.mediaDevices?.getUserMedia))try{if(p=await navigator.mediaDevices.getUserMedia({audio:!0}),h){p.getTracks().forEach(e=>e.stop()),p=null;return}u=new AudioContext,d=u.createAnalyser(),d.fftSize=256,u.createMediaStreamSource(p).connect(d),f=new Uint8Array(d.frequencyBinCount)}catch{}})();let v=()=>{if(c=requestAnimationFrame(v),l)return;let r=Array(n).fill(0);if(d&&f){d.getByteFrequencyData(f);let e=Math.floor(f.length/n);for(let t=0;t<n;t++)r[t]=f[t*e]/255}else{m+=.08;for(let e=0;e<n;e++)r[e]=(Math.sin(m+e*.35)+1)*.35+Math.random()*.15}s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=(e-3*(n-1))/n;for(let e=0;e<n;e++){let n=Math.max(4,r[e]*t*.9),a=e*(i+3),o=t-n,c=s.createLinearGradient(0,o,0,t);c.addColorStop(0,`#a78bfa`),c.addColorStop(1,`#38bdf8`),s.fillStyle=c,s.beginPath(),s.roundRect(a,o,i,n,2),s.fill()}};return v(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:y.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:y.canvas,style:{width:e,height:t}})})},x={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},S=({width:e=400,height:t=400})=>{let n=(0,c.useRef)(null),r=Math.min(e,t),i=r/2-16,a=r/2,o=(0,c.useCallback)(e=>{e.clearRect(0,0,r,r),e.save(),e.translate(a,a),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#fff`,e.fill(),e.strokeStyle=`#d1d5db`,e.lineWidth=2,e.stroke();for(let t=0;t<60;t++){let n=t/60*Math.PI*2,r=i-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(n)*r,Math.sin(n)*r),e.lineTo(Math.cos(n)*i,Math.sin(n)*i),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(r/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let n=t/12*Math.PI*2-Math.PI/2,r=i-32;e.fillText(String(t),Math.cos(n)*r,Math.sin(n)*r)}let t=new Date,n=t.getHours()%12,o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds(),l=(t,n,r,i,a)=>{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()},u=(n+o/60)/12*Math.PI*2-Math.PI/2,d=(o+s/60)/60*Math.PI*2-Math.PI/2,f=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(u,i*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(d,i*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(f,i*.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()},[a,i,r]);return(0,c.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=r*t;let i=e.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=0,s=document.hidden,c=_(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:x.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:x.canvasTarget,style:{width:r,height:r}})})},C={chargeContainer:`cos-chargeContainer-4t9qo`,text:`cos-text-2k7eH`,contrast:`cos-contrast-PNep9`,hueRotate:`cos-hueRotate-bMJ-k`,bubble:`cos-bubble-VXfOd`,moveUp:`cos-moveUp-1Vz9j`,circle:`cos-circle-m4vwX`,circleRotate:`cos-circleRotate-bgFw5`,button:`cos-button-myCst`},ee=15,te=258,ne=e=>{let{initQuantity:t=0,value:n,onChange:r,autoCharge:i=!0,interval:a=500,step:o=.01}=e,s=(0,c.useRef)(null),u=n!==void 0,[d,f]=(0,c.useState)(()=>v(t,0,100)),p=v(u?n:d,0,100),m=(0,c.useRef)(p),h=(0,c.useRef)(r);(0,c.useEffect)(()=>{h.current=r},[r]),(0,c.useEffect)(()=>{m.current=p},[p]),(0,c.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=Math.max(0,e.clientHeight-te);e.style.setProperty(`--charge-rise-max`,`${t}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{if(m.current>=100)return;let e=Math.min(100,Number((m.current+o).toFixed(2)));u?h.current?.(e):f(e)},a);return()=>clearInterval(e)},[i,a,u,o]);let g=p.toFixed(2);return(0,l.jsxs)(`div`,{ref:s,className:C.chargeContainer,"data-auto":i?`true`:`false`,style:{"--charge-pct":p},children:[(0,l.jsxs)(`div`,{className:C.contrast,children:[Array.from({length:ee},(e,t)=>(0,l.jsx)(`span`,{className:C.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:C.circle}),(0,l.jsx)(`div`,{className:C.button})]}),(0,l.jsxs)(`div`,{className:C.text,children:[g,`%`]})]})},w={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},re=({children:e,color:t=`#fbbf24`,count:n=16})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)((e,t)=>{for(let r=0;r<n;r++){let i=Math.PI*2*r/n+Math.random()*.3,o=Math.random()*4+2;a.current.push({x:e,y:t,vx:Math.cos(i)*o,vy:Math.sin(i)*o,alpha:1,size:Math.random()*3+2})}},[n]);return(0,c.useEffect)(()=>{let e=i.current,n=r.current;if(!e||!n)return;let s=e.getContext(`2d`);if(!s)return;let c=()=>{let t=window.devicePixelRatio||1,{width:r,height:i}=n.getBoundingClientRect();e.width=r*t,e.height=i*t,s.setTransform(t,0,0,t,0,0)};c();let l=new ResizeObserver(c);l.observe(n);let u=document.hidden,d=_(e=>{u=e}),f=()=>{if(o.current=requestAnimationFrame(f),u)return;let{width:e,height:r}=n.getBoundingClientRect();s.clearRect(0,0,e,r),a.current=a.current.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.15,e.alpha-=.03,e.alpha<=0?!1:(s.beginPath(),s.arc(e.x,e.y,e.size,0,Math.PI*2),s.fillStyle=t,s.globalAlpha=e.alpha,s.fill(),s.globalAlpha=1,!0)))};return f(),()=>{cancelAnimationFrame(o.current),l.disconnect(),d()}},[t]),(0,l.jsxs)(`div`,{ref:r,className:w.clickSpark,onClick:e=>{let t=r.current?.getBoundingClientRect();t&&s(e.clientX-t.left,e.clientY-t.top)},children:[(0,l.jsx)(`canvas`,{ref:i,className:w.canvas}),e&&(0,l.jsx)(`div`,{className:w.content,children:e}),!e&&(0,l.jsx)(`p`,{className:w.hint,children:`点击任意位置产生火花`})]})},T={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},ie=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],ae=()=>ie[Math.floor(Math.random()*ie.length)],oe=(e,t,n)=>{let r=e/2,i=t*.6;return Array.from({length:n},()=>{let e=(Math.random()-.5)*Math.PI,t=Math.random()*12+6;return{x:r+(Math.random()-.5)*40,y:i,vx:Math.cos(e)*t,vy:Math.sin(e)*t-Math.random()*8,rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*12,color:ae(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},se=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120},i)=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)({width:e,height:t,particleCount:r});u.current={width:e,height:t,particleCount:r};let d=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=u.current;o.current.push(...oe(e,t,n))},[]);return(0,c.useImperativeHandle)(i,()=>({burst:d}),[d]),(0,c.useEffect)(()=>{n&&d()},[n,d]),(0,c.useEffect)(()=>{let n=a.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{s.current=requestAnimationFrame(u),!c&&(i.clearRect(0,0,e,t),o.current=o.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>t+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))))};return u(),()=>{cancelAnimationFrame(s.current),l()}},[t,e]),(0,l.jsxs)(`div`,{className:T.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:T.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:T.hint,children:`点击画布再次喷射`})]})});se.displayName=`Confetti`;var ce={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},le=({width:e=800,height:t=500,color:n=`#00f0ff`,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=i.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=t*.45,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(a.current=requestAnimationFrame(p),d)return;o.current=(o.current+r*1.5)%40,l.fillStyle=`#050510`,l.fillRect(0,0,e,t);let i=l.createLinearGradient(0,0,0,u);i.addColorStop(0,`#0a0a20`),i.addColorStop(1,`#050510`),l.fillStyle=i,l.fillRect(0,0,e,u);let s=e/2;l.strokeStyle=n,l.shadowColor=n,l.shadowBlur=8,l.lineWidth=1;for(let n=-12;n<=12;n++){let r=n/12*e*1.2;l.beginPath(),l.moveTo(s+r*.05,u),l.lineTo(s+r,t),l.globalAlpha=.3+(1-Math.abs(n)/12)*.5,l.stroke()}l.globalAlpha=1;let c=Math.ceil(t/40)+2;for(let n=0;n<c;n++){let r=u+(n*40+o.current)/(t-u)*(t-u)%(t-u),i=(r-u)/(t-u)*.8;l.beginPath(),l.moveTo(0,r),l.lineTo(e,r),l.globalAlpha=i,l.stroke()}l.shadowBlur=0,l.globalAlpha=1;let f=l.createRadialGradient(s,u,0,s,u,e*.4);f.addColorStop(0,`${n}33`),f.addColorStop(1,`transparent`),l.fillStyle=f,l.fillRect(0,0,e,t)};return p(),()=>{cancelAnimationFrame(a.current),f()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:ce.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ce.canvas,style:{width:e,height:t}})})},E={countdown:`cos-countdown-5ZKKP`,unit:`cos-unit-dth8N`,value:`cos-value-yVzcP`,label:`cos-label-pAMEs`,ended:`cos-ended-c0dsD`,pulse:`cos-pulse-krQd-`,invalid:`cos-invalid-d6t-L`},ue=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),de=e=>{let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);return{total:t,days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:n%60}},fe=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],pe=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>ue(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?de(i):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{u.current=t},[t]),(0,c.useEffect)(()=>{if(!a)return;if(s.current=!1,Date.now()>=i){s.current=!0,u.current?.();return}let e=window.setInterval(()=>{o(e=>e+1),Date.now()>=i&&!s.current&&(s.current=!0,u.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[a,i]),a?(0,l.jsxs)(`div`,{className:E.countdown,style:{"--countdown-color":r},children:[fe.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:E.unit,children:[(0,l.jsx)(`div`,{className:E.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:E.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:E.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:E.countdown,children:(0,l.jsx)(`p`,{className:E.invalid,children:`无效的目标时间`})})},me={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},he=({width:e=200,height:t=360,speed:n=1,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=0,u=document.hidden,d=_(e=>{u=e}),f=()=>{if(l=requestAnimationFrame(f),u)return;c+=.03*n,s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=e/2,a=e*.32;for(let e=0;e<18;e++){let n=e/17*(t-40)+20,o=c+e*.4,l=i+Math.sin(o)*a,u=i+Math.sin(o+Math.PI)*a,d=Math.cos(o),f=5+d*2;s.beginPath(),s.moveTo(l,n),s.lineTo(u,n),s.strokeStyle=`rgb(148 163 184 / ${30+Math.abs(d)*30}%)`,s.lineWidth=1.5,s.stroke(),s.beginPath(),s.arc(l,n,f,0,Math.PI*2),s.fillStyle=d>0?r:`#a78bfa`,s.fill(),s.beginPath(),s.arc(u,n,f,0,Math.PI*2),s.fillStyle=d>0?`#a78bfa`:r,s.fill()}};return f(),()=>{cancelAnimationFrame(l),d()}},[r,t,n,e]),(0,l.jsx)(`div`,{className:me.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:me.canvas,style:{width:e,height:t}})})},ge={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},D=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];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);return[...m.slice(0,-1),...h]},_e=({width:e=320,height:t=160,color:n=`#67e8f9`})=>{let r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=r.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=t/2,c=e-40,l=t/2,u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=D(40,s,c,l,40,5);o.beginPath(),r.forEach(([e,t],n)=>n===0?o.moveTo(e,t):o.lineTo(e,t)),o.strokeStyle=n,o.lineWidth=2,o.shadowColor=n,o.shadowBlur=12,o.stroke(),o.shadowBlur=0,o.beginPath(),r.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])=>{o.beginPath(),o.arc(e,t,6,0,Math.PI*2),o.fillStyle=n,o.fill()})};return p(),()=>{cancelAnimationFrame(u),f()}},[n,t,e]),(0,l.jsx)(`div`,{className:ge.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ge.canvas,style:{width:e,height:t}})})},O={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},ve=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:n/2,y:r/2}),s=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let c=i.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=n*l,c.height=r*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=document.hidden,f=_(e=>{d=e}),p=()=>{if(s.current=requestAnimationFrame(p),d)return;let{x:i,y:c}=o.current;a.current.unshift({x:i,y:c,life:1}),a.current.length>t&&(a.current.length=t),u.fillStyle=`rgb(15 23 42 / 15%)`,u.fillRect(0,0,n,r);let l=a.current;for(let t=0;t<l.length;t++){let n=l[t],r=1-t/l.length,i=(1-t/l.length)*8+2;u.beginPath(),u.arc(n.x,n.y,i,0,Math.PI*2),u.fillStyle=e,u.globalAlpha=r*.8,u.fill()}u.globalAlpha=1};return p(),()=>{cancelAnimationFrame(s.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:O.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:i,className:O.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();o.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:O.hint,children:`移动鼠标查看粒子轨迹`})]})},k={diceRoll:`cos-diceRoll-GDwjV`,scene:`cos-scene-tmnKM`,cube:`cos-cube-RklEa`,rolling:`cos-rolling-2ocEq`,face:`cos-face-10eAF`,dot:`cos-dot-p5AzF`,face1:`cos-face1-Ev-x5`,face2:`cos-face2-2M17p`,face3:`cos-face3-Wd6T4`,face4:`cos-face4-RsRwQ`,face5:`cos-face5-PiJbu`,face6:`cos-face6-Yp-MX`,rollBtn:`cos-rollBtn-nXMWJ`,result:`cos-result-kXzu9`},ye={1:{x:0,y:0},2:{x:0,y:180},3:{x:0,y:-90},4:{x:0,y:90},5:{x:-90,y:0},6:{x:90,y:0}},be=({onRoll:e,sides:t=6})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)(1),[o,s]=(0,c.useState)({x:0,y:0,z:0}),u=(0,c.useRef)(e),d=(0,c.useRef)(0);(0,c.useEffect)(()=>{u.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(d.current),[]);let f=()=>{if(n)return;r(!0);let e=Math.floor(Math.random()*t)+1,i=ye[e]??ye[1],o=360*(3+Math.floor(Math.random()*3)),c=360*(3+Math.floor(Math.random()*3));s({x:i.x+o,y:i.y+c,z:Math.random()*360}),clearTimeout(d.current),d.current=window.setTimeout(()=>{a(e),r(!1),u.current?.(e)},1200)},p=e=>({1:[[50,50]],2:[[25,25],[75,75]],3:[[25,25],[50,50],[75,75]],4:[[25,25],[75,25],[25,75],[75,75]],5:[[25,25],[75,25],[50,50],[25,75],[75,75]],6:[[25,25],[75,25],[25,50],[75,50],[25,75],[75,75]]}[e]??[]).map(([e,t],n)=>(0,l.jsx)(`span`,{className:k.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:k.diceRoll,children:[(0,l.jsx)(`div`,{className:k.scene,children:(0,l.jsx)(`div`,{className:`${k.cube} ${n?k.rolling:``}`,style:{transform:`rotateX(${o.x}deg) rotateY(${o.y}deg) rotateZ(${o.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${k.face} ${k[`face${e}`]}`,children:p(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:k.rollBtn,onClick:f,disabled:n,children:n?`掷骰中...`:`掷骰子`}),!n&&(0,l.jsxs)(`p`,{className:k.result,children:[`点数: `,i]})]})},A={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},xe=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],Se=.12,Ce=240,we=()=>xe[Math.floor(Math.random()*xe.length)],Te=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:we(),decay:Math.random()*.015+.01}})},Ee=(0,c.forwardRef)(({width:e=800,height:t=500,auto:n=!0},r)=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(n=>{let r=n??Math.random()*e*.6+e*.2;a.current.push({x:r,y:t,vy:-(Math.random()*4+6),targetY:Math.random()*t*.35+t*.15,color:we(),exploded:!1,particles:[],age:0})},[t,e]);return(0,c.useImperativeHandle)(r,()=>({launch:s}),[s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(l.fillStyle=`rgb(15 23 42 / 25%)`,l.fillRect(0,0,e,t),a.current=a.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=Se,l.beginPath(),l.arc(e.x,e.y,2.5,0,Math.PI*2),l.fillStyle=e.color,l.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=Ce;return(t||n||r||i)&&(e.exploded=!0,e.particles=Te(e.x,e.y,e.color)),!0}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:(l.beginPath(),l.arc(e.x,e.y,2,0,Math.PI*2),l.fillStyle=e.color,l.globalAlpha=e.alpha,l.fill(),l.globalAlpha=1,!0))),e.particles.length>0}))};return p(),n&&(u=window.setInterval(()=>s(),1200)),()=>{cancelAnimationFrame(o.current),clearInterval(u),f()}},[n,t,s,e]),(0,l.jsxs)(`div`,{className:A.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:A.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:A.hint,children:`点击画布燃放烟花`})]})});Ee.displayName=`Fireworks`;var j={flipCounter:`cos-flipCounter-3LuI0`,digit:`cos-digit-yJRPy`,digitCard:`cos-digitCard-zZUzt`,staticTop:`cos-staticTop-aLQcm`,staticBottom:`cos-staticBottom-9y0gu`,flap:`cos-flap-i3YKR`,flapTop:`cos-flapTop-70z-k`,flapBottom:`cos-flapBottom-zhMZe`,isFlipping:`cos-isFlipping-EVEdI`,"fold-top":`cos-fold-top-v-6XJ`,"unfold-bottom":`cos-unfold-bottom-e2gzU`},De=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Oe=({digit:e,color:t,duration:n})=>{let r=(0,c.useRef)(e),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(e);(0,c.useEffect)(()=>{if(e===r.current)return;s(r.current),a(!0),r.current=e;let t=window.setTimeout(()=>a(!1),n);return()=>clearTimeout(t)},[e,n]);let u=i?o:e;return(0,l.jsx)(`div`,{className:j.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${j.digitCard} ${i?j.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:j.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:j.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${j.flap} ${j.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${j.flap} ${j.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},ke=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=De(e,t).split(``);return(0,l.jsx)(`div`,{className:j.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Oe,{digit:e,color:n,duration:r},t))})},Ae={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},je=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],Me=({text:e=`GRADIENT`,colors:t=je,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):je.join(`, `);return(0,l.jsx)(`div`,{className:Ae.gradientFlow,children:(0,l.jsx)(`h1`,{className:Ae.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},Ne={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Pe=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:Ne.glitchText,children:(0,l.jsx)(`h1`,{className:Ne.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Fe={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Ie=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Le=({width:e=400,height:t=300,ballCount:n=12})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*(e-40)+20,y:t*.5*Math.random()+10,vx:(Math.random()-.5)*4,vy:Math.random()*2,r:Math.random()*10+8,color:Ie[Math.floor(Math.random()*Ie.length)]}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let a=window.devicePixelRatio||1;n.width=e*a,n.height=t*a;let o=n.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=0,c=document.hidden,l=_(e=>{c=e}),u=()=>{if(s=requestAnimationFrame(u),c)return;let n=i.current;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);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);for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){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;if(s<c){let e=a/s,t=o/s,n=c-s;r.x-=e*n*.5,r.y-=t*n*.5,i.x+=e*n*.5,i.y+=t*n*.5;let l=(r.vx-i.vx)*e+(r.vy-i.vy)*t;l>0&&(r.vx-=l*e,r.vy-=l*t,i.vx+=l*e,i.vy+=l*t)}}for(let e of n){o.beginPath(),o.arc(e.x,e.y,e.r,0,Math.PI*2);let t=o.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r);t.addColorStop(0,`#fff`),t.addColorStop(.3,e.color),t.addColorStop(1,e.color),o.fillStyle=t,o.fill()}};return u(),()=>{cancelAnimationFrame(s),l()}},[t,e]),(0,l.jsx)(`div`,{className:Fe.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Fe.canvas,style:{width:e,height:t}})})},M={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Re=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:M.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:M.card,onMouseMove:e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=(e.clientX-n.left)/n.width-.5,a=(e.clientY-n.top)/n.height-.5;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}%`)},onMouseLeave:()=>{let e=r.current;e&&(e.style.setProperty(`--rx`,`0deg`),e.style.setProperty(`--ry`,`0deg`),e.style.setProperty(`--gx`,`50%`),e.style.setProperty(`--gy`,`50%`))},children:[(0,l.jsx)(`div`,{className:M.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:M.image}):(0,l.jsx)(`div`,{className:M.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:M.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},N={liquidProgress:`cos-liquidProgress-ABZZA`,svg:`cos-svg-YdTvy`,track:`cos-track-IhMjO`,ring:`cos-ring-6PKMg`,fillBg:`cos-fillBg-pwLI1`,wave:`cos-wave-CBwgG`,label:`cos-label-WYDqS`},ze=({value:e=0,max:t=100,size:n=160,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useId)().replace(/:/g,``),o=v(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=_(e=>{n=e}),a=()=>{if(!n){t+=.04;let e=i.current;if(e){let n=s+Math.sin(t)*2;e.setAttribute(`d`,`M0,${n} Q25,${n-4+Math.sin(t*1.3)*3} 50,${n} T100,${n} V100 H0 Z`)}}e=requestAnimationFrame(a)};return e=requestAnimationFrame(a),()=>{cancelAnimationFrame(e),r()}},[s]),(0,l.jsxs)(`div`,{className:N.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:N.svg,children:[(0,l.jsx)(`defs`,{children:(0,l.jsx)(`clipPath`,{id:`clip-${a}`,children:(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45})})}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:N.track,strokeWidth:10,fill:`none`}),(0,l.jsxs)(`g`,{clipPath:`url(#clip-${a})`,children:[(0,l.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,className:N.fillBg}),(0,l.jsx)(`path`,{ref:i,className:N.wave,d:`M0,${s} Q25,${s-4} 50,${s} T100,${s} V100 H0 Z`})]}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:N.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:N.label,children:[Math.round(o),`%`]})]})},P={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},Be=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:P.liquidGlass,children:(0,l.jsx)(`div`,{className:P.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:P.content,children:e})})}),Ve={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},He=({children:e=`磁吸按钮`,strength:t=.4,color:n=`#6366f1`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,l.jsx)(`div`,{ref:r,className:Ve.magneticButton,onMouseMove:e=>{let n=r.current,a=i.current;if(!n||!a)return;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;a.style.transform=`translate(${l}px, ${u}px)`},onMouseLeave:()=>{let e=i.current;e&&(e.style.transform=`translate(0, 0)`)},children:(0,l.jsx)(`button`,{ref:i,type:`button`,className:Ve.btn,style:{"--btn-color":n},children:e})})},F={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},Ue=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,We=({width:e=800,height:t=500,density:n=.6,color:r=`#00ff41`,showOverlay:i=!0,title:a=`MATRIX`,subtitle:o=`数字雨效果`})=>{let s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=s.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=Math.floor(e/16*n),l=Array.from({length:c},()=>Math.random()*-50),u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{u=requestAnimationFrame(p),!d&&(o.fillStyle=`rgb(0 0 0 / 8%)`,o.fillRect(0,0,e,t),o.font=`16px monospace`,l.forEach((e,i)=>{let a=Ue[Math.floor(Math.random()*53)],s=i/n*16;o.fillStyle=r,o.fillText(a,s,e*16),e*16>t&&Math.random()>.975&&(l[i]=0),l[i]+=1}))};return p(),()=>{cancelAnimationFrame(u),f()}},[r,n,t,e]),(0,l.jsxs)(`div`,{className:F.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:F.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:F.overlay,children:[(0,l.jsx)(`h2`,{className:F.title,children:a}),(0,l.jsx)(`p`,{className:F.subtitle,children:o})]})]})},Ge={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},Ke=({width:e=400,height:t=300,cellSize:n=20,onGenerated:r})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(r);return(0,c.useEffect)(()=>{a.current=r},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let o=window.devicePixelRatio||1;r.width=e*o,r.height=t*o;let s=r.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=Math.floor(e/n),l=Math.floor(t/n),u=Array.from({length:l},()=>Array.from({length:c},()=>({top:!0,right:!0,bottom:!0,left:!0,visited:!1}))),d=[[0,0]];u[0][0].visited=!0;let f=[[0,-1,`top`],[1,0,`right`],[0,1,`bottom`],[-1,0,`left`]],p={top:`bottom`,right:`left`,bottom:`top`,left:`right`};for(;d.length;){let[e,t]=d[d.length-1],n=f.map(([n,r,i])=>{let a=e+n,o=t+r;return a<0||o<0||a>=c||o>=l||u[o][a].visited?null:{nx:a,ny:o,wall:i}}).filter(Boolean);if(!n.length){d.pop();continue}let r=n[Math.floor(Math.random()*n.length)];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])}a.current?.(c,l);let m=0,h=0,g=c*l*2,v=document.hidden,y=_(e=>{v=e}),b=()=>{if(v){m=requestAnimationFrame(b);return}h=Math.min(g,h+2),s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t),s.strokeStyle=`#38bdf8`,s.lineWidth=1.5,s.shadowColor=`#38bdf8`,s.shadowBlur=4;let r=0;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let i=u[e][t],a=t*n,o=e*n;i.top&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a+n,o),s.stroke()),i.right&&r++<h&&(s.beginPath(),s.moveTo(a+n,o),s.lineTo(a+n,o+n),s.stroke()),e===l-1&&i.bottom&&r++<h&&(s.beginPath(),s.moveTo(a,o+n),s.lineTo(a+n,o+n),s.stroke()),t===0&&i.left&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a,o+n),s.stroke())}s.shadowBlur=0,h<g&&(m=requestAnimationFrame(b))};return b(),()=>{cancelAnimationFrame(m),y()}},[n,t,e]),(0,l.jsx)(`div`,{className:Ge.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Ge.canvas,style:{width:e,height:t}})})},qe={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},Je=({width:e=800,height:t=500,meteorCount:n=8})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[t,n,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{a.current=requestAnimationFrame(u),!c&&(s.fillStyle=`rgb(15 23 42 / 15%)`,s.fillRect(0,0,e,t),i.current.forEach(n=>{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);let r=n.x-n.length,i=n.y-n.length*.6;s.beginPath(),s.strokeStyle=`rgb(255 255 255 / ${n.opacity})`,s.lineWidth=2,s.moveTo(n.x,n.y),s.lineTo(r,i),s.stroke(),s.beginPath(),s.fillStyle=`rgb(255 255 255 / ${Math.min(1,n.opacity+.2)})`,s.arc(n.x,n.y,1.5,0,Math.PI*2),s.fill()}))};return u(),()=>{cancelAnimationFrame(a.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:qe.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:qe.canvas,style:{width:e,height:t}})})},I={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},Ye=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:I.neonText,children:[(0,l.jsx)(`h1`,{className:`${I.text} ${r?I.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:I.reflection,style:{fontSize:n*.35,color:t},children:e})]}),L={newtonCradle:`cos-newtonCradle-mFl-b`,frame:`cos-frame-pp818`,pendulum:`cos-pendulum-mC9Bq`,"swing-left":`cos-swing-left-Mf5fy`,"swing-right":`cos-swing-right-gEH1F`,string:`cos-string-UpYWC`,ball:`cos-ball-sj82r`},Xe=({ballCount:e=5,color:t=`#38bdf8`})=>{let n=Math.max(2,Math.min(e,7));return(0,l.jsx)(`div`,{className:L.newtonCradle,style:{"--ball-color":t},children:(0,l.jsx)(`div`,{className:L.frame,children:Array.from({length:n},(e,t)=>(0,l.jsxs)(`div`,{className:L.pendulum,"data-role":t===0?`left`:t===n-1?`right`:`middle`,children:[(0,l.jsx)(`span`,{className:L.string}),(0,l.jsx)(`span`,{className:L.ball})]},t))})})},R={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},Ze=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],Qe=({data:e=Ze,size:t=240})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let r=n.current;if(!r||e.length===0)return;let i=window.devicePixelRatio||1;r.width=t*i,r.height=t*i;let a=r.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0);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=_(e=>{f=e}),m=()=>{if(u=requestAnimationFrame(m),f)return;d+=.012,a.fillStyle=`#0f172a`,a.fillRect(0,0,t,t),e.forEach((e,t)=>{let n=l*(t+1),r=e.value/o,i=v(Math.round(r*12)+1,1,16),u=.4+t*.15;a.beginPath(),a.arc(s,c,n,0,Math.PI*2),a.strokeStyle=`rgb(148 163 184 / 15%)`,a.lineWidth=1,a.stroke();for(let t=0;t<i;t++){let r=d*u+t/i*Math.PI*2,o=s+Math.cos(r)*n,l=c+Math.sin(r)*n;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}});let n=e.reduce((e,t)=>t.value>e.value?t:e,e[0]),r=Math.round(n.value/o*100);a.fillStyle=`#e2e8f0`,a.font=`bold 14px system-ui`,a.textAlign=`center`,a.fillText(`${r}%`,s,c+2),a.font=`10px system-ui`,a.fillStyle=`#94a3b8`,a.fillText(n.label,s,c+16)};return m(),()=>{cancelAnimationFrame(u),p()}},[e,t]),(0,l.jsxs)(`div`,{className:R.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:R.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:R.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:R.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},z={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},$e=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)({x:-1e3,y:-1e3}),d=(0,c.useCallback)(()=>{s.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[t,n,e]);(0,c.useEffect)(()=>{d()},[d]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let c=window.devicePixelRatio||1;n.width=e*c,n.height=t*c;let l=n.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=0,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(f){d=requestAnimationFrame(m);return}l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let n=s.current,o=u.current,c=i*i;n.forEach(n=>{n.x+=n.vx,n.y+=n.vy,(n.x<0||n.x>e)&&(n.vx*=-1),(n.y<0||n.y>t)&&(n.vy*=-1);let r=o.x-n.x,i=o.y-n.y,a=r*r+i*i;if(a<c&&a>0){let e=Math.sqrt(a);n.vx-=r/e*.15,n.vy-=i/e*.15}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let i=n[e].x-n[t].x,o=n[e].y-n[t].y,s=i*i+o*o;if(s<r*r){let i=Math.sqrt(s);l.beginPath(),l.moveTo(n[e].x,n[e].y),l.lineTo(n[t].x,n[t].y),l.strokeStyle=a,l.globalAlpha=1-i/r,l.lineWidth=.8,l.stroke(),l.globalAlpha=1}}n.forEach(e=>{l.beginPath(),l.arc(e.x,e.y,e.radius,0,Math.PI*2),l.fillStyle=a,l.fill()}),d=requestAnimationFrame(m)};return m(),()=>{cancelAnimationFrame(d),p()}},[a,t,d,r,i,e]);let f=(e,t,n)=>{u.current={x:e-n.left,y:t-n.top}},p=e=>{f(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},m=e=>{let t=e.touches[0];t&&f(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},h=()=>{u.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:z.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:z.canvas,style:{width:e,height:t},onMouseMove:p,onMouseLeave:h,onTouchMove:m,onTouchEnd:h}),(0,l.jsx)(`p`,{className:z.hint,children:`移动鼠标或手指与粒子互动`})]})},et={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},tt=({width:e=800,height:t=500,density:n=.5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=Math.floor(20+n*40);i.current=Array.from({length:r},()=>({x:Math.random()*e,y:Math.random()*t,radius:Math.random()*80+40,vx:(Math.random()-.5)*.4,vy:(Math.random()-.5)*.3-.1,alpha:Math.random()*.15+.05}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c+=.008,s.fillStyle=`#1a1a2e`,s.fillRect(0,0,e,t);let n=s.createRadialGradient(e*.5,t*.3,0,e*.5,t*.5,e*.7);n.addColorStop(0,`#2d2d44`),n.addColorStop(1,`#1a1a2e`),s.fillStyle=n,s.fillRect(0,0,e,t),i.current.forEach((n,r)=>{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);let i=s.createRadialGradient(n.x,n.y,0,n.x,n.y,n.radius);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)`),s.fillStyle=i,s.beginPath(),s.arc(n.x,n.y,n.radius,0,Math.PI*2),s.fill()})};return d(),()=>{cancelAnimationFrame(a.current),u()}},[t,e]),(0,l.jsx)(`div`,{className:et.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:et.canvas,style:{width:e,height:t}})})},nt={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},rt=({width:e=800,height:t=500,mode:n=`snow`,count:r=120})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(r=>({x:Math.random()*e,y:r??Math.random()*t,size:n===`sakura`?Math.random()*6+4:Math.random()*3+1,speed:Math.random()*1.5+.5,drift:(Math.random()-.5)*.8,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,opacity:Math.random()*.6+.4}),[t,n,e]);return(0,c.useEffect)(()=>{a.current=Array.from({length:r},()=>s())},[r,s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=document.hidden,d=_(e=>{u=e}),f=e=>{l.globalAlpha=e.opacity,l.fillStyle=`#fff`,l.beginPath(),l.arc(e.x,e.y,e.size,0,Math.PI*2),l.fill()},p=e=>{l.save(),l.translate(e.x,e.y),l.rotate(e.rotation),l.globalAlpha=e.opacity;let t=e.size;l.fillStyle=`#ffb7c5`,l.beginPath(),l.ellipse(0,0,t,t*.6,0,0,Math.PI*2),l.fill(),l.fillStyle=`#ff8fa3`,l.beginPath(),l.ellipse(t*.3,0,t*.5,t*.35,.5,0,Math.PI*2),l.fill(),l.restore()},m=()=>{o.current=requestAnimationFrame(m),!u&&(l.fillStyle=n===`sakura`?`#1a1020`:`#0f172a`,l.fillRect(0,0,e,t),a.current.forEach(e=>{e.y+=e.speed,e.x+=e.drift+Math.sin(e.y*.02)*.3,e.rotation+=e.rotationSpeed,e.y>t+10&&Object.assign(e,s(-10)),n===`sakura`?p(e):f(e)}),l.globalAlpha=1)};return m(),()=>{cancelAnimationFrame(o.current),d()}},[s,t,n,e]),(0,l.jsx)(`div`,{className:nt.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:nt.canvas,style:{width:e,height:t}})})},it={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},at=({width:e=800,height:t=500,starCount:n=400,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({x:(Math.random()-.5)*e,y:(Math.random()-.5)*t,z:Math.random()*e}))},[t,n,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=t*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(c.fillStyle=`rgb(0 0 0 / 25%)`,c.fillRect(0,0,e,t),a.current.forEach(n=>{n.z-=r*2,n.z<=0&&(n.x=(Math.random()-.5)*e,n.y=(Math.random()-.5)*t,n.z=e);let i=128/n.z,a=n.x*i+l,o=n.y*i+u;if(a<0||a>=e||o<0||o>=t)return;let s=(1-n.z/e)*3,d=(1-n.z/e)*255;if(s>.5){let e=128/(n.z+r*4),t=n.x*e+l,i=n.y*e+u;c.beginPath(),c.strokeStyle=`rgb(${d} ${d} ${d+30})`,c.lineWidth=s,c.moveTo(t,i),c.lineTo(a,o),c.stroke()}else c.fillStyle=`rgb(${d} ${d} ${d+30})`,c.fillRect(a,o,s,s)}))};return p(),()=>{cancelAnimationFrame(o.current),f()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:it.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:it.canvas,style:{width:e,height:t}})})},B={progressChest:`cos-progressChest-Bqcv1`,barWrap:`cos-barWrap-E2pnl`,barTrack:`cos-barTrack-dKLhs`,barFill:`cos-barFill-NZJJe`,pct:`cos-pct-D91IU`,chest:`cos-chest-YebJO`,lid:`cos-lid-K4GSD`,open:`cos-open-eWo0Y`,lidTop:`cos-lidTop-N-p2g`,lock:`cos-lock--0AaQ`,body:`cos-body-iqUt3`,treasure:`cos-treasure-nx-6S`,pop:`cos-pop-uRZvT`,label:`cos-label-61hRe`},ot=({progress:e=0,onOpen:t,label:n=`开启宝箱`})=>{let r=(0,c.useRef)(!1),i=(0,c.useRef)(t),a=v(e,0,100),o=a>=100;return(0,c.useEffect)(()=>{i.current=t},[t]),(0,c.useEffect)(()=>{o&&!r.current&&(r.current=!0,i.current?.()),o||(r.current=!1)},[o]),(0,l.jsxs)(`div`,{className:B.progressChest,children:[(0,l.jsxs)(`div`,{className:B.barWrap,children:[(0,l.jsx)(`div`,{className:B.barTrack,children:(0,l.jsx)(`div`,{className:B.barFill,style:{width:`${a}%`}})}),(0,l.jsxs)(`span`,{className:B.pct,children:[a.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${B.chest} ${o?B.open:``}`,children:[(0,l.jsxs)(`div`,{className:B.lid,children:[(0,l.jsx)(`div`,{className:B.lidTop}),(0,l.jsx)(`div`,{className:B.lock})]}),(0,l.jsx)(`div`,{className:B.body,children:o&&(0,l.jsxs)(`div`,{className:B.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:B.label,children:o?`宝箱已开启!`:n})]})},st={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},ct=({size:e=300,color:t=`#22d3ee`,blipCount:n=5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(0),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({angle:Math.random()*Math.PI*2,dist:Math.random()*.7+.15,alpha:Math.random()*.5+.5}))},[n]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=e*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=e/2,d=e/2-10,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(o.current=requestAnimationFrame(m),f)return;i.current+=.03,c.fillStyle=`rgb(15 23 42 / 25%)`,c.fillRect(0,0,e,e);for(let e=1;e<=4;e++)c.beginPath(),c.arc(l,u,d/4*e,0,Math.PI*2),c.strokeStyle=`${t}33`,c.lineWidth=1,c.stroke();c.beginPath(),c.moveTo(l,u-d),c.lineTo(l,u+d),c.moveTo(l-d,u),c.lineTo(l+d,u),c.strokeStyle=`${t}44`,c.stroke();let n=i.current,r=c.createConicGradient(n-.5,l,u);r.addColorStop(0,`transparent`),r.addColorStop(.15,`${t}66`),r.addColorStop(.3,`transparent`),c.beginPath(),c.moveTo(l,u),c.arc(l,u,d,n-.5,n),c.closePath(),c.fillStyle=r,c.fill(),c.beginPath(),c.moveTo(l,u),c.lineTo(l+Math.cos(n)*d,u+Math.sin(n)*d),c.strokeStyle=t,c.lineWidth=2,c.stroke(),a.current.forEach(e=>{let r=e.angle,i=l+Math.cos(r)*d*e.dist,a=u+Math.sin(r)*d*e.dist;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),c.beginPath(),c.arc(i,a,4,0,Math.PI*2),c.fillStyle=t,c.globalAlpha=e.alpha,c.fill(),c.globalAlpha=1}),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=t,c.lineWidth=2,c.stroke()};return m(),()=>{cancelAnimationFrame(o.current),p()}},[n,t,e]),(0,l.jsx)(`div`,{className:st.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:st.canvas,style:{width:e,height:e}})})},V={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},lt=({duration:e=1e4,onGrab:t})=>{let n=(0,c.useRef)(null),r=(0,c.useRef)([]),i=(0,c.useRef)(0),a=(0,c.useRef)(0),o=(0,c.useRef)(0),[s,u]=(0,c.useState)(0),[d,f]=(0,c.useState)(!0),p=(0,c.useRef)(!0),m=(0,c.useRef)(t);(0,c.useEffect)(()=>{m.current=t},[t]),(0,c.useEffect)(()=>{p.current=d},[d]);let h=(0,c.useCallback)(()=>{r.current.push({id:a.current++,x:Math.random()*350+25,y:-60,speed:Math.random()*2+2,rotation:(Math.random()-.5)*.1,amount:[1,2,5,8,10,18,66,88][Math.floor(Math.random()*8)],grabbed:!1})},[]);return(0,c.useEffect)(()=>{let t=n.current;if(!t)return;let a=window.devicePixelRatio||1;t.width=400*a,t.height=500*a;let s=t.getContext(`2d`);if(!s)return;s.setTransform(a,0,0,a,0,0);let c=document.hidden,l=_(e=>{c=e}),u=window.setTimeout(()=>{p.current=!1,f(!1)},e),d=()=>{i.current=requestAnimationFrame(d),!c&&(o.current++,p.current&&o.current%20==0&&h(),s.fillStyle=`rgb(15 23 42 / 20%)`,s.fillRect(0,0,400,500),r.current=r.current.filter(e=>e.grabbed?!1:(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5,s.save(),s.translate(e.x,e.y),s.rotate(e.rotation),s.fillStyle=`#dc2626`,s.beginPath(),s.roundRect(-22,-28,44,56,6),s.fill(),s.fillStyle=`#fbbf24`,s.beginPath(),s.arc(0,-10,8,0,Math.PI*2),s.fill(),s.fillStyle=`#fde68a`,s.font=`bold 12px system-ui`,s.textAlign=`center`,s.fillText(`¥${e.amount}`,0,12),s.restore(),e.y<560)))};return d(),()=>{cancelAnimationFrame(i.current),clearTimeout(u),l()}},[e,h]),(0,l.jsxs)(`div`,{className:V.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:n,className:V.canvas,style:{width:400,height:500},onClick:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,i=e.clientY-t.top,a=!1;r.current=r.current.map(e=>e.grabbed||a?e:Math.abs(n-e.x)<30&&Math.abs(i-e.y)<35?(a=!0,u(t=>t+e.amount),m.current?.(e.amount),{...e,grabbed:!0}):e)}}),(0,l.jsxs)(`div`,{className:V.hud,children:[(0,l.jsxs)(`span`,{children:[`已抢: ¥`,s]}),!d&&(0,l.jsx)(`span`,{className:V.end,children:`红包雨结束`})]}),(0,l.jsx)(`p`,{className:V.hint,children:`点击红包抢夺`})]})},H={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},ut=({starCount:e,glassCount:t=8,glassRadius:n=150})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=r.current,o=i.current;if(!a||!o)return;let s=[],c=[],l=[],{width:u,height:d}=a.getBoundingClientRect(),f=e??Math.max(20,Math.floor(u/20));for(let e=0;e<f;e++){let e=window.setTimeout(()=>{let e=document.createElement(`div`);e.className=H.star,e.style.top=`${Math.random()*d}px`,e.style.left=`${Math.random()*u}px`,a.append(e),c.push(e)},Math.random()*2e3);s.push(e)}for(let e=0;e<t;e++){let r=document.createElement(`div`);r.className=H.glassItem,r.style.transform=`rotateY(${360/t*e}deg) translateZ(${n}px)`,o.appendChild(r),l.push(r);let i=window.setTimeout(()=>{r.style.top=`0px`,r.style.opacity=`1`},e*300);s.push(i)}return()=>{s.forEach(clearTimeout),c.forEach(e=>e.remove()),l.forEach(e=>e.remove())}},[e,t,n]),(0,l.jsx)(`div`,{ref:r,className:H.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:H.glassWrap})})},U={speedometer:`cos-speedometer-INc7F`,svg:`cos-svg-HG-lE`,track:`cos-track-5-922`,valueArc:`cos-valueArc-eJn3E`,tick:`cos-tick-vaiJh`,needle:`cos-needle-PwRAD`,hub:`cos-hub-4WaHw`,valueText:`cos-valueText--q4Xi`,label:`cos-label-hOPy1`},W=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},dt=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+v(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=W(100,100,72,-120),t=W(100,100,72,120);return`M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`},[]),o=(0,c.useMemo)(()=>{let e=W(100,100,72,-120),t=W(100,100,72,i),n=+(i- -120>180);return`M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`},[i]),s=W(100,100,58,i);return(0,l.jsxs)(`div`,{className:U.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:U.svg,children:[(0,l.jsx)(`path`,{d:a,className:U.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:U.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=W(100,100,58,e),n=W(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:U.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:U.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:U.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:U.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:U.label,children:n})]})},G={timelinePulse:`cos-timelinePulse-kcBM6`,axis:`cos-axis-9DWis`,track:`cos-track-jG-HV`,progress:`cos-progress-gf7v1`,steps:`cos-steps-Z-40O`,step:`cos-step-UO2Ux`,dot:`cos-dot-HJEVy`,pulse:`cos-pulse-N6FD1`,name:`cos-name-7zefJ`},ft=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=v(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:G.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:G.axis,children:[(0,l.jsx)(`div`,{className:G.track}),(0,l.jsx)(`div`,{className:G.progress}),(0,l.jsx)(`ul`,{className:G.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:G.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:G.dot}),(0,l.jsx)(`span`,{className:G.name,children:e})]},e+t)})})]})})},K={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},pt=({width:e=800,height:t=500,color:n=`#38bdf8`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0),o=(0,c.useCallback)((n,a)=>{let o=r.current;if(!o)return;let s=o.getBoundingClientRect(),c=n-s.left,l=a-s.top,u=Math.max(e,t)*.45;i.current.push({x:c,y:l,radius:0,maxRadius:u,alpha:.7})},[t,e]);return(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>o(e.clientX,e.clientY),n=e=>{let t=e.touches[0];t&&o(t.clientX,t.clientY)};return e.addEventListener(`click`,t),e.addEventListener(`touchstart`,n,{passive:!0}),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`touchstart`,n)}},[o]),(0,c.useEffect)(()=>{let o=r.current;if(!o)return;let s=window.devicePixelRatio||1;o.width=e*s,o.height=t*s;let c=o.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c.fillStyle=`#0c1929`,c.fillRect(0,0,e,t);let r=c.createLinearGradient(0,0,0,t);r.addColorStop(0,`#0f2744`),r.addColorStop(1,`#061018`),c.fillStyle=r,c.fillRect(0,0,e,t),i.current=i.current.filter(e=>(e.radius+=2.5,e.alpha-=.012,e.alpha<=0?!1:(c.beginPath(),c.arc(e.x,e.y,e.radius,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*(1-e.radius/e.maxRadius),c.lineWidth=2,c.stroke(),e.radius>8&&(c.beginPath(),c.arc(e.x,e.y,e.radius*.6,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*.4,c.lineWidth=1,c.stroke()),c.globalAlpha=1,!0)))};return d(),()=>{cancelAnimationFrame(a.current),u()}},[n,t,e]),(0,l.jsxs)(`div`,{className:K.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:r,className:K.canvas,style:{width:e,height:t}}),(0,l.jsx)(`span`,{className:K.hint,children:`点击水面产生涟漪`})]})},mt={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},ht=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,gt=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=ht})=>{let[r,i]=(0,c.useState)(``),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=n.length>0?n:ht,s=e;o.current=performance.now();let c=e=>{let n=e-o.current,l=Math.min(n/t,1),u=Math.floor(l*s.length);i(s.split(``).map((e,t)=>e===` `?` `:t<u?e:r[Math.floor(Math.random()*r.length)]).join(``)),l<1?a.current=requestAnimationFrame(c):i(s)};return a.current=requestAnimationFrame(c),()=>cancelAnimationFrame(a.current)},[e,t,n]),(0,l.jsx)(`div`,{className:mt.scrambleText,children:(0,l.jsxs)(`p`,{className:mt.text,children:[r,(0,l.jsx)(`span`,{className:mt.cursor})]})})},q={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},_t=({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,onReveal:n,width:r=300,height:i=180})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(!1),s=(0,c.useRef)(!1),u=(0,c.useRef)(n),[d,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{u.current=n},[n]);let p=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,r,i),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(`刮开涂层`,r/2,i/2)},[e,i,r]),m=(0,c.useCallback)(e=>{if(s.current)return;let t=e.getContext(`2d`);if(!t)return;let n=t.getImageData(0,0,e.width,e.height),r=0;for(let e=3;e<n.data.length;e+=4)n.data[e]<128&&r++;r/(e.width*e.height)>.45&&(s.current=!0,f(!0),u.current?.())},[]);(0,c.useEffect)(()=>{let e=a.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=i*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),p(n))},[p,i,r]);let h=(e,t)=>{let n=a.current;if(!n||s.current)return;let r=n.getContext(`2d`);r&&(r.globalCompositeOperation=`destination-out`,r.beginPath(),r.arc(e,t,20,0,Math.PI*2),r.fill(),m(n))},g=e=>{let t=a.current;if(!t)return null;let n=t.getBoundingClientRect();if(`touches`in e){let t=e.touches[0];return{x:t.clientX-n.left,y:t.clientY-n.top}}return{x:e.clientX-n.left,y:e.clientY-n.top}},_=e=>{o.current=!0;let t=g(e);t&&h(t.x,t.y)},v=e=>{if(!o.current)return;let t=g(e);t&&h(t.x,t.y)},y=()=>{o.current=!1};return(0,l.jsxs)(`div`,{className:q.scratchCard,style:{width:r,height:i},children:[(0,l.jsx)(`div`,{className:q.prize,children:t}),(0,l.jsx)(`canvas`,{ref:a,className:`${q.canvas} ${d?q.hidden:``}`,style:{width:r,height:i},onMouseDown:_,onMouseMove:v,onMouseUp:y,onMouseLeave:y,onTouchStart:_,onTouchMove:v,onTouchEnd:y})]})},J={slotMachine:`cos-slotMachine-P6FyZ`,machine:`cos-machine-B066r`,reel:`cos-reel-eEpJ3`,strip:`cos-strip-L5Z-a`,item:`cos-item-WYJ6q`,mask:`cos-mask-jdrj3`,spinBtn:`cos-spinBtn-DvDE7`,result:`cos-result-dLN5b`},vt=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],yt=e=>1-(1-e)**3,bt=({symbols:e=vt,onSpinEnd:t})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)([0,0,0]),[o,s]=(0,c.useState)([]),u=(0,c.useRef)(0),d=(0,c.useRef)(t),f=(0,c.useRef)(null);(0,c.useEffect)(()=>{d.current=t},[t]);let p=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<20;n++)t.push(...e);return t},[e])();return(0,c.useEffect)(()=>()=>{f.current&&(f.current.cancelled=!0),cancelAnimationFrame(u.current)},[]),(0,l.jsxs)(`div`,{className:J.slotMachine,children:[(0,l.jsx)(`div`,{className:J.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:J.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:J.strip,style:{transform:`translateY(${i[e]}px)`},children:p.map((e,t)=>(0,l.jsx)(`div`,{className:J.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:J.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:J.spinBtn,onClick:()=>{if(n)return;r(!0),s([]);let t=[0,1,2].map(()=>Math.floor(Math.random()*e.length)),o=t.map(t=>-(t-1+e.length*10)*80),c=[...i],l=2e3,p=[0,300,600],m=performance.now(),h={cancelled:!1};f.current=h;let g=n=>{if(!h.cancelled){if(a(c.map((e,t)=>{let r=n-m-p[t];if(r<0)return e;let i=yt(Math.min(r/l,1));return e+(o[t]-e)*i})),!p.every(e=>n-m-e>=l))u.current=requestAnimationFrame(g);else if(!h.cancelled){let n=t.map(t=>e[t]);s(n),r(!1),d.current?.(n)}}};u.current=requestAnimationFrame(g)},disabled:n,children:n?`旋转中...`:`开始`}),o.length>0&&!n&&(0,l.jsx)(`p`,{className:J.result,children:o[0]===o[1]&&o[1]===o[2]?`🎰 大奖!`:`结果: ${o.join(` `)}`})]})},Y={splitReveal:`cos-splitReveal-6W8-6`,text:`cos-text-miTsj`,char:`cos-char-0gPJV`,reveal:`cos-reveal-YGzz-`,fromTop:`cos-fromTop-YXHUa`,fromBottom:`cos-fromBottom-24D6g`,fromLeft:`cos-fromLeft-OMiPY`,fromRight:`cos-fromRight-EcMOR`},xt=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],St=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:Y.splitReveal,children:(0,l.jsx)(`h1`,{className:Y.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${Y.char} ${Y[xt[n%xt.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),X={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},Ct=({children:e,radius:t=120,dimColor:n=`rgba(0, 0, 0, 0.85)`})=>{let r=(0,c.useRef)(null),i=(0,c.useCallback)(e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top;t.style.setProperty(`--spot-x`,`${i}px`),t.style.setProperty(`--spot-y`,`${a}px`)},[]);return(0,l.jsxs)(`div`,{ref:r,className:X.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:X.content,children:e}),(0,l.jsx)(`div`,{className:X.overlay})]})},Z={turntable:`cos-turntable-dkc32`,wheelWrap:`cos-wheelWrap-n7lhc`,canvas:`cos-canvas-A1-4x`,pointer:`cos-pointer-Rk1S9`,spinBtn:`cos-spinBtn-l9JIC`,result:`cos-result-H8q2c`,"fade-in":`cos-fade-in-U9bUC`},wt=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Tt=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Et=e=>1-(1-e)**3,Dt=({prizes:e=Tt,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,onSpinEnd:a})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(null),g=(0,c.useRef)(a),_=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=a},[a]);let v=t+48,y=(e,t)=>t.color??wt[e%wt.length],b=(0,c.useCallback)(n=>{let r=o.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=v/2,s=t/2,c=Math.PI*2/e.length;i.clearRect(0,0,v,v),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*c-Math.PI/2,a=r+c,o=y(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,s,r,a),i.closePath(),i.fillStyle=o,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+c/2),i.textAlign=`right`,i.fillStyle=`#fff`,i.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,i.shadowColor=`rgb(0 0 0 / 30%)`,i.shadowBlur=4,i.fillText(e.label,s-18,6),i.restore()}),i.beginPath(),i.arc(0,0,s,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,s-4,0,Math.PI*2),i.strokeStyle=`#f59e0b`,i.lineWidth=2,i.stroke(),i.restore(),i.save(),i.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(s+14),r=Math.sin(t)*(s+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[v,e,t]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;d.current=t,e.width=v*t,e.height=v*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),b(s.current)},[v,b]),(0,c.useEffect)(()=>()=>{_.current&&(_.current.cancelled=!0),u.current&&cancelAnimationFrame(u.current)},[]);let x=t=>{let n=360/e.length,r=(180/Math.PI*t%360+360)%360;return Math.floor((360-r+n/2)%360/n)%e.length};return(0,l.jsxs)(`div`,{className:Z.turntable,style:{width:v,height:v+80},children:[(0,l.jsxs)(`div`,{className:Z.wheelWrap,style:{width:v,height:v},children:[(0,l.jsx)(`div`,{className:Z.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:Z.canvas,style:{width:v,height:v}}),(0,l.jsx)(`button`,{type:`button`,className:Z.spinBtn,onClick:()=>{if(f||e.length===0)return;p(!0),h(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,a=s.current,o=a+r*Math.PI*2+(Math.PI*2-i)-a%(Math.PI*2),c=a,l=performance.now(),d={cancelled:!1};_.current=d;let m=t=>{if(d.cancelled)return;let r=t-l,i=Math.min(r/n,1),a=Et(i),f=c+(o-c)*a;if(s.current=f,b(f),i<1)u.current=requestAnimationFrame(m);else if(!d.cancelled){let t=x(f),n=e[t];s.current=f,p(!1),h(n),g.current?.(n,t)}};u.current=requestAnimationFrame(m)},disabled:f,children:f?`抽奖中...`:i})]}),m&&!f&&(0,l.jsxs)(`p`,{className:Z.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Q={typewriter:`cos-typewriter-7UhOL`,terminal:`cos-terminal-NWNVN`,dots:`cos-dots-oulNg`,text:`cos-text-ICV5T`,prompt:`cos-prompt-Y4hVD`,cursor:`cos-cursor-m8hGi`,blink:`cos-blink-XykM7`},Ot=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],kt=({texts:e,speed:t,deleteSpeed:n,pause:r})=>{let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let c=e[o%e.length],l;if(!u&&i===c)l=setTimeout(()=>d(!0),r);else if(u&&i===``)l=setTimeout(()=>{d(!1),s(t=>(t+1)%e.length)},0);else{let e=u?c.slice(0,i.length-1):c.slice(0,i.length+1);l=setTimeout(()=>a(e),u?n:t)}return()=>clearTimeout(l)},[i,u,o,e,t,n,r]),(0,l.jsx)(`div`,{className:Q.typewriter,children:(0,l.jsxs)(`div`,{className:Q.terminal,children:[(0,l.jsxs)(`div`,{className:Q.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Q.text,children:[(0,l.jsx)(`span`,{className:Q.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Q.cursor,children:`|`})]})]})})},At=({texts:e=Ot,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Ot;return(0,l.jsx)(kt,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},$={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},jt=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:$.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${$.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:$.wave}),(0,l.jsx)(`span`,{className:$.wave}),(0,l.jsx)(`span`,{className:$.label,children:e})]})}),Mt={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},Nt=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:Mt.waveText,children:(0,l.jsx)(`h1`,{className:Mt.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:Mt.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=b,exports.Aurora=g,exports.BarcodeScan=d,exports.BurnAway=p,exports.CanvasClock=S,exports.Charge=ne,exports.ClickSpark=re,exports.Confetti=se,exports.Countdown=pe,exports.CursorTrail=ve,exports.CyberGrid=le,exports.DiceRoll=be,exports.DnaHelix=he,exports.ElectricArc=_e,exports.Fireworks=Ee,exports.FlipCounter=ke,exports.GlitchText=Pe,exports.GradientFlow=Me,exports.GravityBalls=Le,exports.HolographicCard=Re,exports.LiquidGlass=Be,exports.LiquidProgress=ze,exports.MagneticButton=He,exports.MatrixRain=We,exports.MazeGenerator=Ke,exports.MeteorRain=Je,exports.NeonText=Ye,exports.NewtonCradle=Xe,exports.OrbitalChart=Qe,exports.ParticleNetwork=$e,exports.ProgressChest=ot,exports.RadarScan=ct,exports.RedPacketRain=lt,exports.ReturnCity=ut,exports.RippleWater=pt,exports.ScrambleText=gt,exports.ScratchCard=_t,exports.SlotMachine=bt,exports.SmokeFog=tt,exports.Snowfall=rt,exports.Speedometer=dt,exports.SplitReveal=St,exports.Spotlight=Ct,exports.Starfield=at,exports.TimelinePulse=ft,exports.Turntable=Dt,exports.Typewriter=At,exports.WaveButton=jt,exports.WaveText=Nt;
|